1 2005-10-07 Raja R Harinath <rharinath@novell.com>
4 * convert.cs (ImplicitConversionStandard): Move conversion of
5 void* to arbitrary pointer types ...
6 (ExplicitConversionStandard): .. here.
7 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
8 error to always print typenames.
10 2005-10-07 Raja R Harinath <rharinath@novell.com>
12 * convert.cs (GetConversionOperator): Rename from
13 GetConversionOperators. Move operator selection code from ...
14 (UserDefinedConversion): ... here.
16 2005-10-06 Marek Safar <marek.safar@seznam.cz>
18 * convert.cs (ExplicitConversionCore): Removed duplicate enum
21 2005-10-05 Marek Safar <marek.safar@seznam.cz>
23 * assign.cs (Assign.DoResolve): Error method changed.
25 * cfold.cs (DoConstantNumericPromotions): Error method changed.
27 * const.cs (ResolveValue): Reset in_transit immediately.
29 * constant.cs: Error method changed.
31 * convert.cs: Removed useless location parameter.
32 (ExplicitNumericConversion): Don't do double enum check.
33 (ExplicitConversionCore): Renamed from ExplicitConversion.
34 (ExplicitUnsafe): Extracted from ExplicitConversion.
35 (ExplicitConversion): Uses for error reporting.
37 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
39 (ResolveBoolean): Uses common error method.
40 (CastToDecimal): Get rid of ec.
41 (CastFromDecimal): Optimized.
42 (ConvCast): Get rid of ec.
44 * enum.cs (ResolveValue): Reset in_transit immediately.
45 (Emit): Return after first error.
47 * expression.cs: Convert changes.
49 * literal.cs: Error method changed.
51 * statement.cs: Error method changed.
53 2005-10-03 Raja R Harinath <rharinath@novell.com>
55 * support.cs (SeekableStreamReader.Position): Don't error out when
56 the requested position is just beyond the end of the current
59 2005-09-28 Raja R Harinath <rharinath@novell.com>
61 * support.cs (SeekableStreamReader): Simplify drastically. Don't
62 try to keep in sync with the byte count of the underlying Stream.
63 However, this limits us to a window size of 2048 characters: i.e.,
64 the maximum lookahead of our lexer/parser can be 2048 characters.
66 2005-09-28 Marek Safar <marek.safar@seznam.cz>
69 * driver.cs: Fix compilation files with full root path.
71 2005-09-25 Miguel de Icaza <miguel@novell.com>
73 * report.cs (SymbolRelatedToPreviousError): Format the output so
74 it does not use an open parenthesis that is never closed.
76 * driver.cs: Follow coding guidelines
78 2005-09-27 Marek Safar <marek.safar@seznam.cz>
81 * const.cs (Const.ResolveValue): Check for assigning non-null
82 value to reference type.
84 2005-09-27 Marek Safar <marek.safar@seznam.cz>
86 * anonymous.cs: Implemented ExprClassName.
88 * assign.cs (Assign.DoResolve): Don't chrash when type is not
91 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
94 * class.cs (StaticClass.DefineContainerMembers): Report protected
97 * codegen.cs: if(ed) PRODUCTION.
99 * convert.cs (Error_CannotImplicitConversion): Better error
102 * cs-parser.jay: More error checks.
104 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
106 * driver.cs (CSCParseOption): Enabled wrong option check.
108 * ecore.cs (Expression.ExprClassName): Turned to property.
109 (MemberExpr.CheckIntermediateModification): For checking boxed
110 value types modification.
112 * statement.cs (Fixed.Resolve): Expression type must be
113 convertible to fixed type.
114 (CollectionForeach.GetEnumeratorFilter,TryType):
115 Small refactoring for easier error checking.
117 2005-09-26 Marek Safar <marek.safar@seznam.cz>
119 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
122 * class.cs (GeneratedBaseInitializer): New class for customization
123 compiler generated initializers.
124 (MemberBase.DoDefine): Check Obsolete attribute here.
125 (FieldMember.DoDefine): Ditto.
127 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
130 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
131 (MemberCore.GetObsoleteAttribute): Removed argument.
132 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
133 (MemberCore.CheckObsoleteType): New helper.
137 * statement.cs: Updates after MemberCore changes.
139 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
140 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
142 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
143 obsolete attribute for compiler construct.
144 (As.DoResolve): Cache result.
146 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
148 2005-09-26 Raja R Harinath <rharinath@novell.com>
151 * expression.cs (This.VerifyFixed): In a value type T, the type of
152 'this' is T&, iow, 'this' is either an out or ref parameter. In a
153 value type R, 'this' is treated as a value parameter.
155 2005-09-22 Miguel de Icaza <miguel@novell.com>
157 * statement.cs (Lock): Use the TemporaryVariable class instead of
158 manually using local variables as those do not work when variables
161 * ecore.cs: Moved the TemporaryVariable class from being a nested
162 class inside Foreach to be a public class that can be employed in
165 2005-09-19 Marek Safar <marek.safar@seznam.cz>
167 * cs-parser.jay: interface_accessors replaced by
168 accessor_declarations.
170 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
173 * statement.cs (GotoCase.Resolve): Convert null constant to
175 (SwitchLabel.ResolveAndReduce): Ditto.
176 (SwitchLabel.NullStringCase): Custom null stamp.
177 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
179 typemanager.cs (CSharpSignature): Don't skip first argument
182 2005-09-18 Miguel de Icaza <miguel@novell.com>
184 * driver.cs: Set InEmacs based on the environment variable EMACS.
186 * location.cs (InEmacs): in this mode, do not report column
187 location as it confuses Emacs.
189 2005-09-16 Marek Safar <marek.safar@seznam.cz>
191 * cfold.cs, constant.cs, convert.cs, ecore.cs,
192 expression.cs, iterators.cs, literal.cs: Store constants and
195 * class.cs (MemberBase.ShortName): Pass location.
197 * cs-parser.jay: Some location fixes.
199 * ecore.cs (Expression.Location): Made virtual.
201 2005-09-05 Miguel de Icaza <miguel@novell.com>
203 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
204 if the underlying types are the same, otherwise we need to produce
205 code that will do the proper cast.
207 This was exposed by Marek's constant rewrite which produced
208 invalid code for the call site:
215 This fixes test-49.cs
217 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
219 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
220 Type/Object should be allowed as well. Fixed bug #75968.
222 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
224 * expression.cs : (Binary.DoResolve): when one is enum constant and
225 another is constant 0, then return enum one *as enum type*.
228 2005-09-02 Raja R Harinath <rharinath@novell.com>
230 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
234 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
235 flow-branching for LocalVariableReferences in case we were invoked
237 * expression.cs (LocalVariableReference.VerifyAssigned): New.
239 (LocalVariableReference.DoResolveBase): ... this.
240 (MemberAccess.Resolve): Do the check that was disabled during
243 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
246 (PartialContainer.Create): check abstract/sealed/static strictly
247 but abstract/sealed can exist only at one side. Fixed bug #75883.
249 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
252 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
253 specified, don't default to UnmanagedType.I4.
255 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
257 * expression.cs : conditional operator should check possibly
258 incorrect assign expression. Fixed bug #75946.
260 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
262 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
263 Reverting the change. gmcs is much complex than mcs on this matter.
265 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
267 * cs-tokenizer.cs : To read another token ahead of the actual
268 consumption, use new SavedToken and cache token instead of moving
269 back the stream with SeekableStreamReader (it seemed problematic).
271 driver.cs : Thus use StreamReader directly.
272 * support.cs : Thus removed SeekableStreamReader.
274 2005-08-30 Raja R Harinath <rharinath@novell.com>
277 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
278 (ScopeInfo.EmitScopeType): Use it to construct field names from
279 names of captured locals.
282 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
283 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
284 Pass 'target_type' to BoxedCast. Don't default to 'object'.
285 (ExplicitConversion): Remove enum cases already handled by
286 implicit conversion. Move implicit conversion check to the beginning.
287 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
288 * expression.cs (ArrayCreation.EmitDynamicInitializers):
289 Don't treat System.Enum as a struct.
291 2005-08-30 Jb Evain <jbevain@gmail.com>
293 * attribute.cs: handles as expression in parameters.
295 2005-08-30 Raja R Harinath <rharinath@novell.com>
298 * class.cs (TypeContainer.VerifyClsName): Don't use a
299 PartialContainer when verifying CLS compliance.
300 (AbstractPropertyEventMethod): Set Parent here, ...
301 (PropertyMethod): ... not here.
303 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
305 * attribute.cs : escaped attribute name should not be allowed to be
306 resolved (e.g. @class as classAttribute). Fixed bug #75930.
308 2005-08-29 Raja R Harinath <rharinath@novell.com>
311 * convert.cs (ImplicitStandardConversionExists): Allow zero also
312 when converting a long constant to unsigned long.
313 * expression.cs (Invocation.OverloadResolve): Add sanity check to
314 detect where IsApplicable and VerifyArgumentsCompat disagree.
316 2005-08-29 Raja R Harinath <rharinath@novell.com>
317 and Carlos Alberto Cortez <carlos@unixmexico.org>
320 * class.cs (TypeContainer.CanElideInitializer): New helper.
321 (TypeContainer.EmitFieldInitializers): Use it to determine if we
322 can safely emitting the initializer of a field.
324 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
326 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
327 allowed inside a switch (without loop). Fixed bug #75433.
329 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
331 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
332 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
334 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
336 * driver.cs : kinda reverting the default encoding changes (not exact
337 revert since I noticed that "codepage:reset" might not work fine).
339 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
341 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
342 Location. Now getter and setter store location correctly.
343 (errors/cs0111-12.cs now reports the expected location.)
345 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
347 * driver.cs : Use default encoding on the environment.
348 Removed (now that) extra parameter for SeekableStreamReader.
349 * support.cs : (SeekableStreamReader) third .ctor() argument for
350 StreamReader is not required (always true). preamble size could
351 be acquired in simpler and safe way.
353 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
355 * cs-parser.jay: report CS0642 at warning level 3
356 and report CS0642 for an if else statement also
357 fixes bug #74745. Patch by John Luke (and a bit
359 Removed extra CS0642 warning check for "while",
361 * statement.cs: In Block.Resolve(), CS0642 check
362 is reimplemented to check a sequence of an empty
363 statement and a block.
367 2005-08-24 Marek Safar <marek.safar@seznam.cz>
369 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
370 detection until I fix it.
372 * cs-tokenizer.cs: Changed error message.
374 * cs-parser.jay: Fixed 2 error locations.
376 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
377 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
380 * enum.cs (GetSignatureForError): Fixed.
382 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
386 * typemanager.cs (RegisterProperty): Removed.
388 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
390 2005-08-24 Raja R Harinath <rharinath@novell.com>
393 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
394 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
396 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
398 * expression.cs : tiny fix is required for not warning positive ulong.
401 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
403 * expression.cs : add CS0652 check for constant and integral
404 expression. Fixed bug #53974.
406 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
408 * expression.cs : in DoNumericPromotions(), check if there is implicit
409 conversion overload for string (to check CS0034). Fixed bug #52492.
411 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
413 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
415 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
417 * ecore.cs : report location when it is *not* Null.
419 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
425 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
426 correctly. Fixed bug #75721.
428 2005-08-23 Raja R Harinath <rharinath@novell.com>
430 * support.cs (SeekableStreamReader.Position): Avoid an expensive
431 loop that performs 'min (pos, char_count)'.
434 * expression.cs (Unary.ResolveOperator): Don't discard implicit
435 converted value in Operator.OnesComplement.
437 2005-08-22 Ben Maurer <bmaurer@ximian.com>
439 * anonymous.cs: If the anon method is pulled into a helper class,
440 it needs to be `internal' not `private'. Fixes runtime behavior on
443 2005-08-20 Martin Baulig <martin@ximian.com>
445 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
446 scope if we don't already have it.
448 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
449 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
452 2005-08-17 Marek Safar <marek.safar@seznam.cz>
455 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
458 2005-08-16 Marek Safar <marek.safar@seznam.cz>
460 The big constants rewrite
461 Fix #75746, #75685 and more
462 As a side effect saved 1MB for MWF ;-)
464 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
465 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
466 enum based for corlib compilation.
468 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
471 * class.cs (FixedField.Define): Use ResolveAsConstant.
473 * const.cs (IConstant): Interface constants and enums.
474 (Const.ResolveValue): New method for constant resolvning.
475 (ExternalConstant): Constants from imported assemblies.
477 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
478 conversion; like enums.
479 (Constant.ToType): Converts this constant to different type.
480 (Constant.Increment): Adds 1.
482 * convert.cs (ImplicitConversionRequired): Simplified.
484 * cs-parser.jay: Create EnumMember directly.
486 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
488 * doc.cs (GenerateEnumDocComment): Removed.
490 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
491 (ConvertIntLiteral): Removed.
492 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
494 * enum.cs (EnumMember): Implement IConstant.
495 (Enum.IsValidEnumConstant): Removed.
496 (Enum.GetNextDefaultValue): Removed.
497 (Enum.FindMembers): Updated.
498 (Enum.GenerateDocComment): Iterate enum members.
500 * expression.cs (Cast.TryReduce): Handle enums correctly.
501 (New.Constantify): Made public.
502 (MemberAccess.DoResolve): Removed contant specific if(s).
504 * literal.cs (NullLiteral): Implement new abstract methods.
506 * statement.cs (GotoCase.Resolve): Use new constant methods.
507 (SwitchLabel.ResolveAndReduce): Use new constant methods.
509 * typemanager.cs (LookupEnum): Removed.
510 (IsEnumType): Fixed to work with corlib.
511 (RegisterConstant): Removed.
512 (LookupConstant): Removed.
513 (GetConstant): Changed to work with IConstant.
515 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
517 * location.cs : Fixed overflown (>255) column number.
519 2005-08-03 Raja R Harinath <rharinath@novell.com>
521 First cut of the qualified-alias-member feature.
522 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
524 * cs-parser.jay (DOUBLE_COLON): New token.
525 (namespace_or_type_name): Add rule for recognizing
526 qualified-alias-members.
527 (primary_expression): Likewise.
528 (element_access): Allow QualifiedAliasMember as a possible
529 type-bearing expression.
530 (local_variable_type, local_variable_pointer_type): Likewise.
531 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
532 aliases in the current and enclosing namespace declarations.
533 (NamespaceEntry.UsingAlias): Add CS0440 warning.
534 * decl.cs (MemberName.is_double_colon): New.
535 (MemberName.MemberName): Add new constructor for alias-member.
536 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
537 * expression.cs (QualifiedAliasMember): New expression type.
539 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
541 * location.cs : it borked when no argument was specified.
543 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
545 * location.cs : tiny ToString() format fix.
547 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
549 * statement.cs : oops, it was missing.
551 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
553 A set of fixes for precise line/column location.
556 "token" field now holds a file/line "delta", a line number offset
557 from the segment, and a column number. See also:
558 http://lists.ximian.com/pipermail/mono-devel-list/2004-
560 Removed static IsNull. Use instance IsNull property instead.
562 For some tokens it stores Location. For Identifier it stores
563 LocatedToken which is a pair of string name and location.
564 Column numbers are adjusted only at getChar().
566 Use Location.ToString() for reporting (it now contains column).
568 Largely modified to use LocatedToken instead of
569 string (IDENTIFIER), and to acquire Location from some tokens.
570 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
571 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
573 Now MemberName holds Location. DeclSpace.ctor() receives Location
574 as a parameter. Removed extra parameters to all derived classes.
575 Replaced Location.IsNull() with instance property.
576 * assign.cs, expression.cs :
577 Added .ctor() overload that omits Location.
579 Added "nameEscaped" flag that indicates the identifier was escaped
580 in the source file. This fixes bug #57047.
582 2005-08-02 Marek Safar <marek.safar@seznam.cz>
584 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
585 New method, looking for lo-case imported cls type.
587 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
590 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
592 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
594 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
596 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
598 Optimized to save 3.5 MB for SWF compilation.
600 2005-08-01 Marek Safar <marek.safar@seznam.cz>
602 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
603 (PartialContainer.Create): Moved logic AddToContainer.
604 (PartialContainer.MarkForDuplicationCheck): Shares name.
606 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
609 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
611 (Namespace.GetSignatureForError): New method.
613 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
614 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
616 2005-08-01 Raja R Harinath <rharinath@novell.com>
619 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
620 member lookup rather than qualifier_type, since qualifier_type can
623 2005-08-01 Marek Safar <marek.safar@seznam.cz>
625 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
628 2005-07-31 Miguel de Icaza <miguel@novell.com>
630 * statement.cs: Copy the local exception into the exception
631 captured local. Fixes 75674
633 2005-07-31 Raja R Harinath <harinath@gmail.com>
636 * expression.cs (Invocation.OverloadResolve): Don't report error
637 CS1501 if error CS1502 has been reported.
638 (New.DoResolve): Delegate CS1501 reporting to
639 Invocation.OverloadResolve.
642 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
643 invariant-meaning-in-block property in an enclosing block if
646 2005-07-29 Marek Safar <marek.safar@seznam.cz>
648 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
649 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
650 (Switch.CheckSwitch): Just save 50kb for SWF.
652 2005-07-27 Martin Baulig <martin@ximian.com>
654 * anonymous.cs (CaptureContext.AddField): Added
655 `AnonymousContainer am' argument; compute its toplevel scope if
656 it's not already computed. Fixes #75649.
658 2005-07-26 Raja R Harinath <rharinath@novell.com>
661 * class.cs (Constructor.Emit): Reset block to null if the block
664 2005-07-25 Marek Safar <marek.safar@seznam.cz>
666 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
668 2005-07-25 Marek Safar <marek.safar@seznam.cz>
670 * class.cs (MethodData.Define): Check whether accessor implementing
673 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
675 2005-07-22 Marek Safar <marek.safar@seznam.cz>
678 * namespace.cs (LookupType): Moved same type check to...
680 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
683 2005-07-21 Raja R Harinath <rharinath@novell.com>
685 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
686 already found a typebuilder.
687 * class.cs (MethodCore.IsDuplicateImplementation): Compare
688 MemberNames, not strings.
690 * const.cs (Error_ExpressionMustBeConst):
691 Rename from Error_EpressionMustBeConst.
692 * const.cs, class.cs, statement.cd: Update.
694 2005-07-21 Marek Safar <marek.safar@seznam.cz>
698 * const.cs (Const.LookupConstantValue): Report missing contant expression
700 (Error_EpressionMustBeConstant): Only one error method.
702 * class.cs, statement.c: Updated.
704 2005-07-20 Raja R Harinath <rharinath@novell.com>
706 * statement.cs (Block.Flags): Add back HasVarargs.
707 (Block.flags): Make protected.
708 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
710 * typemanager.cs (types, typecontainers, user_types): Remove.
711 (UserTypes, TypeContainers): Likewise.
712 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
713 (CleanUp, Reset): Update.
714 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
715 (GetNestedType): Use Type.GetNestedType.
716 (CoreLookupType): Take two arguments, the namespace and the
717 basename of the type. Update to use the Namespace.Lookup
719 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
720 (RealMemberLookup): Use IsNestedChildOf instead of playing with
721 string concatenation and substring matches.
722 * class.cs, enum.cs, delegate.cs: Update to changes.
724 2005-07-20 Marek Safar <marek.safar@seznam.cz>
726 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
727 Expression and made virtual.
729 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
730 (ImplicitStandardConversionExists): Fixed `byte' typo ?
732 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
734 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
737 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
740 2005-07-18 Marek Safar <marek.safar@seznam.cz>
743 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
744 AssemblyCultureAttribute is not used on executable.
747 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
749 2005-07-16 Raja R Harinath <rharinath@novell.com>
752 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
753 New. Reports CS0252/CS0253.
754 Mostly taken from preliminary patch by Duncak Mak.
755 (Binary.DoResolveOperator): Store results of operator lookup.
756 Use them to detect if we need to warn about unintended reference
759 2005-07-15 Raja R Harinath <rharinath@novell.com>
762 * namespace.cs (Namespace.Lookup): Add back location parameter.
763 (Namespace.LookupType): Add CS0436 report. Add location parameter.
764 * delegate.cs, ecore.cs, expression.cs: Update to changes.
766 * codegen.cs (EmitContext.DeclSpace): Make readonly.
767 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
768 (Namespace.LookupType): ... this.
769 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
771 * typemanager.cs (LookupTypeReflection): Remove buggy code that
772 purported to handle pointers.
773 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
776 2005-07-15 Marek Safar <marek.safar@seznam.cz>
778 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
781 2005-07-15 Raja R Harinath <rharinath@novell.com>
783 * namespace.cs (Namespace.Lookup): Drop location parameter.
784 (NamespaceEntry.LookupAlias): Remove. Merge into ...
785 (NamespaceEntry.Lookup): ... this.
786 (NamespaceEntry.Error_AmbiguousTypeReference):
787 Move here from DeclSpace.
788 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
790 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
791 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
792 Move to NamespaceEntry.
793 * delegate.cs, expression.cs: Update to changes.
795 2005-07-14 Marek Safar <marek.safar@seznam.cz>
797 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
798 CheckAttributeType and refactored.
799 (Attribute.ResolvePossibleAttributeType): Changed to reuse
800 ResolveAsTypeTerminal error handling.
801 (ResolveAsTypeTerminal): Introduced because of global attributes extra
803 (GetSignatureForError): Print errors in same way.
806 * codegen.cs: Reflect attribute GetSignatureForError change.
809 * expression.cs: Add silent parameter to ResolveAsTypeStep.
811 * namespace.cs (UsingEntry): Refactored to make fields private.
814 statement.cs: Error_UnexpectedKind has extra parameter.
816 2005-07-14 Raja R Harinath <rharinath@novell.com>
818 * ecore.cs (IAlias): Remove.
819 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
820 that implement the interface.
821 * namespace.cs (Namespace): Likewise.
822 (Namespace.declspaces): Renamed from 'defined_names'.
823 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
824 DeclSpace instead of an IAlias.
825 * tree.cs (Tree.AddDecl): Update.
827 2005-07-12 Raja R Harinath <rharinath@novell.com>
829 * statement.cs (Block.Flags); Remove HasVarargs.
830 (Block.HasVarargs): Move to ToplevelBlock.
831 (Block.ThisVariable, Block.AddThisVariable): Likewise.
832 (Block.Variables): Make protected. Initialize variable hashtable
834 (Block.AddVariable): Update.
835 (Block.Resolve): Update to changes.
836 (ToplevelBlock.HasVarargs): New boolean.
837 (ToplevelBlock.ThisVariable): Move here from Block.
838 (ToplevelBlock.AddThisVariable): Likewise.
839 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
840 * expression.cs (This.ResolveBase): Update to changes.
841 (ArglistAccess.DoResolve): Likewise.
843 2005-07-11 Marek Safar <marek.safar@seznam.cz>
846 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
848 * class.cs (TypeContainer.VerifyMembers): Distinguish between
849 not used and not used & assigned.
850 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
852 2005-07-11 Marek Safar <marek.safar@seznam.cz>
855 * expression.cs (Is.DoResolve): null is never provided type.
857 2005-07-08 Marek Safar <marek.safar@seznam.cz>
860 * cs-parser.jay: Less strict event error rule to catch more errors.
862 2005-07-08 Martin Baulig <martin@ximian.com>
864 Fix test-iter-10.cs - distinguish whether we `yield' in a property
865 gettter (allowed) or setter (not allowed).
867 * class.cs (Accessor): Implement IIteratorContainer.
868 (Accessor.Yields): New public field.
869 (PropertyBase.PropertyMethod.Define): Handle iterators on a
873 (get_accessor_declaration, set_accessor_declaration): Set the
874 `yields' flag on the accessor, not the property.
875 (property_declaration): Do the iterators check on a per-accessor
876 basis and not for the whole property.
878 2005-07-08 Martin Baulig <martin@ximian.com>
880 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
881 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
883 2005-07-07 Marek Safar <marek.safar@seznam.cz>
886 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
887 (ExtractSecurityPermissionSet): Cope with self referencing security
890 * driver.cs (SetOutputFile): Made public property OutputFile.
892 2005-07-07 Raja R Harinath <rharinath@novell.com>
895 * class.cs (TypeContainer.first_nonstatic_field): Rename from
896 has_nonstatic_fields. Make into a FieldBase pointer.
897 (TypeContainer.AddField): Add CS0282 check.
898 (TypeContainer.EmitType): Update.
900 2005-07-06 Miguel de Icaza <miguel@novell.com>
902 * cs-tokenizer.cs (consume_identifier): Do not create strings to
903 compare if they start with __.
905 2005-07-06 Raja R Harinath <rharinath@novell.com>
907 * statement.cs (Switch.SwitchGoverningType): Only look at
908 UserCasts that don't need implicit standard conversions to one of
909 the allowed switch types (Fixes test-322.cs).
910 (LocalInfo.Resolve): Re-enable sanity-test.
912 2005-07-06 Marek Safar <marek.safar@seznam.cz>
914 * cs-tokenizer.cs (consume_identifier): Detect double undescores
916 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
918 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
920 2005-07-06 Raja R Harinath <rharinath@novell.com>
923 * ecore.cs (SimpleName.GetSignatureForError): Add.
924 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
925 (MemberAccess.GetSignatureForError): Add.
927 2005-07-05 Marek Safar <marek.safar@seznam.cz>
929 The big error and warning messages review.
959 * typemanager.cs: Updated.
961 * class.cs: (MethodCore.SetYields): Moved here to share.
962 (PropertyMethod.Define): Moved iterator setup here.
964 * iterators.cs: Add orig_method to have full access to parent
967 2005-07-05 Raja R Harinath <rharinath@novell.com>
969 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
970 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
971 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
972 variable of struct type.
973 * expression.cs (Unary.ResolveOperator): Update to change.
974 (Indirection.VerifyFixed): Likewise.
975 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
976 (ParameterReference.VerifyFixed): Value parameters are fixed.
977 (This.VerifyFixed): Treat 'this' as a value parameter.
978 * statement.cs (LocalInfo.IsFixed): Remove.
980 2005-07-01 Martin Baulig <martin@ximian.com>
982 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
983 `ec.EmitThis ()' to get the correct scope.
985 2005-07-01 Martin Baulig <martin@ximian.com>
987 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
988 instance is a ParameterReference; fixes #75299.
990 2005-07-01 Martin Baulig <martin@ximian.com>
992 Reverted Marek's latest patch (r46725):
993 - it contains structural changes which are neither mentioned in
994 the ChangeLog nor explained anywhere; for example the additional
995 argument of EmitContext's and Iterator's .ctor's and the
996 TypeContainer.DefineMembers() change.
997 - structural changes like this should go in in seperate patches
998 and not be hidden in a huge patch which just seems to affect
1000 a big and hard to understand patch.
1001 - it breaks iterators and causes regressions, for instance in
1004 2005-06-30 Raja R Harinath <rharinath@novell.com>
1007 * expression.cs (Indexers.map): Remove.
1008 (Indexers.Append): Filter out inaccessible setters and getters.
1009 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
1012 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
1014 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
1015 (FieldExpr.Emit, PropertyExpr.Emit): Update.
1016 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
1017 * expression.cs (Invocation.EmitCall): Add CS0120 check.
1019 2005-06-30 Marek Safar <marek.safar@seznam.cz>
1022 * class.cs (FieldBase.GetInitializerExpression): One more field
1025 2005-06-28 Miguel de Icaza <miguel@novell.com>
1027 * pending.cs: Do not define a proxy if the base method is virtual,
1028 it will be picked up by the runtime (bug 75270).
1030 2005-06-08 Martin Baulig <martin@ximian.com>
1032 The big Iterators rewrite :-)
1034 * iterators.cs: Rewrite this to use the anonymous methods framework.
1036 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
1037 before the TypeContainers; see 2test-21.cs.
1040 (TypeContainer.DefineType): Don't create a new EmitContext if we
1041 already have one (this only happens if we're an Iterator).
1042 (TypeContainer.Define): Also call Define() on all our iterators.
1043 (Method.CreateEmitContext): Added support for iterators.
1046 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
1047 (AnonymousContainer.CreateMethodHost): Moved here from
1048 AnonymousMethod and made abstract.
1049 (AnonymousContainer.CreateScopeType): New abstract method.
1050 (AnonymousContainer.IsIterator): New public property.
1051 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
1052 get the ScopeTypeBuilder rather than manually defining it here.
1053 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
1056 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
1057 before RootContext.DefineTypes().
1059 * codegen.cs (EmitContext.RemapToProxy): Removed.
1060 (EmitContext.CurrentAnonymousMethod): Changed type from
1061 AnonymousMethod -> AnonymousContainer.
1062 (EmitContext.ResolveTopBlock): Protect from being called twice.
1063 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
1064 (EmitContext.EmitThis): Removed the iterators hacks; use the
1065 anonymous methods framework for that.
1068 (ToplevelBlock.Container): Make this a property, not a field.
1069 (ToplevelBlock.ReParent): New public method; move the
1070 ToplevelBlock into a new container.
1071 (Foreach.TemporaryVariable): Simplify.
1073 2005-06-05 Martin Baulig <martin@ximian.com>
1075 * statement.cs (LocalInfo.CompilerGenerated): New flag.
1076 (Block.AddTemporaryVariable): New public method; creates a new
1077 `LocalInfo' for a temporary variable.
1078 (Block.EmitMeta): Create the LocalBuilders for all the temporary
1080 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
1081 non-iterator variables.
1083 2005-06-05 Martin Baulig <martin@ximian.com>
1085 * statement.cs (Foreach.TemporaryVariable): Create the
1086 LocalBuilder in the Emit phase and not in Resolve since in some
1087 situations, we don't have an ILGenerator during Resolve; see
1088 2test-19.cs for an example.
1090 2005-06-04 Martin Baulig <martin@ximian.com>
1092 **** Merged r45395 from GCS ****
1094 The big Foreach rewrite - Part II.
1096 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
1097 with `PropertyInfo ienumerator_getcurrent'.
1099 * codegen.cs (VariableStorage): Removed.
1102 (Foreach): Derive from Statement, not ExceptionStatement.
1103 (Foreach.CollectionForeach): New nested class. Moved all the code
1104 dealing with collection foreach here.
1105 (Foreach.ForeachHelperMethods): Removed.
1106 (Foreach.TemporaryVariable): Implement IMemoryLocation.
1108 2005-05-23 Martin Baulig <martin@ximian.com>
1110 * statement.cs (Try.DoResolve): Don't create a `finally' if we
1111 don't need to. Fix #75014.
1113 2005-05-20 Martin Baulig <martin@ximian.com>
1115 Merged r44808 from GMCS.
1117 * class.cs (TypeContainer.CircularDepException): Removed.
1118 (TypeContainer.DefineType): Removed the `InTransit' stuff.
1119 (TypeContainer.CheckRecursiveDefinition): Check for circular class
1120 (CS0146) and interface (CS0529) dependencies here.
1122 2005-06-21 Raja R Harinath <rharinath@novell.com>
1124 * expression.cs (Invocation.EmitCall): Fix initialization
1125 'this_call' to reflect current behaviour. Fix indentation.
1127 * convert.cs (FindMostEncompassedType): Add two trivial special
1128 cases (number_of_types == 0 || number_of_types == 1).
1129 (FindMostEncompasingType): Likewise.
1131 2005-06-17 Raja R Harinath <rharinath@novell.com>
1133 Some cleanups preparing for the fix of #75283.
1134 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
1136 (EventExpr.InstanceResolve): Likewise.
1137 (EventExpr.DoResolve): Remove redundant checks.
1139 2005-06-10 Duncan Mak <duncan@novell.com>
1141 * cs-tokenizer.cs (process_directives): New flag for controlling
1142 the processing of preprocessor directives.
1143 (x_token): After seeing a '#', return Token.NONE instead of going
1144 to handle_preprocessing_directive() when not processing
1145 directives. This avoids unnecessary processing during the token peek in
1150 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
1151 the existing error reporting methods instead of Report.Error.
1153 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
1154 after Raja's rewrite.
1156 2005-06-08 Miguel de Icaza <miguel@novell.com>
1158 * class.cs: Small fix.
1160 2005-06-08 Raja R Harinath <rharinath@novell.com>
1163 * class.cs (GetPartialBases): Fix return value check of
1166 2005-06-07 Raja R Harinath <rharinath@novell.com>
1168 Ensure that partial classes are registered in their enclosing
1169 namespace. Initial part of fix of #75160.
1170 * tree.cs (Tree.RecordDecl): Add new namespace argument.
1171 Register declspace with namespace here, not in
1172 DeclSpace.RecordDecl.
1173 * cs-parser.jay: Pass namespace to RecordDecl.
1174 * class.cs (PartialContainer.Create): Likewise.
1175 (ClassPart.DefineType): New sanity-check. Throws an exception if
1177 * decl.cs (Declspace.RecordDecl): Remove.
1178 * namespace.cs (NamespaceEntry.DefineName): Remove.
1180 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1182 * rootcontext.cs: Reset TargetExt as well.
1184 2005-06-03 Raja R Harinath <rharinath@novell.com>
1186 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1189 2005-06-02 Raja R Harinath <rharinath@novell.com>
1191 Fix #75080, cs0119.cs.
1192 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1194 (Expression.Resolve): ... this. Use it. Remove bogus code
1195 allowing ExprClass.Type and ExprClass.Namespace for
1196 ResolveFlags.VariableOrValue.
1197 (Expression.Resolve) [1-argument variant]: Change default resolve
1198 flags based on language version.
1199 (Expression.Error_UnexpectedKind): Use a simple string array
1200 rather than an ArrayList.
1201 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1203 (TypeOfVoid.DoResolve): Likewise.
1204 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1205 flags argument -- it always has the same value.
1207 2005-05-31 Raja R Harinath <rharinath@novell.com>
1210 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1211 Use it in the error message.
1212 * assign.cs, expression.cs, statement.cs: Update.
1214 2005-05-30 Raja R Harinath <rharinath@novell.com>
1217 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1218 the "almostMatchedMember" case too.
1219 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1220 that failed the accessibility checks to 'almost_match'.
1222 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1224 * attribute.cs: Use internal MethodBuilder methods to set
1225 ExactSpelling and SetLastError on PInvoke methods, instead
1226 of passing them via charset. Fixes #75060.
1228 2005-05-27 Raja R Harinath <rharinath@novell.com>
1230 * parameter.cs (Parameter): Remove TODO comment.
1231 (Parameter.DefineParameter): Remove Location parameter.
1232 (Parameters.LabelParameters): Likewise.
1233 * class.cs (Constructor.Emit): Update to change.
1234 (MethodData.Emit): Likewise.
1235 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1236 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1238 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1241 Removed Parameters.Location and added Parameter.Location instead.
1242 Removed Location parameter from Emit() and GetSignature().
1249 Modified all related calls.
1251 2005-05-26 Raja R Harinath <rharinath@novell.com>
1253 Improve user-defined conversion handling.
1254 * convert.cs (GetConversionOperators): Rewrite. Return only the
1255 applicable operators.
1256 (AddConversionOperators): New. Helper for GetConversionOperators.
1257 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1258 there is only one most encompassed/encompassing type.
1259 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1260 "applicable operator" handling.
1261 (UserConversion): Move cache here from GetConversionOperators.
1262 Directly cache the chosen operator, rather than the whole
1264 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1265 case. Allow conversion of decimal to sbyte and byte too.
1266 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1267 New static methods. Used to avoid allocating EmptyExpressions in
1270 2005-05-24 Duncan Mak <duncan@novell.com>
1272 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1273 another class, used in Convert.ExplicitNumericConversion.
1274 (CastToDecimal): New class, similar to above, but casts to
1275 System.Decimal, used in Convert.ImplicitNumericConversion and also
1276 in explicit convesion from double/float to decimal.
1278 * convert.cs (ImplicitNumericConversion): Handle implicit
1279 conversions to System.Decimal.
1280 (ExplicitNumericConversion): handle explicit conversions to
1285 2005-05-20 Miguel de Icaza <miguel@novell.com>
1287 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1288 know the type at this stage, just break through. Fixes #75008
1290 2005-05-19 Martin Baulig <martin@ximian.com>
1293 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1294 to disable error reporting.
1296 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1297 here since we don't want to report an error; see the new test-336.cs.
1299 2005-05-19 Raja R Harinath <rharinath@novell.com>
1301 * statement.cs (ToplevelBlock.GetParameterReference)
1302 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1303 Move here from class Block.
1304 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1305 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1307 2005-05-18 Martin Baulig <martin@ximian.com>
1312 (FlowBranching.Reachability): Add non-static public And() and Or()
1314 (FlowBranchingSwitch): New class; do the `break_origins' thing
1315 like in FlowBranchingLoop.
1316 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1317 reachability, not just locals and parameters.
1318 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1319 switch; MergeBreakOrigins() now takes care of that.
1321 2005-05-18 Martin Baulig <martin@ximian.com>
1323 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1324 a loop and may leave it, reset the barrier; fixes #74974.
1326 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1328 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1331 * cs-parser.jay: Catch more lexical errors.
1333 * report.cs: Add one more Error method.
1336 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1338 2005-05-17 Martin Baulig <martin@ximian.com>
1340 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1343 2005-05-16 Raja R Harinath <rharinath@novell.com>
1345 Fix test-382.cs. Emit values of decimal constants.
1346 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1348 (TypeContainer.AddField): ... this.
1349 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1350 with initializers to include 'Const's.
1351 (ClassPart.RegisterFieldForInitialization): Forward to
1353 * const.cs (Const.Const): Pass initializer to base class.
1354 (Const.Define): In case of decimal constants, register them for
1355 initialization in a static constructor.
1357 2005-05-14 Martin Baulig <martin@ximian.com>
1359 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1360 do not call ResolveUnreachable() on unreachable statements in
1361 here, see the comment in the source code.
1363 2005-05-13 Raja R Harinath <rharinath@novell.com>
1366 * expression.cs (BinaryResolveOperator): If one of the operands of
1367 an equality comparison is 'null' and the other is a pointer type,
1368 convert the null to a NullPointer.
1369 * convert.cs (ImplicitReferenceConversion): If the expression is a
1370 NullLiteral and the target type is a pointer type, return a
1371 NullPointer instead.
1372 (ImplicitConversionStandard): Likewise.
1374 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1376 * cs-parser.jay: Set readonly context based on special constructs.
1378 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1379 readonly variable error handling.
1381 * rootcontext.cs (EmitCode): Don't verify members when error
1384 * statement.cs (LocalInfo): Add reaodnly context information.
1385 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1387 2005-05-13 Raja R Harinath <rharinath@novell.com>
1389 * statement.cs (Block.Resolve): Revert change below. Modify fix
1390 for #74041 to initialize 'resolved' to false only for explicit
1391 blocks. Fixes #74873.
1393 2005-05-12 Raja R Harinath <harinath@gmail.com>
1396 * typemanager.cs (unmanaged_enclosing_types): New.
1397 (IsUnmanagedType): Avoid infloops by using
1398 'unmanaged_enclosing_types' to talk with recursive invocations.
1400 2005-05-13 Martin Baulig <martin@ximian.com>
1402 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
1403 instance variable, not a local. Fix #74873.
1404 (Block.ResolveUnreachable): Set it to true here.
1406 2005-05-11 Duncan Mak <duncan@novell.com>
1408 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
1409 continuing to process for 'arg'.
1410 (handle_preprocessing_directive): Check the argument of the #endif
1411 directive and report error CS1025 if there are any trailing
1414 According to the C# spec, having even whitespace after the #endif
1415 directive is illegal; however, because we call arg.TrimEnd ()
1416 beforehand, we have the same behavior as csc, allowing whitespace
1417 after the directive.
1421 2005-05-11 Marek Safar <marek.safar@seznam.cz>
1425 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
1426 (Constructor.GetObsoleteAttribute): Implemented correctly.
1428 2005-05-10 Martin Baulig <martin@ximian.com>
1430 * support.cs (ReflectionParameters.ParameterModifier): Use
1431 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
1432 and `ParameterAttributes.In'. Fixes #74884.
1434 2005-05-10 Marek Safar <marek.safar@seznam.cz>
1436 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
1438 * expression.cs (Argument.GetParameterModifier): Turned to property.
1439 (Invocation.Error_InvalidArguments): Add more descriptive errors.
1441 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
1444 2005-05-09 Raja R Harinath <rharinath@novell.com>
1447 * decl.cs (MemberCache.AddMethods): Register override methods,
1448 rather than non-override methods.
1449 * typemanager.cs (RegisterOverride): New.
1450 (IsOverride): Update.
1452 2005-05-09 Marek Safar <marek.safar@seznam.cz>
1456 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
1457 recursive declaration.
1459 * statement.cs (Block.ResolveMeta): Report any error in resolving.
1461 2005-05-06 Marek Safar <marek.safar@seznam.cz>
1463 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
1465 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
1467 2005-05-05 Raja R Harinath <rharinath@novell.com>
1470 * decl.cs (DeclSpace.FamilyAccessible):
1471 Use TypeManager.IsNestedFamilyAccessible.
1473 Fix reopened #64812.
1474 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
1477 2005-05-04 Raja R Harinath <rharinath@novell.com>
1478 Abin Thomas <projectmonokochi@rediffmail.com>
1479 Anoob V E <projectmonokochi@rediffmail.com>
1480 Harilal P R <projectmonokochi@rediffmail.com>
1483 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
1484 allow access to all static members.
1486 2005-05-04 Martin Baulig <martin@ximian.com>
1488 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
1490 2005-05-04 Martin Baulig <martin@ximian.com>
1494 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
1495 section at the end; make things work if `default' is not the last
1498 2005-05-04 Martin Baulig <martin@ximian.com>
1502 * statement.cs (Switch): Replaced the `got_default' field with a
1503 `default_section' one.
1504 (Switch.CheckSwitch): Set `default_section' here.
1505 (Switch.Resolve): If we're a constant switch and the constant is
1506 not found, use the default section.
1508 2005-05-03 Martin Baulig <martin@ximian.com>
1510 * expression.cs (ArrayAccess.EmitGetLength): New public method.
1512 * statement.cs (Foreach.ArrayForeach): New nested class.
1513 (Foreach.TemporaryVariable): New nested class.
1514 (Foreach.EmitArrayForeach): Removed; this is now in the new
1517 2005-05-03 Raja R Harinath <rharinath@novell.com>
1519 * pending.cs (BaseImplements): Move the #74773 fix here. This is
1521 (VerifyPendingMethods): Revert change below.
1523 * typemanager.cs (IsOverride, RegisterNonOverride): New.
1524 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
1525 that used to trigger warning -28. Remove warning -28.
1526 * expression.cs (Invocation.OverloadResolve): Use
1527 TypeManager.IsOverride to distinguish override methods.
1530 * pending.cs (VerifyPendingMethods): If a base type implements the
1531 requested interface, don't bother checking individual methods of
1532 the base type. As a side-effect, this prevents the creation of
1533 unnecessary proxies.
1535 2005-05-02 Martin Baulig <martin@ximian.com>
1539 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1540 Also `And' the locals if the old vector is null.
1541 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
1542 null; in this case we basically reset all the variables.
1544 2005-05-02 Martin Baulig <martin@ximian.com>
1548 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
1549 Added `FlowBranching branching' argument; always `and' the
1550 variables instead of `or'ing them unless we're an infinite loop.
1552 * statement.cs (While.Resolve): Create a new sibling unless we're
1555 2005-05-02 Martin Baulig <martin@ximian.com>
1559 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
1560 arguments; use it instead of creating a new TopLevelBlock.
1561 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
1562 our ConstructorInitializer.
1565 (TopLevelBlock.TopLevelBranching): New public property.
1566 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
1567 and create our `TopLevelBranching'.
1569 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
1570 anonymous method host, use `block.TopLevelBranching' rather than
1571 creating a new branching.
1573 2005-04-20 Miguel de Icaza <miguel@novell.com>
1575 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
1576 a ScopeInfo, if any of the current children is a child of the new
1577 entry, move those children there.
1579 2005-04-30 Martin Baulig <martin@ximian.com>
1581 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
1582 at the beginning of a SwitchSection. Fix #73335.
1584 2005-04-27 Marek Safar <marek.safar@seznam.cz>
1587 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
1589 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
1590 (FieldExpr.DoResolve): Obsolete members are ignored for field
1593 2005-04-26 Marek Safar <marek.safar@seznam.cz>
1595 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
1596 of arrays detection.
1598 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
1600 (Field.VerifyClsCompliance): Volatile fields are not compliant.
1602 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
1605 2005-04-25 Ben Maurer <bmaurer@ximian.com>
1607 * cs-parser.jay: Use the prefered version of -unsafe in error
1610 2005-04-22 Marek Safar <marek.safar@seznam.cz>
1612 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
1615 2005-04-20 John Luke <john.luke@gmail.com>
1617 * driver.cs: fix typo in error message, --outout to --output
1619 2005-04-20 Marek Safar <marek.safar@seznam.cz>
1621 * codegen.cs (InRefOutArgumentResolving): New field.
1623 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
1624 fields outside contructor.
1626 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
1628 2005-04-19 Miguel de Icaza <miguel@novell.com>
1630 * anonymous.cs (CaptureContext.EmitParameterInstance): The
1631 parameter code was not completed ever, so it was not as up-to-date
1632 as local variables. Must finish it.
1634 The bug fix was to compare the Toplevel of the block, not the
1635 current block. Thanks for Ben for pointing this out.
1637 2005-04-19 Raja R Harinath <rharinath@novell.com>
1639 * decl.cs (AddMethods): Use the declaring type of the problem
1640 method to determine if we want to squash a warning.
1642 2005-04-19 Marek Safar <marek.safar@seznam.cz>
1644 * attribute.cs: Removed debug output.
1646 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
1648 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
1651 2005-04-18 Raja R Harinath <rharinath@novell.com>
1654 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
1655 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
1656 all null comparisons against reference types.
1658 2005-04-18 Marek Safar <marek.safar@seznam.cz>
1661 * class.cs (TypeContainer.CircularDepException) New nested
1663 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
1664 (TypeContainer.DefineType): Removed error, reset InTransit before
1666 (Class.DefineType): Throw exception when is in Transit.
1667 Catch exception and report error.
1668 (Struct.DefineType): Throw exception when is in Transit.
1669 Catch exception and report error.
1670 (Interface.DefineType): Throw exception when is in Transit.
1671 Catch exception and report error.
1673 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
1674 handle nested exception handlers.
1676 * flowanalysis.cs (InTryWithCatch): New method, search for try with
1679 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
1680 InFinally and InCatch storage.
1682 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
1683 (Catch.Resolve): Set and Restore ec.InCatch.
1684 (Try.Resolve): Set and Restore ec.InFinally.
1685 (Try.HasCatch): True when try has catch.
1687 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
1689 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
1690 for the same event member, so exclude such cases from warning 419.
1693 2005-04-16 Miguel de Icaza <miguel@novell.com>
1695 * expression.cs (Binary.ResolveOperator): Apply patch from John
1696 Luke to fix bug 59864: operators &, | and ^ on enumerations
1697 require that the same enum type on both sides.
1699 * driver.cs: Add warnings to old flag usage, this is to assist
1700 people who produce Makefiles and hope that the Makefiles will be
1703 * class.cs (TypeContainer.EmitType): Moved the definition of the
1704 special $PRIVATE$ field from the resolve phase to the Emit phase.
1705 During resolve we do not know if we are a struct with
1706 HasExplicitLayout, we know this only after the attributes for the
1709 Set the FieldOffset to zero on the dummy field that we create for
1710 the class. Fixes 74590.
1712 2005-04-16 Raja R Harinath <rharinath@novell.com>
1715 * ecore.cs (PropertyExpr.resolved): New.
1716 (DoResolve): Use it to handle a case of double resolution here.
1717 Handle a case of identical-name-and-type-name.
1718 * expression.cs (ArrayCreation.CheckIndices): Avoid double
1719 resolution by storing the results of expression resolution back
1720 into the "probes" array.
1722 2005-04-15 Raja R Harinath <rharinath@novell.com>
1724 Fix cs0208-7.cs and cs0208-8.cs.
1725 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
1726 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
1727 error reporting to point out the reason a struct is not unmanaged.
1729 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1731 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
1732 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
1734 2005-04-13 Raja R Harinath <rharinath@novell.com>
1737 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
1738 IdenticalNameAndTypeName here.
1739 (EventExpr.InstanceResolve): Likewise.
1741 2005-04-13 Marek Safar <marek.safar@seznam.cz>
1743 C# 2.0 DefaultCharSetAttribute implementation
1745 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
1746 which allows us to set GlobalNamespace for every resolve.
1747 (Attribute.ResolveArguments): Cut from Resolve.
1748 (Attribute.GetCharSetValue): Returns CharSet named argument.
1749 (Attribute.DefinePInvokeMethod): Gets default charset from
1751 (GlobalAttribute.ResolveAsTypeStep): Override.
1752 (GlobalAttribute.ResolveArguments): Override.
1754 * class.cs (TypeAttr): Is protected.
1756 * codegen.cs (ModuleClass.DefaultCharSet): New member.
1757 (ModuleClass.DefaultCharSetType): New memeber.
1758 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
1760 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
1761 charset from module.
1763 * delegate.cs (TypeAttr): Override.
1764 (Delegate.DefineType): Use this TypeAttr.
1766 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
1767 at very early stage (before types are defined) to resolve model
1768 module attributes. It will probably not work with corlib but it
1771 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
1772 charset from module.
1774 * typemanager.cs (default_charset_type): New type.
1776 2005-04-13 Raja R Harinath <rharinath@novell.com>
1778 * decl.cs (MemberCache.AddMethods): Don't warn if
1779 System.Object.Finalize has buggy MethodAttributes.
1781 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
1784 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1786 * doc.cs : detect ambiguous reference to overloaded members.
1787 Fixed bug #71603. MS 1.1 csc does not detect it.
1789 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
1791 * doc.cs : delegates must not be referenced with parameters.
1794 2005-04-12 Miguel de Icaza <miguel@novell.com>
1796 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
1798 2005-04-10 Miguel de Icaza <miguel@novell.com>
1800 * driver.cs (MainDriver): Stop processing if the CLS stage found
1803 (CompilerCallableEntryPoint.InvokeCompiler): Always
1804 reset after execution; Take a TextWriter argument for the
1807 * report.cs: Use the error stream instead of hardcoding stderr.
1809 2005-04-09 Miguel de Icaza <miguel@novell.com>
1811 * class.cs: Reduce code paths to test, too small of an
1812 optimization to make it worth the extra testing. Always perform
1815 2005-04-08 Raja R Harinath <rharinath@novell.com>
1818 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
1819 operators that had errors reported on them.
1821 2005-04-08 Marek Safar <marek.safar@seznam.cz>
1823 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
1825 (Attribute.Resolve): Add named argument type checking.
1827 * class.cs (FixedField.Define): Use IsPrimitiveType
1829 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
1831 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
1832 unsafe parameter types.
1834 * statement.cs (Using.ResolveExpression): Add better error description.
1836 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
1838 2005-04-08 Raja R Harinath <rharinath@novell.com>
1841 * attribute.cs (Attribute.GetAttributeUsage): Resolve
1842 AttributeUsageAttribute in the emitcontext of the attribute class,
1843 not in the emitcontext of the attributable entity it was attached to.
1844 * cs-parser.jay: Use 'current_class', not 'current_container',
1845 when creating a GlobalAttribute.
1847 2005-04-08 Alp Toker <alp@atoker.com>
1849 * pending.cs: The fix to #58413 failed to compile methods implementing
1850 interfaces with/without params modifiers and vice versa, even though
1851 params modifiers aren't part of the signature. Make the modifier check
1852 less strict as in csc.
1854 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
1855 Anoob V E <projectmonokochi@rediffmail.com>
1856 Harilal P R <projectmonokochi@rediffmail.com>
1859 * pending.cs (TypeAndMethods.mods): New. Store the parameter
1860 modifiers of pending methods.
1861 (PendingImplementation.PendingImplementation): Initialize it.
1862 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
1863 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
1864 with ParameterData. Add check for modifiers.
1865 * class.cs (MethodData.Define): Update to changes.
1867 2005-04-07 Raja R Harinath <rharinath@novell.com>
1869 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
1871 2005-04-07 Marek Safar <marek.safar@seznam.cz>
1873 * class.cs (PropertyMethod.Define): Check private accessor in abstract
1876 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
1879 * typemanager.cs: Registered RequiredAttributeAttribute.
1881 2005-04-06 Marek Safar <marek.safar@seznam.cz>
1883 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
1884 Warning CS0169 is back at level 3.
1885 (IMethodData.SetMemberIsUsed): New method.
1887 * decl.cs (IsUsed): New value; moved from FieldBase.Status
1888 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
1890 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
1892 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
1894 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
1897 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
1900 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
1901 to avoid the problems with nested types.
1903 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
1904 Anoob V.E <projectmonokochi@rediffmail.com>
1905 Harilal P.R <projectmonokochi@rediffmail.com>
1906 Raja R Harinath <rharinath@novell.com>
1909 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
1911 * typemanager (GetConstructor): Make public.
1913 2005-04-05 John Luke <john.luke@gmail.com>
1914 Raja R Harinath <rharinath@novell.com>
1917 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
1918 struct too. Return false quicker in a few cases.
1919 (VerifyUnManaged): Use it.
1921 2005-04-05 Raja R Harinath <rharinath@novell.com>
1924 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
1925 not 'unreachable_seen'.
1927 2005-04-04 Marek Safar <marek.safar@seznam.cz>
1929 * attribute.cs (Attribute.GetValue): Removed unused.
1931 * codegen.cs (CodeGen.TrimExt): Removed unused.
1933 * cs-parser.jay (output): Removed unused.
1935 * cs-tokenizer.cs (hex_digits): Removed unused.
1937 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
1939 * expression.cs (Indirection.LoadExprValue): Removed unused.
1940 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
1942 * iterators.cs (Iterator.param_types): Removed unused.
1944 * statement.cs (Goto.block): Removed unused.
1945 (ToplevelBlock.did): Removed unused.
1946 (Switch.ResolveConstantSwitch): Removed unused.
1948 2005-04-01 Ben Maurer <bmaurer@ximian.com>
1950 * rootcontext.cs: Allow mcs to bootstrap with the compilation
1953 2005-04-01 Raja R Harinath <rharinath@novell.com>
1955 Fix #74232 and cs0208-3.cs.
1956 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
1957 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
1958 unmanaged type. Don't use FieldBuilders when 't' is a
1959 TypeBuilder. Use ModFlags and MemberType fields.
1960 * class.cs (MemberBase.member_type): Rename from MemberType.
1961 (MemberBase.MemberType): New property. Determines member_type on
1963 (MemberBase.DoDefine): Don't initialize MemberType here.
1964 (FieldMember.Define): Likewise.
1966 2005-04-01 Marek Safar <marek.safar@seznam.cz>
1969 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
1970 Attributes are emitted there.
1972 2005-04-01 Raja R Harinath <rharinath@novell.com>
1974 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
1975 keyword in 'partial enum' too.
1976 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
1978 Report from Kamil Skalski <nazgul@omega.pl>.
1981 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
1982 have partial containers too.
1984 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
1985 in block' checks to Block.CheckInvariantMeaningInBlock.
1986 * statement.cs (Block.GetKnownVariableInfo): Make private.
1987 (Block.IsVariableUsedInChildBlock): Remove.
1988 (Block.IsVariableUsedInBlock): Likewise.
1989 (Block.CheckInvariantMeaningInBlock): New. Show location of
1990 conflicting declaration.
1991 (Block.AddVariable): Make error messages less long-winded and more
1992 specific. Show location of conflicting declaration.
1993 * parameter.cs (Parameters.Location): New readonly property.
1995 2005-03-31 Raja R Harinath <rharinath@novell.com>
1997 Clean up semantics of invoking ResolveMemberAccess.
1998 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
1999 can have an instance, ensure that we pass in a non-TypeExpression
2000 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
2001 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
2002 argument. Update to changes and simplify.
2003 (FieldExpr.Emitinstance): Remove CS0120 check.
2004 (PropertyExpr.EmitInstance): Likewise.
2005 * expression.cs (Argument.Resolve): Likewise.
2006 (Invocation.DoResolve): Update to changes in semantics of
2009 2005-03-31 Marek Safar <marek.safar@seznam.cz>
2012 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
2015 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
2017 2005-03-31 Raja R Harinath <rharinath@novell.com>
2019 Fix difference in behaviour with commandline invocation.
2020 * driver.cs (Driver.Reset): New.
2021 (CompilerCallableEntryPoint): Call it.
2023 * statement.cs (If.Resolve): Avoid spurious "uninitialized
2024 variable" warnings if the boolean expression failed to resolve.
2026 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
2028 * attribute.cs: Fix the union of several permissions when some of them
2029 are unrestricted (so the result isn't an unrestricted permission set).
2032 2005-03-30 Raja R Harinath <rharinath@novell.com>
2034 * ecore.cs (MemberExpr): New class. Convert from interface
2036 (MemberExpr.ResolveMemberAccess): Refactor and move here from
2037 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
2039 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
2040 (MethodGroupExpr.IsExplicitImpl): Remove.
2041 (Expression.GetFieldFromEvent): Remove.
2042 (SimpleName.MemberStaticCheck): Remove.
2043 (SimpleName.DoSimpleNameResolve): Update to changes.
2044 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
2045 (MemberAccess.IdenticalNameAndTypeName): Remove.
2046 (MemberAccess.error176): Move to MemberExpr.
2047 (MemberAccess.DoResolve): Update to changes.
2048 (BaseAccess.DoResolve): Likewise.
2050 2005-03-30 Marek Safar <marek.safar@seznam.cz>
2052 C# 2.0 Conditional attribute class implementation
2054 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
2055 Analyzes class whether it has attribute which has ConditionalAttribute
2056 and its condition is not defined.
2058 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
2059 (Class.IsExcluded): New method. Search for at least one defined
2060 condition in ConditionalAttribute of attribute class.
2062 2005-03-30 Raja R Harinath <rharinath@novell.com>
2064 * ecore.cs (PropertyExpr): Derive from Expression, not
2065 ExpressionStatement.
2066 (PropertyExpr.EmitStatement): Remove.
2068 2005-03-29 Raja R Harinath <rharinath@novell.com>
2071 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
2072 internal field "value__" of an enum be private. The examples for
2073 "value__" that I found on MSDN all used FieldAttributes.Private.
2075 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
2076 Don't mention IL method attribute names.
2078 Fix #47991. Remove a TODO.
2079 * statement.cs (Block.Toplevel): Make into a field.
2080 (Block.Parameters): Move into ToplevelBlock.
2081 (Block.known_variables): Rename from child_variable_names.
2082 (Block.Block): Remove variants that take Parameters. Initialize
2083 'Toplevel' with the immediately surrounding toplevel block.
2084 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
2085 LocalInfo parameter.
2086 (Block.GetKnownVariableInfo): New.
2087 (Block.IsVariableNameUsedInChildBlock): Update.
2088 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
2089 the block, even though it may not be in scope.
2090 (Block.AddVariable): Remove Parameters parameter. Use
2091 Toplevel.Parameters instead.
2092 (Block.AddConstant): Remove Parameters parameter.
2093 (Block.GetParameterReference): Update to use Toplevel.Parameters.
2094 (Block.IsParamaterReference): Likewise.
2095 (Block.IsLocalParameter): Likewise. Simplify a lot.
2096 (ToplevelBlock.Parameters): New. Moved from Block.
2097 (ToplevelBlock.ToplevelBlock): Update to changes. Always
2098 initialize Parameters to a non-null value.
2099 * cs-parser.jay: Update to changes.
2100 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
2101 simple names that mean different things in the same block. Use
2102 Block.IsVariableNameUsedInBlock.
2104 2005-03-28 Raja R Harinath <rharinath@novell.com>
2106 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2107 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2108 GetTypeHandle. It is possible for a reflected type to derive from
2109 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2110 System.Array during mscorlib compilation).
2111 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2112 contain a method_hash, don't create one either. Don't create a
2113 deep copy of the base cache's method_hash.
2114 (MemberCache.SetupCache): Rename back from DeepCopy.
2115 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2116 already initialized. If we see an override function, add its
2117 underlying base virtual function to the member_hash too.
2119 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
2121 2005-03-26 Raja R Harinath <harinath@acm.org>
2124 * assign.cs (Assign.DoResolve): When the RHS of an assignment
2125 fails to resolve, ensure that the LHS is still resolved as an
2128 2005-03-25 Raja R Harinath <harinath@acm.org>
2130 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
2132 (Enum.current_ec): Remove.
2133 (Enum.LookupEnumValue): Remove EmitContext argument.
2134 Just uses the one created during DefineType.
2135 (Enum.FindMembers): Update.
2136 * expression.cs (MemberAccess.DoResolve): Update.
2138 2005-03-22 Marek Safar <marek.safar@seznam.cz>
2140 * assign.cs (Assign.DoResolve): Check for CS1717 when
2141 source and target are same (uses Equals).
2143 * expression.cs (LocalVariableReference, ParameterReference,
2144 This): Implemented Equals, GetHashCode.
2146 * statement.cs (Block.GetParameterReference): Removed useless
2149 2005-03-22 Raja R Harinath <rharinath@novell.com>
2152 * statement.cs (Block.AddVariable): Ensure that we skip implicit
2153 blocks before deciding whether the error is cs0136 or cs0128.
2155 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
2156 (using_alias_directive, using_namespace_directive): Pass
2157 MemberName, not an expression to Namespace.UsingAlias and
2159 (MakeName): Use the MemberName of the namespace.
2160 * namespace.cs (Namespace.MemberName): New.
2161 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
2162 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
2164 * decl.cs (MemberName.Name): Make readonly.
2165 (MemberName.FromDotted): New "constructor".
2166 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
2167 (MemberCore.Name): Compute from MemberName on demand.
2168 (MemberCore.SetMemberName): Provide a way to change the
2170 (MemberCore.AddToContainer): Don't take a fullname parameter.
2171 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
2172 fully qualified name of the container to the member name.
2173 (TypeContainer.AddToTypeContainer): Use a fully qualified name
2174 only if the type is a member of the root container.
2175 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
2176 MemberName.Left rather than searching for an embedded ".".
2177 (PartialContainer.CreatePart): Update to changes in RootContext.
2178 (MemberBase.ShortName): Turn into a property. Use
2179 MemberCore.SetMemberName.
2180 (MemberBase.ExplicitInterfaceName): Remove.
2181 (MemberBase.UpdateMemberName): Remove.
2182 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2183 (PropertyBase.SetMemberName): New override.
2184 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2185 (Tree.GetDecl): New.
2186 (Tree.AllDecls): Rename from Decls.
2187 * attribute.cs, enum.cs, report.cs: Update to changes.
2188 * driver.cs (MainDriver): Use MemberName.FromDotted on
2189 RootContext.MainClass.
2191 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2193 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2196 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2198 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2200 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2201 property accessor modifiers.
2203 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2204 fixed buffer attribute (CS1716).
2205 (PropertyMethod.HasCustomAccessModifier): When property accessor
2206 has custom modifier.
2208 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2210 (PropertyExpr.DoResolveLValue): Add CS0272.
2212 2005-03-17 Miguel de Icaza <miguel@novell.com>
2214 * convert.cs: When converting to a pointer, use the proper Conv.U
2215 or Conv.I depending on the source data type.
2217 * cs-tokenizer.cs: Make the size for large decimal constants,
2220 2005-03-17 Martin Baulig <martin@ximian.com>
2222 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2223 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2225 2005-03-17 Martin Baulig <martin@ximian.com>
2227 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2228 to bool so we can return an error condition.
2229 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2232 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2234 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2237 2005-03-16 Raja R Harinath <rharinath@novell.com>
2239 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2240 Refactor to avoid traversing the list of assemblies, and to avoid
2241 string concatenation.
2242 * typemanager.cs (guid_attr_type): Remove.
2243 (negative_hits, pointers, references): Remove hashes.
2245 (GetConstructedType): New. Uses type_hash to handle constructed
2246 types (arrays, references, pointers).
2247 (GetReferenceType, GetPointerType): Use it.
2248 (GetNestedType): New. Uses type_hash to handle nested types of
2250 (LookupType, LookupTypeDirect): Remove.
2251 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2252 'types' hash and LookupTypeReflection directly.
2253 (params_string, params_object): Use GetConstructedType.
2254 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2256 (Namespace.Lookup): Use cached_types.
2257 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2258 provided by old TypeManager.LookupType.
2259 * rootcontext.cs (MakeFQN): Remove.
2260 * decl.cs (DeclSpace.MakeFQN): Likewise.
2261 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2262 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2263 TypeManager.GetConstructedType.
2264 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2266 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2268 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2271 * cs-parser.jay: Reports CS1527 for any namespace element.
2273 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2276 * expression.cs (ParameterReference.IsAssigned): Changed error to
2278 (Error_WrongNumArguments): Moved CS0245 detection here.
2280 * statement.cs (Return.Resolve): Add CS1622 report.
2282 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2284 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2286 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2288 * attribute.cs expression.cs: Get rid of some allocations.
2290 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2292 * doc.cs : just eliminate the latest change.
2294 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2296 * doc.cs : commented out the latest change. It breaks xml-030.cs
2298 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2300 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2301 fail. So invoke CreateType() in FindDocumentedType().
2303 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2305 * cs-tokenizer.cs : added IsKeyword().
2306 * doc.cs : Detect keyword incorrectly used as identifier.
2307 Allow identifiers prefixed by @.
2309 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2311 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2312 It caused exception in namespace resolving (again!).
2314 * class.cs (Class.ctor): Removed exit.
2315 (PropertyMethod.ctor): ditto.
2317 * codegen.cs (Codegen.Reset): Reset static data.
2318 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2320 * cs-tokenizer.cs (Cleanup): Removed.
2322 * driver.cs (GetSystemDir): Rewrote to one line command.
2323 It caused problem with unloaded dynamic modules.
2324 (UnixParseOption): Removed Exit.
2325 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2326 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2327 Now can be mcs used as library.
2329 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2332 * location.cs (Reset): Reset static data.
2334 * namespace.cs (Reset): Reset static data.
2336 * report.cs (Report.Reset): Reset static data.
2338 * rootcontext.cs (RootContext.Reset): Reset static data.
2340 * tree.cs (RootTypes.ctor): Use Location.Null
2342 * typemanager.cs (TypeManager.Reset): Reset static data.
2343 (CoreLookupType): Removed Exit.
2344 (TypeHandle.Reset): Reset static data.
2346 2005-03-10 Raja R Harinath <rharinath@novell.com>
2349 * typemanager.cs (ComputeNamespaces): Import namespaces from
2350 referenced modules too.
2352 2005-03-09 Raja R Harinath <rharinath@novell.com>
2354 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2357 2005-03-09 Raja R Harinath <rharinath@novell.com>
2359 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2360 enclosing DeclSpace. This ensures that a name-lookup populates
2361 more caches and there are fewer 'TypeExpression's. Carve out
2362 nested type lookup into ...
2363 (LookupNestedTypeInHierarchy): ... this.
2365 2005-03-09 Raja R Harinath <rharinath@novell.com>
2367 Clean up a few partial-class semantics.
2368 Fixes test-357.cs and cs1618-2.cs.
2369 * cs-parser.jay (struct_declaration): Use 'current_class' as
2370 parent of newly-created struct. Remove call to Register ().
2371 Use 'pop_current_class' to complete handing the current struct.
2372 (interface_declaration): Likewise.
2373 (class_declaration): Likewise.
2374 (enum_declaration): Use 'current_class' as parent of newly created
2376 (delegate_declaration): Likewise.
2377 (pop_current_class): New function. This is used to handle closing
2378 up the 'current_class' and 'current_container', and pointing them
2379 to the enclosing class/container.
2380 (CSharpParser): Initialize 'current_class' too.
2381 * decl.cs (MemberCore): Add check for invariant: a partial
2382 container is not a parsed entity, and thus does not enclose any
2384 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2385 (DeclSpace.BaseTypeExpr): Use it.
2386 (DeclSpace.LookupType): Add check for invariant.
2387 * class.cs (TypeContainer): Add check for invariant: a nested
2388 class should have the same NamespaceEntry as its enclosing class.
2389 (TypeContainer.EmitFieldInitializers): Make virtual.
2390 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2392 (TypeContainer.Register): Remove.
2393 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2394 null. Use TypeResolveEmitContext for resolving base types and
2395 interfaces. Move initialization of Parts.TypeBuilder here from
2397 (TypeContainer.DefineNestedTypes): ... here.
2398 (PartialContainer): Take a Namespace not a NamespaceEntry.
2399 (PartialContainer.Create): Don't use Register. Call the
2400 appropriate Add... function directly.
2401 (ClassPart): Take both the PartialContainer and the enclosing
2402 class as constructor arguments.
2403 (ClassPart.EmitFieldInitializers): Override.
2404 (ClassPart.PartFindNestedTypes): Remove.
2405 (FieldBase.GetInitializerExpression): Resolve the initializer
2406 expression in the emit context of the enclosing class.
2407 * tree.cs (RootTypes): Remove Register ().
2409 2005-03-08 Marek Safar <marek.safar@seznam.cz>
2411 * cs-parser.jay: Removed CS0134.
2413 * driver.cs: Removed CS1901.
2415 * expression.cs (SizeOf.DoResolve): Don't report CS0233
2416 for predefined types.
2418 2005-03-07 Duncan Mak <duncan@novell.com>
2420 * codegen.cs (Save): Catch UnauthorizedAccessException as
2421 well. Fixes bug #73454.
2423 2005-03-07 Marek Safar <marek.safar@seznam.cz>
2425 * cs-tokenizer.cs (xtoken): Add CS1035.
2427 * class.cs (MethodData.Define): Add CS0683.
2428 (FieldMember.ctor): Add CS0681.
2430 2005-03-07 Raja R Harinath <rharinath@novell.com>
2432 * ecore.cs (SimpleName.DoResolve): Rename from
2433 SimpleName.DoResolveAllowStatic.
2434 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
2435 Pass 'intermediate' flag to MemberStaticCheck.
2436 (SimpleName.MemberStaticCheck): Skip "static check" only in case
2437 of "intermediate" lookups via MemberAccess.
2438 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
2439 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
2441 2005-03-07 Raja R Harinath <rharinath@novell.com>
2444 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
2445 slipped in because of variable names that are identical to a
2446 builtin type's BCL equivalent ('string String;', 'int Int32;').
2447 (PropertyExpr.EmitInstance): Likewise.
2449 2005-03-04 Marek Safar <marek.safar@seznam.cz>
2451 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
2453 * report.cs (warning_ignore_table): Made public.
2455 2005-03-04 Raja R Harinath <rharinath@novell.com>
2458 * class.cs (MethodData.Emit): Pass 'container' to
2459 container.GetObsoleteAttribute instead of 'container.Parent'.
2461 2005-03-03 Marek Safar <marek.safar@seznam.cz>
2463 * cs-parser.jay: Add 1534 error test.
2465 * iterators.cs (Yield.CheckContext): Add error 1629.
2466 (Iterator.ctor): Save unsafe modifier.
2467 (MoveNextMethod.DoEmit): Restore unsafe context.
2469 * namespace.cs (UsingAlias): Better error message.
2471 2005-03-03 Dan Winship <danw@novell.com>
2473 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
2474 the warning message [#73219]
2476 2005-03-03 Raja R Harinath <rharinath@novell.com>
2478 Fix compile with MCS 1.0.0.0.
2479 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
2480 w_restore to not depend on string constant folding.
2482 2005-03-03 Raja R Harinath <rharinath@novell.com>
2484 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
2485 CS0246 check to users who passed 'silent = false'.
2486 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
2488 (SimpleName.SimpleNameResolve): Update.
2489 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
2490 (MemberAccess.IdenticalNameAndTypeName): Update.
2491 * doc.cs (FindDocumentedTypeNonArray): Update.
2493 2005-03-03 Raja R Harinath <rharinath@novell.com>
2495 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
2496 * parameters.cs (ComputeAndDefineParameters): Remove.
2497 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
2498 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
2499 Use GetParameterInfo.
2501 2005-03-02 Marek Safar <marek.safar@seznam.cz>
2503 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
2505 2005-03-02 Raja R Harinath <rharinath@novell.com>
2507 Unify DeclSpace.LookupType and DeclSpace.FindType.
2508 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
2509 is in charge of defining nested types on demand.
2510 (DeclSpace.LookupType): Use it when the current_type is a
2511 TypeBuilder. Use LookupTypeDirect for reflected types.
2512 (DeclSpace.FindType): Remove.
2513 (DeclSpace.LookupInterfaceOrClass): Likewise.
2514 (DeclSpace.DefineTypeAndParents): Likewise.
2515 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
2516 DeclSpace.LookupType.
2517 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
2518 * typemanager.cs (LookupType): Simplify.
2519 (AddUserType): Remove type from negative_hits.
2520 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
2521 * class.cs (TypeContainer.FindMembers): Move handling of nested
2523 (TypeContainer.FindMembers_NestedTypes): ... here.
2524 (TypeContainer.FindNestedType): Implement override.
2525 (ClassPart.FindNestedType): Delegate to PartialContainer.
2526 (ClassPart.PartFindNestedType): Looks up the nested types of the
2529 2005-03-02 Martin Baulig <martin@ximian.com>
2531 * class.cs (TypeContainer.DoDefineMembers): We also need a default
2532 static constructor in static classes.
2534 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
2536 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
2537 sizeParamIndex is not specified.
2539 2005-03-01 Marek Safar <marek.safar@seznam.cz>
2542 * report.cs (WarningMessage.IsEnabled): Missing null check.
2544 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2546 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
2547 in the fields and not in the properties.
2549 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
2551 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
2554 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2556 * attribute.cs: Small refactoring (improved robustness).
2557 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
2558 (ValidateGuid): Removed.
2559 (Resolve): Removed referenced to above mentioned.
2560 (GetAttributeUsage): Made private and changed to work without
2562 (GetIndexerAttributeValue): Don't crash.
2563 (GetConditionalAttributeValue): Ditto.
2564 (GetClsCompliantAttributeValue): Ditto.
2565 (ExtractSecurityPermissionSet): All attributes exceptions are
2567 (GetPropertyValue): New helper.
2568 (GetMethodImplOptions): New method.
2569 (DefinePInvokeMethod): Reuse common code. Implemented handling of
2570 some missing properties.
2572 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
2573 (Method.ApplyAttributeBuilder): Updated.
2575 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
2578 2005-02-28 Raja R Harinath <rharinath@novell.com>
2581 * report.cs (Report.SymbolRelatedToPreviousError): Handle
2582 non-simple types (array, pointer, reference).
2584 2005-02-28 Marek Safar <marek.safar@seznam.cz>
2586 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
2588 * class.cs (MethodCore.IsDuplicateImplementation): Special error
2590 (Method.CheckBase): Catch wrong destructor here.
2591 (MethodData.Define): Add errors 550, 668.
2593 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
2595 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
2597 * pending.cs (VerifyPendingMethods): Add error 551.
2599 * typemanager.cs (CSharpName): Next error report helper.
2601 2005-02-25 Marek Safar <marek.safar@seznam.cz>
2603 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
2604 attributes. Removed useless attribute double check.
2605 It saves almost 2MBs for corlib.
2607 2005-02-25 Raja R Harinath <rharinath@novell.com>
2610 * statement.cs (ExpressionStatement.Resolve): Make robust to being
2611 called twice in case of error.
2613 2005-02-23 Chris Toshok <toshok@ximian.com>
2615 Fix compiler portions of #72827.
2616 * statement.cs (Block.Emit): call Begin/EndScope on the
2617 EmitContext instead of the ILGenerator.
2619 * codegen.cs (EmitContext.BeginScope): new method, call
2620 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
2622 (EmitContext.BeginScope): same, but EndScope and CloseScope
2624 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
2625 offset and call the superclass's OpenScope(int) with it.
2626 (SymbolWriter.CloseScope): get the current il
2627 offset and call superclass's CloseScope(int) with it.
2629 2005-02-23 Marek Safar <marek.safar@seznam.cz>
2631 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
2632 CS1677 for out and ref as well.
2634 * class.cs (Method.Define): Add error CS1599 detection.
2636 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
2638 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
2640 * delegate.cs (Delegate.Define): Add error CS1599 detection.
2642 * support.cs.cs (ModifierDesc): New helper method.
2644 2005-02-23 Raja R Harinath <rharinath@novell.com>
2645 Abin Thomas <projectmonokochi@rediffmail.com>
2646 Anoob V E <projectmonokochi@rediffmail.com>
2647 Harilal P R <projectmonokochi@rediffmail.com>
2650 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
2651 MemberLookup (used for error reporting) actually returns a result.
2652 Fix error report number (122, not 112).
2654 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
2655 Anoob V E <projectmonokochi@rediffmail.com>
2656 Harilal P R <projectmonokochi@rediffmail.com>
2659 * pending.cs (PendingImplementation.GetAbstractMethods):
2660 Find NonPublic members too.
2662 2005-02-22 Marek Safar <marek.safar@seznam.cz>
2664 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
2667 * class.cs (MethodCore.CheckMethodAgainstBase):
2668 Add error 239 report.
2670 2005-02-21 Raja R Harinath <rharinath@novell.com>
2673 * expression.cs (Invocation.IsApplicable): Make public.
2674 (Invocation.IsParamsMethodApplicable): Likewise.
2675 * delegate.cs (Delegate.VerifyApplicability): Don't use
2676 Invocation.VerifyArgumentCompat for parameter applicability
2677 testing. Use Invocation.IsApplicable and
2678 Invocation.IsParamsMethodApplicable.
2680 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2682 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
2684 * class.cs (Operator.Define): Add error 217 report.
2686 2005-02-21 Raja R Harinath <rharinath@novell.com>
2688 * namespace.cs (UsingEntry.Resolve): Undo change below.
2690 2005-02-21 Raja R Harinath <rharinath@novell.com>
2693 * ecore.cs (Expression.MemberLookupFailed): Add argument to
2694 disable the error message when the extended MemberLookup also
2696 (Expression.MemberLookupFinal): Update.
2697 (SimpleName.DoSimpleNameResolve): Update.
2698 * expression.cs (MemberAccess.ResolveNamespaceOrType):
2699 Don't use MemberLookupFinal.
2700 (New.DoResolve): Update.
2701 (BaseAccess.CommonResolve): Update.
2703 2005-02-21 Raja R Harinath <rharinath@novell.com>
2706 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
2707 occured previously, don't resolve again.
2709 2005-02-21 Marek Safar <marek.safar@seznam.cz>
2712 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
2713 argument. Call ResolveAttributeUsage for unresolved.
2714 when types doesn't match ctor arguments.
2716 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
2717 for nested attribute classes.
2718 (Class.attribute_usage): Removed.
2719 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
2720 for attribute class.
2722 * ecore.cs (IsAttribute): Removed.
2724 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
2726 * rootcontext.cs (RegisterAttribute): Removed, attributes are
2728 (attribute_types): Removed.
2729 (EmitCode): Global attributes are emited as the latest.
2731 2005-02-18 Marek Safar <marek.safar@seznam.cz>
2733 * class.cs (EmitFieldInitializers): Don't emit field initializer
2734 for default values when optimilization is on.
2736 * constant.cs (Constant.IsDefaultValue): New property.
2738 * driver.cs: Add /optimize handling.
2742 * literal.cs: Implement new IsDefaultValue property.
2744 * rootcontext.cs (Optimize): New field, holds /optimize option.
2746 2005-02-18 Raja R Harinath <rharinath@novell.com>
2748 Fix crasher in re-opened #72347.
2749 * namespace.cs (Namespace.Lookup): Return null if
2750 DeclSpace.DefineType returns null.
2753 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
2755 2005-02-18 Raja R Harinath <rharinath@novell.com>
2757 Fix remainder of #63202. Change semantics of DoResolveLValue: it
2758 now returns null if it cannot resolve to an lvalue.
2759 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
2760 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
2761 returned null. Remove check for SimpleName.
2762 (EventExpr.DoResolveLValue): New.
2763 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
2764 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
2766 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
2768 (Unary.ResolveOperator): Move CS0211 check ...
2769 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
2771 (Unary.DoResolveLValue): Simplify.
2772 (AddressOf.DoResolveLValue): New.
2773 (ArrayAccess.DoResolveLValue): New.
2775 2005-02-16 Marek Safar <marek.safar@seznam.cz>
2777 * attribute.cs (Attribute.Resolve): Add arguments casting for
2778 when types doesn't match ctor arguments.
2780 2005-02-16 Raja R Harinath <rharinath@novell.com>
2782 Fix parts of #63202.
2783 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
2784 lookup of operator in base type. Ensure that all checks happen
2785 when the operator resolves to an "op_..." method.
2787 2005-02-15 Raja R Harinath <rharinath@novell.com>
2790 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
2791 'ignore_cs0104' parameter. Pass it to ...
2792 (NamespaceEntry.Lookup): ... this.
2793 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
2794 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
2795 (TypeLookupExpression.DoResolveAsTypeStep): Update.
2796 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
2797 Update. Request that cs0104 errors be ignored.
2798 (ComposedCast.ResolveAsTypeStep): Update.
2800 2005-02-14 Raja R Harinath <rharinath@novell.com>
2803 * expression.cs (Invocation.BetterFunction): Remove support for
2804 comparing virtual functions and their overrides.
2805 (Invocation.IsOverride): New.
2806 (Invocation.OverloadResolve): Don't consider 'override' functions
2807 during candidate selection. Store them in a lookaside list.
2808 If the selected method is a 'virtual' function, use the list to
2809 find any overrides that are closer to the LHS type.
2811 2005-02-14 Marek Safar <marek.safar@seznam.cz>
2813 * expression.cs (New.DoResolve): Add complex core type reduction.
2814 (New.Constantify): Converts complex core type syntax like 'new int ()'
2817 2005-02-14 Raja R Harinath <rharinath@novell.com>
2819 * decl.cs (EntryType.EntryType): New constructor to create an
2820 updated copy of a cache entry.
2821 (MemberCache.AddMethods): Use it.
2822 (MemberCache.ClearDeclaredOnly): Remove.
2823 (MemberCache.MemberCache): Update.
2825 2005-02-11 Miguel de Icaza <miguel@novell.com>
2827 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
2828 variable. This one is represents the actual low-level declaration
2829 of the method, as opposed to the semantic level `IsStatic'.
2831 An anonymous method which is hosted into a static method might be
2832 actually an instance method. IsStatic would reflect the
2833 container, while MethodIsStatic represents the actual code
2836 * expression.cs (ParameterReference): Use the new MethodIsStatic
2837 instead of IsStatic.
2839 * anonymous.cs (AnonymousMethod.Compatible): Pass the
2840 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
2841 set on the current EmitContext.
2843 * expression.cs (Cast): Overload DoResolveLValue so we can pass
2844 resolve our casted expression as an LValue. This triggers the
2845 proper LValue processing that is later required by Assign.
2849 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
2851 2005-02-11 Marek Safar <marek.safar@seznam.cz>
2853 C# 2.0 Fixed buffer implementation
2855 * anonymous.cs: Update after RegisterHelperClass renaming.
2857 * attribute.cs (AttributeTester.fixed_buffer_cache):
2858 Cache of external fixed buffers.
2859 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
2860 implementation if field is fixed buffer else null.
2863 (TypeContainer.AddField): Accept FieldMember instead of Field.
2864 (FieldBase.IsFieldClsCompliant): Extracted code from
2865 VerifyClsCompliance descendant customization.
2866 (FixedField): New class handles fixed buffer fields.
2867 (FixedFieldExternal): Keeps information about imported fixed
2869 (IFixedField): Make access to internal or external fixed buffer
2872 * cs-parser.jay: Add fixed buffer parsing.
2874 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
2877 * expression.cs (Indirection): Extended implementation to accept
2879 (PointerArithmetic.Emit): Get element from fixed buffer as well.
2880 (ElementAccess.MakePointerAccess): Get type as parameter.
2881 (DoResolve): Add fixed buffer field expression conversion.
2882 (DoResolveLValue): Ditto.
2883 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
2884 (ArrayPtr): Derives from FixedBufferPtr.
2885 (ArrayPtr.Emit): Add extra emit for array elements.
2887 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
2889 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
2890 for compiler generated types.
2891 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
2893 * statement.cs (Fixed): Refactored to be easier add fixed buffer
2894 and consume less memory.
2895 (Fixed.Resolve): Add fixed buffer case.
2897 * typemanager.cs (compiler_generated_attr_ctor,
2898 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
2899 (HasElementType): Add our own implementation to work on every
2902 2005-02-11 Miguel de Icaza <miguel@novell.com>
2904 * anonymous.cs (CaptureContext): Track whether `this' has been
2907 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
2908 only captured `this' if it was implicitly done (instance
2909 methods/variables were used).
2911 * codegen.cs (EmitContext.CaptureThis): New method to flag that
2912 `this' must be captured.
2914 2005-01-30 Miguel de Icaza <miguel@novell.com>
2916 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
2917 is null it means that there has been no need to capture anything,
2918 so we just create a sibling.
2920 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
2922 Just a partial fix. The other half is fairly elusive.
2924 2005-02-10 Raja R Harinath <rharinath@novell.com>
2926 Fix #52586, cs0121-4.cs.
2927 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
2928 and return a hashtable.
2929 (MemberCache.ClearDeclaredOnly): New.
2930 (MemberCache.MemberCache): Update to change. Make a deep copy of
2931 the method_hash of a base type too.
2932 (MemberCache.AddMethods): Adapt to having a deep copy of the base
2933 type methods. Overwrite entries with the same MethodHandle so
2934 that the ReflectedType is correct. The process leaves in base
2935 virtual functions and their overrides as distinct entries.
2936 (CacheEntry): Now a class instead of a struct. It shouldn't alter
2937 matters since it was boxed in a ArrayList before.
2938 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
2940 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
2941 case of a virtual function and its override (choose the overload
2943 (Invocation.OverloadResolve): Avoid 'override' members during
2944 'applicable_type' calculation.
2946 2005-02-09 Raja R Harinath <rharinath@novell.com>
2948 Combine two near-redundant caches.
2949 * typemanager.cs (method_params): Rename from method_internal_params.
2950 (TypeManager.GetParameterData): New. Replace
2951 Invocation.GetParameterData.
2952 (TypeManager.LookupParametersByBuilder): Remove.
2953 * expression.cs (Invocation.method_parameter_cache): Remove.
2954 (Invocation.GetParameterData): Remove.
2956 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
2959 2005-02-08 Raja R Harinath <rharinath@novell.com>
2962 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
2963 TypeManager.multicast_delegate_type is null, resolve it by looking
2964 up "System.MulticastDelegate".
2965 * rootcontext.cs (RootContext.ResolveCore): Simplify.
2967 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
2968 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
2969 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
2972 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
2973 (LabeledStatement.AddReference): New. Set 'referenced'.
2974 (Goto.Resolve): Use it.
2976 2005-02-05 John Luke <john.luke@gmail.com>
2978 * driver.cs: remove duplicate -doc line in Usage ()
2980 2005-02-04 Raja R Harinath <rharinath@novell.com>
2982 * location.cs (Location.AddFile): Fix CS2002 error report.
2984 2005-02-02 Martin Baulig <martin@ximian.com>
2986 * delegate.cs (Delegate.DefineType): Report an internal error if
2987 TypeManager.multicast_delegate_type is null. See bug #72015 for
2990 2005-02-02 Raja R Harinath <rharinath@novell.com>
2992 Fix a crasher in a variant of #31984.
2993 * const.cs (Constant.CheckBase): New override that defers the
2994 new-or-override check in case the base type hasn't been populated
2996 (Constant.Define): Ensure the new-or-override check is performed.
2998 2005-02-01 Duncan Mak <duncan@ximian.com>
3000 * const.cs (LookupConstantValue): Check that `ce' is not null
3001 before calling GetValue ().
3003 2005-02-01 Raja R Harinath <rharinath@novell.com>
3005 Fix test-334.cs (#69519).
3006 * cs-parser.jay (using_alias_directive): Pass in an expression to
3007 NamespaceEntry.UsingAlias.
3008 (using_namespace_directive): Pass in an expression to
3009 NamespaceEntry.Using.
3010 (namespace_name): Don't flatten to a string.
3011 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
3012 (NamespaceEntry.AliasEntry.Resolve): Lookup using
3014 (NamespaceEntry.UsingEntry): Likewise.
3015 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
3017 (NamespaceEntry.LookupForUsing): Remove.
3018 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
3020 (NamespaceEntry.Lookup): Remove support for dotted names.
3022 2005-02-01 Raja R Harinath <rharinath@novell.com>
3024 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
3026 (NamespaceEntry.ImplicitParent): Compute on demand.
3027 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
3028 parallels the current.
3029 (NamespaceEntry.LookupForUsing): Use it.
3030 (NamespaceEntry.Lookup): If the current namespace-entry is
3031 implicit, don't search aliases and using tables.
3033 2005-02-01 Raja R Harinath <rharinath@novell.com>
3036 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
3038 (TypeContainer.BaseCache): Compute on demand.
3039 (TypeContainer.FindMembers): Define constants and types if they're
3040 not already created.
3041 (FieldMember.Define): Move resetting of ec.InUnsafe before error
3043 * const.cs (Constant.Define): Make idempotent.
3045 2005-01-29 Miguel de Icaza <miguel@novell.com>
3047 * pending.cs: Produce better code (no nops produced by using Ldarg
3050 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
3051 i - 1' it should be arg + 1.
3055 2005-01-28 Raja R Harinath <rharinath@novell.com>
3057 * attribute.cs (Attribute.CheckAttributeType): Make private
3059 (Attribute.ResolveType): Make virtual.
3060 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
3061 handling of RootContext.Tree.Types.
3063 2005-01-27 Raja R Harinath <rharinath@novell.com>
3065 Update attribute-handling to use the SimpleName/MemberAccess
3067 * cs-parser.jay (attribute): Pass in an expression to the
3068 constructors of Attribute and GlobalAttribute.
3069 * attribute.cs (Attribute): Take an expression for the name.
3070 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
3071 passed in attribute name expression.
3072 (Attribute.CheckAttributeType): Use it.
3073 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
3074 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
3075 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
3076 argument to prevent error messages if the lookup fails.
3078 2005-01-27 Marek Safar <marek.safar@seznam.cz>
3080 * expression.cs (Indirection): Implemented IVariable interface
3081 to support indirection in AddressOf operator.
3082 (PointerArithmetic.Emit): Add optimalization for case where
3083 result can be precomputed.
3085 2005-01-26 Martin Baulig <martin@ximian.com>
3087 * class.cs (TypeContainer.AttributeTargets): Return the correct
3088 AttributeTargets depending on our `Kind' instead of throwing an
3089 exception; fixes #71632.
3091 2005-01-26 Marek Safar <marek.safar@seznam.cz>
3094 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
3097 2005-01-25 Raja R Harinath <rharinath@novell.com>
3100 * expression.cs (MemberAccess.DoResolve): Don't complain with
3101 cs0572 when the LHS of a member access has identical name and type
3104 2005-01-25 Marek Safar <marek.safar@seznam.cz>
3107 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
3109 Create custom PermissionSet only for PermissionSetAttribute.
3111 2005-01-24 Marek Safar <marek.safar@seznam.cz>
3114 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
3115 delegates in static class.
3117 2005-01-24 Martin Baulig <martin@ximian.com>
3119 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3120 merging an implicit block, just use its reachability.
3122 * statement.cs (Block.Resolve): Make the unreachable code check
3123 work wrt. implicit blocks; see test-337 from #63842.
3125 2005-01-21 Alp Toker <alp@atoker.com>
3127 * cs-parser.jay: destructor_declaration's container is PartialContainer
3128 not Class when partial types are used, so use Kind prop instead of
3131 2005-01-22 Miguel de Icaza <miguel@ximian.com>
3133 * cs-parser.jay: Improve error reporting when an interface
3136 2005-01-20 Dick Porter <dick@ximian.com>
3138 * support.cs: SeekableStreamReader fix from Sandor Dobos
3139 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
3140 chars are read. Fixes bug 70369.
3142 2005-01-20 Raja R Harinath <rharinath@novell.com>
3144 * cs-parser.jay (catch_clause): Simplify current_block handling
3147 2005-01-17 Miguel de Icaza <miguel@ximian.com>
3149 * convert.cs (ImplicitStandardConversionExists): Synchronize the
3150 code with ImplicitStandardConversion to handle the implicit
3151 conversion of method groups into valid delegate invocations.
3153 The problem is that in parameter handling we were using this code
3154 path. Fixes bug #64698
3156 2005-01-19 Raja R Harinath <rharinath@novell.com>
3158 * cs-parser.jay: Fix several infelicities.
3159 - Avoid assigning to the parser value stack. Code like
3160 '$3 = null' is unclean. Synthesize a value for the code block
3162 - Avoid using oob_stack for storing location information. Use ...
3163 (_mark_): ... this. New (empty) rule. Saves the current location
3165 (foreach_statement): Avoid using oob_stack for current_block
3166 handling. Use technique used in for_statement and
3167 using_statement. Synthesize a value for the code block to store
3168 additional intermediate information.
3170 2005-01-13 Miguel de Icaza <miguel@ximian.com>
3172 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
3173 of a different type is only allowed to private fields of a
3174 containing type, not on fields of a base class.
3176 See test-174.cs and error cs0122-9.cs
3178 2005-01-13 Raja R Harinath <rharinath@novell.com>
3180 Fix test-335.cs (bug #58126).
3181 * cs-parser.jay (argument): Split out non-expression parts of the
3182 rule into 'non_simple_argument'.
3183 (invocation_expression): Support parenthesized invocations with
3184 multiple arguments, and with single non-simple arguments.
3186 2005-01-13 Raja R Harinath <rharinath@novell.com>
3188 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3191 2005-01-12 Raja R Harinath <rharinath@novell.com>
3193 Fix cs0038-1.cs, cs1640-6.cs.
3194 * ecore.cs (Expression.Resolve): Remove special-case for
3195 SimpleName in error-handling.
3196 (Expression.almostMatchedMembers): Relax access permission to
3198 (Expression.MemberLookupFailed): Handle duplicates in
3199 almostMatchedMembers list.
3200 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3201 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3202 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3203 overload if the passed in MemberInfo is a MethodBase.
3205 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3208 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3209 for non-CAS & merge permission sets properly.
3211 2005-01-11 Raja R Harinath <rharinath@novell.com>
3213 Improve standard-compliance of simple name and member access
3214 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3215 * ecore.cs (FullNamedExpression): New abstract base class
3216 for Namespaces and TypeExpressions.
3217 (ResolveFlags.SimpleName): Remove.
3218 (SimpleName): Remove support for dotted names.
3219 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3220 DeclSpace.FindType and DeclSpace.LookupType.
3221 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3222 (Expression.ExprClassName): Make member function.
3223 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3224 a namespace. Remove creation of dotted "SimpleName"s.
3225 (MemberAccess.DoResolve): Likewise.
3226 * decl.cs (DeclSpace.Cache): Make private.
3227 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3228 (DeclSpace.FindType): Update.
3229 (DeclSpace.LookupType): Move here from RootContext. Return a
3230 FullNamedExpression.
3231 * namespace.cs (Namespace): Derive from FullNamedExpression
3232 so that it can be part of expression resolution.
3233 (Namespace.Lookup): Return an FullNamedExpression.
3234 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3236 * rootcontext.cs (NamespaceLookup): Remove.
3237 (LookupType): Move to DeclSpace.
3238 * attribute.cs (CheckAttributeType): Update.
3239 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3240 (FindDocumentedTypeNonArray): Likewise.
3242 2005-01-11 Raja R Harinath <rharinath@novell.com>
3244 Fix cs0509.cs, cs1632.cs.
3245 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3246 is the same as IsInterface.
3247 (TypeContainer.GetClassBases): Likewise.
3248 * statement.cs (LabeledStatement.ig): New field.
3249 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3251 (LabeledStatement.DoEmit): Check that the label was created with
3252 the same ILGenerator.
3254 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3257 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3258 accessors to its properties.
3260 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3261 from accessors to property.
3263 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3266 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3269 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3271 * attribute.cs: Check for null and empty strings.
3273 I have lost another battle to Paolo.
3275 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3278 * class.cs (PropertyMethod): Set Parent field in ctors.
3279 (SetMethod.InternalParameters): Add unsafe switch hack.
3280 Override MarkForDuplicationCheck where it is appropriate.
3282 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3283 It says whether container allows members with the same name.
3285 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3286 Removed is_method parameter.
3288 2005-01-06 Duncan Mak <duncan@ximian.com>
3290 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3291 because the previous change led to incorrect reporting of CS1032
3292 ("Cannot define/undefine preprocessor symbols after first token in
3293 file"). Instead of using `tokens_seen' as the only flag that
3294 triggers CS1040, introduce `comments_seen'. This new flag is used
3295 to signify having seen comments on the current line, so it is
3296 unset after a newline.
3298 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3300 * doc.cs : When searching for a type, find nested type too.
3301 This fixes bug #71040.
3303 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3306 - Warn missing member comment on those classes which also does not
3307 have doc comments. Fixed bug #71041.
3308 - Don't warn missing doc comment on default constructor.
3311 2005-01-06 Duncan Mak <duncan@ximian.com>
3313 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3314 comments, set `tokens_seen' to true. This allows us to detect
3315 misplaced preprocessor directives (i.e. not at the beginning of
3316 the a line, nor after whitespaces). In that case, report error
3317 CS1040. This fixes bug #56460.
3319 * cs-parser.jay (interface_member_declaration): Add checks for
3320 IsExplicitImpl, and report CS0541 error if an interface member is
3321 defined as an explicit interface declaration.
3323 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3326 * class.cs (PropertyMethod): Set Parent field in ctors.
3327 (SetMethod.InternalParameters): Add unsafe switch hack.
3329 * decl.cs (MemberCore.Parent): Cannot be readonly.
3331 2005-01-06 Raja R Harinath <rharinath@novell.com>
3333 * decl.cs (DeclSpace.ResolveType): Remove.
3334 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3335 Merge in code from ...
3336 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3337 * class.cs, enum.cs: Update to changes.
3339 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3341 * anonymous.cs: Ensure that we init the scope of our parent if it
3342 has not been initialized yet.
3344 2004-12-30 Duncan Mak <duncan@ximian.com>
3346 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3347 if field.FieldBuilder is null. Fixes #70758.
3349 * convert.cs: Fixed some typos and updated some of the comments.
3350 (ImplicitStandardConversionExists):
3351 (TryImplicitIntConversion): If `target_type' is an interface and
3352 the type of `ic' implements this interface, return true or a new
3353 BoxedCast instead of null. This fixes #70468.
3355 2004-12-29 Duncan Mak <duncan@ximian.com>
3357 * expression.cs (Argument.Emit): Check that Expr is
3358 IMemoryLocation before casting to it, and report CS1510 otherwise.
3362 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3364 * statement.cs (Block.ThisVariable): remove the recursion here, to
3365 make the --profile more sane.
3367 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3369 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3370 assembly, by JB Evain.
3372 2004-12-17 Raja R Harinath <rharinath@novell.com>
3374 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3375 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3376 "parent" refers to enclosing type/class. "base" refers to superclass.
3378 2004-12-17 Raja R Harinath <rharinath@novell.com>
3380 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3381 Ensure that we only have GlobalAttributes.
3382 * attribute.cs (Attribute.Emit): Make non-virtual.
3383 (GlobalAttribute.Emit): Remove.
3384 (Attribute.Resolve): Make virtual.
3385 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3386 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3387 the argument. Don't create one.
3388 (Attribute.GetObsoleteAttribute): Likewise.
3389 (Attribute.GetClsCompliantAttributeValue): Likewise.
3390 * class.cs, decl.cs: Update to changes.
3392 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3394 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3396 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3398 * statement.cs (Foreach.Resolve): Add error 186 report.
3400 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3402 * expression.cs (Conditional.DoResolve): Add warning 429.
3404 * statement.cs (If.Resolve): Add warning 665.
3406 2004-12-16 Raja R Harinath <rharinath@novell.com>
3408 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3409 except when in the parser, and in GlobalAttribute.
3410 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3411 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3412 RootContext.Tree.Types.NamespaceEntry once work is done.
3413 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3414 and resets RootContext.Tree.Types.NamespaceEntry.
3416 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3418 * cs-parser.jay: Don't create a block for every variable.
3420 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3422 * location.cs: Provide extra information.
3424 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3425 variables from the captured environment, it is the ldarg_0.
3427 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3429 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3432 * class.cs: Changed warning level for 169 to avoid developer
3433 displeasure from warning flooding. It will be changed back when they
3434 fix most of current BCL warnings.
3436 * RootContext.cs: Pushed default WarningLevel to 3.
3438 * statement.cs: Removed unused variable.
3440 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3442 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3443 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
3444 Add error 502 report.
3445 (StaticClass.DefineType): Add error 441 report.
3446 (Class.AllowedModifiersProp): New virtual property as temporary
3447 extension to AllowedModifiers.
3448 (Class.DefineType): Add error 418 report. Moved ModFlags check here
3449 to share implementation with StaticClass and don't call virtual
3452 * driver.cs (MainDriver): Add error 1558 test.
3454 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
3455 report. Moved error 36 test here.
3457 * statement.cs (Throw.Resolve): Add error 724 report.
3459 * typemanager.cs: Add out_attribute_type core type.
3461 2004-12-13 Marek Safar <marek.safar@seznam.cz>
3463 * class.cs (TypeContainer.VerifyClsCompliance): Add error
3465 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
3467 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
3470 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
3472 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
3473 Add error 3023 report.
3474 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
3476 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
3479 2004-12-12 John Luke <john.luke@gmail.com>
3481 * driver.cs (AddArgs): take -- into account when
3482 adding arguments, fixes bug 65710
3484 2004-12-12 Martin Baulig <martin@ximian.com>
3486 * expression.cs (Unary.TryReduceNegative): Added support for
3487 SByteConstant and ByteConstant.
3488 (Unary.Reduce): Check error values from TryReduceNegative().
3490 2004-12-10 Marek Safar <marek.safar@seznam.cz>
3492 * attributes.cs (Attribute.Resolve): Avoid multiple error report
3493 and report exception as error 182.
3495 2004-12-10 Raja R Harinath <rharinath@novell.com>
3497 * driver.cs (Main): Fix message when there are warnings.
3499 2004-12-09 Miguel de Icaza <miguel@ximian.com>
3501 * delegate.cs: Fixed my fix from yesterday, sorry about that.
3503 2004-12-09 Marek Safar <marek.safar@seznam.cz>
3505 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
3506 Reduced number of warnings.
3508 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
3510 2004-12-08 Miguel de Icaza <miguel@ximian.com>
3512 * driver.cs: Removed message.
3514 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
3516 2004-12-08 <vargaz@freemail.hu>
3518 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
3520 2004-12-08 Martin Baulig <martin@ximian.com>
3522 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
3523 instead of a CS3002 for properties and indexer.
3525 2004-12-08 Martin Baulig <martin@ximian.com>
3527 * decl.cs (MemberName.ToString): Make this work again.
3529 2004-12-08 Marek Safar <marek.safar@seznam.cz>
3531 * attribute.cs (Resolve): Add error 591 detection.
3533 * class.cs (FieldMember.Define): Add error 1547 detection.
3534 (Indexer.Define): Add error 620 detection.
3535 (Operator.Define): Add error 590 detection.
3537 * ecore.cs: Missing argument for error 79.
3539 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
3542 2004-12-07 Marek Safar <marek.safar@seznam.cz>
3545 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
3548 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
3550 * cs-parser.jay : handle doc comments on implicit/explicit operators.
3551 Some operator comments were suppressed.
3552 * doc.cs : Implicit/explicit operator name in doc comments are like
3553 "op_Explicit(type)~returnType", so added suffix handling.
3555 2004-12-07 Martin Baulig <martin@ximian.com>
3558 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
3559 (MemberCore.GetClsCompliantAttributeValue): Likewise.
3560 (DeclSpace.ec): New protected field; store the EmitContext here.
3561 (DeclSpace.EmitContext): New public property; moved here from
3563 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
3566 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
3567 (Enum.Emit): Don't create a new EmitContext.
3569 * delegate.cs (Delegate.DefineType): Always create the
3572 * iterators.cs (Iterators.DefineIterator): Create a new
3573 EmitContext and store it in `ec'.
3575 2004-08-24 Martin Baulig <martin@ximian.com>
3578 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
3579 this for accessibility checks.
3580 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
3581 IsNestedFamilyAccessible.
3582 (TypeManager.IsSubclassOf): New method, do what the name actually
3585 2004-12-06 Raja R Harinath <rharinath@novell.com>
3587 Fix crash on cs0657-17.cs.
3588 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3589 Use RootContext.Tree.Types, not 'new RootTypes ()'.
3590 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
3591 the case where the NamespaceEntry gets overwritten.
3593 2004-12-06 Marek Safar <marek.safar@seznam.cz>
3595 Fixed #69195, #56821
3596 * ecore.cs (ResolveBoolean): Tiny refactoring.
3598 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
3599 of right expression resolving when left is false constant and
3600 operator is LogicalAnd OR true constant and operator is LogicalOr.
3602 * statement.cs (ResolveUnreachable): Always reports warning.
3604 2004-12-05 Miguel de Icaza <miguel@ximian.com>
3606 * class.cs: Distinguish between 1721 and 1722 (just a little help
3607 for the programmer).
3609 2004-12-03 Miguel de Icaza <miguel@ximian.com>
3611 * delegate.cs: Only allow this on new versions of the language.
3613 2004-12-02 Duncan Mak <duncan@ximian.com>
3615 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
3617 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
3618 here as a static method. Take an additional bool out parameter
3619 `must_do_cs1540_check' for signaling to InstanceResolve.
3620 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
3621 member field from PropertyExpr class and made it an argument of
3623 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
3624 check for MarshalByRefObject, and report CS0122 instead of CS1540.
3625 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
3626 and `remove_accessor' as well as InstanceResolve: report CS0122
3631 2004-12-03 Raja R Harinath <rharinath@novell.com>
3633 Fix test-327.cs, test-328.cs, and put in early infrastructure
3634 for eventually fixing #52697.
3635 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
3636 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
3638 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
3639 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
3640 (VerifyUsing, error246): Update.
3641 * rootcontext.cs (RootContext.NamespaceLookup): Just use
3642 'NamespaceEntry.LookupNamespaceOrType'.
3644 2004-12-03 Martin Baulig <martin@ximian.com>
3646 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3647 method as our child, call AnonymousMethod.Compatible() on it.
3649 2004-12-03 Raja R Harinath <rharinath@novell.com>
3651 Disable XML documentation support in 'basic' profile.
3652 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
3653 Redirect XmlElement to System.Object.
3654 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
3655 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
3656 * mcs.exe.sources: Add doc-bootstrap.cs.
3657 * doc-bootstrap.cs: New file. Contains empty stub implementation
3660 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
3662 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
3663 comments are allowed.
3665 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3667 * delegate.cs: Add checks for subtypes in paramaters and return values
3668 in VerifyMethod () to add support for Covariance/Contravariance
3671 2004-12-02 Miguel de Icaza <miguel@ximian.com>
3673 * report.cs: Remove extra closing parenthesis.
3675 * convert.cs (Error_CannotImplicitConversion): If the name of the
3676 types are the same, provide some extra information.
3678 * class.cs (FieldBase): Use an unused bit field from the field to
3679 encode the `has_offset' property from the FieldMember. This saves
3680 a couple of Ks on bootstrap compilation.
3682 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
3683 method as our child, return the AnonymousMethod resolved
3686 * expression.cs (New.DoResolve): Allow return values from
3687 NewDelegate to also include AnonymousMethods.
3691 2004-12-02 Marek Safar <marek.safar@seznam.cz>
3694 * attribute.cs (Resolve): Improved implementation of params
3695 attribute arguments.
3697 * support.cs (ParameterData): Add HasParams to be faster.
3699 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
3701 all things are for /doc support:
3703 * doc.cs: new file that supports XML documentation generation.
3704 * mcs.exe.sources: added doc.cs.
3706 Handle /doc command line option.
3707 Report error 2006 instead of 5 for missing file name for /doc.
3708 Generate XML documentation when required, after type resolution.
3710 Added support for picking up documentation (/// and /** ... */),
3711 including a new XmlCommentState enumeration.
3713 Added lines to fill Documentation element for field, constant,
3714 property, indexer, method, constructor, destructor, operator, event
3715 and class, struct, interface, delegate, enum.
3716 Added lines to warn incorrect comment.
3718 Added Documentation field (passed only when /doc was specified).
3720 Added DocComment, DocCommentHeader, GenerateDocComment() and
3721 OnGenerateDocComment() and some supporting private members for
3722 /doc feature to MemberCore.
3724 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
3726 Added overriden DocCommentHeader.
3728 Added overriden DocCommentHeader and GenerateDocComment().
3730 2004-12-01 Miguel de Icaza <miguel@ximian.com>
3732 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
3733 unwrapping the enumeration values, chain to
3734 DoConstantNumericPromotions again, so we can promote things to the
3735 fundamental types (takes care of enums that are bytes, sbytes).
3739 2004-12-01 Raja R Harinath <rharinath@novell.com>
3741 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
3742 Fix long-standing bug in type-lookup. Use FindType instead of
3743 LookupType when ec.ResolvingTypeTree.
3744 (Attribute.ResolveType, Attribute.Resolve)
3745 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
3747 (Attributes.Search): Remove internal version. Update.
3748 (Attributes.SearchMulti): Update.
3749 (Attributes.GetClsCompliantAttribute): Remove.
3750 (Attributes.GetIndexerNameAttribute): Remove.
3751 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
3752 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
3753 * class.cs (Indexer.Define): Likewise.
3755 2004-12-01 Marek Safar <marek.safar@seznam.cz>
3758 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
3759 MarshallByReference members access.
3761 * expression.cs: Use CheckMarshallByRefAccess;
3762 Better error CS0197 message.
3764 * report.cs: Print whole related error message.
3766 2004-11-30 Raja R Harinath <rharinath@novell.com>
3768 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
3769 the current directory to help debugging.
3771 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3773 * class (GetClassBases): Better error 60 report.
3774 (EventProperty): Disabled warning 67 detection.
3776 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3779 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
3781 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
3784 2004-11-29 Marek Safar <marek.safar@seznam.cz>
3787 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
3789 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
3791 2004-11-26 Miguel de Icaza <miguel@ximian.com>
3793 * attribute.cs (Attribute.Resolve): Refine error reporting and
3794 report a cs0117 if the identifier does not exist, to distinguish
3795 from 0617 which is a miss-use of the actual identifier.
3797 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
3798 between cs0070 and cs0079.
3800 * class.cs (MemberBase.DoDefine): When reporting a wrong
3801 accessibility level, we use MethodCore to compare instead of
3802 Method (this was a regression in some refactoring effort).
3804 So now we correctly report cs0056 again.
3806 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
3807 testing the target_type (which was known to be object_type) and
3808 not the source type (which is anonymous_method).
3810 Fixed reporting of error cs1660.
3812 * expression.cs (UserCast.Source): Expose the underlying cast.
3814 * statement.cs (Switch.SwitchGoverningType): Sort the list of
3815 allowed types to find a match to int32 first (most common).
3817 In addition, it ignores any ImplicitUserConversions that did an
3818 internal implicit conversion (as the switch statement allows only
3819 one integral conversion to exist).
3821 * class.cs (PartialContainer.Create): rename `name' to
3822 `member_name' for clarity. Then replace the string calls with a
3823 call to MemberName.GetPartialName, as now using
3824 MemberName.ToString is an error (this is due to the side effects
3825 it had, that were fixed in the past).
3827 This will restore the error reporting on a number of partial class
3828 errors that were missusing this (and getting an exception as a
3829 results, which is now just a plain textual warning, because
3830 yyparse debug output would crash otherwise).
3832 2004-11-26 Raja R Harinath <rharinath@novell.com>
3834 * Makefile (PROGRAM_INSTALL_DIR): Remove.
3836 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3838 * rootcontext.cs (LookupType): Make sure to cache lookups that
3839 don't give us a negative result. This saves about 5% of corlib
3842 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3844 * report.cs (AbstractMessage.Print): messages are sent to stderr
3846 * class.cs (TypeContainer.GetClassBases): It is an error to have a
3847 non-interface in the list of interfaces (at this point, either
3848 parent was properly set, or a base class is being listed in the
3849 interfaces section).
3851 This flags error 1722, and resolves the crash from bug 69259.
3853 2004-11-25 Ben Maurer <bmaurer@ximian.com>
3855 * statement.cs (Using.EmitExpressionFinally): make this work right
3856 for valuetypes. Fixes 69926.
3858 2004-11-25 Miguel de Icaza <miguel@ximian.com>
3860 * const.cs (Const.ChangeType): Cope with the "0 literal can be
3861 converted to an enum" here, before we try to change the underlying
3862 type. This code exists, but it is a different code path than the
3863 one used while encoding constants.
3865 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
3866 old bug: when converting from the null literal to a pointer,
3867 return an EmptyCast, not the NullLiteral.
3869 This fixes #69921, the recent null_type changes probably made this
3872 (ImplicitReferenceConversionExists): In addition, resynchronized
3873 the code here, so it matches the same code in
3874 ImplicitReferenceConversionExists for the `from any class-type S
3875 to any interface-type T'.
3878 2004-11-25 Marek Safar <marek.safar@seznam.cz>
3880 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
3882 2004-11-24 Miguel de Icaza <miguel@ximian.com>
3884 * cs-parser.jay: Use verbosity accordingly.
3886 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3888 * expression.cs (Unary.ResolveOperator): Do not report warning;
3889 AddressOf reads from variable.
3891 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
3893 2004-11-24 Marek Safar <marek.safar@seznam.cz>
3897 * attribute.cs (Attributable): Removed CheckTargets.
3898 (Attributes.Emit): Explicit attribute targets are tested here.
3900 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
3901 not enabled for interfaces.
3903 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
3904 (GetAssemblyName): Ouch next bug there.
3906 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
3908 * expression.cs: Error 275 added.
3910 2004-11-23 Marek Safar <marek.safar@seznam.cz>
3912 Fix bug #69177 (Implemented decimal constant support)
3914 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
3915 (BinaryFold): Add DecimalConstant.
3917 * const.cs (Define): Decimal constant
3919 (ChangeType): Add decimal type handling.
3920 (LookupConstantValue): Don't set value for decimal type but
3921 emit DecimalConstantAttribute. Needed for constant optimization.
3923 * constant.cs (ToDecimal): New method.
3924 (ConvertToDecimal): New method.
3925 (IntConstant): Implemented ConvertToDecimal.
3926 (DecimalConstant.Emit): Emit optimized version for decimals in
3929 * expression.cs (ResolveOperator): Changed order of constant
3930 reduction to work correctly with native types which have
3931 overloaded operators.
3932 (ResolveMemberAccess): Extract constant value from attribute
3935 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
3937 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
3938 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
3939 (ChangeType): Decimal is special.
3940 (TypeToCoreType): Add decimal type.
3942 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3944 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
3947 2004-11-22 Marek Safar <marek.safar@seznam.cz>
3949 * class.cs (EventField.ApplyAttributeBuilder): Fix error
3952 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3954 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
3956 * pending.cs (PendingImplementation): Grab only interfaces.
3958 2004-11-19 Marek Safar <marek.safar@seznam.cz>
3960 * statement.cs (ForeachHelperMethods): Add location member and
3961 error 202 detection.
3963 2004-11-19 Raja R Harinath <rharinath@novell.com>
3965 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
3966 automatically handled by executable.make.
3967 (PROGRAM): Make profile-specific.
3969 2004-11-18 Marek Safar <marek.safar@seznam.cz>
3971 * expression.cs (DoResolveBase): Fixed wrong warning for out
3974 2004-11-18 Martin Baulig <martin@ximian.com>
3976 Merged latest changes into gmcs. Please keep this comment in
3977 here, it makes it easier for me to see what changed in MCS since
3978 the last time I merged.
3980 2004-11-17 Raja R Harinath <rharinath@novell.com>
3982 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
3983 (TypeHandle.GetMemberCache): New.
3984 (TypeHandle.TypeHandle): Update.
3985 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
3986 (TypeManager.LookupParentInterfacesCache):
3987 Rename from LookupInterfaceCache. Optimize slightly.
3988 (TypeManager.MemberLookup_FindMembers): Update.
3989 * decl.cs (MemberCache.MemberCache): Set Container to null in the
3991 (AddCacheContents): Rename from AddHashtable.
3992 * class.cs (TypeContainer.parent_container): Remove.
3993 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
3994 (TypeContainer.DoDefineMembers): Don't initialize it.
3995 Update to name changes.
3997 2004-11-17 Miguel de Icaza <miguel@ximian.com>
3999 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
4000 that factors the code to check access modifiers on override.
4002 (PropertyBase): Use the code here.
4004 Patch from Lluis S'anchez, fixes bug #69361.
4006 2004-11-15 Miguel de Icaza <miguel@ximian.com>
4008 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
4009 routine that is used to report the use of a captured variable
4010 whose address has been taken.
4012 There are two checks: one when variables are being captured and
4013 the other check is when the address of a variable is taken.
4015 (because an anonymous methods might be resolved before *or* after
4016 the address has been taken) and
4018 * expression.cs (Conditional.DoResolve): Remove the special
4019 casing that Martin added to trueExpr and falseExpr being both
4020 NullLiteral. We get the right behavior now just by introducing
4021 the null_type into the compiler.
4023 * convert.cs (ExplicitConversion): Change the code to use
4024 null_type instead of testing `expr is NullLiteral'.
4025 (ImplicitConversionStandard): use null_type too.
4026 (ImplicitReferenceConversionExists): use null_type too.
4027 (ImplicitReferenceConversion): use null_type too.
4029 * literal.cs: The type of `NullLiteral' is now null_type instead
4031 (Resolve): Set the type here.
4033 * typemanager.cs: Introduce null_type.
4035 2004-11-17 Martin Baulig <martin@ximian.com>
4037 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4038 direction, like FindMembers() does. Fixes #69546, testcase is in
4041 2004-11-16 Martin Baulig <martin@ximian.com>
4043 This is based on a patch from Marek Safar, see bug #69082.
4044 Fixes bugs #63705 and #67130.
4046 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4047 method; create a MemberCache for an interface type and cache the
4050 * decl.cs (IMemberContainer.ParentContainer): Removed.
4051 (IMemberContainer.ParentCache): New property.
4052 (MemberCache.SetupCacheForInterface): Removed.
4053 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4054 to create a cache for an interface's "parent".
4056 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4059 2004-11-16 Martin Baulig <martin@ximian.com>
4061 Merged back from gmcs; these changes already went into gmcs a
4062 couple of weeks ago.
4065 (TypeManager.AddUserType): Removed the `ifaces' argument.
4066 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
4068 (TypeManager.AddUserInterface): Removed.
4069 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
4071 (TypeManager.GetInterfaces): Likewise.
4072 (TypeManager.GetExplicitInterfaces): Likewise.
4074 * ecore.cs (TypeExpr.GetInterfaces): Removed.
4076 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
4077 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
4079 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4081 * statement.cs: Avoid adding bools to a hashtable.
4083 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4085 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4086 calling an unsafe method from a safe location.
4088 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4091 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4093 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4095 * namespace.cs (VerifyUsing): use GetPartialName instead of
4098 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4100 * statement.cs (Return.Resolve): Fix regression in typo: if
4101 `in_exc', we have to request a NeedReturnLabel, this was a typo
4102 introduced in the anonymous method check-in. Fixes #69131.
4104 * Indexers were using the ShortName when defining themselves,
4105 causing a regression in the compiler bootstrap when applying the
4106 patch from 2004-11-02 (first part), now they use their full name
4107 and the bug is gone.
4109 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4111 * driver.cs: Strip the path from the names of embedded resources. Fixes
4114 2004-11-04 Raja R Harinath <rharinath@novell.com>
4116 Fix error message regression: cs0104-2.cs.
4117 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4118 (AliasEntry.Resolve): Update.
4119 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4121 (RootContext.LookupType): Update.
4123 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4125 * cs-parser.jay: Add support for handling accessor modifiers
4126 * class: Add support port accessor modifiers and error checking,
4127 define PropertyMethod.Define as virtual (not abstract anymore)
4128 * ecore.cs: Add checking for proeprties access with access modifiers
4129 * iterators.cs: Modify Accessor constructor call based in the modified
4131 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4133 * expression.cs (StringConcat): Handle being called twice,
4134 as when we have a concat in a field init with more than two
4137 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4139 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4140 special case explicit implementations, we should always produce
4141 the .property or .event declaration.
4143 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4144 since it will not return correct data if people use this
4145 unresolved in the presence of using statements (see test-313).
4147 * class.cs (MethodData.Define): If we are an explicit interface
4148 implementation, set the method name to the full name of the
4149 interface plus the name of the method.
4151 Notice that using the method.MethodName.GetFullName() does not
4152 work, as it will only contain the name as declared on the source
4153 file (it can be a shorthand in the presence of using statements)
4154 and not the fully qualifed type name, for example:
4158 class D : ICloneable {
4159 object ICloneable.Clone () {
4163 Would produce a method called `ICloneable.Clone' instead of
4164 `System.ICloneable.Clone'.
4166 * namespace.cs (Alias.Resolve): Use GetPartialName.
4168 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4170 * cs-parser.jay: Add error 1055 report.
4172 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4174 * assign.cs (Assign.DoResolve): Only do the transform of
4175 assignment into a New if the types are compatible, if not, fall
4176 through and let the implicit code deal with the errors and with
4177 the necessary conversions.
4179 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4181 * cs-parser.jay: Add error 1031 report.
4183 * cs-tokenizer.cs: Add location for error 1038.
4185 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4187 * cs-parser.jay: Add error 1016 report.
4189 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4191 * cs-parser.jay: Add errors 1575,1611 report.
4193 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4195 * cs-parser.jay: Add error 1001 report.
4197 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4200 * attribute.cs (GetMarshal): Add method argument for
4201 caller identification.
4203 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4204 agument for GetMarshal and RuntimeMissingSupport.
4206 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4208 * attribute.cs (ExtractSecurityPermissionSet): Removed
4209 TypeManager.code_access_permission_type.
4211 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4213 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4215 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4216 for obsolete use of a variable here. Fixes regression on errors
4217 cs0619-25 and cs0619-26.
4219 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4221 Fix #62358, implemented security attribute encoding.
4223 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4224 Tests permitted SecurityAction for assembly or other types.
4225 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4226 data from SecurityPermissionAttribute to PermisionSet class.
4228 * class.cs (ApplyAttributeBuilder): Added special handling
4229 for System.Security.Permissions.SecurityAttribute based types.
4231 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4232 special handling for System.Security.Permissions.SecurityAttribute
4235 * enum.cs (ApplyAttributeBuilder): Added special handling
4236 for System.Security.Permissions.SecurityAttribute based types.
4238 * parameter.cs (ApplyAttributeBuilder): Added special handling
4239 for System.Security.Permissions.SecurityAttribute based types.
4241 * rootcontext.cs: Next 2 core types.
4243 * typemanager.cs (TypeManager.security_permission_attr_type):
4244 Built in type for the SecurityPermission Attribute.
4245 (code_access_permission_type): Build in type.
4247 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4249 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4250 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4251 all of this information into
4252 EmitContext.EmitCapturedVariableInstance.
4254 * codegen.cs (EmitCapturedVariableInstance): move here the
4255 funcionality of emitting an ldarg.0 in the presence of a
4256 remapping. This centralizes the instance emit code.
4258 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4259 then emit a load of this: it means that we have reached the
4260 topmost ScopeInfo: the one that contains the pointer to the
4261 instance of the class hosting the anonymous method.
4263 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4264 captures to the topmost CaptureContext.
4266 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4268 * expression.cs (LocalVariableReference): Move the knowledge about
4269 the iterators into codegen's EmitCapturedVariableInstance.
4271 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4273 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4274 all code paths return a value from an anonymous method (it is the
4275 same as the 161 error, but for anonymous methods).
4277 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4279 The introduction of anonymous methods in the compiler changed
4280 various ways of doing things in the compiler. The most
4281 significant one is the hard split between the resolution phase
4282 and the emission phases of the compiler.
4284 For instance, routines that referenced local variables no
4285 longer can safely create temporary variables during the
4286 resolution phase: they must do so from the emission phase,
4287 since the variable might have been "captured", hence access to
4288 it can not be done with the local-variable operations from the runtime.
4292 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4293 is a toplevel block.
4295 (ToplevelBlock): A new kind of Block, these are the blocks that
4296 are created by the parser for all toplevel method bodies. These
4297 include methods, accessors and anonymous methods.
4299 These contain some extra information not found in regular blocks:
4300 A pointer to an optional CaptureContext (for tracking captured
4301 local variables and parameters). A pointer to the parent
4304 (Return.Resolve): Catch missmatches when returning a value from an
4305 anonymous method (error 1662).
4306 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4309 (Break.Resolve): ditto.
4311 (SwitchLabel): instead of defining the labels during the
4312 resolution phase, we now turned the public ILLabel and ILLabelCode
4313 labels into methods called GetILLabelCode() and GetILLabel() that
4314 only define the label during the Emit phase.
4316 (GotoCase): Track the SwitchLabel instead of the computed label
4317 (its contained therein). Emit the code by using
4318 SwitchLabel.GetILLabelCode ().
4320 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4321 whether the Local has been captured or not.
4323 (LocalInfo.IsCaptured): New property, used to tell whether the
4324 local has been captured.
4326 * anonymous.cs: Vastly updated to contain the anonymous method
4329 The main classes here are: CaptureContext which tracks any
4330 captured information for a toplevel block and ScopeInfo used to
4331 track the activation frames for various local variables.
4333 Each toplevel block has an optional capture context associated
4334 with it. When a method contains an anonymous method both the
4335 toplevel method and the anonymous method will create a capture
4336 context. When variables or parameters are captured, they are
4337 recorded on the CaptureContext that owns them, for example:
4341 MyDelegate d = delegate {
4346 Here `a' will be recorded as captured on the toplevel
4347 CapturedContext, the inner captured context will not have anything
4348 (it will only have data if local variables or parameters from it
4349 are captured in a nested anonymous method.
4351 The ScopeInfo is used to track the activation frames for local
4352 variables, for example:
4354 for (int i = 0; i < 10; i++)
4355 for (int j = 0; j < 10; j++){
4356 MyDelegate d = delegate {
4361 At runtime this captures a single captured variable `i', but it
4362 captures 10 different versions of the variable `j'. The variable
4363 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4364 recorded on a child.
4366 The toplevel ScopeInfo will also track information like the `this'
4367 pointer if instance variables were referenced (this is necessary
4368 as the anonymous method lives inside a nested class in the host
4369 type of the method).
4371 (AnonymousMethod): Expanded to track the Toplevel, implement
4372 `AnonymousMethod.Compatible' to tell whether an anonymous method
4373 can be converted to a target delegate type.
4375 The routine now also produces the anonymous method content
4377 (AnonymousDelegate): A helper class that derives from
4378 DelegateCreation, this is used to generate the code necessary to
4379 produce the delegate for the anonymous method that was created.
4381 * assign.cs: API adjustments for new changes in
4382 Convert.ImplicitStandardConversionExists.
4384 * class.cs: Adjustments to cope with the fact that now toplevel
4385 blocks are of type `ToplevelBlock'.
4387 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4388 insteda of standard blocks.
4390 Flag errors if params arguments are passed to anonymous methods.
4392 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4393 `CurrentAnonymousMethod' which points to the current Anonymous
4394 Method. The variable points to the AnonymousMethod class that
4395 holds the code being compiled. It is set in the new EmitContext
4396 created for the anonymous method.
4398 (EmitContext.Phase): Introduce a variable and an enumeration to
4399 assist in enforcing some rules about when and where we are allowed
4400 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4401 only one that enfonces this right now).
4403 (EmitContext.HaveCaptureInfo): new helper method that returns
4404 whether we have a CapturedContext initialized.
4406 (EmitContext.CaptureVariable): New method used to register that a
4407 LocalInfo must be flagged for capturing.
4409 (EmitContext.CapturedParameter): New method used to register that a
4410 parameters must be flagged for capturing.
4412 (EmitContext.CapturedField): New method used to register that a
4413 field must be flagged for capturing.
4415 (EmitContext.HaveCapturedVariables,
4416 EmitContext.HaveCapturedFields): Return whether there are captured
4417 variables or fields.
4419 (EmitContext.EmitMethodHostInstance): This is used to emit the
4420 instance for the anonymous method. The instance might be null
4421 (static methods), this (for anonymous methods that capture nothing
4422 and happen to live side-by-side with the current method body) or a
4423 more complicated expression if the method has a CaptureContext.
4425 (EmitContext.EmitTopBlock): Routine that drives the emission of
4426 code: it will first resolve the top block, then emit any metadata
4427 and then emit the code. The split is done so that we can extract
4428 any anonymous methods and flag any captured variables/parameters.
4430 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4431 during this phase, the ILGenerator should not be used as labels
4432 and local variables declared here might not be accessible to any
4433 code that is part of an anonymous method.
4435 Exceptions to this include the temporary variables that are
4436 created by some statements internally for holding temporary
4439 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4442 (EmitContext.TemporaryReturn): This method is typically called
4443 from the Emit phase, and its the only place where we allow the
4444 ReturnLabel to be defined other than the EmitMeta. The reason is
4445 that otherwise we would have to duplicate a lot of logic in the
4446 Resolve phases of various methods that today is on the Emit
4449 (EmitContext.NeedReturnLabel): This no longer creates the label,
4450 as the ILGenerator is not valid during the resolve phase.
4452 (EmitContext.EmitThis): Extended the knowledge in this class to
4453 work in anonymous methods in addition to iterators.
4455 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4456 code is necessary on the stack to access the instance to a local
4457 variable (the variable will be accessed as a field).
4459 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4460 EmitContext.EmitAddressOfParameter): Routines to support
4461 parameters (not completed at this point).
4463 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4464 will also remove the parameters.
4466 * convert.cs (Convert): Define a `ConstantEC' which points to a
4467 null. This is just to prefity some code that uses
4468 ImplicitStandardConversion code and do not have an EmitContext
4471 The idea is to flag explicitly that at that point in time, it is
4472 known that the conversion will not trigger the delegate checking
4473 code in implicit conversions (which requires a valid
4476 Everywhere: pass new EmitContext parameter since
4477 ImplicitStandardConversionExists now requires it to check for
4478 anonymous method conversions.
4480 (Convert.ImplicitStandardConversionExists): If the type of an
4481 expression is the anonymous_method_type, and the type is a
4482 delegate, we invoke the AnonymousMethod.Compatible method to check
4483 whether an implicit conversion is possible.
4485 (Convert.ImplicitConversionStandard): Only do implicit method
4486 group conversions if the language level is not ISO_1.
4488 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4489 MethodInfo for the Invoke method. used by Delegate and
4492 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4493 method conversions if the target type is a delegate.
4495 Removed extra debugging nops.
4497 (LocalVariableReference): Turn the `local_info' into a public
4500 Add `prepared' field, the same hack used for FieldExprs to cope
4501 with composed assignments, as Local variables do not necessarily
4502 operate purely on the stack as they used to: they can be captured
4505 Add `temp' for a temporary result, like fields.
4507 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4509 It now copes with Local variables that are captured and emits the
4510 proper instance variable to load it from a field in the captured
4513 (ParameterReference.DoResolveBase): During the resolve phase,
4514 capture parameters if we are in an anonymous method.
4516 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
4517 anonymous method, use the EmitContext helper routines to emit the
4518 parameter reference.
4520 * iterators.cs: Set RemapToProxy to true/false during the
4523 * parameters.cs (GetParameterByName): New helper method.
4525 * typemanager.cs (anonymous_method_type) a new type that
4526 represents an anonyous method. This is always an internal type,
4527 used as a fencepost to test against the anonymous-methodness of an
4530 2004-10-20 Marek Safar <marek.safar@seznam.cz>
4532 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
4534 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
4536 2004-10-18 Martin Baulig <martin@ximian.com>
4538 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
4539 `Type' directly, but call ResolveType() on it.
4540 (Catch.Resolve): Likewise.
4541 (Foreach.Resolve): Likewise.
4543 2004-10-18 Martin Baulig <martin@ximian.com>
4545 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
4546 `Type' directly, but call ResolveType() on it.
4547 (Probe.DoResolve): Likewise.
4548 (ArrayCreation.LookupType): Likewise.
4549 (TypeOf.DoResolve): Likewise.
4550 (SizeOf.DoResolve): Likewise.
4552 2004-10-18 Martin Baulig <martin@ximian.com>
4554 * expression.cs (Invocation.BetterFunction): Put back
4555 TypeManager.TypeToCoreType().
4557 2004-10-18 Raja R Harinath <rharinath@novell.com>
4559 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
4562 2004-10-18 Martin Baulig <martin@ximian.com>
4564 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
4565 `Type' directly, but call ResolveType() on it.
4567 2004-10-18 Martin Baulig <martin@ximian.com>
4569 * class.cs (FieldMember.Define): Don't access the TypeExpr's
4570 `Type' directly, but call ResolveType() on it.
4571 (MemberBase.DoDefine): Likewise.
4573 * expression.cs (New.DoResolve): Don't access the TypeExpr's
4574 `Type' directly, but call ResolveType() on it.
4575 (ComposedCast.DoResolveAsTypeStep): Likewise.
4577 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
4578 `Type' directly, but call ResolveType() on it.
4580 2004-10-17 John Luke <john.luke@gmail.com>
4582 * class.cs (Operator.GetSignatureForError): use CSharpName
4584 * parameter.cs (Parameter.GetSignatureForError): Returns
4585 correct name even if was not defined.
4587 2004-10-13 Raja R Harinath <rharinath@novell.com>
4590 * class.cs (TypeContainer.EmitContext): New property.
4591 (DefineNestedTypes): Create an emitcontext for each part.
4592 (MethodCore.DoDefineParameters): Use container's emitcontext.
4593 Pass type array to InternalParameters.
4594 (MemberBase.DoDefine): Use container's emitcontext.
4595 (FieldMember.Define): Likewise.
4596 (Event.Define): Likewise.
4597 (SetMethod.GetParameterInfo): Change argument to EmitContext.
4598 Pass type array to InternalParameters.
4599 (SetIndexerMethod.GetParameterInfo): Likewise.
4600 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
4601 * delegate.cs (Define): Pass emitcontext to
4602 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
4603 array to InternalParameters.
4604 * expression.cs (ParameterReference.DoResolveBase): Pass
4605 emitcontext to GetParameterInfo.
4606 (ComposedCast.DoResolveAsTypeStep): Remove check on
4607 ec.ResolvingTypeTree.
4608 * parameter.cs (Parameter.Resolve): Change argument to
4609 EmitContext. Use ResolveAsTypeTerminal.
4610 (Parameter.GetSignature): Change argument to EmitContext.
4611 (Parameters.ComputeSignature): Likewise.
4612 (Parameters.ComputeParameterTypes): Likewise.
4613 (Parameters.GetParameterInfo): Likewise.
4614 (Parameters.ComputeAndDefineParameterTypes): Likewise.
4615 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
4616 * support.cs (InternalParameters..ctor): Remove variant that takes
4618 * typemanager.cs (system_intptr_expr): New.
4619 (InitExpressionTypes): Initialize it.
4621 2004-10-12 Chris Toshok <toshok@ximian.com>
4623 * cs-parser.jay: fix location for try_statement and catch_clause.
4625 2004-10-11 Martin Baulig <martin@ximian.com>
4627 * report.cs: Don't make --fatal abort on warnings, we have
4628 -warnaserror for that.
4630 2004-10-07 Raja R Harinath <rharinath@novell.com>
4632 More DeclSpace.ResolveType avoidance.
4633 * decl.cs (MemberCore.InUnsafe): New property.
4634 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
4635 with newly created EmitContext.
4636 (FieldMember.Define): Likewise.
4637 * delegate.cs (Delegate.Define): Likewise.
4638 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
4639 only if normal name-lookup fails.
4640 (TypeExpr.DoResolve): Enable error-checking.
4641 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
4642 (SizeOf.DoResolve): Likewise.
4643 (ComposedCast.DoResolveAsTypeStep): Likewise.
4644 (StackAlloc.DoResolve): Likewise.
4645 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
4646 (Block.Unsafe): New property.
4647 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
4648 (Unsafe): Set 'unsafe' flag of contained block.
4649 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
4650 (Fixed.Resolve): Likewise.
4651 (Catch.Resolve): Likewise.
4652 (Using.ResolveLocalVariableDecls): Likewise.
4653 (Foreach.Resolve): Likewise.
4655 2004-10-05 John Luke <john.luke@gmail.com>
4657 * cs-parser.jay: add location to error CS0175
4659 2004-10-04 Miguel de Icaza <miguel@ximian.com>
4661 * ecore.cs (Expression.Constantity): Add support for turning null
4664 * const.cs (Const.Define): Allow constants to be reference types
4665 as long as the value is Null.
4667 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
4669 * namespace.cs (NamespaceEntry.Using): No matter which warning
4670 level is set, check if this namespace name has already been added.
4672 2004-10-03 Ben Maurer <bmaurer@ximian.com>
4674 * expression.cs: reftype [!=]= null should always use br[true,false].
4677 2004-10-03 Marek Safar <marek.safar@seznam.cz>
4680 * attribute.cs: Enum conversion moved to
4681 GetAttributeArgumentExpression to be applied to the all
4684 2004-10-01 Raja R Harinath <rharinath@novell.com>
4686 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
4687 * class.c (TypeContainer.DefineType): Flag error if
4688 base types aren't accessible due to access permissions.
4689 * decl.cs (DeclSpace.ResolveType): Move logic to
4690 Expression.ResolveAsTypeTerminal.
4691 (DeclSpace.ResolveTypeExpr): Thin layer over
4692 Expression.ResolveAsTypeTerminal.
4693 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
4694 Refactor code into NestedAccess. Use it.
4695 (DeclSpace.NestedAccess): New.
4696 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
4697 argument to silence errors. Check access permissions.
4698 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
4699 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
4700 (Cast.DoResolve): Likewise.
4701 (New.DoResolve): Likewise.
4702 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
4703 (TypeOf.DoResolve): Likewise.
4705 * expression.cs (Invocation.BetterConversion): Return the Type of
4706 the better conversion. Implement section 14.4.2.3 more faithfully.
4707 (Invocation.BetterFunction): Make boolean. Make correspondence to
4708 section 14.4.2.2 explicit.
4709 (Invocation.OverloadResolve): Update.
4710 (Invocation): Remove is_base field.
4711 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
4712 (Invocation.Emit): Likewise.
4714 2004-09-27 Raja R Harinath <rharinath@novell.com>
4716 * README: Update to changes.
4718 2004-09-24 Marek Safar <marek.safar@seznam.cz>
4720 * cs-parser.jay: Reverted 642 warning fix.
4722 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4725 * decl.cs (FindMemberWithSameName): Indexer can have more than
4728 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4730 * expression.cs (LocalVariableReference.DoResolveLValue):
4731 Do not report warning 219 for out values.
4732 (EmptyExpression.Null): New member to avoid extra allocations.
4734 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4736 * cs-parser.jay: Fix wrong warning 642 report.
4738 * cs-tokenizer.cs (CheckNextToken): New helper;
4739 Inspect next character if is same as expected.
4741 2004-09-23 Martin Baulig <martin@ximian.com>
4743 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
4744 (Convert.ImplicitReferenceConversionExists): Likewise.
4746 2004-09-23 Marek Safar <marek.safar@seznam.cz>
4748 * class.cs (Operator.Define): Add error 448 and 559 report.
4750 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4752 * class.cs (MemberBase.IsTypePermitted): New protected
4753 method for checking error CS0610.
4755 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4757 * class.cs (TypeContainer.HasExplicitLayout): New property
4758 Returns whether container has StructLayout attribute set Explicit.
4759 (FieldMember): New abstract class for consts and fields.
4760 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
4761 (Field): Reuse FieldMember.
4763 * const.cs (Const): Reuse FieldMember.
4765 * rootcontext.cs: EmitConstants call moved to class.
4767 2004-09-22 Martin Baulig <martin@ximian.com>
4769 Thanks to Peter Sestoft for this bug report.
4771 * expression.cs (Conditional): If both the `trueExpr' and the
4772 `falseExpr' is a NullLiteral, return a NullLiteral.
4774 2004-09-22 Martin Baulig <martin@ximian.com>
4776 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
4777 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
4778 for the "get_Current" call.
4780 2004-09-22 Martin Baulig <martin@ximian.com>
4782 Marek and me just fixed one of our oldest bugs: #28562 :-)
4784 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
4786 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
4787 we're an EnumConstant, just return that.
4788 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
4789 an EnumConstant. In this case, we need to use GetValueAsEnumType()
4790 to get the value which'll actually be written into the attribute.
4791 However, we have to use GetValue() to access the attribute's value
4794 2004-09-22 Marek Safar <marek.safar@seznam.cz>
4796 * constant.cs (Constant.IsNegative): New abstract property
4799 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
4800 (StackAlloc.DoResolve): Reused IsNegative.
4802 2004-09-21 Martin Baulig <martin@ximian.com>
4804 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
4805 if we're used in an iterator, we may be called from different
4808 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
4809 we actually have an exception block.
4811 2004-09-20 John Luke <jluke@cfl.rr.com>
4813 * class.cs, cs-parser.jay: Improve the error report for 1520:
4814 report the actual line where the error happens, not where the
4817 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
4818 Pass location information that was available elsewhere.
4820 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
4822 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
4823 runtime to delay sign assemblies.
4825 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4827 * cs-parser.jay: Do not report the stack trace, this is barely
4830 2004-08-22 John Luke <john.luke@gmail.com>
4832 * driver.cs : check that a resource id is not already used
4833 before adding it, report CS1508 if it is, bug #63637
4835 2004-09-19 Miguel de Icaza <miguel@ximian.com>
4837 * ecore.cs: Removed dead code.
4839 2004-09-18 Marek Safar <marek.safar@seznam.cz>
4841 * class.cs: Do not report warning CS0067 on the interfaces.
4843 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4845 * cs-parser.jay: Add error 504 report.
4847 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4849 * rootcontext.cs: WarningLevel is 4 by default now.
4851 * statement.cs (Fixed.Resolve): Do not null
4854 2004-09-16 Marek Safar <marek.safar@seznam.cz>
4857 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
4858 deep search when property is not virtual.
4859 (PropertyExpr.ResolveAccessors): Make one call for both
4862 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4865 * statement.cs: Error 152 report constains also location.
4867 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4870 * const.cs: Explicitly set constant as static.
4872 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4875 * cs-parser.jay: Add error 1017 report.
4877 2004-09-15 Marek Safar <marek.safar@seznam.cz>
4879 Fixed bug #59980, #64224
4880 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
4882 * typemanager.cs (IsSpecialMethod): Simplified
4884 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4886 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
4887 condition with better params.
4889 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4892 * attribute.cs (Resolve): Property has to have both
4895 2004-09-14 Martin Baulig <martin@ximian.com>
4897 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
4899 2004-09-14 Marek Safar <marek.safar@seznam.cz>
4902 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
4903 called and is obsolete then this member suppress message
4904 when call is inside next [Obsolete] method or type.
4906 * expression.cs: Use TestObsoleteMethodUsage member.
4908 2004-09-14 Martin Baulig <martin@ximian.com>
4910 * cs-parser.jay: Sync a bit with the GMCS version.
4912 2004-09-14 Martin Baulig <martin@ximian.com>
4914 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
4915 (CSharpParser.yacc_verbose_flag): New public field.
4917 * genericparser.cs: Removed.
4919 2004-09-14 Raja R Harinath <rharinath@novell.com>
4921 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
4923 2004-09-13 Marek Safar <marek.safar@seznam.cz>
4925 * class.cs (MethodCore.CheckBase): Fix bug #65757.
4927 2004-09-10 Martin Baulig <martin@ximian.com>
4929 Backported my MemberName changes from GMCS into MCS.
4931 - we are now using a special `MemberName' class instead of using
4932 strings; in GMCS, the `MemberName' also contains the type
4935 - changed the grammar rules a bit:
4936 * the old `member_name' is now a `namespace_or_type_name':
4937 The rule is that we use `namespace_or_type_name' everywhere
4938 where we expect either a "member name" (GetEnumerator) or a
4939 "member name" with an explicit interface name
4940 (IEnumerable.GetEnumerator).
4941 In GMCS, the explicit interface name may include type arguments
4942 (IEnumerable<T>.GetEnumerator).
4943 * we use `member_name' instead of just `IDENTIFIER' for
4945 The rule is that we use `member_name' wherever a member may
4946 have type parameters in GMCS.
4948 * decl.cs (MemberName): New public class.
4949 (MemberCore.MemberName): New public readonly field.
4950 (MemberCore.ctor): Take a `MemberName' argument, not a string.
4951 (DeclSpace): Likewise.
4953 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
4954 * enum.cs (Enum.ctor): Likewise.
4956 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
4958 (AliasEntry.ctor): Take a MemberName, not an Expression.
4959 (AliasEntry.UsingAlias): Likewise.
4961 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
4962 (IMethodData.MemberName): Changed type from string to MemberName.
4963 (MemberBase.ExplicitInterfaceName): Likewise.
4964 (AbstractPropertyEventMethod.SetupName): Make this private.
4965 (AbstractPropertyEventMethod.ctor): Added `string prefix'
4966 argument; compute the member name here.
4967 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
4968 on the `member.MemberName' and the `prefix'.
4970 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
4972 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
4973 thus, we get a `MemberName' instead of a `string'. These
4974 declarations may have type parameters in GMCS.
4975 (interface_method_declaration, delegate_declaration): Likewise.
4976 (class_declaration, interface_declaration): Likewise.
4977 (method_header): Use `namespace_or_type_name' instead of
4978 `member_name'. We may be an explicit interface implementation.
4979 (property_declaration, event_declaration): Likewise.
4980 (member_name): This is now just an `IDENTIFIER', not a
4981 `namespace_or_type_name'.
4982 (type_name, interface_type): Removed.
4983 (namespace_or_type_name): Return a MemberName, not an Expression.
4984 (primary_expression): Use `member_name' instead of `IDENTIFIER';
4985 call GetTypeExpression() on the MemberName to get an expression.
4986 (IndexerDeclaration.interface_type): Changed type from string to
4988 (MakeName): Operate on MemberName's instead of string's.
4990 2004-09-13 Raja R Harinath <rharinath@novell.com>
4993 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
4994 (NamespaceEntry.Lookup): Add new argument to flag if we want the
4995 lookup to avoid symbols introduced by 'using'.
4996 * rootcontext.cs (NamespaceLookup): Update.
4998 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5000 * class.cs (TypeContainer.DoDefineMembers): Do not call
5001 DefineDefaultConstructor for static classes.
5003 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5005 * attribute.cs (Attribute.Resolve): Add error 653 report.
5007 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5009 (Method.ApplyAttributeBuilder): Add error 685 report.
5010 (Operator.Define): Add error 564 report.
5012 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5014 * expression.cs (Invocation.DoResolve): Add error
5017 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5020 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5022 * class.cs (ConstructorInitializer.Resolve):
5023 Wrong error number (515->516).
5025 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5027 * class.cs (Indexer.Define): Add error 631 report.
5029 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5031 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5033 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5035 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5037 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5039 * cs-parser.jay: Added error CS0241 report.
5041 2004-09-10 Raja R Harinath <rharinath@novell.com>
5043 * cs-parser.jay (fixed_statement): Introduce a scope for the
5044 declaration in the 'fixed' statement.
5046 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5048 * cs-parser.jay: Added CS0230 error report.
5050 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5052 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5054 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5056 * expression.cs (Argument.Resolve): Added error CS0192 and
5059 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5061 C# 2.0 #pragma warning feature
5063 * cs-tokenizer.cs (PreProcessPragma): New method;
5064 Handles #pragma directive.
5066 * report.cs (WarningRegions): New class; Support
5067 class for #pragma warning directive. It tests whether
5068 warning is enabled for a given line.
5070 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5072 * const.cs: Add more descriptive error report, tahnks to
5075 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5077 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5079 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5081 * expression.cs: Apply patch from Ben: Remove dead code from
5082 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5083 as that code just threw an exception anwyays.
5085 * const.cs: Remove the call to the turnintoconstant, for details
5088 * literal.cs: The type of the null-literal is the null type; So
5089 we use a placeholder type (literal.cs:System.Null, defined here)
5092 * expression.cs (Conditional.DoResolve): Remove some old code that
5093 is no longer needed, conversions have been fixed.
5095 (ArrayCreationExpression.DoResolve): Return false if we fail to
5096 resolve the inner expression.
5098 2004-09-07 Raja R Harinath <rharinath@novell.com>
5101 * cs-parser.jay (delegate_declaration): Record a delegate
5102 declaration as a type declaration.
5103 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5105 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5107 * parameter.cs: Do not crash if the type can not be resolved.
5109 * expression.cs: Report errors with unsafe pointers, fixes #64896
5111 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5113 * expression.cs: Pointer arith always needs to do a conv.i
5114 if the operand is a long. fix 65320
5116 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5118 Fixed cs0619-37.cs, cs0619-38.cs
5120 * enum.cs (GetObsoleteAttribute): Removed.
5122 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5123 on Enum member is double staged. The first is tested member
5126 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5128 Fixed #56986, #63631, #65231
5130 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5131 adds member to name container.
5132 (TypeContainer.AddToTypeContainer): New method, adds type to
5134 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5135 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5136 AddOperator): Simplified by reusing AddToMemberContainer.
5137 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5139 (Method.CheckForDuplications): Fixed implementation to test all
5141 (MemberBase): Detection whether member is explicit interface
5142 implementation is now in constructor.
5143 (MemberBase.UpdateMemberName): Handles IndexerName.
5144 (Accessor): Changed to keep also location information.
5145 (AbstractPropertyEventMethod): Is derived from MemberCore.
5146 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5147 will be emited or not.
5148 (PropertyBase.AreAccessorsDuplicateImplementation):
5149 Tests whether accessors are not in collision with some method.
5150 (Operator): Is derived from MethodCore to simplify common
5153 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5155 (DeclSpace.AddToContainer): Adds the member to defined_names
5156 table. It tests for duplications and enclosing name conflicts.
5158 * enum.cs (EnumMember): Clean up to reuse the base structures
5160 2004-09-03 Martin Baulig <martin@ximian.com>
5162 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5163 into TypeContainer, to make partial classes work again.
5165 2004-09-03 Martin Baulig <martin@ximian.com>
5167 * rootcontext.cs (RootContext.V2): Removed.
5169 2004-03-23 Martin Baulig <martin@ximian.com>
5171 * expression.cs (Invocation.OverloadResolve): Added `bool
5172 may_fail' argument and use it instead of the Location.IsNull() hack.
5174 2004-09-03 Martin Baulig <martin@ximian.com>
5176 Merged latest changes into gmcs. Please keep this comment in
5177 here, it makes it easier for me to see what changed in MCS since
5178 the last time I merged.
5180 2004-09-03 Raja R Harinath <rharinath@novell.com>
5183 * expression.cs (BetterConversion): Don't allow either conversion
5184 to be null. Remove redundant implicit conversion test when 'q ==
5185 null' -- when this function is invoked, we already know that the
5186 implicit conversion exists.
5187 (BetterFunction): Assume that 'best' is non-null. Remove
5188 redundant reimplementation of IsApplicable when 'best' is null.
5189 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5190 number of arguments.
5191 (IsAncestralType): Extract from OverloadResolve.
5192 (OverloadResolve): Make robust to the MethodGroupExpr being
5193 unsorted. Implement all the logic of Section 14.5.5.1, and
5194 support overloading of methods from multiple applicable types.
5195 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5197 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5198 (RealError, Warning): Append type of report to related symbol.
5200 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5202 * enum.cs: Fixed CLS-Compliance checks for enum members.
5203 Error tests cs3008-8.cs, cs3014-8.cs
5205 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5207 Fixed bug #62342, #63102
5208 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5209 like ImplementMethod.
5211 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5213 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5216 2004-09-02 Martin Baulig <martin@ximian.com>
5218 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5219 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5222 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5224 C# 2.0 Static classes implemented
5226 * class.cs (TypeContainer): instance_constructors,
5227 initialized_fields, initialized_static_fields,
5228 default_constructor, base_inteface_types are protected to be
5229 accessible from StaticClass.
5230 (TypeContainer.DefineDefaultConstructor): New virtual method
5231 for custom default constructor generating
5232 (StaticClass): New class to handle "Static classes" feature.
5234 * cs-parser.jay: Handle static keyword on class like instance
5237 * driver.cs: Added "/langversion" command line switch with two
5238 options (iso-1, default).
5240 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5242 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5244 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5246 * delegate.cs: Style.
5248 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5250 * delegate.cs: Add seperate instance expr field for miguel.
5252 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5254 * PointerArithmetic (Resolve): make sure we are not doing
5255 pointer arith on void*. Also, make sure we are resolved
5256 by not setting eclass until resolve.
5258 All callers: Make sure that PointerArithmetic gets resolved.
5260 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5262 * ArrayCreation (LookupType): If the type does not resolve
5263 to an array, give an error.
5265 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5267 * statement.cs (Try.Resolve): Fixed bug #64222
5269 2004-08-27 Martin Baulig <martin@ximian.com>
5272 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5275 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5277 * ecore.cs (Constantify): Get underlying type via
5278 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5279 Windows in special cases.
5281 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5283 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5284 for obtaining also private methods.
5285 (GetRemoveMethod): Used GetRemoveMethod (true)
5286 for obtaining also private methods.
5288 2004-08-24 Martin Baulig <martin@ximian.com>
5290 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5291 MethodAttributes.HideBySig for operators.
5293 2004-08-23 Martin Baulig <martin@ximian.com>
5295 Back to the old error reporting system :-)
5297 * report.cs (Message): Removed.
5298 (Report.MessageData, ErrorData, WarningData): Removed.
5299 (Report.Error, Warning): Back to the old system.
5301 2004-08-23 Martin Baulig <martin@ximian.com>
5303 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5305 * class.cs (TypeContainer.ParentContainer): New public virtual
5306 method; replaces the explicit interface implementation.
5307 (ClassPart.ParentContainer): Override.
5309 2004-08-23 Martin Baulig <martin@ximian.com>
5311 * statement.cs (Switch): Added support for constant switches; see
5312 #59428 or test-285.cs.
5314 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5317 * statement.cs (GetEnumeratorFilter): Removed useless
5318 logic because C# specs is strict. GetEnumerator must be
5321 2004-08-22 Martin Baulig <martin@ximian.com>
5323 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5324 a switch and may break, reset the barrier. Fixes #59867.
5326 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5328 CLS-Compliance speed up (~5% for corlib)
5330 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5331 New method. Tests container for CLS-Compliant names
5333 * class.cs (TypeContainer.VerifyClsName): New method.
5334 Checks whether container name is CLS Compliant.
5335 (Constructor): Implements IMethodData.
5337 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5338 low-case table for CLS Compliance test.
5339 (MemberCache.VerifyClsParameterConflict): New method.
5340 Checks method parameters for CS3006 error.
5342 * enum.cs (EnumMember): Is derived from MemberCore.
5343 (Enum.VerifyClsName): Optimized for better performance.
5345 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5347 * report.cs: Renamed Error_T to Error and changed all
5350 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5352 * class.cs (TypeContainer.IndexerArrayList): New inner class
5353 container for indexers.
5354 (TypeContainer.DefaultIndexerName): New constant for default
5355 indexer name. Replaced all "Item" with this constant.
5356 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5358 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5359 DefaultMemberAttribute constructor.
5361 2004-08-05 Martin Baulig <martin@ximian.com>
5363 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5366 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5368 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5369 multi platforms problem.
5371 * compiler.csproj: Included shared files.
5373 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5375 Fix bug 60333, 55971 in the more general way
5376 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5377 Added arg_type argument for constant conversion.
5378 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5380 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5383 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5384 OperatorArrayList, MethodCoreArrayList for typecontainer
5385 containers. Changed class member types to these new types.
5386 (MethodArrayList.DefineMembers): Added test for CS0659.
5388 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5390 * cfold.cs: Synchronize the folding with the code in expression.cs
5391 Binary.DoNumericPromotions for uint operands.
5393 * attribute.cs: Revert patch from Raja, it introduced a regression
5394 while building Blam-1.2.1 (hard to isolate a test case).
5396 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5400 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5402 (MethodCore.parent_method): New member. The method we're overriding
5403 if this is an override method.
5404 (MethodCore.CheckBase): Moved from Method class and made common.
5405 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5407 (MethodCore.CheckForDuplications): New abstract method. For custom
5408 member duplication search in a container
5409 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5410 method and its return type.
5411 (Event.conflict_symbol): New member. Symbol with same name in the
5415 (MemberCache.FindMemberWithSameName): New method. The method
5416 is looking for conflict with inherited symbols.
5418 2004-08-04 Martin Baulig <martin@ximian.com>
5420 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5422 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5424 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5426 * report.cs (Message): New enum for better error, warning reference in
5428 (MessageData): New inner abstract class. It generally handles printing of
5429 error and warning messages.
5430 Removed unused Error, Warning, Message methods.
5432 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5434 Fix for cs0592-8.cs test
5436 (Attributable.ValidAttributeTargets): Made public.
5437 (Attribute.ExplicitTarget): New member for explicit target value.
5438 (Attribute.CheckTargets): Now we translate explicit attribute
5439 target to Target here.
5441 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5443 * ecore.cs (MethodGroupExpr): new IsBase property.
5445 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5447 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5448 rather than an instance expr.
5450 (DelegateCreation.Emit): Use the method group rather than
5451 the instance expression. Also, if you have base.Foo as the
5452 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5454 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5456 (NewDelegate.DoResolve): Only check for the existance of Invoke
5457 if the method is going to be needed. Use MethodGroupExpr.
5459 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5461 * expression.cs: For pointer arith., make sure to use
5462 the size of the type, not the size of the pointer to
5465 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5468 * class.cs (Class): Added error CS0502 test.
5470 2004-08-03 John Luke <jluke@cfl.rr.com>
5471 Raja R Harinath <rharinath@novell.com>
5474 * attribute.cs (Attribute.complained_before): New flag.
5475 (Attribute.ResolveType, Attribute.Resolve),
5476 (Attribute.DefinePInvokeMethod): Set it.
5477 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5479 2004-08-03 Martin Baulig <martin@ximian.com>
5481 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5482 use a user-defined operator; we still need to do numeric
5483 promotions in case one argument is a builtin type and the other
5484 one has an implicit conversion to that type. Fixes #62322.
5486 2004-08-02 Martin Baulig <martin@ximian.com>
5488 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5489 (LocalInfo.IsThis): New public property.
5490 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5492 2004-08-01 Martin Baulig <martin@ximian.com>
5494 * class.cs (TypeContainer.GetClassBases): Don't set the default
5495 here since we may get called from GetPartialBases().
5496 (TypeContainer.DefineType): If GetClassBases() didn't return a
5497 parent, use the default one.
5499 2004-07-30 Duncan Mak <duncan@ximian.com>
5501 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
5503 2004-07-30 Martin Baulig <martin@ximian.com>
5505 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5507 * class.cs (SourceMethod): New public class, derive from the
5508 symbol writer's ISourceMethod.
5509 (Method): Use the new symbol writer API.
5511 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5512 as argument and use the new symbol writer.
5515 (SourceFile): Implement the symbol writer's ISourceFile.
5516 (Location.SymbolDocument): Removed.
5517 (Location.SourceFile): New public property.
5519 * symbolwriter.cs: Use the new symbol writer API.
5521 2004-07-30 Raja R Harinath <rharinath@novell.com>
5523 * Makefile (install-local): Remove. Functionality moved to
5526 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
5528 * Makefile: Install mcs.exe.config file together with mcs.exe.
5529 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
5530 correct runtime version.
5532 2004-07-25 Martin Baulig <martin@ximian.com>
5535 (TypeContainer.RegisterOrder): Removed, this was unused.
5536 (TypeContainer, interface_order): Removed.
5537 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
5538 TypeContainer as argument since we can also be called with a
5539 `PartialContainer' for a partial class/struct/interface.
5540 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
5541 of checking whether we're an `Interface' - we could be a
5543 (PartialContainer.Register): Override; call
5544 AddClass()/AddStruct()/AddInterface() on our parent.
5546 * cs-parser.jay (interface_member_declaration): Add things to the
5547 `current_container', not the `current_class'.
5549 * rootcontext.cs (RegisterOrder): The overloaded version which
5550 takes an `Interface' was unused, removed.
5552 * typemanager.cs (TypeManager.LookupInterface): Return a
5553 `TypeContainer', not an `Interface'.
5554 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
5555 contain a `PartialContainer' for an interface, so check it's
5556 `Kind' to figure out what it is.
5558 2004-07-25 Martin Baulig <martin@ximian.com>
5560 * class.cs (Class.DefaultTypeAttributes): New public constant.
5561 (Struct.DefaultTypeAttributes): Likewise.
5562 (Interface.DefaultTypeAttributes): Likewise.
5563 (PartialContainer.TypeAttr): Override this and add the
5564 DefaultTypeAttributes.
5566 2004-07-25 Martin Baulig <martin@ximian.com>
5568 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
5569 we can just use the `Parent' field instead.
5571 2004-07-25 Martin Baulig <martin@ximian.com>
5573 * class.cs (TypeContainer.Emit): Renamed to EmitType().
5575 2004-07-25 Martin Baulig <martin@ximian.com>
5577 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
5578 our parts before defining any methods.
5579 (TypeContainer.VerifyImplements): Make this virtual.
5580 (ClassPart.VerifyImplements): Override and call VerifyImplements()
5581 on our PartialContainer.
5583 2004-07-25 Martin Baulig <martin@ximian.com>
5585 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
5587 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
5588 argument, we can just use the `Parent' field instead.
5591 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
5592 (MemberBase.DoDefine): Likewise.
5594 2004-07-24 Martin Baulig <martin@ximian.com>
5596 * decl.cs (MemberCore.Parent): New public field.
5597 (DeclSpace.Parent): Moved to MemberCore.
5599 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
5600 (MemberBase.ctor): Added TypeContainer argument, pass it to our
5602 (FieldBase, Field, Operator): Likewise.
5603 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
5604 (EventField, Event): Likewise.
5606 2004-07-23 Martin Baulig <martin@ximian.com>
5608 * class.cs (PartialContainer): New public class.
5609 (ClassPart): New public class.
5610 (TypeContainer): Added support for partial classes.
5611 (TypeContainer.GetClassBases): Splitted some of the functionality
5612 out into GetNormalBases() and GetPartialBases().
5614 * cs-tokenizer.cs (Token.PARTIAL): New token.
5615 (Tokenizer.consume_identifier): Added some hacks to recognize
5616 `partial', but only if it's immediately followed by `class',
5617 `struct' or `interface'.
5619 * cs-parser.jay: Added support for partial clases.
5621 2004-07-23 Martin Baulig <martin@ximian.com>
5623 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
5624 a `DeclSpace' and also made it readonly.
5625 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
5626 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
5627 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
5629 * cs-parser.jay: Pass the `current_class', not the
5630 `current_container' (at the moment, this is still the same thing)
5631 to a new Method, Property, Event, Indexer or Constructor.
5633 2004-07-23 Martin Baulig <martin@ximian.com>
5635 * cs-parser.jay (CSharpParser): Added a new `current_class' field
5636 and removed the `current_interface' one.
5637 (struct_declaration, class_declaration, interface_declaration):
5638 Set `current_class' to the newly created class/struct/interface;
5639 set their `Bases' and call Register() before parsing their body.
5641 2004-07-23 Martin Baulig <martin@ximian.com>
5643 * class.cs (Kind): New public enum.
5644 (TypeContainer): Made this class abstract.
5645 (TypeContainer.Kind): New public readonly field.
5646 (TypeContainer.CheckDef): New public method; moved here from
5648 (TypeContainer.Register): New public abstract method.
5649 (TypeContainer.GetPendingImplementations): New public abstract
5651 (TypeContainer.GetClassBases): Removed the `is_class' and
5652 `is_iface' parameters.
5653 (TypeContainer.DefineNestedTypes): Formerly known as
5655 (ClassOrStruct): Made this class abstract.
5657 * tree.cs (RootTypes): New public type.
5659 2004-07-20 Martin Baulig <martin@ximian.com>
5661 * tree.cs (Tree.RecordNamespace): Removed.
5662 (Tree.Namespaces): Removed.
5664 * rootcontext.cs (RootContext.IsNamespace): Removed.
5666 * cs-parser.jay (namespace_declaration): Just create a new
5667 NamespaceEntry here.
5669 2004-07-20 Martin Baulig <martin@ximian.com>
5671 * statement.cs (ExceptionStatement): New abstract class. This is
5672 now used as a base class for everyone who's using `finally'.
5673 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
5674 our local variables before using them.
5676 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
5677 virtual method. This is used by Yield.Resolve() to "steal" an
5678 outer block's `finally' clauses.
5679 (FlowBranchingException): The .ctor now takes an ExceptionStatement
5682 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
5683 version which takes an ExceptionStatement. This version must be
5684 used to create exception branchings.
5687 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
5688 (Iterator.EmitMoveNext): Added exception support; protect the
5689 block with a `fault' clause, properly handle 'finally' clauses.
5690 (Iterator.EmitDispose): Run all the `finally' clauses here.
5692 2004-07-20 Martin Baulig <martin@ximian.com>
5694 * iterator.cs: This is the first of a set of changes in the
5695 iterator code. Match the spec more closely: if we're an
5696 IEnumerable, then GetEnumerator() must be called. The first time
5697 GetEnumerator() is called, it returns the current instance; all
5698 subsequent invocations (if any) must create a copy.
5700 2004-07-19 Miguel de Icaza <miguel@ximian.com>
5702 * expression.cs: Resolve the constant expression before returning
5705 2004-07-19 Martin Baulig <martin@ximian.com>
5707 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
5708 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
5709 the return type of the new EmitContext.
5711 2004-07-18 Martin Baulig <martin@ximian.com>
5713 * class.cs (Property.Define): Fix iterators.
5715 * iterators.cs (Iterator.Define): Moved the
5716 `container.AddInterator (this)' call here from the .ctor; only do
5717 it if we resolved successfully.
5719 2004-07-17 Miguel de Icaza <miguel@ximian.com>
5721 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
5722 `true' for preprocessing directives that we parse. The return
5723 value indicates whether we should return to regular tokenizing or
5724 not, not whether it was parsed successfully.
5726 In the past if we were in: #if false ... #line #endif, we would
5727 resume parsing after `#line'. See bug 61604.
5729 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
5730 building: IsEnumType should return true only for enums, not for
5731 enums or System.Enum itself. This fixes #61593.
5733 Likely what happened is that corlib was wrong: mcs depended on
5734 this bug in some places. The bug got fixed, we had to add the
5735 hack, which caused bug 61593.
5737 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
5738 that was a workaround for the older conditions.
5740 2004-07-16 Ben Maurer <bmaurer@ximian.com>
5742 * assign.cs: IAssignMethod has a new interface, as documented
5743 inline. All assignment code now uses this new api.
5745 * ecore.cs, expression.cs: All classes which implement
5746 IAssignMethod now use the new interface.
5748 * expression.cs (Invocation): add a hack to EmitCall so that
5749 IndexerAccess can be the target of a compound assignment without
5750 evaluating its arguments twice.
5752 * statement.cs: Handle changes in Invocation api.
5754 2004-07-16 Martin Baulig <martin@ximian.com>
5756 * iterators.cs: Rewrote this. We're now using one single Proxy
5757 class for both the IEnumerable and the IEnumerator interface and
5758 `Iterator' derives from Class so we can use the high-level API.
5760 * class.cs (TypeContainer.AddIterator): New method.
5761 (TypeContainer.DoDefineType): New protected virtual method, which
5762 is called from DefineType().
5763 (TypeContainer.DoDefineMembers): Call DefineType() and
5764 DefineMembers() on all our iterators.
5765 (TypeContainer.Emit): Call Emit() on all our iterators.
5766 (TypeContainer.CloseType): Call CloseType() on all our iterators.
5768 * codegen.cs (EmitContext.CurrentIterator): New public field.
5770 2004-07-15 Martin Baulig <martin@ximian.com>
5773 (TypeManager.not_supported_exception_type): New type.
5775 2004-07-14 Martin Baulig <martin@ximian.com>
5777 * iterators.cs: Use real error numbers.
5779 2004-07-14 Martin Baulig <martin@ximian.com>
5781 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
5782 requires this to be a System.Collection.IEnumerable and not a
5783 class implementing that interface.
5784 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
5786 2004-07-13 Marek Safar <marek.safar@seznam.cz>
5788 * class.cs: Fixed previous fix, it broke some error tests.
5790 2004-07-12 Martin Baulig <martin@ximian.com>
5792 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
5795 2004-07-09 Miguel de Icaza <miguel@ximian.com>
5797 * assign.cs (LocalTemporary): Add new argument: is_address,If
5798 `is_address' is true, then the value that we store is the address
5799 to the real value, and not the value itself.
5801 * ecore.cs (PropertyExpr): use the new local temporary
5802 stuff to allow us to handle X.Y += z (where X is a struct)
5804 2004-07-08 Martin Baulig <martin@ximian.com>
5806 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
5807 not always return, just like we're doing in Using.Resolve().
5809 2004-07-07 Miguel de Icaza <miguel@ximian.com>
5811 * cs-parser.jay (fixed_statement): flag this as Pinned.
5813 2004-07-06 Miguel de Icaza <miguel@ximian.com>
5815 * typemanager.cs (TypeManager): Removed MakePinned method, this
5816 mechanism is replaced with the .NET 2.x compatible mechanism of
5817 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
5819 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
5820 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
5821 `IsFixed' property which has a different meaning.
5823 2004-07-02 Raja R Harinath <rharinath@novell.com>
5825 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
5826 visible from inside a nested class, not just the names of the
5827 immediately enclosing class.
5830 2004-06-24 Raja R Harinath <rharinath@novell.com>
5832 * expression.cs (BetterConversion): Remove buggy special-case
5833 handling of "implicit constant expression conversions". At this
5834 point, we already know that the conversion is possible -- we're
5835 only checking to see which is better.
5837 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5839 * cs-parser.jay: Added error CS0210 test.
5841 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5843 * cs-parser.jay: Added error CS0134 test.
5845 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5848 * cs-parser.jay: Added error CS0145 test.
5850 2004-06-24 Marek Safar <marek.safar@seznam.cz>
5852 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
5854 2004-06-23 Ben Maurer <bmaurer@ximian.com>
5856 * expression.cs (StackAlloc.Resolve): The argument may not
5857 be a constant; deal with this case.
5859 2004-06-23 Marek Safar <marek.safar@seznam.cz>
5861 * attribute.cs (IndexerName_GetIndexerName): Renamed to
5862 GetIndexerAttributeValue.
5863 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
5865 * class.cs (Indexer.Define): Added error tests for CS0415,
5868 2004-06-23 Miguel de Icaza <miguel@ximian.com>
5870 * attribute.cs (Attribute.Resolve): Keep field code in sync with
5873 2004-06-23 Martin Baulig <martin@ximian.com>
5875 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
5876 neither return nor throw, reset the barrier as well. Fixes #60457.
5878 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
5880 * class.cs : EventAttributes is now set to None by default.
5881 This fixes bug #60459.
5883 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5886 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
5887 Don't throw exception but return null (it's sufficient now).
5889 2004-06-18 Marek Safar <marek.safar@seznam.cz>
5891 * typemanager.cs (GetArgumentTypes): Faster implementation.
5893 2004-06-18 Martin Baulig <martin@ximian.com>
5895 * attribute.cs (Attribute.Resolve): Check whether we're an
5896 EmptyCast which a Constant child. Fixes #60333.
5898 2004-06-17 Ben Maurer <bmaurer@ximian.com>
5900 * statement.cs (EmitCollectionForeach): Account for the fact that
5901 not all valuetypes are in areas which we can take the address of.
5902 For these variables, we store to a temporary variable. Also, make
5903 sure that we dont emit a `callvirt' on a valuetype method.
5905 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5907 * expression.cs (StackAlloc.DoReSolve): Added test for
5908 negative parameter (CS0247).
5910 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5913 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
5915 2004-06-15 Marek Safar <marek.safar@seznam.cz>
5918 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
5921 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5923 Fix bug #58254 & cs1555.cs, cs1556.cs
5924 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
5926 2004-06-14 Marek Safar <marek.safar@seznam.cz>
5928 * cs-parser.jay: Added error CS1669 test for indexers.
5930 2004-06-11 Martin Baulig <martin@ximian.com>
5932 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
5933 call this twice: for params and varargs methods.
5935 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5938 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
5940 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5942 * attribute.cs (Attribute.GetValidTargets): Made public.
5945 (AbstractPropertyEventMethod): New class for better code sharing.
5946 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
5948 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
5950 2004-06-11 Raja R Harinath <rharinath@novell.com>
5953 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
5954 that the call to Resolve is part of a MemberAccess.
5955 (Expression.Resolve): Use it for SimpleName resolution.
5956 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
5957 Add 'intermediate' boolean argument.
5958 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
5959 error message when the SimpleName can be resolved ambiguously
5960 between an expression and a type.
5961 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
5963 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
5964 call on the left-side.
5966 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5969 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
5971 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5973 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
5975 2004-06-11 Martin Baulig <martin@ximian.com>
5977 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
5978 varargs methods if applicable.
5980 2004-06-11 Martin Baulig <martin@ximian.com>
5982 * expression.cs (Invocation.EmitCall): Don't use
5983 `method.CallingConvention == CallingConventions.VarArgs' since the
5984 method could also have `CallingConventions.HasThis'.
5986 2004-06-11 Marek Safar <marek.safar@seznam.cz>
5988 * class.cs (Event.GetSignatureForError): Implemented.
5989 Fixed crash in error test cs3010.cs
5991 2004-06-10 Miguel de Icaza <miguel@ximian.com>
5993 * cs-tokenizer.cs: Change the way we track __arglist to be
5994 consistent with the other keywords.
5996 2004-06-09 Miguel de Icaza <miguel@ximian.com>
5998 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
6001 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
6003 * codegen.cs: Check that all referenced assemblies have a strongname
6004 before strongnaming the compiled assembly. If not report error CS1577.
6005 Fix bug #56563. Patch by Jackson Harper.
6006 * typemanager.cs: Added a method to return all referenced assemblies.
6007 Fix bug #56563. Patch by Jackson Harper.
6009 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6012 (Method.ApplyAttributeBuilder): Moved and added conditional
6013 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
6016 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
6018 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6021 * class.cs: (EventField.attribute_targets): Changed default target.
6023 2004-06-08 Martin Baulig <martin@ximian.com>
6025 * expression.cs (Invocation.EmitCall): Enable varargs methods.
6027 2004-06-08 Martin Baulig <martin@ximian.com>
6029 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
6031 2004-06-07 Martin Baulig <martin@ximian.com>
6033 Added support for varargs methods.
6035 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
6038 * cs-parser.jay: Added support for `__arglist'.
6040 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
6042 * expression.cs (Argument.AType): Added `ArgList'.
6043 (Invocation): Added support for varargs methods.
6044 (ArglistAccess): New public class.
6045 (Arglist): New public class.
6047 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
6049 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
6050 a method's top-level block if the method has varargs.
6052 * support.cs (ReflectionParameters, InternalParameters): Added
6053 support for varargs methods.
6055 2004-06-07 Miguel de Icaza <miguel@ximian.com>
6057 * class.cs: Provide location in indexer error report.
6059 * driver.cs: Use standard names.
6061 * namespace.cs: Catch the use of using after a namespace has been
6062 declared also on using aliases.
6064 2004-06-03 Raja R Harinath <rharinath@novell.com>
6067 * typemanager.cs (closure_private_ok, closure_invocation_type)
6068 (closure_qualifier_type, closure_invocation_assembly)
6069 (FilterWithClosure): Move to ...
6070 (Closure): New internal nested class.
6071 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
6072 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
6073 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
6074 (MemberLookup, MemberLookupFailed): Use it.
6075 * expression.cs (New.DoResolve): Treat the lookup for the
6076 constructor as being qualified by the 'new'ed type.
6077 (Indexers.GetIndexersForTypeOrInterface): Update.
6079 2004-06-03 Marek Safar <marek.safar@seznam.cz>
6082 (GetConditionalAttributeValue): New method. Returns
6083 condition of ConditionalAttribute.
6084 (SearchMulti): New method. Returns all attributes of type 't'.
6085 Use it when attribute is AllowMultiple = true.
6086 (IsConditionalMethodExcluded): New method.
6089 (Method.IsExcluded): Implemented. Returns true if method has conditional
6090 attribute and the conditions is not defined (method is excluded).
6091 (IMethodData): Extended interface for ConditionalAttribute support.
6092 (PropertyMethod.IsExcluded): Implemented.
6095 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
6098 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
6101 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
6103 * expression.cs (ArrayCreationExpression): Make this just an
6104 `expression'. It can't be a statement, so the code here was
6107 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6110 * typemanager.cs (GetFullNameSignature): New method for
6113 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6116 * class.cs (MemberBase.GetSignatureForError): New virtual method.
6117 Use this method when MethodBuilder is null.
6118 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
6119 Added test for error CS0626 (MONO reports error for this situation).
6120 (IMethodData.GetSignatureForError): Extended interface.
6122 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6125 (AttributeTester.GetObsoleteAttribute): Returns instance of
6126 ObsoleteAttribute when type is obsolete.
6129 (TypeContainer.VerifyObsoleteAttribute): Override.
6130 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6131 (MethodCode.VerifyObsoleteAttribute): Override.
6132 (MemberBase.VerifyObsoleteAttribute): Override.
6135 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6136 and report proper error.
6139 Delegate.VerifyObsoleteAttribute): Override.
6142 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6143 and report proper error.
6144 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6147 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6151 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6152 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6153 Added test for ObsoleteAttribute.
6156 (Catch): Derived from Statement.
6158 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6160 Fixed bug #59071 & cs0160.cs
6162 * statement.cs (Try.Resolve): Check here whether order of catch
6163 clauses matches their dependencies.
6165 2004-05-31 Miguel de Icaza <miguel@ximian.com>
6167 * Reverted patch to namespace.cs (Use lookuptypedirect). This
6168 caused a regression: #59343. Referencing nested classes from an
6169 assembly stopped working.
6171 2004-05-31 Martin Baulig <martin@ximian.com>
6173 MCS is now frozen for beta 2.
6175 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6177 * convert.cs: add a trivial cache for overload operator resolution.
6179 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6181 * decl.cs: If possible, use lookuptypedirect here. We can only do
6182 this if there is no `.' after the namespace. Avoids using
6183 LookupType, which does lots of slow processing.
6184 (FindNestedType) New method, does what it says :-).
6185 * namespace.cs: use LookupTypeDirect.
6186 * rootcontext.cs: use membercache, if possible.
6187 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6189 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6192 According to the spec,
6194 In a member access of the form E.I, if E is a single identifier,
6195 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6196 field, property, localvariable, or parameter with the same type as
6197 the meaning of E as a type-name (§3.8), then both possible
6198 meanings of E are permitted.
6200 We did not check that E as a simple-name had the same type as E as
6203 This trivial check gives us 5-7% on bootstrap time.
6205 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6207 * expression.cs (Invocation.OverloadResolve): Avoid the
6208 use of hashtables and boxing here by allocating on demand.
6210 2004-05-30 Martin Baulig <martin@ximian.com>
6212 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6213 we're doing a silent lookup. Don't try to lookup nested types in
6214 TypeManager.object_type (thanks to Ben Maurer).
6216 2004-05-30 Martin Baulig <martin@ximian.com>
6218 Committing a patch from Ben Maurer.
6220 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6222 2004-05-29 Martin Baulig <martin@ximian.com>
6224 * class.cs (IMethodData.ShouldIgnore): New method.
6226 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6227 `Location' argument, we don't need it anywhere. Use
6228 `IMethodData.ShouldIgnore ()' instead of
6229 `MethodData.GetMethodFlags ()'.
6230 (TypeManager.AddMethod): Removed.
6231 (TypeManager.AddMethod2): Renamed to AddMethod.
6233 2004-05-29 Martin Baulig <martin@ximian.com>
6235 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6237 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6238 converting from a class type S to an interface type and we already
6239 have an object on the stack, don't box it again. Fixes #52578.
6241 2004-05-29 Martin Baulig <martin@ximian.com>
6243 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6244 Added support for `params' parameters. Fixes #59267.
6246 2004-05-29 Martin Baulig <martin@ximian.com>
6248 * literal.cs (NullPointer): Provide a private .ctor which sets
6249 `type' to TypeManager.object_type. Fixes #59048.
6251 2004-05-29 Martin Baulig <martin@ximian.com>
6253 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6254 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6256 * ecore.cs (EventExpr.instance_expr): Make the field private.
6258 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6260 Fixed bug #50080 & cs0214-2.cs
6261 * expression.cs (Cast.DoResolve): Check unsafe context here.
6263 * statement.cs (Resolve.DoResolve): Likewise.
6265 2004-05-26 Martin Baulig <martin@ximian.com>
6267 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6269 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6270 (RootContext.LookupType): Pass down the `silent' flag.
6272 2004-05-25 Martin Baulig <martin@ximian.com>
6275 (MethodGroupExpr.IdenticalTypeName): New public property.
6276 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6277 expression actually refers to a type.
6279 2004-05-25 Martin Baulig <martin@ximian.com>
6281 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6282 for #56176 and made it actually work.
6284 2004-05-25 Martin Baulig <martin@ximian.com>
6286 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6287 (FieldExpr, PropertyExpr): Override and implement
6288 CacheTemporaries. Fixes #52279.
6290 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6292 * location.cs: In the new compiler listing a file twice is a
6293 warning, not an error.
6295 2004-05-24 Martin Baulig <martin@ximian.com>
6297 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6298 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6300 2004-05-24 Martin Baulig <martin@ximian.com>
6302 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6303 walking the `using' list. Fixes #53921.
6305 2004-05-24 Martin Baulig <martin@ximian.com>
6307 * const.cs (Const.LookupConstantValue): Added support for
6308 EmptyCast's; fixes #55251.
6310 2004-05-24 Martin Baulig <martin@ximian.com>
6312 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6313 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6314 which does the CS0135 check. The reason is that we first need to
6315 check whether the variable actually exists.
6317 2004-05-24 Martin Baulig <martin@ximian.com>
6319 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6320 than RootContext.LookupType() to find the explicit interface
6323 2004-05-24 Raja R Harinath <rharinath@novell.com>
6325 * Makefile: Simplify. Use executable.make.
6326 * mcs.exe.sources: New file. List of sources of mcs.exe.
6328 2004-05-24 Anders Carlsson <andersca@gnome.org>
6332 Use the invariant culture when doing String.Compare for CLS case
6335 2004-05-23 Martin Baulig <martin@ximian.com>
6337 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6338 don't have any dots. Fixes #52622, added cs0246-8.cs.
6340 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6342 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6344 * class.cs (MemberBase.Define): Reuse MemberType member for
6345 resolved type. Other methods can use it too.
6347 2004-05-23 Martin Baulig <martin@ximian.com>
6349 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6350 the variable also exists in the current block (otherwise, we need
6351 to report a CS0103). Fixes #58670.
6353 2004-05-23 Martin Baulig <martin@ximian.com>
6355 * flowanalysis.cs (Reachability.Reachable): Compute this
6356 on-the-fly rather than storing it as a field.
6358 2004-05-23 Martin Baulig <martin@ximian.com>
6360 * flowanalysis.cs (Reachability.And): Manually compute the
6361 resulting `barrier' from the reachability.
6363 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6366 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6367 instance of ObsoleteAttribute when symbol is obsolete.
6370 (IMethodData): Extended interface for ObsoleteAttribute support.
6372 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6374 * attribute.cs: Fix bug #55970
6376 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6380 (GetObsoleteAttribute): New method. Creates the instance of
6382 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6383 ObsoleteAttribute when member is obsolete.
6384 (AttributeTester.Report_ObsoleteMessage): Common method for
6385 Obsolete error/warning reporting.
6388 (TypeContainer.base_classs_type): New member for storing parent type.
6391 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6392 for this MemberCore.
6394 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6396 * attribute.cs, const.cs: Fix bug #58590
6398 2004-05-21 Martin Baulig <martin@ximian.com>
6400 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6401 out parameters if the end of the method is unreachable. Fixes
6404 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6406 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6407 Hari was right, why extra method.
6409 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6411 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6413 2004-05-20 Martin Baulig <martin@ximian.com>
6415 Merged this back from gmcs to keep the differences to a minumum.
6417 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
6418 instead of a Declspace.
6419 (Attribute.ResolveType): Likewise.
6420 (Attributes.Search): Likewise.
6421 (Attributes.Contains): Likewise.
6422 (Attributes.GetClsCompliantAttribute): Likewise.
6424 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
6426 (MethodData.ApplyAttributes): Take an EmitContext instead of a
6429 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6431 Fix bug #58688 (MCS does not report error when the same attribute
6434 * attribute.cs (Attribute.Emit): Distinction between null and default.
6436 2004-05-19 Raja R Harinath <rharinath@novell.com>
6438 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6439 of a top-level attribute without an attribute target.
6440 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6442 (Attribute.Conditional_GetConditionName),
6443 (Attribute.Obsolete_GetObsoleteMessage): Update.
6444 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6445 part of ScanForIndexerName.
6446 (Attribute.CanIgnoreInvalidAttribute): New function.
6447 (Attribute.ScanForIndexerName): Move to ...
6448 (Attributes.ScanForIndexerName): ... here.
6449 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6450 (Attributes.Search): New internal variant that can choose not to
6451 complain if types aren't resolved. The original signature now
6453 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6454 complaints suppressed.
6455 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6456 only if it not useful.
6457 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6458 top-level for attributes that are shared between the assembly
6459 and a top-level class.
6460 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6461 * class.cs: Update to reflect changes.
6462 (DefineIndexers): Fuse loops.
6463 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6464 a couple more variants of attribute names.
6466 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6468 Fix bug #52585 (Implemented explicit attribute declaration)
6471 (Attributable.ValidAttributeTargets): New abstract method. It gets
6472 list of valid attribute targets for explicit target declaration.
6473 (Attribute.Target): It holds target itself.
6474 (AttributeSection): Removed.
6475 (Attribute.CheckTargets): New method. It checks whether attribute
6476 target is valid for the current element.
6479 (EventProperty): New class. For events that are declared like
6480 property (with add and remove accessors).
6481 (EventField): New class. For events that are declared like field.
6484 * cs-parser.jay: Implemented explicit attribute target declaration.
6486 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6487 Override ValidAttributeTargets.
6490 (ReturnParameter): Class for applying custom attributes on
6492 (ParameterAtribute): New class. Class for applying custom
6493 attributes on the parameter type.
6495 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6497 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6500 (Method): Allow UNSAFE here.
6502 * modifiers.cs: Support unsafe reporting.
6504 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6506 * decl.cs: Fix bug #58478.
6508 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6510 * statement.cs: When checking for unreachable code on an EmptyStatement,
6511 set the location. Fixes bug #58488.
6513 2004-05-13 Miguel de Icaza <miguel@ximian.com>
6515 * driver.cs: Add -pkg handling.
6517 From Gonzalo: UseShelLExecute=false
6519 2004-05-12 Marek Safar <marek.safar@seznam.cz>
6522 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
6524 (Attribute.IsClsCompliaceRequired): Moved to base for better
6526 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
6527 when attribute is AttributeUsageAttribute.
6528 (Attribute.GetValidTargets): Simplified.
6529 (Attribute.GetAttributeUsage): New method returns AttributeUsage
6530 attribute for this type.
6531 (Attribute.ApplyAttributes): Method renamed to Emit and make
6533 (GlobalAttributeSection): New class for special handling of global
6534 attributes (assembly, module).
6535 (AttributeSection.Emit): New method.
6537 * class.cs: Implemented Attributable abstract methods.
6538 (MethodCore.LabelParameters): Moved to Parameter class.
6539 (Accessor): Is back simple class.
6540 (PropertyMethod): Implemented Attributable abstract class.
6541 (DelegateMethod): Implemented Attributable abstract class.
6542 (Event): New constructor for disctintion between normal Event
6543 and Event with accessors.
6545 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
6547 * codegen.cs, const.cs, decl.cs, delegate.cs:
6548 (CommonAssemblyModulClass): Implemented Attributable abstract class
6551 * enum.cs: Implement IAttributeSupport interface.
6552 (EnumMember): New class for emum members. Implemented Attributable
6556 (ParameterBase): Is abstract.
6557 (ReturnParameter): New class for easier [return:] attribute handling.
6559 * typemanager.cs: Removed builder_to_attr.
6561 2004-05-11 Raja R Harinath <rharinath@novell.com>
6564 * attribute.cs (Attribute.GetPositionalValue): New function.
6565 * class.cs (TypeContainer.VerifyMembers): New function.
6566 (TypeContainer.Emit): Use it.
6567 (ClassOrStruct): New base class for Class and Struct.
6568 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
6569 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
6571 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
6572 then each non-static field should have a FieldOffset attribute.
6573 Otherwise, none of the fields should have a FieldOffset attribute.
6574 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
6575 and FieldOffset attributes.
6576 * typemanager.cs (TypeManager.struct_layout_attribute_type)
6577 (TypeManager.field_offset_attribute_type): New core types.
6578 (TypeManager.InitCoreTypes): Initialize them.
6580 2004-05-11 Michal Moskal <malekith@pld-linux.org>
6582 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
6583 Return correct type.
6586 2004-05-09 Miguel de Icaza <miguel@ximian.com>
6588 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
6589 be implicitly converted to ulong.
6591 * expression.cs: The logic for allowing operator &, | and ^ worked
6592 was wrong, it worked before because we did not report an error in
6593 an else branch. Fixes 57895.
6595 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
6596 allow volatile fields to be reference types.
6598 2004-05-07 Miguel de Icaza <miguel@ximian.com>
6600 * driver.cs: Add support for /debug-
6602 2004-05-07 Raja R Harinath <rharinath@novell.com>
6604 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
6605 Add a 'complain' parameter to silence errors.
6606 (Attribute.Resolve): Update to changes. Put in sanity check to catch
6607 silently overlooked type-resolutions.
6608 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
6610 (Attributes.Search): New function.
6611 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
6612 (Attributes.GetAttributeFullName): Remove hack.
6613 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
6614 Update to reflect changes.
6615 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
6616 Use Attributes.Search instead of nested loops.
6618 2004-05-07 Marek Safar <marek.safar@seznam.cz>
6621 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
6622 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
6623 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
6625 * report.cs: (Report.Warning): Renamed to Warning_T because of
6626 parameter collision.
6628 2004-05-05 Raja R Harinath <rharinath@novell.com>
6630 * expression.cs (MemberAccess.ResolveMemberAccess):
6631 Exit with non-zero status after Report.Error.
6632 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
6634 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
6636 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6638 * support.cs: Don't hang when the file is empty.
6640 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
6642 * support.cs: In SeekableStreamReader, compute the preamble size of the
6643 underlying stream. Position changes should take into account that initial
6646 2004-05-03 Todd Berman <tberman@sevenl.net>
6648 * driver.cs: remove unused GetSysVersion function.
6650 2004-05-03 Todd Berman <tberman@sevenl.net>
6652 * driver.cs: Remove the hack from saturday, as well as the hack
6653 from jackson (LoadAssemblyFromGac), also adds the CWD to the
6654 link_paths to get that bit proper.
6656 2004-05-01 Todd Berman <tberman@sevenl.net>
6658 * driver.cs: Try a LoadFrom before a Load, this checks the current
6659 path. This is currently a bug in mono that is be fixed, however, this
6660 provides a workaround for now. This will be removed when the bug
6663 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
6665 * CryptoConvert.cs: Updated to latest version. Fix issue with
6666 incomplete key pairs (#57941).
6668 2004-05-01 Todd Berman <tberman@sevenl.net>
6670 * driver.cs: Remove '.' from path_chars, now System.* loads properly
6673 2004-04-30 Jackson Harper <jackson@ximian.com>
6675 * codegen.cs: Open keys readonly.
6677 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6679 * typemanager.cs: don't report cyclic struct layout when a struct
6680 contains 2 or more fields of the same type. Failed for Pango.AttrShape
6681 which has 2 Pango.Rectangle fields.
6683 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
6685 * expression.cs: Handle IntPtr comparisons with IL code
6686 rather than a method call.
6688 2004-04-29 Martin Baulig <martin@ximian.com>
6690 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
6691 the list of PropertyInfo's in class hierarchy and find the
6692 accessor. Fixes #56013.
6694 2004-04-29 Martin Baulig <martin@ximian.com>
6696 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
6698 2004-04-29 Martin Baulig <martin@ximian.com>
6700 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6702 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
6704 2004-04-29 Martin Baulig <martin@ximian.com>
6706 * class.cs (ConstructorInitializer.Resolve): Check whether the
6707 parent .ctor is accessible. Fixes #52146.
6709 2004-04-29 Martin Baulig <martin@ximian.com>
6711 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
6713 * statement.cs (Using.EmitLocalVariableDecls): Use
6714 TypeManager.idisposable_type, not typeof (IDisposable).
6715 (Foreach.EmitCollectionForeach): Added support for valuetypes.
6717 2004-04-29 Martin Baulig <martin@ximian.com>
6719 * class.cs (Event.Define): Don't emit the field and don't set
6720 RTSpecialName and SpecialName for events on interfaces. Fixes
6723 2004-04-29 Raja R Harinath <rharinath@novell.com>
6725 Refactor Attribute.ApplyAttributes.
6726 * attribute.cs (Attributable): New base class for objects that can
6727 have Attributes applied on them.
6728 (Attribute): Make AttributeUsage fields public.
6729 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
6730 (Attribute.IsInternalCall): New property.
6731 (Attribute.UsageAttr): Convert to a public read-only property.
6732 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
6733 (Attribute.ResolveType, Attribute.Resolve)
6734 (Attribute.ScanForIndexerName): Update to reflect changes.
6735 (Attribute.CheckAttributeTarget): Re-format.
6736 (Attribute.ApplyAttributes): Refactor, to various
6737 Attributable.ApplyAttributeBuilder methods.
6738 * decl.cs (MemberCore): Make Attributable.
6739 * class.cs (Accessor): Make Attributable.
6740 (MethodData.ApplyAttributes): Use proper attribute types, not
6742 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
6743 (TypeContainer.ApplyAttributeBuilder)
6744 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
6745 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
6746 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
6747 (Operator.ApplyAttributeBuilder): New factored-out methods.
6748 * const.cs (Const.ApplyAttributeBuilder): Likewise.
6749 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
6750 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
6751 * parameter.cs (ParameterBase): New Attributable base class
6752 that can also represent Return types.
6753 (Parameter): Update to the changes.
6755 2004-04-29 Jackson Harper <jackson@ximian.com>
6757 * driver.cs: Prefer the corlib system version when looking for
6758 assemblies in the GAC. This is still a hack, but its a better hack
6761 2004-04-29 Marek Safar <marek.safar@seznam.cz>
6763 * decl.cs, enum.cs: Improved error 3005 reporting.
6765 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
6766 (related_symbols): New private member for list of symbols
6767 related to reported error/warning.
6769 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
6771 2004-04-29 Martin Baulig <martin@ximian.com>
6773 * ecore.cs (Expression.Constantify): If we're an enum and
6774 TypeManager.TypeToCoreType() doesn't give us another type, use
6775 t.UnderlyingSystemType. Fixes #56178.
6777 2004-04-29 Martin Baulig <martin@ximian.com>
6779 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
6780 interfaces and for each interface, only add members directly
6781 declared in that interface. Fixes #53255.
6783 2004-04-28 Martin Baulig <martin@ximian.com>
6785 * expression.cs (ConditionalLogicalOperator): Use a temporary
6786 variable for `left' to avoid that we evaluate it more than once;
6789 2004-04-28 Martin Baulig <martin@ximian.com>
6791 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
6794 2004-04-28 Martin Baulig <martin@ximian.com>
6796 * statement.cs (LocalInfo.Resolve): Check whether the type is not
6799 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
6800 whether the type is not void (CS1547).
6802 2004-04-28 Martin Baulig <martin@ximian.com>
6804 * expression.cs (Unary.DoResolveLValue): Override this and report
6805 CS0131 for anything but Operator.Indirection.
6807 2004-04-28 Martin Baulig <martin@ximian.com>
6809 Committing a patch from Ben Maurer; see bug #50820.
6811 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6814 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6817 2004-04-28 Martin Baulig <martin@ximian.com>
6819 Committing a patch from Ben Maurer; see bug #50820.
6821 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
6824 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
6827 2004-04-28 Martin Baulig <martin@ximian.com>
6829 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
6830 (Block.AddLabel): Call DoLookupLabel() to only search in the
6833 2004-04-28 Martin Baulig <martin@ximian.com>
6835 * cfold.cs (ConstantFold.BinaryFold): Added special support for
6836 comparing StringConstants and NullLiterals in Equality and Inequality.
6838 2004-04-28 Jackson Harper <jackson@ximian.com>
6840 * driver.cs: Attempt to load referenced assemblies from the
6841 GAC. This is the quick and dirty version of this method that
6842 doesnt take into account versions and just takes the first
6843 canidate found. Will be good enough for now as we will not have more
6844 then one version installed into the GAC until I update this method.
6846 2004-04-28 Martin Baulig <martin@ximian.com>
6848 * typemanager.cs (TypeManager.CheckStructCycles): New public
6849 static method to check for cycles in the struct layout.
6851 * rootcontext.cs (RootContext.PopulateTypes): Call
6852 TypeManager.CheckStructCycles() for each TypeContainer.
6853 [Note: We only need to visit each type once.]
6855 2004-04-28 Martin Baulig <martin@ximian.com>
6857 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
6859 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
6860 success and added `out object value'. Use a `bool resolved' field
6861 to check whether we've already been called rather than
6862 `ConstantValue != null' since this breaks for NullLiterals.
6864 2004-04-28 Raja R Harinath <rharinath@novell.com>
6866 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
6867 setting of this flag, since the 'set' method may be non-public.
6869 2004-04-28 Raja R Harinath <rharinath@novell.com>
6871 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
6872 check on current_vector.Block.
6874 2004-04-27 Martin Baulig <martin@ximian.com>
6876 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
6877 a field initializer. Fixes #56459.
6879 2004-04-27 Martin Baulig <martin@ximian.com>
6881 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
6882 we're not attempting to use an indexer. Fixes #52154.
6884 2004-04-27 Martin Baulig <martin@ximian.com>
6886 * statement.cs (Return): Don't create a return label if we don't
6887 need it; reverts my change from January 20th. Thanks to Ben
6890 2004-04-27 Martin Baulig <martin@ximian.com>
6892 According to the spec, `goto' can only leave a nested scope, but
6895 * statement.cs (Block.LookupLabel): Only lookup in the current
6896 block, don't recurse into parent or child blocks.
6897 (Block.AddLabel): Check in parent and child blocks, report
6898 CS0140/CS0158 if we find a duplicate.
6899 (Block): Removed this indexer for label lookups.
6900 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
6901 this already does the error reporting for us.
6904 (FlowBranching.UsageVector.Block): New public variable; may be null.
6905 (FlowBranching.CreateSibling): Added `Block' argument.
6906 (FlowBranching.LookupLabel): New public virtual method. Lookup a
6907 label for the target of a `goto' and check whether we're not
6908 leaving a `finally'.
6910 2004-04-27 Martin Baulig <martin@ximian.com>
6912 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
6913 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
6916 2004-04-27 Martin Baulig <martin@ximian.com>
6918 * statement.cs (Block.AddLabel): Also check for implicit blocks
6919 and added a CS0158 check.
6921 2004-04-27 Martin Baulig <martin@ximian.com>
6923 * flowanalysis.cs (FlowBranchingLoop): New class.
6924 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
6925 UsageVector's instead of an ArrayList.
6926 (FlowBranching.Label): Likewise.
6927 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
6928 (FlowBranching.AddBreakVector): New method.
6930 2004-04-27 Miguel de Icaza <miguel@ximian.com>
6932 * attribute.cs: Small regression fix: only convert the type if we
6933 the type is different, fixes System.Drawing build.
6935 2004-04-27 Martin Baulig <martin@ximian.com>
6937 * attribute.cs (Attribute.Resolve): If we have a constant value
6938 for a named field or property, implicity convert it to the correct
6941 2004-04-27 Raja R Harinath <rharinath@novell.com>
6943 * statement.cs (Block.Block): Implicit blocks share
6944 'child_variable_names' fields with parent blocks.
6945 (Block.AddChildVariableNames): Remove.
6946 (Block.AddVariable): Mark variable as "used by a child block" in
6947 every surrounding block.
6948 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
6949 been used in a child block, complain about violation of "Invariant
6950 meaning in blocks" rule.
6951 * cs-parser.jay (declare_local_variables): Don't use
6952 AddChildVariableNames.
6953 (foreach_statement): Don't create an implicit block: 'foreach'
6956 2004-04-23 Miguel de Icaza <miguel@ximian.com>
6958 * convert.cs (ImplicitNumericConversion): 0 is also positive when
6959 converting from 0L to ulong. Fixes 57522.
6961 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6963 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
6964 derived class hides via 'new' keyword field from base class (test-242.cs).
6965 TODO: Handle this in the more general way.
6967 * class.cs (CheckBase): Ditto.
6969 2004-04-22 Marek Safar <marek.safar@seznam.cz>
6971 * decl.cs (caching_flags): New member for storing cached values
6973 (MemberCore.Flags): New enum where bit flags for caching_flags
6975 (MemberCore.cls_compliance): Moved to caching_flags.
6976 (DeclSpace.Created): Moved to caching_flags.
6978 * class.cs: Use caching_flags instead of DeclSpace.Created
6980 2004-04-21 Miguel de Icaza <miguel@ximian.com>
6982 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
6983 if we are only a derived class, not a nested class.
6985 * typemanager.cs: Same as above, but do this at the MemberLookup
6986 level (used by field and methods, properties are handled in
6987 PropertyExpr). Allow for the qualified access if we are a nested
6990 2004-04-21 Marek Safar <marek.safar@seznam.cz>
6992 * class.cs: Refactoring.
6993 (IMethodData): New inteface; Holds links to parent members
6994 to avoid member duplication (reduced memory allocation).
6995 (Method): Implemented IMethodData interface.
6996 (PropertyBase): New inner classes for get/set methods.
6997 (PropertyBase.PropertyMethod): Implemented IMethodData interface
6998 (Event): New inner classes for add/remove methods.
6999 (Event.DelegateMethod): Implemented IMethodData interface.
7001 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7002 EmitContext (related to class.cs refactoring).
7004 2004-04-21 Raja R Harinath <rharinath@novell.com>
7006 * delegate.cs (Delegate.VerifyApplicability): If the number of
7007 arguments are the same as the number of parameters, first try to
7008 verify applicability ignoring any 'params' modifier on the last
7012 2004-04-16 Raja R Harinath <rharinath@novell.com>
7014 * class.cs (TypeContainer.AddIndexer): Use
7015 'ExplicitInterfaceName' to determine if interface name was
7016 explicitly specified. 'InterfaceType' is not initialized at this time.
7017 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7018 Indexers array is already in the required order. Initialize
7019 'IndexerName' only if there are normal indexers.
7020 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7021 (TypeContainer.Emit): Emit DefaultMember attribute only if
7022 IndexerName is initialized.
7025 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7027 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7030 2004-04-15 Raja R Harinath <rharinath@novell.com>
7032 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7036 * attribute.cs (Attribute.Resolve): Check for duplicate named
7040 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7042 * iterators.cs (MarkYield): track whether we are in an exception,
7043 and generate code accordingly. Use a temporary value to store the
7044 result for our state.
7046 I had ignored a bit the interaction of try/catch with iterators
7047 since their behavior was not entirely obvious, but now it is
7048 possible to verify that our behavior is the same as MS .NET 2.0
7052 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7054 * iterators.cs: Avoid creating temporaries if there is no work to
7057 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7058 Enumerations, use TypeManager.EnumToUnderlying and call
7061 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7064 (This.Emit): Use EmitContext.EmitThis to emit our
7067 (This.EmitAssign): Ditto.
7069 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7070 codepaths, we will move all the functionality into
7073 (FieldExpr.EmitAssign): Ditto.
7075 This fixes several hidden bugs that I uncovered while doing a code
7076 review of this today.
7078 * codegen.cs (EmitThis): reworked so the semantics are more clear
7079 and also support value types "this" instances.
7081 * iterators.cs: Changed so that for iterators in value types, we
7082 do not pass the value type as a parameter.
7084 Initialization of the enumerator helpers is now done in the caller
7085 instead of passing the parameters to the constructors and having
7086 the constructor set the fields.
7088 The fields have now `assembly' visibility instead of private.
7090 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7092 * expression.cs (Argument.Resolve): Check if fields passed as ref
7093 or out are contained in a MarshalByRefObject.
7095 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7096 another compiler type.
7098 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7100 * class.cs (Indexer.Define): use the new name checking method.
7101 Also, return false on an error.
7102 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7103 (is_identifier_[start/part]_character): make static.
7105 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7107 * expression.cs (Binary.ResolveOperator): Do no append strings
7108 twice: since we can be invoked more than once (array evaluation)
7109 on the same concatenation, take care of this here. Based on a fix
7110 from Ben (bug #56454)
7112 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7114 * codegen.cs: Fix another case where CS1548 must be reported (when
7115 delay-sign isn't specified and no private is available #56564). Fix
7116 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7117 error when MCS is used on the MS runtime and we need to delay-sign
7118 (which seems unsupported by AssemblyBuilder - see #56621).
7120 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7122 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7123 (TypeManager.ComputeNamespaces): Faster implementation for
7126 * compiler.csproj: Updated AssemblyName to mcs.
7128 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7130 * rootcontext.cs: Add new types to the boot resolution.
7132 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7133 MulticastDelegate is not allowed.
7135 * typemanager.cs: Add new types to lookup: System.TypedReference
7138 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7139 check for TypedReference or ArgIterator, they are not allowed.
7141 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7142 makes us properly catch 1510 in some conditions (see bug 56016 for
7145 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7147 * CryptoConvert.cs: update from corlib version
7150 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7152 * class.cs (Indexer.Define): Check indexername declaration
7154 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7156 * attribute.cs (IsClsCompliant): Fixed problem with handling
7157 all three states (compliant, not-compliant, undetected).
7159 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7161 * attribute.cs (Attribute): Location is now public.
7162 (Resolve): Store resolved arguments (pos_values) in attribute class.
7163 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7164 (GetClsCompliantAttributeValue): New method that gets
7165 CLSCompliantAttribute value.
7166 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7167 if exists else null.
7168 (AttributeTester): New class for CLS-Compliant verification routines.
7170 * class.cs (Emit): Add CLS-Compliant verification.
7171 (Method.GetSignatureForError): Implemented.
7172 (Constructor.GetSignatureForError): Implemented
7173 (Constructor.HasCompliantArgs): Returns if constructor has
7174 CLS-Compliant arguments.
7175 (Constructor.Emit): Override.
7176 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7177 is needed to test only parameters.
7178 (FieldBase.GetSignatureForError): Implemented.
7179 (TypeContainer): New member for storing base interfaces.
7180 (TypeContainer.FindMembers): Search in base interfaces too.
7182 * codegen.cs (GetClsComplianceAttribute): New method that gets
7183 assembly or module CLSCompliantAttribute value.
7184 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7186 (ModuleClass.Emit): Add error 3012 test.
7188 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7190 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7191 state for all decl types.
7192 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7193 if CLS-Compliant tests are required.
7194 (IsClsCompliaceRequired): New method. Analyze whether code
7195 must be CLS-Compliant.
7196 (IsExposedFromAssembly): New method. Returns true when MemberCore
7197 is exposed from assembly.
7198 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7199 value or gets cached value.
7200 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7201 is explicitly marked with CLSCompliantAttribute.
7202 (IsIdentifierClsCompliant): New abstract method. This method is
7203 used to testing error 3005.
7204 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7205 for identifier and parameters CLS-Compliant testing.
7206 (VerifyClsCompliance): New method. The main virtual method for
7207 CLS-Compliant verifications.
7208 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7209 null. I don't know why is null (too many public members !).
7210 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7211 and get value of first CLSCompliantAttribute that found.
7213 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7214 (VerifyClsCompliance): Override and add extra tests.
7216 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7217 clscheck- disable CLS-Compliant verification event if assembly is has
7218 CLSCompliantAttribute(true).
7220 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7221 ApllyAttribute is now called in emit section as in the other cases.
7222 Possible future Emit integration.
7223 (IsIdentifierClsCompliant): New override.
7224 (VerifyClsCompliance): New override.
7225 (GetEnumeratorName): Returns full enum name.
7227 * parameter.cs (GetSignatureForError): Implemented.
7229 * report.cs (WarningData): New struct for Warning message information.
7230 (LocationOfPreviousError): New method.
7231 (Warning): New method. Reports warning based on the warning table.
7232 (Error_T): New method. Reports error based on the error table.
7234 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7235 verifications are done here.
7237 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7239 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7240 CLSCompliantAttribute.
7241 (all_imported_types): New member holds all imported types from other
7243 (LoadAllImportedTypes): New method fills static table with exported types
7244 from all referenced assemblies.
7245 (Modules): New property returns all assembly modules.
7247 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7249 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7250 throwing a parser error.
7252 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7253 which removes the hardcoded get_/set_ prefixes for properties, as
7254 IL allows for the properties to be named something else.
7258 * expression.cs: Do not override operand before we know if it is
7261 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7263 * typemanager.cs: support for pinned variables.
7265 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7267 * decl.cs, typemanager.cs: Avoid using an arraylist
7268 as a buffer if there is only one result set.
7270 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7272 * expression.cs: Make sure you cant call a static method
7273 with an instance expression, bug #56174.
7275 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7277 * class.cs (IsDuplicateImplementation): Improve error reporting to
7278 flag 663 (method only differs in parameter modifier).
7280 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7281 in preprocessor directives.
7283 * location.cs (LookupFile): Allow for the empty path.
7285 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7286 better approach for some of that patch, but its failing with the
7287 CharSet enumeration. For now try/catch will do.
7289 * typemanager.cs: Do not crash if a struct does not have fields.
7292 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7294 * expression.cs: cs0213, cant fix a fixed expression.
7297 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7299 * cs-parser.jay: detect invalid embeded statements gracefully.
7302 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7304 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7307 the invocation type may not be a subclass of the tye of the item/
7308 The type of the item must be a subclass of the invocation item.
7313 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7315 * attribute.cs: Added methods to get a string and a bool from an
7316 attribute. Required to information from AssemblyKeyFileAttribute,
7317 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7318 * codegen.cs: Modified AssemblyName creation to include support for
7319 strongnames. Catch additional exceptions to report them as CS1548.
7320 * compiler.csproj: Updated include CryptoConvert.cs.
7321 * compiler.csproj.user: Removed file - user specific configuration.
7322 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7323 Mono.Security assembly. The original class is maintained and tested in
7324 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7325 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7326 like CSC 8.0 (C# v2) supports.
7327 * Makefile: Added CryptoConvert.cs to mcs sources.
7328 * rootcontext.cs: Added new options for strongnames.
7330 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7332 * driver.cs: For --expect-error, report error code `2'
7333 if the program compiled with no errors, error code `1' if
7334 it compiled with an error other than the one expected.
7336 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7338 * compiler.csproj: Updated for Visual Studio .NET 2003.
7339 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7340 * compiler.sln: Updated for Visual Studio .NET 2003.
7342 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7344 * expression.cs: Fix bug #47234. We basically need to apply the
7345 rule that we prefer the conversion of null to a reference type
7346 when faced with a conversion to 'object' (csc behaviour).
7348 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7350 * statement.cs: Shorter form for foreach, eliminates
7351 a local variable. r=Martin.
7353 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7355 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7356 checks if we can use brtrue/brfalse to test for 0.
7357 * expression.cs: use the above in the test for using brtrue/brfalse.
7360 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7362 * expression.cs: Rewrite string concat stuff. Benefits:
7364 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7365 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7366 rather than a concat chain.
7368 * typemanager.cs: Add lookups for more concat overloads.
7370 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7372 * expression.cs: Emit shorter il code for array init.
7389 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7391 * statement.cs: Before, two switch blocks would be merged if the
7392 total size of the blocks (end_item - begin_item + 1) was less than
7393 two times the combined sizes of the blocks.
7395 Now, it will only merge if after the merge at least half of the
7400 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7402 * class.cs : csc build fix for GetMethods(). See bug #52503.
7404 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7406 * expression.cs: Make sure fp comparisons work with NaN.
7407 This fixes bug #54303. Mig approved this patch a long
7408 time ago, but we were not able to test b/c the runtime
7411 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7413 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7415 2004-03-19 Martin Baulig <martin@ximian.com>
7417 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7418 error here and not in our caller.
7420 2004-03-19 Martin Baulig <martin@ximian.com>
7422 * interface.cs: Completely killed this file.
7423 (Interface): We're now a TypeContainer and live in class.cs.
7425 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7426 argument; we're now also called for interfaces.
7427 (TypeContainer.DefineMembers): Allow this method being called
7429 (TypeContainer.GetMethods): New public method; formerly known as
7430 Interface.GetMethod(). This is used by PendingImplementation.
7431 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7432 it's now private and non-static.
7433 (Interface): Moved this here; it's now implemented similar to
7435 (Method, Property, Event, Indexer): Added `bool is_interface'
7436 argument to their .ctor's.
7437 (MemberBase.IsInterface): New public field.
7439 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7440 instances instead of InterfaceMethod, InterfaceProperty, etc.
7441 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7442 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7444 2004-03-19 Martin Baulig <martin@ximian.com>
7446 * class.cs (MethodCore.IsDuplicateImplementation): New private
7447 method which does the CS0111 checking.
7448 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7449 Use IsDuplicateImplementation().
7451 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7453 * decl.cs (FindMemberToOverride): New method to find the correct
7454 method or property to override in the base class.
7456 - Make Method/Property use the above method to find the
7457 version in the base class.
7458 - Remove the InheritableMemberSignatureCompare as it is now
7461 This patch makes large code bases much faster to compile, as it is
7462 O(n) rather than O(n^2) to do this validation.
7464 Also, it fixes bug 52458 which is that nested classes are not
7465 taken into account when finding the base class member.
7467 Reviewed/Approved by Martin.
7469 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7471 * interface.cs: In all interface classes removed redundant
7472 member initialization.
7474 2004-03-16 Martin Baulig <martin@ximian.com>
7476 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7478 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7480 * decl.cs (DefineTypeAndParents): New helper method to define a
7481 type's containers before the type itself is defined; This is a
7482 bug exposed by the recent changes to Windows.Forms when an
7483 implemented interface was defined inside a class that had not been
7486 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7488 (Check): Loop correctly to report errors modifiers
7489 (UNSAFE was not in the loop, since it was the same as TOP).
7491 * interface.cs: Every interface member now takes a ModFlags,
7492 instead of a "is_new" bool, which we set on the base MemberCore.
7494 Every place where we called "UnsafeOk" in the interface, now we
7495 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7496 the unsafe settings from the member declaration instead of the
7497 container interface.
7499 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7501 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7502 `set_indexer_name' to the pending bits (one per type).
7504 We fixed a bug today that was picking the wrong method to
7505 override, since for properties the existing InterfaceMethod code
7506 basically ignored the method name. Now we make sure that the
7507 method name is one of the valid indexer names.
7509 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7511 * support.cs (SeekableStreamReader): Keep track of stream byte
7512 positions and don't mix them with character offsets to the buffer.
7514 Patch from Gustavo Giráldez
7516 2004-03-15 Marek Safar <marek.safar@seznam.cz>
7518 * interface.cs (InterfaceSetGetBase): Removed double member
7519 initialization, base class does it as well.
7521 2004-03-13 Martin Baulig <martin@ximian.com>
7523 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
7524 when compiling corlib.
7526 2004-03-13 Miguel de Icaza <miguel@ximian.com>
7528 * convert.cs (ExplicitConversion): We were reporting an error on
7529 certain conversions (object_type source to a value type, when the
7530 expression was `null') before we had a chance to pass it through
7531 the user defined conversions.
7533 * driver.cs: Replace / and \ in resource specifications to dots.
7536 * class.cs: Add check for duplicate operators. Fixes 52477
7538 2004-03-11 Miguel de Icaza <miguel@ximian.com>
7540 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
7541 that are in the middle of the statements, not only at the end.
7544 * class.cs (TypeContainer.AddField): No longer set the
7545 `HaveStaticConstructor' flag, now we call it
7546 `UserDefineStaticConstructor' to diferentiate the slightly
7547 semantic difference.
7549 The situation is that we were not adding BeforeFieldInit (from
7550 Modifiers.TypeAttr) to classes that could have it.
7551 BeforeFieldInit should be set to classes that have no static
7556 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
7558 And most importantly Zoltan's comment:
7560 http://bugzilla.ximian.com/show_bug.cgi?id=44229
7562 "I think beforefieldinit means 'it's ok to initialize the type sometime
7563 before its static fields are used', i.e. initialization does not need
7564 to be triggered by the first access to the type. Setting this flag
7565 helps the JIT to compile better code, since it can run the static
7566 constructor at JIT time, and does not need to generate code to call it
7567 (possibly lots of times) at runtime. Unfortunately, mcs does not set
7568 this flag for lots of classes like String.
7570 csc sets this flag if the type does not have an explicit static
7571 constructor. The reasoning seems to be that if there are only static
7572 initalizers for a type, and no static constructor, then the programmer
7573 does not care when this initialization happens, so beforefieldinit
7576 This bug prevents the AOT compiler from being usable, since it
7577 generates so many calls to mono_runtime_class_init that the AOT code
7578 is much slower than the JITted code. The JITted code is faster,
7579 because it does not generate these calls if the vtable is type is
7580 already initialized, which is true in the majority of cases. But the
7581 AOT compiler can't do this."
7583 2004-03-10 Miguel de Icaza <miguel@ximian.com>
7585 * class.cs (MethodData.Emit): Refactor the code so symbolic
7586 information is generated for destructors; For some reasons we
7587 were taking a code path that did not generate symbolic information
7590 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
7592 * class.cs: Create a Constructor.CheckBase method that
7593 takes care of all validation type code. The method
7594 contains some code that was moved from Define.
7596 It also includes new code that checks for duplicate ctors.
7597 This fixes bug #55148.
7599 2004-03-09 Joshua Tauberer <tauberer@for.net>
7601 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
7602 a { ... }-style array creation invokes EmitStaticInitializers
7603 which is not good for reference-type arrays. String, decimal
7604 and now null constants (NullCast) are not counted toward
7605 static initializers.
7607 2004-03-05 Martin Baulig <martin@ximian.com>
7609 * location.cs (SourceFile.HasLineDirective): New public field;
7610 specifies whether the file contains or is referenced by a "#line"
7612 (Location.DefineSymbolDocuments): Ignore source files which
7613 either contain or are referenced by a "#line" directive.
7615 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
7617 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
7618 direct access to our parent, so check the method inline there.
7620 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
7622 * expression.cs (Invocation.EmitCall): Miguel's last commit
7623 caused a regression. If you had:
7628 In Foo the implict this would be null.
7630 2004-02-27 Miguel de Icaza <miguel@ximian.com>
7632 * expression.cs (Invocation.EmitCall): If the method is not
7633 virtual, do not emit a CallVirt to it, use Call.
7635 * typemanager.cs (GetFullNameSignature): Improve the method to
7636 cope with ".ctor" and replace it with the type name.
7638 * class.cs (ConstructorInitializer.Resolve): Now the method takes
7639 as an argument the ConstructorBuilder where it is being defined,
7640 to catch the recursive constructor invocations.
7642 2004-02-26 Miguel de Icaza <miguel@ximian.com>
7644 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
7645 routines to check if a type is an enumerable/enumerator allow
7646 classes that implement the IEnumerable or IEnumerator interfaces.
7648 * class.cs (Property, Operator): Implement IIteratorContainer, and
7649 implement SetYields.
7651 (Property.Define): Do the block swapping for get_methods in the
7652 context of iterators. We need to check if Properties also
7653 include indexers or not.
7655 (Operator): Assign the Block before invoking the
7656 OperatorMethod.Define, so we can trigger the Iterator code
7659 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
7660 Property and Operator classes are not created when we parse the
7661 declarator but until we have the block completed, so we use a
7662 singleton SimpleIteratorContainer.Simple to flag whether the
7663 SetYields has been invoked.
7665 We propagate this setting then to the Property or the Operator to
7666 allow the `yield' to function.
7668 2004-02-25 Marek Safar <marek.safar@seznam.cz>
7670 * codegen.cs: Implemented attribute support for modules.
7671 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
7672 Assembly/Module functionality.
7674 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
7675 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
7676 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
7678 2004-02-16 Marek Safar <marek.safar@seznam.cz>
7680 * interface.cs (FindMembers): The operation is performed on all base
7681 interfaces and not only on the first. It is required for future CLS Compliance patch.
7683 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
7685 * statement.cs, codegen.cs:
7686 This patch deals with patterns such as:
7688 public class List : IEnumerable {
7690 public MyEnumerator GetEnumerator () {
7691 return new MyEnumerator(this);
7694 IEnumerator IEnumerable.GetEnumerator () {
7698 public struct MyEnumerator : IEnumerator {
7703 Before, there were a few things we did wrong:
7704 1) we would emit callvirt on a struct, which is illegal
7705 2) we emited ldarg when we needed to emit ldarga
7706 3) we would mistakenly call the interface methods on an enumerator
7707 type that derived from IEnumerator and was in another assembly. For example:
7709 public class MyEnumerator : IEnumerator
7711 Would have the interface methods called, even if there were public impls of the
7712 method. In a struct, this lead to invalid IL code.
7714 2004-02-11 Marek Safar <marek.safar@seznam.cz>
7716 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
7719 * delegate.cs (Define): Fixed crash when delegate type is undefined.
7721 2004-02-11 Miguel de Icaza <miguel@ximian.com>
7723 * cs-parser.jay: Fix small regression: we were not testing V2
7724 compiler features correctly.
7726 * interface.cs: If the emit context is null, then create one
7728 2004-02-09 Marek Safar <marek.safar@seznam.cz>
7730 * decl.cs (GetSignatureForError): New virtual method to get full name
7733 * attribute.cs (IAttributeSupport): New interface for attribute setting.
7734 Now it is possible to rewrite ApplyAttributes method to be less if/else.
7736 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
7737 Duplicated members and code in these classes has been removed.
7738 Better encapsulation in these classes.
7740 2004-02-07 Miguel de Icaza <miguel@ximian.com>
7742 * assign.cs (Assign.DoResolve): When dealing with compound
7743 assignments, there is a new rule in ECMA C# 2.4 (might have been
7744 there before, but it is documented here) that states that in:
7748 If b is of type int, and the `op' is a shift-operator, then the
7749 above is evaluated as:
7753 * expression.cs (Binary.ResolveOperator): Instead of testing for
7754 int/uint/long/ulong, try to implicitly convert to any of those
7755 types and use that in pointer arithmetic.
7757 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
7758 method to print information for from the type, not from the
7759 null-method we were given.
7761 2004-02-01 Duncan Mak <duncan@ximian.com>
7763 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
7764 parsing for cmd, fixes bug #53694.
7766 2004-02-04 Marek Safar <marek.safar@seznam.cz>
7768 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
7769 in the member name duplication tests. Property and operator name duplication
7770 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
7772 2004-02-03 Marek Safar <marek.safar@seznam.cz>
7774 * interface.cs (PopulateMethod): Fixed crash when interface method
7775 returns not existing type (error test cs0246-3.cs).
7777 2004-02-02 Ravi Pratap M <ravi@ximian.com>
7779 * cs-parser.jay (interface_accessors): Re-write actions to also
7780 store attributes attached to get and set methods. Fix spelling
7783 (inteface_property_declaration): Modify accordingly.
7785 (InterfaceAccessorInfo): New helper class to store information to pass
7786 around between rules that use interface_accessors.
7788 * interface.cs (Emit): Apply attributes on the get and set
7789 accessors of properties and indexers too.
7791 * attribute.cs (ApplyAttributes): Modify accordingly to use the
7792 right MethodBuilder when applying attributes to the get and set accessors.
7794 2004-01-31 Miguel de Icaza <miguel@ximian.com>
7796 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
7798 2004-01-26 Miguel de Icaza <miguel@ximian.com>
7800 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
7802 2004-01-25 Miguel de Icaza <miguel@ximian.com>
7804 * cs-parser.jay: Remove YIELD token, instead use the new grammar
7805 changes that treat `yield' specially when present before `break'
7808 * cs-tokenizer.cs: yield is no longer a keyword.
7810 2004-01-23 Marek Safar <marek.safar@seznam.cz>
7812 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
7813 setting for default constructors.
7814 For default constructors are almost every time set wrong Modifier. The
7815 generated IL code has been alright. But inside mcs this values was
7816 wrong and this was reason why several of my CLS Compliance tests
7819 2004-01-22 Martin Baulig <martin@ximian.com>
7821 * cs-parser.jay (namespace_or_type_name): Return an Expression,
7822 not a QualifiedIdentifier. This is what `type_name_expression'
7823 was previously doing.
7824 (type_name_expression): Removed; the code is now in
7825 `namespace_or_type_name'.
7826 (qualified_identifier): Removed, use `namespace_or_type_name'
7828 (QualifiedIdentifier): Removed this class.
7830 2004-01-22 Martin Baulig <martin@ximian.com>
7832 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
7833 not a string as alias name.
7835 2004-01-21 Miguel de Icaza <miguel@ximian.com>
7837 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
7838 #52730 bug, and instead compute correctly the need to use a
7839 temporary variable when requesting an address based on the
7840 static/instace modified of the field and the constructor.
7842 2004-01-21 Martin Baulig <martin@ximian.com>
7844 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
7845 class and namespace before looking up aliases. Fixes #52517.
7847 2004-01-21 Martin Baulig <martin@ximian.com>
7849 * flowanalysis.cs (UsageVector.Merge): Allow variables being
7850 assinged in a 'try'; fixes exception4.cs.
7852 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7853 * class.cs : Implemented parameter-less constructor for TypeContainer
7855 * decl.cs: Attributes are now stored here. New property OptAttributes
7857 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
7859 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
7861 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7863 * typemanager.cs (CSharpSignature): Now reports also inner class name.
7864 (CSharpSignature): New method for indexer and property signature.
7866 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7868 * pending.cs (IsVirtualFilter): Faster implementation.
7870 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7872 * typemanager.cs: Avoid inclusion of same assembly more than once.
7874 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7876 * cs-parser.jay: Fixed problem where the last assembly attribute
7877 has been applied also to following declaration (class, struct, etc.)
7879 2004-01-21 Marek Safar <marek.safar@seznam.cz>
7881 * class.cs: Added error CS0538, CS0539 reporting.
7882 Fixed crash on Microsoft runtime when field type is void.
7884 * cs-parser.jay: Added error CS0537 reporting.
7886 * pending.cs: Added error CS0535 reporting.
7887 Improved error report for errors CS0536, CS0534.
7889 2004-01-20 Miguel de Icaza <miguel@ximian.com>
7891 Merge a few bits from the Anonymous Method MCS tree.
7893 * statement.cs (ToplevelBlock): New class for toplevel methods,
7894 will hold anonymous methods, lifted variables.
7896 * cs-parser.jay: Create toplevel blocks for delegates and for
7897 regular blocks of code.
7899 2004-01-20 Martin Baulig <martin@ximian.com>
7901 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
7902 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
7903 and `NeedExplicitReturn'; added `IsLastStatement'.
7904 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
7905 have a `ReturnLabel' or we're not unreachable.
7907 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
7908 child's reachability; don't just override ours with it. Fixes
7909 #58058 (lluis's example).
7910 (FlowBranching): Added public InTryOrCatch(), InCatch(),
7911 InFinally(), InLoop(), InSwitch() and
7912 BreakCrossesTryCatchBoundary() methods.
7914 * statement.cs (Return): Do all error checking in Resolve().
7915 Unless we are the last statement in a top-level block, always
7916 create a return label and jump to it.
7917 (Break, Continue): Do all error checking in Resolve(); also make
7918 sure we aren't leaving a `finally'.
7919 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
7920 statement in a top-level block.
7921 (Block.Flags): Added `IsDestructor'.
7922 (Block.IsDestructor): New public property.
7924 2004-01-20 Martin Baulig <martin@ximian.com>
7926 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
7928 2004-01-20 Martin Baulig <martin@ximian.com>
7930 * statement.cs (Statement.ResolveUnreachable): New public method.
7931 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
7932 (Block.Resolve): Resolve unreachable statements.
7934 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7936 * expression.cs: We need to fix the case where we do
7937 not have a temp variable here.
7939 * assign.cs: Only expression compound assignments need
7940 temporary variables.
7942 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
7944 * flowanalysis.cs: Reduce memory allocation in a few ways:
7945 - A block with no variables should not allocate a bit
7947 - A method with no out parameters does not need any tracking
7948 for assignment of the parameters, so we need not allocate
7951 public readonly Type[] VariableTypes;
7952 public readonly string[] VariableNames;
7953 Are redundant. The data is already stored in the variable
7954 map, so we need not allocate another array for it.
7955 - We need to add alot of checks for if (params | locals) == null
7956 due to the first two changes.
7958 2004-01-18 Miguel de Icaza <miguel@ximian.com>
7960 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
7961 implement IMemoryLocation, we store a copy on a local variable and
7962 take the address of it. Patch from Benjamin Jemlich
7964 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
7965 to use a special "type_name_expression" rule which reduces the
7966 number of "QualifiedIdentifier" classes created, and instead
7967 directly creates MemberAccess expressions.
7969 2004-01-17 Miguel de Icaza <miguel@ximian.com>
7971 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
7972 that fixes #52853. Null literal assignment to ValueType
7974 * class.cs (MethodData.Emit): Instead of checking the name of the
7975 method to determine if its a destructor, create a new derived
7976 class from Method called Destructor, and test for that.
7978 * cs-parser.jay: Create a Destructor object instead of a Method.
7980 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
7984 2004-01-16 Miguel de Icaza <miguel@ximian.com>
7986 * expression.cs (Binary.ResolveOperator): Perform an implicit
7987 conversion from MethodGroups to their delegate types on the
7990 * delegate.cs: Introduce a new class DelegateCreation that is the
7991 base class for `NewDelegate' and `ImplicitDelegateCreation',
7992 factor some code in here.
7994 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
7995 conversion from MethodGroups to compatible delegate types.
7997 * ecore.cs (Expression.Resolve): Do not flag error 654
7998 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
7999 we allow conversions from MethodGroups to delegate types now.
8001 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8002 assignments in v2 either.
8004 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8006 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8007 static read-only fields in ctors.
8009 Applied patch from Benjamin Jemlich
8011 * expression.cs (UnaryMutator): Avoid leaking local variables.
8013 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8015 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8016 here to return true, as they can be used like this:
8020 Fixed 49836 and all the other dups
8022 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8024 * driver.cs: Implement /win32res and /win32icon.
8026 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8028 * cs-parser.jay: Add a rule to improve error handling for the
8029 common mistake of placing modifiers after the type.
8031 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8033 * cs-parser.jay (interface_event_declaration): Catch
8034 initialization of events on interfaces, and report cs0068
8036 * cs-parser.jay (interface_event_declaration): Catch
8037 initialization of events.
8039 * ecore.cs: Better report missing constructors.
8041 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8042 the error reporting done in the wrong place. Fix.
8044 * expression.cs (Binary.ResolveOperator): Catch the
8045 operator + (E x, E y) error earlier, and later allow for implicit
8046 conversions in operator +/- (E e, U x) from U to the underlying
8049 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8050 52596, if the container class is abstract, the default constructor
8051 is protected otherwise its public (before, we were always public).
8053 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8056 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8057 Jemlich that fixes bug #52597, MCS was generating invalid code for
8058 idisposable structs. Thanks to Ben for following up with this
8061 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8063 * driver.cs: Allow assemblies without code to be generated, fixes
8066 2004-01-07 Nick Drochak <ndrochak@gol.com>
8068 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8070 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8072 * cs-parser.jay: Add rules to improve error reporting if fields or
8073 methods are declared at the namespace level (error 116)
8075 * Add rules to catch event add/remove
8077 2004-01-04 David Sheldon <dave-mono@earth.li>
8079 * expression.cs: Added matching ")" to error message for
8082 2004-01-03 Todd Berman <tberman@gentoo.org>
8084 * ecore.cs, attribute.cs:
8085 Applying fix from #52429.
8087 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8089 * ecore.cs, expression.cs, statement.cs:
8090 Total rewrite of how we handle branching. We
8091 now handle complex boolean expressions with fewer
8092 jumps. As well if (x == 0) no longer emits a ceq.
8094 if (x is Foo) is much faster now, because we generate
8097 Overall, we get a pretty big improvement on our benchmark
8098 tests. The code we generate is smaller and more readable.
8100 I did a full two-stage bootstrap. The patch was reviewed
8101 by Martin and Miguel.
8103 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8105 * cs-parser.jay: Make primary_expression not take a QI.
8106 we dont need this because the member_access rule covers
8107 us here. So we replace the rule with just IDENTIFIER.
8109 This has two good effects. First, we remove a s/r conflict.
8110 Second, we allocate many fewer QualifiedIdentifier objects.
8112 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8114 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8115 set the correct information via SRE. This prevents
8116 hanging on the MS runtime. Fixes #29374.
8118 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8120 * convert.cs: correctly handle conversions to value types
8121 from Enum and ValueType as unboxing conversions.
8123 Fixes bug #52569. Patch by Benjamin Jemlich.
8125 2004-01-02 Ravi Pratap <ravi@ximian.com>
8127 * expression.cs (BetterConversion): Prefer int -> uint
8128 over int -> ulong (csc's behaviour). This fixed bug #52046.
8130 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8132 * decl.cs (MemberCache.FindMembers): now returns a
8135 * typemanager.cs: In general, go with with ^^.
8136 (CopyNewMethods): take an IList.
8137 (RealMemberLookup): Only allocate an arraylist
8138 if we copy from two sets of methods.
8140 This change basically does two things:
8141 1) Fewer array lists allocated due to CopyNewMethods.
8142 2) the explicit cast in MemberList costed ALOT.
8144 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8146 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8147 a hashtable to avoid needless string allocations when an identifier is
8148 used more than once (the common case).
8150 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8152 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8153 is broken, it will not return anything. So, we
8154 have to use the information we have in mcs to
8157 * typemanager.cs: Add a cache for GetInterfaces,
8158 since this will now be used more often (due to ^^)
8160 (GetExplicitInterfaces) New method that gets the
8161 declared, not effective, interfaces on a type
8162 builder (eg, if you have interface IFoo, interface
8163 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8166 This patch makes MCS able to bootstrap itself on
8169 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8171 * expression.cs: Remove the Nop's that Miguel put
8174 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8176 * report.cs, codegen.cs: Give the real stack trace to
8177 the error when an exception is thrown.
8179 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8181 * decl.cs: only allocate hashtables for ifaces if
8184 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8186 * expression.cs: fix the error from cs0121-2.cs
8187 (a parent interface has two child interfaces that
8188 have a function with the same name and 0 params
8189 and the function is called through the parent).
8191 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8193 * class.cs, rootcontext.cs, typmanager.cs: do not
8196 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8198 * codegen.cs: remove stack for the ec flow branching.
8199 It is already a linked list, so no need.
8201 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8203 * Makefile: Allow custom profiler here.
8205 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8207 * typemanager.cs (LookupType):
8208 - Use a static char [], because split takes
8209 a param array for args, so it was allocating
8211 - Do not store true in a hashtable, it boxes.
8213 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8215 * flowanalysis.cs: bytify common enums.
8217 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8219 * modifiers.cs: Add a new set of flags for the
8220 flags allowed on explicit interface impls.
8221 * cs-parser.jay: catch the use of modifiers in
8222 interfaces correctly.
8223 * class.cs: catch private void IFoo.Blah ().
8225 All related to bug #50572.
8227 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8229 * decl.cs: Rewrite the consistant accessability checking.
8230 Accessability is not linear, it must be implemented in
8231 a tableish way. Fixes #49704.
8233 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8235 * expression.cs: Handle negation in a checked context.
8236 We must use subtraction from zero. Fixes #38674.
8238 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8240 * class.cs: Ignore static void main in DLLs.
8241 * rootcontext.cs: Handle the target type here,
8242 since we are have to access it from class.cs
8243 * driver.cs: account for the above.
8245 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8247 * report.cs: Give line numbers and files if available.
8249 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8251 * driver.cs: Implement /addmodule.
8253 * typemanager.cs: Change 'modules' field so it now contains Modules not
8256 2003-12-20 Martin Baulig <martin@ximian.com>
8258 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8259 (FieldBase.IsAssigned): Removed this field.
8260 (FieldBase.SetAssigned): New public method.
8261 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8263 2003-12-20 Martin Baulig <martin@ximian.com>
8265 * expression.cs (LocalVariableReference.DoResolve): Don't set
8266 `vi.Used' if we're called from DoResolveLValue().
8268 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8269 returns the usage vector it just merged into the current one -
8270 pass this one to UsageWarning().
8271 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8272 of the `EmitContext', don't call this recursively on our children.
8274 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8276 * driver.cs: Implement /target:module.
8278 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8280 * support.cs (CharArrayHashtable): New helper class.
8282 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8283 char arrays, not strings, so we can avoid creating a string in
8284 consume_identifier if the identifier is a keyword.
8286 2003-12-16 Martin Baulig <martin@ximian.com>
8288 * statement.cs (LocalInfo.Assigned): Removed this property.
8289 (LocalInfo.Flags): Removed `Assigned'.
8290 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8291 and uses flow analysis.
8292 (Block.UsageWarning): Made this method private.
8293 (Block.Resolve): Call UsageWarning() if appropriate.
8295 * expression.cs (LocalVariableReference.DoResolve): Always set
8296 LocalInfo.Used here.
8298 2003-12-13 Martin Baulig <martin@ximian.com>
8300 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8301 any value here; we're now using flow analysis to figure out
8302 whether a statement/block returns a value.
8304 2003-12-13 Martin Baulig <martin@ximian.com>
8306 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8308 (FlowBranching.MergeFinally): Don't call
8309 `branching.CheckOutParameters()' here, this is called in
8311 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8312 when adding the `finally' vector.
8314 2003-12-13 Martin Baulig <martin@ximian.com>
8317 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8318 actually work and also fix #48962.
8320 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8322 * decl.cs: Do not check System.Object for nested types,
8323 since we know it does not have any. Big bang for buck:
8328 corlib: 17.99 seconds
8332 corlib: 17.39 seconds
8334 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8336 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8337 time we are returning 0 members, so we save alot here.
8339 2003-12-11 Martin Baulig <martin@ximian.com>
8341 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8342 `MergeChild()', also just take the `FlowBranching' as argument;
8343 call Merge() on it and return the result.
8344 (FlowBranching.Merge): We don't need to do anything if we just
8347 2003-12-11 Martin Baulig <martin@ximian.com>
8349 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8350 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8351 Maurer for this idea.
8353 2003-12-11 Martin Baulig <martin@ximian.com>
8355 * flowanalysis.cs (MergeResult): This class is now gone; we now
8356 use the `UsageVector' for this. The reason for this is that if a
8357 branching just has one sibling, we don't need to "merge" them at
8358 all - that's the next step to do.
8359 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8362 2003-12-11 Martin Baulig <martin@ximian.com>
8364 Reworked flow analyis and made it more precise and bug-free. The
8365 most important change is that we're now using a special `Reachability'
8366 class instead of having "magic" meanings of `FlowReturns'. I'll
8367 do some more cleanups and optimizations and also add some more
8368 documentation this week.
8370 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8371 largely reworked this class.
8372 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8373 the new `Reachability' class instead of having "magic" values here.
8374 (FlowBranching): We're now using an instance of `Reachability'
8375 instead of having separate `Returns', `Breaks' etc. fields.
8377 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8378 based on flow analysis; ignore the return value of block.Emit ().
8380 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8382 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8383 if they are private.
8385 2003-12-09 Martin Baulig <martin@ximian.com>
8387 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8388 call them directly on the UsageVector.
8390 2003-12-09 Martin Baulig <martin@ximian.com>
8392 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8393 Changed return type from `FlowReturns' to `Reachability'.
8395 2003-12-09 Martin Baulig <martin@ximian.com>
8397 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8398 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8399 `Reachable' fields with a single `Reachability' one.
8401 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8403 * class.cs (FindMembers): Remove foreach's.
8416 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8421 This patch does a few things:
8422 1. EmptyStatement is now a singleton, so it is never reallocated.
8423 2. All blah is EmptyStatement constructs have been changed to
8424 blah == EmptyStatement.Value, which is much faster and valid
8425 now that EmptyStatement is a singleton.
8426 3. When resolving a block, rather than allocating a new array for
8427 the non-empty statements, empty statements are replaced with
8428 EmptyStatement.Value
8429 4. Some recursive functions have been made non-recursive.
8430 Mainly the performance impact is from (3), however (1) and (2) are needed for
8431 this to work. (4) does not make a big difference in normal situations, however
8432 it makes the profile look saner.
8437 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8438 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8439 Total memory allocated: 56397 KB
8442 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8443 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8444 Total memory allocated: 55666 KB
8446 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8448 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8449 than the hashtable in a hashtable version
8451 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8452 we always end up concating a string. This results in a huge perf
8453 loss, because many strings have to be tracked by the GC. In this
8454 patch, we first use a hashtable that works with two keys, so that
8455 the strings do not need to be concat'ed.
8466 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8468 * Makefile: Add a new target `do-time' that does a quick and simple
8469 profile, leaving easy to parse output.
8471 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8473 * codegen.cs (Init): Create the dynamic assembly with
8474 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8476 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8478 * support.cs: Make the PtrHashtable use only one
8479 instance of its comparer.
8481 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8483 * typemanager.cs: Fix lookup of GetNamespaces.
8485 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8487 * expression.cs: Removed redundant line.
8489 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8490 ArrayLists, use for loops with bounds.
8492 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8495 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8496 arraylists, use for loop with bounds.
8498 The above three changes give us a 0.071 second performance
8499 improvement out of 3.294 seconds down to 3.223. On my machine
8500 the above changes reduced the memory usage by 1,387 KB during
8503 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8504 QualifiedIdentifiers. Before we created a new string through
8505 concatenation, and mostly later on, the result would be
8506 manipulated by DecomposeQI through string manipulation.
8508 This reduced the compiler memory usage for bootstrapping from
8509 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8510 compile times in 0.05 seconds.
8512 2003-11-28 Dick Porter <dick@ximian.com>
8514 * support.cs: Do string compares with the Invariant culture.
8522 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
8523 the comparison is done with the Invariant culture.
8525 2003-11-27 Miguel de Icaza <miguel@ximian.com>
8527 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
8528 GetEnumerator method.
8530 (ProbeCollectionType): Iterate starting at the most specific type
8531 upwards looking for a GetEnumerator
8533 * expression.cs: Shift count can be up to 31 for int/uint and 63
8536 2003-11-26 Miguel de Icaza <miguel@ximian.com>
8538 * statement.cs (Block.LookupLabel): Also look for the label on the
8539 children blocks. Use a hash table to keep track of visited
8542 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
8543 we actually did transform the other operand, otherwise fall back
8544 to the common codepath that casts to long.
8546 * cs-tokenizer.cs: Use the same code pattern as the int case.
8547 Maybe I should do the parsing myself, and avoid depending on the
8548 Parse routines to get this done.
8550 2003-11-25 Miguel de Icaza <miguel@ximian.com>
8552 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8553 which fixes bug 51347. This time test it.
8555 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
8556 attributes for example can not tell the difference between these.
8557 The difference was only a syntax feature of the language.
8559 * attribute.cs: Apply attributes to delegates.
8561 * delegate.cs: Call the apply attributes method.
8563 2003-11-24 Miguel de Icaza <miguel@ximian.com>
8565 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
8566 comparing 0 vs Byte.MinValue, not the value
8568 (ImplicitConversionRequired): When reporting a conversion error,
8569 use error 31 to print out the constant error instead of the
8572 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
8573 which fixes bug 51347.
8575 2003-11-22 Miguel de Icaza <miguel@ximian.com>
8577 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
8578 which fixes the -warnaserror command line option.
8580 2003-11-21 Miguel de Icaza <miguel@ximian.com>
8582 * cfold.cs (DoNumericPromotions): During constant folding of
8583 additions on UIntConstant, special case intconstants with
8584 IntConstants like we do on the expression binary operator.
8586 2003-11-12 Miguel de Icaza <miguel@ximian.com>
8588 * convert.cs (ImplicitReferenceConversion): We were missing a case
8589 (System.Enum are not value types or class types, so we need to
8590 classify them separatedly).
8592 * driver.cs: We do not support error 2007.
8594 2003-11-12 Jackson Harper <jackson@ximian.com>
8596 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
8597 system directory. Also use the full file name so users can
8598 libraries names mscorlib-o-tron.dll in a non system dir.
8600 2003-11-10 Martin Baulig <martin@ximian.com>
8602 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
8603 (TypeManager.InitCoreTypes): Initialize them here, but instead of
8604 calling `ResolveType()' on them, directly assign their `Type'.
8606 2003-11-08 Martin Baulig <martin@ximian.com>
8608 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
8609 return value and the `out parent' parameter.
8610 (TypeContainer.DefineType): Moved the CS0644 check into
8611 GetClassBases(). Don't pass the interface types to the
8612 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
8613 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
8615 * ecore.cs (TypeExpr.IsAttribute): New property.
8616 (TypeExpr.GetInterfaces): New method.
8618 * interface.cs (Interface.GetInterfaceTypeByName): Return a
8619 TypeExpr instead of a Type.
8620 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
8621 (Interface.DefineType): Don't pass the interface types to the
8622 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
8623 them later and then call `TypeBulider.AddInterfaceImplementation()'.
8625 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
8626 instead of a `Type[]'.
8627 (TypeManager.RegisterBuilder): Likewise.
8628 (TypeManager.AddUserInterface): Likewise.
8629 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
8630 `Type[]' and also return a `TypeExpr[]'.
8631 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
8633 2003-11-08 Martin Baulig <martin@ximian.com>
8635 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
8638 2003-11-08 Martin Baulig <martin@ximian.com>
8640 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
8641 TypeManager.ResolveExpressionTypes().
8643 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
8644 instead of an Expression.
8645 (TypeExpr): This is now an abstract base class for `TypeExpression'.
8646 (TypeExpression): New public class; formerly known as `TypeExpr'.
8648 * expression.cs (ComposedCast): Derive from TypeExpr.
8650 * typemanager.cs (TypeManager.system_*_expr): These are now
8651 TypExpr's instead of Expression's.
8652 (TypeManager.ResolveExpressionTypes): New public static function;
8653 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
8656 2003-11-06 Miguel de Icaza <miguel@ximian.com>
8658 * expression.cs (New.DoResolve): Do not dereference value that
8659 might be a null return.
8661 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
8662 sure that the constant value has the right type. Fixes an
8663 unreported bug, similar to 50425.
8665 * const.cs (Const.LookupConstantValue): Call
8666 ImplicitStandardConversionExists before doing a conversion to
8667 avoid havng the TypeManager.ChangeType do conversions.
8669 Reduced the number of casts used
8671 (Const.ChangeType): New routine to enable reuse of the constant
8672 type changing code from statement.
8674 * typemanager.cs (ChangeType): Move common initialization to
8675 static global variables.
8679 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
8680 every value type to go through, even if it was void. Fix that.
8682 * cs-tokenizer.cs: Use is_identifier_start_character on the start
8683 character of the define, and the is_identifier_part_character for
8684 the rest of the string.
8686 2003-11-05 Miguel de Icaza <miguel@ximian.com>
8688 * expression.cs (UnaryMutator.EmitCode): When I updated
8689 LocalVariableReference.DoResolve, I overdid it, and dropped an
8690 optimization done on local variable references.
8692 2003-11-04 Miguel de Icaza <miguel@ximian.com>
8694 * ecore.cs: Convert the return from Ldlen into an int.
8696 2003-10-20 Miguel de Icaza <miguel@ximian.com>
8698 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
8699 the accessibility, this is a special case for toplevel non-public
8700 classes (internal for instance).
8702 2003-10-20 Nick Drochak <ndrochak@gol.com>
8704 * ecore.cs: Fix typo and build. Needed another right paren.
8706 2003-10-19 Miguel de Icaza <miguel@ximian.com>
8708 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
8709 `internal' case regular and protected, but not allowing protected
8710 to be evaluated later. Bug 49840
8712 2003-10-15 Miguel de Icaza <miguel@ximian.com>
8714 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
8715 to kb.Nlast, and not the kb.nFirst to isolate the switch
8718 Extract the underlying type, so enumerations of long/ulong are
8719 treated like long/ulong.
8721 2003-10-14 Miguel de Icaza <miguel@ximian.com>
8723 * expression.cs (New): Overload the meaning of RequestedType to
8724 track the possible creation of the NewDelegate type, since
8725 DoResolve is invoked more than once for new constructors on field
8728 See bugs: #48800 and #37014
8730 * cs-parser.jay (declare_local_constants): Take an arraylist
8731 instead of a single constant.
8733 (local_constant_declaration): It should take a
8734 constant_declarators, not a constant_declarator. Fixes 49487
8736 * convert.cs: Fix error report.
8738 2003-10-13 Jackson Harper <jackson@ximian.com>
8740 * typemanager.cs (TypeToCoreType): Add float and double this fixes
8743 2003-10-09 Martin Baulig <martin@ximian.com>
8745 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
8747 (MethodCore.DoDefineParameters): Removed the TypeContainer
8748 argument; use the DeclSpace which was passed to the .ctor instead.
8749 (MethodCore.CheckParameter): Take a DeclSpace instead of a
8750 TypeContainer; we only need a DeclSpace here.
8752 2003-10-09 Martin Baulig <martin@ximian.com>
8754 * class.cs (MethodData): Added additional `DeclSpace ds' argument
8756 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
8757 EmitContext's .ctor.
8759 2003-10-09 Martin Baulig <martin@ximian.com>
8761 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
8762 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
8763 AsAccessible(), moved them as well.
8765 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
8767 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
8769 * cs-parser.jay : Renamed yyName to yyNames related to jay.
8771 2003-10-07 Miguel de Icaza <miguel@ximian.com>
8773 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
8774 generation for >=, as spotted by Paolo, bug 48679.
8775 Patch from David Waite.
8777 * cs-tokenizer.cs: Add handling for #pragma.
8779 * cs-parser.jay: Allow for both yield and yield return in the
8780 syntax. The anti-cobolization of C# fight will go on!
8782 * class.cs (TypeBuilder.DefineType): Catch error condition here
8783 (Parent.DefineType erroring out and returning null).
8785 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8786 coping with enumerations variables, we were mistakenly processing
8787 them as a regular value type instead of built-in types. Fixes the
8790 * typemanager.cs (IsBuiltinOrEnum): New method.
8792 2003-09-30 Miguel de Icaza <miguel@ximian.com>
8794 * cs-parser.jay: Upgrade: yield now needs the return clause.
8796 2003-09-19 Martin Baulig <martin@ximian.com>
8798 * decl.cs (MemberCache.SetupCacheForInterface): Take a
8799 `MemberCache parent' argument. Normally, an interface doesn't
8800 have a parent type except System.Object, but we use this in gmcs
8801 for generic type parameters.
8803 2003-09-18 Martin Baulig <martin@ximian.com>
8805 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
8806 on `type.IsInterface'; don't check whether the type has a parent
8807 to determine whether it's an interface.
8809 2003-09-15 Martin Baulig <martin@ximian.com>
8811 * class.cs (TypeContainer.DefineType): Added an error flag to
8812 avoid reporting duplicate CS0146's ("class definition is
8815 * driver.cs (Driver.MainDriver): Abort if
8816 RootContext.ResolveTree() reported any errors.
8818 2003-09-07 Martin Baulig <martin@ximian.com>
8820 * report.cs (Error, Warning): Added overloaded versions which take
8821 a `params object[] args' and call String.Format().
8823 2003-09-07 Martin Baulig <martin@ximian.com>
8825 * decl.cs (DeclSpace..ctor): Don't call
8826 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
8827 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
8828 (DeclSpace.RecordDecl): New method.
8830 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
8832 2003-09-02 Ravi Pratap <ravi@ximian.com>
8834 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
8835 value attributes to be applied to ParameterBuilders.
8837 * class.cs (MethodCore.LabelParameters): Make static and more
8838 generic so that it can be used from other places - like interface
8839 methods, for instance.
8841 * interface.cs (Interface.Emit): Call LabelParameters before
8842 emitting attributes on the InterfaceMethod.
8844 2003-08-26 Martin Baulig <martin@ximian.com>
8846 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
8847 resolving aliases; fixes #47927.
8849 2003-08-26 Martin Baulig <martin@ximian.com>
8851 * statement.cs (Using.DoResolve): This is internally emitting a
8852 try/finally clause, so we need to set ec.NeedExplicitReturn if we
8853 do not always return. Fixes #47681.
8855 2003-08-26 Martin Baulig <martin@ximian.com>
8857 * decl.cs (MemberCore): Moved WarningNotHiding(),
8858 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
8860 (AdditionResult): Make this nested in DeclSpace.
8861 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
8862 argument; call NamespaceEntry.Define() unless we're nested in a
8865 * namespace.cs (Namespace.DefineName): New public function. This
8866 is called from DeclSpace's .ctor to add
8867 (Namespace.Lookup): Include DeclSpaces in the lookup.
8869 * class.cs (Operator): Derive from MemberBase, not MemberCore.
8871 * const.cs (Const): Derive from MemberBase, not MemberCore.
8873 2003-08-25 Martin Baulig <martin@ximian.com>
8875 * convert.cs (Convert.ExplicitReferenceConversion): When
8876 converting from an interface type to a class, unbox if the target
8877 type is a struct type. Fixes #47822.
8879 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8881 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
8884 2003-08-22 Martin Baulig <martin@ximian.com>
8886 * class.cs (TypeManager.DefineType): When defining a nested type,
8887 call DefineType() on our parent; fixes #47801.
8889 2003-08-22 Martin Baulig <martin@ximian.com>
8891 * class.cs (MethodData.Define): While checking if a method is an
8892 interface implementation, improve the test a bit more to fix #47654.
8894 2003-08-22 Martin Baulig <martin@ximian.com>
8896 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
8897 correctly; fixes #47722.
8899 2003-08-22 Martin Baulig <martin@ximian.com>
8901 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
8902 LocalVariableReference, ensure it's not read-only. Fixes #47536.
8904 * statement.cs (Fixed.DoResolve): Make all variables read-only.
8906 2003-08-22 Martin Baulig <martin@ximian.com>
8908 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
8909 can only be assigned in static constructors. Fixes #47161.
8911 2003-08-22 Martin Baulig <martin@ximian.com>
8913 Rewrote and improved the flow analysis code.
8915 * flowbranching.cs (FlowBranching): Make this class abstract.
8916 (FlowBranching.CreateBranching): New static function to create a
8918 (FlowBranchingBlock, FlowBranchingException): New classes.
8919 (FlowBranching.UsageVector.Type): New public readonly field.
8920 (FlowBranching.UsageVector.Breaks): Removed the setter.
8921 (FlowBranching.UsageVector.Returns): Removed the setter.
8922 (FlowBranching.UsageVector): Added Break(), Return(),
8923 NeverReachable() and Throw() methods to modify the reachability.
8924 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
8925 done by FlowBranching.Merge().
8926 (FlowBranching.UsageVector.MergeChild): New method; merges the
8927 merge result into the current vector.
8928 (FlowBranching.Merge): New abstract method to merge a branching.
8930 2003-08-12 Martin Baulig <martin@ximian.com>
8932 * expression.cs (Indirection.CacheTemporaries): Create the
8933 LocalTemporary with the pointer type, not its element type.
8935 2003-08-10 Miguel de Icaza <miguel@ximian.com>
8937 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
8938 token was a keyword or not.
8940 Add `error' options where an IDENTIFIER was expected; Provide
8941 CheckToken and CheckIdentifierToken convenience error reporting
8944 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
8946 * decl.cs: Rename `NamespaceEntry Namespace' public field into
8947 NameSpaceEntry NameSpaceEntry.
8949 (LookupInterfaceOrClass): Avoid creating a full qualified name
8950 from namespace and name: avoid doing lookups when we know the
8951 namespace is non-existant. Use new Tree.LookupByNamespace which
8952 looks up DeclSpaces based on their namespace, name pair.
8954 * driver.cs: Provide a new `parser verbose' to display the
8955 exception thrown during parsing. This is turned off by default
8956 now, so the output of a failure from mcs is more graceful.
8958 * namespace.cs: Track all the namespaces defined in a hashtable
8961 (IsNamespace): New method
8963 2003-08-09 Miguel de Icaza <miguel@ximian.com>
8965 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
8966 we know that we need to concatenate (full typename can never be
8971 * statement.cs: Use a bitfield; Do not initialize to null things
8972 which are done by the constructor by default.
8974 * cs-parser.jay: bug fix, parameter was 4, not 3.
8976 * expression.cs: Just use the property;
8978 * statement.cs: No need for GetVariableInfo method.
8980 2003-08-08 Martin Baulig <martin@ximian.com>
8982 * flowanalysis.cs (FlowReturns): This is now nested in the
8983 `FlowBranching' class.
8984 (MyBitVector): Moved this here from statement.cs.
8985 (FlowBranching.SiblingType): New enum type.
8986 (FlowBranching.CreateSibling): Added `SiblingType' argument.
8988 2003-08-07 Martin Baulig <martin@ximian.com>
8990 * flowanalysis.cs (FlowBranchingType): This is now nested in the
8991 `FlowBranching' class and called `BranchingType'.
8993 2003-08-07 Martin Baulig <martin@ximian.com>
8995 * flowanalysis.cs: Moved all the control flow analysis code into
8998 2003-08-07 Martin Baulig <martin@ximian.com>
9000 * assign.cs (Assign.DoResolve): `target' must either be an
9001 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9004 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9006 * expression.cs (BinaryMethod): This kind of expression is created by the
9007 Binary class if it determines that the operator has to be handled
9010 (BinaryDelegate): This kind of expression is created if we are
9011 dealing with a + or - operator on delegates.
9013 (Binary): remove method, argumetns, and DelegateOperator: when
9014 dealing with methods,
9016 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9018 * statement.cs (Block): use bitfields for the three extra booleans
9019 we had in use. Remove unused topblock parameter.
9021 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9023 * assign.cs: Drop extra unneeded tests.
9025 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9027 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9029 * statement.cs (Foreach): Use VariableStorage instead of
9032 * codegen.cs (VariableStorage): New class used by clients that
9033 require a variable stored: locals or fields for variables that
9034 need to live across yield.
9036 Maybe provide a convenience api for EmitThis+EmitLoad?
9038 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9041 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9043 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9044 RemapParameterLValue): New methods that are used to turn a
9045 precomputed FieldInfo into an expression like this:
9049 The idea is to use this instead of making LocalVariableReference
9050 have more than one meaning.
9052 * cs-parser.jay: Add error production to BASE.
9054 * ecore.cs: Deal with TypeManager.GetField returning null, which
9055 is now a valid return value.
9057 (FieldExprNoAddress): New expression for Fields whose address can
9060 * expression.cs (LocalVariableReference): During the resolve
9061 phases, create new expressions if we are in a remapping context.
9062 Remove code that dealt with remapping here.
9064 (ParameterReference): same.
9066 (ProxyInstance): New expression, like the `This' expression, but
9067 it is born fully resolved. We know what we are doing, so remove
9068 the errors that are targeted to user-provided uses of `this'.
9070 * statement.cs (Foreach): our variable is now stored as an
9071 Expression; During resolution, follow the protocol, dont just
9072 assume it will return this.
9074 2003-08-06 Martin Baulig <martin@ximian.com>
9076 * support.cs (SeekableStreamReader.cs): New public class.
9078 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9079 SeekableStreamReader instead of the normal StreamReader.
9081 2003-08-04 Martin Baulig <martin@ximian.com>
9083 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9084 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9085 deambiguate casts and delegate invocations.
9086 (parenthesized_expression): Use the new tokens to ensure this is
9087 not a cast of method invocation.
9089 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9090 when reading a `)' and Deambiguate_CloseParens () was previously
9093 * expression.cs (ParenthesizedExpression): New class. This is
9094 just used for the CS0075 test.
9095 (Binary.DoResolve): Check for CS0075.
9097 2003-07-29 Ravi Pratap <ravi@ximian.com>
9099 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9100 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9101 reference comparison.
9103 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9104 examine the ReturnType for equality - this is necessary in the
9105 cases of implicit and explicit operators whose signature also
9106 includes the return type.
9108 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9110 * namespace.cs: Cache the result of the namespace computation,
9111 instead of computing it every time.
9113 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9115 * decl.cs: Use a global arraylist that we reuse over invocations
9116 to avoid excesive memory consumption. Reduces memory usage on an
9117 mcs compile by one meg (45 average).
9119 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9120 private, work around that.
9122 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9124 * literal.cs (IntLiteral): Define Zero and One static literals.
9126 * cs-parser.jay (integer_literal): use static literals to reduce
9127 memory usage for the most used literals (0, 1 and -1). 211kb
9128 reduced in memory usage.
9130 Replace all calls to `new ArrayList' with `new
9131 ArrayList(4)' which is a good average number for most allocations,
9132 and also requires only 16 bytes of memory for its buffer by
9135 This reduced MCS memory usage in seven megabytes for the RSS after
9138 2003-07-28 Ravi Pratap <ravi@ximian.com>
9140 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9141 handle params methods the correct way by forming only one
9142 applicable set with params and normal methods in them. Earlier we
9143 were looking at params methods only if we found no normal methods
9144 which was not the correct thing to do.
9146 (Invocation.BetterFunction): Take separate arguments indicating
9147 when candidate and the best method are params methods in their
9150 This fixes bugs #43367 and #46199.
9152 * attribute.cs: Documentation updates.
9154 (CheckAttribute): Rename to CheckAttributeTarget.
9155 (GetValidPlaces): Rename to GetValidTargets.
9157 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9158 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9162 2003-07-28 Martin Baulig <martin@ximian.com>
9164 * class.cs (TypeContainer.DefineMembers): Use the base type's full
9165 name when looking up the base class of a nested class. Fixes #46977.
9167 2003-07-26 Martin Baulig <martin@ximian.com>
9169 * expression.cs (Indexers.Indexer): New nested struct; contains
9170 getter, setter and the indexer's type.
9171 (Indexers.Properties): This is now an ArrayList of
9173 (IndexerAccess.DoResolveLValue): Correctly set the type if the
9174 indexer doesn't have any getters.
9176 * assign.cs (Assign.DoResolve): Also do the implicit conversions
9177 for embedded property and indexer assignments.
9179 2003-07-26 Martin Baulig <martin@ximian.com>
9181 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9182 preprocessor directive is not the first non-whitespace character
9185 2003-07-26 Martin Baulig <martin@ximian.com>
9187 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9188 namespace parsing, follow the spec more closely.
9190 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9191 NamespaceEntry.Lookup().
9193 2003-07-25 Martin Baulig <martin@ximian.com>
9195 * MethodCore.cs (OverridesSomething): New public field; it's set
9196 from TypeContainer.DefineMembers if this method overrides
9197 something (which doesn't need to be a method). Fix #39462.
9199 2003-07-25 Ravi Pratap <ravi@ximian.com>
9201 * typemanager.cs (GetMembers): Ensure that the list of members is
9202 reversed. This keeps things in sync.
9204 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9205 find an AttributeUsage attribute.
9207 * expression.cs (Invocation.OverloadResolve): Perform the check
9208 which disallows Invoke to be directly called on a Delegate.
9210 (Error_InvokeOnDelegate): Report error cs1533.
9212 2003-07-25 Martin Baulig <martin@ximian.com>
9214 * expression.cs (Indexers.GetIndexersForType): Only look in the
9215 interface hierarchy if the requested type is already an
9216 interface. Fixes #46788 while keeping #46502 fixed.
9218 2003-07-25 Martin Baulig <martin@ximian.com>
9220 * class.cs (TypeContainer.DefineMembers): Check whether all
9221 readonly fields have been assigned and report warning CS0649 if
9224 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9227 2003-07-24 Ravi Pratap <ravi@ximian.com>
9229 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9230 returned from GetMethods to make things consistent with the
9231 assumptions MCS makes about ordering of methods.
9233 This should comprehensively fix bug #45127 and it does :-)
9235 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9236 ordering is actually reverse.
9238 * Clean up some debug messages I left lying around.
9240 * interface.cs (Populate*): Get rid of code which emits attributes
9241 since the stage in which we emit attributes is the 'Emit' stage,
9242 not the define stage.
9244 (Emit): Move attribute emission for interface members here.
9246 2003-07-22 Ravi Pratap <ravi@ximian.com>
9248 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9249 closely: we eliminate methods in base types when we have an
9250 applicable method in a top-level type.
9252 Please see section 14.5.5.1 for an exact description of what goes
9255 This fixes bug #45127 and a host of other related to corlib compilation.
9257 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9258 array is the method corresponding to the top-level type (this is
9259 because of the changes made to icall.c) so we change this
9262 (MethodGroupExpr.Name): This too.
9264 * typemanager.cs (GetElementType): New method which does the right
9265 thing when compiling corlib.
9267 * everywhere: Make use of the above in the relevant places.
9269 2003-07-22 Martin Baulig <martin@ximian.com>
9271 * cs-parser.jay (invocation_expression): Moved
9272 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9273 `cast_expression', but create a InvocationOrCast which later
9274 resolves to either an Invocation or a Cast.
9276 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9277 method; call this before EmitStatement() to make sure that this
9278 expression can be used as a statement.
9280 * expression.cs (InvocationOrCast): New class; resolves to either
9281 an Invocation or a Cast.
9283 * statement.cs (StatementExpression): Call ResolveStatement() on
9284 the ExpressionStatement before emitting it.
9286 2003-07-21 Martin Baulig <martin@ximian.com>
9288 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9289 `ref' and `out' attributes match; fixes #46220.
9290 (MemberAccess.ResolveMemberAccess): You can't reference a type
9291 through an expression; fixes #33180.
9292 (Indexers.GetIndexersForType): Don't return the indexers from
9293 interfaces the class implements; fixes #46502.
9295 2003-07-21 Martin Baulig <martin@ximian.com>
9297 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9298 CS0661 checks; fixes bug #30442.
9300 2003-07-21 Martin Baulig <martin@ximian.com>
9302 * decl.cs (AdditionResult): Added `Error'.
9304 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9306 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9307 makes cs0031.cs actually work.
9309 2003-07-20 Martin Baulig <martin@ximian.com>
9311 * namespace.cs: Fixed that bug which caused a crash when compiling
9314 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9316 * typemanager.cs (LookupTypeReflection): Never expose types which
9317 are NotPublic, NestedPrivate, NestedAssembly, or
9318 NestedFamANDAssem. We used to return these, and later do a check
9319 that would report a meaningful error, but the problem is that we
9320 would not get the real match, if there was a name override.
9322 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9324 * namespace.cs (Namespace, Name): Do not compute the namespace
9325 name dynamically, compute it in the constructor. This reduced
9326 memory usage by 1697 KB.
9328 * driver.cs: Use --pause to pause at the end.
9330 2003-07-17 Peter Williams <peter@newton.cx>
9332 * Makefile: Change the name of the test target so that it doesn't
9333 conflict with the recursive test target.
9335 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9337 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9338 AddressOf): Do not use EmitThis, that was wrong, use the actual
9341 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9343 * class.cs (MethodData.Define): While checking if a method is an
9344 interface implementation, improve the test: If we are not public
9345 (use new test here: use the computed MethodAttributes directly,
9346 instead of the parsed modifier flags) check if the `implementing'
9347 method comes from an interface or not.
9349 * pending.cs (VerifyPendingMethods): Slightly better error
9352 * makefile: add test target that does the mcs bootstrap.
9354 2003-07-16 Ravi Pratap <ravi@ximian.com>
9356 * interface.cs (Define): Do nothing here since there are no
9357 members to populate etc. Move the attribute emission out of here
9358 since this was just totally the wrong place to put it. Attribute
9359 application happens during the 'Emit' phase, not in the 'Define'
9362 (Emit): Add this method and move the attribute emission here
9364 * rootcontext.cs (EmitCode): Call the Emit method on interface
9367 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9369 * expression.cs (OverloadResolve): Report error only if Location
9370 is not 'Null' which means that there was a probe going on.
9372 2003-07-14 Martin Baulig <martin@ximian.com>
9374 * expression.cs (ConditionalLogicalOperator): New public class to
9375 implement user defined conditional logical operators.
9376 This is section 14.11.2 in the spec and bug #40505.
9378 2003-07-14 Martin Baulig <martin@ximian.com>
9380 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9382 2003-07-14 Martin Baulig <martin@ximian.com>
9384 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9386 * ecore.cs (IVariable.VerifyFixed): New interface method.
9388 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9389 operator, check whether the variable is actually fixed. Fixes bug
9390 #36055. Set a variable definitely assigned when taking its
9391 address as required by the spec.
9393 * statement.cs (LocalInfo.IsFixed): New field.
9394 (LocalInfo.MakePinned): Set `IsFixed' to true.
9396 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9398 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9399 for .ctors, ensure that we only ask for members declared in the
9400 attribute type (BindingFlags.DeclaredOnly).
9404 * expression.cs (Error_WrongNumArguments): Report error 1501
9405 correctly the way CSC does.
9407 2003-07-13 Martin Baulig <martin@ximian.com>
9409 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9410 lookup on the fully qualified name, to make things like "X.X" work
9411 where "X.X" is a fully qualified type name, but we also have a
9412 namespace "X" in the using list. Fixes #41975.
9414 2003-07-13 Martin Baulig <martin@ximian.com>
9416 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9417 function. If we're a CompoundAssign, we need to create an embedded
9418 CompoundAssign, not an embedded Assign.
9419 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9422 2003-07-13 Martin Baulig <martin@ximian.com>
9424 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9425 work to fix bug #46088.
9427 2003-07-13 Ravi Pratap <ravi@ximian.com>
9429 * class.cs (Operator.Emit): Do not emit attributes here - it is
9430 taken care of by the Method class that we delegate too. This takes
9433 2003-07-10 Martin Baulig <martin@ximian.com>
9435 * expression.cs (TypeOfVoid): New class.
9436 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9438 2003-07-10 Martin Baulig <martin@ximian.com>
9440 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9443 2003-07-10 Martin Baulig <martin@ximian.com>
9445 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
9446 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
9448 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
9450 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
9452 2003-07-10 Martin Baulig <martin@ximian.com>
9454 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
9455 of decimal. Fixes #42850.
9457 NOTE: I also fixed the created byte blob, but this doesn't work on
9458 the MS runtime and csc never produces any byte blobs for decimal
9461 2003-07-10 Martin Baulig <martin@ximian.com>
9463 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
9464 structs; fixes #32068.
9465 (Block.AddChildVariableNames): Fixed #44302.
9467 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9469 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
9471 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9473 * attribute.cs: And this test is onger needed.
9475 2003-07-08 Martin Baulig <martin@ximian.com>
9477 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
9478 inaccessible types. Fixes #36313.
9480 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
9482 * namespace.cs (NamespaceEntry): Create implicit entries for all
9483 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
9484 implicit entries for N1.N2 and N1.
9486 2003-07-08 Martin Baulig <martin@ximian.com>
9488 Rewrote the handling of namespaces to fix a lot of the issues
9489 wrt. `using' aliases etc.
9491 * namespace.cs (Namespace): Splitted this class into a
9492 per-assembly `Namespace' and a per-file `NamespaceEntry'.
9494 * typemanager.cs (TypeManager.IsNamespace): Removed.
9495 (TypeManager.ComputeNamespaces): Only compute namespaces from
9496 loaded assemblies here, not the namespaces from the assembly we're
9497 currently compiling.
9499 2003-07-08 Martin Baulig <martin@ximian.com>
9501 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
9503 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9505 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
9508 I thought about the memory savings here, but LookupTypeReflection
9509 is used under already very constrained scenarios. Compiling
9510 corlib or mcs only exposes one hit, so it would not really reduce
9511 any memory consumption.
9513 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9515 * typemanager.cs: fixes bug #45889 by only adding public types from
9516 other assemblies to the list of known types.
9518 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9520 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
9521 on the type we resolved.
9523 2003-07-05 Martin Baulig <martin@ximian.com>
9525 * pending.cs (PendingImplementation.ParentImplements): Don't
9526 create the proxy if the parent is abstract.
9528 * class.cs (TypeContainer.DefineIndexers): Process explicit
9529 interface implementations first. Fixes #37714.
9531 2003-07-04 Miguel de Icaza <miguel@ximian.com>
9533 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
9534 defined recursively; but since we modify the input parameters
9535 (left is set to `this' temporarily), we reset this value if the
9536 left_is_explicit is false, which gives the original semantics to
9539 * literal.cs (NullPointer): new class used to represent a null
9540 literal in a pointer context.
9542 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
9543 type is a pointer, use a NullPointer object instead of a
9544 NullLiteral. Closes 43687
9546 (ExplicitConversion): Convert pointer values using
9547 the conv opcode to the proper type.
9549 * ecore.cs (New): change ValueTypeVariable property into a method,
9550 that returns whether the valuetype is suitable for being used.
9552 * expression.cs (Binary.DoNumericPromotions): Only return if we
9553 the int constant was a valid uint, and we can return both left and
9554 right as uints. If not, we continue processing, to trigger the
9555 type conversion. This fixes 39018.
9557 * statement.cs (Block.EmitMeta): During constant resolution, set
9558 the CurrentBlock property on the emitcontext, so that we resolve
9559 constants propertly.
9561 2003-07-02 Martin Baulig <martin@ximian.com>
9563 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
9564 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
9566 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
9567 than emitting it here.
9569 * statement.cs: Fixed some more flow analysis bugs.
9571 2003-07-02 Martin Baulig <martin@ximian.com>
9573 * class.cs (MethodData.Define): When implementing interface
9574 methods, set Final unless we're Virtual.
9576 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
9577 check work for interface methods.
9579 2003-07-01 Martin Baulig <martin@ximian.com>
9581 * ecore.cs (EmitContext.This): Replaced this property with a
9582 GetThis() method which takes a Location argument. This ensures
9583 that we get the correct error location for a CS0188.
9585 2003-07-01 Miguel de Icaza <miguel@ximian.com>
9587 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
9588 ImplicitStandardConversion.
9590 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
9592 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
9594 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
9597 2003-06-30 Miguel de Icaza <miguel@ximian.com>
9599 * class.cs (Constructor.Define): Turn off initlocals for unsafe
9602 (MethodData.Define): Turn off initlocals for unsafe methods.
9604 2003-06-29 Miguel de Icaza <miguel@ximian.com>
9606 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
9607 complete; Fixes #37521.
9609 * delegate.cs: Use Modifiers.TypeAttr to compute the
9610 TypeAttributes, instead of rolling our own. This makes the flags
9611 correct for the delegates.
9613 2003-06-28 Miguel de Icaza <miguel@ximian.com>
9615 * class.cs (Constructor.Define): Set the private flag for static
9616 constructors as well.
9618 * cs-parser.jay (statement_expression): Set the return value to
9619 null, to avoid a crash when we catch an error.
9621 2003-06-24 Miguel de Icaza <miguel@ximian.com>
9623 * cs-parser.jay: Applied patch from Jackson that adds support for
9624 extern and unsafe modifiers to destructor declarations.
9626 * expression.cs: Report error 21 if the user is trying to index a
9629 * driver.cs: Add an error message, suggested by the bug report.
9631 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
9632 if we do not have a ": this ()" constructor initializer. Fixes 45149
9634 2003-06-14 Miguel de Icaza <miguel@ximian.com>
9636 * namespace.cs: Add some information to reduce FAQs.
9638 2003-06-13 Miguel de Icaza <miguel@ximian.com>
9640 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
9641 underlying enumeration types. Fixes #43915.
9643 * expression.cs: Treat ushort/short as legal values to be used in
9646 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
9648 * delegate.cs: transfer custom attributes for paramenters from
9649 the delegate declaration to Invoke and BeginInvoke.
9651 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
9653 * attribute.cs: handle custom marshalers and emit marshal info
9656 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
9658 * makefile.gnu: Added anonymous.cs to the compiler sources.
9660 2003-05-28 Miguel de Icaza <miguel@ximian.com>
9662 * iterators.cs: Change the name of the proxy class to include two
9665 * cs-parser.jay: Update grammar to include anonymous methods.
9667 * anonymous.cs: new file.
9669 2003-05-27 Miguel de Icaza <miguel@ximian.com>
9671 * class.cs (Field.Define): Add missing test for pointers and
9674 2003-05-27 Ravi Pratap <ravi@ximian.com>
9676 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
9677 we use the stobj opcode.
9679 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
9680 since it wasn't the correct fix.
9682 It still is puzzling that we are required to use stobj for IntPtr
9683 which seems to be a ValueType.
9685 2003-05-26 Miguel de Icaza <miguel@ximian.com>
9687 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
9688 during regular simple name resolution. Now, the trick is that
9689 instead of returning for processing the simplename, we do a
9690 TypeManager.LookupType (ie, a rooted lookup as opposed to a
9691 contextual lookup type). If a match is found, return that, if
9692 not, return for further composition.
9694 This fixes long-standing 30485.
9696 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9697 using the address to initialize an object, do an Stobj instead of
9698 using the regular Stelem.
9700 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
9701 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
9702 Because if we are a BaseIndexerAccess that value will be true.
9705 * statement.cs (GotoCase.Resolve): Return after reporting an
9706 error, do not attempt to continue.
9708 * expression.cs (PointerArithmetic.Emit): If our operand is a
9709 long, convert our constants to match the operand before
9710 multiplying. Convert to I type before adding. Fixes 43670.
9712 2003-05-14 Ravi Pratap <ravi@ximian.com>
9714 * enum.cs (ImplicitConversionExists) : Rename to
9715 ImplicitEnumConversionExists to remove ambiguity.
9717 * ecore.cs (NullCast): New type of cast expression class which
9718 basically is very similar to EmptyCast with the difference being
9719 it still is a constant since it is used only to cast a null to
9723 * convert.cs (ImplicitReferenceConversion): When casting a null
9724 literal, we return a NullCast.
9726 * literal.cs (NullLiteralTyped): Remove - I don't see why this
9727 should be around anymore.
9729 The renaming (reported was slightly wrong). Corrections:
9731 ConvertImplicitStandard -> ImplicitConversionStandard
9732 ConvertExplicitStandard -> ExplicitConversionStandard
9734 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
9735 before passing them in !
9737 * convert.cs (ImplicitConversionStandard): When comparing for
9738 equal expr and target types, ensure that expr is not a
9741 In general, we must not be checking (expr_type ==
9742 target_type) in the top level conversion methods
9743 (ImplicitConversion, ExplicitConversion etc). This checking is
9744 done in the methods that they delegate to.
9746 2003-05-20 Miguel de Icaza <miguel@ximian.com>
9748 * convert.cs: Move Error_CannotConvertType,
9749 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
9750 ImplicitNumericConversion, ImplicitConversionExists,
9751 ImplicitUserConversionExists, StandardConversionExists,
9752 FindMostEncompassedType, FindMostSpecificSource,
9753 FindMostSpecificTarget, ImplicitUserConversion,
9754 ExplicitUserConversion, GetConversionOperators,
9755 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
9756 TryImplicitIntConversion, Error_CannotConvertImplicit,
9757 ConvertImplicitRequired, ConvertNumericExplicit,
9758 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
9759 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
9762 Perform the following renames:
9764 StandardConversionExists -> ImplicitStandardConversionExists
9765 ConvertImplicit -> ImplicitConversion
9766 ConvertImplicitStandard -> ImplicitStandardConversion
9767 TryImplicitIntConversion -> ImplicitIntConversion
9768 ConvertImplicitRequired -> ImplicitConversionRequired
9769 ConvertNumericExplicit -> ExplicitNumericConversion
9770 ConvertReferenceExplicit -> ExplicitReferenceConversion
9771 ConvertExplicit -> ExplicitConversion
9772 ConvertExplicitStandard -> ExplicitStandardConversion
9774 2003-05-19 Martin Baulig <martin@ximian.com>
9776 * statement.cs (TypeInfo.StructInfo): Made this type protected.
9777 (TypeInfo): Added support for structs having structs as fields.
9779 * ecore.cs (FieldExpr): Implement IVariable.
9780 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
9781 VariableInfo for the field.
9783 2003-05-18 Martin Baulig <martin@ximian.com>
9785 * expression.cs (This.DoResolve): Report a CS0027 if we're
9786 emitting a field initializer.
9788 2003-05-18 Martin Baulig <martin@ximian.com>
9790 * expression.cs (This.ResolveBase): New public function.
9791 (This.DoResolve): Check for CS0188.
9793 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
9796 * ecore.cs (MethodGroupExpr.DoResolve): Set the
9797 `instance_expression' to null if we don't have any non-static
9800 2003-05-18 Martin Baulig <martin@ximian.com>
9802 Reworked the way how local variables and parameters are handled by
9803 the flow analysis code.
9805 * statement.cs (TypeInfo, VariableMap): New public classes.
9806 (VariableInfo): New public class. This is now responsible for
9807 checking whether a variable has been assigned. It is used for
9808 parameters and local variables.
9809 (Block.EmitMeta): Take the InternalParameters as argument; compute
9810 the layout of the flow vectors here.
9811 (Block.LocalMap, Block.ParameterMap): New public properties.
9812 (FlowBranching): The .ctor doesn't get the InternalParameters
9813 anymore since Block.EmitMeta() now computes the layout of the flow
9815 (MyStructInfo): This class is now known as `StructInfo' and nested
9816 in `TypeInfo'; we don't access this directly anymore.
9818 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
9819 property and removed IsAssigned(), IsFieldAssigned(),
9820 SetAssigned() and SetFieldAssigned(); we now call them on the
9821 VariableInfo so we don't need to duplicate this code everywhere.
9823 * expression.cs (ParameterReference): Added `Block block' argument
9825 (LocalVariableReference, ParameterReference, This): The new
9826 VariableInfo class is now responsible for all the definite
9829 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
9830 IsParameterAssigned, SetParameterAssigned): Removed.
9832 2003-05-18 Martin Baulig <martin@ximian.com>
9834 * typemanager.cs (InitCoreTypes): Try calling
9835 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
9836 the 3-args-version. Corlib now also needs our `void_type'.
9837 (GetMethod): Added overloaded version which takes an optional
9838 `bool report_errors' to allow lookups of optional methods.
9840 2003-05-12 Martin Baulig <martin@ximian.com>
9842 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
9843 only used for locals and not for parameters.
9845 2003-05-12 Miguel de Icaza <miguel@ximian.com>
9847 * support.cs (InternalParameters.ParameterType): Return the
9848 ExternalType of the parameter.
9850 * parameter.cs (Parameter.ExternalType): drop the two arguments,
9853 2003-05-11 Miguel de Icaza <miguel@ximian.com>
9855 * class.cs (MethodData.Define): Do not set the `newslot' on
9856 interface members, if they are also flagged as "override".
9858 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
9859 better code for ++i and i++. This only works for static fields
9860 and local variables.
9862 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
9863 want to pull the DeclSpace out of the builder_to_declspace instead
9864 of the TypeBuilder (like in TypeContainer.FindMembers).
9866 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
9867 instead of LookupTypeContainer. Fixes the crash on .NET for
9868 looking up interface members.
9870 * const.cs: Create our own emit context during the Definition
9871 stage, so that constants are evaluated in the proper context, when
9872 a recursive definition happens.
9874 2003-05-11 Martin Baulig <martin@ximian.com>
9876 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
9877 new block for a switch section.
9878 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
9879 the adding/lookup in the switch block. Fixes #39828.
9881 2003-05-09 Miguel de Icaza <miguel@ximian.com>
9883 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
9884 functionality: I needed to convert the data after I had performed
9885 the add/sub operation into the operands type size.
9887 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
9888 pass the type for the box operation, otherwise the resulting
9889 object would have been of type object.
9891 (BoxedCast): Add constructor to specify the type to box as.
9893 2003-05-07 Miguel de Icaza <miguel@ximian.com>
9895 * iterators.cs: I was reusing the `count' variable inadvertently,
9896 take steps to not allow this to happen.
9898 2003-05-06 Miguel de Icaza <miguel@ximian.com>
9900 * attribute.cs (Attribute.Resolve): Params attributes are encoded
9901 by creating an array at the point where the params starts and
9902 putting all those arguments there, then adjusting the size of the
9905 2003-05-05 Miguel de Icaza <miguel@ximian.com>
9907 * expression.cs (New.AddressOf): Implement interface
9908 IMemoryLocation. This is used when the `new' operator is used in
9909 the context of an invocation to a method on a value type.
9911 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
9914 * namespace.cs: Also check the using aliases here.
9916 * driver.cs: Move the test for using validity after the types have
9917 been entered, so we do a single pass that also includes the using
9920 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
9921 in the regular case. CreateSiblingForFinally is doing extra
9924 * attribute.cs (GetAttributeArgumentExpression): Store the result
9925 on an out value, and use the return value to indicate failure
9926 instead of using null (which is a valid return for Constant.GetValue).
9928 * statement.cs: Perform the analysis flow for the increment
9929 portion after the statement, because this will be the real flow of
9930 execution. Fixes #42385
9932 * codegen.cs (EmitContext.EmitArgument,
9933 EmitContext.EmitStoreArgument): New helper functions when the
9934 RemapToProxy flag is set.
9936 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
9939 Add support for remapping parameters.
9941 * iterators.cs: Propagate parameter values; Store parameter
9942 values in the proxy classes.
9944 2003-05-04 Miguel de Icaza <miguel@ximian.com>
9946 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
9947 need a proxy reference; I do not know what I was thinking
9949 * cs-parser.jay (constructor_initializer): catch another error,
9950 and display nice message.
9952 (field_declaration): catch void field declaration
9953 to flag a better error.
9955 * class.cs (MemberBase.CheckBase): Report an error instead of a
9956 warning if a new protected member is declared in a struct.
9957 (Field.Define): catch the error of readonly/volatile.
9959 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
9961 (FieldExpr.AddressOf): ditto. Catch error where the address of a
9962 volatile variable is taken
9964 2003-05-02 Miguel de Icaza <miguel@ximian.com>
9966 * statement.cs (Fixed.Resolve): Report an error if we are not in
9969 2003-05-01 Miguel de Icaza <miguel@ximian.com>
9971 * typemanager.cs: reuse the code that handles type clashes for
9972 delegates and enumerations.
9974 * class.cs (Report28): Always report.
9976 * expression.cs (EncodeAsAttribute): Allow nulls here.
9978 2003-04-28 Miguel de Icaza <miguel@ximian.com>
9980 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
9981 the functionality for testing whether an expression is valid for
9982 an attribute here. Also handle the case of arrays of elements
9985 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
9986 encoding a linear array into an array of objects that are suitable
9987 to be passed to an CustomAttributeBuilder.
9989 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
9991 * ecore.cs: (FieldExpr): Handle field remapping here.
9993 * iteratators.cs: Pass the instance variable (if the method is an
9994 instance method) to the constructors, so we can access the field
9995 variables on the class.
9997 TODO: Test this with structs. I think the THIS variable on
9998 structs might have to be a pointer, and not a refenrece
10000 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10002 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10003 local variables to fields in a proxy class.
10005 * iterators.cs (PopulateProxy): Rename our internal fields to
10007 Create a <THIS> field if we are an instance method, so we can
10008 reference our parent container variables.
10009 (MapVariable): Called back from the EmitContext code to enter a
10010 new variable to field mapping into the proxy class (we just create
10014 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10015 for using the remapped locals to fields.
10017 I placed the code here, because that gives the same semantics to
10018 local variables, and only changes the Emit code.
10020 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10021 statements inside iterators.
10022 (VariableInfo): Add a FieldBuilder for the cases when we are
10023 remapping local variables to fields in a proxy class
10025 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10026 current_block != null.
10028 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10029 not cope with strings, as it has been moved to the
10030 TableSwitchEmit. Fixed bug in switch generation.
10032 * expression.cs (New.DoResolve): Provide more context for the user
10033 when reporting an error.
10035 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10038 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10039 check the permissions for it. Note than in a type-resolution
10040 context the check was already present in DeclSpace.ResolveType,
10041 but was missing from the MemberAccess.
10043 (ArrayCreation.CheckIndices): warn if the user has
10044 more nested levels of expressions, but there are no more
10045 dimensions specified. Avoids crash on bug 41906.
10047 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10049 * statement.cs (Block): replace Implicit bool, for a generic
10051 New flag: `Unchecked'. This is used during the EmitMeta phase
10052 (which is out-of-line with the regular Resolve/Emit process for a
10053 statement, as this is done ahead of time, but still gets a chance
10054 to call constant resolve).
10056 (Block.Flags): new enum for adding a new flag.
10058 (Block.EmitMeta): track the state of unchecked.
10060 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10061 to enable constant resolution to work there as well.
10063 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10065 * typemanager.cs (ienumerable_type): Also look up
10066 System.Collections.IEnumerable.
10068 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10070 TODO: Test more than one conditional per method.
10072 * class.cs (Indexer.Define): Report the location where the user is
10073 referencing the unsupported feature.
10075 (MethodData): Overload the use of `conditionals' to
10076 minimize the creation of needless ArrayLists. This saves roughly
10077 212kb on my machine.
10079 (Method): Implement the new IIteratorContainer interface.
10080 (Method.SetYields): Implement the method by setting the ModFlags
10081 to contain METHOD_YIELDS.
10083 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10084 which just got set to null.
10086 * iterators.cs: New file.
10088 (Yield, YieldBreak): New statements.
10090 * statement.cs (Return.Resolve): Flag an error if we are used in
10091 an iterator method.
10093 * codegen.cs (InIterator): New flag set if the code is being
10094 compiled in an iterator method.
10096 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10097 internal modifier, and we just use it to avoid adding extra
10098 fields, as this is seldom used.
10100 * cs-parser.jay: Add yield_statement (yield and yield break).
10102 * driver.cs: New flag -v2 to turn on version 2 features.
10104 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10105 hashtable when v2 is enabled.
10107 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10109 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10110 there is already a namespace defined with this name.
10112 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10113 people upgraded their corlibs.
10115 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10116 always use fully qualified types, no need to use the compiler
10119 (TypeManager.IsNamespace): Use binarysearch.
10121 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10122 AddDelegate): I did not quite use the new IsValid API properly: I
10123 have to pass the short-name and the fullname. I was passing only
10124 the basename instead of the fullname sometimes.
10126 (TypeContainer.DefineType): call NamespaceClash.
10128 * interface.cs (Interface.DefineType): use NamespaceClash before
10131 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10134 * enum.cs: (Enum.DefineType): use NamespaceClash before
10137 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10138 speed increase. First, use the negative_hits cache when we get a
10139 negative. Second, add the type with its full original name
10140 instead of the new . and + encoded name (reflection uses + to
10141 separate type from a nested type). Use LookupTypeReflection
10142 directly which bypasses the type->name hashtable (that we already
10143 know does not contain the type.
10145 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10146 location/container type.
10148 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10150 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10152 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10154 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10155 method is being referenced in the method group from a static
10156 context, and report error 120 if so.
10158 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10161 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10162 is created, we create the A namespace).
10164 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10167 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10169 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10170 invocation to ModuleBuilder.GetType with the same values will
10171 return a new type instance, so we need to cache its return
10174 * expression.cs (Binary.ResolveOperator): Only allow the compare
10175 operators on enums if they are of the same type.
10177 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10178 types of ValueType on their own case. Before we were giving them
10179 the same treatment as objects.
10181 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10182 fullname. Short name is used to compare against container name.
10183 Fullname is used to check against defined namespace names.
10185 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10186 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10188 (Method.CheckBase): Call parent.
10189 (MemberBase.CheckBase): Check for protected members on sealed
10191 (PropertyBase.CheckBase): Call parent.
10192 (Field.Define): Call parent.
10194 * report.cs: Negative error codes are now mapped to 8000 - code,
10195 so that the display is render more nicely.
10197 * typemanager.cs: Do not use try/catch, instead report a regular
10200 (GetPointerType, GetReferenceType): These methods provide
10201 mechanisms to obtain the T* and T& from a T. We had the code
10202 previously scattered around the code base, and it also used
10203 TypeManager.LookupType that would go through plenty of caches.
10204 This one goes directly to the type source.
10206 In some places we did the Type.GetType followed by
10207 ModuleBuilder.GetType, but not in others, so this unifies the
10208 processing as well.
10210 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10211 statements now that we have namespace information.
10213 * typemanager.cs (IsNamespace): New method, returns whether the
10214 string presented is a namespace or not.
10216 (ComputeNamespaces): New public entry point, computes the list of
10217 available namespaces, using the GetNamespaces API call in Mono, or
10218 the slower version in MS.NET.
10220 Now before we start the semantic analysis phase, we have a
10221 complete list of namespaces including everything that the user has
10224 Deleted old code to cache namespaces in .nsc files.
10226 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10228 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10229 class/struct location definition Location for the implicit
10230 constructor location.
10232 (Operator.Define): Use the location of the operator for the
10233 implicit Method definition.
10235 (Constructor.Emit): use the constructor location for the implicit
10236 base initializer constructor.
10238 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10239 and the Expression class now contains two new methods:
10241 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10242 isolate type lookup from the rest of the resolution process.
10244 Since we use Expressions to hold type definitions due to the way
10245 we parse the input we have historically overloaded Resolve to
10246 perform the Type lookups if a special flag is passed. Now this is
10247 eliminated and two methods take their place.
10249 The differences in the two methods between xStep and xTerminal is
10250 that xStep is involved in our current lookup system that uses
10251 SimpleNames to compose a name, while xTerminal is used just to
10252 catch the case where the simplename lookup failed.
10254 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10256 * expression.cs (ResolveMemberAccess): Remove redundant code.
10257 TypeExpr expressions are always born fully resolved.
10259 * interface.cs (PopulateMethod): Do not lookup the types twice.
10260 We were doing it once during SemanticAnalysis and once during
10263 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10264 in local variable type definitions, were being returned as a
10265 SimpleName (we decomposed everything into a string), that is
10266 because primary_expression was being used instead of a type in the
10267 grammar (reduce/reduce conflicts).
10269 The part that was wrong is that we converted the expression into a
10270 string (an oversimplification in one hand, compounded with primary
10271 expressions doing string concatenation).
10277 Would return "A.B.C[]" as a SimpleName. This stopped things like
10278 using clauses from working on this particular context. And a type
10279 was being matched directly against "A.B.C[]".
10281 We now use the correct approach, and allow for ComposedCast to be
10282 part of the unary expression. So the "A.B.C []" become a composed
10283 cast of "A.B.C" (as a nested group of MemberAccess with a
10284 SimpleName at the end) plus the rank composition "[]".
10288 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10290 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10291 for the access level checking.
10293 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10294 `TypeContainer container', because I kept getting confused when I
10295 was debugging this code.
10297 * expression.cs (Indexers): Instead of tracking getters/setters,
10298 we now track them in parallel. We create one arraylist less, but
10299 most importantly it is possible now for the LValue code to find a
10300 matching get for a set.
10302 (IndexerAccess.DoResolveLValue): Update the code.
10303 GetIndexersForType has been modified already to extract all the
10304 indexers from a type. The code assumed it did not.
10306 Also make the code set the correct return type for the indexer.
10307 This was fixed a long time ago for properties, but was missing for
10308 indexers. It used to be void_type.
10310 (Binary.Emit): Test first for doubles instead of
10311 floats, as they are more common.
10313 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10314 when dealing with floats and the <=, >= operators. This fixes bug
10317 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10318 to load the array value by emitting a load on the foreach variable
10319 type. This was incorrect.
10321 We now emit the code to load an element using the the array
10322 variable type, and then we emit the conversion operator.
10326 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10328 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10330 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10332 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10333 test for protection before we test for signatures.
10335 (MethodSignature.ToString): implement.
10337 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10338 to the case where we reduced into a LongConstant.
10340 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10341 depend on whether the information is acurrate, because the
10342 Microsoft runtime will always claim that the array type is public,
10343 regardless of the real state.
10345 If the type is a pointer, another problem happens: the type is
10346 reported as non-public in Microsoft.
10348 In both cases we have to call CheckAccessLevel recursively with
10349 the underlying type as the argument to be tested.
10351 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10353 * assign.cs (Assign.Emit): If we are dealing with a compound
10354 assignment expression, we should use the code path that stores the
10355 intermediate result in a temporary value. This fixes #40903.
10357 *expression.cs (Indirection.ToString): Provide ToString method for
10360 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10362 * class.cs: Null out fields holding references to Block objects so
10363 they can be garbage collected.
10365 * expression.cs (OverloadResolve): Remove unused local.
10367 2003-04-07 Martin Baulig <martin@ximian.com>
10369 * codegen.cs (EmitContext.CurrentFile): New public field.
10370 (EmitContext.Mark): Use the CurrentFile to check whether the
10371 location is in the correct file.
10372 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10374 2003-04-07 Martin Baulig <martin@ximian.com>
10376 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10378 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10379 location. [FIXME: The location argument which gets passed to this
10380 method is sometimes wrong!]
10382 2003-04-07 Nick Drochak <ndrochak@gol.com>
10384 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10386 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10388 * expression.cs (Indirection.EmitAssign): We were using the
10389 temporary, but returning immediately instead of continuing the
10392 2003-04-06 Martin Baulig <martin@ximian.com>
10394 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10395 if it's a nested child, but also deriving from the outer class.
10398 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10399 nested child, but also deriving from the outer class. See
10401 (FilterWithClosure): We may access private members of the outer
10402 class if we're a nested child and deriving from the outer class.
10403 (RealMemberLookup): Only set `closure_private_ok' if the
10404 `original_bf' contained BindingFlags.NonPublic.
10406 2003-04-05 Martin Baulig <martin@ximian.com>
10408 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
10410 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10412 * class.cs (Event.Define): Do not allow abstract events to have
10415 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10417 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10418 block in event declarations.
10420 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10421 value type, get its address.
10423 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10424 leaving a class on the stack instead of a boolean value (int
10425 0/1). Change the code so we compare against null, and then the
10426 result against zero.
10428 * class.cs (TypeContainer.GetClassBases): We were checking for the
10429 parent class being sealed too late.
10431 * expression.cs (Binary.Emit): For <= and >= when dealing with
10432 floating point values, use cgt.un and clt.un instead of cgt and
10435 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10437 * statement.cs: Apply the same optimization as MS: skip the
10438 GetEnumerator returning an IEnumerator, and use the one returning a
10439 CharEnumerator instead. This allows us to avoid the try-finally block
10442 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
10444 * cs-parser.jay: Attributes cannot be applied to
10445 namespaces. Fixes #40473
10447 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10450 (Add*): check if the name is valid using the full name for constants,
10451 fields, properties and events.
10453 2003-03-28 Miguel de Icaza <miguel@ximian.com>
10455 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
10456 char constants to be part of the enumeration.
10458 * expression.cs (Conditional.DoResolve): Add support for operator
10459 true. Implements the missing functionality from 14.12
10461 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
10462 operator true/false as required by the spec.
10464 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
10465 implicit conversion to boolean.
10467 * statement.cs (Statement.ResolveBoolean): A boolean expression is
10468 also one where the type implements `operator true'.
10470 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10471 get an expression that will invoke operator true based on an
10474 (GetConversionOperators): Removed the hack that called op_True
10477 (Expression.ResolveBoolean): Move this from Statement.
10479 2003-03-17 Miguel de Icaza <miguel@ximian.com>
10481 * ecore.cs (FieldExpr): do not allow initialization of initonly
10482 fields on derived classes
10484 2003-03-13 Martin Baulig <martin@ximian.com>
10486 * statement.cs (Block.Emit): Call ig.BeginScope() and
10487 ig.EndScope() when compiling with debugging info; call
10488 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
10490 2003-03-08 Miguel de Icaza <miguel@ximian.com>
10492 * expression.cs (Indexers): Do not construct immediately, allow
10493 for new members to be appended as we go. Fixes 38143
10495 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10497 * expression.cs: save/restore context when resolving an unchecked
10500 2003-03-05 Miguel de Icaza <miguel@ximian.com>
10502 * cfold.cs: Catch division by zero in modulus operator during
10505 2003-03-03 Miguel de Icaza <miguel@ximian.com>
10507 * interface.cs (Interface.DefineMembers): Avoid defining members
10510 2003-02-27 Miguel de Icaza <miguel@ximian.com>
10512 * driver.cs: handle the +/- options for -noconfig
10514 * statement.cs (Unckeched.Resolve): Also track the state of
10515 unchecked in the Resolve phase.
10517 2003-02-27 Martin Baulig <martin@ximian.com>
10519 * ecore.cs (Expression.MemberLookup): Don't create a
10520 MethodGroupExpr for something which is not a method. Fixes #38291.
10522 2003-02-25 Miguel de Icaza <miguel@ximian.com>
10524 * class.cs (MemberBase.CheckParameters): Also check that the type
10525 is unmanaged if it is a pointer.
10527 * expression.cs (SizeOf.Resolve): Add location information.
10529 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
10530 a managed type is declared.
10532 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
10533 parameter modifiers as well. Fixes bug 38606
10535 * class.cs: Very sad. Am backing out the speed up changes
10536 introduced by the ArrayList -> Array in the TypeContainer, as they
10537 were not actually that much faster, and introduced a bug (no error
10538 reports on duplicated methods).
10540 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
10541 source first, this will guarantee that we have a valid expression
10542 before calling in lower levels functions that will require a
10543 resolved object. Then use this original_source in the
10544 target.ResolveLValue instead of the original source that was
10547 Another change. Use target.Resolve instead of LValueResolve.
10548 Although we are resolving for LValues, we will let the Assign code
10549 take care of that (it will be called again from Resolve). This
10550 basically allows code like this:
10552 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
10553 class Y { void A (X x) { x [0] += o; }
10555 The problem was that the indexer was trying to resolve for
10556 set_Item (idx, object o) and never finding one. The real set_Item
10557 was set_Item (idx, X). By delaying the process we get the right
10562 2003-02-23 Martin Baulig <martin@ximian.com>
10564 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
10565 while calling DoEmit ().
10567 * codegen.cs (EmitContext.Mark): Don't mark locations in other
10568 source files; if you use the #line directive inside a method, the
10569 compiler stops emitting line numbers for the debugger until it
10570 reaches the end of the method or another #line directive which
10571 restores the original file.
10573 2003-02-23 Martin Baulig <martin@ximian.com>
10575 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
10577 2003-02-23 Martin Baulig <martin@ximian.com>
10579 * statement.cs (Block.AddChildVariableNames): We need to call this
10580 recursively, not just for our immediate children.
10582 2003-02-23 Martin Baulig <martin@ximian.com>
10584 * class.cs (Event.Define): Always make the field private, like csc does.
10586 * typemanager.cs (TypeManager.RealMemberLookup): Make events
10587 actually work, fixes bug #37521.
10589 2003-02-23 Miguel de Icaza <miguel@ximian.com>
10591 * delegate.cs: When creating the various temporary "Parameters"
10592 classes, make sure that we call the ComputeAndDefineParameterTypes
10593 on those new parameters (just like we do with the formal ones), to
10594 allow them to be resolved in the context of the DeclSpace.
10596 This fixes the bug that Dick observed in Bugzilla #38530.
10598 2003-02-22 Miguel de Icaza <miguel@ximian.com>
10600 * expression.cs (ResolveMemberAccess): When resolving a constant,
10601 do not attempt to pull a constant if the value was not able to
10602 generate a valid constant.
10604 * const.cs (LookupConstantValue): Do not report more errors than required.
10606 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10608 * expression.cs: fixes bug #38328.
10610 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10612 * class.cs: Changed all the various members that can be part of a
10613 class from being an ArrayList to be an Array of the right type.
10614 During the DefineType type_list, interface_list, delegate_list and
10615 enum_list are turned into types, interfaces, delegates and enums
10618 And during the member population, indexer_list, event_list,
10619 constant_list, field_list, instance_constructor_list, method_list,
10620 operator_list and property_list are turned into their real arrays.
10622 Although we could probably perform this operation earlier, for
10623 good error reporting we need to keep the lists and remove the
10624 lists for longer than required.
10626 This optimization was triggered by Paolo profiling the compiler
10627 speed on the output of `gen-sample-program.pl' perl script.
10629 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
10630 not crash in methods like MemberLookupFailed that use this field.
10632 This problem arises when the compiler fails to resolve a type
10633 during interface type definition for example.
10635 2003-02-18 Miguel de Icaza <miguel@ximian.com>
10637 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
10638 inherit from System.Object, so we have to stop at null, not only
10639 when reaching System.Object.
10641 2003-02-17 Miguel de Icaza <miguel@ximian.com>
10643 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
10644 DeclaredOnly because the parent indexer might have had a different
10645 name, but did not loop until the top of the hierarchy was reached.
10647 The problem this one fixes is 35492: when a class implemented an
10648 indexer from an interface, we were getting the interface method
10649 (which was abstract) and we were flagging an error (can not invoke
10652 This also keeps bug 33089 functioning, and test-148 functioning.
10654 * typemanager.cs (IsSpecialMethod): The correct way of figuring
10655 out if a method is special is to see if it is declared in a
10656 property or event, or whether it is one of the predefined operator
10657 names. This should fix correctly #36804.
10659 2003-02-15 Miguel de Icaza <miguel@ximian.com>
10661 The goal here is to remove the dependency on EmptyCast.Peel ().
10662 Killing it completely.
10664 The problem is that currently in a number of places where
10665 constants are expected, we have to "probe" for an EmptyCast, and
10666 Peel, which is not the correct thing to do, as this will be
10667 repetitive and will likely lead to errors.
10669 The idea is to remove any EmptyCasts that are used in casts that
10670 can be reduced to constants, so we only have to cope with
10673 This bug hunt was triggered by Bug 37363 and the desire to remove
10674 the duplicate pattern where we were "peeling" emptycasts to check
10675 whether they were constants. Now constants will always be
10678 * ecore.cs: Use an enumconstant here instead of wrapping with
10681 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
10682 throwing me off. By handling this we can get rid of a few hacks.
10684 * statement.cs (Switch): Removed Peel() code.
10686 2003-02-14 Miguel de Icaza <miguel@ximian.com>
10688 * class.cs: Location information for error 508
10690 * expression.cs (New.DoResolve): Add a guard against double
10691 resolution of an expression.
10693 The New DoResolve might be called twice when initializing field
10694 expressions (see EmitFieldInitializers, the call to
10695 GetInitializerExpression will perform a resolve on the expression,
10696 and later the assign will trigger another resolution
10698 This leads to bugs (#37014)
10700 * delegate.cs: The signature for EndInvoke should contain any ref
10701 or out parameters as well. We were not doing this in the past.
10703 * class.cs (Field.Define): Do not overwrite the type definition
10704 inside the `volatile' group. Turns out that volatile enumerations
10705 were changing the type here to perform a validity test, which
10708 2003-02-12 Miguel de Icaza <miguel@ximian.com>
10710 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
10711 and structs, we do not want to load the instance variable
10713 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
10714 enum_type has to be handled like an object reference (implicit
10715 conversions exists from this to object), but the regular IsClass
10716 and IsValueType tests will never return true for this one.
10718 Also we use TypeManager.IsValueType instead of type.IsValueType,
10719 just for consistency with the rest of the code (this is only
10720 needed if we ever use the construct exposed by test-180.cs inside
10721 corlib, which we dont today).
10723 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
10725 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
10728 2003-02-09 Martin Baulig <martin@ximian.com>
10730 * namespace.cs (Namespace..ctor): Added SourceFile argument.
10731 (Namespace.DefineNamespaces): New static public method; this is
10732 called when we're compiling with debugging to add all namespaces
10733 to the symbol file.
10735 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
10736 pass it to the Namespace's .ctor.
10738 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
10739 and MethodBase arguments; pass the namespace ID to the symwriter;
10740 pass the MethodBase instead of the token to the symwriter.
10741 (SymbolWriter.DefineNamespace): New method to add a namespace to
10744 2003-02-09 Martin Baulig <martin@ximian.com>
10746 * symbolwriter.cs: New file. This is a wrapper around
10747 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
10748 methods here in near future.
10750 2003-02-09 Martin Baulig <martin@ximian.com>
10752 * codegen.cs (EmitContext.Mark): Just pass the arguments to
10753 ILGenerator.MarkSequencePoint() which are actually used by the
10756 2003-02-09 Martin Baulig <martin@ximian.com>
10758 * location.cs (SourceFile): New public sealed class. This
10759 contains the name and an index which is used in the location's token.
10760 (Location): Reserve an appropriate number of bits in the token for
10761 the source file instead of walking over that list, this gives us a
10762 really huge performance improvement when compiling with debugging.
10764 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
10765 `SourceFile' argument instead of a string.
10766 (Driver.ProcessFile): Add all the files via Location.AddFile(),
10767 but don't parse/tokenize here, we need to generate the list of all
10768 source files before we do that.
10769 (Driver.ProcessFiles): New static function. Parses/tokenizes all
10772 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
10773 instead of a string.
10775 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
10778 2003-02-09 Martin Baulig <martin@ximian.com>
10780 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
10781 filename on `#line default'.
10783 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
10785 * statement.cs: don't clear the pinned var when the fixed statement
10786 returns from the method (fixes bug#37752).
10788 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
10790 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
10793 2003-02-07 Martin Baulig <martin@ximian.com>
10795 * driver.cs: Removed the `--debug-args' command line argument.
10797 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
10798 automatically by the AsssemblyBuilder.
10799 (CodeGen.InitializeSymbolWriter): We don't need to call any
10800 initialization function on the symbol writer anymore. This method
10801 doesn't take any arguments.
10803 2003-02-03 Miguel de Icaza <miguel@ximian.com>
10805 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
10806 from referenced assemblies as well.
10808 2003-02-02 Martin Baulig <martin@ximian.com>
10810 * class.cs (MethodData.Emit): Generate debugging info for external methods.
10812 2003-02-02 Martin Baulig <martin@ximian.com>
10814 * class.cs (Constructor.Emit): Open the symbol writer before
10815 emitting the constructor initializer.
10816 (ConstructorInitializer.Emit): Call ec.Mark() to allow
10817 single-stepping through constructor initializers.
10819 2003-01-30 Miguel de Icaza <miguel@ximian.com>
10821 * class.cs: Handle error 549: do not allow virtual methods in
10824 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
10826 * decl.cs: Check access levels when resolving types
10828 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
10830 * statement.cs: Add parameters and locals set in catch blocks that might
10831 return to set vector
10833 2003-01-29 Miguel de Icaza <miguel@ximian.com>
10835 * class.cs (Operator): Set the SpecialName flags for operators.
10837 * expression.cs (Invocation.DoResolve): Only block calls to
10838 accessors and operators on SpecialName methods.
10840 (Cast.TryReduce): Handle conversions from char constants.
10843 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
10845 * statement.cs: small memory and time optimization in FlowBranching.
10847 2003-01-28 Pedro Mart <yoros@wanadoo.es>
10849 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
10850 problem that the last fix but in the other sid (Set).
10852 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
10853 access when there is no indexer in the hierarchy.
10855 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
10857 * class.cs: Combine some if statements.
10859 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10861 * driver.cs: fixed bug #37187.
10863 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
10865 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
10866 any indexer, it's needed to build a list with all the indexers in the
10867 hierarchy (AllGetters), else we have problems. Fixes #35653.
10869 2003-01-23 Miguel de Icaza <miguel@ximian.com>
10871 * class.cs (MethodData.Define): It is wrong for an interface
10872 implementation to be static in both cases: explicit and implicit.
10873 We were only handling this in one case.
10875 Improve the if situation there to not have negations.
10877 * class.cs (Field.Define): Turns out that we do not need to check
10878 the unsafe bit on field definition, only on usage. Remove the test.
10880 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10882 * driver.cs: use assembly.Location instead of Codebase (the latest
10883 patch made mcs fail when using MS assemblies).
10885 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
10887 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
10888 get the path to *corlib.dll.
10890 2003-01-21 Nick Drochak <ndrochak@gol.com>
10894 * typemanager.cs: Remove compiler warnings
10896 2003-01-20 Duncan Mak <duncan@ximian.com>
10898 * AssemblyInfo.cs: Bump the version number to 0.19.
10900 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10902 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
10904 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
10906 * class.cs (Constructor::Emit): Emit debugging info for constructors.
10908 2003-01-17 Miguel de Icaza <miguel@ximian.com>
10910 * cs-parser.jay: Small fix: we were not comparing the constructor
10911 name correctly. Thanks to Zoltan for the initial pointer.
10913 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
10915 * cs-tokenizer.cs: Set file name when specified with #line
10917 2003-01-15 Miguel de Icaza <miguel@ximian.com>
10919 * cs-parser.jay: Only perform the constructor checks here if we
10920 are named like the class; This will help provider a better
10921 error. The constructor path is taken when a type definition is
10922 not found, but most likely the user forgot to add the type, so
10923 report that rather than the constructor error.
10925 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
10927 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
10930 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10932 * cs-parser.jay: Add cleanup call.
10934 2003-01-13 Duncan Mak <duncan@ximian.com>
10936 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
10937 consistent with other methods.
10939 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10941 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
10943 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
10945 * attribute.cs: only set GuidAttr to true when we have a
10948 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10952 * typemanager.cs: fixes to allow mcs compile corlib with the new
10953 Type.IsSubclassOf fix.
10955 2003-01-08 Miguel de Icaza <miguel@ximian.com>
10957 * expression.cs (LocalVariableReference.DoResolve): Classify a
10958 constant as a value, not as a variable. Also, set the type for
10961 * cs-parser.jay (fixed_statement): take a type instead of a
10962 pointer_type, so we can produce a better error message later.
10964 * statement.cs (Fixed.Resolve): Flag types that are not pointers
10967 (For.DoEmit): Make inifinite loops have a
10968 non-conditional branch back.
10970 (Fixed.DoEmit): First populate the pinned variables, then emit the
10971 statement, then clear the variables. Before I was emitting the
10972 code once for each fixed piece.
10975 2003-01-08 Martin Baulig <martin@ximian.com>
10977 * statement.cs (FlowBranching.MergeChild): A break in a
10978 SWITCH_SECTION does not leave a loop. Fixes #36155.
10980 2003-01-08 Martin Baulig <martin@ximian.com>
10982 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
10983 lives in the same number space than `param_map'. Fixes #36154.
10985 2003-01-07 Miguel de Icaza <miguel@ximian.com>
10987 * cs-parser.jay (constructor_declaration): Set the
10988 Constructor.ModFlags before probing for it. This makes the
10989 compiler report 514, 515 and 132 (the code was there, but got
10992 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
10993 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
10994 (GotoCase.Resolve): Set `Returns' to ALWAYS.
10996 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
10998 * enum.cs: create the enum static fields using the enum type.
11000 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11002 * class.cs: don't try to create the ParamBuilder for the return
11003 type if it's not needed (and handle it breaking for the ms runtime
11006 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11008 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11010 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11012 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11013 the command. This showed up while compiling the JANET source
11014 code, which used \r as its only newline separator.
11016 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11018 * class.cs (Method.Define): If we are an operator (because it
11019 reuses our code), then set the SpecialName and HideBySig. #36128
11021 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11023 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11024 exception, report error 120 `object reference required'.
11026 * driver.cs: Add --pause option, used during to measure the size
11027 of the process as it goes with --timestamp.
11029 * expression.cs (Invocation.DoResolve): Do not allow methods with
11030 SpecialName to be invoked.
11032 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11034 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11035 number before adding it.
11037 2002-12-21 Ravi Pratap <ravi@ximian.com>
11039 * ecore.cs (StandardImplicitConversion): When in an unsafe
11040 context, we allow conversion between void * to any other pointer
11041 type. This fixes bug #35973.
11043 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11045 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11046 is not thrown when extensionless outputs are used
11048 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11050 * rootcontext.cs: fixed compilation of corlib.
11052 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11054 * attribute.cs (Attributes.Contains): Add new method.
11056 * class.cs (MethodCore.LabelParameters): if the parameter is an
11057 `out' parameter, check that no attribute `[In]' has been passed.
11059 * enum.cs: Handle the `value__' name in an enumeration.
11061 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11063 * decl.cs: Added special case to allow overrides on "protected
11066 2002-12-18 Ravi Pratap <ravi@ximian.com>
11068 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11069 since it makes much more sense.
11071 (Attributes.ctor): Don't require a Location parameter.
11073 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11075 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11076 since we already have that information per attribute.
11078 * everywhere : make appropriate changes.
11080 * class.cs (LabelParameters): Write the code which actually
11081 applies attributes to the return type. We can't do this on the MS
11082 .NET runtime so we flag a warning in the case an exception is
11085 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11087 * const.cs: Handle implicit null conversions here too.
11089 2002-12-17 Ravi Pratap <ravi@ximian.com>
11091 * class.cs (MethodCore.LabelParameters): Remove the extra
11092 Type [] parameter since it is completely unnecessary. Instead
11093 pass in the method's attributes so that we can extract
11094 the "return" attribute.
11096 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11098 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11099 of ignoring it and letting the compile continue.
11101 * typemanager.cs (ChangeType): use an extra argument to return an
11102 error condition instead of throwing an exception.
11104 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11106 * expression.cs (Unary.TryReduce): mimic the code for the regular
11107 code path. Perform an implicit cast in the cases where we can
11108 implicitly convert to one of the integral types, and then reduce
11109 based on that constant. This fixes bug #35483.
11111 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11113 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11115 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11117 * namespace.cs: fixed bug #35489.
11119 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11121 * class.cs: Remove some dead code.
11123 * cs-parser.jay: Estimate the number of methods needed
11124 (RootContext.MethodCount);
11126 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11127 numbers instead of StringBuilders.
11129 * support.cs (PtrHashtable): Add constructor with initial size;
11130 We can now reduce reallocations of the method table.
11132 2002-12-10 Ravi Pratap <ravi@ximian.com>
11134 * attribute.cs (ApplyAttributes): Keep track of the emitted
11135 attributes on a per-target basis. This fixes bug #35413.
11137 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11139 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11140 default to the Windows 1252 encoding.
11142 (UnixParseOption): Support version, thanks to Alp for the missing
11145 * AssemblyInfo.cs: Add nice assembly information.
11147 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11150 * cs-parser.jay: Allow a trailing comma before the close bracked
11151 in the attribute_section production.
11153 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11154 address of the instance was being taken, I will take this out,
11155 because we take the address of the object immediately here.
11157 2002-12-09 Ravi Pratap <ravi@ximian.com>
11159 * typemanager.cs (AreMultipleAllowed): Take care of the most
11160 obvious case where attribute type is not in the current assembly -
11163 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11165 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11166 definitions, instead of doing that afterwards.
11168 Also we use a nice little hack, depending on the constructor, we
11169 know if we are a "composed" name or a simple name. Hence, we
11170 avoid the IndexOf test, and we avoid
11172 * codegen.cs: Add code to assist in a bug reporter to track down
11173 the source of a compiler crash.
11175 2002-12-07 Ravi Pratap <ravi@ximian.com>
11177 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11178 types have been emitted for a given element and flag an error
11179 if something which does not have AllowMultiple set is used more
11182 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11183 attribute types and their corresponding AllowMultiple properties
11185 (AreMultipleAllowed): Check the property for a given type.
11187 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11188 property in the case we have a TypeContainer.
11190 (Attributes.AddAttribute): Detect duplicates and just skip on
11191 adding them. This trivial fix catches a pretty gross error in our
11192 attribute emission - global attributes were being emitted twice!
11194 Bugzilla bug #33187 is now fixed.
11196 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11198 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11199 instead of pp_and).
11201 * expression.cs (Binary.ResolveOperator): I can only use the
11202 Concat (string, string, string) and Concat (string, string,
11203 string, string) if the child is actually a concatenation of
11206 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11208 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11209 context where we need a 2-character lookahead.
11211 * pending.cs (PendingImplementation): Rework so we can keep track
11212 of interface types all the time, and flag those which were
11213 implemented by parents as optional.
11215 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11217 * expression.cs (Binary.ResolveOperator): Use
11218 String.Concat(string,string,string) or
11219 String.Concat(string,string,string,string) when possible.
11221 * typemanager: More helper methods.
11224 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11226 * pending.cs: remove the bogus return from GetMissingInterfaces()
11227 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11229 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11231 * namespace.cs: avoid duplicated 'using xxx' being added to
11232 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11233 when we get more than one 'using' statement for the same namespace.
11234 Report a CS0105 warning for it.
11236 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11238 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11239 of calling getChar/putback, uses internal knowledge of it.
11241 (xtoken): Reorder tokenizer so most common patterns are checked
11242 first. This reduces the compilation time in another 5% (from 8.11s
11243 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11245 The parsing time is 22% of the compilation in mcs, and from that
11246 64% is spent on the tokenization process.
11248 I tried using a binary search for keywords, but this is slower
11249 than the hashtable. Another option would be to do a couple of
11252 * Not use a StringBuilder, instead use an array of chars,
11253 with a set value. Notice that this way we could catch
11254 the 645 error without having to do it *afterwards*.
11256 * We could write a hand-parser to avoid the hashtable
11257 compares altogether.
11259 The identifier consumption process takes 37% of the tokenization
11260 time. Another 15% is spent on is_number. 56% of the time spent
11261 on is_number is spent on Int64.Parse:
11263 * We could probably choose based on the string length to
11264 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11267 Another 3% is spend on wrapping `xtoken' in the `token' function.
11269 Handle 0xa0 as whitespace (#34752)
11271 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11273 * typemanager.cs (IsCLRType): New routine to tell whether a type
11274 is one of the builtin types.
11276 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11277 typecode in more places instead of doing pointer comparissions.
11278 We could leverage some knowledge about the way the typecodes are
11281 New code to cache namespaces in assemblies, it is currently not
11282 invoked, to be used soon.
11284 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11286 * expression.cs (Binary.ResolveOperator): specially handle
11287 strings, and do not perform user-defined operator overloading for
11290 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11292 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11293 internalcall as it is a pretty simple operation; Avoid whenever
11294 possible to call Char.IsLetter.
11296 (consume_identifier): Cut by half the number of
11297 hashtable calls by merging the is_keyword and GetKeyword behavior.
11299 Do not short-circuit, because if we do, we
11300 report errors (ie, #if false && true would produce an invalid
11304 2002-11-24 Martin Baulig <martin@ximian.com>
11306 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11307 check constant ranges and report a CS0221. Fixes #33186.
11309 2002-11-24 Martin Baulig <martin@ximian.com>
11311 * cs-parser.jay: Make this work for uninitialized variable
11312 declarations in the `for' initializer. Fixes #32416.
11314 2002-11-24 Martin Baulig <martin@ximian.com>
11316 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11317 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11319 2002-11-24 Martin Baulig <martin@ximian.com>
11321 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11322 argument; if true, we also check for user-defined conversions.
11323 This is only needed if both arguments are of a user-defined type.
11324 Fixes #30443, added test-175.cs.
11325 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11327 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11329 2002-11-24 Martin Baulig <martin@ximian.com>
11331 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11332 function to get the store opcode.
11333 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11334 only emit the Ldelema if the store opcode is Stobj. You must run
11335 both test-34 and test-167 to test this. Fixes #34529.
11337 2002-11-23 Martin Baulig <martin@ximian.com>
11339 * ecore.cs (Expression.MemberLookup): Added additional
11340 `qualifier_type' argument which is used when we're being called
11341 from MemberAccess.DoResolve() and null if we're called from a
11343 (Expression.MemberLookupFailed): New method to report errors; this
11344 does the CS1540 check and reports the correct error message.
11346 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11347 argument for the CS1540 check and redone the way how we're dealing
11348 with private members. See the comment in the source code for details.
11349 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11350 `closure_start_type' to `closure_qualifier_type' and check whether
11351 it's not null. It was not this filter being broken, it was just
11352 being called with the wrong arguments.
11354 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11355 and pass it the correct `qualifier_type'; this also does the error
11358 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11360 * expression.cs (Invocation.EmitParams): If the we are dealing
11361 with a non-built-in value type, load its address as well.
11363 (ArrayCreation): Use a a pretty constant instead
11364 of the hardcoded value 2. Use 6 instead of 2 for the number of
11365 static initializers.
11367 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11368 because they are not really value types, just glorified integers.
11370 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11372 * ecore.cs: Remove redundant code for enumerations, make them use
11373 the same code path as everything else, fixes the casting issue
11374 with enumerations in Windows.Forms.
11376 * attribute.cs: Do only cast to string if it is a string, the
11377 validation happens later.
11379 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11380 people upgrade their corlibs.
11382 * ecore.cs: Oops, enumerations were not following the entire code path
11384 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11386 * typemanager.cs (FilterWithClosure): Commented out the test for
11387 1540 in typemanager.cs, as it has problems when accessing
11388 protected methods from a parent class (see test-174.cs).
11390 * attribute.cs (Attribute.ValidateGuid): new method.
11391 (Attribute.Resolve): Use above.
11393 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11395 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11397 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11398 handling for enumerations, as we only needed the TypeContainer
11399 functionality to begin with (this is required for the fix below to
11400 work for enums that reference constants in a container class for
11403 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11405 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11406 a valid TypeBuilder to perform lookups on.o
11408 * class.cs (InheritableMemberSignatureCompare): Use true in the
11409 call to GetGetMethod and GetSetMethod, because we are comparing
11410 the signature, and we need to get the methods *even* if they are
11413 (PropertyBase.CheckBase): ditto.
11415 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11416 GotoCase.Resolve): Use Peel on EmpytCasts.
11418 * ecore.cs (EmptyCast): drop child, add Peel method.
11420 2002-11-17 Martin Baulig <martin@ximian.com>
11422 * ecore.cs (EmptyCast.Child): New public property.
11424 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11425 label resolved to an EmptyCast. Fixes #34162.
11426 (GotoCase.Resolve): Likewise.
11427 (Block.EmitMeta): Likewise.
11429 2002-11-17 Martin Baulig <martin@ximian.com>
11431 * expression.cs (Invocation.BetterConversion): Prefer int over
11432 uint; short over ushort; long over ulong for integer literals.
11433 Use ImplicitConversionExists instead of StandardConversionExists
11434 since we also need to check for user-defined implicit conversions.
11435 Fixes #34165. Added test-173.cs.
11437 2002-11-16 Martin Baulig <martin@ximian.com>
11439 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11440 with the `true' and `false' literals. Fixes #33151.
11442 2002-11-16 Martin Baulig <martin@ximian.com>
11444 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
11445 October 22nd; don't do the cs1540 check for static members.
11447 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
11448 now using our own filter here and doing the cs1540 check again.
11450 2002-11-16 Martin Baulig <martin@ximian.com>
11452 * support.cs (InternalParameters): Don't crash if we don't have
11453 any fixed parameters. Fixes #33532.
11455 2002-11-16 Martin Baulig <martin@ximian.com>
11457 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
11458 when looking up static methods to make this work on Windows.
11461 2002-11-16 Martin Baulig <martin@ximian.com>
11463 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
11464 a setter rather than using PropertyInfo.CanWrite.
11466 2002-11-15 Nick Drochak <ndrochak@gol.com>
11468 * class.cs: Allow acces to block member by subclasses. Fixes build
11471 2002-11-14 Martin Baulig <martin@ximian.com>
11473 * class.cs (Constructor.Emit): Added the extern/block check.
11476 2002-11-14 Martin Baulig <martin@ximian.com>
11478 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
11479 iteration while looking for indexers, this is needed because the
11480 indexer may have a different name in our base classes. Fixed the
11481 error reporting (no indexers at all, not get accessor, no
11482 overloaded match). Fixes bug #33089.
11483 (IndexerAccess.DoResolveLValue): Likewise.
11485 2002-11-14 Martin Baulig <martin@ximian.com>
11487 * class.cs (PropertyBase.CheckBase): Make this work for multiple
11488 indexers. Fixes the first part of bug #33089.
11489 (MethodSignature.InheritableMemberSignatureCompare): Added support
11492 2002-11-13 Ravi Pratap <ravi@ximian.com>
11494 * attribute.cs (Attribute.Resolve): Catch the
11495 NullReferenceException and report it since it isn't supposed to
11498 2002-11-12 Miguel de Icaza <miguel@ximian.com>
11500 * expression.cs (Binary.EmitBranchable): Also handle the cases for
11501 LogicalOr and LogicalAnd that can benefit from recursively
11502 handling EmitBranchable. The code now should be nice for Paolo.
11504 2002-11-08 Miguel de Icaza <miguel@ximian.com>
11506 * typemanager.cs (LookupType): Added a negative-hit hashtable for
11507 the Type lookups, as we perform quite a number of lookups on
11508 non-Types. This can be removed once we can deterministically tell
11509 whether we have a type or a namespace in advance.
11511 But this might require special hacks from our corlib.
11515 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
11516 and double which avoids a conversion from an integer to a double.
11518 * expression.cs: tiny optimization, avoid calling IsConstant,
11519 because it effectively performs the lookup twice.
11521 2002-11-06 Miguel de Icaza <miguel@ximian.com>
11523 But a bogus return here to keep the semantics of the old code
11524 until the Mono runtime is fixed.
11526 * pending.cs (GetMissingInterfaces): New method used to remove all
11527 the interfaces that are already implemented by our parent
11528 classes from the list of pending methods.
11530 * interface.cs: Add checks for calls after ResolveTypeExpr.
11532 2002-11-05 Miguel de Icaza <miguel@ximian.com>
11534 * class.cs (Class.Emit): Report warning 67: event not used if the
11535 warning level is beyond 3.
11537 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
11538 being a NullLiteral.
11540 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
11543 * class.cs (TypeContainer.GetClassBases): Cover a missing code
11544 path that might fail if a type can not be resolved.
11546 * expression.cs (Binary.Emit): Emit unsigned versions of the
11549 * driver.cs: use error 5.
11551 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
11553 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
11555 2002-11-01 Miguel de Icaza <miguel@ximian.com>
11557 * cs-parser.jay (switch_section): A beautiful patch from Martin
11558 Baulig that fixed 33094.
11560 2002-10-31 Miguel de Icaza <miguel@ximian.com>
11562 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
11563 Check whether the base is abstract and report an error if so.
11565 * expression.cs (IndexerAccess.DoResolveLValue,
11566 IndexerAccess.DoResolve): ditto.
11568 (Invocation.DoResolve): ditto.
11570 (Invocation.FullMethodDesc): Improve the report string.
11572 * statement.cs (Block): Eliminate IsVariableDefined as it is
11573 basically just a wrapper for GetVariableInfo.
11575 * ecore.cs (SimpleName): Use new
11577 * support.cs (ReflectionParamter.ParameterType): We unwrap the
11578 type, as we return the actual parameter ref/unref state on a
11581 2002-10-30 Miguel de Icaza <miguel@ximian.com>
11583 * support.cs: Return proper flags REF/OUT fixing the previous
11586 * expression.cs: Reverted last patch, that was wrong. Is_ref is
11587 not used to mean `ref' but `ref or out' in ParameterReference
11589 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
11590 full type signature instead of calling TypeManger.CSharpName
11593 * support.cs (InternalParameters.ParameterDesc): Do not compare
11594 directly to the modflags, because REF/OUT will actually be bitsets
11597 * delegate.cs (VerifyMethod): Check also the modifiers.
11599 * cs-tokenizer.cs: Fix bug where floating point values with an
11600 exponent where a sign was missing was ignored.
11602 * driver.cs: Allow multiple assemblies to be specified in a single
11605 2002-10-28 Miguel de Icaza <miguel@ximian.com>
11607 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
11608 because identifiers after a parenthesis would end up in this kind
11609 of production, and we needed to desamiguate it for having casts
11612 (UserDefinedType *) xxx
11614 2002-10-24 Miguel de Icaza <miguel@ximian.com>
11616 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
11617 we should set on the Bindingflags.NonPublic, but not turn on
11618 private_ok. private_ok controls whether a Private member is
11619 returned (this is chekced on the filter routine), while the
11620 BindingFlags.NonPublic just controls whether private/protected
11621 will be allowed. This fixes the problem part of the problem of
11622 private properties being allowed to be used in derived classes.
11624 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
11625 so we can call the children DoResolveLValue method (this will
11626 properly signal errors on lvalue assignments to base properties)
11628 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
11629 getter are null, and we have a property info, we know that this
11630 happened because the lookup failed, so we report an error 122 for
11631 protection level violation.
11633 We also silently return if setter and getter are null in the
11634 resolve functions, this condition only happens if we have flagged
11635 the error before. This is the other half of the problem.
11637 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
11638 not have accessibility information, that is why we were returning
11639 true in the filter function in typemanager.cs.
11641 To properly report 122 (property is inaccessible because of its
11642 protection level) correctly, we report this error in ResolveAccess
11643 by failing if both the setter and the getter are lacking (ie, the
11646 DoResolve and DoLResolve have been modified to check for both
11647 setter/getter being null and returning silently, the reason being
11648 that I did not want to put the knowledge about this error in upper
11651 int old = Report.Errors;
11652 x = new PropertyExpr (...);
11653 if (old != Report.Errors)
11658 So the property expr is returned, but it is invalid, so the error
11659 will be flagged during the resolve process.
11661 * class.cs: Remove InheritablePropertySignatureCompare from the
11662 class, as we no longer depend on the property signature to compute
11663 whether it is possible to implement a method or not.
11665 The reason is that calling PropertyInfo.GetGetMethod will return
11666 null (in .NET, in Mono it works, and we should change this), in
11667 cases where the Get Method does not exist in that particular
11672 class X { public virtual int A { get { return 1; } } }
11674 class Z : Y { public override int A { get { return 2; } } }
11676 Would fail in Z because the parent (Y) would not have the property
11677 defined. So we avoid this completely now (because the alternative
11678 fix was ugly and slow), and we now depend exclusively on the
11681 (PropertyBase.CheckBase): Use a method-base mechanism to find our
11682 reference method, instead of using the property.
11684 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
11685 routines are gone now.
11687 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
11688 names, they were incorrectly named.
11690 * cs-tokenizer.cs: Return are more gentle token on failure.
11692 * pending.cs (PendingImplementation.InterfaceMethod): This routine
11693 had an out-of-sync index variable, which caused it to remove from
11694 the list of pending methods the wrong method sometimes.
11696 2002-10-22 Miguel de Icaza <miguel@ximian.com>
11698 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
11699 CanWrite, because those refer to this particular instance of the
11700 property, and do not take into account the fact that we can
11701 override single members of a property.
11703 Constructor requires an EmitContext. The resolution process does
11704 not happen here, but we need to compute the accessors before,
11705 because the resolution does not always happen for properties.
11707 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
11708 subclass, before we did not update this flag, but we did update
11711 (GetAccessors): Drop this routine, as it did not work in the
11712 presence of partially overwritten set/get methods.
11714 Notice that this broke the cs1540 detection, but that will require
11717 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11721 * driver.cs: issue a warning instead of an error if we don't support
11722 debugging for the platform. Also ignore a couple of errors that may
11723 arise when trying to write the symbols. Undo my previous patch.
11725 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11727 * driver.cs: ignore /debug switch except for Unix platforms.
11729 2002-10-23 Nick Drochak <ndrochak@gol.com>
11731 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
11733 2002-10-21 Miguel de Icaza <miguel@ximian.com>
11735 * driver.cs: Do not make mcs-debug conditional, so we do not break
11736 builds that use it.
11738 * statement.cs (UsageVector.MergeChildren): I would like Martin to
11739 review this patch. But basically after all the children variables
11740 have been merged, the value of "Breaks" was not being set to
11741 new_breaks for Switch blocks. I think that it should be set after
11742 it has executed. Currently I set this to the value of new_breaks,
11743 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
11744 conservative, but I do not understand this code very well.
11746 I did not break anything in the build, so that is good ;-)
11748 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
11750 2002-10-20 Mark Crichton <crichton@gimp.org>
11752 * cfold.cs: Fixed compile blocker. Really fixed it this time.
11754 2002-10-20 Nick Drochak <ndrochak@gol.com>
11756 * cfold.cs: Fixed compile blocker.
11758 2002-10-20 Miguel de Icaza <miguel@ximian.com>
11760 * driver.cs: I was chekcing the key, not the file.
11762 2002-10-19 Ravi Pratap <ravi@ximian.com>
11764 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
11765 message that we were generating - we just need to silently return
11768 2002-10-19 Miguel de Icaza <miguel@ximian.com>
11770 * class.cs (Event.Define): Change my previous commit, as this
11771 breaks the debugger. This is a temporary hack, as it seems like
11772 the compiler is generating events incorrectly to begin with.
11774 * expression.cs (Binary.ResolveOperator): Added support for
11775 "U operator - (E x, E y)"
11777 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
11780 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
11781 init-only variables, but this path did not take into account that
11782 there might be also instance readonly variables. Correct this
11785 This fixes bug 32253
11787 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
11790 * driver.cs: Change the extension for modules to `netmodule'
11792 * cs-parser.jay: Improved slightly the location tracking for
11793 the debugger symbols.
11795 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
11796 modifiers that were specified instead of the hardcoded value
11797 (FamAndAssem). This was basically ignoring the static modifier,
11798 and others. Fixes 32429.
11800 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
11801 fixed a bug in the process (32476)
11803 * expression.cs (ArrayAccess.EmitAssign): Patch from
11804 hwang_rob@yahoo.ca that fixes bug 31834.3
11806 2002-10-18 Miguel de Icaza <miguel@ximian.com>
11808 * driver.cs: Make the module extension .netmodule.
11810 2002-10-16 Miguel de Icaza <miguel@ximian.com>
11812 * driver.cs: Report an error if the resource file is not found
11813 instead of crashing.
11815 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
11816 false, like Emit does.
11818 2002-10-16 Nick Drochak <ndrochak@gol.com>
11820 * typemanager.cs: Remove unused private member. Also reported mcs
11821 bug to report this as a warning like csc.
11823 2002-10-15 Martin Baulig <martin@gnome.org>
11825 * statement.cs (Statement.Emit): Made this a virtual method; emits
11826 the line number info and calls DoEmit().
11827 (Statement.DoEmit): New protected abstract method, formerly knows
11828 as Statement.Emit().
11830 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
11832 2002-10-11 Miguel de Icaza <miguel@ximian.com>
11834 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
11835 have fixed a remaining problem: not every AddXXXX was adding a
11836 fully qualified name.
11838 Now everyone registers a fully qualified name in the DeclSpace as
11839 being defined instead of the partial name.
11841 Downsides: we are slower than we need to be due to the excess
11842 copies and the names being registered this way.
11844 The reason for this is that we currently depend (on the corlib
11845 bootstrap for instance) that types are fully qualified, because
11846 we dump all the types in the namespace, and we should really have
11847 types inserted into the proper namespace, so we can only store the
11848 basenames in the defined_names array.
11850 2002-10-10 Martin Baulig <martin@gnome.org>
11852 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
11853 from bug #31834, see the bug report for a testcase which is
11856 2002-10-10 Martin Baulig <martin@gnome.org>
11858 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
11859 flow analysis code for this.
11861 * statement.cs (Do, While, For): Tell the flow analysis code about
11863 (FlowBranching.UsageVector): Added support for infinite loops.
11864 (Block.Resolve): Moved the dead code elimination here and use flow
11867 2002-10-09 Miguel de Icaza <miguel@ximian.com>
11869 * class.cs (Field.Define): Catch cycles on struct type
11872 * typemanager.cs (IsUnmanagedtype): Do not recursively check
11873 fields if the fields are static. We only need to check instance
11876 * expression.cs (As.DoResolve): Test for reference type.
11878 * statement.cs (Using.ResolveExpression): Use
11879 ConvertImplicitRequired, not ConvertImplicit which reports an
11881 (Using.ResolveLocalVariableDecls): ditto.
11883 * expression.cs (Binary.ResolveOperator): Report errors in a few
11884 places where we had to.
11886 * typemanager.cs (IsUnmanagedtype): Finish implementation.
11888 2002-10-08 Miguel de Icaza <miguel@ximian.com>
11890 * expression.cs: Use StoreFromPtr instead of extracting the type
11891 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
11893 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
11894 an enumeration value to a System.Enum, but System.Enum is not a
11895 value type, but an class type, so we need to box.
11897 (Expression.ConvertExplicit): One codepath could return
11898 errors but not flag them. Fix this. Fixes #31853
11900 * parameter.cs (Resolve): Do not allow void as a parameter type.
11902 2002-10-06 Martin Baulig <martin@gnome.org>
11904 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
11905 if it's a class type and not a struct. Fixes #31815.
11907 2002-10-06 Martin Baulig <martin@gnome.org>
11909 * statement.cs: Reworked the flow analysis code a bit to make it
11910 usable for dead code elimination.
11912 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11914 * cs-parser.jay: allow empty source files. Fixes bug #31781.
11916 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11918 * expression.cs (ComposedCast.DoResolveType): A quick workaround
11919 to fix the test 165, will investigate deeper.
11921 2002-10-04 Martin Baulig <martin@gnome.org>
11923 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
11924 finally blocks actually work.
11925 (Try.Resolve): We don't need to create a sibling for `finally' if
11926 there is no finally block.
11928 2002-10-04 Martin Baulig <martin@gnome.org>
11930 * class.cs (Constructor.Define): The default accessibility for a
11931 non-default constructor is private, not public.
11933 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11935 * class.cs (Constructor): Make AllowedModifiers public, add
11938 * cs-parser.jay: Perform the modifiers test here, as the
11939 constructor for the Constructor class usually receives a zero
11940 because of the way we create it (first we create, later we
11941 customize, and we were never checking the modifiers).
11943 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
11944 is a version of LookupTypeReflection that includes the type-name
11945 cache. This can be used as a fast path for functions that know
11946 the fully qualified name and are only calling into *.GetType() to
11947 obtain a composed type.
11949 This is also used by TypeManager.LookupType during its type
11952 (LookupType): We now also track the real type name, as sometimes
11953 we can get a quey for the real type name from things like
11954 ComposedCast. This fixes bug 31422.
11956 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
11957 complete type fullname, it does not have to go through the type
11958 resolution system to obtain the composed version of the type (for
11959 obtaining arrays or pointers).
11961 (Conditional.Emit): Use the EmitBoolExpression to
11962 generate nicer code, as requested by Paolo.
11964 (ArrayCreation.CheckIndices): Use the patch from
11965 hwang_rob@yahoo.ca to validate the array initializers.
11967 2002-10-03 Miguel de Icaza <miguel@ximian.com>
11969 * class.cs (ConstructorInitializer.Emit): simplify code by using
11970 Invocation.EmitCall, and at the same time, fix the bugs in calling
11971 parent constructors that took variable arguments.
11973 * ecore.cs (Expression.ConvertNumericExplicit,
11974 Expression.ImplicitNumericConversion): Remove the code that
11975 manually wrapped decimal (InternalTypeConstructor call is now gone
11978 * expression.cs (Cast.TryReduce): Also handle decimal types when
11979 trying to perform a constant fold on the type.
11981 * typemanager.cs (IsUnmanagedtype): Partially implemented.
11983 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
11984 that only turned off an error report, and did nothing else.
11986 2002-10-02 Miguel de Icaza <miguel@ximian.com>
11988 * driver.cs: Handle and ignore /fullpaths
11990 2002-10-01 Miguel de Icaza <miguel@ximian.com>
11992 * expression.cs (Binary.ResolveOperator): Catch the case where
11993 DoNumericPromotions returns true,
11995 (Binary.DoNumericPromotions): Simplify the code, and the tests.
11997 2002-09-27 Miguel de Icaza <miguel@ximian.com>
11999 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12002 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12004 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12005 conversion exists, but it is also required that the conversion be
12006 performed. This manifested in "(Type64Enum) 2".
12008 * class.cs (TypeManager.AddMethod): The fix is not to change
12009 AddEnum, because that one was using a fully qualified name (every
12010 DeclSpace derivative does), but to change the AddMethod routine
12011 that was using an un-namespaced name. This now correctly reports
12012 the duplicated name.
12014 Revert patch until I can properly fix it. The issue
12015 is that we have a shared Type space across all namespaces
12016 currently, which is wrong.
12018 Options include making the Namespace a DeclSpace, and merge
12019 current_namespace/current_container in the parser.
12021 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12023 * cs-parser.jay: Improve error reporting when we get a different
12024 kind of expression in local_variable_type and
12025 local_variable_pointer_type.
12027 Propagate this to avoid missleading errors being reported.
12029 * ecore.cs (ImplicitReferenceConversion): treat
12030 TypeManager.value_type as a target just like object_type. As
12035 Is valid, and needs to result in the int 1 being boxed before it
12036 is assigned to the value type v.
12038 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12039 to validate the enumeration name.
12041 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12042 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12043 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12045 * ecore.cs (TryImplicitIntConversion): When doing an
12046 implicit-enumeration-conversion, check if the type is 64-bits and
12047 perform a conversion before passing to EnumConstant.
12049 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12051 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12052 report ambiguous type references. Unlike the MS version, we
12053 report what the ambiguity is. Innovation at work ;-)
12055 (DeclSpace.FindType): Require a location argument to
12056 display when we display an ambiguous error.
12058 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12060 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12062 * expression.cs (EmitDynamicInitializers): Apply patch from
12063 hwang_rob@yahoo.ca that fixes the order in which we emit our
12066 2002-09-21 Martin Baulig <martin@gnome.org>
12068 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12069 delegate takes no arguments.
12071 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12073 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12076 * expression.cs: Extract the underlying type.
12078 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12080 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12082 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12084 * class.cs (TypeContainer.DefineType): We can not use the nice
12085 PackingSize with the size set to 1 DefineType method, because it
12086 will not allow us to define the interfaces that the struct
12089 This completes the fixing of bug 27287
12091 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12092 means also structs. This fixes part of the problem.
12093 (Expresion.ImplicitReferenceConversionExists): ditto.
12095 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12096 error if there were no errors reported during the type lookup
12097 process, to avoid duplicates or redundant errors. Without this
12098 you would get an ambiguous errors plus a type not found. We have
12099 beaten the user enough with the first error.
12101 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12104 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12105 during the resolution process, stop the lookup, this avoids
12106 repeated error reports (same error twice).
12108 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12110 * typemanager.cs (LookupType): Redo the type lookup code to match
12111 the needs of System.Reflection.
12113 The issue is that System.Reflection requires references to nested
12114 types to begin with a "+" sign instead of a dot. So toplevel
12115 types look like: "NameSpace.TopLevelClass", and nested ones look
12116 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12119 2002-09-19 Martin Baulig <martin@gnome.org>
12121 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12122 says that a method always returns or always throws an exception,
12123 don't report the CS0161.
12125 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12126 set `Returns = new_returns'.
12128 2002-09-19 Martin Baulig <martin@gnome.org>
12130 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12131 to an enum constant, check for a CS0176.
12133 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12135 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12136 for operators that must be in pairs and report errors.
12138 * ecore.cs (SimpleName.DoResolveType): During the initial type
12139 resolution process, when we define types recursively, we must
12140 check first for types in our current scope before we perform
12141 lookups in the enclosing scopes.
12143 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12145 (Invocation.VerifyArgumentsCompat): Call
12146 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12147 I thought we were supposed to always call this, but there are a
12148 few places in the code where we dont do it.
12150 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12152 * driver.cs: Add support in -linkres and -resource to specify the
12153 name of the identifier.
12155 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12157 * ecore.cs (StandardConversionExists): Sync with the conversion
12158 code: allow anything-* to void* conversions.
12160 (FindMostSpecificSource): Use an Expression argument
12161 instead of a Type, because we might be handed over a Literal which
12162 gets a few more implicit conversions that plain types do not. So
12163 this information was being lost.
12165 Also, we drop the temporary type-holder expression when not
12168 2002-09-17 Martin Baulig <martin@gnome.org>
12170 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12171 this is an explicit interface implementation.
12173 2002-09-17 Martin Baulig <martin@gnome.org>
12175 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12176 different `IndexerName' attributes.
12178 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12179 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12180 virtual CommonResolve().
12182 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12184 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12185 and convert that to the UnderlyingType.
12187 * statement.cs (Foreach.Resolve): Indexers are just like variables
12188 or PropertyAccesses.
12190 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12191 inside quoted strings, we were not doing this before.
12193 2002-09-16 Martin Baulig <martin@gnome.org>
12195 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12196 resolve it. This is needed for the definite assignment check of the
12197 instance expression, fixes bug #29846.
12198 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12200 2002-09-16 Nick Drochak <ndrochak@gol.com>
12202 * parameter.cs: Fix compile error. Cannot reference static member
12203 from an instance object. Is this an mcs bug?
12205 2002-09-14 Martin Baulig <martin@gnome.org>
12207 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12208 multiple times. Fixes bug #30295, added test-166.cs.
12210 2002-09-14 Martin Baulig <martin@gnome.org>
12212 * statement.cs (Block.Emit): Don't emit unreachable code.
12213 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12214 `break' statements.
12215 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12217 2002-09-14 Martin Baulig <martin@gnome.org>
12219 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12222 2002-09-14 Martin Baulig <martin@gnome.org>
12224 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12225 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12226 be false on the ms runtime.
12228 2002-09-13 Martin Baulig <martin@gnome.org>
12230 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12231 the CS0038 error message.
12233 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12235 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12236 constant inside, return it.
12238 2002-09-12 Martin Baulig <martin@gnome.org>
12240 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12241 implicit conversion can be done between enum types.
12243 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12244 check whether an implicit conversion to the current enum's UnderlyingType
12245 exists and report an error if not.
12247 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12248 without debugging support.
12250 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12251 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12253 2002-09-12 Martin Baulig <martin@gnome.org>
12255 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12257 * ecore.cs (IMemberExpr.DeclaringType): New property.
12258 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12259 nonstatic member of an outer type (CS0038).
12261 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12263 * driver.cs: Activate the using-error detector at warning level
12264 4 (at least for MS-compatible APIs).
12266 * namespace.cs (VerifyUsing): Small buglett fix.
12268 * pending.cs (PendingImplementation): pass the container pointer.
12270 * interface.cs (GetMethods): Allow for recursive definition. Long
12271 term, I would like to move every type to support recursive
12272 definitions, not the current ordering mechanism that we have right
12275 The situation is this: Attributes are handled before interfaces,
12276 so we can apply attributes to interfaces. But some attributes
12277 implement interfaces, we will now handle the simple cases
12278 (recursive definitions will just get an error).
12280 * parameter.cs: Only invalidate types at the end if we fail to
12283 2002-09-09 Martin Baulig <martin@gnome.org>
12285 * ecore.cs (PropertyExpr.Emit): Also check for
12286 TypeManager.system_int_array_get_length so this'll also work when
12287 compiling corlib. Fixes #30003.
12289 2002-09-09 Martin Baulig <martin@gnome.org>
12291 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12292 and throw an exception if we can't get the type's size. Fixed #30040,
12295 2002-09-09 Martin Baulig <martin@gnome.org>
12297 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12299 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12300 context. Fixes bug #30027.
12302 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12303 virtual functions. Fixes bug #30043, added test-164.cs.
12305 2002-09-08 Ravi Pratap <ravi@ximian.com>
12307 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12309 2002-09-08 Nick Drochak <ndrochak@gol.com>
12311 * driver.cs: Use an object to get the windows codepage since it's not a
12314 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12316 * statement.cs (For.Emit): for infinite loops (test == null)
12317 return whether there is a break inside, not always "true".
12319 * namespace.cs (UsingEntry): New struct to hold the name of the
12320 using definition, the location where it is defined, and whether it
12321 has been used in a successful type lookup.
12323 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12328 2002-09-06 Ravi Pratap <ravi@ximian.com>
12330 * attribute.cs : Fix incorrect code which relied on catching
12331 a NullReferenceException to detect a null being passed in
12332 where an object was expected.
12334 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12336 * statement.cs (Try): flag the catch variable as assigned
12338 * expression.cs (Cast): Simplified by using ResolveType instead of
12339 manually resolving.
12341 * statement.cs (Catch): Fix bug by using ResolveType.
12343 2002-09-06 Ravi Pratap <ravi@ximian.com>
12345 * expression.cs (BetterConversion): Special case for when we have
12346 a NullLiteral as the argument and we have to choose between string
12347 and object types - we choose string the way csc does.
12349 * attribute.cs (Attribute.Resolve): Catch the
12350 NullReferenceException and report error #182 since the Mono
12351 runtime no more has the bug and having this exception raised means
12352 we tried to select a constructor which takes an object and is
12355 2002-09-05 Ravi Pratap <ravi@ximian.com>
12357 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12358 message (1502, 1503) when we can't locate a method after overload
12359 resolution. This is much more informative and closes the bug
12362 * interface.cs (PopulateMethod): Return if there are no argument
12363 types. Fixes a NullReferenceException bug.
12365 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12366 expressions too. Previously we were checking only in one place for
12367 positional arguments leaving out named arguments.
12369 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12370 type to the enum type is not allowed. Remove code corresponding to
12373 (ConvertNumericExplicit): Allow explicit conversions from
12374 the underlying type to enum type. This precisely follows the spec
12375 and closes a bug filed by Gonzalo.
12377 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12380 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12382 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12384 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12385 it was important that we stored the right value after the
12386 reduction in `converted'.
12388 2002-09-04 Martin Baulig <martin@gnome.org>
12390 * location.cs (Location.SymbolDocument): Use full pathnames for the
12393 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12395 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12396 of the expression resolve mechanism, because that will catch the
12397 SimpleName error failures.
12399 (Conditional): If we can not resolve the
12400 expression, return, do not crash.
12402 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12405 (location): display token name instead of its number.
12407 2002-08-28 Martin Baulig <martin@gnome.org>
12409 * expression.cs (Binary.ResolveOperator): Don't silently return
12410 but return an error if an operator cannot be applied between two
12413 2002-08-28 Martin Baulig <martin@gnome.org>
12415 * class.cs (Constructor.Define): Set the permission attributes
12416 correctly instead of making all constructors public.
12418 2002-08-28 Martin Baulig <martin@gnome.org>
12420 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12421 for private members before reporting a CS0103; if we find anything,
12424 2002-08-28 Martin Baulig <martin@gnome.org>
12426 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12427 to check whether `closure_start_type == closure_invocation_type',
12428 we also need to check whether `m.DeclaringType == closure_invocation_type'
12429 before bypassing the permission checks. We might be accessing
12430 protected/private members from the base class.
12431 (TypeManager.RealMemberLookup): Only set private_ok if private
12432 members were requested via BindingFlags.NonPublic.
12434 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12436 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12437 MethodGroupExpr.IsExplicitImpl if appropriate.
12438 (Invocation.DoResolve): Don't report the CS0120 for explicit
12439 interface implementations.
12441 2002-08-27 Martin Baulig <martin@gnome.org>
12443 * expression.cs (Invocation.DoResolve): If this is a static
12444 method and we don't have an InstanceExpression, we must report
12447 2002-08-25 Martin Baulig <martin@gnome.org>
12449 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
12450 `==' between a valuetype and an object.
12452 2002-08-25 Miguel de Icaza <miguel@ximian.com>
12454 * ecore.cs (TypeExpr): Provide a ToString method.
12456 2002-08-24 Martin Baulig <martin@gnome.org>
12458 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
12459 now called proggie.dbg and it's a binary file.
12461 2002-08-23 Martin Baulig <martin@gnome.org>
12463 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
12465 2002-08-23 Martin Baulig <martin@gnome.org>
12467 * struct.cs (MyStructInfo.ctor): Make this work with empty
12468 structs; it's not allowed to use foreach() on null.
12470 2002-08-23 Martin Baulig <martin@gnome.org>
12472 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
12473 writer the full pathname of the generated assembly.
12475 2002-08-23 Martin Baulig <martin@gnome.org>
12477 * statements.cs (FlowBranching.UsageVector.MergeChildren):
12478 A `finally' block never returns or breaks; improved handling of
12481 2002-08-23 Martin Baulig <martin@gnome.org>
12483 * statement.cs (Throw.Resolve): Allow `throw null'.
12485 2002-08-23 Martin Baulig <martin@gnome.org>
12487 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
12488 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
12489 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
12490 MemberLookup would return a wrong event if this is an explicit
12491 interface implementation and the class has an event with the same
12494 2002-08-23 Martin Baulig <martin@gnome.org>
12496 * statement.cs (Block.AddChildVariableNames): New public method.
12497 (Block.AddChildVariableName): Likewise.
12498 (Block.IsVariableNameUsedInChildBlock): Likewise.
12499 (Block.AddVariable): Check whether a variable name has already
12500 been used in a child block.
12502 * cs-parser.jay (declare_local_variables): Mark all variable names
12503 from the current block as being used in a child block in the
12506 2002-08-23 Martin Baulig <martin@gnome.org>
12508 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
12509 find the symbol writer.
12511 * driver.cs: csc also allows the arguments to /define being
12512 separated by commas, not only by semicolons.
12514 2002-08-23 Martin Baulig <martin@gnome.org>
12516 * interface.cs (Interface.GetMembers): Added static check for events.
12518 2002-08-15 Martin Baulig <martin@gnome.org>
12520 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
12521 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
12523 * ecore.cs (Expression.MemberLookup): Added documentation and explained
12524 why the MethodData.EmitDestructor() change was necessary.
12526 2002-08-20 Martin Baulig <martin@gnome.org>
12528 * class.cs (TypeContainer.FindMembers): Added static check for events.
12530 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
12532 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
12533 use Type.GetEvents(), not Type.FindMembers().
12535 2002-08-20 Martin Baulig <martin@gnome.org>
12537 * decl.cs (MemberCache): Added a special method cache which will
12538 be used for method-only searched. This ensures that a method
12539 search will return a MethodInfo with the correct ReflectedType for
12542 2002-08-20 Martin Baulig <martin@gnome.org>
12544 * decl.cs (DeclSpace.FindMembers): Made this public.
12546 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12548 * delegate.cs: fixed build on windows.
12549 [FIXME: Filed as bug #29150: MCS must report these errors.]
12551 2002-08-19 Ravi Pratap <ravi@ximian.com>
12553 * ecore.cs (StandardConversionExists): Return a false
12554 if we are trying to convert the void type to anything else
12555 since that is not allowed.
12557 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
12558 we flag error 70 in the event an event is trying to be accessed
12559 directly from outside the declaring type.
12561 2002-08-20 Martin Baulig <martin@gnome.org>
12563 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
12564 MemberCache from typemanager.cs to decl.cs.
12566 2002-08-19 Martin Baulig <martin@gnome.org>
12568 * class.cs (TypeContainer): Implement IMemberContainer.
12569 (TypeContainer.DefineMembers): Create the MemberCache.
12570 (TypeContainer.FindMembers): Do better BindingFlags checking; only
12571 return public members if BindingFlags.Public was given, check
12572 whether members are static.
12574 2002-08-16 Martin Baulig <martin@gnome.org>
12576 * decl.cs (DeclSpace.Define): Splitted this in Define and
12577 DefineMembers. DefineMembers is called first and initializes the
12580 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
12581 DefineMembers() on all our DeclSpaces.
12583 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
12584 but call DefineMembers() on all nested interfaces. We call their
12585 Define() in our new Define() function.
12587 * interface.cs (Interface): Implement IMemberContainer.
12588 (Interface.Define): Moved all code except the attribute stuf to
12590 (Interface.DefineMembers): Initialize the member cache.
12592 * typemanager.cs (IMemberFinder): Removed this interface, we don't
12593 need this anymore since we can use MemberCache.FindMembers directly.
12595 2002-08-19 Martin Baulig <martin@gnome.org>
12597 * typemanager.cs (MemberCache): When creating the cache for an
12598 interface type, add all inherited members.
12599 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
12600 to `out bool used_cache' and documented it.
12601 (TypeManager.MemberLookup): If we already used the cache in the first
12602 iteration, we don't need to do the interfaces check.
12604 2002-08-19 Martin Baulig <martin@gnome.org>
12606 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
12607 here from IMemberFinder and don't implement this interface anymore.
12608 (DeclSpace.MemberCache): Moved here from IMemberFinder.
12610 * typemanager.cs (IMemberFinder): This interface is now only used by
12611 classes which actually support the member cache.
12612 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
12613 since we only put DeclSpaces into this Hashtable.
12614 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
12615 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
12617 2002-08-16 Martin Baulig <martin@gnome.org>
12619 * typemanager.cs (ICachingMemberFinder): Removed.
12620 (IMemberFinder.MemberCache): New property.
12621 (TypeManager.FindMembers): Merged this with RealFindMembers().
12622 This function will never be called from TypeManager.MemberLookup()
12623 so we can't use the cache here, just the IMemberFinder.
12624 (TypeManager.MemberLookup_FindMembers): Check whether the
12625 IMemberFinder has a MemberCache and call the cache's FindMembers
12627 (MemberCache): Rewrote larger parts of this yet another time and
12628 cleaned it up a bit.
12630 2002-08-15 Miguel de Icaza <miguel@ximian.com>
12632 * driver.cs (LoadArgs): Support quoting.
12634 (Usage): Show the CSC-like command line arguments.
12636 Improved a few error messages.
12638 2002-08-15 Martin Baulig <martin@gnome.org>
12640 * typemanager.cs (IMemberContainer.Type): New property.
12641 (IMemberContainer.IsInterface): New property.
12643 The following changes are conditional to BROKEN_RUNTIME, which is
12644 defined at the top of the file.
12646 * typemanager.cs (MemberCache.MemberCache): Don't add the base
12647 class'es members, but add all members from TypeHandle.ObjectType
12648 if we're an interface.
12649 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
12650 is the current type.
12651 (MemberCache.CacheEntry.Container): Removed this field.
12652 (TypeHandle.GetMembers): Include inherited members.
12654 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12656 * typemanager.cs: fixed compilation and added a comment on a field that
12659 2002-08-15 Martin Baulig <martin@gnome.org>
12661 * class.cs (ConstructorInitializer.Resolve): In the
12662 Expression.MemberLookup call, use the queried_type as
12665 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
12666 declared' attribute, it's always true.
12667 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
12668 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
12669 temporary wrapper for FindMembers which tells MemberLookup whether
12670 members from the base classes are included in the return value.
12671 This will go away soon.
12672 (TypeManager.MemberLookup): Use this temporary hack here; once the
12673 new MemberCache is completed, we don't need to do the DeclaredOnly
12674 looping here anymore since the MemberCache will take care of this.
12675 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
12676 (MemberCache): When creating the MemberCache for a class, get
12677 members from the current class and all its base classes.
12678 (MemberCache.CacheEntry.Container): New field. This is a
12679 temporary hack until the Mono runtime is fixed to distinguish
12680 between ReflectedType and DeclaringType. It allows us to use MCS
12681 with both the MS runtime and the unfixed Mono runtime without
12682 problems and without accecting performance.
12683 (MemberCache.SearchMembers): The DeclaredOnly looping from
12684 TypeManager.MemberLookup is now done here.
12686 2002-08-14 Martin Baulig <martin@gnome.org>
12688 * statement.cs (MyStructInfo.MyStructInfo): Don't call
12689 Type.GetFields on dynamic types but get the fields from the
12690 corresponding TypeContainer.
12691 (MyStructInfo.GetStructInfo): Added check for enum types.
12693 * typemanager.cs (MemberList.IsSynchronized): Implemented.
12694 (MemberList.SyncRoot): Implemented.
12695 (TypeManager.FilterWithClosure): No need to check permissions if
12696 closure_start_type == closure_invocation_type, don't crash if
12697 closure_invocation_type is null.
12699 2002-08-13 Martin Baulig <martin@gnome.org>
12701 Rewrote TypeContainer.FindMembers to use a member cache. This
12702 gives us a speed increase of about 35% for the self-hosting MCS
12703 build and of about 15-20% for the class libs (both on GNU/Linux).
12705 * report.cs (Timer): New class to get enhanced profiling. This
12706 whole class is "TIMER" conditional since it remarkably slows down
12709 * class.cs (MemberList): New class. This is an IList wrapper
12710 which we're now using instead of passing MemberInfo[]'s around to
12711 avoid copying this array unnecessarily.
12712 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
12713 (ICachingMemberFinder, IMemberContainer): New interface.
12714 (TypeManager.FilterWithClosure): If `criteria' is null, the name
12715 has already been checked, otherwise use it for the name comparision.
12716 (TypeManager.FindMembers): Renamed to RealMemberFinder and
12717 provided wrapper which tries to use ICachingMemberFinder.FindMembers
12718 if possible. Returns a MemberList, not a MemberInfo [].
12719 (TypeHandle): New class, implements IMemberContainer. We create
12720 one instance of this class per type, it contains a MemberCache
12721 which is used to do the member lookups.
12722 (MemberCache): New class. Each instance of this class contains
12723 all members of a type and a name-based hash table.
12724 (MemberCache.FindMembers): This is our new member lookup
12725 function. First, it looks up all members of the requested name in
12726 the hash table. Then, it walks this list and sorts out all
12727 applicable members and returns them.
12729 2002-08-13 Martin Baulig <martin@gnome.org>
12731 In addition to a nice code cleanup, this gives us a performance
12732 increase of about 1.4% on GNU/Linux - not much, but it's already
12733 half a second for the self-hosting MCS compilation.
12735 * typemanager.cs (IMemberFinder): New interface. It is used by
12736 TypeManager.FindMembers to call FindMembers on a TypeContainer,
12737 Enum, Delegate or Interface.
12738 (TypeManager.finder_to_member_finder): New PtrHashtable.
12739 (TypeManager.finder_to_container): Removed.
12740 (TypeManager.finder_to_delegate): Removed.
12741 (TypeManager.finder_to_interface): Removed.
12742 (TypeManager.finder_to_enum): Removed.
12744 * interface.cs (Interface): Implement IMemberFinder.
12746 * delegate.cs (Delegate): Implement IMemberFinder.
12748 * enum.cs (Enum): Implement IMemberFinder.
12750 * class.cs (TypeContainer): Implement IMemberFinder.
12752 2002-08-12 Martin Baulig <martin@gnome.org>
12754 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
12756 2002-08-12 Martin Baulig <martin@gnome.org>
12758 * ecore.cs (ITypeExpression): New interface for expressions which
12760 (TypeExpression): Renamed to TypeLookupExpression.
12761 (Expression.DoResolve): If we're doing a types-only lookup, the
12762 expression must implement the ITypeExpression interface and we
12763 call DoResolveType() on it.
12764 (SimpleName): Implement the new ITypeExpression interface.
12765 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
12766 hack, the situation that we're only looking up types can't happen
12767 anymore when this method is called. Moved the type lookup code to
12768 DoResolveType() and call it.
12769 (SimpleName.DoResolveType): This ITypeExpression interface method
12770 is now doing the types-only lookup.
12771 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
12772 (ResolveFlags): Added MaskExprClass.
12774 * expression.cs (MemberAccess): Implement the ITypeExpression
12776 (MemberAccess.DoResolve): Added support for a types-only lookup
12777 when we're called via ITypeExpression.DoResolveType().
12778 (ComposedCast): Implement the ITypeExpression interface.
12780 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
12781 Expression.Resolve() with ResolveFlags.Type instead.
12783 2002-08-12 Martin Baulig <martin@gnome.org>
12785 * interface.cs (Interface.Define): Apply attributes.
12787 * attribute.cs (Attribute.ApplyAttributes): Added support for
12788 interface attributes.
12790 2002-08-11 Martin Baulig <martin@gnome.org>
12792 * statement.cs (Block.Emit): Only check the "this" variable if we
12793 do not always throw an exception.
12795 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
12796 whether the property has a set accessor.
12798 2002-08-11 Martin Baulig <martin@gnome.org>
12800 Added control flow analysis support for structs.
12802 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
12803 with control flow analysis turned off.
12804 (IVariable): New interface.
12805 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
12806 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
12807 (FieldExpr.DoResolve): Resolve the instance expression with flow
12808 analysis turned off and do the definite assignment check after the
12809 resolving when we know what the expression will resolve to.
12811 * expression.cs (LocalVariableReference, ParameterReference):
12812 Implement the new IVariable interface, only call the flow analysis
12813 code if ec.DoFlowAnalysis is true.
12814 (This): Added constructor which takes a Block argument. Implement
12815 the new IVariable interface.
12816 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
12817 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
12818 This does the definite assignment checks for struct members.
12820 * class.cs (Constructor.Emit): If this is a non-static `struct'
12821 constructor which doesn't have any initializer, call
12822 Block.AddThisVariable() to tell the flow analysis code that all
12823 struct elements must be initialized before control returns from
12826 * statement.cs (MyStructInfo): New public class.
12827 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
12828 argument to this indexer. If non-zero, check an individual struct
12829 member, not the whole struct.
12830 (FlowBranching.CheckOutParameters): Check struct members.
12831 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
12832 overloaded versions of these methods which take an additional
12833 `int field_idx' argument to check struct members.
12834 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
12835 overloaded versions of these methods which take an additional
12836 `string field_name' argument to check struct member.s
12837 (VariableInfo): Implement the IVariable interface.
12838 (VariableInfo.StructInfo): New public property. Returns the
12839 MyStructInfo instance of the variable if it's a struct or null.
12840 (Block.AddThisVariable): New public method. This is called from
12841 Constructor.Emit() for non-static `struct' constructor which do
12842 not have any initializer. It creates a special variable for the
12843 "this" instance variable which will be checked by the flow
12844 analysis code to ensure that all of the struct's fields are
12845 initialized before control returns from the constructor.
12846 (UsageVector): Added support for struct members. If a
12847 variable/parameter is a struct with N members, we reserve a slot
12848 in the usage vector for each member. A struct is considered fully
12849 initialized if either the struct itself (slot 0) or all its
12850 members are initialized.
12852 2002-08-08 Martin Baulig <martin@gnome.org>
12854 * driver.cs (Driver.MainDriver): Only report an error CS5001
12855 if there were no compilation errors.
12857 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
12858 `UnsafeContext' property to determine whether the parent is in
12859 unsafe context rather than checking the parent's ModFlags:
12860 classes nested in an unsafe class are unsafe as well.
12862 2002-08-08 Martin Baulig <martin@gnome.org>
12864 * statement.cs (UsageVector.MergeChildren): Distinguish between
12865 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
12866 we return. Added test17() and test18() to test-154.cs.
12868 2002-08-08 Martin Baulig <martin@gnome.org>
12870 * typemanager.cs (TypeManager.FilterWithClosure): If we have
12871 Family access, make sure the invoking type isn't a subclass of the
12872 queried type (that'd be a CS1540).
12874 * ecore.cs (Expression.MemberLookup): Added overloaded version of
12875 this method which takes an additional `Type invocation_type'.
12877 * expression.cs (BaseAccess.DoResolve): Use the base type as
12878 invocation and query type.
12879 (MemberAccess.DoResolve): If the lookup failed and we're about to
12880 report a CS0122, try a lookup with the ec.ContainerType - if this
12881 succeeds, we must report a CS1540.
12883 2002-08-08 Martin Baulig <martin@gnome.org>
12885 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
12886 (MethodGroupExpr): Implement the IMemberExpr interface.
12888 * expression (MemberAccess.ResolveMemberAccess): No need to have
12889 any special code for MethodGroupExprs anymore, they're now
12892 2002-08-08 Martin Baulig <martin@gnome.org>
12894 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
12895 Family, FamANDAssem and FamORAssem permissions.
12896 (TypeManager.IsSubclassOrNestedChildOf): New public method.
12898 2002-08-08 Martin Baulig <martin@gnome.org>
12900 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
12901 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
12904 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
12906 * driver.cs: implemented /resource option to embed managed resources.
12908 2002-08-07 Martin Baulig <martin@gnome.org>
12910 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
12911 (FieldBase.HasFieldInitializer): New public property.
12912 (FieldBase.GetInitializerExpression): New public method. Resolves and
12913 returns the field initializer and makes sure it is only resolved once.
12914 (TypeContainer.EmitFieldInitializers): Call
12915 FieldBase.GetInitializerExpression to get the initializer, this ensures
12916 that it isn't resolved multiple times.
12918 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
12919 the resolving process (SimpleName/MemberLookup) that we're currently
12920 emitting a field initializer (which must not access any instance members,
12921 this is an error CS0236).
12923 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
12924 argument, if the `IsFieldInitializer' flag is set, we must report and
12925 error CS0236 and not an error CS0120.
12927 2002-08-07 Martin Baulig <martin@gnome.org>
12929 * ecore.cs (IMemberExpr): New public interface.
12930 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
12931 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
12932 if the expression is an IMemberExpr.
12934 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
12935 to be null, implicitly default to `this' if we're non-static in
12936 this case. Simplified the code a lot by using the new IMemberExpr
12937 interface. Also fixed bug #28176 here.
12939 2002-08-06 Martin Baulig <martin@gnome.org>
12941 * cs-parser.jay (SimpleLookup): Removed. We need to create
12942 ParameterReferences during semantic analysis so that we can do a
12943 type-only search when resolving Cast, TypeOf and SizeOf.
12944 (block): Pass the `current_local_parameters' to the Block's
12947 * class.cs (ConstructorInitializer): Added `Parameters parameters'
12948 argument to the constructor.
12949 (ConstructorInitializer.Resolve): Create a temporary implicit
12950 block with the parameters.
12952 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
12953 references here if we aren't doing a type-only search.
12955 * statement.cs (Block): Added constructor which takes a
12956 `Parameters parameters' argument.
12957 (Block.Parameters): New public property.
12959 * support.cs (InternalParameters.Parameters): Renamed `parameters'
12960 to `Parameters' and made it public readonly.
12962 2002-08-06 Martin Baulig <martin@gnome.org>
12964 * ecore.cs (Expression.Warning): Made this public as well.
12966 * report.cs (Report.Debug): Print the contents of collections.
12968 2002-08-06 Martin Baulig <martin@gnome.org>
12970 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
12971 used to tell Resolve() which kinds of expressions it may return.
12972 (Expression.Resolve): Added overloaded version of this method which
12973 takes a `ResolveFlags flags' argument. This can be used to tell
12974 Resolve() which kinds of expressions it may return. Reports a
12976 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
12977 ResolveFlags.SimpleName.
12978 (Expression.Error118): Added overloaded version of this method which
12979 takes a `ResolveFlags flags' argument. It uses the flags to determine
12980 which kinds of expressions are allowed.
12982 * expression.cs (Argument.ResolveMethodGroup): New public method.
12983 Resolves an argument, but allows a MethodGroup to be returned.
12984 This is used when invoking a delegate.
12986 * TODO: Updated a bit.
12988 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12990 Fixed compilation with csc.
12992 * ecore.cs: Expression.Error made public. Is this correct? Should
12993 Warning be made public too?
12995 * expression.cs: use ea.Location instead of ea.loc.
12996 [FIXME: Filed as bug #28607: MCS must report these errors.]
12998 2002-08-06 Martin Baulig <martin@gnome.org>
13000 * ecore.cs (Expression.loc): Moved the location here instead of
13001 duplicating it in all derived classes.
13002 (Expression.Location): New public property.
13003 (Expression.Error, Expression.Warning): Made them non-static and
13004 removed the location argument.
13005 (Expression.Warning): Added overloaded version which takes an
13006 `int level' argument.
13007 (Expression.Error118): Make this non-static and removed the
13008 expression and location arguments.
13009 (TypeExpr): Added location argument to the constructor.
13011 * expression.cs (StaticCallExpr): Added location argument to
13013 (Indirection, PointerArithmetic): Likewise.
13014 (CheckedExpr, UnCheckedExpr): Likewise.
13015 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13016 (StringPtr): Likewise.
13019 2002-08-05 Martin Baulig <martin@gnome.org>
13021 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13023 * assign.cs (Assign.DoResolve): Check whether the source
13024 expression is a value or variable.
13026 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13027 while resolving the corresponding blocks.
13029 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13030 an error, don't silently return null.
13032 * statement.cs (Block.AddVariable): Do the error reporting here
13033 and distinguish between CS0128 and CS0136.
13034 (Block.DoResolve): Report all unused labels (warning CS0164).
13035 (LabeledStatement): Pass the location to the constructor.
13036 (LabeledStatement.HasBeenReferenced): New property.
13037 (LabeledStatement.Resolve): Set it to true here.
13039 * statement.cs (Return.Emit): Return success even after reporting
13040 a type mismatch error (CS0126 or CS0127), this is what csc does and
13041 it avoids confusing the users with any consecutive errors.
13043 2002-08-05 Martin Baulig <martin@gnome.org>
13045 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13047 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13049 * expression.cs (MemberAccess.DoResolve): Silently return if an
13050 error has already been reported.
13052 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13053 error has already been reported.
13055 2002-08-05 Martin Baulig <martin@gnome.org>
13057 * statement.cs (UsageVector): Only initialize the `parameters'
13058 vector if we actually have any "out" parameters.
13060 2002-08-05 Martin Baulig <martin@gnome.org>
13062 * expression.cs (Binary.ResolveOperator): When combining delegates,
13063 they must have the same type.
13065 2002-08-05 Martin Baulig <martin@gnome.org>
13067 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13068 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13069 work with the ms runtime and we also don't need it: if we're a
13070 PropertyBuilder and not in the `indexer_arguments' hash, then we
13071 are a property and not an indexer.
13073 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13074 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13075 since the latter one doesn't work with the ms runtime.
13077 2002-08-03 Martin Baulig <martin@gnome.org>
13079 Fixed bugs #27998 and #22735.
13081 * class.cs (Method.IsOperator): New public field.
13082 (Method.CheckBase): Report CS0111 if there's already a method
13083 with the same parameters in the current class. Report CS0508 when
13084 attempting to change the return type of an inherited method.
13085 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13086 and it's not marked abstract or extern.
13087 (PropertyBase): New abstract base class for Property and Indexer.
13088 (PropertyBase.CheckBase): Moved here from Property and made it work
13090 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13091 the same so we can reuse it there.
13092 (Property, Indexer): Derive from PropertyBase.
13093 (MethodSignature.inheritable_property_signature_filter): New delegate
13094 to find properties and indexers.
13096 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13097 argument and improved error reporting.
13099 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13100 EmptyReadOnlyParameters and made it a property.
13102 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13103 version of this method which takes a `PropertyInfo indexer'.
13104 (TypeManager.RegisterIndexer): New method.
13106 * class.cs: Added myself as author of this file :-)
13108 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13110 * class.cs: fixed compilation on windoze.
13112 2002-08-03 Martin Baulig <martin@gnome.org>
13114 * interface.cs (Interface.GetInterfaceBases): Check whether all
13115 base interfaces are at least as accessible than the current one.
13117 * class.cs (TypeContainer.GetClassBases): Check whether base types
13118 are at least as accessible than the current type.
13119 (TypeContainer.AsAccessible): Implemented and made non-static.
13120 (MemberBase.CheckParameters): Report errors if the accessibility
13123 * delegate.cs (Delegate.Delegate): The default visibility is
13124 internal for top-level types and private for nested types.
13125 (Delegate.Define): Report errors if the accessibility checks fail.
13127 * enum.cs (Enum.Enum): The default visibility is internal for
13128 top-level types and private for nested types.
13129 (Enum.DefineType): Compute the correct visibility.
13131 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13132 function which takes a `bool is_toplevel' instead of a TypeContainer.
13134 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13137 2002-08-02 Martin Baulig <martin@gnome.org>
13139 * expression.cs (LocalVariableReferenc): Added constructor which
13140 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13141 (LocalVariableReference.IsReadOnly): New property.
13142 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13143 variable is readonly, use our own readonly flag to do this; you can
13144 use the new constructor to get a writable reference to a read-only
13147 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13148 reference to the local variable.
13150 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13152 * rootcontext.cs (ResolveCore): Also include System.Exception
13154 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13155 we reach an EmptyStatement.
13157 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13160 * expression.cs (Binary.ResolveOperator): Check error result in
13163 use brtrue/brfalse directly and avoid compares to null.
13165 2002-08-02 Martin Baulig <martin@gnome.org>
13167 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13168 Fixes bug #28407, added test-155.cs.
13170 2002-08-01 Martin Baulig <martin@gnome.org>
13172 * class.cs (Event.EmitDefaultMethod): Make this work with static
13173 events. Fixes #28311, added verify-3.cs.
13175 2002-08-01 Martin Baulig <martin@gnome.org>
13177 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13178 `is_disposable' fields.
13179 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13180 `hm.is_disposable' if we're using the collection pattern.
13181 (Foreach.EmitCollectionForeach): Use the correct type for the
13182 enumerator's local variable, only emit the try/finally block if
13183 necessary (fixes #27713).
13185 2002-08-01 Martin Baulig <martin@gnome.org>
13187 * ecore.cs (Expression.report118): Renamed to Error118 and made
13190 * statement.cs (Throw.Resolve): Check whether the expression is of
13191 the correct type (CS0118) and whether the type derives from
13192 System.Exception (CS0155).
13193 (Catch.Resolve): New method. Do the type lookup here and check
13194 whether it derives from System.Exception (CS0155).
13195 (Catch.CatchType, Catch.IsGeneral): New public properties.
13197 * typemanager.cs (TypeManager.exception_type): Added.
13199 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13201 * driver.cs: Updated About function.
13203 2002-07-31 Martin Baulig <martin@gnome.org>
13205 Implemented Control Flow Analysis.
13207 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13208 (EmitContext.CurrentBranching): Added.
13209 (EmitContext.StartFlowBranching): Added.
13210 (EmitContext.EndFlowBranching): Added.
13211 (EmitContext.KillFlowBranching): Added.
13212 (EmitContext.IsVariableAssigned): Added.
13213 (EmitContext.SetVariableAssigned): Added.
13214 (EmitContext.IsParameterAssigned): Added.
13215 (EmitContext.SetParameterAssigned): Added.
13216 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13217 Added control flow analysis stuff here.
13219 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13220 resolve the expression as lvalue.
13221 (LocalVariableReference.DoResolve): Check whether the variable has
13222 already been assigned.
13223 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13224 the parameter as assigned here.
13225 (ParameterReference.DoResolve): Check whether the parameter has already
13227 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13228 expression as lvalue.
13230 * statement.cs (FlowBranching): New class for the flow analysis code.
13231 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13232 (LabeledStatement.IsDefined): New public property.
13233 (LabeledStatement.AddUsageVector): New public method to tell flow
13234 analyis that the label may be reached via a forward jump.
13235 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13237 (VariableInfo.Number): New public field. This is used by flow analysis
13238 to number all locals of a block.
13239 (Block.CountVariables): New public property. This is the number of
13240 local variables in this block (including the locals from all parent
13242 (Block.EmitMeta): Number all the variables.
13244 * statement.cs: Added flow analysis support to all classes.
13246 2002-07-31 Martin Baulig <martin@gnome.org>
13248 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13249 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13250 then use this argument.
13252 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13254 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13255 use this to specify /define options.
13257 2002-07-29 Martin Baulig <martin@gnome.org>
13259 * statement.cs (Fixed): Moved all code that does variable lookups
13260 and resolvings from Emit to Resolve.
13262 * statement.cs (For): Moved all code that does variable lookups
13263 and resolvings from Emit to Resolve.
13265 * statement.cs (Using): Moved all code that does variable lookups
13266 and resolvings from Emit to Resolve.
13268 2002-07-29 Martin Baulig <martin@gnome.org>
13270 * attribute.cs (Attribute.Resolve): Explicitly catch a
13271 System.NullReferenceException when creating the
13272 CustromAttributeBuilder and report a different warning message.
13274 2002-07-29 Martin Baulig <martin@gnome.org>
13276 * support.cs (ParameterData.ParameterName): Added method to
13277 get the name of a parameter.
13279 * typemanager.cs (TypeManager.IsValueType): New public method.
13281 2002-07-29 Martin Baulig <martin@gnome.org>
13283 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13284 is a flag which specifies that it's either ref or out.
13285 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13286 the out parameter to `out Parameter.Modifier mod', also set the
13287 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13289 * support.cs (InternalParameters.ParameterModifier): Distinguish
13290 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13291 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13293 * expression.cs (Argument.GetParameterModifier): Distinguish
13294 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13295 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13297 2002-07-29 Martin Baulig <martin@gnome.org>
13299 * expression.cs (ParameterReference.ParameterReference): Added
13300 `Location loc' argument to the constructor.
13302 * cs-parser.jay: Pass location to ParameterReference.
13304 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13306 * statement.cs (Try): Initialize the location.
13308 * cs-parser.jay: pass location to Try.
13310 * expression.cs (Unary.Reduce): Change the prototype to return
13311 whether a constant fold could be performed or not. The result is
13312 returned in an out parameters. In the case of Indirection and
13313 AddressOf, we want to perform the full tests.
13315 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13317 * statement.cs (Statement.Emit): Flag dead code.
13319 2002-07-27 Andrew Birkett <andy@nobugs.org>
13321 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13323 2002-07-27 Martin Baulig <martin@gnome.org>
13325 * class.cs (MethodData.Define): Put back call to
13326 TypeManager.AddMethod(), accidentally commented this out.
13328 * report.cs (Debug): New public method to print debugging information,
13329 this is `[Conditional ("DEBUG")]'.
13331 2002-07-26 Martin Baulig <martin@gnome.org>
13333 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13334 (switch_statement): Push the current_block to the switch_stack and
13335 pop it again when we're done with the switch.
13336 (switch_section): The new block is a child of the current_block.
13337 Fixes bug #24007, added test-152.cs.
13339 2002-07-27 Martin Baulig <martin@gnome.org>
13341 * expression.cs (Invocation.EmitArguments): When calling a varargs
13342 function with only its fixed arguments, we need to pass an empty
13345 2002-07-27 Martin Baulig <martin@gnome.org>
13347 Mono 0.13 has been released.
13349 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13351 * driver.cs: Rename --resource to --linkres, because that is what
13352 we do currently, we dont support --resource yet.
13354 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13356 2002-07-25 Martin Baulig <martin@gnome.org>
13358 * class.cs (MethodData): New public class. This is a `method builder'
13359 class for a method or one accessor of a Property/Indexer/Event.
13360 (MethodData.GetMethodFlags): Moved here from MemberBase.
13361 (MethodData.ApplyAttributes): Likewise.
13362 (MethodData.ApplyObsoleteAttribute): Likewise.
13363 (MethodData.ApplyConditionalAttribute): Likewise.
13364 (MethodData.ApplyDllImportAttribute): Likewise.
13365 (MethodData.CheckAbstractAndExternal): Likewise.
13366 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13367 (MethodData.Emit): Formerly known as Method.Emit().
13368 (MemberBase): Moved everything which was specific to a single
13369 accessor/method to MethodData.
13370 (Method): Create a new MethodData and call Define() and Emit() on it.
13371 (Property, Indexer, Event): Create a new MethodData objects for each
13372 accessor and call Define() and Emit() on them.
13374 2002-07-25 Martin Baulig <martin@gnome.org>
13376 Made MethodCore derive from MemberBase to reuse the code from there.
13377 MemberBase now also checks for attributes.
13379 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13380 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13382 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13383 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13384 (MemberBase.ApplyAttributes): New virtual method; applies the
13385 attributes to a method or accessor.
13386 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13387 (MemberBase.ApplyConditionalAttribute): Likewise.
13388 (MemberBase.ApplyDllImportAttribute): Likewise.
13389 (MemberBase.CheckAbstractAndExternal): Likewise.
13390 (MethodCore.ParameterTypes): This is now a property instead of a
13391 method, it's initialized from DoDefineParameters().
13392 (MethodCore.ParameterInfo): Removed the set accessor.
13393 (MethodCore.DoDefineParameters): New protected virtual method to
13394 initialize ParameterTypes and ParameterInfo.
13395 (Method.GetReturnType): We can now simply return the MemberType.
13396 (Method.GetMethodFlags): Override the MemberBase version and add
13397 the conditional flags.
13398 (Method.CheckBase): Moved some code from Define() here, call
13399 DoDefineParameters() here.
13400 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13401 here to avoid some larger code duplication.
13402 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13403 ensure that abstract and external accessors don't declare a body.
13405 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13406 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13407 lookup in the attribute's parent classes, so we need to abort as soon
13408 as we found the first match.
13409 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13410 the attribute has no arguments.
13412 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13415 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13417 * cs-parser.jay: reverted previous patch.
13419 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13421 * cs-parser.jay: fixed bug #22119.
13423 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13425 * attribute.cs: fixed compilation. The error was:
13426 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13427 be assigned to before control leaves the current method."
13428 [FIXME: Filed as bug #28186: MCS must report this error.]
13430 2002-07-25 Martin Baulig <martin@gnome.org>
13432 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13433 method to pull the condition name ouf of a Conditional attribute.
13434 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13435 the obsolete message and error flag out of an Obsolete attribute.
13437 * class.cs (Method.GetMethodFlags): New public method to get the
13438 TypeManager.MethodFlags for this method.
13439 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13441 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13442 if we're overriding a virtual function, set the new private variable
13443 `parent_method'; call the new TypeManager.AddMethod().
13445 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
13446 the MethodBuilder and the Method in a PtrHashtable.
13447 (TypeManager.builder_to_method): Added for this purpose.
13448 (TypeManager.MethodFlags): Added IsObsoleteError.
13449 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
13450 Obsolete and Conditional arguments in MethodBuilders. If we discover
13451 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
13452 the message from the attribute.
13454 2002-07-24 Martin Baulig <martin@gnome.org>
13456 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
13457 preprocessor directives, ensure that the argument to #define/#undef is
13458 exactly one identifier and that it's actually an identifier.
13460 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
13463 2002-07-24 Martin Baulig <martin@gnome.org>
13465 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
13466 initialize it to TypeManager.object_type in the constructor.
13467 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
13468 of the `hm.get_current' method if we're using the collection pattern.
13469 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
13470 for the explicit conversion to make it work when we're using the collection
13471 pattern and the `Current' property has a different return type than `object'.
13474 2002-07-24 Martin Baulig <martin@gnome.org>
13476 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
13477 does not match, but don't report any errors. This method is called in
13478 order for all methods in a MethodGroupExpr until a matching method is
13479 found, so we don't want to bail out if the first method doesn't match.
13480 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
13481 matches, report the 123. Fixes #28070.
13483 2002-07-24 Martin Baulig <martin@gnome.org>
13485 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
13486 TypeManager.TypeToCoreType() to the top of the method so the
13487 following equality checks will work. Fixes #28107.
13489 2002-07-24 Martin Baulig <martin@gnome.org>
13491 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
13492 operand is of type uint, and the other operand is of type sbyte,
13493 short or int, the operands are converted to type long." -
13494 Actually do what this comment already told us. Fixes bug #28106,
13497 2002-07-24 Martin Baulig <martin@gnome.org>
13499 * class.cs (MethodBase): New abstract class. This is now a base
13500 class for Property, Indexer and Event to avoid some code duplication
13501 in their Define() and DefineMethods() methods.
13502 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
13503 generic methods for Define() and DefineMethods().
13504 (FieldBase): Derive from MemberBase, not MemberCore.
13505 (Property): Derive from MemberBase, not MemberCore.
13506 (Property.DefineMethod): Moved all the code from this method to the
13507 new MethodBase.DefineAccessor(), just call it with appropriate
13509 (Property.Define): Call the new Property.DoDefine(), this does some
13510 sanity checks and we don't need to duplicate the code everywhere.
13511 (Event): Derive from MemberBase, not MemberCore.
13512 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
13513 accessors, this will also make them work with interface events.
13514 (Indexer): Derive from MemberBase, not MemberCore.
13515 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
13516 (Indexer.Define): Use the new MethodBase functions.
13518 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
13519 argument to the constructor.
13520 (Interface.FindMembers): Added support for interface events.
13521 (Interface.PopluateEvent): Implemented.
13523 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
13525 2002-07-22 Miguel de Icaza <miguel@ximian.com>
13527 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
13528 but this is required to check for a method name being the same as
13529 the containing class.
13533 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13535 * interface.cs: initialize variable.
13537 2002-07-23 Martin Baulig <martin@gnome.org>
13539 Implemented the IndexerName attribute in interfaces.
13541 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
13542 name if this is an explicit interface implementation.
13543 (Indexer.InterfaceIndexerName): New public variable. If we're
13544 implementing an interface indexer, this is the IndexerName in that
13545 interface. Otherwise, it's the IndexerName.
13546 (Indexer.DefineMethod): If we're implementing interface indexer,
13547 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
13548 and Pending.ImplementIndexer methods.
13549 (Indexer.Define): Also define the PropertyBuilder if we're
13550 implementing an interface indexer and this is neither an explicit
13551 interface implementation nor do the IndexerName match the one in
13554 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
13555 If a method is defined here, then we always need to create a proxy
13556 for it. This is used when implementing interface indexers.
13557 (Pending.IsInterfaceIndexer): New public method.
13558 (Pending.ImplementIndexer): New public method.
13559 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
13560 This is used when implementing interface indexers to define a proxy
13562 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
13563 define a proxy if necessary.
13565 * interface.cs (Interface.IndexerName): New public variable.
13566 (Interface.PopulateIndexer): Set the IndexerName.
13567 (Interface.DefineIndexers): New private method. Populate all the
13568 indexers and make sure their IndexerNames match.
13570 * typemanager.cs (IndexerPropertyName): Added support for interface
13573 2002-07-22 Martin Baulig <martin@gnome.org>
13575 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
13576 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
13577 ret if HasReturnLabel.
13578 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
13581 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
13582 and set the ec.LoopBeginTryCatchLevel.
13583 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
13584 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
13585 the current ec.TryCatchLevel, the branch goes out of an exception
13586 block. In this case, we need to use Leave and not Br.
13588 2002-07-22 Martin Baulig <martin@gnome.org>
13590 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
13591 block unless the block does not always return or it is contained in
13592 another try { ... } catch { ... } block. Fixes bug #26506.
13593 Added verify-1.cs to the test suite.
13595 2002-07-22 Martin Baulig <martin@gnome.org>
13597 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
13598 then we do not always return. Fixes bug #24985.
13600 2002-07-22 Martin Baulig <martin@gnome.org>
13602 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
13603 lookup on a per-class level; ie. walk up the class hierarchy until we
13604 found at least one applicable method, then choose the best among them.
13605 Fixes bug #24463 and test-29.cs.
13607 2002-07-22 Martin Baulig <martin@gnome.org>
13609 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
13610 return types of the methods. The return type is not part of the
13611 signature and we must not check it to make the `new' modifier work.
13612 Fixes bug #27999, also added test-147.cs.
13613 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
13615 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
13616 on the method's return type.
13618 2002-07-21 Martin Baulig <martin@gnome.org>
13620 * assign.cs: Make this work if the rightmost source is a constant and
13621 we need to do an implicit type conversion. Also adding a few more tests
13622 to test-38.cs which should have caught this.
13624 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
13625 target in the makefile for this. The makefile.gnu is primarily intended
13626 for end-users who don't want to debug the compiler.
13628 2002-07-21 Martin Baulig <martin@gnome.org>
13630 * assign.cs: Improved the Assign class so it can now handle embedded
13631 assignments (X = Y = Z = something). As a side-effect this'll now also
13632 consume less local variables. test-38.cs now passes with MCS, added
13633 a few new test cases to that test.
13635 2002-07-20 Martin Baulig <martin@gnome.org>
13637 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
13638 instructions. Fixes bug #27977, also added test-146.cs.
13640 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13642 * cs-tokenizer.cs: fixed getHex ().
13644 2002-07-19 Martin Baulig <martin@gnome.org>
13646 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
13647 not Type.GetType() to lookup the array type. This is needed when
13648 we're constructing an array of a user-defined type.
13649 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
13650 single-dimensional arrays, but also for single-dimensial arrays of
13653 2002-07-19 Martin Baulig <martin@gnome.org>
13655 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
13656 this function is called, it's not allowed to share LocalBuilders
13657 among ILGenerators.
13659 2002-07-19 Martin Baulig <martin@gnome.org>
13661 * expression.cs (Argument.Resolve): Report an error 118 when trying
13662 to pass a type as argument.
13664 2002-07-18 Martin Baulig <martin@gnome.org>
13666 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
13667 Conv_R_Un for the signed `long' type.
13669 2002-07-15 Miguel de Icaza <miguel@ximian.com>
13671 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
13672 `expr' for the temporary result, as that will fail if we do
13673 multiple resolves on the same expression.
13675 2002-07-05 Miguel de Icaza <miguel@ximian.com>
13677 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
13678 ec.TypeContainer for looking up aliases.
13680 * class.cs (TypeContainer): Remove LookupAlias from here.
13682 * decl.cs (DeclSpace); Move here.
13684 2002-07-01 Miguel de Icaza <miguel@ximian.com>
13686 * class.cs (FindMembers): Only call filter if the constructor
13687 bulider is not null.
13689 Also handle delegates in `NestedTypes' now. Now we will perform
13690 type lookups using the standard resolution process. This also
13693 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
13694 This uses Expressions (the limited kind that can be parsed by the
13695 tree) instead of strings.
13697 * expression.cs (ComposedCast.ToString): Implement, used to flag
13698 errors since now we have to render expressions.
13700 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
13703 * ecore.cs (SimpleName.ToString): ditto.
13705 * cs-parser.jay: Instead of using strings to assemble types, use
13706 Expressions to assemble the type (using SimpleName, ComposedCast,
13707 MemberAccess). This should fix the type lookups in declarations,
13708 because we were using a different code path for this.
13710 * statement.cs (Block.Resolve): Continue processing statements
13711 even when there is an error.
13713 2002-07-17 Miguel de Icaza <miguel@ximian.com>
13715 * class.cs (Event.Define): Also remove the `remove' method from
13716 the list of pending items.
13718 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
13719 generate more compact code.
13721 2002-07-17 Martin Baulig <martin@gnome.org>
13723 * const.cs (Const.LookupConstantValue): Add support for constant
13724 `unchecked' and `checked' expressions.
13725 Also adding test case test-140.cs for this.
13727 2002-07-17 Martin Baulig <martin@gnome.org>
13729 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
13730 check whether mi.ReturnType implements the IEnumerator interface; the
13731 `==' and the IsAssignableFrom() will fail in this situation.
13733 2002-07-16 Ravi Pratap <ravi@ximian.com>
13735 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
13738 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13740 * expression.cs: fixed bug #27811.
13742 2002-07-14 Miguel de Icaza <miguel@ximian.com>
13744 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
13745 Molaro: when we are a ref, the value already contains a pointer
13746 value, do not take the address of it.
13748 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13749 * removed mb-parser.jay and mb-tokenizer.cs
13751 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13753 * expression.cs: check against the building corlib void type.
13755 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
13757 * ecore.cs: fix for valuetype static readonly fields: when
13758 initializing them, we need their address, not the address of a copy.
13760 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
13762 * typemanager.cs: register also enum_type in corlib.
13764 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13766 * class.cs: allow calling this (but not base) initializers in structs.
13768 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
13770 * ecore.cs: make sure we compare against the building base types
13773 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
13775 * typemanager.cs: fix TypeToCoreType() to handle void and object
13776 (corlib gets no more typerefs after this change).
13778 2002-07-12 Miguel de Icaza <miguel@ximian.com>
13780 * expression.cs (ArrayCreation.EmitArrayArguments): use
13781 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
13783 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
13784 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
13785 array indexes, the runtime actually forbids them.
13787 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
13788 for array arguments here.
13790 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
13791 instead of the default for ValueTypes.
13793 (New.DoEmit): Use IsValueType instead of
13794 IsSubclassOf (value_type)
13795 (New.DoResolve): ditto.
13796 (Invocation.EmitCall): ditto.
13798 * assign.cs (Assign): ditto.
13800 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
13801 Statements *are* currently doing part of their resolution during
13804 Expressions do always resolve during resolve, but statements are
13805 only required to propagate resolution to their children.
13807 2002-07-11 Miguel de Icaza <miguel@ximian.com>
13809 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
13811 (LoadAssembly): Do not add the dll if it is already specified
13813 (MainDriver): Add the System directory to the link path at the end,
13814 after all the other -L arguments.
13816 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
13817 wrong opcode for loading bytes and bools (ldelem.i1 instead of
13818 ldelem.u1) and using the opposite for sbytes.
13820 This fixes Digger, and we can finally run it.
13822 * driver.cs (UnixParseOption): Move the option parsing here.
13823 (CSCParseOption): Implement CSC-like parsing of options.
13825 We now support both modes of operation, the old Unix way, and the
13826 new CSC-like way. This should help those who wanted to make cross
13827 platform makefiles.
13829 The only thing broken is that /r:, /reference: and /lib: are not
13830 implemented, because I want to make those have the same semantics
13831 as the CSC compiler has, and kill once and for all the confussion
13832 around this. Will be doing this tomorrow.
13834 * statement.cs (Unsafe.Resolve): The state is checked during
13835 resolve, not emit, so we have to set the flags for IsUnsfe here.
13837 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13839 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
13840 not catch the Error_ObjectRefRequired in SimpleName (as it is
13841 possible to have a class/instance variable name that later gets
13842 deambiguated), we have to check this here.
13844 2002-07-10 Ravi Pratap <ravi@ximian.com>
13846 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
13847 make static and put into Expression.
13849 (Event.Define): Register the private field of the event with the
13850 TypeManager so that GetFieldFromEvent can get at it.
13852 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
13853 keep track of the private field associated with an event which
13856 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
13859 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
13861 2002-07-10 Miguel de Icaza <miguel@ximian.com>
13863 * expression.cs (Binary.EmitBranchable): this routine emits the
13864 Binary expression in a branchable context. This basically means:
13865 we need to branch somewhere, not just get the value on the stack.
13867 This works together with Statement.EmitBoolExpression.
13869 * statement.cs (Statement.EmitBoolExpression): Use
13872 2002-07-09 Miguel de Icaza <miguel@ximian.com>
13874 * statement.cs (For): Reduce the number of jumps in loops.
13876 (For): Implement loop inversion for the For statement.
13878 (Break): We can be breaking out of a Try/Catch controlled section
13879 (foreach might have an implicit try/catch clause), so we need to
13880 use Leave instead of Br.
13882 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
13883 now). If the instace expression supports IMemoryLocation, we use
13884 the AddressOf method from the IMemoryLocation to extract the
13885 address instead of emitting the instance.
13887 This showed up with `This', as we were emitting the instance
13888 always (Emit) instead of the Address of This. Particularly
13889 interesting when This is a value type, as we dont want the Emit
13890 effect (which was to load the object).
13892 2002-07-08 Miguel de Icaza <miguel@ximian.com>
13894 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
13896 * statement.cs (Checked): Set the CheckedState during the resolve
13897 process too, as the ConvCast operations track the checked state on
13898 the resolve process, and not emit.
13900 * cs-parser.jay (namespace_member_declaration): Flag that we have
13901 found a declaration when we do. This is used to flag error 1529
13903 * driver.cs: Report ok when we display the help only.
13905 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
13907 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
13909 2002-07-04 Miguel de Icaza <miguel@ximian.com>
13911 * cs-tokenizer.cs (define): We also have to track locally the
13912 defines. AllDefines is just used for the Conditional Attribute,
13913 but we also need the local defines for the current source code.
13915 2002-07-03 Miguel de Icaza <miguel@ximian.com>
13917 * statement.cs (While, For, Do): These loops can exit through a
13918 Break statement, use this information to tell whether the
13919 statement is the last piece of code.
13921 (Break): Flag that we break.
13923 * codegen.cs (EmitContexts): New `Breaks' state variable.
13925 2002-07-03 Martin Baulig <martin@gnome.org>
13927 * class.cs (TypeContainer.MethodModifiersValid): Allow override
13928 modifiers in method declarations in structs. Otherwise, you won't
13929 be able to override things like Object.Equals().
13931 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13933 * class.cs (Method, Property, Indexer): Do not allow the public
13934 modifier to be used in explicit interface implementations.
13936 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
13937 override modifiers in method declarations in structs
13939 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
13941 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
13942 integer or real overflow, report an error
13944 2002-07-02 Martin Baulig <martin@gnome.org>
13946 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
13947 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
13948 to tell the runtime about our newly created System.Object and
13949 System.ValueType types.
13951 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13953 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
13954 struct instead of Ldarg/Starg.
13956 2002-07-02 Martin Baulig <martin@gnome.org>
13958 * expression.cs (Indirection.Indirection): Call
13959 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
13961 2002-07-02 Martin Baulig <martin@gnome.org>
13963 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
13964 ValueType, call TypeManager.TypeToCoreType() on it.
13965 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
13966 the OpCodes.Newarr argument.
13968 2002-07-02 Martin Baulig <martin@gnome.org>
13970 * expression.cs (Invocation.EmitCall): When compiling corlib,
13971 replace all calls to the system's System.Array type to calls to
13972 the newly created one.
13974 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
13975 System.Array methods.
13976 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
13977 from the system's System.Array type which must be replaced.
13979 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
13981 * typemanager.cs: load unverifiable_code_ctor so we can build
13982 corlib using the correct type. Avoid using GetTypeCode() with
13984 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
13985 TypeManager.object_type to allow building corlib.
13987 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
13989 * ecore.cs: handle System.Enum separately in LoadFromPtr().
13991 2002-07-01 Martin Baulig <martin@gnome.org>
13993 * class.cs: Make the last change actually work, we need to check
13994 whether `ifaces != null' to avoid a crash.
13996 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13998 * class.cs: when we build structs without fields that implement
13999 interfaces, we need to add the interfaces separately, since there is
14000 no API to both set the size and add the interfaces at type creation
14003 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14005 * expression.cs: the dimension arguments to the array constructors
14006 need to be converted if they are a long.
14008 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14010 * class.cs: don't emit ldarg.0 if there is no parent constructor
14011 (fixes showstopper for corlib).
14013 2002-06-29 Martin Baulig <martin@gnome.org>
14015 MCS now compiles corlib on GNU/Linux :-)
14017 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14018 ie. check for MethodImplOptions.InternalCall.
14020 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14021 and TypeManager.attribute_type are null, so we must explicitly check
14022 whether parent is not null to find out whether it's an attribute type.
14023 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14024 and SetBuilder, not only if the property is neither abstract nor external.
14025 This is necessary to set the MethodImplOptions on the accessor methods.
14026 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14027 SetBuilder, see Property.Emit().
14029 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14030 populate "System.Object", "System.ValueType" and "System.Attribute" since
14031 they've already been populated from BootCorlib_PopulateCoreTypes().
14033 2002-06-29 Martin Baulig <martin@gnome.org>
14035 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14036 is the NullLiteral, we also need to make sure that target_type is not
14039 2002-06-29 Martin Baulig <martin@gnome.org>
14041 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14042 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14043 before calling BootstrapCorlib_ResolveDelegate ().
14045 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14047 * statement.cs: fixed build-breaker. All tests passed ok.
14049 2002-06-27 Martin Baulig <martin@gnome.org>
14051 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14052 for System.Decimal when compiling corlib.
14054 2002-06-27 Martin Baulig <martin@gnome.org>
14056 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14057 switch blocks which contain nothing but a default clause.
14059 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14061 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14063 2002-06-27 Martin Baulig <martin@gnome.org>
14065 * ecore.cs (PropertyExpr.PropertyExpr): Call
14066 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14068 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14069 is already a TypeBuilder.
14071 2002-06-27 Martin Baulig <martin@gnome.org>
14073 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14074 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14075 the "from an array-type to System.Array" case. This makes it work
14076 when compiling corlib.
14078 2002-06-27 Martin Baulig <martin@gnome.org>
14080 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14081 non-static PropertyExpr, set its InstanceExpression. This makes
14082 the `ICollection.Count' property work in System/Array.cs.
14084 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14086 * driver.cs: Made error handling more consistent. Errors now
14087 tracked by Report class, so many methods which used to return int
14088 now return void. Main() now prints success/failure and
14089 errors/warnings message.
14091 Renamed '--probe' compiler argument to '--expect-error'. Removed
14092 the magic number return values (123 and 124). Now, if the
14093 expected error occurs, the compiler exits with success (exit value
14094 0). If the compilation completes without seeing that particular
14095 error, the compiler exits with failure (exit value 1). The
14096 makefile in mcs/errors has been changed to handle the new behaviour.
14098 * report.cs: Made 'expected error' number a property and renamed
14099 it from 'Probe' to 'ExpectedError'.
14101 * genericparser.cs: Removed error handling support, since it is
14102 now all done by Report class.
14104 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14105 class, so parse() no longer returns an int.
14107 * namespace.cs: Use Report.Error instead of GenericParser.error
14109 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14111 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14112 TypeContainer.AddOperator): At the front of the list put the
14113 explicit implementations, so they get resolved/defined first.
14115 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14117 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14118 interface type is implemented by this TypeContainer. Used during
14119 explicit interface implementation.
14121 (Property.Define, Indexer.Define, Method.Define): Validate that
14122 the given interface in the explicit implementation is one of the
14123 base classes for the containing type.
14125 Also if we are explicitly implementing an interface, but there is
14126 no match in the pending implementation table, report an error.
14128 (Property.Define): Only define the property if we are
14129 not explicitly implementing a property from an interface. Use the
14130 correct name also for those properties (the same CSC uses,
14131 although that is really not needed).
14133 (Property.Emit): Do not emit attributes for explicitly implemented
14134 properties, as there is no TypeBuilder.
14136 (Indexer.Emit): ditto.
14138 Hiding then means that we do not really *implement* a pending
14139 implementation, which makes code fail.
14141 2002-06-22 Martin Baulig <martin@gnome.org>
14143 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14144 the return value of Object.GetType(). [FIXME: we need to do this whenever
14145 we get a type back from the reflection library].
14147 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14149 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14151 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14153 * attribute.cs: Return null if we can not look up the type.
14155 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14156 the interface types found.
14158 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14159 interface types found.
14161 * typemanager.cs (GetInterfaces): Make this routine returns alll
14162 the interfaces and work around the lame differences between
14163 System.Type and System.Reflection.Emit.TypeBuilder in the results
14164 result for GetInterfaces.
14166 (ExpandInterfaces): Given an array of interface types, expand and
14167 eliminate repeated ocurrences of an interface. This expands in
14168 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14171 2002-06-21 Martin Baulig <martin@gnome.org>
14173 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14176 2002-06-21 Martin Baulig <martin@gnome.org>
14178 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14179 and called with one of the core types, return the corresponding typebuilder for
14182 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14185 2002-06-21 Martin Baulig <martin@gnome.org>
14187 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14188 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14189 (Expression.ConvertReferenceExplicit): Likewise.
14191 * expression.cs (ElementAccess.DoResolve): Likewise.
14192 (ElementAccess.DoResolveLValue): Likewise.
14194 2002-06-10 Martin Baulig <martin@gnome.org>
14196 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14197 add the "value" parameter to the parameter list.
14199 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14202 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14204 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14205 the argument to an int, uint, long or ulong, per the spec. Also
14206 catch negative constants in array creation.
14208 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14210 * class.cs: do not allow the same interface to appear twice in
14211 the definition list.
14213 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14215 * ecore.cs: don't use ldlen with System.Array.
14217 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14219 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14221 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14223 * modifiers.cs: produce correct field attributes for protected
14224 internal. Easy fix so miguel can work on ther harder stuff:-)
14226 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14228 * pending.cs: New file. Move the code from class.cs here.
14229 Support clearning the pending flag for all methods (when not doing
14230 explicit interface implementation).
14232 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14234 * rootcontext.cs: added a couple more types needed to bootstrap.
14236 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14238 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14239 constructor in the type, instead of any constructor in the type
14240 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14241 a bug in the Mono runtime when applying the params attribute).
14243 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14244 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14246 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14248 * expression.cs (Unary.ResolveOperator): Use TypeManager
14249 to resolve the type.
14251 2002-06-13 Ravi Pratap <ravi@ximian.com>
14253 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14256 * enum.cs (AddEnumMember): Add support to store the attributes associated
14257 with each member too.
14259 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14260 field builders too - this takes care of the enum member case.
14262 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14264 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14265 address-of operator on both value types and pointers.
14267 2002-06-10 Martin Baulig <martin@gnome.org>
14269 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14270 PropertyBuilder to the `property_builders' list.
14272 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14273 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14274 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14275 find any indexers which are inherited from an interface.
14277 2002-06-09 Martin Baulig <martin@gnome.org>
14279 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14280 the same type as the constant if necessary. There's also a test-130.cs
14283 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14285 * typemanager.cs (TypeManager.ChangeType): Previously known as
14286 Enum.ChangeEnumType().
14288 2002-06-09 Martin Baulig <martin@gnome.org>
14290 * expression.cs (Cast.TryReduce): Added support for consts.
14292 2002-06-08 Ravi Pratap <ravi@ximian.com>
14294 * class.cs (Accessor): Hold attributes information so we can pass
14297 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14298 Modify to pass in attributes attached to the methods.
14300 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14302 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14303 to handle the Accessor kind :-)
14305 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14307 2002-06-08 Martin Baulig <martin@gnome.org>
14309 * expression.cs (Unary.TryReduceNegative): Added support for
14312 2002-06-08 Martin Baulig <martin@gnome.org>
14314 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14315 name can't be found in the `defined_names' - the caller will do a
14316 MemberLookup in this case and thus find methods in System.Enum
14317 such as Enum.IsDefined().
14319 2002-06-08 Martin Baulig <martin@gnome.org>
14321 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14322 Convert.ChangeType() which works with TypeBuilder created types.
14323 (Enum.LookupEnumValue, Enum.Define): Use it here.
14325 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14326 `TypeBuilder.BaseType != null' check.
14327 (TypeContainer.FindMembers): Only lookup parent members if we
14328 actually have a parent.
14329 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14330 (ConstructorInitializer.Resolve): Likewise.
14332 * interface.cs (Interface.FindMembers): Added
14333 `TypeBuilder.BaseType != null' check.
14335 * rootcontext.cs (RootContext.ResolveCore): Added
14336 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14337 classes_second_stage.
14339 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14340 debug_type and trace_type when compiling with --nostdlib.
14342 2002-06-07 Martin Baulig <martin@gnome.org>
14344 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14345 (AddField): Set it to true when adding a non-static field.
14346 (DefineType): Use `have_nonstatic_fields' to find out whether we
14347 have non-static fields, not `Fields != null'.
14349 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14351 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14352 dereferencing a null on the static-field code path)
14354 2002-05-30 Martin Baulig <martin@gnome.org>
14356 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14357 to take command line arguments. Use reflection to call the new
14358 custom `Initialize' function on the symbol writer and pass it the
14359 command line arguments.
14361 * driver.cs (--debug-args): New command line argument to pass command
14362 line arguments to the symbol writer.
14364 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14366 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14367 the target type for indexers and properties. Thanks to Joe for
14370 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14372 * typemanager.cs (MethodFlags): returns the method flags
14373 (Obsolete/ShouldIgnore) that control warning emission and whether
14374 the invocation should be made, or ignored.
14376 * expression.cs (Invocation.Emit): Remove previous hack, we should
14377 not do this on matching a base type, we should do this based on an attribute
14379 Only emit calls to System.Diagnostics.Debug and
14380 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14381 on the command line.
14383 * rootcontext.cs: Global settings for tracing and debugging.
14385 * cs-tokenizer.cs (define): New utility function to track
14386 defines. Set the global settings for TRACE and DEBUG if found.
14388 2002-05-25 Ravi Pratap <ravi@ximian.com>
14390 * interface.cs (Populate*): Pass in the TypeContainer as well as
14391 the DeclSpace as parameters so that we can create EmitContexts and
14392 then use that to apply attributes etc.
14394 (PopulateMethod, PopulateEvent, PopulateProperty)
14395 (PopulateIndexer): Apply attributes everywhere.
14397 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14400 (ApplyAttributes): Update accordingly.
14402 We now apply interface attributes for all members too.
14404 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14406 * class.cs (Indexer.Define); Correctly check if we are explicit
14407 implementation (instead of checking the Name for a ".", we
14408 directly look up if the InterfaceType was specified).
14410 Delay the creation of the PropertyBuilder.
14412 Only create the PropertyBuilder if we are not an explicit
14413 interface implementation. This means that explicit interface
14414 implementation members do not participate in regular function
14415 lookups, and hence fixes another major ambiguity problem in
14416 overload resolution (that was the visible effect).
14418 (DefineMethod): Return whether we are doing an interface
14421 * typemanager.cs: Temporary hack until we get attributes in
14422 interfaces (Ravi is working on that) and we get IndexerName
14423 support in interfaces.
14425 * interface.cs: Register the indexers as properties.
14427 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14428 warning, I have verified that this is a bug in the .NET runtime
14429 (JavaScript suffers of the same problem).
14431 * typemanager.cs (MemberLookup): When looking up members for
14432 interfaces, the parent of an interface is the implicit
14433 System.Object (so we succeed in searches of Object methods in an
14434 interface method invocation. Example: IEnumerable x; x.ToString
14437 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14439 * class.cs (Event): Events should also register if they do
14440 implement the methods that an interface requires.
14442 * typemanager.cs (MemberLookup); use the new GetInterfaces
14445 (GetInterfaces): The code used to lookup interfaces for a type is
14446 used in more than one place, factor it here.
14448 * driver.cs: Track the errors at the bottom of the file, we kept
14451 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
14452 instance if the method we are calling is static!
14454 2002-05-24 Miguel de Icaza <miguel@ximian.com>
14456 * attribute.cs (ApplyAttributes): Make this function filter out
14457 the IndexerName attribute (as that attribute in reality is never
14458 applied) and return the string constant for the IndexerName
14461 * class.cs (TypeContainer.Emit): Validate that all the indexers
14462 have the same IndexerName attribute, and if so, set the
14463 DefaultName attribute on the class.
14465 * typemanager.cs: The return value might contain other stuff (not
14466 only methods). For instance, consider a method with an "Item"
14467 property and an Item method.
14469 * class.cs: If there is a problem with the parameter types,
14472 2002-05-24 Ravi Pratap <ravi@ximian.com>
14474 * ecore.cs (ImplicitConversionExists): Wrapper function which also
14475 looks at user defined conversion after making a call to
14476 StandardConversionExists - we need this for overload resolution.
14478 * expression.cs : Update accordingly the various method calls.
14480 This fixes 2 bugs filed against implicit user defined conversions
14482 2002-05-22 Miguel de Icaza <miguel@ximian.com>
14484 * statement.cs: Track the result of the assignment.
14486 2002-05-21 Miguel de Icaza <miguel@ximian.com>
14488 * expression.cs (MemberAccess): Improved error reporting for
14489 inaccessible members.
14491 2002-05-22 Martin Baulig <martin@gnome.org>
14493 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
14494 itself with debugging support.
14496 2002-05-22 Martin Baulig <martin@gnome.org>
14498 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
14499 Removed, this isn't needed anymore.
14501 2002-05-20 Martin Baulig <martin@gnome.org>
14503 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14504 be underlying type for an enum.
14506 2002-05-20 Miguel de Icaza <miguel@ximian.com>
14508 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14509 that splits out the loading of just the core types.
14511 * rootcontext.cs (ResolveCore): Split the struct resolution in
14512 two, so we can load the enumeration underlying types before any
14515 * expression.cs (Is): Bandaid until we fix properly Switch (see
14516 bug #24985 for details).
14518 * typemanager.cs (ImplementsInterface): The hashtable will contain
14519 a null if there are no interfaces implemented.
14521 2002-05-18 Miguel de Icaza <miguel@ximian.com>
14523 * cs-parser.jay (indexer_declarator): It is fine to have array
14526 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14528 * typemanager.cs: (RegisterBuilder): New function used to register
14529 TypeBuilders that implement interfaces. Since
14530 TypeBuilder.GetInterfaces (as usual) does not work with lame
14532 (AddUserType): register interfaces.
14534 (ImplementsInterface): Use the builder_to_ifaces hash if we are
14535 dealing with TypeBuilder. Also, arrays are showing up as
14536 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
14537 methods can not be invoked on them!
14539 * ecore.cs (ExplicitReferenceConversionExists): Made public.
14540 (ImplicitReferenceConversionExists): Split out from
14541 StandardConversionExists.
14543 * expression.cs (As): We were only implementing one of the three
14544 cases for the as operator. We now implement them all.
14545 (Is): Implement the various other cases for Is as well.
14547 * typemanager.cs (CACHE): New define used to control if we want or
14548 not the FindMembers cache. Seems to have a negative impact on
14549 performance currently
14551 (MemberLookup): Nested types have full acess to
14552 enclosing type members
14554 Remove code that coped with instance/static returns for events, we
14555 now catch this in RealFindMembers.
14557 (RealFindMembers): only perform static lookup if the instance
14558 lookup did not return a type or an event.
14560 2002-05-17 Miguel de Icaza <miguel@ximian.com>
14562 * assign.cs (CompoundAssign): We pass more semantic information
14563 now to Compound Assignments than we did before: now we have all
14564 the information at hand, and now we resolve the target *before* we
14565 do the expression expansion, which allows the "CacheValue" method
14566 to have the effect we intended (before, a [x] += 1 would generate
14567 two differen ArrayAccess expressions from the ElementAccess,
14568 during the resolution process).
14570 (CompoundAssign.DoResolve): Resolve target and original_source here.
14572 2002-05-16 Miguel de Icaza <miguel@ximian.com>
14574 * expression.cs (ArrayAccess): dropped debugging information.
14576 * typemanager.cs: Small bug fix: I was always returning i_members,
14577 instead of one of i_members or s_members (depending on which had
14580 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
14581 method is invoked before any code generation takes place, and it
14582 is a mechanism to inform that the expression will be invoked more
14583 than once, and that the method should use temporary values to
14584 avoid having side effects
14586 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
14588 * ecore.cs (Expression.CacheTemporaries): Provide empty default
14591 * expression.cs (Indirection, ArrayAccess): Add support for
14592 CacheTemporaries in these two bad boys.
14594 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
14595 ldobj or ldind_ref.
14596 (StoreFromPtr): Handle stobj as well.
14598 * expression.cs (UnaryMutator): Share more code.
14600 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
14601 down: I was not tracking the Filter function as well, which
14602 was affecting the results of the cache.
14604 2002-05-15 Miguel de Icaza <miguel@ximian.com>
14606 * attribute.cs: Remove the hack to handle the CharSet property on
14609 2002-05-14 Miguel de Icaza <miguel@ximian.com>
14611 * attribute.cs (DoResolve): More uglyness, we now only try to
14612 resolve the attribute partially, to extract the CharSet
14613 information (only if we are a StructLayout attribute). Otherwise
14615 (GetExtraTypeInfo): Add some code to conditionally kill in the
14616 future this. I am more and more convinced that the .NET
14617 framework has special code to handle the attribute setting on
14620 * expression.cs (IsParamsMethodApplicable): Revert my previous
14621 foreach change here, it was wrong.
14623 2002-05-13 Miguel de Icaza <miguel@ximian.com>
14625 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
14626 (pp_expr): do not abort on unknown input, just return.
14627 (eval): abort if there are pending chars.
14629 * attribute.cs (Attribute.Resolve): Positional parameters are
14630 optional. Deal with that case.
14632 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
14633 the Ansi/Unicode/Auto information for the type.
14635 (TypeContainer.DefineType): instantiate the EmitContext here, as
14636 we will be using it during the type definition (to resolve
14637 attributes) and during the emit phase.
14639 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
14640 to pull type information out of the attributes
14642 (Attribute.Resolve): track the constructor builder, and allow for
14643 multiple invocations (structs and classes will use this).
14645 * ecore.cs (MemberLookupFinal): new version with all the
14646 parameters customizable.
14648 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
14649 constructors. Return if the result value is null (as the error
14650 would have been flagged already by MemberLookupFinal)
14652 Do not allow instances of abstract classes or interfaces to be
14655 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
14656 We have to compare the assembly property here when dealing with
14657 FamANDAssem and Assembly access modifiers, because we might be
14658 creating an assembly from *modules* (that means that we are not
14659 getting TypeBuilders for types defined in other modules that are
14660 part of this assembly).
14662 (Method.Emit): If the method is marked abstract and has a body,
14665 (TypeContainer.DefineMembers): If both the defined member and the
14666 parent name match are methods, then do not emit any warnings: let
14667 the Method.Define routine take care of flagging warnings. But if
14668 there is a mismatch (method overrides something else, or method is
14669 overriwritten by something, then emit warning).
14671 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
14672 set to null, this means `do not check for the return type on the
14675 (Method.Define): set the return type for the method signature to
14676 null, so that we get methods with the same name and parameters and
14677 different return types. This is used to flag warning 114 (you are
14678 hiding a method, and you probably want to use the new/override
14681 * typemanager.cs (MemberLookup): Implemented proper access
14682 control, closing a long standing set of bug reports. The problem
14683 was that the Framework only has two bits: Public and NonPublic,
14684 and NonPublic includes private and protected methods, but we need
14685 to enforce the FamANDAssem, FamOrAssem and Family.
14687 2002-05-11 Miguel de Icaza <miguel@ximian.com>
14689 * statement.cs (GotoCase): Return true: Ammounts to giving up
14690 knowledge on whether we return or not, and letting the other case
14691 be responsible for it.
14693 2002-05-10 Miguel de Icaza <miguel@ximian.com>
14695 * driver.cs: Do not load directories for each file processed, only
14696 do it if there is a pattern.
14698 * ecore.cs: Report readonly assigns here as well, as we might have
14699 been resolved only by MemberAccess.
14701 (SimpleName.SimpleNameResolve): Also be useful for LValue
14702 resolution. We need this to propagate assign to local readonly variables
14704 * typemanager.cs: Use a ptrhashtable for the criteria, because we
14705 do not want to reuse potential criteria memory.
14707 * class.cs (MyEventBuilder): Set reflected_type;
14709 * ecore.cs (Constantify): Added support for constifying bools.
14711 (RootContext.LookupType): Added a cache for values looked up in
14712 the declaration space.
14714 * typemanager.cs (FindMembers): Now is a front-end to
14715 RealFindMembers, and provides a two-level hashtable-based cache to
14718 15% performance improvement: from 22.5 to 19.2 seconds.
14720 * expression.cs (IsParamsMethodApplicable): use foreach.
14721 (Invocation.DoResolve): ditto.
14722 (New.DoResolve): ditto.
14723 (ArrayCreation.DoResolve): ditto.
14725 * ecore.cs (FindMostEncompassingType): use foreach.
14727 * delegate.cs (NewDelegate.DoResolve): Use foreach
14729 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
14730 (RemoveMethods): use foreach.
14732 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
14733 nested foreach statements instead of for, and also break out of
14734 the inner loop once a match is found.
14736 (Invocation.OverloadResolve): Use foreach, simplify the code.
14738 2002-05-08 Miguel de Icaza <miguel@ximian.com>
14740 * cfold.cs (BinaryFold): During an enumeration evaluation context,
14741 we actually unwrap the expression to allow for extra information
14744 * expression.cs: Use Shr_Un on unsigned operations.
14746 2002-05-08 Ravi Pratap <ravi@ximian.com>
14748 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
14749 applicable operators was not being considered correctly. This closes
14750 the bug Miguel reported.
14752 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
14754 * attribute.cs: check that the type derives from System.Attribute
14755 and report the correct error in that case (moved the duplicate code to
14756 its own method, too).
14758 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
14760 * attribute.cs: lookup attribute type name as the spec says: first the
14761 bare attribute name and then name + "Attribute" (nant compiles with
14762 mcs after this fix).
14764 2002-05-07 Miguel de Icaza <miguel@ximian.com>
14766 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
14767 Because of the way we parse things, we should try to see if a
14768 UIntConstant can fit in an integer.
14770 2002-05-07 Ravi Pratap <ravi@ximian.com>
14772 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
14773 when we are in an explicit context.
14775 (ConvertReferenceExplicit): When converting from Iface type S to Class
14776 T make sure the rules are implemented as an OR.
14778 * parameter.cs (ParameterType): Make it a property for now although the
14779 purpose really isn't anything immediate.
14781 * expression.cs (Is*Applicable): Do better checking on the parameter type
14782 of a ref/out parameter. The ones from the system assemblies are already
14783 marked with the correct type so we don't need to do any correction.
14785 * ecore.cs (StandardConversionExists): Conversion from Interface types to
14786 the object type is standard too so include that.
14788 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14790 * ecore.cs (StandardConversionExists): Augment with missing code:
14791 deal with IntConstant, LongConstants and Enumerations.
14793 * assign.cs: Report the error, instead of failing silently
14795 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
14796 typecontainer that they are declared, because the
14797 typecontainer/namespace will have the list of using clauses that
14798 need to be applied.
14800 Assembly Attributes were escaping the normal registration
14803 (EmitCode): Apply attributes within an EmitContext that represents
14804 the container they were declared on.
14806 * cs-parser.jay: Track bases for structs. How did I get this wrong?
14808 2002-05-06 Ravi Pratap <ravi@ximian.com>
14810 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
14811 Revamp completely - make much cleaner as we now operate only
14814 (FindMostSpecificSource, FindMostSpecificTarget): New methods
14815 to implement the logic detailed in the spec more correctly.
14817 (UserDefinedConversion): Update accordingly.
14819 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14821 * statement.cs: Return flow analysis information up.
14823 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
14826 (token): Do not consume an extra character before calling
14829 2002-05-06 Piers Haken <piersh@friskit.com>
14831 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
14833 2002-05-06 Miguel de Icaza <miguel@ximian.com>
14835 * class.cs (Constructor.Emit): Set the IsStatic flag in the
14836 EmitContext during the instance constructor initializer
14837 resolution, to stop access to instance variables.
14839 This is mandated by the spec, last paragraph of the `constructor
14840 initializers' section.
14842 2002-05-05 Miguel de Icaza <miguel@ximian.com>
14844 * cs-parser.jay, class.cs (Accessor): new class used to represent
14845 an accessor (get or set). In the past we used `null' to represent
14846 a missing accessor. But this is ambiguous because there was no
14847 way to tell in abstract indexers/properties if one of them was
14850 Now there is a way of addressing that.
14852 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
14853 instead of FindMembers.
14855 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
14856 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
14858 * attribute.cs: Treat indexers and properties as the same in terms
14859 of applying attributes
14861 * ecore.cs (FindMostEncompassedType): Use statically initialized
14862 EmptyExpressions()s like we do elsewhere to avoid creating useless
14863 objects (and we take this out of the tight loop).
14865 (GetConversionOperators): Move the code to extract the actual
14866 operators to a separate routine to clean things up.
14868 2002-05-04 Miguel de Icaza <miguel@ximian.com>
14870 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
14871 events are always registered FieldBuilders.
14873 * class.cs (FieldBase): New class shared by Fields
14875 * delegate.cs: If we are a toplevel delegate, use our full name.
14876 If we are a nested delegate, then only use our tail name.
14878 2002-05-02 Ravi Pratap <ravi@ximian.com>
14880 * expression.cs (IsApplicable): Ensure that we add the "&" to
14881 ref/out types before comparing it with the type of the argument.
14883 (IsParamsMethodApplicable): Ditto.
14885 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
14888 * delegate.cs : Handle the case when we have more than one applicable
14889 method. Flag an error only when we finish checking all.
14891 2002-05-02 Miguel de Icaza <miguel@ximian.com>
14893 * expression.cs: Add support for boolean static initializers.
14895 2002-05-01 Miguel de Icaza <miguel@ximian.com>
14897 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
14899 * parameter.cs (ComputeParameterTypes,
14900 ComputeAndDefineParameterTypes): Better error handling: now we
14901 clear the `types' cache if we fail during any of the type lookups.
14902 We also return the status code correctly to our caller
14904 * delegate.cs: If we fail to define a delegate, abort the extra
14907 * expression.cs (Binary.ResolveOperator): for
14908 operator==(object,object) and operator !=(object, object) we also
14909 have to verify that there is an implicit conversion from one to
14912 (ArrayAccess.DoResolve): Array Access can operate on
14915 2002-04-30 Miguel de Icaza <miguel@ximian.com>
14917 * assign.cs (CompoundAssign): A new class used as a "flag" that
14918 the assignment actually is happening as part of a compound
14919 assignment operator.
14921 During compound assignment, a few new rules exist to enable things
14928 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
14929 to the type of x) if y is implicitly convertible to the type of x,
14930 and the operator is a builtin operator and the return type of the
14931 operator is explicitly convertible to the type of x.
14933 * rootcontext.cs: Reset warning level to 2. 4 catches various
14934 "interesting" features in mcs, we must clean this up at some
14935 point, but currently am trying to kill other bugs ;-)
14937 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
14938 in container classes as well.
14940 * expression.cs (Binary.ResolveOperator): Handle string case
14941 before anything else (as operator overloading does emit an error
14942 before doing anything else).
14944 This code could go away when we move to a table driven model, but
14945 i could not come up with a good plan last night.
14947 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
14949 * typemanager.cs (CSharpName): reimplementation using regex.
14950 * class.cs: added null check for fields in Emit
14951 * rootcontext.cs: set warninglevel to 4
14953 2002-04-29 Miguel de Icaza <miguel@ximian.com>
14955 * typemanager.cs (CSharpName): reimplemented with Lupus
14958 2002-04-28 Miguel de Icaza <miguel@ximian.com>
14960 * statement.cs (If): correclty implement Resolve, because we were
14961 not catching sem errors in there. The same process is needed
14963 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
14966 (Statement.Warning_DeadCodeFound): Factorize code.
14967 (While): Report dead code here too.
14969 (Statement): Added Resolve virtual method to allow
14970 for resolution split from the emit code.
14972 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14974 * statement.cs (EmitBoolExpression): No longer try to resolve the
14976 (MakeBoolean): New utility function that resolve, implicitly
14977 converts to boolean and tags the expression.
14980 (If, Do): Implement dead code elimination.
14981 (While): Implement loop inversion
14983 (Do, While, For, If): Resolve the expression prior to calling our
14986 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
14989 - added method Report28 (warning: program has more than one entry point)
14990 - added method IsEntryPoint, implements paragraph 10.1 of the spec
14991 - modified method Method.Define, the part at the end of the method
14993 * rootcontext.cs: added static public Location EntryPointLocation;
14995 * ../errors/cs0028.cs : Add test case for the above warning.
14998 - modified method CSharpName to allow arrays of primitive type to
14999 be printed nicely (e.g. instead of System.Int32[][] it now prints
15001 - added method CSharpSignature: returns the signature of a method
15002 in string format to be used in reporting errors, warnings, etc.
15004 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15007 2002-04-26 Ravi Pratap <ravi@ximian.com>
15009 * delegate.cs (Define): Fix extremely silly bug where I was
15010 setting the type of the 'object' parameter of the BeginInvoke
15011 method to System.IAsyncResult instead of System.Object ;-)
15013 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15015 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15018 (Constructor.Emit): return if we fail to initialize the
15019 constructor. Another door closed!
15021 * expression.cs (New.DoResolve): Improve error message (from -6 to
15022 1501). Use DeclaredOnly lookup to find the exact constructor.
15024 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15025 loop. This is useful.
15027 * cs-parser.jay: Adjust the default parameters so that destructors
15028 have the proper signature.
15030 2002-04-26 Martin Baulig <martin@gnome.org>
15032 * driver.cs (LoadAssembly): If `assembly' contains any characters
15033 which are only valid in path names and not in assembly names
15034 (currently slash, backslash and point), use Assembly.LoadFrom ()
15035 instead of Assembly.Load () on the `assembly' (before iteration
15036 over the link_paths).
15038 2002-04-26 Martin Baulig <martin@gnome.org>
15040 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15042 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15044 * class.cs (Property): use the new typemanager.MemberLookup
15046 (TypeContainer.MemberLookup): Implement using the
15047 TypeManager.MemberLookup now.
15049 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15050 and return MemberInfos, so that these can be used without an
15051 EmitContext (what we had before).
15053 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15055 * expression.cs: Fix the case where the argument to params if the
15056 type of the params. I omitted handling this before. Fixed
15058 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15060 * driver.cs: Call BootCorlib_PopulateCoreType
15062 * class.cs (Property.CheckBase): Check for properties only, not
15065 * interface.cs: Temporary hack: try/catch around the
15066 CustomAttributeBuilder, because I am getting an exception that I
15069 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15070 types whose definitions are required to be there (attributes are
15071 defined before standard types).
15073 Compute definitions as we boot the various types, as they are used
15074 immediately (value_type class will need object_type, but if we do
15075 not initialize object_type, we will pass a null, which will let
15076 the runtime pick the System.Object from the existing corlib, which
15077 is not what we want).
15079 2002-04-22 Patrik Torstensson <totte@labs2.com>
15081 * cs-tokenizer.cs: fixed a number of trim() issues.
15083 2002-04-22 Ravi Pratap <ravi@ximian.com>
15085 * expression.cs (Argument.Type): Ensure that we return the correct
15086 type when we have out or ref parameters [in which case we
15089 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15091 * class.cs (Property, Indexer): Allow extern modifier in there.
15093 * typemanager.cs (InitBaseTypes): Initializes object_type and
15094 value_type, since those will be used early on during the bootstrap
15095 process to compile corlib.
15097 (InitCoreTypes): Move code from here to InitBaseTypes.
15099 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15101 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15102 single-dimension arrays as using the ldlen opcode.
15104 Daniel Lewis discovered this optimization.
15106 * typemanager.cs: Add signature for System.Array::get_Length
15108 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15110 * statement.cs: report the error when the foreach does not apply to an
15111 array nor a collection.
15113 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15115 * expression.cs: Add implicit conversions to the operator ~.
15117 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15119 * typemanager.cs: Locate the decimal constructor.
15121 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15123 * attribute.cs: use the new property of TypeOf.
15124 * expression.cs: added 'get' property around typearg.
15126 These changes fix a build breaker reported by NickD. Is this the
15127 correct way to fix? If not, please, revert my changes and make it
15130 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15132 * attribute.cs: Add support for typeof in attribute invocations.
15133 I am not sure that this is right though.
15135 2002-04-14 Duncan Mak <duncan@ximian.com>
15137 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15138 Binary.Operator.Division case.
15140 2002-04-13 Ravi Pratap <ravi@ximian.com>
15142 * class.cs (DefineType): Ensure that we do a proper check on
15143 attribute types and also register it with the TypeManager.
15145 (TypeContainer.Targets): The default for attribute types is
15146 AttributeTargets.All.
15148 * attribute.cs (ApplyAttributes): Registering the attribute type
15149 is done elsewhere, not when we discover we have a Usage attribute.
15151 2002-04-12 Ravi Pratap <ravi@ximian.com>
15153 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15154 and get rid of is_delegate parameter.
15156 * everywhere : update.
15158 2002-04-12 Ravi Pratap <ravi@ximian.com>
15160 * cs-parser.jay (compilation_unit): Revamp completely to use
15161 some new ideas that I got from Rhys' grammar to solve the problems
15162 with assembly level attributes.
15164 (outer_declaration): New grammar production.
15166 (attribute_sections): Add.
15168 (opt_attributes): Base on attribute_sections
15170 (namespace_declaration): Allow opt_attributes to tackle the case
15171 when we have assembly level attributes - we are clever in this
15174 * attribute.cs (ApplyAttributes): Do not worry about assembly
15175 attributes in the non-global context.
15177 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15178 instead of SetGlobalAttributes.
15180 * class.cs, rootcontext.cs : Ensure we define and generate
15181 attribute types before anything else.
15183 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15184 and flag the new error -20 for the case when the attribute type
15185 does not have valid targets specified. csc does not catch this.
15187 * ../errors/errors.txt : update for error # -20
15189 2002-04-11 Ravi Pratap <ravi@ximian.com>
15191 * support.cs (InternalParameters.ParameterModifier): Do some null
15192 checking and return sane values.
15194 * class.cs (Method.Define): If we are a PInvoke method, ensure
15195 that we are static and extern. Report error # 601
15197 * ../errors/cs0601.cs : Add test case for the above error.
15199 2002-04-07 Ravi Pratap <ravi@ximian.com>
15201 * rootcontext.cs (attribute_types): We need to keep type of
15202 all attribute types separately and emit code for them first.
15204 (RegisterAttribute) : Implement.
15206 * class.cs (DefineType): Check if the current Type is a custom
15207 attribute type and register it accordingly.
15209 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15210 adding the first attribute twice and rename to
15212 (SetGlobalAttributes): this.
15214 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15217 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15218 if we are processing global arguments. Hmm, I am unsure of this.
15220 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15222 * expression.cs: added static array of strings to avoid calling
15223 Enum.ToString () for Operator in Binary. Significant recover of
15226 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15228 * class.cs (FindMembers): Allow the Builders of the various
15229 members to be null. If they are skip them. This only happens
15230 during the PInvoke declaration.
15232 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15234 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15235 failure, so we do not keep going afterwards.
15237 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15238 wanted to pass `false' as the `is_delegate' argument. If this is
15239 the case, why not use delegate_type == null to mean `is_delegate =
15240 false' and anything else as is_delegate = true.
15242 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15244 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15245 code for the section, not the beginning of the tests.
15247 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15249 * cfold.cs: Handle operator + (Enum x, Underlying x)
15251 * expression.cs (Binary): same. Warn about errors where we have
15252 Enum/Enum in operator + as well.
15254 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15257 - added support for switch(bool)
15258 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15259 - add TableSwitchEmit() to handle table-based switch statements
15261 2002-04-05 Ravi Pratap <ravi@ximian.com>
15263 * expression.cs (Invocation.OverloadResolve): Factor out code which
15264 does parameter compatibility checking with arguments so that we can
15265 re-use the code even from Delegate.VerifyApplicability
15267 (VerifyArgumentsCompat): Move above code here.
15269 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15270 and instead make a call to the above method.
15272 2002-03-31 Ravi Pratap <ravi@ximian.com>
15274 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15275 We use it to keep track of classes which are attribute types.
15277 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15279 * delegate.cs (Delegate.Define): Correctly define the types in the
15280 presence of fixed and array parameters.
15282 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15285 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15286 include NonPublic after the first iteration.
15288 * class.cs (Indexer.CheckBase): Only check if both parents are
15291 * cs-parser.jay (accessor_body): If empty, set to null.
15293 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15294 same code path here to resolve constants names that we did have in
15295 MemberAccess.DoResolve. There is too much code duplicated here.
15297 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15299 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15301 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15304 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15305 tokens, numbers and strings.
15307 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15310 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15311 asyncronous parameters and the regular parameters.
15313 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15314 specify the target directory.
15316 * expression.cs: (This.DoResolve): Simplify
15317 (As.Emit): Optimize, do not generate IsInst if the expression is
15318 always of the given type.
15320 (Is.DoResolve): Bug fix, we were reporting both always/never for
15323 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15324 creating too many unnecessary arrays.
15326 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15328 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15329 fields instead of rolling our own initializer. Takes care of all
15330 implicit conversions, and drops unnecessary static checks/argument.
15332 2002-03-31 Dick Porter <dick@ximian.com>
15334 * driver.cs: use the GetDirectories() return values properly, and
15335 use "/" as path separator.
15337 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15339 * expression.cs (Unary): Optimize - - expr into expr.
15340 (Binary): Optimize a + (-b) into a -b.
15342 * codegen.cs (CodeGen): Made all methods static.
15344 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15348 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15349 TypeBuilder property.
15351 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15354 * tree.cs: Removed the various RecordXXXX, and replaced with a
15355 single RecordDecl. Removed all the accessor methods, and just
15356 left a single access point Type
15358 * enum.cs: Rename DefineEnum to DefineType.
15360 * decl.cs: New abstract method `DefineType' used to unify the
15361 Defines for Enumerations, Interfaces, TypeContainers and
15364 (FindType): Moved LookupInterfaceOrClass here. Moved the
15365 LookupBaseClasses method that used to live in class.cs and
15366 interface.cs here, and renamed to FindType.
15368 * delegate.cs: Implement DefineType. Take advantage of the
15369 refactored pattern for locating the parent builder without taking
15370 the parent_builder argument (which we know does not work if we are
15371 nested, and triggering a toplevel definition).
15373 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15375 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15376 accessibility of a member has changed during override and report
15379 * class.cs (Method.Define, Property.Define): Only complain on
15380 overrides if the method is private, any other accessibility is
15381 fine (and since we just checked the permission is the same, we are
15384 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15385 and elif are processed always. The other pre-processing
15386 directives are only processed if we are "taking" the path
15388 2002-03-29 Martin Baulig <martin@gnome.org>
15390 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15391 current location is not Null.
15393 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15394 a separate method so we can profile it.
15396 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15397 `span.Seconds' are just seconds, but no minutes or hours.
15398 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15400 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15402 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15403 Remove the gratuitous set of Final:
15405 // If an interface implementation, then we can set Final.
15406 if (((flags & MethodAttributes.Abstract) == 0) &&
15407 implementing.DeclaringType.IsInterface)
15408 flags |= MethodAttributes.Final;
15410 I do not know what I was smoking when I used that.
15413 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15414 step into fixing the name resolution issues for delegates and
15415 unifying the toplevel name resolution.
15417 2002-03-28 Martin Baulig <martin@gnome.org>
15419 * class.cs (Method.Emit): If we have a symbol writer, call its
15420 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15421 tell it about the current method.
15423 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15424 writer that we're going to emit the first byte of IL code for a new
15425 statement (a new source line).
15426 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15427 EmitContext.Mark() before emitting any code.
15429 * location.cs (SymbolDocument): Return null when we're Null.
15431 * statement.cs (Statement): Moved the `Location loc' variable here.
15432 (Statement.EmitBoolExpression): If we have a symbol writer, call
15433 ec.Mark() before emitting any code to tell it that we're at the
15434 beginning of a new statement.
15435 (StatementExpression): Added `Location' argument to the constructor.
15436 (Block): Added public readonly variable `StartLocation' and public
15437 variable `EndLocation'. The latter is to be set using SetEndLocation().
15438 (Block): Added constructor which takes a start and end location.
15439 (Block.SetEndLocation): New method. This sets the end location.
15440 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15441 local variables we create.
15442 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15443 each statement and do also mark the begin and end of the block.
15445 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
15446 tell it the current lexer.Location, use Location.Null for the end of the
15448 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
15449 current block, set its end location using SetEndLocation().
15450 (statement_expression): StatementExpression constructor now takes the
15451 lexer.Location as additional argument.
15452 (for_statement, declare_local_variables): Likewise.
15453 (declare_local_variables): When creating a new implicit block, use the
15454 new Block constructor and pass it the lexer.Location.
15456 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15458 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
15459 members also on the parent interfaces recursively.
15461 2002-03-27 Miguel de Icaza <miguel@ximian.com>
15463 * report.cs: Use new formats, since Gonzalo finished the missing
15466 * expression.cs (Binary.ResolveOperator): added missing operator|
15467 operator& and operator^ for bool/bool.
15469 * cs-parser.jay: CheckDef now takes a Location argument that is
15470 used to report errors more precisly (instead of reporting the end
15471 of a definition, we try to track something which is a lot closer
15472 to the source of the problem).
15474 * cs-tokenizer.cs: Track global token use, so we can properly flag
15475 the use of #define/#undef after the first token has been seen.
15477 Also, rename the reportXXXX to Error_DescriptiveName
15479 * decl.cs (DeclSpace.IsTopLevel): Move property here from
15480 TypeContainer, so that Enum and Interface can use this too.
15482 * class.cs (TypeContainer.LookupInterfaceOrClass,
15483 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
15484 `builder' argument. Typically this was used to pass the parent
15485 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
15488 The problem is that a nested class could trigger the definition of
15489 a toplevel class, and the builder would be obviously wrong in that
15492 So we drop this argument, and we compute dynamically the
15493 TypeBuilder/ModuleBuilder (the correct information was available
15494 to us anyways from DeclSpace.Parent)
15496 * interface.cs (Interface.DefineInterface): Drop builder
15497 parameter cleanup like class.cs
15499 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
15502 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
15505 (Try.Emit): Propagate the returns value from the statement.
15507 (Return.Emit): Even if we are leavning
15509 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
15511 * modifiers.cs: Fix the computation of MethodAttributes flags.
15513 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
15515 * driver.cs: allow compilation of files that start with '/'.
15516 Add a default case when checking the argument of --target.
15518 2002-03-25 Miguel de Icaza <miguel@ximian.com>
15520 * interface.cs: Implement the same search algorithm for types in
15521 the interface code.
15523 * delegate.cs: Do not allow multiple definition.
15525 * Recovered ChangeLog that got accidentally amputated
15527 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
15529 * rootcontext.cs: Load manually enum to allow core classes to
15530 contain enumerations.
15532 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
15533 Update to new static methods in TypeManager.
15535 * typemanager.cs (GetMethod, GetConstructor): Use our
15536 implementation of FindMembers to find the members, since during
15537 corlib compilation, the types are TypeBuilders and GetMethod and
15538 GetConstructor do not work.
15540 Make all methods in TypeManager static.
15542 (InitCodeHelpers): Split the functionality from
15543 the InitCodeTypes function.
15545 * driver.cs: Call InitCodeHelpers after we have populated the
15548 * cs-parser.jay (delegate_declaration): we did not used to compute
15549 the delegate name correctly for void delegates.
15551 2002-03-24 Miguel de Icaza <miguel@ximian.com>
15553 * rootcontext.cs (RootContext): Init the interface_resolve_order
15554 and type_container_resolve_order always.
15556 (ResolveCore, BootstrapCorlib_ResolveClass,
15557 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
15558 compiler when compiling with --nostdlib
15560 * class.cs (TypeContainer.DefineType): Check that our parent is
15561 not null. This test is most important when we are bootstraping
15564 * codegen.cs: Split out the symbol writing code.
15566 2002-03-25 Martin Baulig <martin@gnome.org>
15568 * driver.cs (-g): Made -g an alias for --debug.
15570 2002-03-24 Martin Baulig <martin@gnome.org>
15572 * codegen.cs (SymbolWriter): New public variable. Returns the
15573 current symbol writer.
15574 (CodeGen): Added `bool want_debugging_support' argument to the
15575 constructor. If true, tell the ModuleBuild that we want debugging
15576 support and ask it for the ISymbolWriter.
15577 (Save): If we have a symbol writer, call it's Close() method after
15578 saving the assembly.
15580 * driver.c (--debug): New command line argument to create a
15581 debugger information file.
15583 * location.cs (SymbolDocument): New public property. Returns an
15584 ISymbolDocumentWriter object for the current source file or null
15585 if we don't have a symbol writer.
15587 2002-03-21 Miguel de Icaza <miguel@ximian.com>
15589 * driver.cs (LoadAssembly): Correctly return when all the paths
15590 have been tried and not before.
15592 * statement.cs (Switch.Emit): return the actual coverage for this
15593 statement (returns/not-returns)
15595 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
15596 switch of the statement if we are the last switch section. That
15597 kills two problems: try/catch problems (we used to emit an empty
15598 nop at the end) and switch statements where all branches would
15601 2002-03-19 Miguel de Icaza <miguel@ximian.com>
15603 * driver.cs: Add default assemblies (the equivalent to the
15604 Microsoft CSC.RSP file)
15606 * cs-tokenizer.cs: When updating `cols and setting it to zero,
15607 also update tokens_seen and set it to false.
15609 * driver.cs: Implement --recurse for Mike.
15611 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
15612 correctly splitting out the paths.
15614 2002-03-18 Miguel de Icaza <miguel@ximian.com>
15616 * interface.cs (Interface.PopulateProperty): Instead of using
15617 `parent' as the declaration space for the set parameters, use
15620 * support.cs (InternalParameters): InternalParameters constructor
15621 takes a DeclSpace instead of a TypeContainer.
15623 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
15624 types are being initialized, load the address of it before calling
15627 (New): Provide a mechanism to disable the generation of local
15628 value type temporaries when the caller will be providing us with
15629 an address to store it.
15631 (ArrayCreation.EmitDynamicInitializers): Use it.
15633 2002-03-17 Miguel de Icaza <miguel@ximian.com>
15635 * expression.cs (Invocation.EmitArguments): Only probe for array
15636 property if there is more than one argument. Sorry about that.
15638 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
15639 empty param arrays.
15641 * class.cs (Method.LabelParameters): Fix incorrect code path that
15642 prevented the `ParamArrayAttribute' from being applied to the
15645 2002-03-16 Miguel de Icaza <miguel@ximian.com>
15647 * support.cs (ReflectionParameters): Correctly compute whether the
15648 last argument is a params array. Fixes the problem with
15651 * typemanager.cs: Make the assemblies array always be non-null
15652 (empty, but non-null)
15654 * tree.cs (RecordDecl): New function that abstracts the recording
15655 of names. This reports error 101, and provides a pointer to the
15656 previous declaration. Fixes a crash in the compiler.
15658 * cs-parser.jay (constructor_declaration): Update to new grammar,
15659 and provide a constructor_body that can be empty.
15661 2002-03-15 Miguel de Icaza <miguel@ximian.com>
15663 * driver.cs: Add support for --resources.
15665 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
15666 Make all types for the various array helper methods be integer.
15668 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
15669 CheckState to ConvCast.
15671 (ConvCast): Now it takes a `checked' state argument, to avoid
15672 depending on the emit context for the conversion, and just using
15673 the resolve time setting.
15675 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
15676 instead of Invocation.EmitArguments. We do not emit the original
15677 arguments, instead we emit those which have been converted to
15678 unsigned int expressions.
15680 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
15682 * codegen.cs: ditto.
15684 * expression.cs (LocalVariableReference): Drop the use of the
15685 Store function that depended on the variable index.
15687 * statement.cs (VariableInfo): Drop the `Idx' property from this
15688 class, as this is not taking into account the indexes for
15689 temporaries tat we generate during the execution, getting the
15692 * class.cs: First emit class initializers, then call the parent
15695 * expression.cs (Binary): Fix opcode emision.
15696 (UnaryMutator.EmitCode): Support checked code generation
15698 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
15699 matches for events for both the Static and Instance scans,
15700 pointing to the same element. Fix that.
15702 2002-03-14 Miguel de Icaza <miguel@ximian.com>
15704 * rootcontext.cs (ResolveTree): Always set the
15705 interface_resolve_order, because nested interfaces will be calling
15708 * class.cs (GetInterfaceOrClass): Track the same resolution
15709 process used by TypeManager.LookupType. This fixes the nested
15710 type lookups in class declarations (separate path from
15713 (TypeContainer.DefineType): Also define nested interfaces.
15714 (TypeContainer.RegisterOrder): New public function used to
15715 register the order in which child interfaces need to be closed.
15717 Nested interfaces need to be closed after their parents have been
15720 * interface.cs (InterfaceAttr): Put all the logic for computing
15721 the interface attribute here.
15723 (DefineInterface): Register our interface order with the
15724 RootContext or with the TypeContainer depending on the case.
15726 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15728 * cs-parser.jay: rework foreach statement to work with the new
15729 changes to the policy on SimpleNames.
15731 * report.cs: support Stacktrace on warnings as well.
15733 * makefile: drop --unsafe and /unsafe from the compile.
15735 2002-03-13 Ravi Pratap <ravi@ximian.com>
15737 * ecore.cs (StandardConversionExists): Modify to take an Expression
15738 as the first parameter. Ensure we do null -> reference type conversion
15741 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
15742 temporary Expression objects.
15744 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
15746 * interface.cs: workaround bug in method overloading resolution
15747 (there is already a bugzilla bug for it).
15749 2002-03-12 Miguel de Icaza <miguel@ximian.com>
15751 We could also solve this problem by having a separate path for
15752 performing type lookups, instead of DoResolve, we could have a
15753 ResolveType entry point, and only participating pieces of the
15754 production (simplename, deref, array) would implement this.
15756 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
15757 signal SimpleName to only resolve type names and not attempt to
15758 resolve anything else.
15760 * expression.cs (Cast): Set the flag.
15762 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
15764 * class.cs: Only report 108 if there is no `new' modifier.
15766 * cs-parser.jay: rework foreach statement to work with the new
15767 changes to the policy on SimpleNames.
15769 * report.cs: support Stacktrace on warnings as well.
15771 * makefile: drop --unsafe and /unsafe from the compile.
15773 2002-03-11 Miguel de Icaza <miguel@ximian.com>
15775 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15776 lookups here, instead of doing that at parse time. This means
15777 that our grammar will not introduce `LocalVariableReferences' as
15778 expressions at this point. That solves the problem of code like
15782 static void Main ()
15786 This is only half the fix. The full fix requires parameters to
15787 also be handled in this way.
15789 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
15790 makes the use more obvious of the DeclSpace. The
15791 ec.TypeContainer.TypeBuilder is now only used to pull the
15792 TypeBuilder for it.
15794 My theory is that I can get rid of the TypeBuilder completely from
15795 the EmitContext, and have typecasts where it is used (from
15796 DeclSpace to where it matters).
15798 The only pending problem is that the code that implements Aliases
15799 is on TypeContainer, and probably should go in DeclSpace.
15801 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
15802 lookups here, instead of doing that at parse time. This means
15803 that our grammar will not introduce `LocalVariableReferences' as
15804 expressions at this point. That solves the problem of code like
15808 static void Main ()
15812 This is only half the fix. The full fix requires parameters to
15813 also be handled in this way.
15815 * class.cs (Property.DefineMethod): When implementing an interface
15816 method, set newslot, when implementing an abstract method, do not
15817 set the flag (before we tried never setting it, or always setting
15818 it, which is the difference).
15819 (Indexer.DefineMethod): same.
15820 (Method.DefineMethod): same.
15822 * ecore.cs: Only set the status used flag if we get back a Field.
15824 * attribute.cs: Temporary hack, so Paolo can keep working.
15826 2002-03-08 Ravi Pratap <ravi@ximian.com>
15828 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
15829 the unmanaged type in the case we have a MarshalAs attribute.
15831 (Resolve): Handle the case when we are parsing the special MarshalAs
15832 attribute [we need to store the unmanaged type to use later]
15834 * typemanager.cs (marshal_as_attr_type): Built in type for the
15835 MarshalAs Attribute.
15837 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
15838 on parameters and accordingly set the marshalling info.
15840 2002-03-09 Miguel de Icaza <miguel@ximian.com>
15842 * class.cs: Optimizing slightly by removing redundant code after
15843 we switched to the `NoTypes' return value.
15844 (Property.DefineMethod): use NoTypes here too.
15846 This fixes the bug I introduced in my last batch of changes.
15848 2002-03-05 Ravi Pratap <ravi@ximian.com>
15850 * tree.cs (RecordEnum): Add. We now keep track of enums too.
15852 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
15853 Enums since those are types too.
15855 * cs-parser.jay (enum_declaration): Record enums as we parse them.
15857 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
15858 thanks to a call during the lookup process.
15860 2002-03-07 Miguel de Icaza <miguel@ximian.com>
15862 * statement.cs (Foreach): Lots of work to accomodate a particular
15863 kind of foreach statement that I had not kept in mind. It is
15864 possible to have foreachs on classes that provide a GetEnumerator
15865 method that return objects that implement the "pattern" for using
15866 a foreach, there is no need to support GetEnumerator
15869 This is needed to compile nant.
15871 * decl.cs: Only report 114 if the member is not `Finalize' and if
15872 the warning level is at least 2.
15874 * class.cs: Moved the compare function from Method to
15877 (MethodSignature.InheritableMemberSignatureCompare): Add new
15878 filter function that is used to extract inheritable methods from a
15881 (Method.Define): Use the new `inheritable_method_signature_filter'
15884 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
15887 2002-03-06 Miguel de Icaza <miguel@ximian.com>
15889 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
15891 * cs-parser.jay: Add opt_semicolon to the interface declaration.
15893 * expression.cs: Pass location information to
15894 ConvertImplicitStandard.
15896 * class.cs: Added debugging code to track return values from
15899 2002-03-05 Miguel de Icaza <miguel@ximian.com>
15901 * expression.cs (Is.DoResolve): If either side of the `is' is an
15902 interface, do not flag the warning.
15904 * ecore.cs (ImplicitReferenceConversion): We need a separate test
15907 * report.cs: Allow for --fatal to be used with --probe.
15909 * typemanager.cs (NoTypes): Move the definition for the empty Type
15912 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
15914 (TypeContainer.DefineProxy): New function used to proxy to parent
15915 implementations when implementing interfaces.
15916 (TypeContainer.ParentImplements): used to lookup if our parent
15917 implements a public function that is required by an interface.
15918 (TypeContainer.VerifyPendingMethods): Hook this up.
15920 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
15921 `modules' and `assemblies' arraylists into arrays. We only grow
15922 these are the very early start up of the program, so this improves
15923 the speedof LookupType (nicely measured).
15925 * expression.cs (MakeByteBlob): Replaced unsafe code with
15926 BitConverter, as suggested by Paolo.
15928 * cfold.cs (ConstantFold.Binary): Special case: perform constant
15929 folding of string concatenation, but if either side is a string,
15930 and the other is not, then return null, and let the runtime use
15931 the concatenation on the string plus the object (using
15932 `Object.ToString').
15934 2002-03-04 Miguel de Icaza <miguel@ximian.com>
15936 Constant Folding has been implemented now.
15938 * expression.cs (Unary.Reduce): Do not throw an exception, catch
15939 the error instead on types that are not supported in one's
15942 * constant.cs (Constant and all children): New set of functions to
15943 perform implict and explicit conversions.
15945 * ecore.cs (EnumConstant): Implement the new functions to perform
15946 conversion by proxying to the child expression.
15948 * codegen.cs: (ConstantCheckState): Constant evaluation has its
15949 own separate setting that can not be turned off from the command
15950 line using --unchecked or --checked and is only controlled using
15951 the checked/unchecked statements and expressions. This setting is
15952 used by the constant folder to flag errors.
15954 * expression.cs (CheckedExpr, UncheckedExpr): Set the
15955 ConstantCheckState as well.
15957 During Resolve, they also have to flag the state, because the
15958 constant folder runs completely in the Resolve phase.
15960 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
15963 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15965 * cfold.cs: New file, this file contains the constant folder.
15967 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
15968 argument to track whether we are using the resulting address to
15969 load or store a value and provide better error messages.
15971 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
15972 new AddressOf arguments.
15974 * statement.cs (Foreach.EmitCollectionForeach): Update
15976 * expression.cs (Argument.Emit): Call AddressOf with proper
15977 arguments to track usage.
15979 (New.DoEmit): Call AddressOf with new arguments.
15981 (Unary.Emit): Adjust AddressOf call.
15983 2002-03-01 Ravi Pratap <ravi@ximian.com>
15985 * cs-parser.jay (member_access): Change the case for pre-defined types
15986 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
15989 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
15992 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
15993 essentially like methods and apply attributes like MethodImplOptions to them too.
15995 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
15998 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
15999 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16002 * Update code everywhere accordingly.
16004 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16006 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16008 2002-02-28 Ravi Pratap <ravi@ximian.com>
16010 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16011 try performing lookups against those instead of jumping straight into using
16012 the 'using' clauses.
16014 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16016 (LookupType): Perform lookups in implicit parents too.
16018 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16019 sequence as RootContext.LookupType.
16021 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16022 the various cases of namespace lookups into this method.
16024 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16026 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16027 in positional arguments)
16029 * class.cs (Operator): Update the AllowedModifiers to contain
16032 * cs-parser.jay: Update operator declaration to allow for the
16033 operator body to be empty.
16035 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16038 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16040 * class.cs (Method.Emit): Label parameters.
16042 * driver.cs: Return 1 or 0 as the program exit code.
16044 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16046 * expression.cs: Special case the `null' object when trying to
16047 auto-compute the type, as anything can be explicitly converted to
16050 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16051 spotting this Paolo.
16053 (Expression.ImplicitNumericConversion): Perform comparissions of
16054 the type using the underlying type in the case of an enumeration
16055 rather than using the enumeration type for the compare.
16057 Cope with the underlying == type case, which is not possible to
16060 (Expression.ConvertNumericExplicit): Perform comparissions of
16061 the type using the underlying type in the case of an enumeration
16062 rather than using the enumeration type for the compare.
16064 * driver.cs: If the user does not supply an extension, assume .exe
16066 * cs-parser.jay (if_statement): Rewrote so that we can track the
16067 location for the if statement.
16069 * expression.cs (Binary.ConstantFold): Only concat strings when
16070 the operation is "+", not everything ;-)
16072 * statement.cs (Statement.EmitBoolExpression): Take a location
16074 (If, While, Do): Track location.
16076 * expression.cs (Binary.ResolveOperator): In the object + string
16077 case, I was missing a call to ConvertImplicit
16079 2002-02-25 Ravi Pratap <ravi@ximian.com>
16081 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16082 Location arguments. Ensure we use RootContext.LookupType to do our work
16083 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16085 * interface.cs (PopulateMethod): Handle the type of the parameter being
16088 * expression.cs (Invocation.BetterFunction): Handle the case when we
16089 have a params method with no fixed arguments and a call is made with no
16092 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16094 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16095 the verbatim-string-literal
16097 * support.cs (InternalParameters.ParameterModifier): handle null
16099 (InternalParameters.ParameterType): ditto.
16101 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16102 duplicating the name of the variable parameter.
16103 (GetParameterByName): Fix bug where we were not looking up array
16104 paramters if they were the only present (thanks Paolo!).
16105 (GetParameterInfo): We only have an empty set of types if both
16106 fixed and array are set to null.
16107 (GetParameterInfo-idx): Handle FixedParameter == null
16109 * cs-parser.jay: Handle the case where there is no catch
16110 statements (missing null test).
16112 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16114 * driver.cs (MainDriver): Be conservative on our command line
16117 Catch DirectoryNotFoundException when calling GetFiles.
16119 (SplitPathAndPattern): Used to split the input specification into
16120 a path and a pattern that we can feed to Directory.GetFiles.
16122 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16124 * statement.cs (Fixed): Implement the last case of the Fixed
16125 statement (string handling).
16127 * expression.cs (StringPtr): New class used to return a char * to
16128 a string; Used by the Fixed statement.
16130 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16132 * expression.cs (Binary.ResolveOperator): Remove redundant
16133 MemberLookup pn parent type.
16134 Optimize union call, we do not need a union if the types are the same.
16135 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16138 Specialize the use of MemberLookup everywhere, instead of using
16139 the default settings.
16141 (StackAlloc): Implement stackalloc keyword.
16143 * cs-parser.jay: Add rule to parse stackalloc.
16145 * driver.cs: Handle /h, /help, /?
16147 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16148 before we supported unsafe code.
16150 * makefile: add --unsafe to the self compilation of mcs.
16152 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16154 * expression.cs (PointerArithmetic): New class that is used to
16155 perform pointer arithmetic.
16156 (Binary.Resolve): Handle pointer arithmetic
16157 Handle pointer comparission.
16158 (ArrayPtr): Utility expression class that is used to take the
16159 address of an array.
16161 (ElementAccess): Implement array access for pointers
16163 * statement.cs (Fixed): Implement fixed statement for arrays, we
16164 are missing one more case before we are done.
16166 * expression.cs (Indirection): Implement EmitAssign and set the
16167 ExprClass to Variable. This allows pointer dereferences to be
16168 treated as variables, and to have values assigned to them.
16170 * ecore.cs (Expression.StoreFromPtr): New utility function to
16171 store values dereferencing.
16173 2002-02-20 Ravi Pratap <ravi@ximian.com>
16175 * expression.cs (Binary.ResolveOperator): Ensure that we are
16176 not trying to operate on a void type - this fixes the reported
16179 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16180 the parent implementation is sealed.
16182 * ../errors/cs0239.cs : Add.
16184 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16186 * typemanager.cs (unverifiable_code_type): Corresponds to
16187 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16188 which have unsafe code in them.
16190 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16193 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16195 * cs-tokenizer.cs: Add support for @"litreal strings"
16197 Make tokenizer accept pre-processor directives
16198 on any column (remove the old C-like limitation).
16200 * rootcontext.cs (EmitCode): Emit any global attributes.
16201 (AddGlobalAttributes): Used to keep track of assembly attributes.
16203 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16205 * cs-parser.jay: Add support for global attributes.
16207 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16209 * expression.cs (Indirection): New helper class. Unary will
16210 create Indirection classes to be able to implement the
16211 IMemoryLocation interface on it.
16213 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16215 * cs-parser.jay (fixed_statement): reference the right statement.
16217 * statement.cs (Fixed.Emit): Finish implementing the fixed
16218 statement for the &x case.
16220 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16222 * class.cs (Property.Define, Method.Define): Remove newslot when
16225 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16226 wrong. NewSlot should only be used if the `new' keyword is present.
16228 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16229 locating our system dir. Sorry about this.
16231 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16233 * driver.cs (GetSystemDir): Compute correctly the location of our
16234 system assemblies. I was using the compiler directory instead of
16235 the library directory.
16237 2002-02-13 Ravi Pratap <ravi@ximian.com>
16239 * expression.cs (BetterFunction): Put back in what Miguel commented out
16240 since it is the correct fix. The problem is elsewhere ;-)
16242 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16243 parameters of the parms method are themselves compatible or not !
16245 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16246 to check that a class implements an interface before saying that an implicit
16247 conversion was allowed. Use ImplementsInterface to do the checking.
16249 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16251 * class.cs (Method.Define): Track whether we are an explicit
16252 implementation or not. And only call DefineMethodOverride if we
16253 are an explicit implementation.
16255 (Property.DefineMethod): Ditto.
16257 2002-02-11 Ravi Pratap <ravi@ximian.com>
16259 * expression.cs (BetterFunction): Catch hideous bug which was
16260 preventing us from detecting ambiguous calls due to implicit casts i.e
16263 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16265 * support.cs (Pair): Remove un-needed method. I figured why I was
16266 getting the error in cs-parser.jay, the variable in a foreach loop
16267 is readonly, and the compiler does not really treat this as a variable.
16269 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16270 instead of EQUALS in grammar.
16272 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16274 * expression.cs (Unary.DoResolve): Check whether the argument is
16277 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16279 * support.cs: Api for Pair to set a value. Despite the fact that
16280 the variables are public the MS C# compiler refuses to compile
16281 code that accesses the field if the variable is part of a foreach
16284 * statement.cs (Fixed): Begin implementation of the fixed
16287 (Block.AddVariable): Return the VariableInfo on success and null
16288 on failure instead of true/false.
16290 * cs-parser.jay (foreach): Catch errors on variables already
16291 defined (we were ignoring this value before) and properly unwind
16292 the block hierarchy
16294 (fixed_statement): grammar for the fixed statement.
16296 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16298 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16299 pointer types to be incretemented.
16301 (SizeOf): Implement.
16303 * cs-parser.jay (pointer_member_access): Implement
16304 expr->IDENTIFIER production.
16306 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16307 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16310 (Unary): Implement indirection.
16312 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16313 use in non-unsafe context).
16315 (SimpleName.DoResolve): Check for pointers in field access on safe
16318 (Expression.LoadFromPtr): Factor the load-indirect code in this
16319 function. This was duplicated in UnboxCast and ParameterReference
16321 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16323 * expression.cs (ComposedCast): report an error if a pointer cast
16324 is used in a safe region.
16326 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16327 pointer type casts in unsafe context.
16329 * codegen.cs (EmitContext): Set up IsUnsafe.
16331 * cs-parser.jay (non_expression_type): Add productions for pointer
16334 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16335 code. We should not use force into static mode if the method is
16336 not virtual. Fixes bug in MIS
16338 * statement.cs (Do.Emit, While.Emit, For.Emit,
16339 Statement.EmitBoolExpression): Add support to Do and While to
16340 propagate infinite loop as `I do return' semantics.
16342 Improve the For case to also test for boolean constants.
16344 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16345 to the list of attributes we can add.
16347 Remove `EmitContext' argument.
16349 * class.cs (Method.Define): Apply parameter attributes.
16350 (Constructor.Define): Apply parameter attributes.
16351 (MethodCore.LabelParameters): Move here the core of labeling
16354 * support.cs (ReflectionParameters.ParameterModifier,
16355 InternalParameters.ParameterModifier): Use IsByRef on the type and
16356 only return the OUT bit for these parameters instead of in/out/ref
16359 This is because I miss-understood things. The ParameterInfo.IsIn
16360 and IsOut represent whether the parameter has the [In] and [Out]
16363 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16365 * ecore.cs (FieldExpr.Emit): Release temporaries.
16367 * assign.cs (LocalTemporary.Release): new function.
16369 * codegen.cs (EmitContext.GetTemporaryStorage,
16370 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16371 temporary storage. Now we can "put back" localbuilders when we
16374 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16376 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16377 need to make a copy of the variable to generate verifiable code.
16379 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16381 * driver.cs: Compute dynamically the system directory.
16383 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16384 Slower, but more generally useful. Used by the abstract
16385 registering implementation.
16387 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16388 the rules for the special rule on Type/instances. First check if
16389 we have the same name, and if so, try that special static path
16390 rather than the instance path.
16392 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16394 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16397 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16398 Enum, ValueType, Delegate or Array for non-corlib compiles.
16400 * cs-tokenizer.cs: Catch long identifiers (645)
16402 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16405 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16406 fix, we were returning too early, so we were not registering
16407 pending methods from abstract classes.
16409 Do not register pending methods if the class is abstract.
16411 * expression.cs (Conditional.DoResolve): Report circular implicit
16412 conversions when we neecd to compute it for conditional
16415 (Is.DoResolve): If the expression is always of the provided type,
16416 flag warning 183. If the expression can not ever be of the
16417 provided type flag warning 184.
16419 * class.cs: Catch 169 as well.
16421 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16424 2002-01-18 Nick Drochak <ndrochak@gol.com>
16426 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16428 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16430 * interface.cs: (PopulateMethod): Check for pointers being defined
16431 only if the unsafe context is active.
16432 (PopulateProperty): ditto.
16433 (PopulateIndexer): ditto.
16435 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16436 specified. If pointers are present, make sure that they are
16437 present in an unsafe context.
16438 (Constructor, Constructor.Define): ditto.
16439 (Field, Field.Define): ditto.
16440 (Property, Property.Define): ditto.
16441 (Event, Event.Define): ditto.
16443 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
16444 hashtable if there are classes or structs defined.
16446 * expression.cs (LocalVariableReference.DoResolve): Simplify this
16447 code, as the constant resolution moved.
16449 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
16450 the metadata, so we can flag error 133.
16452 * decl.cs (MemberCore.UnsafeOK): New function to test that a
16453 pointer is being declared in an unsafe context.
16455 2002-01-16 Miguel de Icaza <miguel@ximian.com>
16457 * modifiers.cs (Modifiers.Check): Require a Location argument.
16458 Report error 227 for Unsafe use.
16460 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
16462 * statement.cs (For.Emit): If the test is null, then report that
16463 we do `return', as we wont reach anything afterwards.
16465 (Switch.SwitchGoverningType): Track the expression that matched
16468 * driver.cs: Allow negative numbers as an error code to flag.
16470 * cs-parser.jay: Handle 1551.
16472 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
16474 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16476 * cs-parser.jay: Report 1518 (type declaration can only contain
16477 class, struct, interface, enum or delegate)
16479 (switch_label): Report 1523 (keywords `case' or `default' must
16482 (opt_switch_sections): Report 1522 (empty switch)
16484 * driver.cs: Report 1515 (response file specified multiple times)
16485 Report 1516 (Source file specified multiple times).
16487 * expression.cs (Argument.Resolve): Signal 1510
16489 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
16490 access not allowed in static code)
16492 2002-01-11 Ravi Pratap <ravi@ximian.com>
16494 * typemanager.cs (IsPointerType): Utility method which we are going
16497 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
16498 the object type, so we take care of that.
16500 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
16502 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
16503 added to non-params parameters :-)
16505 * typemanager.cs (CSharpName): Include 'void' type too.
16507 (void_ptr_type): Include in the set of core types.
16509 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
16512 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
16515 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
16516 completely forgotten about it.
16518 2002-01-10 Ravi Pratap <ravi@ximian.com>
16520 * cs-parser.jay (pointer_type): Add. This begins our implementation
16521 of parsing rules for unsafe code.
16523 (unsafe_statement): Implement.
16525 (embedded_statement): Modify to include the above.
16527 * statement.cs (Unsafe): Implement new class for unsafe blocks.
16529 * codegen.cs (EmitContext.InUnsafe): Add. This determines
16530 if the current context is an unsafe one.
16532 * cs-parser.jay (local_variable_pointer_type): Since local variable types
16533 are handled differently, we need separate rules for them.
16535 (local_variable_declaration): Update to use local_variable_pointer_type
16536 to allow variable declarations of unmanaged pointer types.
16538 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
16539 in unsafe contexts.
16541 * ../errors/cs0214.cs : Add.
16543 2002-01-16 Nick Drochak <ndrochak@gol.com>
16545 * makefile: remove 'response' file when cleaning.
16547 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16549 * cs-parser.jay: Report 1524.
16551 2002-01-14 Miguel de Icaza <miguel@ximian.com>
16553 * typemanager.cs (RegisterMethod): drop checking if we have
16554 registered this from here
16556 2002-01-12 Miguel de Icaza <miguel@ximian.com>
16558 * class.cs (Method.EmitDestructor): Implement calling our base
16561 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
16562 value of InFinally.
16564 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
16565 this routine and will wrap the call in a try/catch block. Deal
16568 2002-01-11 Miguel de Icaza <miguel@ximian.com>
16570 * ecore.cs (Expression.MemberLookup): instead of taking a
16571 parameter `same_type' that was used to tell whether we could
16572 access private members we compute our containing type from the
16575 (FieldExpr): Added partial support for volatile fields. This does
16576 not work for volatile fields exposed from assemblies, as I can not
16577 figure out how to extract the modreq from it.
16579 Updated all the source files to use this.
16581 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
16582 because it is referenced by MemberLookup very often.
16584 2002-01-09 Ravi Pratap <ravi@ximian.com>
16586 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
16587 TypeBuilder.GetCustomAttributes to retrieve what we need.
16589 Get rid of redundant default_member_attr_type as this is the same as
16590 default_member_type which already exists.
16592 * interface.cs, attribute.cs : Update accordingly.
16594 2002-01-08 Miguel de Icaza <miguel@ximian.com>
16596 * typemanager.cs: Enable IndexerPropertyName again. It does not
16597 work for TYpeBuilders though. Ravi, can you please fix this?
16599 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
16601 * expression.cs (Argument.Emit): Handle the case of ref objects
16602 being passed to ref functions;
16604 (ParameterReference.EmitLoad): Loads the content of the pointer
16605 without dereferencing.
16607 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16609 * cs-tokenizer.cs: Implemented the pre-processing expressions.
16611 2002-01-08 Ravi Pratap <ravi@ximian.com>
16613 * class.cs (Indexer.DefineMethod): Incorporate the interface
16614 type in the name of the method if we are doing explicit interface
16617 * expression.cs (ConversionExists): Remove as it is completely obsolete.
16619 (BetterConversion): Fix extremely trivial bug where we were referring to
16620 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
16623 * ../errors/bug16.cs : Add although we have fixed it.
16625 2002-01-07 Miguel de Icaza <miguel@ximian.com>
16627 * expression.cs (BaseIndexer): Begin implementation.
16629 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
16631 * cs-parser.jay (indexer_declarator): Use qualified_identifier
16632 production directly to remove a shift/reduce, and implement
16633 explicit interface implementation.
16635 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
16636 after a floating point suffix.
16638 * expression.cs (DoNumericPromotions): Improved the conversion for
16639 uint/uint. If we have a constant, we avoid doing a typecast to a
16642 * class.cs (Indexer): Implement explicit interface implementation
16645 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
16647 * class.cs: make the default instance constructor public and hidebysig.
16649 2001-01-03 Ravi Pratap <ravi@ximian.com>
16651 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
16652 so we can call it from elsewhere.
16654 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
16655 we emit it internally if the class has a defined indexer; otherwise the user
16656 emits it by decorating the class definition with the DefaultMemberAttribute.
16658 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
16659 attribute is not used on a type which defines an indexer.
16661 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
16662 character when we skip whitespace.
16664 * ../errors/cs0646.cs : Add.
16666 2002-01-03 Miguel de Icaza <miguel@ximian.com>
16668 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
16671 * makefile: Add practical target `mcs3.exe' which builds the third
16672 generation compiler.
16674 * expression.cs (New): Fix structures constructor calling.
16676 * class.cs (Property, Method, Indexer): Emit Final flag on the
16677 method if we are an interface implementation and we are not
16680 * ecore.cs (PropertyExpr): New public field `IsBase', tells
16681 whether this property is referencing a `base' method.
16683 * expression.cs (Invocation.EmitCall): take an extra argument:
16684 is_base, this is used to determine whether the `call' or
16685 `callvirt' opcode should be used.
16688 * delegate.cs: update EmitCall.
16690 * class.cs (Method.Define): Set NewSlot for the cases where we are
16691 not implementing an interface method.
16693 (Property.Define): ditto.
16695 2002-01-02 Miguel de Icaza <miguel@ximian.com>
16697 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
16698 'r'. Allows mcs to parse itself fully.
16700 2002-01-02 Ravi Pratap <ravi@ximian.com>
16702 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
16703 of the number of initializers that require the InitializeArray method.
16705 (CheckIndices): Store the Expression in all cases - not the plain value. Also
16706 update the above field where necessary.
16708 (MakeByteBlob): Update accordingly.
16710 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
16713 (EmitDynamicInitializers): Update in accordance with the new optimization.
16715 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
16716 same OpCode applies.
16718 * cs-parser.jay : Fix some glaring errors I introduced.
16720 2002-01-01 Ravi Pratap <ravi@ximian.com>
16722 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
16723 so that we can check for name clashes there too.
16725 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
16726 for interface indexers.
16728 * interfaces.cs (Define): Emit the default member attribute.
16730 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
16731 variable was being referred to while setting the value ;-)
16733 2002-01-01 Miguel de Icaza <miguel@ximian.com>
16735 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
16736 byte-by-byte information when we know the data is zero.
16738 Make the block always a multiple of 4, because
16739 DefineInitializedData has a bug.
16741 * assign.cs: Fix, we should assign from the temporary, not from
16744 * expression.cs (MakeByteBlob): Fix my incorrect code.
16746 2001-12-31 Miguel de Icaza <miguel@ximian.com>
16748 * typemanager.cs (EnumToUnderlying): This function is used to get
16749 the underlying type from an enumeration, because it does not
16752 * constant.cs: Use the I4_S form for values between -128 and 127.
16754 * statement.cs (Block.LookupLabel): Looks up a label.
16755 (Block): Drop support for labeled blocks.
16757 (LabeledStatement): New kind of statement that represents a label
16760 (Goto): Finally implement this bad boy.
16762 * cs-parser.jay: Update to reflect new mechanism to implement
16765 2001-12-30 Miguel de Icaza <miguel@ximian.com>
16767 * codegen.cs (EmitContext.This): a codegen property that keeps the
16768 a single instance of this instead of creating many different this
16771 * delegate.cs (Delegate.DoResolve): Update to use the property;
16773 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
16775 * expression.cs (BaseAccess.DoResolve): Ditto.
16777 2001-12-29 Ravi Pratap <ravi@ximian.com>
16779 * typemanager.cs (methodimpl_attr_type): Add to hold the type
16780 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
16782 (InitCoreTypes): Update accordingly.
16784 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
16785 so we can quickly store the state.
16787 (ApplyAttributes): Set the correct implementation flags
16788 for InternalCall methods.
16790 2001-12-29 Miguel de Icaza <miguel@ximian.com>
16792 * expression.cs (EmitCall): if a method is not virtual, then do
16793 not use callvirt on it.
16795 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
16796 user defined stuff) requires the use of stobj, which takes an
16797 address on the stack instead of an array and an index. So emit
16798 the Ldelema operation for it.
16800 (EmitStoreOpcode): Use stobj for valuetypes.
16802 (UnaryMutator.EmitCode): Use the right 1 value depending on
16803 whether we are dealing with int64/uint64, float or doubles.
16805 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
16806 constructors that I implemented last night.
16808 (Constructor.IsDefault): Fix to work properly for static
16811 * cs-parser.jay (CheckDef): report method signature errors.
16812 Update error number 103 to be 132.
16814 * decl.cs: New AdditionResult enumeration value: MethodExists.
16815 Although we do this check for methods later on in the semantic
16816 analysis, catching repeated default constructors is so easy that
16817 we catch these here.
16819 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
16822 (ParameterReference.EmitAssign, Emit): handle
16825 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
16826 (ArrayAccess.EmitStoreOpcode): ditto.
16828 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
16830 * expression.cs (MakeByteBlob): Complete all the missing types
16831 (uint, short, ushort, byte, sbyte)
16833 * class.cs: Only init instance field initializers on instance
16836 Rename `constructors' to instance_constructors.
16838 (TypeContainer.AddConstructor): Only add constructors to the list
16839 if it is not static.
16841 Make sure that we handle default_static_constructor independently
16842 everywhere where we handle instance_constructors
16844 2001-12-28 Miguel de Icaza <miguel@ximian.com>
16846 * class.cs: Do not lookup or create a base initializer for a
16847 static constructor.
16849 (ConstructorInitializer.Resolve): use the proper type to lookup
16852 * cs-parser.jay: Report error 1585 (modifiers between type and name).
16854 * enum.cs, interface.cs: Remove CloseType, this is taken care by
16857 * decl.cs: CloseType is now an virtual method, the default
16858 implementation just closes this type.
16860 2001-12-28 Ravi Pratap <ravi@ximian.com>
16862 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
16863 to PreserveSig by default. Also emit HideBySig on such methods.
16865 Basically, set the defaults to standard values.
16867 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
16868 argument, if candidate is better, it can't be worse than the best !
16870 (Invocation): Re-write bits to differentiate between methods being
16871 applicable in their expanded form and their normal form - for params
16874 Get rid of use_standard everywhere as only standard conversions are allowed
16875 in overload resolution.
16877 More spec conformance.
16879 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16881 * driver.cs: Add --timestamp, to see where the compiler spends
16884 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
16885 `this' in static code.
16887 (SimpleName.DoResolve): Implement in terms of a helper function
16888 that allows static-references to be passed upstream to
16891 (Expression.ResolveWithSimpleName): Resolve specially simple
16892 names when called by MemberAccess to implement the special
16895 (Expression.ImplicitReferenceConversion): Handle conversions from
16896 Null to reference types before others, as Null's type is
16899 * expression.cs (Invocation.EmitCall): Handle the special case of
16900 calling methods declared on a reference type from a ValueType
16901 (Base classes System.Object and System.Enum)
16903 (MemberAccess.Resolve): Only perform lookups on Enumerations if
16904 the left hand side is a TypeExpr, not on every enumeration.
16906 (Binary.Resolve): If types are reference types, then do a cast to
16907 object on operators != and == of both arguments.
16909 * typemanager.cs (FindMembers): Extract instance and static
16910 members if requested.
16912 * interface.cs (PopulateProperty): Use void_type instead of null
16913 as the return type for the setter method.
16915 (PopulateIndexer): ditto.
16917 2001-12-27 Ravi Pratap <ravi@ximian.com>
16919 * support.cs (ReflectionParameters): Fix minor bug where we
16920 were examining the wrong parameter for the ParamArray attribute.
16922 Cope with requests for the type of the parameter at position
16923 greater than the params parameter's. We now return the element
16924 type of the params array as that makes more sense.
16926 * expression.cs (Invocation.IsParamsMethodApplicable): Update
16927 accordingly as we no longer have to extract the element type
16930 (Invocation.OverloadResolve): Update.
16932 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16934 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
16935 against IEnumerator, test whether the return value is a descendant
16936 of the IEnumerator interface.
16938 * class.cs (Indexer.Define): Use an auxiliary method to implement
16939 the other bits of the method definition. Begin support for
16940 explicit interface implementation.
16942 (Property.DefineMethod): Use TypeManager.void_type instead of null
16943 for an empty return value.
16945 2001-12-26 Miguel de Icaza <miguel@ximian.com>
16947 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
16948 dealing with a FieldExpr which is composed of a FieldBuilder, in
16949 the code path we did extract the constant, but we should have
16950 obtained the underlying value to be able to cast it (otherwise we
16951 end up in an infinite loop, this is what Ravi was running into).
16953 (ArrayCreation.UpdateIndices): Arrays might be empty.
16955 (MemberAccess.ResolveMemberAccess): Add support for section
16956 14.5.4.1 that deals with the special case of E.I when E is a type
16957 and something else, that I can be a reference to a static member.
16959 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
16960 handle a particular array type to create byte blobs, it is just
16961 something we dont generate byteblobs for.
16963 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
16966 * location.cs (Push): remove the key from the hashtable that we
16967 are about to add. This happens for empty files.
16969 * driver.cs: Dispose files after we have parsed them.
16971 (tokenize): new function that only runs the tokenizer on its
16972 input, for speed testing.
16974 2001-12-26 Ravi Pratap <ravi@ximian.com>
16976 * class.cs (Event.Define): Define the private field only if there
16977 are no accessors defined.
16979 * expression.cs (ResolveMemberAccess): If there is no associated
16980 field with the event, that means we have an event defined with its
16981 own accessors and we should flag error cs0070 since transforming
16982 ourselves into a field is not valid in that case.
16984 * ecore.cs (SimpleName.DoResolve): Same as above.
16986 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
16987 and charset to sane values.
16989 2001-12-25 Ravi Pratap <ravi@ximian.com>
16991 * assign.cs (DoResolve): Perform check on events only if they
16992 are being accessed outside the declaring type.
16994 * cs-parser.jay (event_declarations): Update rules to correctly
16995 set the type of the implicit parameter etc.
16997 (add_accessor, remove_accessor): Set current local parameters.
16999 * expression.cs (Binary): For delegate addition and subtraction,
17000 cast the return value from the method into the appropriate delegate
17003 2001-12-24 Ravi Pratap <ravi@ximian.com>
17005 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17006 of these as the workaround is unnecessary.
17008 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17009 delegate data - none of that is needed at all.
17011 Re-write bits to extract the instance expression and the delegate method
17014 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17017 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17018 of attaching attributes instead of duplicating code everywhere.
17020 * everywhere : Update code to do attribute emission using the above method.
17022 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17024 * expression.cs (IsParamsMethodApplicable): if there are not
17025 parameters, return immediately.
17027 * ecore.cs: The 0 literal can be implicity converted to an enum
17030 (SimpleName.DoResolve): First lookup the type, then lookup the
17033 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17034 want to get its address. If the InstanceExpression is not
17035 addressable, store the result in a temporary variable, then get
17038 * codegen.cs: Only display 219 errors on warning level or above.
17040 * expression.cs (ArrayAccess): Make it implement the
17041 IMemoryLocation interface.
17043 (Binary.DoResolve): handle the operator == (object a, object b)
17044 and operator != (object a, object b) without incurring into a
17045 BoxedCast (because 5 != o should never be performed).
17047 Handle binary enumerator operators.
17049 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17050 value type, otherwise use Ldelem_ref.
17052 Use precomputed names;
17054 (AddressOf): Implement address of
17056 * cs-parser.jay (labeled_statement): Fix recursive block
17057 addition by reworking the production.
17059 * expression.cs (New.DoEmit): New has a special case:
17061 If we are dealing with a ValueType, we have a few
17062 situations to deal with:
17064 * The target of New is a ValueType variable, that is
17065 easy, we just pass this as the variable reference
17067 * The target of New is being passed as an argument,
17068 to a boxing operation or a function that takes a
17071 In this case, we need to create a temporary variable
17072 that is the argument of New.
17075 2001-12-23 Ravi Pratap <ravi@ximian.com>
17077 * rootcontext.cs (LookupType): Check that current_type is not null before
17078 going about looking at nested types.
17080 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17081 not implement the IAssignMethod interface any more.
17083 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17084 where we tranform them into FieldExprs if they are being resolved from within
17085 the declaring type.
17087 * ecore.cs (SimpleName.DoResolve): Do the same here.
17089 * assign.cs (DoResolve, Emit): Clean up code considerably.
17091 * ../errors/bug10.cs : Add.
17093 * ../errors/cs0070.cs : Add.
17095 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17097 * assign.cs : Get rid of EventIsLocal everywhere.
17099 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17101 * ecore.cs (ConvertIntLiteral): finished the implementation.
17103 * statement.cs (SwitchLabel): Convert the value we are using as a
17104 key before looking up the table.
17106 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17108 * codegen.cs (EmitTopBlock): Require a Location argument now.
17110 * cs-parser.jay (constructor_declarator): We need to setup
17111 current_local_parameters before we parse the
17112 opt_constructor_initializer, to allow the variables to be bound
17113 to the constructor arguments.
17115 * rootcontext.cs (LookupType): First lookup nested classes in our
17116 class and our parents before we go looking outside our class.
17118 * expression.cs (ConstantFold): Extract/debox the values at the
17121 * rootcontext.cs (EmitCode): Resolve the constants first before we
17122 resolve the types. This is not really needed, but it helps debugging.
17124 * statement.cs: report location.
17126 * cs-parser.jay: pass location to throw statement.
17128 * driver.cs: Small bug fix.
17130 * report.cs: Updated format to be 4-zero filled digits.
17132 2001-12-22 Ravi Pratap <ravi@ximian.com>
17134 * expression.cs (CheckIndices): Fix minor bug where the wrong
17135 variable was being referred to ;-)
17137 (DoEmit): Do not call EmitStaticInitializers when the
17138 underlying type is System.Object.
17140 2001-12-21 Ravi Pratap <ravi@ximian.com>
17142 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17143 and do the usual workaround for SRE.
17145 * class.cs (MyEventBuilder.EventType): New member to get at the type
17146 of the event, quickly.
17148 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17150 * assign.cs (Assign.DoResolve): Handle the case when the target
17151 is an EventExpr and perform the necessary checks.
17153 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17156 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17158 (EventExpr): Set the type in the constructor itself since we
17159 are meant to be born fully resolved.
17161 (EventExpr.Define): Revert code I wrote earlier.
17163 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17164 instance expression is null. The instance expression is a This in that case
17165 or a null, depending on whether it is a static method or not.
17167 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17168 refers to more than one method.
17170 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17171 and accordingly flag errors.
17173 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17175 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17177 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17179 * location.cs (ToString): Provide useful rutine.
17181 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17183 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17184 objects, return the actual integral boxed.
17186 * statement.cs (SwitchLabel): define an ILLabel for each
17189 (Switch.CheckSwitch): If the value is a Literal, extract
17190 the underlying literal.
17192 Also in the unused hashtable we had, add the SwitchLabel so we can
17193 quickly look this value up.
17195 * constant.cs: Implement a bunch of new constants. Rewrite
17196 Literal based on this. Made changes everywhere to adapt to this.
17198 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17199 dereferencing array only once, and also copes with enumrations.
17201 bytes are two bytes wide, not one.
17203 (Cast): Perform constant conversions.
17205 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17206 wrappers to the literals here.
17208 * expression.cs (DoNumericPromotions): long literals can converted
17209 to ulong implicity (this is taken care of elsewhere, but I was
17210 missing this spot).
17212 * ecore.cs (Expression.Literalize): Make the return type Literal,
17213 to improve type checking.
17215 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17217 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17219 * literal.cs: Revert code from ravi that checked the bounds. The
17220 bounds are sane by the definition of the type itself.
17222 * typemanager.cs: Fix implementation of ImplementsInterface. We
17223 need to actually look up in our parent hierarchy for interfaces
17226 * const.cs: Use the underlying type for enumerations
17228 * delegate.cs: Compute the basename for the delegate creation,
17229 that should fix the delegate test case, and restore the correct
17230 Type Lookup semantics in rootcontext
17232 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17233 referencing a nested type with the Reflection API is using the "+"
17236 * cs-parser.jay: Do not require EOF token at the end.
17238 2001-12-20 Ravi Pratap <ravi@ximian.com>
17240 * rootcontext.cs (LookupType): Concatenate type names with
17241 a '.' instead of a '+' The test suite passes again.
17243 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17244 field of the enumeration.
17246 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17247 the case when the member is an EventExpr.
17249 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17250 static has an associated instance expression.
17252 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17254 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17256 * class.cs (Event.Define): Register event and perform appropriate checks
17259 We define the Add and Remove methods even if the use provides none because
17260 in that case, we provide default implementations ourselves.
17262 Define a private field of the type of the event. This is done by the CSC compiler
17263 and we should be doing it too ;-)
17265 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17266 More methods we use in code we generate.
17268 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17271 (InitCoreTypes): Update accordingly for the above.
17273 * class.cs (Event.Emit): Generate code for default accessors that we provide
17275 (EmitDefaultMethod): Do the job in the above.
17277 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17280 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17282 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17283 builders even if we were missing one.
17285 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17286 pass the Basename as our class name instead of the Name. The
17287 basename will be correctly composed for us.
17289 * parameter.cs (Paramters): Now takes a Location argument.
17291 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17292 make all the code call directly LookupType in RootContext and take
17293 this chance to pass the Location information everywhere.
17295 * Everywhere: pass Location information.
17297 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17299 * class.cs (Constructor.Define): Updated way of detecting the
17300 length of the parameters.
17302 (TypeContainer.DefineType): Use basename as the type name for
17305 (TypeContainer.Define): Do not recursively define types here, as
17306 definition is taken care in order by the RootContext.
17308 * tree.cs: Keep track of namespaces in a per-file basis.
17310 * parameter.cs (Parameter.ComputeSignature): Update to use
17313 (Parameters.GetSignature): ditto.
17315 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17316 instead of a TypeContainer.
17318 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17319 resolve names. Because we need to be resolve in our context, not
17322 * driver.cs: Implement response files.
17324 * class.cs (TypeContainer.DefineType): If we are defined, do not
17325 redefine ourselves.
17327 (Event.Emit): Emit the code for add/remove handlers.
17328 (Event.Define): Save the MethodBuilders for add/remove.
17330 * typemanager.cs: Use pair here too.
17332 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17333 DictionaryEntry requires the first argument to be non-null.
17335 (enum_declaration): Compute full name for registering the
17338 (delegate_declaration): Instead of using
17339 formal_parameter_list, use opt_formal_parameter_list as the list
17342 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17343 (EventParsing): New property that controls whether `add' and
17344 `remove' are returned as tokens or identifiers (for events);
17346 2001-12-19 Ravi Pratap <ravi@ximian.com>
17348 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17349 use MyEventBuilder only and let it wrap the real builder for us.
17351 (MyEventBuilder): Revamp constructor etc.
17353 Implement all operations that we perform on EventBuilder in precisely the same
17356 (FindMembers): Update to use the EventBuilder member.
17358 (Event.Emit): Update accordingly.
17360 2001-12-18 Ravi Pratap <ravi@ximian.com>
17362 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17363 by calling the appropriate methods.
17365 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17368 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17370 2001-12-17 Ravi Pratap <ravi@ximian.com>
17372 * delegate.cs (Delegate.Populate): Check that the return type
17373 and various parameters types are indeed accessible.
17375 * class.cs (Constructor.Define): Same here.
17377 (Field.Define): Ditto.
17379 (Event.Define): Ditto.
17381 (Operator.Define): Check that the underlying Method defined itself
17382 correctly - so it's MethodBuilder should not be null.
17384 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17385 expression happens to be null.
17387 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17388 members but as of now we don't seem to be able to do anything really useful with it.
17390 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17391 not the EventBuilder.
17393 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17395 * cs-tokenizer.cs: Add support for defines.
17396 Add support for #if, #elif, #else, #endif
17398 (eval_var): evaluates a variable.
17399 (eval): stubbed for evaluating functions.
17401 * cs-parser.jay: Pass the defines information
17403 * driver.cs: Add --define command line option.
17405 * decl.cs: Move MemberCore here.
17407 Make it the base class for DeclSpace. This allows us to catch and
17408 report 108 and 109 for everything now.
17410 * class.cs (TypeContainer.Define): Extract all the members
17411 before populating and emit the warning 108 (new keyword required
17412 to override) instead of having each member implement this.
17414 (MemberCore.Define): New abstract method, we will be using this in
17415 the warning reporting engine in Populate.
17417 (Operator.Define): Adjust to new MemberCore protocol.
17419 * const.cs (Const): This does not derive from Expression, it is a
17420 temporary object we use to create fields, it is a MemberCore.
17422 * class.cs (Method.Define): Allow the entry point to be in a
17425 * driver.cs: Rewrite the argument handler to clean it up a bit.
17427 * rootcontext.cs: Made it just an auxiliary namespace feature by
17428 making everything static.
17430 * driver.cs: Adapt code to use RootContext type name instead of
17433 * delegate.cs: Remove RootContext argument.
17435 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17438 * class.cs (Event.Define): The lookup can fail.
17440 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17442 * expression.cs: Resolve the this instance before invoking the code.
17444 2001-12-17 Miguel de Icaza <miguel@ximian.com>
17446 * cs-parser.jay: Add a production in element_access that allows
17447 the thing to become a "type" reference. This way we can parse
17448 things like "(string [])" as a type.
17450 Note that this still does not handle the more complex rules of
17454 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
17456 * ecore.cs: (CopyNewMethods): new utility function used to
17457 assemble the list of methods from running FindMembers.
17459 (MemberLookup): Rework FindMembers so that
17461 2001-12-16 Miguel de Icaza <miguel@ximian.com>
17463 * class.cs (TypeContainer): Remove Delegates who fail to be
17466 * delegate.cs (Populate): Verify that we dont get null return
17467 values. TODO: Check for AsAccessible.
17469 * cs-parser.jay: Use basename to emit error 574 (destructor should
17470 have the same name as container class), not the full name.
17472 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
17473 possible representation.
17475 Also implements integer type suffixes U and L.
17477 2001-12-15 Miguel de Icaza <miguel@ximian.com>
17479 * expression.cs (ArrayCreation.DoResolve): We need to do the
17480 argument resolution *always*.
17482 * decl.cs: Make this hold the namespace. Hold the root context as
17484 (LookupType): Move here.
17486 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
17488 * location.cs (Row, Name): Fixed the code, it was always returning
17489 references to the first file.
17491 * interface.cs: Register properties defined through interfaces.
17493 * driver.cs: Add support for globbing on the command line
17495 * class.cs (Field): Make it derive from MemberCore as well.
17498 2001-12-15 Ravi Pratap <ravi@ximian.com>
17500 * class.cs (Event::Define): Check that the type of the event is a delegate
17501 type else flag error #66.
17503 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
17506 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
17507 values of EntryPoint, CharSet etc etc.
17509 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
17511 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
17512 be null and we should ignore this. I am not sure if this is really clean. Apparently,
17513 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
17514 which needs this to do its work.
17516 * ../errors/cs0066.cs : Add.
17518 2001-12-14 Miguel de Icaza <miguel@ximian.com>
17520 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
17523 * class.cs: (MethodSignature.MethodSignature): Removed hack that
17524 clears out the parameters field.
17525 (MemberSignatureCompare): Cleanup
17527 (MemberCore): New base class used to share code between MethodCore
17530 (RegisterRequiredImplementations) BindingFlags.Public requires
17531 either BindingFlags.Instace or Static. Use instance here.
17533 (Property): Refactored code to cope better with the full spec.
17535 * parameter.cs (GetParameterInfo): Return an empty array instead
17538 * class.cs (Property): Abstract or extern properties have no bodies.
17540 * parameter.cs (GetParameterInfo): return a zero-sized array.
17542 * class.cs (TypeContainer.MethodModifiersValid): Move all the
17543 method modifier validation to the typecontainer so we can reuse
17544 this on properties.
17546 (MethodCore.ParameterTypes): return an empty sized array of types.
17548 (Property.Define): Test property modifier validity.
17550 Add tests for sealed/override too.
17552 (Method.Emit): abstract or extern methods have no bodies.
17554 2001-12-14 Ravi Pratap <ravi@ximian.com>
17556 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
17559 (Method::Define, ::Emit): Modify accordingly.
17561 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
17563 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
17565 * makefile: Pass in /unsafe.
17567 2001-12-13 Miguel de Icaza <miguel@ximian.com>
17569 * class.cs (MakeKey): Kill routine.
17571 * class.cs (TypeContainer.Define): Correctly define explicit
17572 method implementations (they require the full interface name plus
17575 * typemanager.cs: Deply the PtrHashtable here and stop using the
17576 lame keys. Things work so much better.
17578 This of course broke everyone who depended on `RegisterMethod' to
17579 do the `test for existance' test. This has to be done elsewhere.
17581 * support.cs (PtrHashtable): A hashtable that avoid comparing with
17582 the object stupid Equals method (because, that like fails all over
17583 the place). We still do not use it.
17585 * class.cs (TypeContainer.SetRequiredInterface,
17586 TypeContainer.RequireMethods): Killed these two routines and moved
17587 all the functionality to RegisterRequiredImplementations.
17589 (TypeContainer.RegisterRequiredImplementations): This routine now
17590 registers all the implementations required in an array for the
17591 interfaces and abstract methods. We use an array of structures
17592 which can be computed ahead of time to reduce memory usage and we
17593 also assume that lookups are cheap as most classes will not
17594 implement too many interfaces.
17596 We also avoid creating too many MethodSignatures.
17598 (TypeContainer.IsInterfaceMethod): Update and optionally does not
17599 clear the "pending" bit if we find that there are problems with
17602 (TypeContainer.VerifyPendingMethods): Update to report errors of
17603 methods that look like implementations but are not.
17605 (TypeContainer.Define): Add support for explicit interface method
17608 2001-12-12 Miguel de Icaza <miguel@ximian.com>
17610 * typemanager.cs: Keep track of the parameters here instead of
17611 being a feature of the TypeContainer.
17613 * class.cs: Drop the registration of parameters here, as
17614 InterfaceMethods are also interface declarations.
17616 * delegate.cs: Register methods with the TypeManager not only with
17617 the TypeContainer. This code was buggy.
17619 * interface.cs: Full registation here.
17621 2001-12-11 Miguel de Icaza <miguel@ximian.com>
17623 * expression.cs: Remove reducer for binary expressions, it can not
17626 * const.cs: Put here the code that used to go into constant.cs
17628 * constant.cs: Put here the code for constants, this is a new base
17629 class for Literals.
17631 * literal.cs: Make Literal derive from Constant.
17633 2001-12-09 Miguel de Icaza <miguel@ximian.com>
17635 * statement.cs (Return.Emit): Report error 157 if the user
17636 attempts to return from a finally block.
17638 (Return.Emit): Instead of emitting a return, jump to the end of
17641 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
17642 LocalBuilder to store the result of the function. ReturnLabel is
17643 the target where we jump.
17646 2001-12-09 Radek Doulik <rodo@ximian.com>
17648 * cs-parser.jay: remember alias in current namespace
17650 * ecore.cs (SimpleName::DoResolve): use aliases for types or
17653 * class.cs (LookupAlias): lookup alias in my_namespace
17655 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
17657 (LookupAlias): lookup alias in this and if needed in parent
17660 2001-12-08 Miguel de Icaza <miguel@ximian.com>
17664 * rootcontext.cs: (ModuleBuilder) Made static, first step into
17665 making things static. I need this to avoid passing the
17666 TypeContainer when calling ParameterType.
17668 * support.cs (InternalParameters.ParameterType): Remove ugly hack
17669 that did string manipulation to compute the type and then call
17670 GetType. Use Parameter.ParameterType instead.
17672 * cs-tokenizer.cs: Consume the suffix for floating values.
17674 * expression.cs (ParameterReference): figure out whether this is a
17675 reference parameter or not. Kill an extra variable by computing
17676 the arg_idx during emission.
17678 * parameter.cs (Parameters.GetParameterInfo): New overloaded
17679 function that returns whether a parameter is an out/ref value or not.
17681 (Parameter.ParameterType): The type of the parameter (base,
17682 without ref/out applied).
17684 (Parameter.Resolve): Perform resolution here.
17685 (Parameter.ExternalType): The full type (with ref/out applied).
17687 * statement.cs (Using.Emit, Using.EmitExpression): Implement
17688 support for expressions on the using statement.
17690 2001-12-07 Miguel de Icaza <miguel@ximian.com>
17692 * statement.cs (Using.EmitLocalVariableDecls): Split the
17693 localvariable handling of the using statement.
17695 (Block.EmitMeta): Keep track of variable count across blocks. We
17696 were reusing slots on separate branches of blocks.
17698 (Try.Emit): Emit the general code block, we were not emitting it.
17700 Check the type of the declaration to be an IDisposable or
17701 something that can be implicity converted to it.
17703 Emit conversions if required.
17705 * ecore.cs (EmptyExpression): New utility class.
17706 (Expression.ImplicitConversionExists): New utility function.
17708 2001-12-06 Miguel de Icaza <miguel@ximian.com>
17710 * statement.cs (Using): Implement.
17712 * expression.cs (LocalVariableReference): Support read only variables.
17714 * statement.cs: Remove the explicit emit for the Leave opcode.
17715 (VariableInfo): Add a readonly field.
17717 2001-12-05 Miguel de Icaza <miguel@ximian.com>
17719 * ecore.cs (ConvCast): new class used to encapsulate the various
17720 explicit integer conversions that works in both checked and
17721 unchecked contexts.
17723 (Expression.ConvertNumericExplicit): Use new ConvCast class to
17724 properly generate the overflow opcodes.
17726 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17728 * statement.cs: The correct type for the EmptyExpression is the
17729 element_type, not the variable type. Ravi pointed this out.
17731 2001-12-04 Ravi Pratap <ravi@ximian.com>
17733 * class.cs (Method::Define): Handle PInvoke methods specially
17734 by using DefinePInvokeMethod instead of the usual one.
17736 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
17737 above to do the task of extracting information and defining the method.
17739 2001-12-04 Ravi Pratap <ravi@ximian.com>
17741 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
17742 of the condition for string type.
17744 (Emit): Move that here.
17746 (ArrayCreation::CheckIndices): Keep string literals in their expression
17749 (EmitDynamicInitializers): Handle strings appropriately.
17751 2001-12-04 Miguel de Icaza <miguel@ximian.com>
17753 * codegen.cs (EmitContext): Replace multiple variables with a
17754 single pointer to the current Switch statement.
17756 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
17759 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17763 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
17766 (Foreach.Emit): Foreach on arrays was not setting
17767 up the loop variables (for break/continue).
17769 (GotoCase): Semi-implented.
17771 2001-12-03 Ravi Pratap <ravi@ximian.com>
17773 * attribute.cs (CheckAttribute): Handle system attributes by using
17774 Attribute.GetAttributes to examine information we need.
17776 (GetValidPlaces): Same here.
17778 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
17780 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
17782 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
17784 (Method::Define): Set appropriate flags if we have a DllImport attribute.
17786 (Method::Emit): Handle the case when we are a PInvoke method.
17788 2001-12-03 Miguel de Icaza <miguel@ximian.com>
17790 * expression.cs: Use ResolveWithSimpleName on compound names.
17792 2001-12-02 Ravi Pratap <ravi@ximian.com>
17794 * constant.cs (EmitConstant): Make sure we resolve the associated expression
17795 before trying to reduce it.
17797 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
17799 * constant.cs (LookupConstantValue): Implement.
17801 (EmitConstant): Use the above in emitting the constant.
17803 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
17804 that are user-defined by doing a LookupConstantValue on them.
17806 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
17809 2001-11-29 Miguel de Icaza <miguel@ximian.com>
17811 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
17813 (BaseAccess.DoResolve): Implement.
17815 (MemberAccess.DoResolve): Split this routine into a
17816 ResolveMemberAccess routine that can be used independently
17818 2001-11-28 Miguel de Icaza <miguel@ximian.com>
17820 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
17821 As that share bits of the implementation. Is returns a boolean,
17822 while As returns the Type that is being probed.
17824 2001-12-01 Ravi Pratap <ravi@ximian.com>
17826 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
17827 instead of a Literal - much easier.
17829 (EnumInTransit): Remove - utterly useless :-)
17831 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
17833 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
17835 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
17836 chain when we have no associated expression.
17838 2001-11-30 Ravi Pratap <ravi@ximian.com>
17840 * constant.cs (Define): Use Location while reporting the errror.
17842 Also emit a warning when 'new' is used and there is no inherited
17845 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
17848 (LookupEnumValue): Implement to lookup an enum member's value and define it
17851 (Populate): Re-write accordingly to use the above routine.
17853 2001-11-27 Miguel de Icaza <miguel@ximian.com>
17855 * expression.cs (This): Fix prototype for DoResolveLValue to
17856 override the base class DoResolveLValue.
17858 * cs-parser.cs: Report errors cs574 and cs575 (destructor
17861 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
17862 (we need to load the address of the field here). This fixes
17865 (FieldExpr.DoResolveLValue): Call the DoResolve
17866 function to initialize the Instance expression.
17868 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
17869 correctly the GetEnumerator operation on a value type.
17871 * cs-parser.jay: Add more simple parsing error catches.
17873 * statement.cs (Switch): Add support for string switches.
17874 Handle null specially.
17876 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
17878 2001-11-28 Ravi Pratap <ravi@ximian.com>
17880 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
17882 (declare_local_constant): New helper function.
17884 * statement.cs (AddConstant): Keep a separate record of constants
17886 (IsConstant): Implement to determine if a variable is a constant.
17888 (GetConstantExpression): Implement.
17890 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
17892 * statement.cs (IsVariableDefined): Re-write.
17894 2001-11-27 Ravi Pratap <ravi@ximian.com>
17896 * class.cs (TypeContainer::FindMembers): Look for constants
17897 in the case when we are looking for MemberTypes.Field
17899 * expression.cs (MemberAccess::DoResolve): Check that in the
17900 case we are a FieldExpr and a Literal, we are not being accessed
17901 by an instance reference.
17903 * cs-parser.jay (local_constant_declaration): Implement.
17905 (declaration_statement): Implement for constant declarations.
17907 2001-11-26 Miguel de Icaza <miguel@ximian.com>
17909 * statement.cs (Switch): Catch double defaults.
17911 (Switch): More work on the switch() statement
17912 implementation. It works for integral values now, need to finish
17916 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17918 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
17919 integer literals into other integer literals. To be used by
17922 2001-11-24 Ravi Pratap <ravi@ximian.com>
17924 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
17927 (EmitDynamicInitializers): Cope with the above since we extract data
17928 directly from ArrayData now.
17930 (ExpectInitializers): Keep track of whether initializers are mandatory
17933 (Bounds): Make it a hashtable to prevent the same dimension being
17934 recorded for every element in that dimension.
17936 (EmitDynamicInitializers): Fix bug which prevented the Set array method
17939 Also fix bug which was causing the indices to be emitted in the reverse
17942 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17944 * expression.cs (ArrayCreation): Implement the bits that Ravi left
17945 unfinished. They do not work, because the underlying code is
17948 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17950 * cs-parser.jay: Remove bogus fixme.
17952 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
17953 on Switch statement.
17955 2001-11-23 Ravi Pratap <ravi@ximian.com>
17957 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
17960 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
17961 parameter. Apparently, any expression is allowed.
17963 (ValidateInitializers): Update accordingly.
17965 (CheckIndices): Fix some tricky bugs thanks to recursion.
17967 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
17968 I was being completely brain-dead.
17970 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
17971 and re-write acordingly.
17973 (DelegateInvocation): Re-write accordingly.
17975 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
17977 (MakeByteBlob): Handle types more correctly.
17979 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
17980 initialization from expressions but it is incomplete because I am a complete
17983 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17985 * statement.cs (If.Emit): Fix a bug that generated incorrect code
17986 on If. Basically, we have to return `true' (ie, we do return to
17987 our caller) only if both branches of the if return.
17989 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
17990 short-circuit operators, handle them as short circuit operators.
17992 (Cast.DoResolve): Resolve type.
17993 (Cast.Cast): Take an expression as the target type.
17995 * cs-parser.jay (cast_expression): Remove old hack that only
17996 allowed a limited set of types to be handled. Now we take a
17997 unary_expression and we resolve to a type during semantic
18000 Use the grammar productions from Rhys to handle casts (this is
18001 not complete like Rhys syntax yet, we fail to handle that corner
18002 case that C# has regarding (-x), but we will get there.
18004 2001-11-22 Ravi Pratap <ravi@ximian.com>
18006 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18007 field which is an array type.
18009 * cs-parser.jay (declare_local_variables): Support array initialization too.
18011 * typemanager.cs (MakeKey): Implement.
18013 (everywhere): Use the above appropriately.
18015 * cs-parser.jay (for_statement): Update for array initialization while
18016 declaring variables.
18018 * ecore.cs : The error message was correct, it's the variable's names that
18019 were misleading ;-) Make the code more readable.
18021 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18022 the correct type etc.
18024 (ConvertExplicit): Handle Enum types by examining the underlying type.
18026 2001-11-21 Ravi Pratap <ravi@ximian.com>
18028 * parameter.cs (GetCallingConvention): Always return
18029 CallingConventions.Standard for now.
18031 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18033 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18034 and `r' after calling DoNumericPromotions.
18036 * ecore.cs: Fix error message (the types were in the wrong order).
18038 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18039 BindingFlags.Instance as well
18041 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18042 implicit int literal conversion in an empty cast so that we
18043 propagate the right type upstream.
18045 (UnboxCast): new class used to unbox value types.
18046 (Expression.ConvertExplicit): Add explicit type conversions done
18049 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18050 the target type before applying the implicit LongLiterals to ULong
18053 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18055 * cs-parser.jay (for_statement): Reworked the way For works: now
18056 we declare manually any variables that are introduced in
18057 for_initializer to solve the problem of having out-of-band code
18058 emition (that is what got for broken).
18060 (declaration_statement): Perform the actual variable declaration
18061 that used to be done in local_variable_declaration here.
18063 (local_variable_declaration): Do not declare anything, just pass
18064 the information on a DictionaryEntry
18066 2001-11-20 Ravi Pratap <ravi@ximian.com>
18068 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18069 re-write of the logic to now make it recursive.
18071 (UpdateIndices): Re-write accordingly.
18073 Store element data in a separate ArrayData list in the above methods.
18075 (MakeByteBlob): Implement to dump the array data into a byte array.
18077 2001-11-19 Ravi Pratap <ravi@ximian.com>
18079 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18082 * constant.cs (Define): Implement.
18084 (EmitConstant): Re-write fully.
18086 Pass in location info.
18088 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18091 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18092 DictionaryEntry since we need location info too.
18094 (constant_declaration): Update accordingly.
18096 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18097 code into another method : UpdateIndices.
18099 2001-11-18 Ravi Pratap <ravi@ximian.com>
18101 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18102 some type checking etc.
18104 2001-11-17 Ravi Pratap <ravi@ximian.com>
18106 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18107 bits to provide dimension info if the user skips doing that.
18109 Update second constructor to store the rank correctly.
18111 2001-11-16 Ravi Pratap <ravi@ximian.com>
18113 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18114 and try to implement.
18116 * ../errors/cs0150.cs : Add.
18118 * ../errors/cs0178.cs : Add.
18120 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18122 * statement.cs: Implement foreach on multi-dimensional arrays.
18124 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18125 name of the params argument.
18127 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18128 initializing the array.
18130 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18131 we can use this elsewhere.
18133 * statement.cs: Finish implementation of foreach for single
18136 * cs-parser.jay: Use an out-of-band stack to pass information
18137 around, I wonder why I need this.
18139 foreach_block: Make the new foreach_block the current_block.
18141 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18142 function used to return a static Parameters structure. Used for
18143 empty parameters, as those are created very frequently.
18145 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18147 2001-11-15 Ravi Pratap <ravi@ximian.com>
18149 * interface.cs : Default modifier is private, not public. The
18150 make verify test passes again.
18152 2001-11-15 Ravi Pratap <ravi@ximian.com>
18154 * support.cs (ReflectionParameters): Fix logic to determine
18155 whether the last parameter is a params one. Test 9 passes again.
18157 * delegate.cs (Populate): Register the builders we define with
18158 RegisterParameterForBuilder. Test 19 passes again.
18160 * cs-parser.jay (property_declaration): Reference $6 instead
18161 of $$ to get at the location.
18163 (indexer_declaration): Similar stuff.
18165 (attribute): Ditto.
18167 * class.cs (Property): Register parameters for the Get and Set methods
18168 if they exist. Test 23 passes again.
18170 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18171 call to EmitArguments as we are sure there aren't any params arguments.
18172 Test 32 passes again.
18174 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18175 IndexOutOfRangeException.
18177 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18178 Test 33 now passes again.
18180 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18182 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18183 broke a bunch of things. Will have to come up with a better way
18184 of tracking locations.
18186 * statement.cs: Implemented foreach for single dimension arrays.
18188 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18190 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18191 an error. This removes the lookup from the critical path.
18193 * cs-parser.jay: Removed use of temporary_loc, which is completely
18196 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18198 * support.cs (ReflectionParameters.ParameterModifier): Report
18199 whether the argument is a PARAMS argument or not.
18201 * class.cs: Set the attribute `ParamArrayAttribute' on the
18202 parameter argument.
18204 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18205 and cons_param_array_attribute (ConstructorInfo for
18206 ParamArrayAttribute).,
18208 * codegen.cs: Emit the return using the `Return' statement, that
18209 way we can report the error correctly for missing return values.
18211 * class.cs (Method.Emit): Clean up.
18213 * expression.cs (Argument.Resolve): Take another argument: the
18214 location where this argument is used. Notice that this is not
18215 part of the "Argument" class as to reduce the size of the
18216 structure (we know the approximate location anyways).
18218 Test if the argument is a variable-reference, if not, then
18219 complain with a 206.
18221 (Argument.Emit): Emit addresses of variables.
18223 (Argument.FullDesc): Simplify.
18225 (Invocation.DoResolve): Update for Argument.Resolve.
18227 (ElementAccess.DoResolve): ditto.
18229 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18230 method should be virtual, as this method is always virtual.
18232 (NewDelegate.DoResolve): Update for Argument.Resolve.
18234 * class.cs (ConstructorInitializer.DoResolve): ditto.
18236 * attribute.cs (Attribute.Resolve): ditto.
18238 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18240 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18242 * expression.cs (ParameterReference): Drop IStackStorage and implement
18243 IAssignMethod instead.
18245 (LocalVariableReference): ditto.
18247 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18248 IAssignMethod instead.
18250 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18252 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18253 enumerations that are used in heavily used structures derive from
18254 byte in a laughable and pathetic attempt to reduce memory usage.
18255 This is the kind of pre-optimzations that you should not do at
18256 home without adult supervision.
18258 * expression.cs (UnaryMutator): New class, used to handle ++ and
18259 -- separatedly from the other unary operators. Cleans up the
18260 code, and kills the ExpressionStatement dependency in Unary.
18262 (Unary): Removed `method' and `Arguments' from this class, making
18263 it smaller, and moving it all to SimpleCall, so I can reuse this
18264 code in other locations and avoid creating a lot of transient data
18265 strucutres when not required.
18267 * cs-parser.jay: Adjust for new changes.
18269 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18271 * enum.cs (Enum.Populate): If there is a failure during
18274 * cs-parser.jay (opt_enum_base): we used to catch type errors
18275 here, but this is really incorrect. The type error should be
18276 catched during semantic analysis.
18278 2001-12-11 Ravi Pratap <ravi@ximian.com>
18280 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18281 current_local_parameters as expected since I, in my stupidity, had forgotten
18284 * attribute.cs (GetValidPlaces): Fix stupid bug.
18286 * class.cs (Method::Emit): Perform check on applicability of attributes.
18288 (Constructor::Emit): Ditto.
18290 (Field::Emit): Ditto.
18292 (Field.Location): Store location information.
18294 (Property, Event, Indexer, Operator): Ditto.
18296 * cs-parser.jay (field_declaration): Pass in location for each field.
18298 * ../errors/cs0592.cs : Add.
18300 2001-11-12 Ravi Pratap <ravi@ximian.com>
18302 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18304 (InitCoreTypes): Update accordingly.
18306 (RegisterAttrType, LookupAttr): Implement.
18308 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18309 info about the same.
18311 (Resolve): Update to populate the above as necessary.
18313 (Error592): Helper.
18315 (GetValidPlaces): Helper to the above.
18317 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18319 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18321 2001-11-12 Ravi Pratap <ravi@ximian.com>
18323 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18325 * ../errors/cs0617.cs : Add.
18327 2001-11-11 Ravi Pratap <ravi@ximian.com>
18329 * enum.cs (Emit): Rename to Populate to be more consistent with what
18330 we expect it to do and when exactly it is called.
18332 * class.cs, rootcontext.cs : Update accordingly.
18334 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18335 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18337 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18339 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18340 of a fieldinfo using the above, when dealing with a FieldBuilder.
18342 2001-11-10 Ravi Pratap <ravi@ximian.com>
18344 * ../errors/cs0031.cs : Add.
18346 * ../errors/cs1008.cs : Add.
18348 * ../errrors/cs0543.cs : Add.
18350 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18353 (FindMembers): Implement.
18355 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18356 enums and delegates too.
18358 (enum_types): Rename to builder_to_enum.
18360 (delegate_types): Rename to builder_to_delegate.
18362 * delegate.cs (FindMembers): Implement.
18364 2001-11-09 Ravi Pratap <ravi@ximian.com>
18366 * typemanager.cs (IsEnumType): Implement.
18368 * enum.cs (Emit): Re-write parts to account for the underlying type
18369 better and perform checking etc.
18371 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18372 of the underlying type.
18374 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18377 * enum.cs (error31): Helper to report error #31.
18379 * cs-parser.jay (enum_declaration): Store location of each member too.
18381 * enum.cs (member_to_location): New hashtable.
18383 (AddEnumMember): Update location hashtable.
18385 (Emit): Use the location of each member while reporting errors.
18387 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18389 * cs-parser.jay: A for_initializer if is a
18390 local_variable_declaration really ammount to have an implicit
18391 block with the variable declaration and no initializer for for.
18393 * statement.cs (For.Emit): Cope with null initializers.
18395 This fixes the infinite loop on for initializers.
18397 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18399 * enum.cs: More cleanup.
18401 * ecore.cs: Remove dead code.
18403 * class.cs (Property.Emit): More simplification.
18404 (Event.Emit): ditto.
18406 Reworked to have less levels of indentation.
18408 2001-11-08 Ravi Pratap <ravi@ximian.com>
18410 * class.cs (Property): Emit attributes.
18420 * enum.cs (Emit): Ditto.
18422 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18425 * class.cs (Field, Event, etc.): Move attribute generation into the
18426 Emit method everywhere.
18428 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18429 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18430 as we had no way of defining nested enums !
18432 * rootcontext.cs : Adjust code accordingly.
18434 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18436 2001-11-07 Ravi Pratap <ravi@ximian.com>
18438 * expression.cs (EvalConstantExpression): Move into ecore.cs
18440 * enum.cs (Enum): Rename some members and make them public and readonly
18441 according to our convention.
18443 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
18446 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
18448 (Enum::Emit): Write a simple version for now which doesn't try to compute
18449 expressions. I shall modify this to be more robust in just a while.
18451 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
18453 (TypeContainer::CloseType): Create the Enum types too.
18455 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
18457 * expression.cs (EvalConstantExpression): Get rid of completely.
18459 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
18460 user-defined values and other cases.
18462 (IsValidEnumLiteral): Helper function.
18464 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
18465 out there in the case we had a literal FieldExpr.
18467 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
18469 (Literalize): Revamp a bit to take two arguments.
18471 (EnumLiteral): New class which derives from Literal to wrap enum literals.
18473 2001-11-06 Ravi Pratap <ravi@ximian.com>
18475 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
18477 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
18479 (Resolve): Use the above to ensure we have proper initializers.
18481 2001-11-05 Ravi Pratap <ravi@ximian.com>
18483 * expression.cs (Expression::EvalConstantExpression): New method to
18484 evaluate constant expressions.
18486 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
18488 2001-11-07 Miguel de Icaza <miguel@ximian.com>
18490 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
18493 (Binary.ResolveOperator): Handle operator != (object a, object b)
18494 and operator == (object a, object b);
18496 (Binary.DoNumericPromotions): Indicate whether the numeric
18497 promotion was possible.
18499 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
18502 Made the ArrayAccess implement interface IAssignMethod instead of
18503 IStackStore as the order in which arguments are passed reflects
18506 * assign.cs: Instead of using expr.ExprClass to select the way of
18507 assinging, probe for the IStackStore/IAssignMethod interfaces.
18509 * typemanager.cs: Load InitializeArray definition.
18511 * rootcontext.cs (RootContext.MakeStaticData): Used to define
18512 static data that can be used to initialize arrays.
18514 2001-11-05 Miguel de Icaza <miguel@ximian.com>
18516 * expression.cs: Handle operator== and operator!= for booleans.
18518 (Conditioal.Reduce): Implement reducer for the ?: operator.
18520 (Conditional.Resolve): Implement dead code elimination.
18522 (Binary.Resolve): Catch string literals and return a new
18523 concatenated string.
18525 (Unary.Reduce): Implement reduction of unary expressions.
18527 * ecore.cs: Split out the expression core handling here.
18529 (Expression.Reduce): New method used to perform constant folding
18530 and CSE. This is needed to support constant-expressions.
18532 * statement.cs (Statement.EmitBoolExpression): Pass true and false
18533 targets, and optimize for !x.
18535 2001-11-04 Ravi Pratap <ravi@ximian.com>
18537 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
18538 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
18539 set custom atttributes.
18541 * literal.cs (Literal::GetValue): New abstract method to return the actual
18542 value of the literal, cast as an object.
18544 (*Literal): Implement GetValue method.
18546 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
18547 expressions to the arraylist but objects of type Argument.
18549 * class.cs (TypeContainer::Emit): Emit our attributes too.
18551 (Method::Emit, Constructor::Emit): Ditto.
18553 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
18554 to be ignoring earlier.
18556 2001-11-03 Ravi Pratap <ravi@ximian.com>
18558 * attribute.cs (AttributeSection::Define): Implement to do the business
18559 of constructing a CustomAttributeBuilder.
18561 (Attribute): New trivial class. Increases readability of code.
18563 * cs-parser.jay : Update accordingly.
18565 (positional_argument_list, named_argument_list, named_argument): New rules
18567 (attribute_arguments): Use the above so that we are more correct.
18569 2001-11-02 Ravi Pratap <ravi@ximian.com>
18571 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
18572 to perform all checks for a method with a params parameter.
18574 (Invocation::OverloadResolve): Update to use the above method and therefore
18575 cope correctly with params method invocations.
18577 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
18580 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
18581 constructors in our parent too because we can't afford to miss out on
18584 * attribute.cs (AttributeSection): New name for the class Attribute
18586 Other trivial changes to improve readability.
18588 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
18589 use the new class names.
18591 2001-11-01 Ravi Pratap <ravi@ximian.com>
18593 * class.cs (Method::Define): Complete definition for params types too
18595 (Indexer::Define): Ditto.
18597 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
18598 Cope everywhere with a request for info about the array parameter.
18600 2001-11-01 Ravi Pratap <ravi@ximian.com>
18602 * tree.cs (RecordNamespace): Fix up to check for the correct key.
18604 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
18605 local_variable_type to extract the string corresponding to the type.
18607 (local_variable_type): Fixup the action to use the new helper method.
18609 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
18612 * expression.cs : Clean out code which uses the above.
18614 2001-10-31 Ravi Pratap <ravi@ximian.com>
18616 * typemanager.cs (RegisterMethod): Check if we already have an existing key
18617 and bale out if necessary by returning a false.
18619 (RegisterProperty): Ditto.
18621 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
18622 and print out appropriate error messages.
18624 * interface.cs (everywhere): Ditto.
18626 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
18627 location to constructor.
18629 * class.cs (Property, Event, Indexer): Update accordingly.
18631 * ../errors/cs111.cs : Added.
18633 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
18634 of a method, as laid down by the spec.
18636 (Invocation::OverloadResolve): Use the above method.
18638 2001-10-31 Ravi Pratap <ravi@ximian.com>
18640 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
18641 now take a TypeContainer and a Parameters object.
18643 (ParameterData): Modify return type of ParameterModifier method to be
18644 Parameter.Modifier and not a string.
18646 (ReflectionParameters, InternalParameters): Update accordingly.
18648 * expression.cs (Argument::GetParameterModifier): Same here.
18650 * support.cs (InternalParameters::ParameterType): Find a better way of determining
18651 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
18652 symbol in it at all so maybe this is only for now.
18654 2001-10-30 Ravi Pratap <ravi@ximian.com>
18656 * support.cs (InternalParameters): Constructor now takes an extra argument
18657 which is the actual Parameters class.
18659 (ParameterDesc): Update to provide info on ref/out modifiers.
18661 * class.cs (everywhere): Update call to InternalParameters to pass in
18662 the second argument too.
18664 * support.cs (ParameterData): Add ParameterModifier, which is a method
18665 to return the modifier info [ref/out etc]
18667 (InternalParameters, ReflectionParameters): Implement the above.
18669 * expression.cs (Argument::ParameterModifier): Similar function to return
18670 info about the argument's modifiers.
18672 (Invocation::OverloadResolve): Update to take into account matching modifiers
18675 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
18676 a new SetFormalParameters object which we pass to InternalParameters.
18678 2001-10-30 Ravi Pratap <ravi@ximian.com>
18680 * expression.cs (NewArray): Merge into the ArrayCreation class.
18682 2001-10-29 Ravi Pratap <ravi@ximian.com>
18684 * expression.cs (NewArray): Merge classes NewBuiltinArray and
18685 NewUserdefinedArray into one as there wasn't much of a use in having
18688 * expression.cs (Argument): Change field's name to ArgType from Type.
18690 (Type): New readonly property which returns the proper type, taking into
18691 account ref/out modifiers.
18693 (everywhere): Adjust code accordingly for the above.
18695 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
18696 whether we are emitting for a ref or out parameter.
18698 * expression.cs (Argument::Emit): Use the above field to set the state.
18700 (LocalVariableReference::Emit): Update to honour the flag and emit the
18703 * parameter.cs (Attributes): Set the correct flags for ref parameters.
18705 * expression.cs (Argument::FullDesc): New function to provide a full desc.
18707 * support.cs (ParameterData): Add method ParameterDesc to the interface.
18709 (ReflectionParameters, InternalParameters): Implement the above method.
18711 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
18714 (Invocation::FullMethodDesc): Ditto.
18716 2001-10-29 Miguel de Icaza <miguel@ximian.com>
18718 * cs-parser.jay: Add extra production for the second form of array
18721 * expression.cs (ArrayCreation): Update to reflect the above
18724 * Small changes to prepare for Array initialization.
18726 2001-10-28 Miguel de Icaza <miguel@ximian.com>
18728 * typemanager.cs (ImplementsInterface): interface might be null;
18729 Deal with this problem;
18731 Also, we do store negative hits on the cache (null values), so use
18732 this instead of calling t.GetInterfaces on the type everytime.
18734 2001-10-28 Ravi Pratap <ravi@ximian.com>
18736 * typemanager.cs (IsBuiltinType): New method to help determine the same.
18738 * expression.cs (New::DoResolve): Get rid of array creation code and instead
18739 split functionality out into different classes.
18741 (New::FormArrayType): Move into NewBuiltinArray.
18743 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
18746 (NewBuiltinArray): New class to handle creation of built-in arrays.
18748 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
18749 account creation of one-dimensional arrays.
18751 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
18753 (NewUserdefinedArray::DoResolve): Implement.
18755 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
18757 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
18758 we maintain inside the TypeManager. This is necessary to perform lookups on the
18761 (LookupType): Update to perform GetType on the module builders too.
18763 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
18765 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
18767 2001-10-23 Ravi Pratap <ravi@ximian.com>
18769 * expression.cs (New::DoResolve): Implement guts of array creation.
18771 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
18773 2001-10-27 Miguel de Icaza <miguel@ximian.com>
18775 * expression.cs: Fix bug I introduced lsat night that broke
18778 (Expression.Resolve): Report a 246 error (can not resolve name)
18779 if we find a SimpleName in the stream.
18781 (Expression.ResolveLValue): Ditto.
18783 (Expression.ResolveWithSimpleName): This function is a variant of
18784 ResolveName, this one allows SimpleNames to be returned without a
18785 warning. The only consumer of SimpleNames is MemberAccess
18787 2001-10-26 Miguel de Icaza <miguel@ximian.com>
18789 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
18790 might arrive here. I have my doubts that this is correct.
18792 * statement.cs (Lock): Implement lock statement.
18794 * cs-parser.jay: Small fixes to support `lock' and `using'
18796 * cs-tokenizer.cs: Remove extra space
18798 * driver.cs: New flag --checked, allows to turn on integer math
18801 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
18802 Threading.Monitor.Exit
18804 2001-10-23 Miguel de Icaza <miguel@ximian.com>
18806 * expression.cs (IndexerAccess::DoResolveLValue): Set the
18807 Expression Class to be IndexerAccess.
18809 Notice that Indexer::DoResolve sets the eclass to Value.
18811 2001-10-22 Miguel de Icaza <miguel@ximian.com>
18813 * class.cs (TypeContainer::Emit): Emit code for indexers.
18815 * assign.cs (IAssignMethod): New interface implemented by Indexers
18816 and Properties for handling assignment.
18818 (Assign::Emit): Simplify and reuse code.
18820 * expression.cs (IndexerAccess, PropertyExpr): Implement
18821 IAssignMethod, clean up old code.
18823 2001-10-22 Ravi Pratap <ravi@ximian.com>
18825 * typemanager.cs (ImplementsInterface): New method to determine if a type
18826 implements a given interface. Provides a nice cache too.
18828 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
18831 (ConvertReferenceExplicit): Ditto.
18833 * delegate.cs (Delegate::Populate): Update to define the parameters on the
18834 various methods, with correct names etc.
18836 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
18837 Operator.UnaryNegation.
18839 * cs-parser.jay (operator_declarator): Be a little clever in the case where
18840 we have a unary plus or minus operator.
18842 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
18845 * everywhere : update accordingly.
18847 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
18850 * class.cs (Method::Define): For the case where we are implementing a method
18851 inherited from an interface, we need to set the MethodAttributes.Final flag too.
18852 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
18854 2001-10-21 Ravi Pratap <ravi@ximian.com>
18856 * interface.cs (FindMembers): Implement to work around S.R.E
18859 * typemanager.cs (IsInterfaceType): Implement.
18861 (FindMembers): Update to handle interface types too.
18863 * expression.cs (ImplicitReferenceConversion): Re-write bits which
18864 use IsAssignableFrom as that is not correct - it doesn't work.
18866 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
18867 and accordingly override EmitStatement.
18869 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
18870 using the correct logic :-)
18872 2001-10-19 Ravi Pratap <ravi@ximian.com>
18874 * ../errors/cs-11.cs : Add to demonstrate error -11
18876 2001-10-17 Miguel de Icaza <miguel@ximian.com>
18878 * assign.cs (Assign::Resolve): Resolve right hand side first, and
18879 then pass this as a hint to ResolveLValue.
18881 * expression.cs (FieldExpr): Add Location information
18883 (FieldExpr::LValueResolve): Report assignment to readonly
18886 (Expression::ExprClassFromMemberInfo): Pass location information.
18888 (Expression::ResolveLValue): Add new method that resolves an
18891 (Expression::DoResolveLValue): Default invocation calls
18894 (Indexers): New class used to keep track of indexers in a given
18897 (IStackStore): Renamed from LValue, as it did not really describe
18898 what this did. Also ResolveLValue is gone from this interface and
18899 now is part of Expression.
18901 (ElementAccess): Depending on the element access type
18903 * typemanager.cs: Add `indexer_name_type' as a Core type
18904 (System.Runtime.CompilerServices.IndexerNameAttribute)
18906 * statement.cs (Goto): Take a location.
18908 2001-10-18 Ravi Pratap <ravi@ximian.com>
18910 * delegate.cs (Delegate::VerifyDelegate): New method to verify
18911 if two delegates are compatible.
18913 (NewDelegate::DoResolve): Update to take care of the case when
18914 we instantiate a delegate from another delegate.
18916 * typemanager.cs (FindMembers): Don't even try to look up members
18917 of Delegate types for now.
18919 2001-10-18 Ravi Pratap <ravi@ximian.com>
18921 * delegate.cs (NewDelegate): New class to take care of delegate
18924 * expression.cs (New): Split the delegate related code out into
18925 the NewDelegate class.
18927 * delegate.cs (DelegateInvocation): New class to handle delegate
18930 * expression.cs (Invocation): Split out delegate related code into
18931 the DelegateInvocation class.
18933 2001-10-17 Ravi Pratap <ravi@ximian.com>
18935 * expression.cs (New::DoResolve): Implement delegate creation fully
18936 and according to the spec.
18938 (New::DoEmit): Update to handle delegates differently.
18940 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
18941 because of which we were printing out arguments in reverse order !
18943 * delegate.cs (VerifyMethod): Implement to check if the given method
18944 matches the delegate.
18946 (FullDelegateDesc): Implement.
18948 (VerifyApplicability): Implement.
18950 * expression.cs (Invocation::DoResolve): Update to accordingly handle
18951 delegate invocations too.
18953 (Invocation::Emit): Ditto.
18955 * ../errors/cs1593.cs : Added.
18957 * ../errors/cs1594.cs : Added.
18959 * delegate.cs (InstanceExpression, TargetMethod): New properties.
18961 2001-10-16 Ravi Pratap <ravi@ximian.com>
18963 * typemanager.cs (intptr_type): Core type for System.IntPtr
18965 (InitCoreTypes): Update for the same.
18967 (iasyncresult_type, asynccallback_type): Ditto.
18969 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
18972 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
18975 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
18976 the builders for the 4 members of a delegate type :-)
18978 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
18981 * expression.cs (New::DoResolve): Implement guts for delegate creation.
18983 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
18985 2001-10-15 Miguel de Icaza <miguel@ximian.com>
18987 * statement.cs (Break::Emit): Implement.
18988 (Continue::Emit): Implement.
18990 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
18991 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
18992 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
18993 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
18996 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
18997 properties that track the label for the current loop (begin of the
18998 loop and end of the loop).
19000 2001-10-15 Ravi Pratap <ravi@ximian.com>
19002 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19003 use of emitting anything at all.
19005 * class.cs, rootcontext.cs : Get rid of calls to the same.
19007 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19009 (Populate): Define the constructor correctly and set the implementation
19012 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19015 (AddDelegateType): Implement.
19017 (IsDelegateType): Implement helper method.
19019 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19021 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19022 and accordingly handle it.
19024 * delegate.cs (Populate): Take TypeContainer argument.
19025 Implement bits to define the Invoke method. However, I still haven't figured out
19026 how to take care of the native int bit :-(
19028 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19029 Qualify the name of the delegate, not its return type !
19031 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19034 (StandardConversionExists): Checking for array types turns out to be recursive.
19036 (ConvertReferenceExplicit): Implement array conversion.
19038 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19040 2001-10-12 Ravi Pratap <ravi@ximian.com>
19042 * cs-parser.jay (delegate_declaration): Store the fully qualified
19043 name as it is a type declaration.
19045 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19048 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19049 as TypeContainer::DefineType.
19051 (Populate): Method in which all the definition of the various methods (Invoke)
19054 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19057 (CloseDelegate): Finally creates the delegate.
19059 * class.cs (TypeContainer::DefineType): Update to define delegates.
19060 (Populate, Emit and CloseType): Do the same thing here too.
19062 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19063 delegates in all these operations.
19065 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19067 * expression.cs: LocalTemporary: a new expression used to
19068 reference a temporary that has been created.
19070 * assign.cs: Handle PropertyAccess back here, so that we can
19071 provide the proper semantic access to properties.
19073 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19074 a few more explicit conversions.
19076 * modifiers.cs: `NEW' modifier maps to HideBySig.
19078 * expression.cs (PropertyExpr): Make this into an
19079 ExpressionStatement, and support the EmitStatement code path.
19081 Perform get/set error checking, clean up the interface.
19083 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19084 them into toplevel access objects.
19086 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19088 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19091 * typemanager.cs: Keep track here of our PropertyBuilders again to
19092 work around lameness in SRE.
19094 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19096 * expression.cs (LValue::LValueResolve): New method in the
19097 interface, used to perform a second resolution pass for LValues.
19099 (This::DoResolve): Catch the use of this in static methods.
19101 (This::LValueResolve): Implement.
19103 (This::Store): Remove warning, assigning to `this' in structures
19106 (Invocation::Emit): Deal with invocation of
19107 methods on value types. We need to pass the address to structure
19108 methods rather than the object itself. (The equivalent code to
19109 emit "this" for structures leaves the entire structure on the
19110 stack instead of a pointer to it).
19112 (ParameterReference::DoResolve): Compute the real index for the
19113 argument based on whether the method takes or not a `this' pointer
19114 (ie, the method is static).
19116 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19117 value types returned from functions when we need to invoke a
19118 method on the sturcture.
19121 2001-10-11 Ravi Pratap <ravi@ximian.com>
19123 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19124 defining the type in the Modulebuilder or Typebuilder. This is to take
19125 care of nested types which need to be defined on the TypeBuilder using
19126 DefineNestedMethod.
19128 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19129 methods in RootContext, only ported to be part of TypeContainer.
19131 (TypeContainer::GetInterfaceOrClass): Ditto.
19133 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19135 * interface.cs (Interface::DefineInterface): New method. Does exactly
19136 what RootContext.CreateInterface did earlier, only it takes care of nested types
19139 (Interface::GetInterfaces): Move from RootContext here and port.
19141 (Interface::GetInterfaceByName): Same here.
19143 * rootcontext.cs (ResolveTree): Re-write.
19145 (PopulateTypes): Re-write.
19147 * class.cs (TypeContainer::Populate): Populate nested types too.
19148 (TypeContainer::Emit): Emit nested members too.
19150 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19151 instead just use the name argument passed in as it is already fully
19154 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19155 to TypeContainer mapping to see if a type is user-defined.
19157 * class.cs (TypeContainer::CloseType): Implement.
19159 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19160 the default constructor.
19162 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19165 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19167 * interface.cs (CloseType): Create the type here.
19169 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19172 Remove all the methods which are now in TypeContainer.
19174 2001-10-10 Ravi Pratap <ravi@ximian.com>
19176 * delegate.cs (Define): Re-write bits to define the delegate
19179 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19181 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19183 * expression.cs (ImplicitReferenceConversion): handle null as well
19184 as a source to convert to any reference type.
19186 * statement.cs (Return): Perform any implicit conversions to
19187 expected return type.
19189 Validate use of return statement.
19191 * codegen.cs (EmitContext): Pass the expected return type here.
19193 * class.cs (Method, Constructor, Property): Pass expected return
19194 type to EmitContext.
19196 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19198 * expression.cs: Make DoResolve take an EmitContext instead of a
19201 Replaced `l' and `location' for `loc', for consistency.
19203 (Error, Warning): Remove unneeded Tc argument.
19205 * assign.cs, literal.cs, constant.cs: Update to new calling
19208 * codegen.cs: EmitContext now contains a flag indicating whether
19209 code is being generated in a static method or not.
19211 * cs-parser.jay: DecomposeQI, new function that replaces the old
19212 QualifiedIdentifier. Now we always decompose the assembled
19213 strings from qualified_identifier productions into a group of
19216 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19218 * rootcontext.cs: Deal with field-less struct types correctly now
19219 by passing the size option to Define Type.
19221 * class.cs: Removed hack that created one static field.
19223 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19225 * statement.cs: Moved most of the code generation here.
19227 2001-10-09 Ravi Pratap <ravi@ximian.com>
19229 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19232 (ElementAccess): Remove useless bits for now - keep checks as the spec
19235 2001-10-08 Ravi Pratap <ravi@ximian.com>
19237 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19238 and start performing checks according to the spec.
19240 2001-10-07 Ravi Pratap <ravi@ximian.com>
19242 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19243 rank_specifiers instead.
19245 (rank_specifiers): Change the order in which the rank specifiers are stored
19247 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19249 * expression.cs (ElementAccess): Implement the LValue interface too.
19251 2001-10-06 Ravi Pratap <ravi@ximian.com>
19253 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19254 except that user defined conversions are not included.
19256 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19257 perform the conversion of the return type, if necessary.
19259 (New::DoResolve): Check whether we are creating an array or an object
19260 and accordingly do the needful.
19262 (New::Emit): Same here.
19264 (New::DoResolve): Implement guts of array creation.
19266 (New::FormLookupType): Helper function.
19268 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19270 * codegen.cs: Removed most of the code generation here, and move the
19271 corresponding code generation bits to the statement classes.
19273 Added support for try/catch/finalize and throw.
19275 * cs-parser.jay: Added support for try/catch/finalize.
19277 * class.cs: Catch static methods having the flags override,
19278 virtual or abstract.
19280 * expression.cs (UserCast): This user cast was not really doing
19281 what it was supposed to do. Which is to be born in fully resolved
19282 state. Parts of the resolution were being performed at Emit time!
19286 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19288 * expression.cs: Implicity convert the result from UserCast.
19290 2001-10-05 Ravi Pratap <ravi@ximian.com>
19292 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19293 prevented it from working correctly.
19295 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19296 merely ConvertImplicit.
19298 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19300 * typemanager.cs: Make the LookupTypeContainer function static,
19301 and not per-instance.
19303 * class.cs: Make static FindMembers (the one that takes a Type
19306 * codegen.cs: Add EmitForeach here.
19308 * cs-parser.jay: Make foreach a toplevel object instead of the
19309 inline expansion, as we need to perform semantic analysis on it.
19311 2001-10-05 Ravi Pratap <ravi@ximian.com>
19313 * expression.cs (Expression::ImplicitUserConversion): Rename to
19314 UserDefinedConversion.
19316 (Expression::UserDefinedConversion): Take an extra argument specifying
19317 whether we look for explicit user conversions too.
19319 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19321 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19323 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19324 with the appropriate arguments.
19326 * cs-parser.jay (cast_expression): Record location too.
19328 * expression.cs (Cast): Record location info.
19330 (Expression::ConvertExplicit): Take location argument.
19332 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19333 to determine if we are doing explicit conversions.
19335 (UserCast::Emit): Update accordingly.
19337 (Expression::ConvertExplicit): Report an error if everything fails.
19339 * ../errors/cs0030.cs : Add.
19341 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19343 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19344 virtual and newslot bits.
19346 * class.cs (TypeContainer::RegisterRequiredImplementations):
19347 Record methods we need.
19349 (TypeContainer::MakeKey): Helper function to make keys for
19350 MethodBases, since the Methodbase key is useless.
19352 (TypeContainer::Populate): Call RegisterRequiredImplementations
19353 before defining the methods.
19355 Create a mapping for method_builders_to_methods ahead of time
19356 instead of inside a tight loop.
19358 (::RequireMethods): Accept an object as the data to set into the
19359 hashtable so we can report interface vs abstract method mismatch.
19361 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19363 * report.cs: Make all of it static.
19365 * rootcontext.cs: Drop object_type and value_type computations, as
19366 we have those in the TypeManager anyways.
19368 Drop report instance variable too, now it is a global.
19370 * driver.cs: Use try/catch on command line handling.
19372 Add --probe option to debug the error reporting system with a test
19375 * report.cs: Add support for exiting program when a probe
19376 condition is reached.
19378 2001-10-03 Ravi Pratap <ravi@ximian.com>
19380 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19381 we do a forcible conversion regardless of type, to check if
19382 ForceConversion returns a null.
19384 (Binary::error19): Use location to report error.
19386 (Unary::error23): Use location here too.
19388 * ../errors/cs0019.cs : Check in.
19390 * ../errors/cs0023.cs : Check in.
19392 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19393 case of a non-null MethodInfo object with a length of 0 !
19395 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19396 an applicable member - according to the spec :-)
19397 Also fix logic to find members in base types.
19399 (Unary::ResolveOperator): Same here.
19401 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19402 as I was getting thoroughly confused between this and error19 :-)
19404 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19405 (::FindMostEncompassedType): Implement.
19406 (::FindMostEncompassingType): Implement.
19407 (::StandardConversionExists): Implement.
19409 (UserImplicitCast): Re-vamp. We now need info about most specific
19410 source and target types so that we can do the necessary conversions.
19412 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19413 mathematical union with no duplicates.
19415 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19417 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19418 in order from base classes to child classes, so that we can in
19419 child classes look up in our parent for method names and
19420 attributes (required for handling abstract, virtual, new, override
19421 constructs: we need to instrospect our base class, and if we dont
19422 populate the classes in order, the introspection might be
19423 incorrect. For example, a method could query its parent before
19424 the parent has any methods and would determine that the parent has
19425 no abstract methods (while it could have had them)).
19427 (RootContext::CreateType): Record the order in which we define the
19430 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19432 * class.cs (TypeContainer::Populate): Also method definitions can
19433 fail now, keep track of this.
19435 (TypeContainer::FindMembers): Implement support for
19436 DeclaredOnly/noDeclaredOnly flag.
19438 (Constructor::Emit) Return the ConstructorBuilder.
19440 (Method::Emit) Return the MethodBuilder.
19441 Check for abstract or virtual methods to be public.
19443 * rootcontext.cs (RootContext::CreateType): Register all the
19444 abstract methods required for the class to be complete and the
19445 interface methods that must be implemented.
19447 * cs-parser.jay: Report error 501 (method requires body if it is
19448 not marked abstract or extern).
19450 * expression.cs (TypeOf::Emit): Implement.
19452 * typemanager.cs: runtime_handle_type, new global type.
19454 * class.cs (Property::Emit): Generate code for properties.
19456 2001-10-02 Ravi Pratap <ravi@ximian.com>
19458 * expression.cs (Unary::ResolveOperator): Find operators on base type
19459 too - we now conform exactly to the spec.
19461 (Binary::ResolveOperator): Same here.
19463 * class.cs (Operator::Define): Fix minor quirk in the tests.
19465 * ../errors/cs0215.cs : Added.
19467 * ../errors/cs0556.cs : Added.
19469 * ../errors/cs0555.cs : Added.
19471 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19473 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
19474 single integer which is really efficient
19476 2001-10-01 Ravi Pratap <ravi@ximian.com>
19478 * expression.cs (Expression::ImplicitUserConversion): Use location
19479 even in the case when we are examining True operators.
19481 * class.cs (Operator::Define): Perform extensive checks to conform
19482 with the rules for operator overloading in the spec.
19484 * expression.cs (Expression::ImplicitReferenceConversion): Implement
19485 some of the other conversions mentioned in the spec.
19487 * typemanager.cs (array_type): New static member for the System.Array built-in
19490 (cloneable_interface): For System.ICloneable interface.
19492 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
19493 we start resolving the tree and populating types.
19495 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
19497 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19499 * expression.cs (Expression::ExprClassFromMemberInfo,
19500 Expression::Literalize): Create literal expressions from
19501 FieldInfos which are literals.
19503 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
19504 type casts, because they were wrong. The test suite in tests
19507 (ImplicitNumericConversion): ushort to ulong requires a widening
19510 Int32 constant to long requires widening cast as well.
19512 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
19513 for integers because the type on the stack is not i4.
19515 2001-09-30 Miguel de Icaza <miguel@ximian.com>
19517 * expression.cs (report118): require location argument.
19519 * parameter.cs: Do not dereference potential null value.
19521 * class.cs: Catch methods that lack the `new' keyword when
19522 overriding a name. Report warnings when `new' is used without
19523 anything being there to override.
19525 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
19527 * class.cs: Only add constructor to hashtable if it is non-null
19528 (as now constructors can fail on define).
19530 (TypeManager, Class, Struct): Take location arguments.
19532 Catch field instance initialization in structs as errors.
19534 accepting_filter: a new filter for FindMembers that is static so
19535 that we dont create an instance per invocation.
19537 (Constructor::Define): Catch errors where a struct constructor is
19540 * cs-parser.jay: Pass location information for various new
19543 * delegate.cs (Delegate): take a location argument.
19545 * driver.cs: Do not call EmitCode if there were problesm in the
19546 Definition of the types, as many Builders wont be there.
19548 * decl.cs (Decl::Decl): Require a location argument.
19550 * cs-tokenizer.cs: Handle properly hex constants that can not fit
19551 into integers, and find the most appropiate integer for it.
19553 * literal.cs: Implement ULongLiteral.
19555 * rootcontext.cs: Provide better information about the location of
19556 failure when CreateType fails.
19558 2001-09-29 Miguel de Icaza <miguel@ximian.com>
19560 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
19563 * expression.cs (Binary::CheckShiftArguments): Add missing type
19565 (Binary::ResolveOperator): Add type to the logical and and logical
19566 or, Bitwise And/Or and Exclusive Or code paths, it was missing
19569 (Binary::DoNumericPromotions): In the case where either argument
19570 is ulong (and most signed types combined with ulong cause an
19571 error) perform implicit integer constant conversions as well.
19573 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19575 * expression.cs (UserImplicitCast): Method should always be
19577 (Invocation::BetterConversion): Simplified test for IntLiteral.
19579 (Expression::ImplicitNumericConversion): Split this routine out.
19580 Put the code that performs implicit constant integer conversions
19583 (Expression::Resolve): Become a wrapper around DoResolve so we can
19584 check eclass and type being set after resolve.
19586 (Invocation::Badness): Remove this dead function
19588 (Binary::ResolveOperator): Do not compute the expensive argumnets
19589 unless we have a union for it.
19591 (Probe::Emit): Is needs to do an isinst and then
19592 compare against null.
19594 (::CanConvert): Added Location argument. If the Location argument
19595 is null (Location.Null), then we do not report errors. This is
19596 used by the `probe' mechanism of the Explicit conversion. We do
19597 not want to generate an error for something that the user
19598 explicitly requested to be casted. But the pipeline for an
19599 explicit cast first tests for potential implicit casts.
19601 So for now, if the Location is null, it means `Probe only' to
19602 avoid adding another argument. Might have to revise this
19605 (ClassCast): New class used to type cast objects into arbitrary
19606 classes (used in Explicit Reference Conversions).
19608 Implement `as' as well.
19610 Reverted all the patches from Ravi below: they were broken:
19612 * The use of `level' as a mechanism to stop recursive
19613 invocations is wrong. That was there just to catch the
19614 bug with a strack trace but not as a way of addressing
19617 To fix the problem we have to *understand* what is going
19618 on and the interactions and come up with a plan, not
19619 just get things going.
19621 * The use of the type conversion cache that I proposed
19622 last night had an open topic: How does this work across
19623 protection domains. A user defined conversion might not
19624 be public in the location where we are applying the
19625 conversion, a different conversion might be selected
19626 (ie, private A->B (better) but public B->A (worse),
19627 inside A, A->B applies, but outside it, B->A will
19630 * On top of that (ie, even if the above is solved),
19631 conversions in a cache need to be abstract. Ie, `To
19632 convert from an Int to a Short use an OpcodeCast', not
19633 `To convert from an Int to a Short use the OpcodeCast on
19634 the variable 5' (which is what this patch was doing).
19636 2001-09-28 Ravi Pratap <ravi@ximian.com>
19638 * expression.cs (Invocation::ConversionExists): Re-write to use
19639 the conversion cache
19641 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
19642 cache all conversions done, not just user-defined ones.
19644 (Invocation::BetterConversion): The real culprit. Use ConversionExists
19645 to determine if a conversion exists instead of acutually trying to
19646 perform the conversion. It's faster too.
19648 (Expression::ConvertExplicit): Modify to use ConversionExists to check
19649 and only then attempt the implicit conversion.
19651 2001-09-28 Ravi Pratap <ravi@ximian.com>
19653 * expression.cs (ConvertImplicit): Use a cache for conversions
19654 already found. Check level of recursion and bail out if necessary.
19656 2001-09-28 Miguel de Icaza <miguel@ximian.com>
19658 * typemanager.cs (string_concat_string_string, string_concat_object_object):
19659 Export standard methods that we expect for string operations.
19661 * statement.cs (Block::UsageWarning): Track usage of variables and
19662 report the errors for not used variables.
19664 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
19667 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19669 * codegen.cs: remove unnneded code
19671 * expression.cs: Removed BuiltinTypeAccess class
19673 Fix the order in which implicit conversions are
19676 The previous fixed dropped support for boxed conversions (adding a
19677 test to the test suite now)
19679 (UserImplicitCast::CanConvert): Remove test for source being null,
19680 that code is broken. We should not feed a null to begin with, if
19681 we do, then we should track the bug where the problem originates
19682 and not try to cover it up here.
19684 Return a resolved expression of type UserImplicitCast on success
19685 rather than true/false. Ravi: this is what I was talking about,
19686 the pattern is to use a static method as a "constructor" for
19689 Also, do not create arguments until the very last minute,
19690 otherwise we always create the arguments even for lookups that
19691 will never be performed.
19693 (UserImplicitCast::Resolve): Eliminate, objects of type
19694 UserImplicitCast are born in a fully resolved state.
19696 * typemanager.cs (InitCoreTypes): Init also value_type
19697 (System.ValueType).
19699 * expression.cs (Cast::Resolve): First resolve the child expression.
19701 (LValue): Add new method AddressOf to be used by
19704 Change the argument of Store to take an EmitContext instead of an
19705 ILGenerator, because things like FieldExpr need to be able to call
19706 their children expression to generate the instance code.
19708 (Expression::Error, Expression::Warning): Sugar functions for
19711 (Expression::MemberLookup): Accept a TypeContainer instead of a
19712 Report as the first argument.
19714 (Expression::ResolvePrimary): Killed. I still want to improve
19715 this as currently the code is just not right.
19717 (Expression::ResolveMemberAccess): Simplify, but it is still
19720 (Unary::Resolve): Catch errors in AddressOf operators.
19722 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
19723 index to a byte for the short-version, or the compiler will choose
19724 the wrong Emit call, which generates the wrong data.
19726 (ParameterReference::Emit, ::Store): same.
19728 (FieldExpr::AddressOf): Implement.
19730 * typemanager.cs: TypeManager: made public variable instead of
19733 * driver.cs: document --fatal.
19735 * report.cs (ErrorMessage, WarningMessage): new names for the old
19736 Error and Warning classes.
19738 * cs-parser.jay (member_access): Turn built-in access to types
19739 into a normal simplename
19741 2001-09-27 Ravi Pratap <ravi@ximian.com>
19743 * expression.cs (Invocation::BetterConversion): Fix to cope
19744 with q being null, since this was introducing a bug.
19746 * expression.cs (ConvertImplicit): Do built-in conversions first.
19748 2001-09-27 Ravi Pratap <ravi@ximian.com>
19750 * expression.cs (UserImplicitCast::Resolve): Fix bug.
19752 2001-09-27 Ravi Pratap <ravi@ximian.com>
19754 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
19755 I had introduced long ago (what's new ?).
19757 * expression.cs (UserImplicitCast::CanConvert): Static method to do
19758 the work of all the checking.
19759 (ConvertImplicit): Call CanConvert and only then create object if necessary.
19760 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
19762 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
19763 that is the right way.
19765 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
19766 overloading resolution. Use everywhere instead of cutting and pasting code.
19768 (Binary::ResolveOperator): Use MakeUnionSet.
19770 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
19771 we have to convert to bool types. Not complete yet.
19773 2001-09-27 Miguel de Icaza <miguel@ximian.com>
19775 * typemanager.cs (TypeManager::CSharpName): support ushort.
19777 * expression.cs (Expression::TryImplicitIntConversion): Attempts
19778 to provide an expression that performsn an implicit constant int
19779 conversion (section 6.1.6).
19780 (Expression::ConvertImplicitRequired): Reworked to include
19781 implicit constant expression conversions.
19783 (Expression::ConvertNumericExplicit): Finished.
19785 (Invocation::Emit): If InstanceExpression is null, then it means
19786 that we perform a call on this.
19788 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19790 * expression.cs (Unary::Emit): Remove some dead code.
19791 (Probe): Implement Resolve and Emit for `is'.
19792 (Expression::ConvertImplicitRequired): Attempt to do constant
19793 expression conversions here. Maybe should be moved to
19794 ConvertImplicit, but I am not sure.
19795 (Expression::ImplicitLongConstantConversionPossible,
19796 Expression::ImplicitIntConstantConversionPossible): New functions
19797 that tell whether is it possible to apply an implicit constant
19798 expression conversion.
19800 (ConvertNumericExplicit): Started work on explicit numeric
19803 * cs-parser.jay: Update operator constants.
19805 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
19806 (Parameters::GetSignature): Hook up VerifyArgs here.
19807 (Parameters::VerifyArgs): Verifies that no two arguments have the
19810 * class.cs (Operator): Update the operator names to reflect the
19811 ones that the spec expects (as we are just stringizing the
19814 * expression.cs (Unary::ResolveOperator): Fix bug: Use
19815 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
19816 previous usage did only work for our methods.
19817 (Expression::ConvertImplicit): Handle decimal implicit numeric
19818 conversions as well.
19819 (Expression::InternalTypeConstructor): Used to invoke constructors
19820 on internal types for default promotions.
19822 (Unary::Emit): Implement special handling for the pre/post
19823 increment/decrement for overloaded operators, as they need to have
19824 the same semantics as the other operators.
19826 (Binary::ResolveOperator): ditto.
19827 (Invocation::ConversionExists): ditto.
19828 (UserImplicitCast::Resolve): ditto.
19830 2001-09-26 Ravi Pratap <ravi@ximian.com>
19832 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
19833 operator, return after emitting body. Regression tests pass again !
19835 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
19836 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
19837 (Invocation::OverloadResolve): Ditto.
19838 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
19840 * everywhere : update calls to the above methods accordingly.
19842 2001-09-26 Miguel de Icaza <miguel@ximian.com>
19844 * assign.cs (Assign): Make it inherit from ExpressionStatement.
19846 * expression.cs (ExpressionStatement): New base class used for
19847 expressions that can appear in statements, so that we can provide
19848 an alternate path to generate expression that do not leave a value
19851 (Expression::Emit, and all the derivatives): We no longer return
19852 whether a value is left on the stack or not. Every expression
19853 after being emitted leaves a single value on the stack.
19855 * codegen.cs (EmitContext::EmitStatementExpression): Use the
19856 facilties of ExpressionStatement if possible.
19858 * cs-parser.jay: Update statement_expression.
19860 2001-09-25 Miguel de Icaza <miguel@ximian.com>
19862 * driver.cs: Change the wording of message
19864 2001-09-25 Ravi Pratap <ravi@ximian.com>
19866 * expression.cs (Binary::ResolveOperator): Had forgottten to set
19867 the type of the expression to the return type of the method if
19868 we have an overloaded operator match ! The regression tests pass again !
19869 (Unary::ResolveOperator): Ditto.
19871 * expression.cs (Invocation::ConversionExists): Correct the member lookup
19872 to find "op_Implicit", not "implicit" ;-)
19873 (UserImplicitCast): New class to take care of user-defined implicit conversions.
19874 (ConvertImplicit, ForceConversion): Take TypeContainer argument
19876 * everywhere : Correct calls to the above accordingly.
19878 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
19879 (ConvertImplicit): Do user-defined conversion if it exists.
19881 2001-09-24 Miguel de Icaza <miguel@ximian.com>
19883 * assign.cs: track location.
19884 (Resolve): Use implicit conversions on assignment.
19886 * literal.cs: Oops. Not good, Emit of short access values should
19887 pass (Bytes) or the wrong argument will be selected.
19889 * expression.cs (Unary::Emit): Emit code for -expr.
19891 (Unary::ResolveOperator): Handle `Substract' for non-constants
19892 (substract from zero from the non-constants).
19893 Deal with Doubles as well.
19895 (Expression::ConvertImplicitRequired): New routine that reports an
19896 error if no implicit conversion exists.
19898 (Invocation::OverloadResolve): Store the converted implicit
19899 expressions if we make them
19901 2001-09-24 Ravi Pratap <ravi@ximian.com>
19903 * class.cs (ConstructorInitializer): Take a Location argument.
19904 (ConstructorBaseInitializer): Same here.
19905 (ConstructorThisInitializer): Same here.
19907 * cs-parser.jay : Update all calls accordingly.
19909 * expression.cs (Unary, Binary, New): Take location argument.
19910 Update accordingly everywhere.
19912 * cs-parser.jay : Update all calls to the above to take a location
19915 * class.cs : Ditto.
19917 2001-09-24 Ravi Pratap <ravi@ximian.com>
19919 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
19920 (Invocation::BetterConversion): Same here
19921 (Invocation::ConversionExists): Ditto.
19923 (Invocation::ConversionExists): Implement.
19925 2001-09-22 Ravi Pratap <ravi@ximian.com>
19927 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
19928 Also take an additional TypeContainer argument.
19930 * All over : Pass in TypeContainer as argument to OverloadResolve.
19932 * typemanager.cs (CSharpName): Update to check for the string type and return
19935 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
19938 2001-09-21 Ravi Pratap <ravi@ximian.com>
19940 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
19941 (Invocation::BetterFunction): Implement.
19942 (Invocation::BetterConversion): Implement.
19943 (Invocation::ConversionExists): Skeleton, no implementation yet.
19945 Okay, things work fine !
19947 2001-09-21 Miguel de Icaza <miguel@ximian.com>
19949 * typemanager.cs: declare and load enum_type, delegate_type and
19952 * expression.cs (Expression::Emit): Now emit returns a value that
19953 tells whether a value is left on the stack or not. This strategy
19954 might be reveted tomorrow with a mechanism that would address
19955 multiple assignments.
19956 (Expression::report118): Utility routine to report mismatches on
19959 (Unary::Report23): Report impossible type/operator combination
19962 (Unary::IsIncrementableNumber): Whether the type can be
19963 incremented or decremented with add.
19964 (Unary::ResolveOperator): Also allow enumerations to be bitwise
19966 (Unary::ResolveOperator): Implement ++, !, ~,
19968 (Invocation::Emit): Deal with new Emit convetion.
19970 * All Expression derivatives: Updated their Emit method to return
19971 whether they leave values on the stack or not.
19973 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
19974 stack for expressions that are statements.
19976 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19978 * expression.cs (LValue): New interface. Must be implemented by
19980 (LocalVariableReference, ParameterReference, FieldExpr): Implement
19983 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
19984 interface for generating code, simplifies the code.
19986 2001-09-20 Ravi Pratap <ravi@ximian.com>
19988 * expression.cs (everywhere): Comment out return statements in ::Resolve
19989 methods to avoid the warnings.
19991 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19993 * driver.cs (parse): Report error 2001 if we can not open the
19996 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
19999 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20002 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20003 otherwise nested blocks end up with the same index.
20005 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20007 * expression.cs: Instead of having FIXMEs in the Resolve
20008 functions, throw exceptions so it is obvious that we are facing a
20011 * cs-parser.jay (invocation_expression): Pass Location information.
20013 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20014 Use a basename for those routines because .NET does not like paths
20017 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20020 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20022 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20023 are loading the correct data types (throws an exception if not).
20024 (TypeManager::InitCoreTypes): Use CoreLookupType
20026 * expression.cs (Unary::ResolveOperator): return the child
20027 expression for expressions which are just +expr.
20028 (Unary::ResolveOperator): Return negative literals for -LITERAL
20029 expressions (otherwise they are Unary {Literal}).
20030 (Invocation::Badness): Take into account `Implicit constant
20031 expression conversions'.
20033 * literal.cs (LongLiteral): Implement long literal class.
20034 (IntLiteral): export the `Value' of the intliteral.
20036 2001-09-19 Ravi Pratap <ravi@ximian.com>
20038 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20040 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20041 instead of 'Operator'
20043 * expression.cs (Binary::ResolveOperator): Update accordingly.
20044 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20047 * cs-parser.jay (unary_expression): Update to use the new names.
20049 * gen-treedump.cs (GetUnary): Same here.
20051 * expression.cs (Unary::Resolve): Implement.
20052 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20053 operators are found instead of making noise ;-)
20054 (Unary::ResolveOperator): New method to do precisely the same thing which
20055 Binary::ResolveOperator does for Binary expressions.
20056 (Unary.method, .Arguments): Add.
20057 (Unary::OperName): Implement.
20058 (Unary::ForceConversion): Copy and Paste !
20060 * class.cs (Operator::Define): Fix a small bug for the case when we have
20063 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20064 for the inbuilt operators. Only overloading works for now ;-)
20066 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20068 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20069 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20071 * expression.cs (This::Emit): Implement.
20072 (This::Resolve): Implement.
20073 (TypeOf:Resolve): Implement.
20074 (Expression::ResolveSimpleName): Add an implicit this to instance
20076 (MemberAccess::Resolve): Deal with Parameters and Fields.
20077 Bind instance variable to Field expressions.
20078 (FieldExpr::Instance): New field used to track the expression that
20079 represents the object instance.
20080 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20082 (FieldExpr::Emit): Implement.
20084 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20085 the last instruction contains a return opcode to avoid generating
20086 the last `ret' instruction (this generates correct code, and it is
20087 nice to pass the peverify output).
20089 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20090 initializer for static and instance variables.
20091 (Constructor::Emit): Allow initializer to be null in the case of
20092 static constructors. Only emit initializer for instance
20095 (TypeContainer::FindMembers): Return a null array if there are no
20098 Also fix the code for the MemberTypes.Method branch, as it was not
20099 scanning that for operators (or tried to access null variables before).
20101 * assign.cs (Assign::Emit): Handle instance and static fields.
20105 * driver.cs: Stop compilation if there are parse errors.
20107 * cs-parser.jay (constructor_declaration): Provide default base
20108 initializer for non-static constructors.
20109 (constructor_declarator): Do not provide a default base
20110 initializers if none was specified.
20111 Catch the fact that constructors should not have parameters.
20113 * class.cs: Do not emit parent class initializers for static
20114 constructors, that should be flagged as an error.
20116 2001-09-18 Ravi Pratap <ravi@ximian.com>
20118 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20119 Move back code into TypeContainer::Populate.
20121 2001-09-18 Ravi Pratap <ravi@ximian.com>
20123 * class.cs (TypeContainer::AddConstructor): Fix the check to
20124 compare against Name, not Basename.
20125 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20127 * cs-parser.jay : Update accordingly.
20129 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20130 for methods, don't forget to look into the operators too.
20131 (RegisterMethodBuilder): Helper method to take care of this for
20132 methods, constructors and operators.
20133 (Operator::Define): Completely revamp.
20134 (Operator.OperatorMethod, MethodName): New fields.
20135 (TypeContainer::Populate): Move the registering of builders into
20136 RegisterMethodBuilder.
20137 (Operator::Emit): Re-write.
20139 * expression.cs (Binary::Emit): Comment out code path to emit method
20140 invocation stuff for the case when we have a user defined operator. I am
20141 just not able to get it right !
20143 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20145 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20148 (Expression::MemberLookup): Provide a version that allows to
20149 specify the MemberTypes and BindingFlags.
20151 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20152 so it was not fetching variable information from outer blocks.
20154 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20155 Beforefieldinit as it was buggy.
20157 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20158 that Ravi put here.
20160 * class.cs (Constructor::Emit): Only emit if block is not null.
20161 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20162 deal with this by semantically definining it as if the user had
20165 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20166 constructors as we now "emit" them at a higher level.
20168 (TypeContainer::DefineDefaultConstructor): Used to define the
20169 default constructors if none was provided.
20171 (ConstructorInitializer): Add methods Resolve and Emit.
20173 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20175 2001-09-17 Ravi Pratap <ravi@ximian.com>
20177 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20178 the default constructor builder with our hashtable for methodbuilders
20181 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20182 and argument_count is 0 in which case we have a match.
20183 (Binary::ResolveOperator): More null checking and miscellaneous coding
20186 2001-09-17 Ravi Pratap <ravi@ximian.com>
20188 * rootcontext.cs (IsNameSpace): Compare against null.
20190 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20192 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20193 and Unary::Operator.
20195 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20198 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20199 we have overloaded operators.
20200 (Binary::ResolveOperator): Implement the part which does the operator overload
20203 * class.cs (Operator::Emit): Implement.
20204 (TypeContainer::Emit): Emit the operators we have too.
20206 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20207 the case when we have a user-defined operator.
20209 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20211 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20213 2001-09-16 Ravi Pratap <ravi@ximian.com>
20215 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20216 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20217 (Constructor::Emit): Implement.
20218 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20219 if we have no work to do.
20220 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20223 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20224 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20226 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20229 2001-09-15 Ravi Pratap <ravi@ximian.com>
20231 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20233 (Tree::RecordNamespace): Method to do what the name says ;-)
20234 (Tree::Namespaces): Property to get at the namespaces hashtable.
20236 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20239 * rootcontext.cs (IsNamespace): Fixed it :-)
20241 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20243 * class.cs (TypeContainer::FindMembers): Add support for
20245 (MethodCore): New class that encapsulates both the shared aspects
20246 of a Constructor and a Method.
20247 (Method, Constructor): Factored pieces into MethodCore.
20249 * driver.cs: Added --fatal which makes errors throw exceptions.
20250 Load System assembly as well as part of the standard library.
20252 * report.cs: Allow throwing exceptions on errors for debugging.
20254 * modifiers.cs: Do not use `parent', instead use the real type
20255 container to evaluate permission settings.
20257 * class.cs: Put Ravi's patch back in. He is right, and we will
20258 have to cope with the
20260 2001-09-14 Ravi Pratap <ravi@ximian.com>
20262 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20263 FamORAssem, not FamANDAssem.
20265 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20267 * driver.cs: Added --parse option that only parses its input files
20270 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20271 incorrect. IsTopLevel is not used to tell whether an object is
20272 root_types or not (that can be achieved by testing this ==
20273 root_types). But to see if this is a top-level *class* (not
20274 necessarly our "toplevel" container).
20276 2001-09-14 Ravi Pratap <ravi@ximian.com>
20278 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20279 parent instead of a direct call to GetType.
20281 2001-09-14 Ravi Pratap <ravi@ximian.com>
20283 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20284 Modifiers.TypeAttr. This should just be a call to that method.
20286 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20287 object so that we can determine if we are top-level or not.
20289 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20292 * enum.cs (Enum::Define): Ditto.
20294 * modifiers.cs (FieldAttr): Re-write.
20296 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20297 (TypeContainer::HaveStaticConstructor): New property to provide access
20298 to precisely that info.
20300 * modifiers.cs (MethodAttr): Re-write.
20301 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20303 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20304 of top-level types as claimed.
20306 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20308 * expression.cs (MemberLookup): Fruitless attempt to lookup
20309 constructors. Maybe I need to emit default constructors? That
20310 might be it (currently .NET emits this for me automatically).
20311 (Invocation::OverloadResolve): Cope with Arguments == null.
20312 (Invocation::EmitArguments): new function, shared by the new
20313 constructor and us.
20314 (Invocation::Emit): Handle static and instance methods. Emit
20315 proper call instruction for virtual or non-virtual invocations.
20316 (New::Emit): Implement.
20317 (New::Resolve): Implement.
20318 (MemberAccess:Resolve): Implement.
20319 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20320 to track instances.
20321 (FieldExpr::Resolve): Set type.
20323 * support.cs: Handle empty arguments.
20325 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20326 SimpleLookup): Auxiliary routines to help parse a qualifier
20329 Update qualifier_identifier rule.
20331 * codegen.cs: Removed debugging messages.
20333 * class.cs: Make this a global thing, this acts just as a "key" to
20334 objects that we might have around.
20336 (Populate): Only initialize method_builders_to_methods once.
20338 * expression.cs (PropertyExpr): Initialize type from the
20341 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20342 Resolve pattern. Attempt to implicitly convert value to boolean.
20345 * expression.cs: Set the type for the int32/int32 argument case.
20346 (Binary::ResolveOperator): Set the return type to boolean for
20347 comparission operators
20349 * typemanager.cs: Remove debugging print code.
20351 (Invocation::Resolve): resolve type.
20353 * class.cs: Allocate a MemberInfo of the correct size, as the code
20354 elsewhere depends on the test to reflect the correct contents.
20356 (Method::) Keep track of parameters, due to System.Reflection holes
20358 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20361 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20362 of the exact size and return that.
20364 (Class::LookupMethodByBuilder): New function that maps
20365 MethodBuilders to its methods. Required to locate the information
20366 on methods because System.Reflection bit us again.
20368 * support.cs: New file, contains an interface ParameterData and
20369 two implementations: ReflectionParameters and InternalParameters
20370 used to access Parameter information. We will need to grow this
20373 * expression.cs (Invocation::GetParameterData): implement a cache
20374 and a wrapper around the ParameterData creation for methods.
20375 (Invocation::OverloadResolve): Use new code.
20377 2001-09-13 Ravi Pratap <ravi@ximian.com>
20379 * class.cs (TypeContainer::EmitField): Remove and move into
20380 (Field::Define): here and modify accordingly.
20381 (Field.FieldBuilder): New member.
20382 (TypeContainer::Populate): Update accordingly.
20383 (TypeContainer::FindMembers): Implement.
20385 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20387 * statement.cs: (VariableInfo::VariableType): New field to be
20388 initialized with the full type once it is resolved.
20390 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20392 * parameter.cs (GetParameterInfo): Use a type cache to compute
20393 things only once, and to reuse this information
20395 * expression.cs (LocalVariableReference::Emit): Implement.
20396 (OpcodeCast::Emit): fix.
20398 (ParameterReference::Resolve): Implement.
20399 (ParameterReference::Emit): Implement.
20401 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20402 that are expressions need to stay as Expressions.
20404 * typemanager.cs (CSharpName): Returns the C# name of a type if
20407 * expression.cs (Expression::ConvertImplicit): New function that
20408 implements implicit type conversions.
20410 (Expression::ImplicitReferenceConversion): Implements implicit
20411 reference conversions.
20413 (EmptyCast): New type for transparent casts.
20415 (OpcodeCast): New type for casts of types that are performed with
20416 a sequence of bytecodes.
20418 (BoxedCast): New type used for casting value types into reference
20419 types. Emits a box opcode.
20421 (Binary::DoNumericPromotions): Implements numeric promotions of
20422 and computation of the Binary::Type.
20424 (Binary::EmitBranchable): Optimization.
20426 (Binary::Emit): Implement code emission for expressions.
20428 * typemanager.cs (TypeManager): Added two new core types: sbyte
20431 2001-09-12 Ravi Pratap <ravi@ximian.com>
20433 * class.cs (TypeContainer::FindMembers): Method which does exactly
20434 what Type.FindMembers does, only we don't have to use reflection. No
20435 implementation yet.
20437 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20438 typecontainer objects as we need to get at them.
20439 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20441 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20442 typecontainer object.
20444 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
20445 of just a Report object.
20447 2001-09-11 Ravi Pratap <ravi@ximian.com>
20449 * class.cs (Event::Define): Go back to using the prefixes "add_" and
20451 (TypeContainer::Populate): Now define the delegates of the type too.
20452 (TypeContainer.Delegates): Property to access the list of delegates defined
20455 * delegates.cs (Delegate::Define): Implement partially.
20457 * modifiers.cs (TypeAttr): Handle more flags.
20459 2001-09-11 Ravi Pratap <ravi@ximian.com>
20461 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
20463 (Operator::Define): Re-write logic to get types by using the LookupType method
20464 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
20465 (Indexer::Define): Ditto.
20466 (Event::Define): Ditto.
20467 (Property::Define): Ditto.
20469 2001-09-10 Ravi Pratap <ravi@ximian.com>
20471 * class.cs (TypeContainer::Populate): Now define operators too.
20472 (TypeContainer.Operators): New property to access the list of operators
20474 (Operator.OperatorMethodBuilder): New member to hold the method builder
20475 for the operator we are defining.
20476 (Operator::Define): Implement.
20478 2001-09-10 Ravi Pratap <ravi@ximian.com>
20480 * class.cs (Event::Define): Make the prefixes of the accessor methods
20481 addOn_ and removeOn_
20483 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
20484 of the location being passed in too. Ideally, this should go later since all
20485 error reporting should be done through the Report object.
20487 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
20488 (Populate): Iterate thru the indexers we have and define them too.
20489 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
20490 for the get and set accessors.
20491 (Indexer::Define): Implement.
20493 2001-09-09 Miguel de Icaza <miguel@ximian.com>
20495 * expression.cs (Binary::Resolve): Beginning of it. I scratched
20496 my previous implementation, did not work.
20498 * typemanager.cs: Add a couple of missing types (the longs).
20500 * literal.cs: Use TypeManager.bool_type instead of getting it.
20502 * expression.cs (EventExpr): New kind of expressions.
20503 (Expressio::ExprClassFromMemberInfo): finish
20505 2001-09-08 Miguel de Icaza <miguel@ximian.com>
20507 * assign.cs: Emit stores to static fields differently.
20509 2001-09-08 Ravi Pratap <ravi@ximian.com>
20511 * Merge in changes and adjust code to tackle conflicts. Backed out my
20512 code in Assign::Resolve ;-)
20514 2001-09-08 Ravi Pratap <ravi@ximian.com>
20516 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
20517 instead Report.Error and also pass in the location.
20518 (CSharpParser::Lexer): New readonly property to return the reference
20519 to the Tokenizer object.
20520 (declare_local_variables): Use Report.Error with location instead of plain
20524 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
20525 (Operator.CheckBinaryOperator): Ditto.
20527 * cs-parser.jay (operator_declarator): Update accordingly.
20529 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
20530 (CheckBinaryOperator): Same here.
20532 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
20533 on the name without any prefixes of namespace names etc. This is because we
20534 already might have something already fully qualified like
20535 'System.Console.WriteLine'
20537 * assign.cs (Resolve): Begin implementation. Stuck ;-)
20539 2001-09-07 Ravi Pratap <ravi@ximian.com>
20541 * cs-tokenizer.cs (location): Return a string which also contains
20544 * expression.cs (ElementAccess): New class for expressions of the
20545 type 'element access.'
20546 (BaseAccess): New class for expressions of the type 'base access.'
20547 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
20550 * cs-parser.jay (element_access): Implement action.
20551 (base_access): Implement actions.
20552 (checked_expression, unchecked_expression): Implement.
20554 * cs-parser.jay (local_variable_type): Correct and implement.
20555 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
20557 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
20559 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
20560 name and the specifiers.
20562 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
20564 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
20565 making them all public ;-)
20567 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
20570 2001-09-07 Miguel de Icaza <miguel@ximian.com>
20572 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
20574 (FieldExpr, PropertyExprs): New resolved expressions.
20575 (SimpleName::MemberStaticCheck): Perform static checks for access
20576 to non-static fields on static methods. Maybe this should be
20577 generalized for MemberAccesses.
20578 (SimpleName::ResolveSimpleName): More work on simple name
20581 * cs-parser.jay (primary_expression/qualified_identifier): track
20582 the parameter index.
20584 * codegen.cs (CodeGen::Save): Catch save exception, report error.
20585 (EmitContext::EmitBoolExpression): Chain to expression generation
20586 instead of temporary hack.
20587 (::EmitStatementExpression): Put generic expression code generation.
20589 * assign.cs (Assign::Emit): Implement variable assignments to
20590 local variables, parameters and fields.
20592 2001-09-06 Miguel de Icaza <miguel@ximian.com>
20594 * statement.cs (Block::GetVariableInfo): New method, returns the
20595 VariableInfo for a variable name in a block.
20596 (Block::GetVariableType): Implement in terms of GetVariableInfo
20598 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
20599 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
20601 2001-09-06 Ravi Pratap <ravi@ximian.com>
20603 * cs-parser.jay (operator_declaration): Continue on my quest : update
20604 to take attributes argument.
20605 (event_declaration): Ditto.
20606 (enum_declaration): Ditto.
20607 (indexer_declaration): Ditto.
20609 * class.cs (Operator::Operator): Update constructor accordingly.
20610 (Event::Event): Ditto.
20612 * delegate.cs (Delegate::Delegate): Same here.
20614 * enum.cs (Enum::Enum): Same here.
20616 2001-09-05 Ravi Pratap <ravi@ximian.com>
20618 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
20620 * ../tests/cs0658.cs : New file to demonstrate error 0658.
20622 * attribute.cs (Attributes): New class to encapsulate all attributes which were
20623 being passed around as an arraylist.
20624 (Attributes::AddAttribute): Method to add attribute sections.
20626 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
20627 (struct_declaration): Update accordingly.
20628 (constant_declaration): Update.
20629 (field_declaration): Update.
20630 (method_header): Update.
20631 (fixed_parameter): Update.
20632 (parameter_array): Ditto.
20633 (property_declaration): Ditto.
20634 (destructor_declaration): Ditto.
20636 * class.cs (Struct::Struct): Update constructors accordingly.
20637 (Class::Class): Ditto.
20638 (Field::Field): Ditto.
20639 (Method::Method): Ditto.
20640 (Property::Property): Ditto.
20641 (TypeContainer::OptAttribute): update property's return type.
20643 * interface.cs (Interface.opt_attributes): New member.
20644 (Interface::Interface): Update to take the extra Attributes argument.
20646 * parameter.cs (Parameter::Parameter): Ditto.
20648 * constant.cs (Constant::Constant): Ditto.
20650 * interface.cs (InterfaceMemberBase): New OptAttributes field.
20651 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
20652 the attributes as a parameter.
20653 (InterfaceProperty): Update constructor call.
20654 (InterfaceEvent): Ditto.
20655 (InterfaceMethod): Ditto.
20656 (InterfaceIndexer): Ditto.
20658 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
20659 pass the attributes too.
20660 (interface_event_declaration): Ditto.
20661 (interface_property_declaration): Ditto.
20662 (interface_method_declaration): Ditto.
20663 (interface_declaration): Ditto.
20665 2001-09-05 Miguel de Icaza <miguel@ximian.com>
20667 * class.cs (Method::Define): Track the "static Main" definition to
20668 create an entry point.
20670 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
20671 EntryPoint if we find it.
20673 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
20674 (EmitContext::ig): Make this variable public.
20676 * driver.cs: Make the default output file be the first file name
20677 with the .exe extension.
20679 Detect empty compilations
20681 Handle various kinds of output targets. Handle --target and
20682 rename -t to --dumper.
20684 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
20685 methods inherited from Expression return now an Expression. This
20686 will is used during the tree rewriting as we resolve them during
20689 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
20690 the spec. Missing entirely is the information about
20691 accessability of elements of it.
20693 (Expression::ExprClassFromMemberInfo): New constructor for
20694 Expressions that creates a fully initialized Expression based on
20695 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
20698 (Invocation::Resolve): Begin implementing resolution of invocations.
20700 * literal.cs (StringLiteral): Implement Emit.
20702 2001-09-05 Ravi Pratap <ravi@ximian.com>
20704 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
20707 2001-09-04 Ravi Pratap <ravi@ximian.com>
20709 * cs-parser.jay (attribute_arguments): Implement actions.
20710 (attribute): Fix bug in production. Implement action.
20711 (attribute_list): Implement.
20712 (attribute_target): Implement.
20713 (attribute_target_specifier, opt_target_specifier): Implement
20714 (CheckAttributeTarget): New method to check if the attribute target
20716 (attribute_section): Implement.
20717 (opt_attributes): Implement.
20719 * attribute.cs : New file to handle attributes.
20720 (Attribute): Class to hold attribute info.
20722 * cs-parser.jay (opt_attribute_target_specifier): Remove production
20723 (attribute_section): Modify production to use 2 different rules to
20724 achieve the same thing. 1 s/r conflict down !
20725 Clean out commented, useless, non-reducing dimension_separator rules.
20727 * class.cs (TypeContainer.attributes): New member to hold list
20728 of attributes for a type.
20729 (Struct::Struct): Modify to take one more argument, the attribute list.
20730 (Class::Class): Ditto.
20731 (Field::Field): Ditto.
20732 (Method::Method): Ditto.
20733 (Property::Property): Ditto.
20735 * cs-parser.jay (struct_declaration): Update constructor call to
20736 pass in the attributes too.
20737 (class_declaration): Ditto.
20738 (constant_declaration): Ditto.
20739 (field_declaration): Ditto.
20740 (method_header): Ditto.
20741 (fixed_parameter): Ditto.
20742 (parameter_array): Ditto.
20743 (property_declaration): Ditto.
20745 * constant.cs (Constant::Constant): Update constructor similarly.
20746 Use System.Collections.
20748 * parameter.cs (Parameter::Parameter): Update as above.
20750 2001-09-02 Ravi Pratap <ravi@ximian.com>
20752 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
20753 (TypeContainer.delegates): New member to hold list of delegates.
20755 * cs-parser.jay (delegate_declaration): Implement the action correctly
20756 this time as I seem to be on crack ;-)
20758 2001-09-02 Miguel de Icaza <miguel@ximian.com>
20760 * rootcontext.cs (RootContext::IsNamespace): new function, used to
20761 tell whether an identifier represents a namespace.
20763 * expression.cs (NamespaceExpr): A namespace expression, used only
20764 temporarly during expression resolution.
20765 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
20766 utility functions to resolve names on expressions.
20768 2001-09-01 Miguel de Icaza <miguel@ximian.com>
20770 * codegen.cs: Add hook for StatementExpressions.
20772 * class.cs: Fix inverted test for static flag in methods.
20774 2001-09-02 Ravi Pratap <ravi@ximian.com>
20776 * class.cs (Operator::CheckUnaryOperator): Correct error number used
20777 to make it coincide with MS' number.
20778 (Operator::CheckBinaryOperator): Ditto.
20780 * ../errors/errors.txt : Remove error numbers added earlier.
20782 * ../errors/cs1019.cs : Test case for error # 1019
20784 * ../errros/cs1020.cs : Test case for error # 1020
20786 * cs-parser.jay : Clean out commented cruft.
20787 (dimension_separators, dimension_separator): Comment out. Ostensibly not
20788 used anywhere - non-reducing rule.
20789 (namespace_declarations): Non-reducing rule - comment out.
20791 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
20792 with TypeContainer::AddEnum.
20794 * delegate.cs : New file for delegate handling classes.
20795 (Delegate): Class for declaring delegates.
20797 * makefile : Update.
20799 * cs-parser.jay (delegate_declaration): Implement.
20801 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
20803 * class.cs (Event::Define): Implement.
20804 (Event.EventBuilder): New member.
20806 * class.cs (TypeContainer::Populate): Update to define all enums and events
20808 (Events): New property for the events arraylist we hold. Shouldn't we move to using
20809 readonly fields for all these cases ?
20811 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20813 * class.cs (Property): Revamp to use the convention of making fields readonly.
20814 Accordingly modify code elsewhere.
20816 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
20817 the Define method of the Property class.
20819 * class.cs : Clean up applied patch and update references to variables etc. Fix
20821 (TypeContainer::Populate): Update to define all the properties we have. Also
20822 define all enumerations.
20824 * enum.cs (Define): Implement.
20826 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
20828 * cs-parser.jay (overloadable_operator): The semantic value is an
20829 enum of the Operator class.
20830 (operator_declarator): Implement actions.
20831 (operator_declaration): Implement.
20833 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
20834 validity of definitions.
20835 (Operator::CheckBinaryOperator): Static method to check for binary operators
20836 (TypeContainer::AddOperator): New method to add an operator to a type.
20838 * cs-parser.jay (indexer_declaration): Added line to actually call the
20839 AddIndexer method so it gets added ;-)
20841 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
20842 already taken care of by the MS compiler ?
20844 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20846 * class.cs (Operator): New class for operator declarations.
20847 (Operator::OpType): Enum for the various operators.
20849 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
20851 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
20852 ostensibly handle this in semantic analysis.
20854 * cs-parser.jay (general_catch_clause): Comment out
20855 (specific_catch_clauses, specific_catch_clause): Ditto.
20856 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
20857 (catch_args, opt_catch_args): New productions.
20858 (catch_clause): Rewrite to use the new productions above
20859 (catch_clauses): Modify accordingly.
20860 (opt_catch_clauses): New production to use in try_statement
20861 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
20862 and re-write the code in the actions to extract the specific and
20863 general catch clauses by being a little smart ;-)
20865 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
20866 Hooray, try and catch statements parse fine !
20868 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20870 * statement.cs (Block::GetVariableType): Fix logic to extract the type
20871 string from the hashtable of variables.
20873 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
20874 I end up making that mistake ;-)
20875 (catch_clauses): Fixed gross error which made Key and Value of the
20876 DictionaryEntry the same : $1 !!
20878 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20880 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
20882 * cs-parser.jay (event_declaration): Correct to remove the semicolon
20883 when the add and remove accessors are specified.
20885 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20887 * cs-parser.jay (IndexerDeclaration): New helper class to hold
20888 information about indexer_declarator.
20889 (indexer_declarator): Implement actions.
20890 (parsing_indexer): New local boolean used to keep track of whether
20891 we are parsing indexers or properties. This is necessary because
20892 implicit_parameters come into picture even for the get accessor in the
20893 case of an indexer.
20894 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
20896 * class.cs (Indexer): New class for indexer declarations.
20897 (TypeContainer::AddIndexer): New method to add an indexer to a type.
20898 (TypeContainer::indexers): New member to hold list of indexers for the
20901 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20903 * cs-parser.jay (add_accessor_declaration): Implement action.
20904 (remove_accessor_declaration): Implement action.
20905 (event_accessors_declaration): Implement
20906 (variable_declarators): swap statements for first rule - trivial.
20908 * class.cs (Event): New class to hold information about event
20910 (TypeContainer::AddEvent): New method to add an event to a type
20911 (TypeContainer::events): New member to hold list of events.
20913 * cs-parser.jay (event_declaration): Implement actions.
20915 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20917 * cs-parser.jay (dim_separators): Implement. Make it a string
20918 concatenating all the commas together, just as they appear.
20919 (opt_dim_separators): Modify accordingly
20920 (rank_specifiers): Update accordingly. Basically do the same
20921 thing - instead, collect the brackets here.
20922 (opt_rank_sepcifiers): Modify accordingly.
20923 (array_type): Modify to actually return the complete type string
20924 instead of ignoring the rank_specifiers.
20925 (expression_list): Implement to collect the expressions
20926 (variable_initializer): Implement. We make it a list of expressions
20927 essentially so that we can handle the array_initializer case neatly too.
20928 (variable_initializer_list): Implement.
20929 (array_initializer): Make it a list of variable_initializers
20930 (opt_array_initializer): Modify accordingly.
20932 * expression.cs (New::NType): Add enumeration to help us
20933 keep track of whether we have an object/delegate creation
20934 or an array creation.
20935 (New:NewType, New::Rank, New::Indices, New::Initializers): New
20936 members to hold data about array creation.
20937 (New:New): Modify to update NewType
20938 (New:New): New Overloaded contructor for the array creation
20941 * cs-parser.jay (array_creation_expression): Implement to call
20942 the overloaded New constructor.
20944 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
20946 * class.cs (TypeContainer::Constructors): Return member
20947 constructors instead of returning null.
20949 2001-08-26 Miguel de Icaza <miguel@ximian.com>
20951 * typemanager.cs (InitCoreTypes): Initialize the various core
20952 types after we have populated the type manager with the user
20953 defined types (this distinction will be important later while
20954 compiling corlib.dll)
20956 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
20957 on Expression Classification. Now all expressions have a method
20958 `Resolve' and a method `Emit'.
20960 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
20961 generation from working. Also add some temporary debugging
20964 2001-08-24 Miguel de Icaza <miguel@ximian.com>
20966 * codegen.cs: Lots of code generation pieces. This is only the
20967 beginning, will continue tomorrow with more touches of polish. We
20968 handle the fundamentals of if, while, do, for, return. Others are
20969 trickier and I need to start working on invocations soon.
20971 * gen-treedump.cs: Bug fix, use s.Increment here instead of
20974 * codegen.cs (EmitContext): New struct, used during code
20975 emission to keep a context. Most of the code generation will be
20978 * cs-parser.jay: Add embedded blocks to the list of statements of
20979 this block. So code generation proceeds in a top down fashion.
20981 2001-08-23 Miguel de Icaza <miguel@ximian.com>
20983 * statement.cs: Add support for multiple child blocks.
20985 2001-08-22 Miguel de Icaza <miguel@ximian.com>
20987 * codegen.cs (EmitCode): New function, will emit the code for a
20988 Block of code given a TypeContainer and its ILGenerator.
20990 * statement.cs (Block): Standard public readonly optimization.
20991 (Block::Block constructors): Link children.
20992 (Block::Child): Child Linker.
20993 (Block::EmitVariables): Emits IL variable declarations.
20995 * class.cs: Drop support for MethodGroups here, delay until
20997 (Method::): Applied the same simplification that I did before, and
20998 move from Properties to public readonly fields.
20999 (Method::ParameterTypes): Returns the parameter types for the
21000 function, and implements a cache that will be useful later when I
21001 do error checking and the semantic analysis on the methods is
21003 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21004 and made a method, optional argument tells whether this is a class
21005 or a structure to apply the `has-this' bit.
21006 (Method::GetCallingConvention): Implement, returns the calling
21008 (Method::Define): Defines the type, a second pass is performed
21009 later to populate the methods.
21011 (Constructor::ParameterTypes): implement a cache similar to the
21012 one on Method::ParameterTypes, useful later when we do semantic
21015 (TypeContainer::EmitMethod): New method. Emits methods.
21017 * expression.cs: Removed MethodGroup class from here.
21019 * parameter.cs (Parameters::GetCallingConvention): new method.
21021 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21023 * class.cs (TypeContainer::Populate): Drop RootContext from the
21026 (Constructor::CallingConvention): Returns the calling convention.
21027 (Constructor::ParameterTypes): Returns the constructor parameter
21030 (TypeContainer::AddConstructor): Keep track of default constructor
21031 and the default static constructor.
21033 (Constructor::) Another class that starts using `public readonly'
21034 instead of properties.
21036 (Constructor::IsDefault): Whether this is a default constructor.
21038 (Field::) use readonly public fields instead of properties also.
21040 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21041 track of static constructors; If none is used, turn on
21042 BeforeFieldInit in the TypeAttributes.
21044 * cs-parser.jay (opt_argument_list): now the return can be null
21045 for the cases where there are no arguments.
21047 (constructor_declarator): If there is no implicit `base' or
21048 `this', then invoke the default parent constructor.
21050 * modifiers.cs (MethodAttr): New static function maps a set of
21051 modifiers flags into a MethodAttributes enum
21052 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21053 MethodAttr, TypeAttr to represent the various mappings where the
21054 modifiers are used.
21055 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21057 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21059 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21062 * interface.cs (PopulateIndexer): Implemented the code generator
21063 for interface indexers.
21065 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21067 * interface.cs (InterfaceMemberBase): Now we track the new status
21070 (PopulateProperty): Implement property population. Woohoo! Got
21071 Methods and Properties going today.
21073 Removed all the properties for interfaces, and replaced them with
21074 `public readonly' fields.
21076 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21078 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21079 initialize their hashtables/arraylists only when they are needed
21080 instead of doing this always.
21082 * parameter.cs: Handle refs and out parameters.
21084 * cs-parser.jay: Use an ArrayList to construct the arguments
21085 instead of the ParameterCollection, and then cast that to a
21088 * parameter.cs: Drop the use of ParameterCollection and use
21089 instead arrays of Parameters.
21091 (GetParameterInfo): Use the Type, not the Name when resolving
21094 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21096 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21097 and instead use public readonly fields.
21099 * class.cs: Put back walking code for type containers.
21101 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21103 * class.cs (MakeConstant): Code to define constants.
21105 * rootcontext.cs (LookupType): New function. Used to locate types
21108 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21110 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21111 this System.Reflection code is. Kudos to Microsoft
21113 * typemanager.cs: Implement a type cache and avoid loading all
21114 types at boot time. Wrap in LookupType the internals. This made
21115 the compiler so much faster. Wow. I rule!
21117 * driver.cs: Make sure we always load mscorlib first (for
21118 debugging purposes, nothing really important).
21120 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21121 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21123 * rootcontext.cs: Lookup types on their namespace; Lookup types
21124 on namespaces that have been imported using the `using' keyword.
21126 * class.cs (TypeContainer::TypeAttr): Virtualize.
21127 (Class::TypeAttr): Return attributes suitable for this bad boy.
21128 (Struct::TypeAttr): ditto.
21129 Handle nested classes.
21130 (TypeContainer::) Remove all the type visiting code, it is now
21131 replaced with the rootcontext.cs code
21133 * rootcontext.cs (GetClassBases): Added support for structs.
21135 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21137 * interface.cs, statement.cs, class.cs, parameter.cs,
21138 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21139 Drop use of TypeRefs, and use strings instead.
21141 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21145 * class.cs (Struct::Struct): set the SEALED flags after
21146 checking the modifiers.
21147 (TypeContainer::TypeAttr): new property, returns the
21148 TypeAttributes for a class.
21150 * cs-parser.jay (type_list): Oops, list production was creating a
21151 new list of base types.
21153 * rootcontext.cs (StdLib): New property.
21154 (GetInterfaceTypeByName): returns an interface by type name, and
21155 encapsulates error handling here.
21156 (GetInterfaces): simplified.
21157 (ResolveTree): Encapsulated all the tree resolution here.
21158 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21161 * driver.cs: Add support for --nostdlib, to avoid loading the
21162 default assemblies.
21163 (Main): Do not put tree resolution here.
21165 * rootcontext.cs: Beginning of the class resolution.
21167 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21169 * rootcontext.cs: Provide better error reporting.
21171 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21173 * rootcontext.cs (CreateInterface): Handle the case where there
21174 are no parent interfaces.
21176 (CloseTypes): Routine to flush types at the end.
21177 (CreateInterface): Track types.
21178 (GetInterfaces): Returns an array of Types from the list of
21179 defined interfaces.
21181 * typemanager.c (AddUserType): Mechanism to track user types (puts
21182 the type on the global type hash, and allows us to close it at the
21185 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21187 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21188 RecordInterface instead.
21190 * cs-parser.jay: Updated to reflect changes above.
21192 * decl.cs (Definition): Keep track of the TypeBuilder type that
21193 represents this type here. Not sure we will use it in the long
21194 run, but wont hurt for now.
21196 * driver.cs: Smaller changes to accomodate the new code.
21198 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21201 * rootcontext.cs (CreateInterface): New method, used to create
21202 the System.TypeBuilder type for interfaces.
21203 (ResolveInterfaces): new entry point to resolve the interface
21205 (CodeGen): Property, used to keep track of the code generator.
21207 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21209 * cs-parser.jay: Add a second production for delegate_declaration
21212 (enum_body): Put an opt_comma here instead of putting it on
21213 enum_body or enum_member_declarations so we can handle trailing
21214 commas on enumeration members. Gets rid of a shift/reduce.
21216 (type_list): Need a COMMA in the middle.
21218 (indexer_declaration): Tell tokenizer to recognize get/set
21220 * Remove old targets.
21222 * Re-add the parser target.
21224 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21226 * cs-parser.jay: Add precendence rules for a number of operators
21227 ot reduce the number of shift/reduce conflicts in the grammar.
21229 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21231 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21234 Get rid of old crufty code.
21236 * rootcontext.cs: Use this to keep track of the parsed
21237 representation and the defined types available to the program.
21239 * gen-treedump.cs: adjust for new convention.
21241 * type.cs: Split out the type manager, and the assembly builder
21244 * typemanager.cs: the type manager will live here now.
21246 * cil-codegen.cs: And the code generator here.
21248 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21250 * makefile: Fixed up for easy making.
21252 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21254 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21257 (unary_expression): Expand pre_increment_expression and
21258 post_decrement_expression to reduce a shift/reduce.
21260 2001-07-11 Simon Cozens
21262 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21264 Improve allow_keyword_as_indent name.
21266 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21268 * Adjustments for Beta2.
21270 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21272 * decl.cs: Added `Define' abstract method.
21273 (InTransit): new property, used to catch recursive definitions.
21275 * interface.cs: Implement `Define'.
21277 * modifiers.cs: Map Modifiers.constants to
21278 System.Reflection.TypeAttribute flags.
21280 * class.cs: Keep track of types and user-defined types.
21281 (BuilderInit): New method for creating an assembly
21282 (ResolveType): New function to launch the resolution process, only
21283 used by interfaces for now.
21285 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21286 that are inserted into the name space.
21288 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21290 * ARGH. I have screwed up my tree so many times due to the use of
21291 rsync rather than using CVS. Going to fix this at once.
21293 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21296 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21298 * Experiment successful: Use System.Type rather that our own
21301 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21303 * cs-parser.jay: Removed nsAliases from here.
21305 Use new namespaces, handle `using XXX;'
21307 * namespace.cs: Reimplemented namespace handling, use a recursive
21308 definition of the class. Now we can keep track of using clauses
21309 and catch invalid using clauses.
21311 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21313 * gen-treedump.cs: Adapted for all the renaming.
21315 * expression.cs (Expression): this class now has a Type property
21316 which returns an expression Type.
21318 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21319 `Type', as this has a different meaning now in the base
21321 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21323 * interface.cs, class.cs: Removed from all the sources the
21324 references to signature computation, as we can not do method
21325 signature computation during the parsing time, as we are not
21326 trying to solve at that point distinguishing:
21330 void a (NS.Blah x) {}
21333 Which depending on the context might be valid or not, as we do not
21334 know if Blah is the same thing as NS.Blah at that point.
21336 * Redid everything so the code uses TypeRefs now instead of
21337 Types. TypeRefs are just temporary type placeholders, that need
21338 to be resolved. They initially have a pointer to a string and the
21339 current scope in which they are used. This is used later by the
21340 compiler to resolve the reference to an actual Type.
21342 * DeclSpace is no longer a CIR.Type, and neither are
21343 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21344 are all DeclSpaces, but no Types.
21346 * type.cs (TypeRefManager): This implements the TypeRef manager,
21347 which keeps track of all the types that need to be resolved after
21348 the parsing has finished.
21350 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21352 * ARGH. We are going to have to store `foreach' as a class rather
21353 than resolving it, as we need to verify error 1579 after name
21354 resolution. *OR* we could keep a flag that says `This request to
21355 IEnumerator comes from a foreach statement' which we can then use
21356 to generate the error.
21358 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21360 * class.cs (TypeContainer.AddMethod): we now add methods to the
21361 MethodGroup instead of the method hashtable.
21363 * expression.cs: Add MethodGroup abstraction, which gets us one
21364 step closer to the specification in the way we handle method
21367 * cs-parser.jay (primary_expression): qualified_identifier now
21368 tried to match up an identifier to a local variable reference or
21369 to a parameter reference.
21371 current_local_parameters is now a parser global variable that
21372 points to the current parameters for the block, used during name
21375 (property_declaration): Now creates an implicit `value' argument to
21378 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21380 * parameter.cs: Do not use `param' arguments as part of the
21381 signature, per the spec.
21383 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21385 * decl.cs: Base class for classes, structs and interfaces. This
21386 is the "Declaration Space"
21388 * cs-parser.jay: Use CheckDef for checking declaration errors
21389 instead of having one on each function.
21391 * class.cs: Factor out some code for handling error handling in
21392 accordance to the "Declarations" section in the "Basic Concepts"
21393 chapter in the ECMA C# spec.
21395 * interface.cs: Make all interface member classes derive from
21396 InterfaceMemberBase.
21398 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21400 * Many things: all interfaces are parsed and generated in
21401 gen-treedump. Support for member variables, constructors,
21402 destructors, properties, constants is there.
21404 Beginning of the IL backend, but very little done, just there for
21407 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21409 * cs-parser.jay: Fix labeled statement.
21411 * cs-tokenizer.cs (escape): Escape " and ' always.
21412 ref_line, ref_name: keep track of the line/filename as instructed
21413 by #line by the compiler.
21416 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21418 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21419 to match the values in System.CodeDOM.
21421 Divid renamed to Divide.
21423 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21425 (Statements.set): remove.
21427 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21430 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21431 falseStatements always have valid values.
21433 * cs-parser.jay: Use System.CodeDOM now.