1 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
3 * doc.cs : documented member might be from DeclaringType for nested
4 types. Fixed bug #76782.
6 2005-12-03 Ben Maurer <bmaurer@ximian.com>
8 * anonymous.cs: Have the param code handle leaving copies on the
9 stack etc. Allows anonymous params to take part in the assignment
10 code (++, +=, etc). Fixes bug #76550
12 * expression.cs: Handle the prepare_for_load/leave_copy by passing
13 it down to the anon code.
15 * iterators.cs: Use dummy var here
17 * codegen.cs: Handle new vars
19 2005-12-01 Marek Safar <marek.safar@seznam.cz>
22 * class.cs (MethodData.Define): Set proper Obsolete context.
24 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
26 (FieldExpr.DoResolve): Ditto.
28 2005-12-01 Marek Safar <marek.safar@seznam.cz>
31 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
32 parent is not obsolete.
34 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
36 * doc.cs : (FindDocumentedMember) find parameterless members first
37 and get CS0419 in the early stage. Fixed first case of bug #76727.
39 2005-11-30 Marek Safar <marek.safar@seznam.cz>
42 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
43 no error was reported.
45 *expression.cs (Binary.DoResolve): left can be null.
47 2005-11-22 Marek Safar <marek.safar@seznam.cz>
50 * class.cs (MethodData.Emit): Parameters should be labeled first.
52 2005-11-21 Marek Safar <marek.safar@seznam.cz>
55 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
57 2005-11-18 Marek Safar <marek.safar@seznam.cz>
59 * attribute.cs (AreParametersCompliant): Moved to Parameter.
61 * class.cs (MethodCore): Parameter clean up.
62 (IMethodData): Added ParameterInfo.
63 (MethodData): Parameter clean up.
64 (Indexer.Define): Parameter clean up.
76 * typemanager.cs: Parameter clean up.
78 * delegate.cs (Define): Get rid of duplicated code.
80 * expression.cs (ParameterReference): Removed useless parameters
84 * parameter.cs (ParamsParameter): New class, params specialization.
85 (ArglistParameter): Attemp to separate arglist.
86 (Parameter): Refactored to be reusable and faster.
87 (Parameter.Modifier): Made understandable.
88 (Parameters): Changed to be used as a class for `this' assembly
89 parameters. Refactored to use new specialized classes.
91 * support.cs (ParameterData): Added Types property.
92 (InternalParameters): Deleted.
94 2005-08-20 Martin Baulig <martin@ximian.com>
96 Merging this patch from GMCS to fix #75867.
98 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
99 scope if we don't already have it.
101 2005-11-17 Martin Baulig <martin@ximian.com>
104 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
105 inherit the scope from our parent. Fixes #76653.
107 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
109 * doc.cs : the previous patch does not actually fix the bug.
110 PropertyInfo override check is now implemented and really fixed it.
111 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
113 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
115 * doc.cs : apply "override filter" also to properties.
118 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
120 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
121 no need to check overrides. For classes, omit those results from
122 interfaces since they must exist in the class. Fixed bug #76726.
124 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
126 * typemanager.cs : (GetFullNameSignature) differentiate indexers
127 with different parameters. Fixed the second problem in #76685.
129 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
131 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
132 get expected 'protected' access in CheckValidFamilyAccess()).
135 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
137 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
138 Fixed bug #76705. CS1569 was incorrectly commented out.
140 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
142 * doc.cs : use Invocation.IsOverride() to do real override check.
143 * expression.cs : made Invocation.IsOverride() internal.
145 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
147 * doc.cs : use TypeManager.FindMembers() instead of (possible)
148 TypeBuilder.FindMembers() and filter overriden base members out.
151 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
153 * doc.cs : ref/out parameters are represented as '@' (instead of
154 '&' in type FullName). Fixed bug #76630 (additionally crefs).
156 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
158 * doc.cs : when there was no '.' in cref to methods in doc comment,
159 then parameters were missing in the output. Fixed bug #76691.
161 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
163 * driver.cs : don't output docs when there is an error.
166 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
169 Now it should detect indexers. Fixed primary concern in bug #76685.
170 Fixed CS0419 message to not show the identical member signature in
173 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
175 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
176 instead of Type.FindMembers() since it does not handle events.
179 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
181 * codegen.cs: Fixed typo (speficied -> specified).
183 2005-11-11 Marek Safar <marek.safar@seznam.cz>
186 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
188 2005-11-11 Marek Safar <marek.safar@seznam.cz>
190 * attribute.cs: Changed error message.
192 * cs-tokenizer.cs: One more check.
194 2005-11-10 Marek Safar <marek.safar@seznam.cz>
196 * statement.cs (Block.Resolve): Ignore empty statement.
198 2005-11-10 Marek Safar <marek.safar@seznam.cz>
200 * report.cs: Made error/warning methods more strict to avoid
203 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
204 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
205 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
206 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
208 2005-11-08 Marek Safar <marek.safar@seznam.cz>
210 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
211 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
213 * class.cs (TypeContainer.IsComImport): New property.
214 (Constructor.Define): Create proper ctor for ComImport types.
216 * expression.cs (New.CheckComImport): Fixed.
218 2005-11-07 Miguel de Icaza <miguel@novell.com>
220 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
221 that a parameter has been captured does not mean that we do not
222 have to do the rest of the processing. This fixes the second part
223 of #76592. If there was another anonymous method capturing
224 values in the past, the Scope would never be set for the second
225 method that captured the same parameter.
227 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
228 properly manipulate the stack. Second part of fix for #76592.
230 * expression.cs (New): Add support for invoking "new" on
231 interfaces that have been flagged with the ComImport attribute and
232 the CoClass. Fixes #76637
234 * statement.cs (Try.DoEmit): When a variable is captured, do not
235 try to emit the vi.LocalBuilder variable as it has been captured.
236 Create a temporary variable and store the results on the
237 FieldBuilder. Fixes #76642
239 2005-11-07 Marek Safar <marek.safar@seznam.cz>
241 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
243 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
245 * expression.cs (Binary.DoResolve): Added && optimalization.
247 * typemanager.cs (AddUserType): Removed useless argument.
249 2005-11-04 Marek Safar <marek.safar@seznam.cz>
251 * statement.cs (Block.variables): Uses ListDictionary.
253 2005-11-03 Marek Safar <marek.safar@seznam.cz>
256 * class.cs (PartialContainer.EmitType): Customized to emit
258 (ClassPart.ApplyAttributeBuilder): Transform security attribute
261 2005-11-03 Marek Safar <marek.safar@seznam.cz>
264 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
265 access has to be fixed.
267 * typemanager.cs (IsUnmanagedType): Wrong common field type.
269 2005-11-01 Marek Safar <marek.safar@seznam.cz>
272 * ecore.cs (NullCast.Reduce): Implemented.
274 * expression.cs (ArrayCreation.CheckIndices): Correcly check
277 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
279 (Foreach.Resolve): Catch null properly.
281 2005-10-29 Marek Safar <marek.safar@seznam.cz>
283 * cs-tokenizer.cs: Warning text fix.
285 * driver.cs: AllWarningNumbers exposed on public interface.
287 * report.cs (): Reviewed warning numbers.
288 (IsValidWarning): Use binary search.
290 2005-10-29 Marek Safar <marek.safar@seznam.cz>
292 * driver.cs: Implemeted resource visibility.
293 (Resources): New class for code sharing between /res: and
296 2005-10-28 Marek Safar <marek.safar@seznam.cz>
299 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
302 * convert (Convert.ImplicitReferenceConversion): NullCast holds
305 * ecore.cs (NullCast): Child is contant only.
307 * literal.cs (NullLiteral.Reduce): null can be converted to any
310 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
312 * driver.cs: Use Encoding.Default as default code page instead
315 2005-10-27 Raja R Harinath <rharinath@novell.com>
318 * expression.cs (Invocation.Error_InvalidArguments): Handle
319 __arglist parameters.
320 (Invocation.VerifyArgumentsCompat): Likewise.
321 * support.cs (ReflectionParameters.GetSignatureForError): Print
322 __arglist parameters.
323 (InternalParamters.GetSignatureForError): Likewise.
324 * parameter.cs (Parameters.GetSignatureForError): Likewise.
326 2005-10-26 Marek Safar <marek.safar@seznam.cz>
328 * attribute.cs (GetPropertyValue): Made public.
330 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
332 Add new property WrapNonExceptionThrows to handle 2.0 assembly
334 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
337 * driver.cs: Reflect method name change.
339 * statement.cs (Try.Resolve): Warn when try has both general
342 * typemanager.cs: runtime_compatibility_attr_type new predefined
345 2005-10-26 Raja R Harinath <harinath@gmail.com>
348 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
349 treat it as an empty parameter list.
351 2005-10-26 Raja R Harinath <rharinath@novell.com>
354 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
355 ResolveAsTypeStep silent.
356 * statement.cs (Block.AddConstant): Mark block as used.
357 (Block.ResolveMeta): Avoid piling on error messages
358 if a constant initializer resolution fails.
360 2005-10-25 Raja R Harinath <rharinath@novell.com>
362 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
364 (NamespaceEntry.VerifyAllUsing): New.
365 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
366 behaviour. Delegates actual resolution of alias to ...
367 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
368 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
370 * driver.cs (Driver.MainDriver): Update.
372 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
373 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
375 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
377 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
378 RootNamespace.DefineNamespacesForAll.
380 2005-10-24 Raja R Harinath <harinath@gmail.com>
382 * typemanager.cs (assemblies, external_aliases, modules)
383 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
384 (ComputeNamespaces, GetRootNamespace): Remove extra staging
385 overhead. Move resposibility ...
386 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
387 * driver.cs, attribute.cs, codegen.cs: Update to changes.
389 2005-10-23 Raja R Harinath <harinath@gmail.com>
391 * namespace.cs (RootNamespace.all_namespaces): Renamed from
392 cached_namespaces. Improve usage.
393 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
394 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
395 Move from GlobalRootNamespace and simplify.
396 (RootNamespace.Global): Make instance variable.
397 (RootNamespace.RootNamespace): Add "alias name" parameter.
398 (GlobalRootNamespace): Simplify drastically.
399 (Namespace.Lookup): Don't use GetNamespace.
400 * typemanager.cs (GetRootNamespace): Rename from
401 ComputeNamespaceForAlias.
402 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
404 2005-10-23 Marek Safar <marek.safar@seznam.cz>
406 * anonymous.cs (AnonymousContainer): Don't crash when container
409 2005-10-23 Marek Safar <marek.safar@seznam.cz>
411 * expression.cs (Binary.DoResolve): Warn when comparing same
414 2005-10-23 Marek Safar <marek.safar@seznam.cz>
417 * expression.cs (Binary.DoResolve): It looks like there are no
418 convetsion rules in enum context.
420 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
422 Add support for extern alias qualifiers.
423 * typemanager.cs: Move some LookupTypeReflection code
424 to namespace.cs, to have cleaner code. Added some methods
425 to help us keep track of the extern aliased references.
426 * driver.cs: Add suport for extern alias assemblies on command
427 line and check for their warnings/errors. Also keep track of the
428 extern aliased assemblies.
429 * namespace.cs: Move the global functionality of Namespace
430 to GlobalRootNamespace/RootNamespace. Now the global namespace
431 is GlobalRootNamespace.Globa. Also the code moved from
432 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
433 Finally added LocalAliasEntry (AliasEntry before) and
434 ExternAliasEntry, to handle alias statements.
435 * cs-parser.jay: Add support in the grammar for extern alias
437 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
438 Update callings to Namespace (now in GlobalRootNamespace).
440 2005-10-18 Raja R Harinath <rharinath@novell.com>
443 * class.cs (TypeContainer.DefineType): Move updating of
444 topological sort earlier in the code.
445 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
447 2005-10-18 Marek Safar <marek.safar@seznam.cz>
450 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
452 * constant.cs (Constant.TryReduce): Moved from Cast class.
453 (Reduce): Made little bit more OO and fixed missing conversions.
455 * ecore.cs (Reduce): Implemented.
456 (Binary.EnumLiftUp): New method to upgrade values to enum values.
458 * literal.cs (Reduce): Implemented.
460 * class.cs: Reverted Miguel's wrong commit.
462 2005-10-14 Miguel de Icaza <miguel@novell.com>
464 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
466 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
468 * cs-parser.jay, expression.cs : CS0214 was missing error location
469 for constants. Fixed bug #76404.
471 2005-10-11 Marek Safar <marek.safar@seznam.cz>
474 * convert.cs (ExplicitConversionCore): Fixed object->enum
477 2005-10-10 Raja R Harinath <rharinath@novell.com>
479 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
481 (PropertyExpr.EmitCall): Likewise.
482 * expression.cs (Invocation.EmitArguments): Handle case where
484 (Invocation.EmitCall): Avoid allocating temporary variable if
485 there are no arguments.
487 2005-10-07 Raja R Harinath <rharinath@novell.com>
490 * convert.cs (ImplicitConversionStandard): Move conversion of
491 void* to arbitrary pointer types ...
492 (ExplicitConversionStandard): .. here.
493 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
494 error to always print typenames.
496 2005-10-07 Raja R Harinath <rharinath@novell.com>
498 * convert.cs (GetConversionOperator): Rename from
499 GetConversionOperators. Move operator selection code from ...
500 (UserDefinedConversion): ... here.
502 2005-10-06 Marek Safar <marek.safar@seznam.cz>
504 * convert.cs (ExplicitConversionCore): Removed duplicate enum
507 2005-10-05 Marek Safar <marek.safar@seznam.cz>
509 * assign.cs (Assign.DoResolve): Error method changed.
511 * cfold.cs (DoConstantNumericPromotions): Error method changed.
513 * const.cs (ResolveValue): Reset in_transit immediately.
515 * constant.cs: Error method changed.
517 * convert.cs: Removed useless location parameter.
518 (ExplicitNumericConversion): Don't do double enum check.
519 (ExplicitConversionCore): Renamed from ExplicitConversion.
520 (ExplicitUnsafe): Extracted from ExplicitConversion.
521 (ExplicitConversion): Uses for error reporting.
523 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
525 (ResolveBoolean): Uses common error method.
526 (CastToDecimal): Get rid of ec.
527 (CastFromDecimal): Optimized.
528 (ConvCast): Get rid of ec.
530 * enum.cs (ResolveValue): Reset in_transit immediately.
531 (Emit): Return after first error.
533 * expression.cs: Convert changes.
535 * literal.cs: Error method changed.
537 * statement.cs: Error method changed.
539 2005-10-03 Raja R Harinath <rharinath@novell.com>
541 * support.cs (SeekableStreamReader.Position): Don't error out when
542 the requested position is just beyond the end of the current
545 2005-09-28 Raja R Harinath <rharinath@novell.com>
547 * support.cs (SeekableStreamReader): Simplify drastically. Don't
548 try to keep in sync with the byte count of the underlying Stream.
549 However, this limits us to a window size of 2048 characters: i.e.,
550 the maximum lookahead of our lexer/parser can be 2048 characters.
552 2005-09-28 Marek Safar <marek.safar@seznam.cz>
555 * driver.cs: Fix compilation files with full root path.
557 2005-09-25 Miguel de Icaza <miguel@novell.com>
559 * report.cs (SymbolRelatedToPreviousError): Format the output so
560 it does not use an open parenthesis that is never closed.
562 * driver.cs: Follow coding guidelines
564 2005-09-27 Marek Safar <marek.safar@seznam.cz>
567 * const.cs (Const.ResolveValue): Check for assigning non-null
568 value to reference type.
570 2005-09-27 Marek Safar <marek.safar@seznam.cz>
572 * anonymous.cs: Implemented ExprClassName.
574 * assign.cs (Assign.DoResolve): Don't chrash when type is not
577 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
580 * class.cs (StaticClass.DefineContainerMembers): Report protected
583 * codegen.cs: if(ed) PRODUCTION.
585 * convert.cs (Error_CannotImplicitConversion): Better error
588 * cs-parser.jay: More error checks.
590 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
592 * driver.cs (CSCParseOption): Enabled wrong option check.
594 * ecore.cs (Expression.ExprClassName): Turned to property.
595 (MemberExpr.CheckIntermediateModification): For checking boxed
596 value types modification.
598 * statement.cs (Fixed.Resolve): Expression type must be
599 convertible to fixed type.
600 (CollectionForeach.GetEnumeratorFilter,TryType):
601 Small refactoring for easier error checking.
603 2005-09-26 Marek Safar <marek.safar@seznam.cz>
605 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
608 * class.cs (GeneratedBaseInitializer): New class for customization
609 compiler generated initializers.
610 (MemberBase.DoDefine): Check Obsolete attribute here.
611 (FieldMember.DoDefine): Ditto.
613 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
616 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
617 (MemberCore.GetObsoleteAttribute): Removed argument.
618 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
619 (MemberCore.CheckObsoleteType): New helper.
623 * statement.cs: Updates after MemberCore changes.
625 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
626 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
628 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
629 obsolete attribute for compiler construct.
630 (As.DoResolve): Cache result.
632 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
634 2005-09-26 Raja R Harinath <rharinath@novell.com>
637 * expression.cs (This.VerifyFixed): In a value type T, the type of
638 'this' is T&, iow, 'this' is either an out or ref parameter. In a
639 value type R, 'this' is treated as a value parameter.
641 2005-09-22 Miguel de Icaza <miguel@novell.com>
643 * statement.cs (Lock): Use the TemporaryVariable class instead of
644 manually using local variables as those do not work when variables
647 * ecore.cs: Moved the TemporaryVariable class from being a nested
648 class inside Foreach to be a public class that can be employed in
651 2005-09-19 Marek Safar <marek.safar@seznam.cz>
653 * cs-parser.jay: interface_accessors replaced by
654 accessor_declarations.
656 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
659 * statement.cs (GotoCase.Resolve): Convert null constant to
661 (SwitchLabel.ResolveAndReduce): Ditto.
662 (SwitchLabel.NullStringCase): Custom null stamp.
663 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
665 typemanager.cs (CSharpSignature): Don't skip first argument
668 2005-09-18 Miguel de Icaza <miguel@novell.com>
670 * driver.cs: Set InEmacs based on the environment variable EMACS.
672 * location.cs (InEmacs): in this mode, do not report column
673 location as it confuses Emacs.
675 2005-09-16 Marek Safar <marek.safar@seznam.cz>
677 * cfold.cs, constant.cs, convert.cs, ecore.cs,
678 expression.cs, iterators.cs, literal.cs: Store constants and
681 * class.cs (MemberBase.ShortName): Pass location.
683 * cs-parser.jay: Some location fixes.
685 * ecore.cs (Expression.Location): Made virtual.
687 2005-09-05 Miguel de Icaza <miguel@novell.com>
689 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
690 if the underlying types are the same, otherwise we need to produce
691 code that will do the proper cast.
693 This was exposed by Marek's constant rewrite which produced
694 invalid code for the call site:
701 This fixes test-49.cs
703 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
705 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
706 Type/Object should be allowed as well. Fixed bug #75968.
708 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
710 * expression.cs : (Binary.DoResolve): when one is enum constant and
711 another is constant 0, then return enum one *as enum type*.
714 2005-09-02 Raja R Harinath <rharinath@novell.com>
716 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
720 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
721 flow-branching for LocalVariableReferences in case we were invoked
723 * expression.cs (LocalVariableReference.VerifyAssigned): New.
725 (LocalVariableReference.DoResolveBase): ... this.
726 (MemberAccess.Resolve): Do the check that was disabled during
729 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
732 (PartialContainer.Create): check abstract/sealed/static strictly
733 but abstract/sealed can exist only at one side. Fixed bug #75883.
735 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
738 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
739 specified, don't default to UnmanagedType.I4.
741 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
743 * expression.cs : conditional operator should check possibly
744 incorrect assign expression. Fixed bug #75946.
746 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
748 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
749 Reverting the change. gmcs is much complex than mcs on this matter.
751 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
753 * cs-tokenizer.cs : To read another token ahead of the actual
754 consumption, use new SavedToken and cache token instead of moving
755 back the stream with SeekableStreamReader (it seemed problematic).
757 driver.cs : Thus use StreamReader directly.
758 * support.cs : Thus removed SeekableStreamReader.
760 2005-08-30 Raja R Harinath <rharinath@novell.com>
763 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
764 (ScopeInfo.EmitScopeType): Use it to construct field names from
765 names of captured locals.
768 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
769 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
770 Pass 'target_type' to BoxedCast. Don't default to 'object'.
771 (ExplicitConversion): Remove enum cases already handled by
772 implicit conversion. Move implicit conversion check to the beginning.
773 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
774 * expression.cs (ArrayCreation.EmitDynamicInitializers):
775 Don't treat System.Enum as a struct.
777 2005-08-30 Jb Evain <jbevain@gmail.com>
779 * attribute.cs: handles as expression in parameters.
781 2005-08-30 Raja R Harinath <rharinath@novell.com>
784 * class.cs (TypeContainer.VerifyClsName): Don't use a
785 PartialContainer when verifying CLS compliance.
786 (AbstractPropertyEventMethod): Set Parent here, ...
787 (PropertyMethod): ... not here.
789 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
791 * attribute.cs : escaped attribute name should not be allowed to be
792 resolved (e.g. @class as classAttribute). Fixed bug #75930.
794 2005-08-29 Raja R Harinath <rharinath@novell.com>
797 * convert.cs (ImplicitStandardConversionExists): Allow zero also
798 when converting a long constant to unsigned long.
799 * expression.cs (Invocation.OverloadResolve): Add sanity check to
800 detect where IsApplicable and VerifyArgumentsCompat disagree.
802 2005-08-29 Raja R Harinath <rharinath@novell.com>
803 and Carlos Alberto Cortez <carlos@unixmexico.org>
806 * class.cs (TypeContainer.CanElideInitializer): New helper.
807 (TypeContainer.EmitFieldInitializers): Use it to determine if we
808 can safely emitting the initializer of a field.
810 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
812 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
813 allowed inside a switch (without loop). Fixed bug #75433.
815 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
817 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
818 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
820 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
822 * driver.cs : kinda reverting the default encoding changes (not exact
823 revert since I noticed that "codepage:reset" might not work fine).
825 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
827 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
828 Location. Now getter and setter store location correctly.
829 (errors/cs0111-12.cs now reports the expected location.)
831 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
833 * driver.cs : Use default encoding on the environment.
834 Removed (now that) extra parameter for SeekableStreamReader.
835 * support.cs : (SeekableStreamReader) third .ctor() argument for
836 StreamReader is not required (always true). preamble size could
837 be acquired in simpler and safe way.
839 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
841 * cs-parser.jay: report CS0642 at warning level 3
842 and report CS0642 for an if else statement also
843 fixes bug #74745. Patch by John Luke (and a bit
845 Removed extra CS0642 warning check for "while",
847 * statement.cs: In Block.Resolve(), CS0642 check
848 is reimplemented to check a sequence of an empty
849 statement and a block.
853 2005-08-24 Marek Safar <marek.safar@seznam.cz>
855 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
856 detection until I fix it.
858 * cs-tokenizer.cs: Changed error message.
860 * cs-parser.jay: Fixed 2 error locations.
862 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
863 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
866 * enum.cs (GetSignatureForError): Fixed.
868 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
872 * typemanager.cs (RegisterProperty): Removed.
874 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
876 2005-08-24 Raja R Harinath <rharinath@novell.com>
879 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
880 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
882 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
884 * expression.cs : tiny fix is required for not warning positive ulong.
887 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
889 * expression.cs : add CS0652 check for constant and integral
890 expression. Fixed bug #53974.
892 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
894 * expression.cs : in DoNumericPromotions(), check if there is implicit
895 conversion overload for string (to check CS0034). Fixed bug #52492.
897 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
899 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
901 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
903 * ecore.cs : report location when it is *not* Null.
905 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
911 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
912 correctly. Fixed bug #75721.
914 2005-08-23 Raja R Harinath <rharinath@novell.com>
916 * support.cs (SeekableStreamReader.Position): Avoid an expensive
917 loop that performs 'min (pos, char_count)'.
920 * expression.cs (Unary.ResolveOperator): Don't discard implicit
921 converted value in Operator.OnesComplement.
923 2005-08-22 Ben Maurer <bmaurer@ximian.com>
925 * anonymous.cs: If the anon method is pulled into a helper class,
926 it needs to be `internal' not `private'. Fixes runtime behavior on
929 2005-08-20 Martin Baulig <martin@ximian.com>
931 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
932 scope if we don't already have it.
934 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
935 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
938 2005-08-17 Marek Safar <marek.safar@seznam.cz>
941 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
944 2005-08-16 Marek Safar <marek.safar@seznam.cz>
946 The big constants rewrite
947 Fix #75746, #75685 and more
948 As a side effect saved 1MB for MWF ;-)
950 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
951 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
952 enum based for corlib compilation.
954 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
957 * class.cs (FixedField.Define): Use ResolveAsConstant.
959 * const.cs (IConstant): Interface constants and enums.
960 (Const.ResolveValue): New method for constant resolvning.
961 (ExternalConstant): Constants from imported assemblies.
963 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
964 conversion; like enums.
965 (Constant.ToType): Converts this constant to different type.
966 (Constant.Increment): Adds 1.
968 * convert.cs (ImplicitConversionRequired): Simplified.
970 * cs-parser.jay: Create EnumMember directly.
972 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
974 * doc.cs (GenerateEnumDocComment): Removed.
976 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
977 (ConvertIntLiteral): Removed.
978 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
980 * enum.cs (EnumMember): Implement IConstant.
981 (Enum.IsValidEnumConstant): Removed.
982 (Enum.GetNextDefaultValue): Removed.
983 (Enum.FindMembers): Updated.
984 (Enum.GenerateDocComment): Iterate enum members.
986 * expression.cs (Cast.TryReduce): Handle enums correctly.
987 (New.Constantify): Made public.
988 (MemberAccess.DoResolve): Removed contant specific if(s).
990 * literal.cs (NullLiteral): Implement new abstract methods.
992 * statement.cs (GotoCase.Resolve): Use new constant methods.
993 (SwitchLabel.ResolveAndReduce): Use new constant methods.
995 * typemanager.cs (LookupEnum): Removed.
996 (IsEnumType): Fixed to work with corlib.
997 (RegisterConstant): Removed.
998 (LookupConstant): Removed.
999 (GetConstant): Changed to work with IConstant.
1001 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
1003 * location.cs : Fixed overflown (>255) column number.
1005 2005-08-03 Raja R Harinath <rharinath@novell.com>
1007 First cut of the qualified-alias-member feature.
1008 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
1010 * cs-parser.jay (DOUBLE_COLON): New token.
1011 (namespace_or_type_name): Add rule for recognizing
1012 qualified-alias-members.
1013 (primary_expression): Likewise.
1014 (element_access): Allow QualifiedAliasMember as a possible
1015 type-bearing expression.
1016 (local_variable_type, local_variable_pointer_type): Likewise.
1017 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
1018 aliases in the current and enclosing namespace declarations.
1019 (NamespaceEntry.UsingAlias): Add CS0440 warning.
1020 * decl.cs (MemberName.is_double_colon): New.
1021 (MemberName.MemberName): Add new constructor for alias-member.
1022 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
1023 * expression.cs (QualifiedAliasMember): New expression type.
1025 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1027 * location.cs : it borked when no argument was specified.
1029 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1031 * location.cs : tiny ToString() format fix.
1033 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1035 * statement.cs : oops, it was missing.
1037 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1039 A set of fixes for precise line/column location.
1042 "token" field now holds a file/line "delta", a line number offset
1043 from the segment, and a column number. See also:
1044 http://lists.ximian.com/pipermail/mono-devel-list/2004-
1045 December/009508.html
1046 Removed static IsNull. Use instance IsNull property instead.
1048 For some tokens it stores Location. For Identifier it stores
1049 LocatedToken which is a pair of string name and location.
1050 Column numbers are adjusted only at getChar().
1052 Use Location.ToString() for reporting (it now contains column).
1054 Largely modified to use LocatedToken instead of
1055 string (IDENTIFIER), and to acquire Location from some tokens.
1056 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
1057 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
1059 Now MemberName holds Location. DeclSpace.ctor() receives Location
1060 as a parameter. Removed extra parameters to all derived classes.
1061 Replaced Location.IsNull() with instance property.
1062 * assign.cs, expression.cs :
1063 Added .ctor() overload that omits Location.
1065 Added "nameEscaped" flag that indicates the identifier was escaped
1066 in the source file. This fixes bug #57047.
1068 2005-08-02 Marek Safar <marek.safar@seznam.cz>
1070 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
1071 New method, looking for lo-case imported cls type.
1073 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
1076 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
1078 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
1080 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
1082 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
1084 Optimized to save 3.5 MB for SWF compilation.
1086 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1088 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
1089 (PartialContainer.Create): Moved logic AddToContainer.
1090 (PartialContainer.MarkForDuplicationCheck): Shares name.
1092 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
1095 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
1097 (Namespace.GetSignatureForError): New method.
1099 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
1100 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
1102 2005-08-01 Raja R Harinath <rharinath@novell.com>
1105 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
1106 member lookup rather than qualifier_type, since qualifier_type can
1109 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1111 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
1114 2005-07-31 Miguel de Icaza <miguel@novell.com>
1116 * statement.cs: Copy the local exception into the exception
1117 captured local. Fixes 75674
1119 2005-07-31 Raja R Harinath <harinath@gmail.com>
1122 * expression.cs (Invocation.OverloadResolve): Don't report error
1123 CS1501 if error CS1502 has been reported.
1124 (New.DoResolve): Delegate CS1501 reporting to
1125 Invocation.OverloadResolve.
1128 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
1129 invariant-meaning-in-block property in an enclosing block if
1132 2005-07-29 Marek Safar <marek.safar@seznam.cz>
1134 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
1135 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
1136 (Switch.CheckSwitch): Just save 50kb for SWF.
1138 2005-07-27 Martin Baulig <martin@ximian.com>
1140 * anonymous.cs (CaptureContext.AddField): Added
1141 `AnonymousContainer am' argument; compute its toplevel scope if
1142 it's not already computed. Fixes #75649.
1144 2005-07-26 Raja R Harinath <rharinath@novell.com>
1147 * class.cs (Constructor.Emit): Reset block to null if the block
1150 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1152 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
1154 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1156 * class.cs (MethodData.Define): Check whether accessor implementing
1157 interface is public.
1159 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
1161 2005-07-22 Marek Safar <marek.safar@seznam.cz>
1164 * namespace.cs (LookupType): Moved same type check to...
1166 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
1169 2005-07-21 Raja R Harinath <rharinath@novell.com>
1171 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
1172 already found a typebuilder.
1173 * class.cs (MethodCore.IsDuplicateImplementation): Compare
1174 MemberNames, not strings.
1176 * const.cs (Error_ExpressionMustBeConst):
1177 Rename from Error_EpressionMustBeConst.
1178 * const.cs, class.cs, statement.cd: Update.
1180 2005-07-21 Marek Safar <marek.safar@seznam.cz>
1184 * const.cs (Const.LookupConstantValue): Report missing contant expression
1186 (Error_EpressionMustBeConstant): Only one error method.
1188 * class.cs, statement.c: Updated.
1190 2005-07-20 Raja R Harinath <rharinath@novell.com>
1192 * statement.cs (Block.Flags): Add back HasVarargs.
1193 (Block.flags): Make protected.
1194 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
1196 * typemanager.cs (types, typecontainers, user_types): Remove.
1197 (UserTypes, TypeContainers): Likewise.
1198 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
1199 (CleanUp, Reset): Update.
1200 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
1201 (GetNestedType): Use Type.GetNestedType.
1202 (CoreLookupType): Take two arguments, the namespace and the
1203 basename of the type. Update to use the Namespace.Lookup
1205 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
1206 (RealMemberLookup): Use IsNestedChildOf instead of playing with
1207 string concatenation and substring matches.
1208 * class.cs, enum.cs, delegate.cs: Update to changes.
1210 2005-07-20 Marek Safar <marek.safar@seznam.cz>
1212 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
1213 Expression and made virtual.
1215 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
1216 (ImplicitStandardConversionExists): Fixed `byte' typo ?
1218 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
1220 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
1223 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
1226 2005-07-18 Marek Safar <marek.safar@seznam.cz>
1229 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
1230 AssemblyCultureAttribute is not used on executable.
1233 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
1235 2005-07-16 Raja R Harinath <rharinath@novell.com>
1238 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
1239 New. Reports CS0252/CS0253.
1240 Mostly taken from preliminary patch by Duncak Mak.
1241 (Binary.DoResolveOperator): Store results of operator lookup.
1242 Use them to detect if we need to warn about unintended reference
1245 2005-07-15 Raja R Harinath <rharinath@novell.com>
1248 * namespace.cs (Namespace.Lookup): Add back location parameter.
1249 (Namespace.LookupType): Add CS0436 report. Add location parameter.
1250 * delegate.cs, ecore.cs, expression.cs: Update to changes.
1252 * codegen.cs (EmitContext.DeclSpace): Make readonly.
1253 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
1254 (Namespace.LookupType): ... this.
1255 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
1257 * typemanager.cs (LookupTypeReflection): Remove buggy code that
1258 purported to handle pointers.
1259 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
1262 2005-07-15 Marek Safar <marek.safar@seznam.cz>
1264 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
1267 2005-07-15 Raja R Harinath <rharinath@novell.com>
1269 * namespace.cs (Namespace.Lookup): Drop location parameter.
1270 (NamespaceEntry.LookupAlias): Remove. Merge into ...
1271 (NamespaceEntry.Lookup): ... this.
1272 (NamespaceEntry.Error_AmbiguousTypeReference):
1273 Move here from DeclSpace.
1274 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
1276 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
1277 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
1278 Move to NamespaceEntry.
1279 * delegate.cs, expression.cs: Update to changes.
1281 2005-07-14 Marek Safar <marek.safar@seznam.cz>
1283 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
1284 CheckAttributeType and refactored.
1285 (Attribute.ResolvePossibleAttributeType): Changed to reuse
1286 ResolveAsTypeTerminal error handling.
1287 (ResolveAsTypeTerminal): Introduced because of global attributes extra
1289 (GetSignatureForError): Print errors in same way.
1292 * codegen.cs: Reflect attribute GetSignatureForError change.
1295 * expression.cs: Add silent parameter to ResolveAsTypeStep.
1297 * namespace.cs (UsingEntry): Refactored to make fields private.
1300 statement.cs: Error_UnexpectedKind has extra parameter.
1302 2005-07-14 Raja R Harinath <rharinath@novell.com>
1304 * ecore.cs (IAlias): Remove.
1305 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
1306 that implement the interface.
1307 * namespace.cs (Namespace): Likewise.
1308 (Namespace.declspaces): Renamed from 'defined_names'.
1309 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
1310 DeclSpace instead of an IAlias.
1311 * tree.cs (Tree.AddDecl): Update.
1313 2005-07-12 Raja R Harinath <rharinath@novell.com>
1315 * statement.cs (Block.Flags); Remove HasVarargs.
1316 (Block.HasVarargs): Move to ToplevelBlock.
1317 (Block.ThisVariable, Block.AddThisVariable): Likewise.
1318 (Block.Variables): Make protected. Initialize variable hashtable
1320 (Block.AddVariable): Update.
1321 (Block.Resolve): Update to changes.
1322 (ToplevelBlock.HasVarargs): New boolean.
1323 (ToplevelBlock.ThisVariable): Move here from Block.
1324 (ToplevelBlock.AddThisVariable): Likewise.
1325 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
1326 * expression.cs (This.ResolveBase): Update to changes.
1327 (ArglistAccess.DoResolve): Likewise.
1329 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1332 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
1334 * class.cs (TypeContainer.VerifyMembers): Distinguish between
1335 not used and not used & assigned.
1336 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
1338 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1341 * expression.cs (Is.DoResolve): null is never provided type.
1343 2005-07-08 Marek Safar <marek.safar@seznam.cz>
1346 * cs-parser.jay: Less strict event error rule to catch more errors.
1348 2005-07-08 Martin Baulig <martin@ximian.com>
1350 Fix test-iter-10.cs - distinguish whether we `yield' in a property
1351 gettter (allowed) or setter (not allowed).
1353 * class.cs (Accessor): Implement IIteratorContainer.
1354 (Accessor.Yields): New public field.
1355 (PropertyBase.PropertyMethod.Define): Handle iterators on a
1359 (get_accessor_declaration, set_accessor_declaration): Set the
1360 `yields' flag on the accessor, not the property.
1361 (property_declaration): Do the iterators check on a per-accessor
1362 basis and not for the whole property.
1364 2005-07-08 Martin Baulig <martin@ximian.com>
1366 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
1367 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
1369 2005-07-07 Marek Safar <marek.safar@seznam.cz>
1372 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
1373 (ExtractSecurityPermissionSet): Cope with self referencing security
1374 attributes properly.
1376 * driver.cs (SetOutputFile): Made public property OutputFile.
1378 2005-07-07 Raja R Harinath <rharinath@novell.com>
1381 * class.cs (TypeContainer.first_nonstatic_field): Rename from
1382 has_nonstatic_fields. Make into a FieldBase pointer.
1383 (TypeContainer.AddField): Add CS0282 check.
1384 (TypeContainer.EmitType): Update.
1386 2005-07-06 Miguel de Icaza <miguel@novell.com>
1388 * cs-tokenizer.cs (consume_identifier): Do not create strings to
1389 compare if they start with __.
1391 2005-07-06 Raja R Harinath <rharinath@novell.com>
1393 * statement.cs (Switch.SwitchGoverningType): Only look at
1394 UserCasts that don't need implicit standard conversions to one of
1395 the allowed switch types (Fixes test-322.cs).
1396 (LocalInfo.Resolve): Re-enable sanity-test.
1398 2005-07-06 Marek Safar <marek.safar@seznam.cz>
1400 * cs-tokenizer.cs (consume_identifier): Detect double undescores
1402 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
1404 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
1406 2005-07-06 Raja R Harinath <rharinath@novell.com>
1409 * ecore.cs (SimpleName.GetSignatureForError): Add.
1410 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
1411 (MemberAccess.GetSignatureForError): Add.
1413 2005-07-05 Marek Safar <marek.safar@seznam.cz>
1415 The big error and warning messages review.
1445 * typemanager.cs: Updated.
1447 * class.cs: (MethodCore.SetYields): Moved here to share.
1448 (PropertyMethod.Define): Moved iterator setup here.
1450 * iterators.cs: Add orig_method to have full access to parent
1453 2005-07-05 Raja R Harinath <rharinath@novell.com>
1455 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
1456 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
1457 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
1458 variable of struct type.
1459 * expression.cs (Unary.ResolveOperator): Update to change.
1460 (Indirection.VerifyFixed): Likewise.
1461 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
1462 (ParameterReference.VerifyFixed): Value parameters are fixed.
1463 (This.VerifyFixed): Treat 'this' as a value parameter.
1464 * statement.cs (LocalInfo.IsFixed): Remove.
1466 2005-07-01 Martin Baulig <martin@ximian.com>
1468 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
1469 `ec.EmitThis ()' to get the correct scope.
1471 2005-07-01 Martin Baulig <martin@ximian.com>
1473 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
1474 instance is a ParameterReference; fixes #75299.
1476 2005-07-01 Martin Baulig <martin@ximian.com>
1478 Reverted Marek's latest patch (r46725):
1479 - it contains structural changes which are neither mentioned in
1480 the ChangeLog nor explained anywhere; for example the additional
1481 argument of EmitContext's and Iterator's .ctor's and the
1482 TypeContainer.DefineMembers() change.
1483 - structural changes like this should go in in seperate patches
1484 and not be hidden in a huge patch which just seems to affect
1485 warnings and errors.
1486 a big and hard to understand patch.
1487 - it breaks iterators and causes regressions, for instance in
1490 2005-06-30 Raja R Harinath <rharinath@novell.com>
1493 * expression.cs (Indexers.map): Remove.
1494 (Indexers.Append): Filter out inaccessible setters and getters.
1495 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
1498 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
1500 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
1501 (FieldExpr.Emit, PropertyExpr.Emit): Update.
1502 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
1503 * expression.cs (Invocation.EmitCall): Add CS0120 check.
1505 2005-06-30 Marek Safar <marek.safar@seznam.cz>
1508 * class.cs (FieldBase.GetInitializerExpression): One more field
1511 2005-06-28 Miguel de Icaza <miguel@novell.com>
1513 * pending.cs: Do not define a proxy if the base method is virtual,
1514 it will be picked up by the runtime (bug 75270).
1516 2005-06-08 Martin Baulig <martin@ximian.com>
1518 The big Iterators rewrite :-)
1520 * iterators.cs: Rewrite this to use the anonymous methods framework.
1522 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
1523 before the TypeContainers; see 2test-21.cs.
1526 (TypeContainer.DefineType): Don't create a new EmitContext if we
1527 already have one (this only happens if we're an Iterator).
1528 (TypeContainer.Define): Also call Define() on all our iterators.
1529 (Method.CreateEmitContext): Added support for iterators.
1532 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
1533 (AnonymousContainer.CreateMethodHost): Moved here from
1534 AnonymousMethod and made abstract.
1535 (AnonymousContainer.CreateScopeType): New abstract method.
1536 (AnonymousContainer.IsIterator): New public property.
1537 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
1538 get the ScopeTypeBuilder rather than manually defining it here.
1539 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
1542 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
1543 before RootContext.DefineTypes().
1545 * codegen.cs (EmitContext.RemapToProxy): Removed.
1546 (EmitContext.CurrentAnonymousMethod): Changed type from
1547 AnonymousMethod -> AnonymousContainer.
1548 (EmitContext.ResolveTopBlock): Protect from being called twice.
1549 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
1550 (EmitContext.EmitThis): Removed the iterators hacks; use the
1551 anonymous methods framework for that.
1554 (ToplevelBlock.Container): Make this a property, not a field.
1555 (ToplevelBlock.ReParent): New public method; move the
1556 ToplevelBlock into a new container.
1557 (Foreach.TemporaryVariable): Simplify.
1559 2005-06-05 Martin Baulig <martin@ximian.com>
1561 * statement.cs (LocalInfo.CompilerGenerated): New flag.
1562 (Block.AddTemporaryVariable): New public method; creates a new
1563 `LocalInfo' for a temporary variable.
1564 (Block.EmitMeta): Create the LocalBuilders for all the temporary
1566 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
1567 non-iterator variables.
1569 2005-06-05 Martin Baulig <martin@ximian.com>
1571 * statement.cs (Foreach.TemporaryVariable): Create the
1572 LocalBuilder in the Emit phase and not in Resolve since in some
1573 situations, we don't have an ILGenerator during Resolve; see
1574 2test-19.cs for an example.
1576 2005-06-04 Martin Baulig <martin@ximian.com>
1578 **** Merged r45395 from GCS ****
1580 The big Foreach rewrite - Part II.
1582 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
1583 with `PropertyInfo ienumerator_getcurrent'.
1585 * codegen.cs (VariableStorage): Removed.
1588 (Foreach): Derive from Statement, not ExceptionStatement.
1589 (Foreach.CollectionForeach): New nested class. Moved all the code
1590 dealing with collection foreach here.
1591 (Foreach.ForeachHelperMethods): Removed.
1592 (Foreach.TemporaryVariable): Implement IMemoryLocation.
1594 2005-05-23 Martin Baulig <martin@ximian.com>
1596 * statement.cs (Try.DoResolve): Don't create a `finally' if we
1597 don't need to. Fix #75014.
1599 2005-05-20 Martin Baulig <martin@ximian.com>
1601 Merged r44808 from GMCS.
1603 * class.cs (TypeContainer.CircularDepException): Removed.
1604 (TypeContainer.DefineType): Removed the `InTransit' stuff.
1605 (TypeContainer.CheckRecursiveDefinition): Check for circular class
1606 (CS0146) and interface (CS0529) dependencies here.
1608 2005-06-21 Raja R Harinath <rharinath@novell.com>
1610 * expression.cs (Invocation.EmitCall): Fix initialization
1611 'this_call' to reflect current behaviour. Fix indentation.
1613 * convert.cs (FindMostEncompassedType): Add two trivial special
1614 cases (number_of_types == 0 || number_of_types == 1).
1615 (FindMostEncompasingType): Likewise.
1617 2005-06-17 Raja R Harinath <rharinath@novell.com>
1619 Some cleanups preparing for the fix of #75283.
1620 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
1622 (EventExpr.InstanceResolve): Likewise.
1623 (EventExpr.DoResolve): Remove redundant checks.
1625 2005-06-10 Duncan Mak <duncan@novell.com>
1627 * cs-tokenizer.cs (process_directives): New flag for controlling
1628 the processing of preprocessor directives.
1629 (x_token): After seeing a '#', return Token.NONE instead of going
1630 to handle_preprocessing_directive() when not processing
1631 directives. This avoids unnecessary processing during the token peek in
1636 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
1637 the existing error reporting methods instead of Report.Error.
1639 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
1640 after Raja's rewrite.
1642 2005-06-08 Miguel de Icaza <miguel@novell.com>
1644 * class.cs: Small fix.
1646 2005-06-08 Raja R Harinath <rharinath@novell.com>
1649 * class.cs (GetPartialBases): Fix return value check of
1652 2005-06-07 Raja R Harinath <rharinath@novell.com>
1654 Ensure that partial classes are registered in their enclosing
1655 namespace. Initial part of fix of #75160.
1656 * tree.cs (Tree.RecordDecl): Add new namespace argument.
1657 Register declspace with namespace here, not in
1658 DeclSpace.RecordDecl.
1659 * cs-parser.jay: Pass namespace to RecordDecl.
1660 * class.cs (PartialContainer.Create): Likewise.
1661 (ClassPart.DefineType): New sanity-check. Throws an exception if
1663 * decl.cs (Declspace.RecordDecl): Remove.
1664 * namespace.cs (NamespaceEntry.DefineName): Remove.
1666 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1668 * rootcontext.cs: Reset TargetExt as well.
1670 2005-06-03 Raja R Harinath <rharinath@novell.com>
1672 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1675 2005-06-02 Raja R Harinath <rharinath@novell.com>
1677 Fix #75080, cs0119.cs.
1678 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1680 (Expression.Resolve): ... this. Use it. Remove bogus code
1681 allowing ExprClass.Type and ExprClass.Namespace for
1682 ResolveFlags.VariableOrValue.
1683 (Expression.Resolve) [1-argument variant]: Change default resolve
1684 flags based on language version.
1685 (Expression.Error_UnexpectedKind): Use a simple string array
1686 rather than an ArrayList.
1687 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1689 (TypeOfVoid.DoResolve): Likewise.
1690 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1691 flags argument -- it always has the same value.
1693 2005-05-31 Raja R Harinath <rharinath@novell.com>
1696 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1697 Use it in the error message.
1698 * assign.cs, expression.cs, statement.cs: Update.
1700 2005-05-30 Raja R Harinath <rharinath@novell.com>
1703 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1704 the "almostMatchedMember" case too.
1705 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1706 that failed the accessibility checks to 'almost_match'.
1708 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1710 * attribute.cs: Use internal MethodBuilder methods to set
1711 ExactSpelling and SetLastError on PInvoke methods, instead
1712 of passing them via charset. Fixes #75060.
1714 2005-05-27 Raja R Harinath <rharinath@novell.com>
1716 * parameter.cs (Parameter): Remove TODO comment.
1717 (Parameter.DefineParameter): Remove Location parameter.
1718 (Parameters.LabelParameters): Likewise.
1719 * class.cs (Constructor.Emit): Update to change.
1720 (MethodData.Emit): Likewise.
1721 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1722 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1724 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1727 Removed Parameters.Location and added Parameter.Location instead.
1728 Removed Location parameter from Emit() and GetSignature().
1735 Modified all related calls.
1737 2005-05-26 Raja R Harinath <rharinath@novell.com>
1739 Improve user-defined conversion handling.
1740 * convert.cs (GetConversionOperators): Rewrite. Return only the
1741 applicable operators.
1742 (AddConversionOperators): New. Helper for GetConversionOperators.
1743 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1744 there is only one most encompassed/encompassing type.
1745 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1746 "applicable operator" handling.
1747 (UserConversion): Move cache here from GetConversionOperators.
1748 Directly cache the chosen operator, rather than the whole
1750 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1751 case. Allow conversion of decimal to sbyte and byte too.
1752 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1753 New static methods. Used to avoid allocating EmptyExpressions in
1756 2005-05-24 Duncan Mak <duncan@novell.com>
1758 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1759 another class, used in Convert.ExplicitNumericConversion.
1760 (CastToDecimal): New class, similar to above, but casts to
1761 System.Decimal, used in Convert.ImplicitNumericConversion and also
1762 in explicit convesion from double/float to decimal.
1764 * convert.cs (ImplicitNumericConversion): Handle implicit
1765 conversions to System.Decimal.
1766 (ExplicitNumericConversion): handle explicit conversions to
1771 2005-05-20 Miguel de Icaza <miguel@novell.com>
1773 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1774 know the type at this stage, just break through. Fixes #75008
1776 2005-05-19 Martin Baulig <martin@ximian.com>
1779 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1780 to disable error reporting.
1782 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1783 here since we don't want to report an error; see the new test-336.cs.
1785 2005-05-19 Raja R Harinath <rharinath@novell.com>
1787 * statement.cs (ToplevelBlock.GetParameterReference)
1788 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1789 Move here from class Block.
1790 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1791 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1793 2005-05-18 Martin Baulig <martin@ximian.com>
1798 (FlowBranching.Reachability): Add non-static public And() and Or()
1800 (FlowBranchingSwitch): New class; do the `break_origins' thing
1801 like in FlowBranchingLoop.
1802 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1803 reachability, not just locals and parameters.
1804 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1805 switch; MergeBreakOrigins() now takes care of that.
1807 2005-05-18 Martin Baulig <martin@ximian.com>
1809 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1810 a loop and may leave it, reset the barrier; fixes #74974.
1812 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1814 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1817 * cs-parser.jay: Catch more lexical errors.
1819 * report.cs: Add one more Error method.
1822 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1824 2005-05-17 Martin Baulig <martin@ximian.com>
1826 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1829 2005-05-16 Raja R Harinath <rharinath@novell.com>
1831 Fix test-382.cs. Emit values of decimal constants.
1832 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1834 (TypeContainer.AddField): ... this.
1835 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1836 with initializers to include 'Const's.
1837 (ClassPart.RegisterFieldForInitialization): Forward to
1839 * const.cs (Const.Const): Pass initializer to base class.
1840 (Const.Define): In case of decimal constants, register them for
1841 initialization in a static constructor.
1843 2005-05-14 Martin Baulig <martin@ximian.com>
1845 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1846 do not call ResolveUnreachable() on unreachable statements in
1847 here, see the comment in the source code.
1849 2005-05-13 Raja R Harinath <rharinath@novell.com>
1852 * expression.cs (BinaryResolveOperator): If one of the operands of
1853 an equality comparison is 'null' and the other is a pointer type,
1854 convert the null to a NullPointer.
1855 * convert.cs (ImplicitReferenceConversion): If the expression is a
1856 NullLiteral and the target type is a pointer type, return a
1857 NullPointer instead.
1858 (ImplicitConversionStandard): Likewise.
1860 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1862 * cs-parser.jay: Set readonly context based on special constructs.
1864 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1865 readonly variable error handling.
1867 * rootcontext.cs (EmitCode): Don't verify members when error
1870 * statement.cs (LocalInfo): Add reaodnly context information.
1871 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1873 2005-05-13 Raja R Harinath <rharinath@novell.com>
1875 * statement.cs (Block.Resolve): Revert change below. Modify fix
1876 for #74041 to initialize 'resolved' to false only for explicit
1877 blocks. Fixes #74873.
1879 2005-05-12 Raja R Harinath <harinath@gmail.com>
1882 * typemanager.cs (unmanaged_enclosing_types): New.
1883 (IsUnmanagedType): Avoid infloops by using
1884 'unmanaged_enclosing_types' to talk with recursive invocations.
1886 2005-05-13 Martin Baulig <martin@ximian.com>
1888 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
1889 instance variable, not a local. Fix #74873.
1890 (Block.ResolveUnreachable): Set it to true here.
1892 2005-05-11 Duncan Mak <duncan@novell.com>
1894 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
1895 continuing to process for 'arg'.
1896 (handle_preprocessing_directive): Check the argument of the #endif
1897 directive and report error CS1025 if there are any trailing
1900 According to the C# spec, having even whitespace after the #endif
1901 directive is illegal; however, because we call arg.TrimEnd ()
1902 beforehand, we have the same behavior as csc, allowing whitespace
1903 after the directive.
1907 2005-05-11 Marek Safar <marek.safar@seznam.cz>
1911 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
1912 (Constructor.GetObsoleteAttribute): Implemented correctly.
1914 2005-05-10 Martin Baulig <martin@ximian.com>
1916 * support.cs (ReflectionParameters.ParameterModifier): Use
1917 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
1918 and `ParameterAttributes.In'. Fixes #74884.
1920 2005-05-10 Marek Safar <marek.safar@seznam.cz>
1922 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
1924 * expression.cs (Argument.GetParameterModifier): Turned to property.
1925 (Invocation.Error_InvalidArguments): Add more descriptive errors.
1927 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
1930 2005-05-09 Raja R Harinath <rharinath@novell.com>
1933 * decl.cs (MemberCache.AddMethods): Register override methods,
1934 rather than non-override methods.
1935 * typemanager.cs (RegisterOverride): New.
1936 (IsOverride): Update.
1938 2005-05-09 Marek Safar <marek.safar@seznam.cz>
1942 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
1943 recursive declaration.
1945 * statement.cs (Block.ResolveMeta): Report any error in resolving.
1947 2005-05-06 Marek Safar <marek.safar@seznam.cz>
1949 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
1951 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
1953 2005-05-05 Raja R Harinath <rharinath@novell.com>
1956 * decl.cs (DeclSpace.FamilyAccessible):
1957 Use TypeManager.IsNestedFamilyAccessible.
1959 Fix reopened #64812.
1960 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
1963 2005-05-04 Raja R Harinath <rharinath@novell.com>
1964 Abin Thomas <projectmonokochi@rediffmail.com>
1965 Anoob V E <projectmonokochi@rediffmail.com>
1966 Harilal P R <projectmonokochi@rediffmail.com>
1969 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
1970 allow access to all static members.
1972 2005-05-04 Martin Baulig <martin@ximian.com>
1974 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
1976 2005-05-04 Martin Baulig <martin@ximian.com>
1980 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
1981 section at the end; make things work if `default' is not the last
1984 2005-05-04 Martin Baulig <martin@ximian.com>
1988 * statement.cs (Switch): Replaced the `got_default' field with a
1989 `default_section' one.
1990 (Switch.CheckSwitch): Set `default_section' here.
1991 (Switch.Resolve): If we're a constant switch and the constant is
1992 not found, use the default section.
1994 2005-05-03 Martin Baulig <martin@ximian.com>
1996 * expression.cs (ArrayAccess.EmitGetLength): New public method.
1998 * statement.cs (Foreach.ArrayForeach): New nested class.
1999 (Foreach.TemporaryVariable): New nested class.
2000 (Foreach.EmitArrayForeach): Removed; this is now in the new
2003 2005-05-03 Raja R Harinath <rharinath@novell.com>
2005 * pending.cs (BaseImplements): Move the #74773 fix here. This is
2007 (VerifyPendingMethods): Revert change below.
2009 * typemanager.cs (IsOverride, RegisterNonOverride): New.
2010 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
2011 that used to trigger warning -28. Remove warning -28.
2012 * expression.cs (Invocation.OverloadResolve): Use
2013 TypeManager.IsOverride to distinguish override methods.
2016 * pending.cs (VerifyPendingMethods): If a base type implements the
2017 requested interface, don't bother checking individual methods of
2018 the base type. As a side-effect, this prevents the creation of
2019 unnecessary proxies.
2021 2005-05-02 Martin Baulig <martin@ximian.com>
2025 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2026 Also `And' the locals if the old vector is null.
2027 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
2028 null; in this case we basically reset all the variables.
2030 2005-05-02 Martin Baulig <martin@ximian.com>
2034 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
2035 Added `FlowBranching branching' argument; always `and' the
2036 variables instead of `or'ing them unless we're an infinite loop.
2038 * statement.cs (While.Resolve): Create a new sibling unless we're
2041 2005-05-02 Martin Baulig <martin@ximian.com>
2045 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
2046 arguments; use it instead of creating a new TopLevelBlock.
2047 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
2048 our ConstructorInitializer.
2051 (TopLevelBlock.TopLevelBranching): New public property.
2052 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
2053 and create our `TopLevelBranching'.
2055 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
2056 anonymous method host, use `block.TopLevelBranching' rather than
2057 creating a new branching.
2059 2005-04-20 Miguel de Icaza <miguel@novell.com>
2061 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
2062 a ScopeInfo, if any of the current children is a child of the new
2063 entry, move those children there.
2065 2005-04-30 Martin Baulig <martin@ximian.com>
2067 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
2068 at the beginning of a SwitchSection. Fix #73335.
2070 2005-04-27 Marek Safar <marek.safar@seznam.cz>
2073 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
2075 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
2076 (FieldExpr.DoResolve): Obsolete members are ignored for field
2079 2005-04-26 Marek Safar <marek.safar@seznam.cz>
2081 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
2082 of arrays detection.
2084 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
2086 (Field.VerifyClsCompliance): Volatile fields are not compliant.
2088 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
2091 2005-04-25 Ben Maurer <bmaurer@ximian.com>
2093 * cs-parser.jay: Use the prefered version of -unsafe in error
2096 2005-04-22 Marek Safar <marek.safar@seznam.cz>
2098 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
2101 2005-04-20 John Luke <john.luke@gmail.com>
2103 * driver.cs: fix typo in error message, --outout to --output
2105 2005-04-20 Marek Safar <marek.safar@seznam.cz>
2107 * codegen.cs (InRefOutArgumentResolving): New field.
2109 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
2110 fields outside contructor.
2112 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
2114 2005-04-19 Miguel de Icaza <miguel@novell.com>
2116 * anonymous.cs (CaptureContext.EmitParameterInstance): The
2117 parameter code was not completed ever, so it was not as up-to-date
2118 as local variables. Must finish it.
2120 The bug fix was to compare the Toplevel of the block, not the
2121 current block. Thanks for Ben for pointing this out.
2123 2005-04-19 Raja R Harinath <rharinath@novell.com>
2125 * decl.cs (AddMethods): Use the declaring type of the problem
2126 method to determine if we want to squash a warning.
2128 2005-04-19 Marek Safar <marek.safar@seznam.cz>
2130 * attribute.cs: Removed debug output.
2132 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
2134 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
2137 2005-04-18 Raja R Harinath <rharinath@novell.com>
2140 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
2141 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
2142 all null comparisons against reference types.
2144 2005-04-18 Marek Safar <marek.safar@seznam.cz>
2147 * class.cs (TypeContainer.CircularDepException) New nested
2149 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
2150 (TypeContainer.DefineType): Removed error, reset InTransit before
2152 (Class.DefineType): Throw exception when is in Transit.
2153 Catch exception and report error.
2154 (Struct.DefineType): Throw exception when is in Transit.
2155 Catch exception and report error.
2156 (Interface.DefineType): Throw exception when is in Transit.
2157 Catch exception and report error.
2159 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
2160 handle nested exception handlers.
2162 * flowanalysis.cs (InTryWithCatch): New method, search for try with
2165 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
2166 InFinally and InCatch storage.
2168 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
2169 (Catch.Resolve): Set and Restore ec.InCatch.
2170 (Try.Resolve): Set and Restore ec.InFinally.
2171 (Try.HasCatch): True when try has catch.
2173 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
2175 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
2176 for the same event member, so exclude such cases from warning 419.
2179 2005-04-16 Miguel de Icaza <miguel@novell.com>
2181 * expression.cs (Binary.ResolveOperator): Apply patch from John
2182 Luke to fix bug 59864: operators &, | and ^ on enumerations
2183 require that the same enum type on both sides.
2185 * driver.cs: Add warnings to old flag usage, this is to assist
2186 people who produce Makefiles and hope that the Makefiles will be
2189 * class.cs (TypeContainer.EmitType): Moved the definition of the
2190 special $PRIVATE$ field from the resolve phase to the Emit phase.
2191 During resolve we do not know if we are a struct with
2192 HasExplicitLayout, we know this only after the attributes for the
2195 Set the FieldOffset to zero on the dummy field that we create for
2196 the class. Fixes 74590.
2198 2005-04-16 Raja R Harinath <rharinath@novell.com>
2201 * ecore.cs (PropertyExpr.resolved): New.
2202 (DoResolve): Use it to handle a case of double resolution here.
2203 Handle a case of identical-name-and-type-name.
2204 * expression.cs (ArrayCreation.CheckIndices): Avoid double
2205 resolution by storing the results of expression resolution back
2206 into the "probes" array.
2208 2005-04-15 Raja R Harinath <rharinath@novell.com>
2210 Fix cs0208-7.cs and cs0208-8.cs.
2211 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
2212 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
2213 error reporting to point out the reason a struct is not unmanaged.
2215 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2217 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
2218 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
2220 2005-04-13 Raja R Harinath <rharinath@novell.com>
2223 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
2224 IdenticalNameAndTypeName here.
2225 (EventExpr.InstanceResolve): Likewise.
2227 2005-04-13 Marek Safar <marek.safar@seznam.cz>
2229 C# 2.0 DefaultCharSetAttribute implementation
2231 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
2232 which allows us to set GlobalNamespace for every resolve.
2233 (Attribute.ResolveArguments): Cut from Resolve.
2234 (Attribute.GetCharSetValue): Returns CharSet named argument.
2235 (Attribute.DefinePInvokeMethod): Gets default charset from
2237 (GlobalAttribute.ResolveAsTypeStep): Override.
2238 (GlobalAttribute.ResolveArguments): Override.
2240 * class.cs (TypeAttr): Is protected.
2242 * codegen.cs (ModuleClass.DefaultCharSet): New member.
2243 (ModuleClass.DefaultCharSetType): New memeber.
2244 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
2246 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
2247 charset from module.
2249 * delegate.cs (TypeAttr): Override.
2250 (Delegate.DefineType): Use this TypeAttr.
2252 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
2253 at very early stage (before types are defined) to resolve model
2254 module attributes. It will probably not work with corlib but it
2257 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
2258 charset from module.
2260 * typemanager.cs (default_charset_type): New type.
2262 2005-04-13 Raja R Harinath <rharinath@novell.com>
2264 * decl.cs (MemberCache.AddMethods): Don't warn if
2265 System.Object.Finalize has buggy MethodAttributes.
2267 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
2270 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2272 * doc.cs : detect ambiguous reference to overloaded members.
2273 Fixed bug #71603. MS 1.1 csc does not detect it.
2275 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2277 * doc.cs : delegates must not be referenced with parameters.
2280 2005-04-12 Miguel de Icaza <miguel@novell.com>
2282 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
2284 2005-04-10 Miguel de Icaza <miguel@novell.com>
2286 * driver.cs (MainDriver): Stop processing if the CLS stage found
2289 (CompilerCallableEntryPoint.InvokeCompiler): Always
2290 reset after execution; Take a TextWriter argument for the
2293 * report.cs: Use the error stream instead of hardcoding stderr.
2295 2005-04-09 Miguel de Icaza <miguel@novell.com>
2297 * class.cs: Reduce code paths to test, too small of an
2298 optimization to make it worth the extra testing. Always perform
2301 2005-04-08 Raja R Harinath <rharinath@novell.com>
2304 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
2305 operators that had errors reported on them.
2307 2005-04-08 Marek Safar <marek.safar@seznam.cz>
2309 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
2311 (Attribute.Resolve): Add named argument type checking.
2313 * class.cs (FixedField.Define): Use IsPrimitiveType
2315 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
2317 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
2318 unsafe parameter types.
2320 * statement.cs (Using.ResolveExpression): Add better error description.
2322 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
2324 2005-04-08 Raja R Harinath <rharinath@novell.com>
2327 * attribute.cs (Attribute.GetAttributeUsage): Resolve
2328 AttributeUsageAttribute in the emitcontext of the attribute class,
2329 not in the emitcontext of the attributable entity it was attached to.
2330 * cs-parser.jay: Use 'current_class', not 'current_container',
2331 when creating a GlobalAttribute.
2333 2005-04-08 Alp Toker <alp@atoker.com>
2335 * pending.cs: The fix to #58413 failed to compile methods implementing
2336 interfaces with/without params modifiers and vice versa, even though
2337 params modifiers aren't part of the signature. Make the modifier check
2338 less strict as in csc.
2340 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
2341 Anoob V E <projectmonokochi@rediffmail.com>
2342 Harilal P R <projectmonokochi@rediffmail.com>
2345 * pending.cs (TypeAndMethods.mods): New. Store the parameter
2346 modifiers of pending methods.
2347 (PendingImplementation.PendingImplementation): Initialize it.
2348 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
2349 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
2350 with ParameterData. Add check for modifiers.
2351 * class.cs (MethodData.Define): Update to changes.
2353 2005-04-07 Raja R Harinath <rharinath@novell.com>
2355 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
2357 2005-04-07 Marek Safar <marek.safar@seznam.cz>
2359 * class.cs (PropertyMethod.Define): Check private accessor in abstract
2362 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
2365 * typemanager.cs: Registered RequiredAttributeAttribute.
2367 2005-04-06 Marek Safar <marek.safar@seznam.cz>
2369 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
2370 Warning CS0169 is back at level 3.
2371 (IMethodData.SetMemberIsUsed): New method.
2373 * decl.cs (IsUsed): New value; moved from FieldBase.Status
2374 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
2376 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
2378 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
2380 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
2383 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
2386 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
2387 to avoid the problems with nested types.
2389 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
2390 Anoob V.E <projectmonokochi@rediffmail.com>
2391 Harilal P.R <projectmonokochi@rediffmail.com>
2392 Raja R Harinath <rharinath@novell.com>
2395 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
2397 * typemanager (GetConstructor): Make public.
2399 2005-04-05 John Luke <john.luke@gmail.com>
2400 Raja R Harinath <rharinath@novell.com>
2403 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
2404 struct too. Return false quicker in a few cases.
2405 (VerifyUnManaged): Use it.
2407 2005-04-05 Raja R Harinath <rharinath@novell.com>
2410 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
2411 not 'unreachable_seen'.
2413 2005-04-04 Marek Safar <marek.safar@seznam.cz>
2415 * attribute.cs (Attribute.GetValue): Removed unused.
2417 * codegen.cs (CodeGen.TrimExt): Removed unused.
2419 * cs-parser.jay (output): Removed unused.
2421 * cs-tokenizer.cs (hex_digits): Removed unused.
2423 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
2425 * expression.cs (Indirection.LoadExprValue): Removed unused.
2426 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
2428 * iterators.cs (Iterator.param_types): Removed unused.
2430 * statement.cs (Goto.block): Removed unused.
2431 (ToplevelBlock.did): Removed unused.
2432 (Switch.ResolveConstantSwitch): Removed unused.
2434 2005-04-01 Ben Maurer <bmaurer@ximian.com>
2436 * rootcontext.cs: Allow mcs to bootstrap with the compilation
2439 2005-04-01 Raja R Harinath <rharinath@novell.com>
2441 Fix #74232 and cs0208-3.cs.
2442 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
2443 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
2444 unmanaged type. Don't use FieldBuilders when 't' is a
2445 TypeBuilder. Use ModFlags and MemberType fields.
2446 * class.cs (MemberBase.member_type): Rename from MemberType.
2447 (MemberBase.MemberType): New property. Determines member_type on
2449 (MemberBase.DoDefine): Don't initialize MemberType here.
2450 (FieldMember.Define): Likewise.
2452 2005-04-01 Marek Safar <marek.safar@seznam.cz>
2455 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
2456 Attributes are emitted there.
2458 2005-04-01 Raja R Harinath <rharinath@novell.com>
2460 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
2461 keyword in 'partial enum' too.
2462 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
2464 Report from Kamil Skalski <nazgul@omega.pl>.
2467 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
2468 have partial containers too.
2470 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
2471 in block' checks to Block.CheckInvariantMeaningInBlock.
2472 * statement.cs (Block.GetKnownVariableInfo): Make private.
2473 (Block.IsVariableUsedInChildBlock): Remove.
2474 (Block.IsVariableUsedInBlock): Likewise.
2475 (Block.CheckInvariantMeaningInBlock): New. Show location of
2476 conflicting declaration.
2477 (Block.AddVariable): Make error messages less long-winded and more
2478 specific. Show location of conflicting declaration.
2479 * parameter.cs (Parameters.Location): New readonly property.
2481 2005-03-31 Raja R Harinath <rharinath@novell.com>
2483 Clean up semantics of invoking ResolveMemberAccess.
2484 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
2485 can have an instance, ensure that we pass in a non-TypeExpression
2486 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
2487 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
2488 argument. Update to changes and simplify.
2489 (FieldExpr.Emitinstance): Remove CS0120 check.
2490 (PropertyExpr.EmitInstance): Likewise.
2491 * expression.cs (Argument.Resolve): Likewise.
2492 (Invocation.DoResolve): Update to changes in semantics of
2495 2005-03-31 Marek Safar <marek.safar@seznam.cz>
2498 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
2501 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
2503 2005-03-31 Raja R Harinath <rharinath@novell.com>
2505 Fix difference in behaviour with commandline invocation.
2506 * driver.cs (Driver.Reset): New.
2507 (CompilerCallableEntryPoint): Call it.
2509 * statement.cs (If.Resolve): Avoid spurious "uninitialized
2510 variable" warnings if the boolean expression failed to resolve.
2512 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
2514 * attribute.cs: Fix the union of several permissions when some of them
2515 are unrestricted (so the result isn't an unrestricted permission set).
2518 2005-03-30 Raja R Harinath <rharinath@novell.com>
2520 * ecore.cs (MemberExpr): New class. Convert from interface
2522 (MemberExpr.ResolveMemberAccess): Refactor and move here from
2523 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
2525 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
2526 (MethodGroupExpr.IsExplicitImpl): Remove.
2527 (Expression.GetFieldFromEvent): Remove.
2528 (SimpleName.MemberStaticCheck): Remove.
2529 (SimpleName.DoSimpleNameResolve): Update to changes.
2530 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
2531 (MemberAccess.IdenticalNameAndTypeName): Remove.
2532 (MemberAccess.error176): Move to MemberExpr.
2533 (MemberAccess.DoResolve): Update to changes.
2534 (BaseAccess.DoResolve): Likewise.
2536 2005-03-30 Marek Safar <marek.safar@seznam.cz>
2538 C# 2.0 Conditional attribute class implementation
2540 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
2541 Analyzes class whether it has attribute which has ConditionalAttribute
2542 and its condition is not defined.
2544 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
2545 (Class.IsExcluded): New method. Search for at least one defined
2546 condition in ConditionalAttribute of attribute class.
2548 2005-03-30 Raja R Harinath <rharinath@novell.com>
2550 * ecore.cs (PropertyExpr): Derive from Expression, not
2551 ExpressionStatement.
2552 (PropertyExpr.EmitStatement): Remove.
2554 2005-03-29 Raja R Harinath <rharinath@novell.com>
2557 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
2558 internal field "value__" of an enum be private. The examples for
2559 "value__" that I found on MSDN all used FieldAttributes.Private.
2561 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
2562 Don't mention IL method attribute names.
2564 Fix #47991. Remove a TODO.
2565 * statement.cs (Block.Toplevel): Make into a field.
2566 (Block.Parameters): Move into ToplevelBlock.
2567 (Block.known_variables): Rename from child_variable_names.
2568 (Block.Block): Remove variants that take Parameters. Initialize
2569 'Toplevel' with the immediately surrounding toplevel block.
2570 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
2571 LocalInfo parameter.
2572 (Block.GetKnownVariableInfo): New.
2573 (Block.IsVariableNameUsedInChildBlock): Update.
2574 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
2575 the block, even though it may not be in scope.
2576 (Block.AddVariable): Remove Parameters parameter. Use
2577 Toplevel.Parameters instead.
2578 (Block.AddConstant): Remove Parameters parameter.
2579 (Block.GetParameterReference): Update to use Toplevel.Parameters.
2580 (Block.IsParamaterReference): Likewise.
2581 (Block.IsLocalParameter): Likewise. Simplify a lot.
2582 (ToplevelBlock.Parameters): New. Moved from Block.
2583 (ToplevelBlock.ToplevelBlock): Update to changes. Always
2584 initialize Parameters to a non-null value.
2585 * cs-parser.jay: Update to changes.
2586 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
2587 simple names that mean different things in the same block. Use
2588 Block.IsVariableNameUsedInBlock.
2590 2005-03-28 Raja R Harinath <rharinath@novell.com>
2592 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2593 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2594 GetTypeHandle. It is possible for a reflected type to derive from
2595 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2596 System.Array during mscorlib compilation).
2597 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2598 contain a method_hash, don't create one either. Don't create a
2599 deep copy of the base cache's method_hash.
2600 (MemberCache.SetupCache): Rename back from DeepCopy.
2601 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2602 already initialized. If we see an override function, add its
2603 underlying base virtual function to the member_hash too.
2605 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
2607 2005-03-26 Raja R Harinath <harinath@acm.org>
2610 * assign.cs (Assign.DoResolve): When the RHS of an assignment
2611 fails to resolve, ensure that the LHS is still resolved as an
2614 2005-03-25 Raja R Harinath <harinath@acm.org>
2616 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
2618 (Enum.current_ec): Remove.
2619 (Enum.LookupEnumValue): Remove EmitContext argument.
2620 Just uses the one created during DefineType.
2621 (Enum.FindMembers): Update.
2622 * expression.cs (MemberAccess.DoResolve): Update.
2624 2005-03-22 Marek Safar <marek.safar@seznam.cz>
2626 * assign.cs (Assign.DoResolve): Check for CS1717 when
2627 source and target are same (uses Equals).
2629 * expression.cs (LocalVariableReference, ParameterReference,
2630 This): Implemented Equals, GetHashCode.
2632 * statement.cs (Block.GetParameterReference): Removed useless
2635 2005-03-22 Raja R Harinath <rharinath@novell.com>
2638 * statement.cs (Block.AddVariable): Ensure that we skip implicit
2639 blocks before deciding whether the error is cs0136 or cs0128.
2641 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
2642 (using_alias_directive, using_namespace_directive): Pass
2643 MemberName, not an expression to Namespace.UsingAlias and
2645 (MakeName): Use the MemberName of the namespace.
2646 * namespace.cs (Namespace.MemberName): New.
2647 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
2648 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
2650 * decl.cs (MemberName.Name): Make readonly.
2651 (MemberName.FromDotted): New "constructor".
2652 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
2653 (MemberCore.Name): Compute from MemberName on demand.
2654 (MemberCore.SetMemberName): Provide a way to change the
2656 (MemberCore.AddToContainer): Don't take a fullname parameter.
2657 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
2658 fully qualified name of the container to the member name.
2659 (TypeContainer.AddToTypeContainer): Use a fully qualified name
2660 only if the type is a member of the root container.
2661 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
2662 MemberName.Left rather than searching for an embedded ".".
2663 (PartialContainer.CreatePart): Update to changes in RootContext.
2664 (MemberBase.ShortName): Turn into a property. Use
2665 MemberCore.SetMemberName.
2666 (MemberBase.ExplicitInterfaceName): Remove.
2667 (MemberBase.UpdateMemberName): Remove.
2668 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2669 (PropertyBase.SetMemberName): New override.
2670 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2671 (Tree.GetDecl): New.
2672 (Tree.AllDecls): Rename from Decls.
2673 * attribute.cs, enum.cs, report.cs: Update to changes.
2674 * driver.cs (MainDriver): Use MemberName.FromDotted on
2675 RootContext.MainClass.
2677 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2679 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2682 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2684 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2686 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2687 property accessor modifiers.
2689 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2690 fixed buffer attribute (CS1716).
2691 (PropertyMethod.HasCustomAccessModifier): When property accessor
2692 has custom modifier.
2694 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2696 (PropertyExpr.DoResolveLValue): Add CS0272.
2698 2005-03-17 Miguel de Icaza <miguel@novell.com>
2700 * convert.cs: When converting to a pointer, use the proper Conv.U
2701 or Conv.I depending on the source data type.
2703 * cs-tokenizer.cs: Make the size for large decimal constants,
2706 2005-03-17 Martin Baulig <martin@ximian.com>
2708 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2709 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2711 2005-03-17 Martin Baulig <martin@ximian.com>
2713 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2714 to bool so we can return an error condition.
2715 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2718 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2720 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2723 2005-03-16 Raja R Harinath <rharinath@novell.com>
2725 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2726 Refactor to avoid traversing the list of assemblies, and to avoid
2727 string concatenation.
2728 * typemanager.cs (guid_attr_type): Remove.
2729 (negative_hits, pointers, references): Remove hashes.
2731 (GetConstructedType): New. Uses type_hash to handle constructed
2732 types (arrays, references, pointers).
2733 (GetReferenceType, GetPointerType): Use it.
2734 (GetNestedType): New. Uses type_hash to handle nested types of
2736 (LookupType, LookupTypeDirect): Remove.
2737 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2738 'types' hash and LookupTypeReflection directly.
2739 (params_string, params_object): Use GetConstructedType.
2740 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2742 (Namespace.Lookup): Use cached_types.
2743 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2744 provided by old TypeManager.LookupType.
2745 * rootcontext.cs (MakeFQN): Remove.
2746 * decl.cs (DeclSpace.MakeFQN): Likewise.
2747 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2748 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2749 TypeManager.GetConstructedType.
2750 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2752 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2754 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2757 * cs-parser.jay: Reports CS1527 for any namespace element.
2759 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2762 * expression.cs (ParameterReference.IsAssigned): Changed error to
2764 (Error_WrongNumArguments): Moved CS0245 detection here.
2766 * statement.cs (Return.Resolve): Add CS1622 report.
2768 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2770 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2772 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2774 * attribute.cs expression.cs: Get rid of some allocations.
2776 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2778 * doc.cs : just eliminate the latest change.
2780 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2782 * doc.cs : commented out the latest change. It breaks xml-030.cs
2784 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2786 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2787 fail. So invoke CreateType() in FindDocumentedType().
2789 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2791 * cs-tokenizer.cs : added IsKeyword().
2792 * doc.cs : Detect keyword incorrectly used as identifier.
2793 Allow identifiers prefixed by @.
2795 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2797 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2798 It caused exception in namespace resolving (again!).
2800 * class.cs (Class.ctor): Removed exit.
2801 (PropertyMethod.ctor): ditto.
2803 * codegen.cs (Codegen.Reset): Reset static data.
2804 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2806 * cs-tokenizer.cs (Cleanup): Removed.
2808 * driver.cs (GetSystemDir): Rewrote to one line command.
2809 It caused problem with unloaded dynamic modules.
2810 (UnixParseOption): Removed Exit.
2811 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2812 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2813 Now can be mcs used as library.
2815 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2818 * location.cs (Reset): Reset static data.
2820 * namespace.cs (Reset): Reset static data.
2822 * report.cs (Report.Reset): Reset static data.
2824 * rootcontext.cs (RootContext.Reset): Reset static data.
2826 * tree.cs (RootTypes.ctor): Use Location.Null
2828 * typemanager.cs (TypeManager.Reset): Reset static data.
2829 (CoreLookupType): Removed Exit.
2830 (TypeHandle.Reset): Reset static data.
2832 2005-03-10 Raja R Harinath <rharinath@novell.com>
2835 * typemanager.cs (ComputeNamespaces): Import namespaces from
2836 referenced modules too.
2838 2005-03-09 Raja R Harinath <rharinath@novell.com>
2840 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2843 2005-03-09 Raja R Harinath <rharinath@novell.com>
2845 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2846 enclosing DeclSpace. This ensures that a name-lookup populates
2847 more caches and there are fewer 'TypeExpression's. Carve out
2848 nested type lookup into ...
2849 (LookupNestedTypeInHierarchy): ... this.
2851 2005-03-09 Raja R Harinath <rharinath@novell.com>
2853 Clean up a few partial-class semantics.
2854 Fixes test-357.cs and cs1618-2.cs.
2855 * cs-parser.jay (struct_declaration): Use 'current_class' as
2856 parent of newly-created struct. Remove call to Register ().
2857 Use 'pop_current_class' to complete handing the current struct.
2858 (interface_declaration): Likewise.
2859 (class_declaration): Likewise.
2860 (enum_declaration): Use 'current_class' as parent of newly created
2862 (delegate_declaration): Likewise.
2863 (pop_current_class): New function. This is used to handle closing
2864 up the 'current_class' and 'current_container', and pointing them
2865 to the enclosing class/container.
2866 (CSharpParser): Initialize 'current_class' too.
2867 * decl.cs (MemberCore): Add check for invariant: a partial
2868 container is not a parsed entity, and thus does not enclose any
2870 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2871 (DeclSpace.BaseTypeExpr): Use it.
2872 (DeclSpace.LookupType): Add check for invariant.
2873 * class.cs (TypeContainer): Add check for invariant: a nested
2874 class should have the same NamespaceEntry as its enclosing class.
2875 (TypeContainer.EmitFieldInitializers): Make virtual.
2876 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2878 (TypeContainer.Register): Remove.
2879 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2880 null. Use TypeResolveEmitContext for resolving base types and
2881 interfaces. Move initialization of Parts.TypeBuilder here from
2883 (TypeContainer.DefineNestedTypes): ... here.
2884 (PartialContainer): Take a Namespace not a NamespaceEntry.
2885 (PartialContainer.Create): Don't use Register. Call the
2886 appropriate Add... function directly.
2887 (ClassPart): Take both the PartialContainer and the enclosing
2888 class as constructor arguments.
2889 (ClassPart.EmitFieldInitializers): Override.
2890 (ClassPart.PartFindNestedTypes): Remove.
2891 (FieldBase.GetInitializerExpression): Resolve the initializer
2892 expression in the emit context of the enclosing class.
2893 * tree.cs (RootTypes): Remove Register ().
2895 2005-03-08 Marek Safar <marek.safar@seznam.cz>
2897 * cs-parser.jay: Removed CS0134.
2899 * driver.cs: Removed CS1901.
2901 * expression.cs (SizeOf.DoResolve): Don't report CS0233
2902 for predefined types.
2904 2005-03-07 Duncan Mak <duncan@novell.com>
2906 * codegen.cs (Save): Catch UnauthorizedAccessException as
2907 well. Fixes bug #73454.
2909 2005-03-07 Marek Safar <marek.safar@seznam.cz>
2911 * cs-tokenizer.cs (xtoken): Add CS1035.
2913 * class.cs (MethodData.Define): Add CS0683.
2914 (FieldMember.ctor): Add CS0681.
2916 2005-03-07 Raja R Harinath <rharinath@novell.com>
2918 * ecore.cs (SimpleName.DoResolve): Rename from
2919 SimpleName.DoResolveAllowStatic.
2920 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
2921 Pass 'intermediate' flag to MemberStaticCheck.
2922 (SimpleName.MemberStaticCheck): Skip "static check" only in case
2923 of "intermediate" lookups via MemberAccess.
2924 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
2925 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
2927 2005-03-07 Raja R Harinath <rharinath@novell.com>
2930 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
2931 slipped in because of variable names that are identical to a
2932 builtin type's BCL equivalent ('string String;', 'int Int32;').
2933 (PropertyExpr.EmitInstance): Likewise.
2935 2005-03-04 Marek Safar <marek.safar@seznam.cz>
2937 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
2939 * report.cs (warning_ignore_table): Made public.
2941 2005-03-04 Raja R Harinath <rharinath@novell.com>
2944 * class.cs (MethodData.Emit): Pass 'container' to
2945 container.GetObsoleteAttribute instead of 'container.Parent'.
2947 2005-03-03 Marek Safar <marek.safar@seznam.cz>
2949 * cs-parser.jay: Add 1534 error test.
2951 * iterators.cs (Yield.CheckContext): Add error 1629.
2952 (Iterator.ctor): Save unsafe modifier.
2953 (MoveNextMethod.DoEmit): Restore unsafe context.
2955 * namespace.cs (UsingAlias): Better error message.
2957 2005-03-03 Dan Winship <danw@novell.com>
2959 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
2960 the warning message [#73219]
2962 2005-03-03 Raja R Harinath <rharinath@novell.com>
2964 Fix compile with MCS 1.0.0.0.
2965 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
2966 w_restore to not depend on string constant folding.
2968 2005-03-03 Raja R Harinath <rharinath@novell.com>
2970 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
2971 CS0246 check to users who passed 'silent = false'.
2972 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
2974 (SimpleName.SimpleNameResolve): Update.
2975 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
2976 (MemberAccess.IdenticalNameAndTypeName): Update.
2977 * doc.cs (FindDocumentedTypeNonArray): Update.
2979 2005-03-03 Raja R Harinath <rharinath@novell.com>
2981 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
2982 * parameters.cs (ComputeAndDefineParameters): Remove.
2983 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
2984 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
2985 Use GetParameterInfo.
2987 2005-03-02 Marek Safar <marek.safar@seznam.cz>
2989 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
2991 2005-03-02 Raja R Harinath <rharinath@novell.com>
2993 Unify DeclSpace.LookupType and DeclSpace.FindType.
2994 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
2995 is in charge of defining nested types on demand.
2996 (DeclSpace.LookupType): Use it when the current_type is a
2997 TypeBuilder. Use LookupTypeDirect for reflected types.
2998 (DeclSpace.FindType): Remove.
2999 (DeclSpace.LookupInterfaceOrClass): Likewise.
3000 (DeclSpace.DefineTypeAndParents): Likewise.
3001 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
3002 DeclSpace.LookupType.
3003 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
3004 * typemanager.cs (LookupType): Simplify.
3005 (AddUserType): Remove type from negative_hits.
3006 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
3007 * class.cs (TypeContainer.FindMembers): Move handling of nested
3009 (TypeContainer.FindMembers_NestedTypes): ... here.
3010 (TypeContainer.FindNestedType): Implement override.
3011 (ClassPart.FindNestedType): Delegate to PartialContainer.
3012 (ClassPart.PartFindNestedType): Looks up the nested types of the
3015 2005-03-02 Martin Baulig <martin@ximian.com>
3017 * class.cs (TypeContainer.DoDefineMembers): We also need a default
3018 static constructor in static classes.
3020 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
3022 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
3023 sizeParamIndex is not specified.
3025 2005-03-01 Marek Safar <marek.safar@seznam.cz>
3028 * report.cs (WarningMessage.IsEnabled): Missing null check.
3030 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3032 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
3033 in the fields and not in the properties.
3035 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
3037 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
3040 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3042 * attribute.cs: Small refactoring (improved robustness).
3043 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
3044 (ValidateGuid): Removed.
3045 (Resolve): Removed referenced to above mentioned.
3046 (GetAttributeUsage): Made private and changed to work without
3048 (GetIndexerAttributeValue): Don't crash.
3049 (GetConditionalAttributeValue): Ditto.
3050 (GetClsCompliantAttributeValue): Ditto.
3051 (ExtractSecurityPermissionSet): All attributes exceptions are
3053 (GetPropertyValue): New helper.
3054 (GetMethodImplOptions): New method.
3055 (DefinePInvokeMethod): Reuse common code. Implemented handling of
3056 some missing properties.
3058 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
3059 (Method.ApplyAttributeBuilder): Updated.
3061 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
3064 2005-02-28 Raja R Harinath <rharinath@novell.com>
3067 * report.cs (Report.SymbolRelatedToPreviousError): Handle
3068 non-simple types (array, pointer, reference).
3070 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3072 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
3074 * class.cs (MethodCore.IsDuplicateImplementation): Special error
3076 (Method.CheckBase): Catch wrong destructor here.
3077 (MethodData.Define): Add errors 550, 668.
3079 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
3081 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
3083 * pending.cs (VerifyPendingMethods): Add error 551.
3085 * typemanager.cs (CSharpName): Next error report helper.
3087 2005-02-25 Marek Safar <marek.safar@seznam.cz>
3089 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
3090 attributes. Removed useless attribute double check.
3091 It saves almost 2MBs for corlib.
3093 2005-02-25 Raja R Harinath <rharinath@novell.com>
3096 * statement.cs (ExpressionStatement.Resolve): Make robust to being
3097 called twice in case of error.
3099 2005-02-23 Chris Toshok <toshok@ximian.com>
3101 Fix compiler portions of #72827.
3102 * statement.cs (Block.Emit): call Begin/EndScope on the
3103 EmitContext instead of the ILGenerator.
3105 * codegen.cs (EmitContext.BeginScope): new method, call
3106 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
3108 (EmitContext.BeginScope): same, but EndScope and CloseScope
3110 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
3111 offset and call the superclass's OpenScope(int) with it.
3112 (SymbolWriter.CloseScope): get the current il
3113 offset and call superclass's CloseScope(int) with it.
3115 2005-02-23 Marek Safar <marek.safar@seznam.cz>
3117 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
3118 CS1677 for out and ref as well.
3120 * class.cs (Method.Define): Add error CS1599 detection.
3122 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
3124 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
3126 * delegate.cs (Delegate.Define): Add error CS1599 detection.
3128 * support.cs.cs (ModifierDesc): New helper method.
3130 2005-02-23 Raja R Harinath <rharinath@novell.com>
3131 Abin Thomas <projectmonokochi@rediffmail.com>
3132 Anoob V E <projectmonokochi@rediffmail.com>
3133 Harilal P R <projectmonokochi@rediffmail.com>
3136 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
3137 MemberLookup (used for error reporting) actually returns a result.
3138 Fix error report number (122, not 112).
3140 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
3141 Anoob V E <projectmonokochi@rediffmail.com>
3142 Harilal P R <projectmonokochi@rediffmail.com>
3145 * pending.cs (PendingImplementation.GetAbstractMethods):
3146 Find NonPublic members too.
3148 2005-02-22 Marek Safar <marek.safar@seznam.cz>
3150 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
3153 * class.cs (MethodCore.CheckMethodAgainstBase):
3154 Add error 239 report.
3156 2005-02-21 Raja R Harinath <rharinath@novell.com>
3159 * expression.cs (Invocation.IsApplicable): Make public.
3160 (Invocation.IsParamsMethodApplicable): Likewise.
3161 * delegate.cs (Delegate.VerifyApplicability): Don't use
3162 Invocation.VerifyArgumentCompat for parameter applicability
3163 testing. Use Invocation.IsApplicable and
3164 Invocation.IsParamsMethodApplicable.
3166 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3168 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
3170 * class.cs (Operator.Define): Add error 217 report.
3172 2005-02-21 Raja R Harinath <rharinath@novell.com>
3174 * namespace.cs (UsingEntry.Resolve): Undo change below.
3176 2005-02-21 Raja R Harinath <rharinath@novell.com>
3179 * ecore.cs (Expression.MemberLookupFailed): Add argument to
3180 disable the error message when the extended MemberLookup also
3182 (Expression.MemberLookupFinal): Update.
3183 (SimpleName.DoSimpleNameResolve): Update.
3184 * expression.cs (MemberAccess.ResolveNamespaceOrType):
3185 Don't use MemberLookupFinal.
3186 (New.DoResolve): Update.
3187 (BaseAccess.CommonResolve): Update.
3189 2005-02-21 Raja R Harinath <rharinath@novell.com>
3192 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
3193 occured previously, don't resolve again.
3195 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3198 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
3199 argument. Call ResolveAttributeUsage for unresolved.
3200 when types doesn't match ctor arguments.
3202 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
3203 for nested attribute classes.
3204 (Class.attribute_usage): Removed.
3205 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
3206 for attribute class.
3208 * ecore.cs (IsAttribute): Removed.
3210 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
3212 * rootcontext.cs (RegisterAttribute): Removed, attributes are
3214 (attribute_types): Removed.
3215 (EmitCode): Global attributes are emited as the latest.
3217 2005-02-18 Marek Safar <marek.safar@seznam.cz>
3219 * class.cs (EmitFieldInitializers): Don't emit field initializer
3220 for default values when optimilization is on.
3222 * constant.cs (Constant.IsDefaultValue): New property.
3224 * driver.cs: Add /optimize handling.
3228 * literal.cs: Implement new IsDefaultValue property.
3230 * rootcontext.cs (Optimize): New field, holds /optimize option.
3232 2005-02-18 Raja R Harinath <rharinath@novell.com>
3234 Fix crasher in re-opened #72347.
3235 * namespace.cs (Namespace.Lookup): Return null if
3236 DeclSpace.DefineType returns null.
3239 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
3241 2005-02-18 Raja R Harinath <rharinath@novell.com>
3243 Fix remainder of #63202. Change semantics of DoResolveLValue: it
3244 now returns null if it cannot resolve to an lvalue.
3245 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
3246 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
3247 returned null. Remove check for SimpleName.
3248 (EventExpr.DoResolveLValue): New.
3249 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
3250 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
3252 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
3254 (Unary.ResolveOperator): Move CS0211 check ...
3255 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
3257 (Unary.DoResolveLValue): Simplify.
3258 (AddressOf.DoResolveLValue): New.
3259 (ArrayAccess.DoResolveLValue): New.
3261 2005-02-16 Marek Safar <marek.safar@seznam.cz>
3263 * attribute.cs (Attribute.Resolve): Add arguments casting for
3264 when types doesn't match ctor arguments.
3266 2005-02-16 Raja R Harinath <rharinath@novell.com>
3268 Fix parts of #63202.
3269 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
3270 lookup of operator in base type. Ensure that all checks happen
3271 when the operator resolves to an "op_..." method.
3273 2005-02-15 Raja R Harinath <rharinath@novell.com>
3276 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
3277 'ignore_cs0104' parameter. Pass it to ...
3278 (NamespaceEntry.Lookup): ... this.
3279 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
3280 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
3281 (TypeLookupExpression.DoResolveAsTypeStep): Update.
3282 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
3283 Update. Request that cs0104 errors be ignored.
3284 (ComposedCast.ResolveAsTypeStep): Update.
3286 2005-02-14 Raja R Harinath <rharinath@novell.com>
3289 * expression.cs (Invocation.BetterFunction): Remove support for
3290 comparing virtual functions and their overrides.
3291 (Invocation.IsOverride): New.
3292 (Invocation.OverloadResolve): Don't consider 'override' functions
3293 during candidate selection. Store them in a lookaside list.
3294 If the selected method is a 'virtual' function, use the list to
3295 find any overrides that are closer to the LHS type.
3297 2005-02-14 Marek Safar <marek.safar@seznam.cz>
3299 * expression.cs (New.DoResolve): Add complex core type reduction.
3300 (New.Constantify): Converts complex core type syntax like 'new int ()'
3303 2005-02-14 Raja R Harinath <rharinath@novell.com>
3305 * decl.cs (EntryType.EntryType): New constructor to create an
3306 updated copy of a cache entry.
3307 (MemberCache.AddMethods): Use it.
3308 (MemberCache.ClearDeclaredOnly): Remove.
3309 (MemberCache.MemberCache): Update.
3311 2005-02-11 Miguel de Icaza <miguel@novell.com>
3313 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
3314 variable. This one is represents the actual low-level declaration
3315 of the method, as opposed to the semantic level `IsStatic'.
3317 An anonymous method which is hosted into a static method might be
3318 actually an instance method. IsStatic would reflect the
3319 container, while MethodIsStatic represents the actual code
3322 * expression.cs (ParameterReference): Use the new MethodIsStatic
3323 instead of IsStatic.
3325 * anonymous.cs (AnonymousMethod.Compatible): Pass the
3326 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
3327 set on the current EmitContext.
3329 * expression.cs (Cast): Overload DoResolveLValue so we can pass
3330 resolve our casted expression as an LValue. This triggers the
3331 proper LValue processing that is later required by Assign.
3335 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
3337 2005-02-11 Marek Safar <marek.safar@seznam.cz>
3339 C# 2.0 Fixed buffer implementation
3341 * anonymous.cs: Update after RegisterHelperClass renaming.
3343 * attribute.cs (AttributeTester.fixed_buffer_cache):
3344 Cache of external fixed buffers.
3345 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
3346 implementation if field is fixed buffer else null.
3349 (TypeContainer.AddField): Accept FieldMember instead of Field.
3350 (FieldBase.IsFieldClsCompliant): Extracted code from
3351 VerifyClsCompliance descendant customization.
3352 (FixedField): New class handles fixed buffer fields.
3353 (FixedFieldExternal): Keeps information about imported fixed
3355 (IFixedField): Make access to internal or external fixed buffer
3358 * cs-parser.jay: Add fixed buffer parsing.
3360 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
3363 * expression.cs (Indirection): Extended implementation to accept
3365 (PointerArithmetic.Emit): Get element from fixed buffer as well.
3366 (ElementAccess.MakePointerAccess): Get type as parameter.
3367 (DoResolve): Add fixed buffer field expression conversion.
3368 (DoResolveLValue): Ditto.
3369 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
3370 (ArrayPtr): Derives from FixedBufferPtr.
3371 (ArrayPtr.Emit): Add extra emit for array elements.
3373 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
3375 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
3376 for compiler generated types.
3377 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
3379 * statement.cs (Fixed): Refactored to be easier add fixed buffer
3380 and consume less memory.
3381 (Fixed.Resolve): Add fixed buffer case.
3383 * typemanager.cs (compiler_generated_attr_ctor,
3384 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
3385 (HasElementType): Add our own implementation to work on every
3388 2005-02-11 Miguel de Icaza <miguel@novell.com>
3390 * anonymous.cs (CaptureContext): Track whether `this' has been
3393 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
3394 only captured `this' if it was implicitly done (instance
3395 methods/variables were used).
3397 * codegen.cs (EmitContext.CaptureThis): New method to flag that
3398 `this' must be captured.
3400 2005-01-30 Miguel de Icaza <miguel@novell.com>
3402 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
3403 is null it means that there has been no need to capture anything,
3404 so we just create a sibling.
3406 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
3408 Just a partial fix. The other half is fairly elusive.
3410 2005-02-10 Raja R Harinath <rharinath@novell.com>
3412 Fix #52586, cs0121-4.cs.
3413 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
3414 and return a hashtable.
3415 (MemberCache.ClearDeclaredOnly): New.
3416 (MemberCache.MemberCache): Update to change. Make a deep copy of
3417 the method_hash of a base type too.
3418 (MemberCache.AddMethods): Adapt to having a deep copy of the base
3419 type methods. Overwrite entries with the same MethodHandle so
3420 that the ReflectedType is correct. The process leaves in base
3421 virtual functions and their overrides as distinct entries.
3422 (CacheEntry): Now a class instead of a struct. It shouldn't alter
3423 matters since it was boxed in a ArrayList before.
3424 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
3426 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
3427 case of a virtual function and its override (choose the overload
3429 (Invocation.OverloadResolve): Avoid 'override' members during
3430 'applicable_type' calculation.
3432 2005-02-09 Raja R Harinath <rharinath@novell.com>
3434 Combine two near-redundant caches.
3435 * typemanager.cs (method_params): Rename from method_internal_params.
3436 (TypeManager.GetParameterData): New. Replace
3437 Invocation.GetParameterData.
3438 (TypeManager.LookupParametersByBuilder): Remove.
3439 * expression.cs (Invocation.method_parameter_cache): Remove.
3440 (Invocation.GetParameterData): Remove.
3442 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
3445 2005-02-08 Raja R Harinath <rharinath@novell.com>
3448 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
3449 TypeManager.multicast_delegate_type is null, resolve it by looking
3450 up "System.MulticastDelegate".
3451 * rootcontext.cs (RootContext.ResolveCore): Simplify.
3453 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
3454 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
3455 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
3458 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
3459 (LabeledStatement.AddReference): New. Set 'referenced'.
3460 (Goto.Resolve): Use it.
3462 2005-02-05 John Luke <john.luke@gmail.com>
3464 * driver.cs: remove duplicate -doc line in Usage ()
3466 2005-02-04 Raja R Harinath <rharinath@novell.com>
3468 * location.cs (Location.AddFile): Fix CS2002 error report.
3470 2005-02-02 Martin Baulig <martin@ximian.com>
3472 * delegate.cs (Delegate.DefineType): Report an internal error if
3473 TypeManager.multicast_delegate_type is null. See bug #72015 for
3476 2005-02-02 Raja R Harinath <rharinath@novell.com>
3478 Fix a crasher in a variant of #31984.
3479 * const.cs (Constant.CheckBase): New override that defers the
3480 new-or-override check in case the base type hasn't been populated
3482 (Constant.Define): Ensure the new-or-override check is performed.
3484 2005-02-01 Duncan Mak <duncan@ximian.com>
3486 * const.cs (LookupConstantValue): Check that `ce' is not null
3487 before calling GetValue ().
3489 2005-02-01 Raja R Harinath <rharinath@novell.com>
3491 Fix test-334.cs (#69519).
3492 * cs-parser.jay (using_alias_directive): Pass in an expression to
3493 NamespaceEntry.UsingAlias.
3494 (using_namespace_directive): Pass in an expression to
3495 NamespaceEntry.Using.
3496 (namespace_name): Don't flatten to a string.
3497 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
3498 (NamespaceEntry.AliasEntry.Resolve): Lookup using
3500 (NamespaceEntry.UsingEntry): Likewise.
3501 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
3503 (NamespaceEntry.LookupForUsing): Remove.
3504 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
3506 (NamespaceEntry.Lookup): Remove support for dotted names.
3508 2005-02-01 Raja R Harinath <rharinath@novell.com>
3510 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
3512 (NamespaceEntry.ImplicitParent): Compute on demand.
3513 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
3514 parallels the current.
3515 (NamespaceEntry.LookupForUsing): Use it.
3516 (NamespaceEntry.Lookup): If the current namespace-entry is
3517 implicit, don't search aliases and using tables.
3519 2005-02-01 Raja R Harinath <rharinath@novell.com>
3522 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
3524 (TypeContainer.BaseCache): Compute on demand.
3525 (TypeContainer.FindMembers): Define constants and types if they're
3526 not already created.
3527 (FieldMember.Define): Move resetting of ec.InUnsafe before error
3529 * const.cs (Constant.Define): Make idempotent.
3531 2005-01-29 Miguel de Icaza <miguel@novell.com>
3533 * pending.cs: Produce better code (no nops produced by using Ldarg
3536 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
3537 i - 1' it should be arg + 1.
3541 2005-01-28 Raja R Harinath <rharinath@novell.com>
3543 * attribute.cs (Attribute.CheckAttributeType): Make private
3545 (Attribute.ResolveType): Make virtual.
3546 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
3547 handling of RootContext.Tree.Types.
3549 2005-01-27 Raja R Harinath <rharinath@novell.com>
3551 Update attribute-handling to use the SimpleName/MemberAccess
3553 * cs-parser.jay (attribute): Pass in an expression to the
3554 constructors of Attribute and GlobalAttribute.
3555 * attribute.cs (Attribute): Take an expression for the name.
3556 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
3557 passed in attribute name expression.
3558 (Attribute.CheckAttributeType): Use it.
3559 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
3560 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
3561 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
3562 argument to prevent error messages if the lookup fails.
3564 2005-01-27 Marek Safar <marek.safar@seznam.cz>
3566 * expression.cs (Indirection): Implemented IVariable interface
3567 to support indirection in AddressOf operator.
3568 (PointerArithmetic.Emit): Add optimalization for case where
3569 result can be precomputed.
3571 2005-01-26 Martin Baulig <martin@ximian.com>
3573 * class.cs (TypeContainer.AttributeTargets): Return the correct
3574 AttributeTargets depending on our `Kind' instead of throwing an
3575 exception; fixes #71632.
3577 2005-01-26 Marek Safar <marek.safar@seznam.cz>
3580 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
3583 2005-01-25 Raja R Harinath <rharinath@novell.com>
3586 * expression.cs (MemberAccess.DoResolve): Don't complain with
3587 cs0572 when the LHS of a member access has identical name and type
3590 2005-01-25 Marek Safar <marek.safar@seznam.cz>
3593 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
3595 Create custom PermissionSet only for PermissionSetAttribute.
3597 2005-01-24 Marek Safar <marek.safar@seznam.cz>
3600 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
3601 delegates in static class.
3603 2005-01-24 Martin Baulig <martin@ximian.com>
3605 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3606 merging an implicit block, just use its reachability.
3608 * statement.cs (Block.Resolve): Make the unreachable code check
3609 work wrt. implicit blocks; see test-337 from #63842.
3611 2005-01-21 Alp Toker <alp@atoker.com>
3613 * cs-parser.jay: destructor_declaration's container is PartialContainer
3614 not Class when partial types are used, so use Kind prop instead of
3617 2005-01-22 Miguel de Icaza <miguel@ximian.com>
3619 * cs-parser.jay: Improve error reporting when an interface
3622 2005-01-20 Dick Porter <dick@ximian.com>
3624 * support.cs: SeekableStreamReader fix from Sandor Dobos
3625 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
3626 chars are read. Fixes bug 70369.
3628 2005-01-20 Raja R Harinath <rharinath@novell.com>
3630 * cs-parser.jay (catch_clause): Simplify current_block handling
3633 2005-01-17 Miguel de Icaza <miguel@ximian.com>
3635 * convert.cs (ImplicitStandardConversionExists): Synchronize the
3636 code with ImplicitStandardConversion to handle the implicit
3637 conversion of method groups into valid delegate invocations.
3639 The problem is that in parameter handling we were using this code
3640 path. Fixes bug #64698
3642 2005-01-19 Raja R Harinath <rharinath@novell.com>
3644 * cs-parser.jay: Fix several infelicities.
3645 - Avoid assigning to the parser value stack. Code like
3646 '$3 = null' is unclean. Synthesize a value for the code block
3648 - Avoid using oob_stack for storing location information. Use ...
3649 (_mark_): ... this. New (empty) rule. Saves the current location
3651 (foreach_statement): Avoid using oob_stack for current_block
3652 handling. Use technique used in for_statement and
3653 using_statement. Synthesize a value for the code block to store
3654 additional intermediate information.
3656 2005-01-13 Miguel de Icaza <miguel@ximian.com>
3658 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
3659 of a different type is only allowed to private fields of a
3660 containing type, not on fields of a base class.
3662 See test-174.cs and error cs0122-9.cs
3664 2005-01-13 Raja R Harinath <rharinath@novell.com>
3666 Fix test-335.cs (bug #58126).
3667 * cs-parser.jay (argument): Split out non-expression parts of the
3668 rule into 'non_simple_argument'.
3669 (invocation_expression): Support parenthesized invocations with
3670 multiple arguments, and with single non-simple arguments.
3672 2005-01-13 Raja R Harinath <rharinath@novell.com>
3674 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3677 2005-01-12 Raja R Harinath <rharinath@novell.com>
3679 Fix cs0038-1.cs, cs1640-6.cs.
3680 * ecore.cs (Expression.Resolve): Remove special-case for
3681 SimpleName in error-handling.
3682 (Expression.almostMatchedMembers): Relax access permission to
3684 (Expression.MemberLookupFailed): Handle duplicates in
3685 almostMatchedMembers list.
3686 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3687 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3688 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3689 overload if the passed in MemberInfo is a MethodBase.
3691 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3694 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3695 for non-CAS & merge permission sets properly.
3697 2005-01-11 Raja R Harinath <rharinath@novell.com>
3699 Improve standard-compliance of simple name and member access
3700 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3701 * ecore.cs (FullNamedExpression): New abstract base class
3702 for Namespaces and TypeExpressions.
3703 (ResolveFlags.SimpleName): Remove.
3704 (SimpleName): Remove support for dotted names.
3705 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3706 DeclSpace.FindType and DeclSpace.LookupType.
3707 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3708 (Expression.ExprClassName): Make member function.
3709 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3710 a namespace. Remove creation of dotted "SimpleName"s.
3711 (MemberAccess.DoResolve): Likewise.
3712 * decl.cs (DeclSpace.Cache): Make private.
3713 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3714 (DeclSpace.FindType): Update.
3715 (DeclSpace.LookupType): Move here from RootContext. Return a
3716 FullNamedExpression.
3717 * namespace.cs (Namespace): Derive from FullNamedExpression
3718 so that it can be part of expression resolution.
3719 (Namespace.Lookup): Return an FullNamedExpression.
3720 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3722 * rootcontext.cs (NamespaceLookup): Remove.
3723 (LookupType): Move to DeclSpace.
3724 * attribute.cs (CheckAttributeType): Update.
3725 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3726 (FindDocumentedTypeNonArray): Likewise.
3728 2005-01-11 Raja R Harinath <rharinath@novell.com>
3730 Fix cs0509.cs, cs1632.cs.
3731 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3732 is the same as IsInterface.
3733 (TypeContainer.GetClassBases): Likewise.
3734 * statement.cs (LabeledStatement.ig): New field.
3735 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3737 (LabeledStatement.DoEmit): Check that the label was created with
3738 the same ILGenerator.
3740 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3743 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3744 accessors to its properties.
3746 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3747 from accessors to property.
3749 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3752 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3755 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3757 * attribute.cs: Check for null and empty strings.
3759 I have lost another battle to Paolo.
3761 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3764 * class.cs (PropertyMethod): Set Parent field in ctors.
3765 (SetMethod.InternalParameters): Add unsafe switch hack.
3766 Override MarkForDuplicationCheck where it is appropriate.
3768 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3769 It says whether container allows members with the same name.
3771 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3772 Removed is_method parameter.
3774 2005-01-06 Duncan Mak <duncan@ximian.com>
3776 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3777 because the previous change led to incorrect reporting of CS1032
3778 ("Cannot define/undefine preprocessor symbols after first token in
3779 file"). Instead of using `tokens_seen' as the only flag that
3780 triggers CS1040, introduce `comments_seen'. This new flag is used
3781 to signify having seen comments on the current line, so it is
3782 unset after a newline.
3784 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3786 * doc.cs : When searching for a type, find nested type too.
3787 This fixes bug #71040.
3789 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3792 - Warn missing member comment on those classes which also does not
3793 have doc comments. Fixed bug #71041.
3794 - Don't warn missing doc comment on default constructor.
3797 2005-01-06 Duncan Mak <duncan@ximian.com>
3799 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3800 comments, set `tokens_seen' to true. This allows us to detect
3801 misplaced preprocessor directives (i.e. not at the beginning of
3802 the a line, nor after whitespaces). In that case, report error
3803 CS1040. This fixes bug #56460.
3805 * cs-parser.jay (interface_member_declaration): Add checks for
3806 IsExplicitImpl, and report CS0541 error if an interface member is
3807 defined as an explicit interface declaration.
3809 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3812 * class.cs (PropertyMethod): Set Parent field in ctors.
3813 (SetMethod.InternalParameters): Add unsafe switch hack.
3815 * decl.cs (MemberCore.Parent): Cannot be readonly.
3817 2005-01-06 Raja R Harinath <rharinath@novell.com>
3819 * decl.cs (DeclSpace.ResolveType): Remove.
3820 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3821 Merge in code from ...
3822 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3823 * class.cs, enum.cs: Update to changes.
3825 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3827 * anonymous.cs: Ensure that we init the scope of our parent if it
3828 has not been initialized yet.
3830 2004-12-30 Duncan Mak <duncan@ximian.com>
3832 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3833 if field.FieldBuilder is null. Fixes #70758.
3835 * convert.cs: Fixed some typos and updated some of the comments.
3836 (ImplicitStandardConversionExists):
3837 (TryImplicitIntConversion): If `target_type' is an interface and
3838 the type of `ic' implements this interface, return true or a new
3839 BoxedCast instead of null. This fixes #70468.
3841 2004-12-29 Duncan Mak <duncan@ximian.com>
3843 * expression.cs (Argument.Emit): Check that Expr is
3844 IMemoryLocation before casting to it, and report CS1510 otherwise.
3848 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3850 * statement.cs (Block.ThisVariable): remove the recursion here, to
3851 make the --profile more sane.
3853 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3855 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3856 assembly, by JB Evain.
3858 2004-12-17 Raja R Harinath <rharinath@novell.com>
3860 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3861 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3862 "parent" refers to enclosing type/class. "base" refers to superclass.
3864 2004-12-17 Raja R Harinath <rharinath@novell.com>
3866 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3867 Ensure that we only have GlobalAttributes.
3868 * attribute.cs (Attribute.Emit): Make non-virtual.
3869 (GlobalAttribute.Emit): Remove.
3870 (Attribute.Resolve): Make virtual.
3871 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3872 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3873 the argument. Don't create one.
3874 (Attribute.GetObsoleteAttribute): Likewise.
3875 (Attribute.GetClsCompliantAttributeValue): Likewise.
3876 * class.cs, decl.cs: Update to changes.
3878 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3880 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3882 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3884 * statement.cs (Foreach.Resolve): Add error 186 report.
3886 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3888 * expression.cs (Conditional.DoResolve): Add warning 429.
3890 * statement.cs (If.Resolve): Add warning 665.
3892 2004-12-16 Raja R Harinath <rharinath@novell.com>
3894 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3895 except when in the parser, and in GlobalAttribute.
3896 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3897 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3898 RootContext.Tree.Types.NamespaceEntry once work is done.
3899 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3900 and resets RootContext.Tree.Types.NamespaceEntry.
3902 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3904 * cs-parser.jay: Don't create a block for every variable.
3906 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3908 * location.cs: Provide extra information.
3910 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3911 variables from the captured environment, it is the ldarg_0.
3913 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3915 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3918 * class.cs: Changed warning level for 169 to avoid developer
3919 displeasure from warning flooding. It will be changed back when they
3920 fix most of current BCL warnings.
3922 * RootContext.cs: Pushed default WarningLevel to 3.
3924 * statement.cs: Removed unused variable.
3926 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3928 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3929 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
3930 Add error 502 report.
3931 (StaticClass.DefineType): Add error 441 report.
3932 (Class.AllowedModifiersProp): New virtual property as temporary
3933 extension to AllowedModifiers.
3934 (Class.DefineType): Add error 418 report. Moved ModFlags check here
3935 to share implementation with StaticClass and don't call virtual
3938 * driver.cs (MainDriver): Add error 1558 test.
3940 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
3941 report. Moved error 36 test here.
3943 * statement.cs (Throw.Resolve): Add error 724 report.
3945 * typemanager.cs: Add out_attribute_type core type.
3947 2004-12-13 Marek Safar <marek.safar@seznam.cz>
3949 * class.cs (TypeContainer.VerifyClsCompliance): Add error
3951 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
3953 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
3956 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
3958 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
3959 Add error 3023 report.
3960 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
3962 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
3965 2004-12-12 John Luke <john.luke@gmail.com>
3967 * driver.cs (AddArgs): take -- into account when
3968 adding arguments, fixes bug 65710
3970 2004-12-12 Martin Baulig <martin@ximian.com>
3972 * expression.cs (Unary.TryReduceNegative): Added support for
3973 SByteConstant and ByteConstant.
3974 (Unary.Reduce): Check error values from TryReduceNegative().
3976 2004-12-10 Marek Safar <marek.safar@seznam.cz>
3978 * attributes.cs (Attribute.Resolve): Avoid multiple error report
3979 and report exception as error 182.
3981 2004-12-10 Raja R Harinath <rharinath@novell.com>
3983 * driver.cs (Main): Fix message when there are warnings.
3985 2004-12-09 Miguel de Icaza <miguel@ximian.com>
3987 * delegate.cs: Fixed my fix from yesterday, sorry about that.
3989 2004-12-09 Marek Safar <marek.safar@seznam.cz>
3991 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
3992 Reduced number of warnings.
3994 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
3996 2004-12-08 Miguel de Icaza <miguel@ximian.com>
3998 * driver.cs: Removed message.
4000 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
4002 2004-12-08 <vargaz@freemail.hu>
4004 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
4006 2004-12-08 Martin Baulig <martin@ximian.com>
4008 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
4009 instead of a CS3002 for properties and indexer.
4011 2004-12-08 Martin Baulig <martin@ximian.com>
4013 * decl.cs (MemberName.ToString): Make this work again.
4015 2004-12-08 Marek Safar <marek.safar@seznam.cz>
4017 * attribute.cs (Resolve): Add error 591 detection.
4019 * class.cs (FieldMember.Define): Add error 1547 detection.
4020 (Indexer.Define): Add error 620 detection.
4021 (Operator.Define): Add error 590 detection.
4023 * ecore.cs: Missing argument for error 79.
4025 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
4028 2004-12-07 Marek Safar <marek.safar@seznam.cz>
4031 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
4034 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
4036 * cs-parser.jay : handle doc comments on implicit/explicit operators.
4037 Some operator comments were suppressed.
4038 * doc.cs : Implicit/explicit operator name in doc comments are like
4039 "op_Explicit(type)~returnType", so added suffix handling.
4041 2004-12-07 Martin Baulig <martin@ximian.com>
4044 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4045 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4046 (DeclSpace.ec): New protected field; store the EmitContext here.
4047 (DeclSpace.EmitContext): New public property; moved here from
4049 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4052 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4053 (Enum.Emit): Don't create a new EmitContext.
4055 * delegate.cs (Delegate.DefineType): Always create the
4058 * iterators.cs (Iterators.DefineIterator): Create a new
4059 EmitContext and store it in `ec'.
4061 2004-08-24 Martin Baulig <martin@ximian.com>
4064 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
4065 this for accessibility checks.
4066 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
4067 IsNestedFamilyAccessible.
4068 (TypeManager.IsSubclassOf): New method, do what the name actually
4071 2004-12-06 Raja R Harinath <rharinath@novell.com>
4073 Fix crash on cs0657-17.cs.
4074 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4075 Use RootContext.Tree.Types, not 'new RootTypes ()'.
4076 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
4077 the case where the NamespaceEntry gets overwritten.
4079 2004-12-06 Marek Safar <marek.safar@seznam.cz>
4081 Fixed #69195, #56821
4082 * ecore.cs (ResolveBoolean): Tiny refactoring.
4084 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
4085 of right expression resolving when left is false constant and
4086 operator is LogicalAnd OR true constant and operator is LogicalOr.
4088 * statement.cs (ResolveUnreachable): Always reports warning.
4090 2004-12-05 Miguel de Icaza <miguel@ximian.com>
4092 * class.cs: Distinguish between 1721 and 1722 (just a little help
4093 for the programmer).
4095 2004-12-03 Miguel de Icaza <miguel@ximian.com>
4097 * delegate.cs: Only allow this on new versions of the language.
4099 2004-12-02 Duncan Mak <duncan@ximian.com>
4101 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
4103 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
4104 here as a static method. Take an additional bool out parameter
4105 `must_do_cs1540_check' for signaling to InstanceResolve.
4106 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
4107 member field from PropertyExpr class and made it an argument of
4109 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
4110 check for MarshalByRefObject, and report CS0122 instead of CS1540.
4111 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
4112 and `remove_accessor' as well as InstanceResolve: report CS0122
4117 2004-12-03 Raja R Harinath <rharinath@novell.com>
4119 Fix test-327.cs, test-328.cs, and put in early infrastructure
4120 for eventually fixing #52697.
4121 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
4122 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
4124 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
4125 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
4126 (VerifyUsing, error246): Update.
4127 * rootcontext.cs (RootContext.NamespaceLookup): Just use
4128 'NamespaceEntry.LookupNamespaceOrType'.
4130 2004-12-03 Martin Baulig <martin@ximian.com>
4132 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4133 method as our child, call AnonymousMethod.Compatible() on it.
4135 2004-12-03 Raja R Harinath <rharinath@novell.com>
4137 Disable XML documentation support in 'basic' profile.
4138 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
4139 Redirect XmlElement to System.Object.
4140 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
4141 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
4142 * mcs.exe.sources: Add doc-bootstrap.cs.
4143 * doc-bootstrap.cs: New file. Contains empty stub implementation
4146 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
4148 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
4149 comments are allowed.
4151 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4153 * delegate.cs: Add checks for subtypes in paramaters and return values
4154 in VerifyMethod () to add support for Covariance/Contravariance
4157 2004-12-02 Miguel de Icaza <miguel@ximian.com>
4159 * report.cs: Remove extra closing parenthesis.
4161 * convert.cs (Error_CannotImplicitConversion): If the name of the
4162 types are the same, provide some extra information.
4164 * class.cs (FieldBase): Use an unused bit field from the field to
4165 encode the `has_offset' property from the FieldMember. This saves
4166 a couple of Ks on bootstrap compilation.
4168 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4169 method as our child, return the AnonymousMethod resolved
4172 * expression.cs (New.DoResolve): Allow return values from
4173 NewDelegate to also include AnonymousMethods.
4177 2004-12-02 Marek Safar <marek.safar@seznam.cz>
4180 * attribute.cs (Resolve): Improved implementation of params
4181 attribute arguments.
4183 * support.cs (ParameterData): Add HasParams to be faster.
4185 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
4187 all things are for /doc support:
4189 * doc.cs: new file that supports XML documentation generation.
4190 * mcs.exe.sources: added doc.cs.
4192 Handle /doc command line option.
4193 Report error 2006 instead of 5 for missing file name for /doc.
4194 Generate XML documentation when required, after type resolution.
4196 Added support for picking up documentation (/// and /** ... */),
4197 including a new XmlCommentState enumeration.
4199 Added lines to fill Documentation element for field, constant,
4200 property, indexer, method, constructor, destructor, operator, event
4201 and class, struct, interface, delegate, enum.
4202 Added lines to warn incorrect comment.
4204 Added Documentation field (passed only when /doc was specified).
4206 Added DocComment, DocCommentHeader, GenerateDocComment() and
4207 OnGenerateDocComment() and some supporting private members for
4208 /doc feature to MemberCore.
4210 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
4212 Added overriden DocCommentHeader.
4214 Added overriden DocCommentHeader and GenerateDocComment().
4216 2004-12-01 Miguel de Icaza <miguel@ximian.com>
4218 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
4219 unwrapping the enumeration values, chain to
4220 DoConstantNumericPromotions again, so we can promote things to the
4221 fundamental types (takes care of enums that are bytes, sbytes).
4225 2004-12-01 Raja R Harinath <rharinath@novell.com>
4227 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
4228 Fix long-standing bug in type-lookup. Use FindType instead of
4229 LookupType when ec.ResolvingTypeTree.
4230 (Attribute.ResolveType, Attribute.Resolve)
4231 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
4233 (Attributes.Search): Remove internal version. Update.
4234 (Attributes.SearchMulti): Update.
4235 (Attributes.GetClsCompliantAttribute): Remove.
4236 (Attributes.GetIndexerNameAttribute): Remove.
4237 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
4238 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
4239 * class.cs (Indexer.Define): Likewise.
4241 2004-12-01 Marek Safar <marek.safar@seznam.cz>
4244 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
4245 MarshallByReference members access.
4247 * expression.cs: Use CheckMarshallByRefAccess;
4248 Better error CS0197 message.
4250 * report.cs: Print whole related error message.
4252 2004-11-30 Raja R Harinath <rharinath@novell.com>
4254 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
4255 the current directory to help debugging.
4257 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4259 * class (GetClassBases): Better error 60 report.
4260 (EventProperty): Disabled warning 67 detection.
4262 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4265 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
4267 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
4270 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4273 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
4275 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
4277 2004-11-26 Miguel de Icaza <miguel@ximian.com>
4279 * attribute.cs (Attribute.Resolve): Refine error reporting and
4280 report a cs0117 if the identifier does not exist, to distinguish
4281 from 0617 which is a miss-use of the actual identifier.
4283 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
4284 between cs0070 and cs0079.
4286 * class.cs (MemberBase.DoDefine): When reporting a wrong
4287 accessibility level, we use MethodCore to compare instead of
4288 Method (this was a regression in some refactoring effort).
4290 So now we correctly report cs0056 again.
4292 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
4293 testing the target_type (which was known to be object_type) and
4294 not the source type (which is anonymous_method).
4296 Fixed reporting of error cs1660.
4298 * expression.cs (UserCast.Source): Expose the underlying cast.
4300 * statement.cs (Switch.SwitchGoverningType): Sort the list of
4301 allowed types to find a match to int32 first (most common).
4303 In addition, it ignores any ImplicitUserConversions that did an
4304 internal implicit conversion (as the switch statement allows only
4305 one integral conversion to exist).
4307 * class.cs (PartialContainer.Create): rename `name' to
4308 `member_name' for clarity. Then replace the string calls with a
4309 call to MemberName.GetPartialName, as now using
4310 MemberName.ToString is an error (this is due to the side effects
4311 it had, that were fixed in the past).
4313 This will restore the error reporting on a number of partial class
4314 errors that were missusing this (and getting an exception as a
4315 results, which is now just a plain textual warning, because
4316 yyparse debug output would crash otherwise).
4318 2004-11-26 Raja R Harinath <rharinath@novell.com>
4320 * Makefile (PROGRAM_INSTALL_DIR): Remove.
4322 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4324 * rootcontext.cs (LookupType): Make sure to cache lookups that
4325 don't give us a negative result. This saves about 5% of corlib
4328 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4330 * report.cs (AbstractMessage.Print): messages are sent to stderr
4332 * class.cs (TypeContainer.GetClassBases): It is an error to have a
4333 non-interface in the list of interfaces (at this point, either
4334 parent was properly set, or a base class is being listed in the
4335 interfaces section).
4337 This flags error 1722, and resolves the crash from bug 69259.
4339 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4341 * statement.cs (Using.EmitExpressionFinally): make this work right
4342 for valuetypes. Fixes 69926.
4344 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4346 * const.cs (Const.ChangeType): Cope with the "0 literal can be
4347 converted to an enum" here, before we try to change the underlying
4348 type. This code exists, but it is a different code path than the
4349 one used while encoding constants.
4351 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
4352 old bug: when converting from the null literal to a pointer,
4353 return an EmptyCast, not the NullLiteral.
4355 This fixes #69921, the recent null_type changes probably made this
4358 (ImplicitReferenceConversionExists): In addition, resynchronized
4359 the code here, so it matches the same code in
4360 ImplicitReferenceConversionExists for the `from any class-type S
4361 to any interface-type T'.
4364 2004-11-25 Marek Safar <marek.safar@seznam.cz>
4366 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
4368 2004-11-24 Miguel de Icaza <miguel@ximian.com>
4370 * cs-parser.jay: Use verbosity accordingly.
4372 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4374 * expression.cs (Unary.ResolveOperator): Do not report warning;
4375 AddressOf reads from variable.
4377 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
4379 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4383 * attribute.cs (Attributable): Removed CheckTargets.
4384 (Attributes.Emit): Explicit attribute targets are tested here.
4386 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
4387 not enabled for interfaces.
4389 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
4390 (GetAssemblyName): Ouch next bug there.
4392 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4394 * expression.cs: Error 275 added.
4396 2004-11-23 Marek Safar <marek.safar@seznam.cz>
4398 Fix bug #69177 (Implemented decimal constant support)
4400 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
4401 (BinaryFold): Add DecimalConstant.
4403 * const.cs (Define): Decimal constant
4405 (ChangeType): Add decimal type handling.
4406 (LookupConstantValue): Don't set value for decimal type but
4407 emit DecimalConstantAttribute. Needed for constant optimization.
4409 * constant.cs (ToDecimal): New method.
4410 (ConvertToDecimal): New method.
4411 (IntConstant): Implemented ConvertToDecimal.
4412 (DecimalConstant.Emit): Emit optimized version for decimals in
4415 * expression.cs (ResolveOperator): Changed order of constant
4416 reduction to work correctly with native types which have
4417 overloaded operators.
4418 (ResolveMemberAccess): Extract constant value from attribute
4421 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
4423 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
4424 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
4425 (ChangeType): Decimal is special.
4426 (TypeToCoreType): Add decimal type.
4428 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4430 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
4433 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4435 * class.cs (EventField.ApplyAttributeBuilder): Fix error
4438 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4440 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
4442 * pending.cs (PendingImplementation): Grab only interfaces.
4444 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4446 * statement.cs (ForeachHelperMethods): Add location member and
4447 error 202 detection.
4449 2004-11-19 Raja R Harinath <rharinath@novell.com>
4451 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
4452 automatically handled by executable.make.
4453 (PROGRAM): Make profile-specific.
4455 2004-11-18 Marek Safar <marek.safar@seznam.cz>
4457 * expression.cs (DoResolveBase): Fixed wrong warning for out
4460 2004-11-18 Martin Baulig <martin@ximian.com>
4462 Merged latest changes into gmcs. Please keep this comment in
4463 here, it makes it easier for me to see what changed in MCS since
4464 the last time I merged.
4466 2004-11-17 Raja R Harinath <rharinath@novell.com>
4468 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
4469 (TypeHandle.GetMemberCache): New.
4470 (TypeHandle.TypeHandle): Update.
4471 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
4472 (TypeManager.LookupParentInterfacesCache):
4473 Rename from LookupInterfaceCache. Optimize slightly.
4474 (TypeManager.MemberLookup_FindMembers): Update.
4475 * decl.cs (MemberCache.MemberCache): Set Container to null in the
4477 (AddCacheContents): Rename from AddHashtable.
4478 * class.cs (TypeContainer.parent_container): Remove.
4479 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
4480 (TypeContainer.DoDefineMembers): Don't initialize it.
4481 Update to name changes.
4483 2004-11-17 Miguel de Icaza <miguel@ximian.com>
4485 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
4486 that factors the code to check access modifiers on override.
4488 (PropertyBase): Use the code here.
4490 Patch from Lluis S'anchez, fixes bug #69361.
4492 2004-11-15 Miguel de Icaza <miguel@ximian.com>
4494 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
4495 routine that is used to report the use of a captured variable
4496 whose address has been taken.
4498 There are two checks: one when variables are being captured and
4499 the other check is when the address of a variable is taken.
4501 (because an anonymous methods might be resolved before *or* after
4502 the address has been taken) and
4504 * expression.cs (Conditional.DoResolve): Remove the special
4505 casing that Martin added to trueExpr and falseExpr being both
4506 NullLiteral. We get the right behavior now just by introducing
4507 the null_type into the compiler.
4509 * convert.cs (ExplicitConversion): Change the code to use
4510 null_type instead of testing `expr is NullLiteral'.
4511 (ImplicitConversionStandard): use null_type too.
4512 (ImplicitReferenceConversionExists): use null_type too.
4513 (ImplicitReferenceConversion): use null_type too.
4515 * literal.cs: The type of `NullLiteral' is now null_type instead
4517 (Resolve): Set the type here.
4519 * typemanager.cs: Introduce null_type.
4521 2004-11-17 Martin Baulig <martin@ximian.com>
4523 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4524 direction, like FindMembers() does. Fixes #69546, testcase is in
4527 2004-11-16 Martin Baulig <martin@ximian.com>
4529 This is based on a patch from Marek Safar, see bug #69082.
4530 Fixes bugs #63705 and #67130.
4532 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4533 method; create a MemberCache for an interface type and cache the
4536 * decl.cs (IMemberContainer.ParentContainer): Removed.
4537 (IMemberContainer.ParentCache): New property.
4538 (MemberCache.SetupCacheForInterface): Removed.
4539 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4540 to create a cache for an interface's "parent".
4542 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4545 2004-11-16 Martin Baulig <martin@ximian.com>
4547 Merged back from gmcs; these changes already went into gmcs a
4548 couple of weeks ago.
4551 (TypeManager.AddUserType): Removed the `ifaces' argument.
4552 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
4554 (TypeManager.AddUserInterface): Removed.
4555 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
4557 (TypeManager.GetInterfaces): Likewise.
4558 (TypeManager.GetExplicitInterfaces): Likewise.
4560 * ecore.cs (TypeExpr.GetInterfaces): Removed.
4562 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
4563 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
4565 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4567 * statement.cs: Avoid adding bools to a hashtable.
4569 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4571 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4572 calling an unsafe method from a safe location.
4574 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4577 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4579 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4581 * namespace.cs (VerifyUsing): use GetPartialName instead of
4584 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4586 * statement.cs (Return.Resolve): Fix regression in typo: if
4587 `in_exc', we have to request a NeedReturnLabel, this was a typo
4588 introduced in the anonymous method check-in. Fixes #69131.
4590 * Indexers were using the ShortName when defining themselves,
4591 causing a regression in the compiler bootstrap when applying the
4592 patch from 2004-11-02 (first part), now they use their full name
4593 and the bug is gone.
4595 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4597 * driver.cs: Strip the path from the names of embedded resources. Fixes
4600 2004-11-04 Raja R Harinath <rharinath@novell.com>
4602 Fix error message regression: cs0104-2.cs.
4603 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4604 (AliasEntry.Resolve): Update.
4605 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4607 (RootContext.LookupType): Update.
4609 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4611 * cs-parser.jay: Add support for handling accessor modifiers
4612 * class: Add support port accessor modifiers and error checking,
4613 define PropertyMethod.Define as virtual (not abstract anymore)
4614 * ecore.cs: Add checking for proeprties access with access modifiers
4615 * iterators.cs: Modify Accessor constructor call based in the modified
4617 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4619 * expression.cs (StringConcat): Handle being called twice,
4620 as when we have a concat in a field init with more than two
4623 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4625 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4626 special case explicit implementations, we should always produce
4627 the .property or .event declaration.
4629 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4630 since it will not return correct data if people use this
4631 unresolved in the presence of using statements (see test-313).
4633 * class.cs (MethodData.Define): If we are an explicit interface
4634 implementation, set the method name to the full name of the
4635 interface plus the name of the method.
4637 Notice that using the method.MethodName.GetFullName() does not
4638 work, as it will only contain the name as declared on the source
4639 file (it can be a shorthand in the presence of using statements)
4640 and not the fully qualifed type name, for example:
4644 class D : ICloneable {
4645 object ICloneable.Clone () {
4649 Would produce a method called `ICloneable.Clone' instead of
4650 `System.ICloneable.Clone'.
4652 * namespace.cs (Alias.Resolve): Use GetPartialName.
4654 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4656 * cs-parser.jay: Add error 1055 report.
4658 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4660 * assign.cs (Assign.DoResolve): Only do the transform of
4661 assignment into a New if the types are compatible, if not, fall
4662 through and let the implicit code deal with the errors and with
4663 the necessary conversions.
4665 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4667 * cs-parser.jay: Add error 1031 report.
4669 * cs-tokenizer.cs: Add location for error 1038.
4671 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4673 * cs-parser.jay: Add error 1016 report.
4675 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4677 * cs-parser.jay: Add errors 1575,1611 report.
4679 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4681 * cs-parser.jay: Add error 1001 report.
4683 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4686 * attribute.cs (GetMarshal): Add method argument for
4687 caller identification.
4689 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4690 agument for GetMarshal and RuntimeMissingSupport.
4692 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4694 * attribute.cs (ExtractSecurityPermissionSet): Removed
4695 TypeManager.code_access_permission_type.
4697 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4699 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4701 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4702 for obsolete use of a variable here. Fixes regression on errors
4703 cs0619-25 and cs0619-26.
4705 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4707 Fix #62358, implemented security attribute encoding.
4709 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4710 Tests permitted SecurityAction for assembly or other types.
4711 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4712 data from SecurityPermissionAttribute to PermisionSet class.
4714 * class.cs (ApplyAttributeBuilder): Added special handling
4715 for System.Security.Permissions.SecurityAttribute based types.
4717 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4718 special handling for System.Security.Permissions.SecurityAttribute
4721 * enum.cs (ApplyAttributeBuilder): Added special handling
4722 for System.Security.Permissions.SecurityAttribute based types.
4724 * parameter.cs (ApplyAttributeBuilder): Added special handling
4725 for System.Security.Permissions.SecurityAttribute based types.
4727 * rootcontext.cs: Next 2 core types.
4729 * typemanager.cs (TypeManager.security_permission_attr_type):
4730 Built in type for the SecurityPermission Attribute.
4731 (code_access_permission_type): Build in type.
4733 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4735 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4736 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4737 all of this information into
4738 EmitContext.EmitCapturedVariableInstance.
4740 * codegen.cs (EmitCapturedVariableInstance): move here the
4741 funcionality of emitting an ldarg.0 in the presence of a
4742 remapping. This centralizes the instance emit code.
4744 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4745 then emit a load of this: it means that we have reached the
4746 topmost ScopeInfo: the one that contains the pointer to the
4747 instance of the class hosting the anonymous method.
4749 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4750 captures to the topmost CaptureContext.
4752 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4754 * expression.cs (LocalVariableReference): Move the knowledge about
4755 the iterators into codegen's EmitCapturedVariableInstance.
4757 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4759 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4760 all code paths return a value from an anonymous method (it is the
4761 same as the 161 error, but for anonymous methods).
4763 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4765 The introduction of anonymous methods in the compiler changed
4766 various ways of doing things in the compiler. The most
4767 significant one is the hard split between the resolution phase
4768 and the emission phases of the compiler.
4770 For instance, routines that referenced local variables no
4771 longer can safely create temporary variables during the
4772 resolution phase: they must do so from the emission phase,
4773 since the variable might have been "captured", hence access to
4774 it can not be done with the local-variable operations from the runtime.
4778 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4779 is a toplevel block.
4781 (ToplevelBlock): A new kind of Block, these are the blocks that
4782 are created by the parser for all toplevel method bodies. These
4783 include methods, accessors and anonymous methods.
4785 These contain some extra information not found in regular blocks:
4786 A pointer to an optional CaptureContext (for tracking captured
4787 local variables and parameters). A pointer to the parent
4790 (Return.Resolve): Catch missmatches when returning a value from an
4791 anonymous method (error 1662).
4792 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4795 (Break.Resolve): ditto.
4797 (SwitchLabel): instead of defining the labels during the
4798 resolution phase, we now turned the public ILLabel and ILLabelCode
4799 labels into methods called GetILLabelCode() and GetILLabel() that
4800 only define the label during the Emit phase.
4802 (GotoCase): Track the SwitchLabel instead of the computed label
4803 (its contained therein). Emit the code by using
4804 SwitchLabel.GetILLabelCode ().
4806 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4807 whether the Local has been captured or not.
4809 (LocalInfo.IsCaptured): New property, used to tell whether the
4810 local has been captured.
4812 * anonymous.cs: Vastly updated to contain the anonymous method
4815 The main classes here are: CaptureContext which tracks any
4816 captured information for a toplevel block and ScopeInfo used to
4817 track the activation frames for various local variables.
4819 Each toplevel block has an optional capture context associated
4820 with it. When a method contains an anonymous method both the
4821 toplevel method and the anonymous method will create a capture
4822 context. When variables or parameters are captured, they are
4823 recorded on the CaptureContext that owns them, for example:
4827 MyDelegate d = delegate {
4832 Here `a' will be recorded as captured on the toplevel
4833 CapturedContext, the inner captured context will not have anything
4834 (it will only have data if local variables or parameters from it
4835 are captured in a nested anonymous method.
4837 The ScopeInfo is used to track the activation frames for local
4838 variables, for example:
4840 for (int i = 0; i < 10; i++)
4841 for (int j = 0; j < 10; j++){
4842 MyDelegate d = delegate {
4847 At runtime this captures a single captured variable `i', but it
4848 captures 10 different versions of the variable `j'. The variable
4849 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4850 recorded on a child.
4852 The toplevel ScopeInfo will also track information like the `this'
4853 pointer if instance variables were referenced (this is necessary
4854 as the anonymous method lives inside a nested class in the host
4855 type of the method).
4857 (AnonymousMethod): Expanded to track the Toplevel, implement
4858 `AnonymousMethod.Compatible' to tell whether an anonymous method
4859 can be converted to a target delegate type.
4861 The routine now also produces the anonymous method content
4863 (AnonymousDelegate): A helper class that derives from
4864 DelegateCreation, this is used to generate the code necessary to
4865 produce the delegate for the anonymous method that was created.
4867 * assign.cs: API adjustments for new changes in
4868 Convert.ImplicitStandardConversionExists.
4870 * class.cs: Adjustments to cope with the fact that now toplevel
4871 blocks are of type `ToplevelBlock'.
4873 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4874 insteda of standard blocks.
4876 Flag errors if params arguments are passed to anonymous methods.
4878 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4879 `CurrentAnonymousMethod' which points to the current Anonymous
4880 Method. The variable points to the AnonymousMethod class that
4881 holds the code being compiled. It is set in the new EmitContext
4882 created for the anonymous method.
4884 (EmitContext.Phase): Introduce a variable and an enumeration to
4885 assist in enforcing some rules about when and where we are allowed
4886 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4887 only one that enfonces this right now).
4889 (EmitContext.HaveCaptureInfo): new helper method that returns
4890 whether we have a CapturedContext initialized.
4892 (EmitContext.CaptureVariable): New method used to register that a
4893 LocalInfo must be flagged for capturing.
4895 (EmitContext.CapturedParameter): New method used to register that a
4896 parameters must be flagged for capturing.
4898 (EmitContext.CapturedField): New method used to register that a
4899 field must be flagged for capturing.
4901 (EmitContext.HaveCapturedVariables,
4902 EmitContext.HaveCapturedFields): Return whether there are captured
4903 variables or fields.
4905 (EmitContext.EmitMethodHostInstance): This is used to emit the
4906 instance for the anonymous method. The instance might be null
4907 (static methods), this (for anonymous methods that capture nothing
4908 and happen to live side-by-side with the current method body) or a
4909 more complicated expression if the method has a CaptureContext.
4911 (EmitContext.EmitTopBlock): Routine that drives the emission of
4912 code: it will first resolve the top block, then emit any metadata
4913 and then emit the code. The split is done so that we can extract
4914 any anonymous methods and flag any captured variables/parameters.
4916 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4917 during this phase, the ILGenerator should not be used as labels
4918 and local variables declared here might not be accessible to any
4919 code that is part of an anonymous method.
4921 Exceptions to this include the temporary variables that are
4922 created by some statements internally for holding temporary
4925 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4928 (EmitContext.TemporaryReturn): This method is typically called
4929 from the Emit phase, and its the only place where we allow the
4930 ReturnLabel to be defined other than the EmitMeta. The reason is
4931 that otherwise we would have to duplicate a lot of logic in the
4932 Resolve phases of various methods that today is on the Emit
4935 (EmitContext.NeedReturnLabel): This no longer creates the label,
4936 as the ILGenerator is not valid during the resolve phase.
4938 (EmitContext.EmitThis): Extended the knowledge in this class to
4939 work in anonymous methods in addition to iterators.
4941 (EmitContext.EmitCapturedVariableInstance): This emits whatever
4942 code is necessary on the stack to access the instance to a local
4943 variable (the variable will be accessed as a field).
4945 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
4946 EmitContext.EmitAddressOfParameter): Routines to support
4947 parameters (not completed at this point).
4949 Removals: Removed RemapLocal and RemapLocalLValue. We probably
4950 will also remove the parameters.
4952 * convert.cs (Convert): Define a `ConstantEC' which points to a
4953 null. This is just to prefity some code that uses
4954 ImplicitStandardConversion code and do not have an EmitContext
4957 The idea is to flag explicitly that at that point in time, it is
4958 known that the conversion will not trigger the delegate checking
4959 code in implicit conversions (which requires a valid
4962 Everywhere: pass new EmitContext parameter since
4963 ImplicitStandardConversionExists now requires it to check for
4964 anonymous method conversions.
4966 (Convert.ImplicitStandardConversionExists): If the type of an
4967 expression is the anonymous_method_type, and the type is a
4968 delegate, we invoke the AnonymousMethod.Compatible method to check
4969 whether an implicit conversion is possible.
4971 (Convert.ImplicitConversionStandard): Only do implicit method
4972 group conversions if the language level is not ISO_1.
4974 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
4975 MethodInfo for the Invoke method. used by Delegate and
4978 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
4979 method conversions if the target type is a delegate.
4981 Removed extra debugging nops.
4983 (LocalVariableReference): Turn the `local_info' into a public
4986 Add `prepared' field, the same hack used for FieldExprs to cope
4987 with composed assignments, as Local variables do not necessarily
4988 operate purely on the stack as they used to: they can be captured
4991 Add `temp' for a temporary result, like fields.
4993 Refactor DoResolve and DoResolveLValue into DoResolveBase.
4995 It now copes with Local variables that are captured and emits the
4996 proper instance variable to load it from a field in the captured
4999 (ParameterReference.DoResolveBase): During the resolve phase,
5000 capture parameters if we are in an anonymous method.
5002 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
5003 anonymous method, use the EmitContext helper routines to emit the
5004 parameter reference.
5006 * iterators.cs: Set RemapToProxy to true/false during the
5009 * parameters.cs (GetParameterByName): New helper method.
5011 * typemanager.cs (anonymous_method_type) a new type that
5012 represents an anonyous method. This is always an internal type,
5013 used as a fencepost to test against the anonymous-methodness of an
5016 2004-10-20 Marek Safar <marek.safar@seznam.cz>
5018 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
5020 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
5022 2004-10-18 Martin Baulig <martin@ximian.com>
5024 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
5025 `Type' directly, but call ResolveType() on it.
5026 (Catch.Resolve): Likewise.
5027 (Foreach.Resolve): Likewise.
5029 2004-10-18 Martin Baulig <martin@ximian.com>
5031 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
5032 `Type' directly, but call ResolveType() on it.
5033 (Probe.DoResolve): Likewise.
5034 (ArrayCreation.LookupType): Likewise.
5035 (TypeOf.DoResolve): Likewise.
5036 (SizeOf.DoResolve): Likewise.
5038 2004-10-18 Martin Baulig <martin@ximian.com>
5040 * expression.cs (Invocation.BetterFunction): Put back
5041 TypeManager.TypeToCoreType().
5043 2004-10-18 Raja R Harinath <rharinath@novell.com>
5045 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
5048 2004-10-18 Martin Baulig <martin@ximian.com>
5050 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
5051 `Type' directly, but call ResolveType() on it.
5053 2004-10-18 Martin Baulig <martin@ximian.com>
5055 * class.cs (FieldMember.Define): Don't access the TypeExpr's
5056 `Type' directly, but call ResolveType() on it.
5057 (MemberBase.DoDefine): Likewise.
5059 * expression.cs (New.DoResolve): Don't access the TypeExpr's
5060 `Type' directly, but call ResolveType() on it.
5061 (ComposedCast.DoResolveAsTypeStep): Likewise.
5063 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
5064 `Type' directly, but call ResolveType() on it.
5066 2004-10-17 John Luke <john.luke@gmail.com>
5068 * class.cs (Operator.GetSignatureForError): use CSharpName
5070 * parameter.cs (Parameter.GetSignatureForError): Returns
5071 correct name even if was not defined.
5073 2004-10-13 Raja R Harinath <rharinath@novell.com>
5076 * class.cs (TypeContainer.EmitContext): New property.
5077 (DefineNestedTypes): Create an emitcontext for each part.
5078 (MethodCore.DoDefineParameters): Use container's emitcontext.
5079 Pass type array to InternalParameters.
5080 (MemberBase.DoDefine): Use container's emitcontext.
5081 (FieldMember.Define): Likewise.
5082 (Event.Define): Likewise.
5083 (SetMethod.GetParameterInfo): Change argument to EmitContext.
5084 Pass type array to InternalParameters.
5085 (SetIndexerMethod.GetParameterInfo): Likewise.
5086 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
5087 * delegate.cs (Define): Pass emitcontext to
5088 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
5089 array to InternalParameters.
5090 * expression.cs (ParameterReference.DoResolveBase): Pass
5091 emitcontext to GetParameterInfo.
5092 (ComposedCast.DoResolveAsTypeStep): Remove check on
5093 ec.ResolvingTypeTree.
5094 * parameter.cs (Parameter.Resolve): Change argument to
5095 EmitContext. Use ResolveAsTypeTerminal.
5096 (Parameter.GetSignature): Change argument to EmitContext.
5097 (Parameters.ComputeSignature): Likewise.
5098 (Parameters.ComputeParameterTypes): Likewise.
5099 (Parameters.GetParameterInfo): Likewise.
5100 (Parameters.ComputeAndDefineParameterTypes): Likewise.
5101 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
5102 * support.cs (InternalParameters..ctor): Remove variant that takes
5104 * typemanager.cs (system_intptr_expr): New.
5105 (InitExpressionTypes): Initialize it.
5107 2004-10-12 Chris Toshok <toshok@ximian.com>
5109 * cs-parser.jay: fix location for try_statement and catch_clause.
5111 2004-10-11 Martin Baulig <martin@ximian.com>
5113 * report.cs: Don't make --fatal abort on warnings, we have
5114 -warnaserror for that.
5116 2004-10-07 Raja R Harinath <rharinath@novell.com>
5118 More DeclSpace.ResolveType avoidance.
5119 * decl.cs (MemberCore.InUnsafe): New property.
5120 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
5121 with newly created EmitContext.
5122 (FieldMember.Define): Likewise.
5123 * delegate.cs (Delegate.Define): Likewise.
5124 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
5125 only if normal name-lookup fails.
5126 (TypeExpr.DoResolve): Enable error-checking.
5127 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
5128 (SizeOf.DoResolve): Likewise.
5129 (ComposedCast.DoResolveAsTypeStep): Likewise.
5130 (StackAlloc.DoResolve): Likewise.
5131 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
5132 (Block.Unsafe): New property.
5133 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
5134 (Unsafe): Set 'unsafe' flag of contained block.
5135 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
5136 (Fixed.Resolve): Likewise.
5137 (Catch.Resolve): Likewise.
5138 (Using.ResolveLocalVariableDecls): Likewise.
5139 (Foreach.Resolve): Likewise.
5141 2004-10-05 John Luke <john.luke@gmail.com>
5143 * cs-parser.jay: add location to error CS0175
5145 2004-10-04 Miguel de Icaza <miguel@ximian.com>
5147 * ecore.cs (Expression.Constantity): Add support for turning null
5150 * const.cs (Const.Define): Allow constants to be reference types
5151 as long as the value is Null.
5153 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
5155 * namespace.cs (NamespaceEntry.Using): No matter which warning
5156 level is set, check if this namespace name has already been added.
5158 2004-10-03 Ben Maurer <bmaurer@ximian.com>
5160 * expression.cs: reftype [!=]= null should always use br[true,false].
5163 2004-10-03 Marek Safar <marek.safar@seznam.cz>
5166 * attribute.cs: Enum conversion moved to
5167 GetAttributeArgumentExpression to be applied to the all
5170 2004-10-01 Raja R Harinath <rharinath@novell.com>
5172 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
5173 * class.c (TypeContainer.DefineType): Flag error if
5174 base types aren't accessible due to access permissions.
5175 * decl.cs (DeclSpace.ResolveType): Move logic to
5176 Expression.ResolveAsTypeTerminal.
5177 (DeclSpace.ResolveTypeExpr): Thin layer over
5178 Expression.ResolveAsTypeTerminal.
5179 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
5180 Refactor code into NestedAccess. Use it.
5181 (DeclSpace.NestedAccess): New.
5182 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
5183 argument to silence errors. Check access permissions.
5184 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
5185 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
5186 (Cast.DoResolve): Likewise.
5187 (New.DoResolve): Likewise.
5188 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
5189 (TypeOf.DoResolve): Likewise.
5191 * expression.cs (Invocation.BetterConversion): Return the Type of
5192 the better conversion. Implement section 14.4.2.3 more faithfully.
5193 (Invocation.BetterFunction): Make boolean. Make correspondence to
5194 section 14.4.2.2 explicit.
5195 (Invocation.OverloadResolve): Update.
5196 (Invocation): Remove is_base field.
5197 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
5198 (Invocation.Emit): Likewise.
5200 2004-09-27 Raja R Harinath <rharinath@novell.com>
5202 * README: Update to changes.
5204 2004-09-24 Marek Safar <marek.safar@seznam.cz>
5206 * cs-parser.jay: Reverted 642 warning fix.
5208 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5211 * decl.cs (FindMemberWithSameName): Indexer can have more than
5214 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5216 * expression.cs (LocalVariableReference.DoResolveLValue):
5217 Do not report warning 219 for out values.
5218 (EmptyExpression.Null): New member to avoid extra allocations.
5220 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5222 * cs-parser.jay: Fix wrong warning 642 report.
5224 * cs-tokenizer.cs (CheckNextToken): New helper;
5225 Inspect next character if is same as expected.
5227 2004-09-23 Martin Baulig <martin@ximian.com>
5229 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
5230 (Convert.ImplicitReferenceConversionExists): Likewise.
5232 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5234 * class.cs (Operator.Define): Add error 448 and 559 report.
5236 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5238 * class.cs (MemberBase.IsTypePermitted): New protected
5239 method for checking error CS0610.
5241 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5243 * class.cs (TypeContainer.HasExplicitLayout): New property
5244 Returns whether container has StructLayout attribute set Explicit.
5245 (FieldMember): New abstract class for consts and fields.
5246 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
5247 (Field): Reuse FieldMember.
5249 * const.cs (Const): Reuse FieldMember.
5251 * rootcontext.cs: EmitConstants call moved to class.
5253 2004-09-22 Martin Baulig <martin@ximian.com>
5255 Thanks to Peter Sestoft for this bug report.
5257 * expression.cs (Conditional): If both the `trueExpr' and the
5258 `falseExpr' is a NullLiteral, return a NullLiteral.
5260 2004-09-22 Martin Baulig <martin@ximian.com>
5262 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
5263 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
5264 for the "get_Current" call.
5266 2004-09-22 Martin Baulig <martin@ximian.com>
5268 Marek and me just fixed one of our oldest bugs: #28562 :-)
5270 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
5272 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
5273 we're an EnumConstant, just return that.
5274 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
5275 an EnumConstant. In this case, we need to use GetValueAsEnumType()
5276 to get the value which'll actually be written into the attribute.
5277 However, we have to use GetValue() to access the attribute's value
5280 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5282 * constant.cs (Constant.IsNegative): New abstract property
5285 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
5286 (StackAlloc.DoResolve): Reused IsNegative.
5288 2004-09-21 Martin Baulig <martin@ximian.com>
5290 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
5291 if we're used in an iterator, we may be called from different
5294 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
5295 we actually have an exception block.
5297 2004-09-20 John Luke <jluke@cfl.rr.com>
5299 * class.cs, cs-parser.jay: Improve the error report for 1520:
5300 report the actual line where the error happens, not where the
5303 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
5304 Pass location information that was available elsewhere.
5306 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
5308 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
5309 runtime to delay sign assemblies.
5311 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5313 * cs-parser.jay: Do not report the stack trace, this is barely
5316 2004-08-22 John Luke <john.luke@gmail.com>
5318 * driver.cs : check that a resource id is not already used
5319 before adding it, report CS1508 if it is, bug #63637
5321 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5323 * ecore.cs: Removed dead code.
5325 2004-09-18 Marek Safar <marek.safar@seznam.cz>
5327 * class.cs: Do not report warning CS0067 on the interfaces.
5329 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5331 * cs-parser.jay: Add error 504 report.
5333 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5335 * rootcontext.cs: WarningLevel is 4 by default now.
5337 * statement.cs (Fixed.Resolve): Do not null
5340 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5343 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
5344 deep search when property is not virtual.
5345 (PropertyExpr.ResolveAccessors): Make one call for both
5348 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5351 * statement.cs: Error 152 report constains also location.
5353 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5356 * const.cs: Explicitly set constant as static.
5358 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5361 * cs-parser.jay: Add error 1017 report.
5363 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5365 Fixed bug #59980, #64224
5366 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
5368 * typemanager.cs (IsSpecialMethod): Simplified
5370 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5372 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
5373 condition with better params.
5375 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5378 * attribute.cs (Resolve): Property has to have both
5381 2004-09-14 Martin Baulig <martin@ximian.com>
5383 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
5385 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5388 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
5389 called and is obsolete then this member suppress message
5390 when call is inside next [Obsolete] method or type.
5392 * expression.cs: Use TestObsoleteMethodUsage member.
5394 2004-09-14 Martin Baulig <martin@ximian.com>
5396 * cs-parser.jay: Sync a bit with the GMCS version.
5398 2004-09-14 Martin Baulig <martin@ximian.com>
5400 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
5401 (CSharpParser.yacc_verbose_flag): New public field.
5403 * genericparser.cs: Removed.
5405 2004-09-14 Raja R Harinath <rharinath@novell.com>
5407 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
5409 2004-09-13 Marek Safar <marek.safar@seznam.cz>
5411 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5413 2004-09-10 Martin Baulig <martin@ximian.com>
5415 Backported my MemberName changes from GMCS into MCS.
5417 - we are now using a special `MemberName' class instead of using
5418 strings; in GMCS, the `MemberName' also contains the type
5421 - changed the grammar rules a bit:
5422 * the old `member_name' is now a `namespace_or_type_name':
5423 The rule is that we use `namespace_or_type_name' everywhere
5424 where we expect either a "member name" (GetEnumerator) or a
5425 "member name" with an explicit interface name
5426 (IEnumerable.GetEnumerator).
5427 In GMCS, the explicit interface name may include type arguments
5428 (IEnumerable<T>.GetEnumerator).
5429 * we use `member_name' instead of just `IDENTIFIER' for
5431 The rule is that we use `member_name' wherever a member may
5432 have type parameters in GMCS.
5434 * decl.cs (MemberName): New public class.
5435 (MemberCore.MemberName): New public readonly field.
5436 (MemberCore.ctor): Take a `MemberName' argument, not a string.
5437 (DeclSpace): Likewise.
5439 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
5440 * enum.cs (Enum.ctor): Likewise.
5442 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
5444 (AliasEntry.ctor): Take a MemberName, not an Expression.
5445 (AliasEntry.UsingAlias): Likewise.
5447 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
5448 (IMethodData.MemberName): Changed type from string to MemberName.
5449 (MemberBase.ExplicitInterfaceName): Likewise.
5450 (AbstractPropertyEventMethod.SetupName): Make this private.
5451 (AbstractPropertyEventMethod.ctor): Added `string prefix'
5452 argument; compute the member name here.
5453 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
5454 on the `member.MemberName' and the `prefix'.
5456 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
5458 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
5459 thus, we get a `MemberName' instead of a `string'. These
5460 declarations may have type parameters in GMCS.
5461 (interface_method_declaration, delegate_declaration): Likewise.
5462 (class_declaration, interface_declaration): Likewise.
5463 (method_header): Use `namespace_or_type_name' instead of
5464 `member_name'. We may be an explicit interface implementation.
5465 (property_declaration, event_declaration): Likewise.
5466 (member_name): This is now just an `IDENTIFIER', not a
5467 `namespace_or_type_name'.
5468 (type_name, interface_type): Removed.
5469 (namespace_or_type_name): Return a MemberName, not an Expression.
5470 (primary_expression): Use `member_name' instead of `IDENTIFIER';
5471 call GetTypeExpression() on the MemberName to get an expression.
5472 (IndexerDeclaration.interface_type): Changed type from string to
5474 (MakeName): Operate on MemberName's instead of string's.
5476 2004-09-13 Raja R Harinath <rharinath@novell.com>
5479 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
5480 (NamespaceEntry.Lookup): Add new argument to flag if we want the
5481 lookup to avoid symbols introduced by 'using'.
5482 * rootcontext.cs (NamespaceLookup): Update.
5484 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5486 * class.cs (TypeContainer.DoDefineMembers): Do not call
5487 DefineDefaultConstructor for static classes.
5489 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5491 * attribute.cs (Attribute.Resolve): Add error 653 report.
5493 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5495 (Method.ApplyAttributeBuilder): Add error 685 report.
5496 (Operator.Define): Add error 564 report.
5498 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5500 * expression.cs (Invocation.DoResolve): Add error
5503 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5506 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5508 * class.cs (ConstructorInitializer.Resolve):
5509 Wrong error number (515->516).
5511 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5513 * class.cs (Indexer.Define): Add error 631 report.
5515 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5517 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5519 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5521 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5523 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5525 * cs-parser.jay: Added error CS0241 report.
5527 2004-09-10 Raja R Harinath <rharinath@novell.com>
5529 * cs-parser.jay (fixed_statement): Introduce a scope for the
5530 declaration in the 'fixed' statement.
5532 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5534 * cs-parser.jay: Added CS0230 error report.
5536 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5538 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5540 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5542 * expression.cs (Argument.Resolve): Added error CS0192 and
5545 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5547 C# 2.0 #pragma warning feature
5549 * cs-tokenizer.cs (PreProcessPragma): New method;
5550 Handles #pragma directive.
5552 * report.cs (WarningRegions): New class; Support
5553 class for #pragma warning directive. It tests whether
5554 warning is enabled for a given line.
5556 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5558 * const.cs: Add more descriptive error report, tahnks to
5561 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5563 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5565 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5567 * expression.cs: Apply patch from Ben: Remove dead code from
5568 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5569 as that code just threw an exception anwyays.
5571 * const.cs: Remove the call to the turnintoconstant, for details
5574 * literal.cs: The type of the null-literal is the null type; So
5575 we use a placeholder type (literal.cs:System.Null, defined here)
5578 * expression.cs (Conditional.DoResolve): Remove some old code that
5579 is no longer needed, conversions have been fixed.
5581 (ArrayCreationExpression.DoResolve): Return false if we fail to
5582 resolve the inner expression.
5584 2004-09-07 Raja R Harinath <rharinath@novell.com>
5587 * cs-parser.jay (delegate_declaration): Record a delegate
5588 declaration as a type declaration.
5589 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5591 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5593 * parameter.cs: Do not crash if the type can not be resolved.
5595 * expression.cs: Report errors with unsafe pointers, fixes #64896
5597 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5599 * expression.cs: Pointer arith always needs to do a conv.i
5600 if the operand is a long. fix 65320
5602 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5604 Fixed cs0619-37.cs, cs0619-38.cs
5606 * enum.cs (GetObsoleteAttribute): Removed.
5608 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5609 on Enum member is double staged. The first is tested member
5612 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5614 Fixed #56986, #63631, #65231
5616 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5617 adds member to name container.
5618 (TypeContainer.AddToTypeContainer): New method, adds type to
5620 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5621 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5622 AddOperator): Simplified by reusing AddToMemberContainer.
5623 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5625 (Method.CheckForDuplications): Fixed implementation to test all
5627 (MemberBase): Detection whether member is explicit interface
5628 implementation is now in constructor.
5629 (MemberBase.UpdateMemberName): Handles IndexerName.
5630 (Accessor): Changed to keep also location information.
5631 (AbstractPropertyEventMethod): Is derived from MemberCore.
5632 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5633 will be emited or not.
5634 (PropertyBase.AreAccessorsDuplicateImplementation):
5635 Tests whether accessors are not in collision with some method.
5636 (Operator): Is derived from MethodCore to simplify common
5639 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5641 (DeclSpace.AddToContainer): Adds the member to defined_names
5642 table. It tests for duplications and enclosing name conflicts.
5644 * enum.cs (EnumMember): Clean up to reuse the base structures
5646 2004-09-03 Martin Baulig <martin@ximian.com>
5648 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5649 into TypeContainer, to make partial classes work again.
5651 2004-09-03 Martin Baulig <martin@ximian.com>
5653 * rootcontext.cs (RootContext.V2): Removed.
5655 2004-03-23 Martin Baulig <martin@ximian.com>
5657 * expression.cs (Invocation.OverloadResolve): Added `bool
5658 may_fail' argument and use it instead of the Location.IsNull() hack.
5660 2004-09-03 Martin Baulig <martin@ximian.com>
5662 Merged latest changes into gmcs. Please keep this comment in
5663 here, it makes it easier for me to see what changed in MCS since
5664 the last time I merged.
5666 2004-09-03 Raja R Harinath <rharinath@novell.com>
5669 * expression.cs (BetterConversion): Don't allow either conversion
5670 to be null. Remove redundant implicit conversion test when 'q ==
5671 null' -- when this function is invoked, we already know that the
5672 implicit conversion exists.
5673 (BetterFunction): Assume that 'best' is non-null. Remove
5674 redundant reimplementation of IsApplicable when 'best' is null.
5675 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5676 number of arguments.
5677 (IsAncestralType): Extract from OverloadResolve.
5678 (OverloadResolve): Make robust to the MethodGroupExpr being
5679 unsorted. Implement all the logic of Section 14.5.5.1, and
5680 support overloading of methods from multiple applicable types.
5681 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5683 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5684 (RealError, Warning): Append type of report to related symbol.
5686 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5688 * enum.cs: Fixed CLS-Compliance checks for enum members.
5689 Error tests cs3008-8.cs, cs3014-8.cs
5691 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5693 Fixed bug #62342, #63102
5694 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5695 like ImplementMethod.
5697 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5699 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5702 2004-09-02 Martin Baulig <martin@ximian.com>
5704 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5705 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5708 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5710 C# 2.0 Static classes implemented
5712 * class.cs (TypeContainer): instance_constructors,
5713 initialized_fields, initialized_static_fields,
5714 default_constructor, base_inteface_types are protected to be
5715 accessible from StaticClass.
5716 (TypeContainer.DefineDefaultConstructor): New virtual method
5717 for custom default constructor generating
5718 (StaticClass): New class to handle "Static classes" feature.
5720 * cs-parser.jay: Handle static keyword on class like instance
5723 * driver.cs: Added "/langversion" command line switch with two
5724 options (iso-1, default).
5726 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5728 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5730 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5732 * delegate.cs: Style.
5734 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5736 * delegate.cs: Add seperate instance expr field for miguel.
5738 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5740 * PointerArithmetic (Resolve): make sure we are not doing
5741 pointer arith on void*. Also, make sure we are resolved
5742 by not setting eclass until resolve.
5744 All callers: Make sure that PointerArithmetic gets resolved.
5746 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5748 * ArrayCreation (LookupType): If the type does not resolve
5749 to an array, give an error.
5751 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5753 * statement.cs (Try.Resolve): Fixed bug #64222
5755 2004-08-27 Martin Baulig <martin@ximian.com>
5758 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5761 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5763 * ecore.cs (Constantify): Get underlying type via
5764 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5765 Windows in special cases.
5767 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5769 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5770 for obtaining also private methods.
5771 (GetRemoveMethod): Used GetRemoveMethod (true)
5772 for obtaining also private methods.
5774 2004-08-24 Martin Baulig <martin@ximian.com>
5776 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5777 MethodAttributes.HideBySig for operators.
5779 2004-08-23 Martin Baulig <martin@ximian.com>
5781 Back to the old error reporting system :-)
5783 * report.cs (Message): Removed.
5784 (Report.MessageData, ErrorData, WarningData): Removed.
5785 (Report.Error, Warning): Back to the old system.
5787 2004-08-23 Martin Baulig <martin@ximian.com>
5789 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5791 * class.cs (TypeContainer.ParentContainer): New public virtual
5792 method; replaces the explicit interface implementation.
5793 (ClassPart.ParentContainer): Override.
5795 2004-08-23 Martin Baulig <martin@ximian.com>
5797 * statement.cs (Switch): Added support for constant switches; see
5798 #59428 or test-285.cs.
5800 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5803 * statement.cs (GetEnumeratorFilter): Removed useless
5804 logic because C# specs is strict. GetEnumerator must be
5807 2004-08-22 Martin Baulig <martin@ximian.com>
5809 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5810 a switch and may break, reset the barrier. Fixes #59867.
5812 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5814 CLS-Compliance speed up (~5% for corlib)
5816 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5817 New method. Tests container for CLS-Compliant names
5819 * class.cs (TypeContainer.VerifyClsName): New method.
5820 Checks whether container name is CLS Compliant.
5821 (Constructor): Implements IMethodData.
5823 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5824 low-case table for CLS Compliance test.
5825 (MemberCache.VerifyClsParameterConflict): New method.
5826 Checks method parameters for CS3006 error.
5828 * enum.cs (EnumMember): Is derived from MemberCore.
5829 (Enum.VerifyClsName): Optimized for better performance.
5831 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5833 * report.cs: Renamed Error_T to Error and changed all
5836 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5838 * class.cs (TypeContainer.IndexerArrayList): New inner class
5839 container for indexers.
5840 (TypeContainer.DefaultIndexerName): New constant for default
5841 indexer name. Replaced all "Item" with this constant.
5842 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5844 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5845 DefaultMemberAttribute constructor.
5847 2004-08-05 Martin Baulig <martin@ximian.com>
5849 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5852 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5854 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5855 multi platforms problem.
5857 * compiler.csproj: Included shared files.
5859 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5861 Fix bug 60333, 55971 in the more general way
5862 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5863 Added arg_type argument for constant conversion.
5864 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5866 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5869 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5870 OperatorArrayList, MethodCoreArrayList for typecontainer
5871 containers. Changed class member types to these new types.
5872 (MethodArrayList.DefineMembers): Added test for CS0659.
5874 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5876 * cfold.cs: Synchronize the folding with the code in expression.cs
5877 Binary.DoNumericPromotions for uint operands.
5879 * attribute.cs: Revert patch from Raja, it introduced a regression
5880 while building Blam-1.2.1 (hard to isolate a test case).
5882 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5886 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5888 (MethodCore.parent_method): New member. The method we're overriding
5889 if this is an override method.
5890 (MethodCore.CheckBase): Moved from Method class and made common.
5891 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5893 (MethodCore.CheckForDuplications): New abstract method. For custom
5894 member duplication search in a container
5895 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5896 method and its return type.
5897 (Event.conflict_symbol): New member. Symbol with same name in the
5901 (MemberCache.FindMemberWithSameName): New method. The method
5902 is looking for conflict with inherited symbols.
5904 2004-08-04 Martin Baulig <martin@ximian.com>
5906 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5908 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5910 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5912 * report.cs (Message): New enum for better error, warning reference in
5914 (MessageData): New inner abstract class. It generally handles printing of
5915 error and warning messages.
5916 Removed unused Error, Warning, Message methods.
5918 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5920 Fix for cs0592-8.cs test
5922 (Attributable.ValidAttributeTargets): Made public.
5923 (Attribute.ExplicitTarget): New member for explicit target value.
5924 (Attribute.CheckTargets): Now we translate explicit attribute
5925 target to Target here.
5927 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5929 * ecore.cs (MethodGroupExpr): new IsBase property.
5931 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
5933 * delegate.cs (DelegateCreation): store a MethodGroupExpr
5934 rather than an instance expr.
5936 (DelegateCreation.Emit): Use the method group rather than
5937 the instance expression. Also, if you have base.Foo as the
5938 method for a delegate, make sure to emit ldftn, not ldftnvirt.
5940 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
5942 (NewDelegate.DoResolve): Only check for the existance of Invoke
5943 if the method is going to be needed. Use MethodGroupExpr.
5945 (NewDelegate.Emit): Remove, DelegateCreation implements this.
5947 * expression.cs: For pointer arith., make sure to use
5948 the size of the type, not the size of the pointer to
5951 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5954 * class.cs (Class): Added error CS0502 test.
5956 2004-08-03 John Luke <jluke@cfl.rr.com>
5957 Raja R Harinath <rharinath@novell.com>
5960 * attribute.cs (Attribute.complained_before): New flag.
5961 (Attribute.ResolveType, Attribute.Resolve),
5962 (Attribute.DefinePInvokeMethod): Set it.
5963 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
5965 2004-08-03 Martin Baulig <martin@ximian.com>
5967 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
5968 use a user-defined operator; we still need to do numeric
5969 promotions in case one argument is a builtin type and the other
5970 one has an implicit conversion to that type. Fixes #62322.
5972 2004-08-02 Martin Baulig <martin@ximian.com>
5974 * statement.cs (LocalInfo.Flags): Added `IsThis'.
5975 (LocalInfo.IsThis): New public property.
5976 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
5978 2004-08-01 Martin Baulig <martin@ximian.com>
5980 * class.cs (TypeContainer.GetClassBases): Don't set the default
5981 here since we may get called from GetPartialBases().
5982 (TypeContainer.DefineType): If GetClassBases() didn't return a
5983 parent, use the default one.
5985 2004-07-30 Duncan Mak <duncan@ximian.com>
5987 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
5989 2004-07-30 Martin Baulig <martin@ximian.com>
5991 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
5993 * class.cs (SourceMethod): New public class, derive from the
5994 symbol writer's ISourceMethod.
5995 (Method): Use the new symbol writer API.
5997 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
5998 as argument and use the new symbol writer.
6001 (SourceFile): Implement the symbol writer's ISourceFile.
6002 (Location.SymbolDocument): Removed.
6003 (Location.SourceFile): New public property.
6005 * symbolwriter.cs: Use the new symbol writer API.
6007 2004-07-30 Raja R Harinath <rharinath@novell.com>
6009 * Makefile (install-local): Remove. Functionality moved to
6012 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
6014 * Makefile: Install mcs.exe.config file together with mcs.exe.
6015 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
6016 correct runtime version.
6018 2004-07-25 Martin Baulig <martin@ximian.com>
6021 (TypeContainer.RegisterOrder): Removed, this was unused.
6022 (TypeContainer, interface_order): Removed.
6023 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
6024 TypeContainer as argument since we can also be called with a
6025 `PartialContainer' for a partial class/struct/interface.
6026 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
6027 of checking whether we're an `Interface' - we could be a
6029 (PartialContainer.Register): Override; call
6030 AddClass()/AddStruct()/AddInterface() on our parent.
6032 * cs-parser.jay (interface_member_declaration): Add things to the
6033 `current_container', not the `current_class'.
6035 * rootcontext.cs (RegisterOrder): The overloaded version which
6036 takes an `Interface' was unused, removed.
6038 * typemanager.cs (TypeManager.LookupInterface): Return a
6039 `TypeContainer', not an `Interface'.
6040 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
6041 contain a `PartialContainer' for an interface, so check it's
6042 `Kind' to figure out what it is.
6044 2004-07-25 Martin Baulig <martin@ximian.com>
6046 * class.cs (Class.DefaultTypeAttributes): New public constant.
6047 (Struct.DefaultTypeAttributes): Likewise.
6048 (Interface.DefaultTypeAttributes): Likewise.
6049 (PartialContainer.TypeAttr): Override this and add the
6050 DefaultTypeAttributes.
6052 2004-07-25 Martin Baulig <martin@ximian.com>
6054 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
6055 we can just use the `Parent' field instead.
6057 2004-07-25 Martin Baulig <martin@ximian.com>
6059 * class.cs (TypeContainer.Emit): Renamed to EmitType().
6061 2004-07-25 Martin Baulig <martin@ximian.com>
6063 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
6064 our parts before defining any methods.
6065 (TypeContainer.VerifyImplements): Make this virtual.
6066 (ClassPart.VerifyImplements): Override and call VerifyImplements()
6067 on our PartialContainer.
6069 2004-07-25 Martin Baulig <martin@ximian.com>
6071 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
6073 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
6074 argument, we can just use the `Parent' field instead.
6077 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
6078 (MemberBase.DoDefine): Likewise.
6080 2004-07-24 Martin Baulig <martin@ximian.com>
6082 * decl.cs (MemberCore.Parent): New public field.
6083 (DeclSpace.Parent): Moved to MemberCore.
6085 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
6086 (MemberBase.ctor): Added TypeContainer argument, pass it to our
6088 (FieldBase, Field, Operator): Likewise.
6089 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
6090 (EventField, Event): Likewise.
6092 2004-07-23 Martin Baulig <martin@ximian.com>
6094 * class.cs (PartialContainer): New public class.
6095 (ClassPart): New public class.
6096 (TypeContainer): Added support for partial classes.
6097 (TypeContainer.GetClassBases): Splitted some of the functionality
6098 out into GetNormalBases() and GetPartialBases().
6100 * cs-tokenizer.cs (Token.PARTIAL): New token.
6101 (Tokenizer.consume_identifier): Added some hacks to recognize
6102 `partial', but only if it's immediately followed by `class',
6103 `struct' or `interface'.
6105 * cs-parser.jay: Added support for partial clases.
6107 2004-07-23 Martin Baulig <martin@ximian.com>
6109 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
6110 a `DeclSpace' and also made it readonly.
6111 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
6112 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
6113 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
6115 * cs-parser.jay: Pass the `current_class', not the
6116 `current_container' (at the moment, this is still the same thing)
6117 to a new Method, Property, Event, Indexer or Constructor.
6119 2004-07-23 Martin Baulig <martin@ximian.com>
6121 * cs-parser.jay (CSharpParser): Added a new `current_class' field
6122 and removed the `current_interface' one.
6123 (struct_declaration, class_declaration, interface_declaration):
6124 Set `current_class' to the newly created class/struct/interface;
6125 set their `Bases' and call Register() before parsing their body.
6127 2004-07-23 Martin Baulig <martin@ximian.com>
6129 * class.cs (Kind): New public enum.
6130 (TypeContainer): Made this class abstract.
6131 (TypeContainer.Kind): New public readonly field.
6132 (TypeContainer.CheckDef): New public method; moved here from
6134 (TypeContainer.Register): New public abstract method.
6135 (TypeContainer.GetPendingImplementations): New public abstract
6137 (TypeContainer.GetClassBases): Removed the `is_class' and
6138 `is_iface' parameters.
6139 (TypeContainer.DefineNestedTypes): Formerly known as
6141 (ClassOrStruct): Made this class abstract.
6143 * tree.cs (RootTypes): New public type.
6145 2004-07-20 Martin Baulig <martin@ximian.com>
6147 * tree.cs (Tree.RecordNamespace): Removed.
6148 (Tree.Namespaces): Removed.
6150 * rootcontext.cs (RootContext.IsNamespace): Removed.
6152 * cs-parser.jay (namespace_declaration): Just create a new
6153 NamespaceEntry here.
6155 2004-07-20 Martin Baulig <martin@ximian.com>
6157 * statement.cs (ExceptionStatement): New abstract class. This is
6158 now used as a base class for everyone who's using `finally'.
6159 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
6160 our local variables before using them.
6162 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
6163 virtual method. This is used by Yield.Resolve() to "steal" an
6164 outer block's `finally' clauses.
6165 (FlowBranchingException): The .ctor now takes an ExceptionStatement
6168 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
6169 version which takes an ExceptionStatement. This version must be
6170 used to create exception branchings.
6173 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
6174 (Iterator.EmitMoveNext): Added exception support; protect the
6175 block with a `fault' clause, properly handle 'finally' clauses.
6176 (Iterator.EmitDispose): Run all the `finally' clauses here.
6178 2004-07-20 Martin Baulig <martin@ximian.com>
6180 * iterator.cs: This is the first of a set of changes in the
6181 iterator code. Match the spec more closely: if we're an
6182 IEnumerable, then GetEnumerator() must be called. The first time
6183 GetEnumerator() is called, it returns the current instance; all
6184 subsequent invocations (if any) must create a copy.
6186 2004-07-19 Miguel de Icaza <miguel@ximian.com>
6188 * expression.cs: Resolve the constant expression before returning
6191 2004-07-19 Martin Baulig <martin@ximian.com>
6193 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
6194 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
6195 the return type of the new EmitContext.
6197 2004-07-18 Martin Baulig <martin@ximian.com>
6199 * class.cs (Property.Define): Fix iterators.
6201 * iterators.cs (Iterator.Define): Moved the
6202 `container.AddInterator (this)' call here from the .ctor; only do
6203 it if we resolved successfully.
6205 2004-07-17 Miguel de Icaza <miguel@ximian.com>
6207 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
6208 `true' for preprocessing directives that we parse. The return
6209 value indicates whether we should return to regular tokenizing or
6210 not, not whether it was parsed successfully.
6212 In the past if we were in: #if false ... #line #endif, we would
6213 resume parsing after `#line'. See bug 61604.
6215 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
6216 building: IsEnumType should return true only for enums, not for
6217 enums or System.Enum itself. This fixes #61593.
6219 Likely what happened is that corlib was wrong: mcs depended on
6220 this bug in some places. The bug got fixed, we had to add the
6221 hack, which caused bug 61593.
6223 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
6224 that was a workaround for the older conditions.
6226 2004-07-16 Ben Maurer <bmaurer@ximian.com>
6228 * assign.cs: IAssignMethod has a new interface, as documented
6229 inline. All assignment code now uses this new api.
6231 * ecore.cs, expression.cs: All classes which implement
6232 IAssignMethod now use the new interface.
6234 * expression.cs (Invocation): add a hack to EmitCall so that
6235 IndexerAccess can be the target of a compound assignment without
6236 evaluating its arguments twice.
6238 * statement.cs: Handle changes in Invocation api.
6240 2004-07-16 Martin Baulig <martin@ximian.com>
6242 * iterators.cs: Rewrote this. We're now using one single Proxy
6243 class for both the IEnumerable and the IEnumerator interface and
6244 `Iterator' derives from Class so we can use the high-level API.
6246 * class.cs (TypeContainer.AddIterator): New method.
6247 (TypeContainer.DoDefineType): New protected virtual method, which
6248 is called from DefineType().
6249 (TypeContainer.DoDefineMembers): Call DefineType() and
6250 DefineMembers() on all our iterators.
6251 (TypeContainer.Emit): Call Emit() on all our iterators.
6252 (TypeContainer.CloseType): Call CloseType() on all our iterators.
6254 * codegen.cs (EmitContext.CurrentIterator): New public field.
6256 2004-07-15 Martin Baulig <martin@ximian.com>
6259 (TypeManager.not_supported_exception_type): New type.
6261 2004-07-14 Martin Baulig <martin@ximian.com>
6263 * iterators.cs: Use real error numbers.
6265 2004-07-14 Martin Baulig <martin@ximian.com>
6267 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
6268 requires this to be a System.Collection.IEnumerable and not a
6269 class implementing that interface.
6270 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
6272 2004-07-13 Marek Safar <marek.safar@seznam.cz>
6274 * class.cs: Fixed previous fix, it broke some error tests.
6276 2004-07-12 Martin Baulig <martin@ximian.com>
6278 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
6281 2004-07-09 Miguel de Icaza <miguel@ximian.com>
6283 * assign.cs (LocalTemporary): Add new argument: is_address,If
6284 `is_address' is true, then the value that we store is the address
6285 to the real value, and not the value itself.
6287 * ecore.cs (PropertyExpr): use the new local temporary
6288 stuff to allow us to handle X.Y += z (where X is a struct)
6290 2004-07-08 Martin Baulig <martin@ximian.com>
6292 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
6293 not always return, just like we're doing in Using.Resolve().
6295 2004-07-07 Miguel de Icaza <miguel@ximian.com>
6297 * cs-parser.jay (fixed_statement): flag this as Pinned.
6299 2004-07-06 Miguel de Icaza <miguel@ximian.com>
6301 * typemanager.cs (TypeManager): Removed MakePinned method, this
6302 mechanism is replaced with the .NET 2.x compatible mechanism of
6303 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
6305 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
6306 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
6307 `IsFixed' property which has a different meaning.
6309 2004-07-02 Raja R Harinath <rharinath@novell.com>
6311 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
6312 visible from inside a nested class, not just the names of the
6313 immediately enclosing class.
6316 2004-06-24 Raja R Harinath <rharinath@novell.com>
6318 * expression.cs (BetterConversion): Remove buggy special-case
6319 handling of "implicit constant expression conversions". At this
6320 point, we already know that the conversion is possible -- we're
6321 only checking to see which is better.
6323 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6325 * cs-parser.jay: Added error CS0210 test.
6327 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6329 * cs-parser.jay: Added error CS0134 test.
6331 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6334 * cs-parser.jay: Added error CS0145 test.
6336 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6338 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
6340 2004-06-23 Ben Maurer <bmaurer@ximian.com>
6342 * expression.cs (StackAlloc.Resolve): The argument may not
6343 be a constant; deal with this case.
6345 2004-06-23 Marek Safar <marek.safar@seznam.cz>
6347 * attribute.cs (IndexerName_GetIndexerName): Renamed to
6348 GetIndexerAttributeValue.
6349 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
6351 * class.cs (Indexer.Define): Added error tests for CS0415,
6354 2004-06-23 Miguel de Icaza <miguel@ximian.com>
6356 * attribute.cs (Attribute.Resolve): Keep field code in sync with
6359 2004-06-23 Martin Baulig <martin@ximian.com>
6361 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
6362 neither return nor throw, reset the barrier as well. Fixes #60457.
6364 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
6366 * class.cs : EventAttributes is now set to None by default.
6367 This fixes bug #60459.
6369 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6372 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6373 Don't throw exception but return null (it's sufficient now).
6375 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6377 * typemanager.cs (GetArgumentTypes): Faster implementation.
6379 2004-06-18 Martin Baulig <martin@ximian.com>
6381 * attribute.cs (Attribute.Resolve): Check whether we're an
6382 EmptyCast which a Constant child. Fixes #60333.
6384 2004-06-17 Ben Maurer <bmaurer@ximian.com>
6386 * statement.cs (EmitCollectionForeach): Account for the fact that
6387 not all valuetypes are in areas which we can take the address of.
6388 For these variables, we store to a temporary variable. Also, make
6389 sure that we dont emit a `callvirt' on a valuetype method.
6391 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6393 * expression.cs (StackAlloc.DoReSolve): Added test for
6394 negative parameter (CS0247).
6396 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6399 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
6401 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6404 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
6407 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6409 Fix bug #58254 & cs1555.cs, cs1556.cs
6410 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
6412 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6414 * cs-parser.jay: Added error CS1669 test for indexers.
6416 2004-06-11 Martin Baulig <martin@ximian.com>
6418 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
6419 call this twice: for params and varargs methods.
6421 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6424 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
6426 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6428 * attribute.cs (Attribute.GetValidTargets): Made public.
6431 (AbstractPropertyEventMethod): New class for better code sharing.
6432 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
6434 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
6436 2004-06-11 Raja R Harinath <rharinath@novell.com>
6439 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
6440 that the call to Resolve is part of a MemberAccess.
6441 (Expression.Resolve): Use it for SimpleName resolution.
6442 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
6443 Add 'intermediate' boolean argument.
6444 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
6445 error message when the SimpleName can be resolved ambiguously
6446 between an expression and a type.
6447 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
6449 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
6450 call on the left-side.
6452 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6455 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
6457 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6459 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
6461 2004-06-11 Martin Baulig <martin@ximian.com>
6463 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
6464 varargs methods if applicable.
6466 2004-06-11 Martin Baulig <martin@ximian.com>
6468 * expression.cs (Invocation.EmitCall): Don't use
6469 `method.CallingConvention == CallingConventions.VarArgs' since the
6470 method could also have `CallingConventions.HasThis'.
6472 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6474 * class.cs (Event.GetSignatureForError): Implemented.
6475 Fixed crash in error test cs3010.cs
6477 2004-06-10 Miguel de Icaza <miguel@ximian.com>
6479 * cs-tokenizer.cs: Change the way we track __arglist to be
6480 consistent with the other keywords.
6482 2004-06-09 Miguel de Icaza <miguel@ximian.com>
6484 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
6487 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
6489 * codegen.cs: Check that all referenced assemblies have a strongname
6490 before strongnaming the compiled assembly. If not report error CS1577.
6491 Fix bug #56563. Patch by Jackson Harper.
6492 * typemanager.cs: Added a method to return all referenced assemblies.
6493 Fix bug #56563. Patch by Jackson Harper.
6495 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6498 (Method.ApplyAttributeBuilder): Moved and added conditional
6499 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
6502 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
6504 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6507 * class.cs: (EventField.attribute_targets): Changed default target.
6509 2004-06-08 Martin Baulig <martin@ximian.com>
6511 * expression.cs (Invocation.EmitCall): Enable varargs methods.
6513 2004-06-08 Martin Baulig <martin@ximian.com>
6515 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
6517 2004-06-07 Martin Baulig <martin@ximian.com>
6519 Added support for varargs methods.
6521 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
6524 * cs-parser.jay: Added support for `__arglist'.
6526 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
6528 * expression.cs (Argument.AType): Added `ArgList'.
6529 (Invocation): Added support for varargs methods.
6530 (ArglistAccess): New public class.
6531 (Arglist): New public class.
6533 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
6535 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
6536 a method's top-level block if the method has varargs.
6538 * support.cs (ReflectionParameters, InternalParameters): Added
6539 support for varargs methods.
6541 2004-06-07 Miguel de Icaza <miguel@ximian.com>
6543 * class.cs: Provide location in indexer error report.
6545 * driver.cs: Use standard names.
6547 * namespace.cs: Catch the use of using after a namespace has been
6548 declared also on using aliases.
6550 2004-06-03 Raja R Harinath <rharinath@novell.com>
6553 * typemanager.cs (closure_private_ok, closure_invocation_type)
6554 (closure_qualifier_type, closure_invocation_assembly)
6555 (FilterWithClosure): Move to ...
6556 (Closure): New internal nested class.
6557 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
6558 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
6559 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
6560 (MemberLookup, MemberLookupFailed): Use it.
6561 * expression.cs (New.DoResolve): Treat the lookup for the
6562 constructor as being qualified by the 'new'ed type.
6563 (Indexers.GetIndexersForTypeOrInterface): Update.
6565 2004-06-03 Marek Safar <marek.safar@seznam.cz>
6568 (GetConditionalAttributeValue): New method. Returns
6569 condition of ConditionalAttribute.
6570 (SearchMulti): New method. Returns all attributes of type 't'.
6571 Use it when attribute is AllowMultiple = true.
6572 (IsConditionalMethodExcluded): New method.
6575 (Method.IsExcluded): Implemented. Returns true if method has conditional
6576 attribute and the conditions is not defined (method is excluded).
6577 (IMethodData): Extended interface for ConditionalAttribute support.
6578 (PropertyMethod.IsExcluded): Implemented.
6581 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
6584 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
6587 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
6589 * expression.cs (ArrayCreationExpression): Make this just an
6590 `expression'. It can't be a statement, so the code here was
6593 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6596 * typemanager.cs (GetFullNameSignature): New method for
6599 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6602 * class.cs (MemberBase.GetSignatureForError): New virtual method.
6603 Use this method when MethodBuilder is null.
6604 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
6605 Added test for error CS0626 (MONO reports error for this situation).
6606 (IMethodData.GetSignatureForError): Extended interface.
6608 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6611 (AttributeTester.GetObsoleteAttribute): Returns instance of
6612 ObsoleteAttribute when type is obsolete.
6615 (TypeContainer.VerifyObsoleteAttribute): Override.
6616 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6617 (MethodCode.VerifyObsoleteAttribute): Override.
6618 (MemberBase.VerifyObsoleteAttribute): Override.
6621 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6622 and report proper error.
6625 Delegate.VerifyObsoleteAttribute): Override.
6628 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6629 and report proper error.
6630 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6633 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6637 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6638 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6639 Added test for ObsoleteAttribute.
6642 (Catch): Derived from Statement.
6644 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6646 Fixed bug #59071 & cs0160.cs
6648 * statement.cs (Try.Resolve): Check here whether order of catch
6649 clauses matches their dependencies.
6651 2004-05-31 Miguel de Icaza <miguel@ximian.com>
6653 * Reverted patch to namespace.cs (Use lookuptypedirect). This
6654 caused a regression: #59343. Referencing nested classes from an
6655 assembly stopped working.
6657 2004-05-31 Martin Baulig <martin@ximian.com>
6659 MCS is now frozen for beta 2.
6661 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6663 * convert.cs: add a trivial cache for overload operator resolution.
6665 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6667 * decl.cs: If possible, use lookuptypedirect here. We can only do
6668 this if there is no `.' after the namespace. Avoids using
6669 LookupType, which does lots of slow processing.
6670 (FindNestedType) New method, does what it says :-).
6671 * namespace.cs: use LookupTypeDirect.
6672 * rootcontext.cs: use membercache, if possible.
6673 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6675 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6678 According to the spec,
6680 In a member access of the form E.I, if E is a single identifier,
6681 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6682 field, property, localvariable, or parameter with the same type as
6683 the meaning of E as a type-name (§3.8), then both possible
6684 meanings of E are permitted.
6686 We did not check that E as a simple-name had the same type as E as
6689 This trivial check gives us 5-7% on bootstrap time.
6691 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6693 * expression.cs (Invocation.OverloadResolve): Avoid the
6694 use of hashtables and boxing here by allocating on demand.
6696 2004-05-30 Martin Baulig <martin@ximian.com>
6698 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6699 we're doing a silent lookup. Don't try to lookup nested types in
6700 TypeManager.object_type (thanks to Ben Maurer).
6702 2004-05-30 Martin Baulig <martin@ximian.com>
6704 Committing a patch from Ben Maurer.
6706 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6708 2004-05-29 Martin Baulig <martin@ximian.com>
6710 * class.cs (IMethodData.ShouldIgnore): New method.
6712 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6713 `Location' argument, we don't need it anywhere. Use
6714 `IMethodData.ShouldIgnore ()' instead of
6715 `MethodData.GetMethodFlags ()'.
6716 (TypeManager.AddMethod): Removed.
6717 (TypeManager.AddMethod2): Renamed to AddMethod.
6719 2004-05-29 Martin Baulig <martin@ximian.com>
6721 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6723 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6724 converting from a class type S to an interface type and we already
6725 have an object on the stack, don't box it again. Fixes #52578.
6727 2004-05-29 Martin Baulig <martin@ximian.com>
6729 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6730 Added support for `params' parameters. Fixes #59267.
6732 2004-05-29 Martin Baulig <martin@ximian.com>
6734 * literal.cs (NullPointer): Provide a private .ctor which sets
6735 `type' to TypeManager.object_type. Fixes #59048.
6737 2004-05-29 Martin Baulig <martin@ximian.com>
6739 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6740 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6742 * ecore.cs (EventExpr.instance_expr): Make the field private.
6744 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6746 Fixed bug #50080 & cs0214-2.cs
6747 * expression.cs (Cast.DoResolve): Check unsafe context here.
6749 * statement.cs (Resolve.DoResolve): Likewise.
6751 2004-05-26 Martin Baulig <martin@ximian.com>
6753 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6755 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6756 (RootContext.LookupType): Pass down the `silent' flag.
6758 2004-05-25 Martin Baulig <martin@ximian.com>
6761 (MethodGroupExpr.IdenticalTypeName): New public property.
6762 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6763 expression actually refers to a type.
6765 2004-05-25 Martin Baulig <martin@ximian.com>
6767 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6768 for #56176 and made it actually work.
6770 2004-05-25 Martin Baulig <martin@ximian.com>
6772 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6773 (FieldExpr, PropertyExpr): Override and implement
6774 CacheTemporaries. Fixes #52279.
6776 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6778 * location.cs: In the new compiler listing a file twice is a
6779 warning, not an error.
6781 2004-05-24 Martin Baulig <martin@ximian.com>
6783 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6784 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6786 2004-05-24 Martin Baulig <martin@ximian.com>
6788 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6789 walking the `using' list. Fixes #53921.
6791 2004-05-24 Martin Baulig <martin@ximian.com>
6793 * const.cs (Const.LookupConstantValue): Added support for
6794 EmptyCast's; fixes #55251.
6796 2004-05-24 Martin Baulig <martin@ximian.com>
6798 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6799 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6800 which does the CS0135 check. The reason is that we first need to
6801 check whether the variable actually exists.
6803 2004-05-24 Martin Baulig <martin@ximian.com>
6805 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6806 than RootContext.LookupType() to find the explicit interface
6809 2004-05-24 Raja R Harinath <rharinath@novell.com>
6811 * Makefile: Simplify. Use executable.make.
6812 * mcs.exe.sources: New file. List of sources of mcs.exe.
6814 2004-05-24 Anders Carlsson <andersca@gnome.org>
6818 Use the invariant culture when doing String.Compare for CLS case
6821 2004-05-23 Martin Baulig <martin@ximian.com>
6823 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6824 don't have any dots. Fixes #52622, added cs0246-8.cs.
6826 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6828 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6830 * class.cs (MemberBase.Define): Reuse MemberType member for
6831 resolved type. Other methods can use it too.
6833 2004-05-23 Martin Baulig <martin@ximian.com>
6835 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6836 the variable also exists in the current block (otherwise, we need
6837 to report a CS0103). Fixes #58670.
6839 2004-05-23 Martin Baulig <martin@ximian.com>
6841 * flowanalysis.cs (Reachability.Reachable): Compute this
6842 on-the-fly rather than storing it as a field.
6844 2004-05-23 Martin Baulig <martin@ximian.com>
6846 * flowanalysis.cs (Reachability.And): Manually compute the
6847 resulting `barrier' from the reachability.
6849 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6852 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6853 instance of ObsoleteAttribute when symbol is obsolete.
6856 (IMethodData): Extended interface for ObsoleteAttribute support.
6858 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6860 * attribute.cs: Fix bug #55970
6862 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6866 (GetObsoleteAttribute): New method. Creates the instance of
6868 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6869 ObsoleteAttribute when member is obsolete.
6870 (AttributeTester.Report_ObsoleteMessage): Common method for
6871 Obsolete error/warning reporting.
6874 (TypeContainer.base_classs_type): New member for storing parent type.
6877 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6878 for this MemberCore.
6880 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6882 * attribute.cs, const.cs: Fix bug #58590
6884 2004-05-21 Martin Baulig <martin@ximian.com>
6886 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6887 out parameters if the end of the method is unreachable. Fixes
6890 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6892 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6893 Hari was right, why extra method.
6895 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6897 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6899 2004-05-20 Martin Baulig <martin@ximian.com>
6901 Merged this back from gmcs to keep the differences to a minumum.
6903 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
6904 instead of a Declspace.
6905 (Attribute.ResolveType): Likewise.
6906 (Attributes.Search): Likewise.
6907 (Attributes.Contains): Likewise.
6908 (Attributes.GetClsCompliantAttribute): Likewise.
6910 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
6912 (MethodData.ApplyAttributes): Take an EmitContext instead of a
6915 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6917 Fix bug #58688 (MCS does not report error when the same attribute
6920 * attribute.cs (Attribute.Emit): Distinction between null and default.
6922 2004-05-19 Raja R Harinath <rharinath@novell.com>
6924 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6925 of a top-level attribute without an attribute target.
6926 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6928 (Attribute.Conditional_GetConditionName),
6929 (Attribute.Obsolete_GetObsoleteMessage): Update.
6930 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
6931 part of ScanForIndexerName.
6932 (Attribute.CanIgnoreInvalidAttribute): New function.
6933 (Attribute.ScanForIndexerName): Move to ...
6934 (Attributes.ScanForIndexerName): ... here.
6935 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
6936 (Attributes.Search): New internal variant that can choose not to
6937 complain if types aren't resolved. The original signature now
6939 (Attributes.GetClsCompliantAttribute): Use internal variant, with
6940 complaints suppressed.
6941 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
6942 only if it not useful.
6943 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
6944 top-level for attributes that are shared between the assembly
6945 and a top-level class.
6946 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
6947 * class.cs: Update to reflect changes.
6948 (DefineIndexers): Fuse loops.
6949 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
6950 a couple more variants of attribute names.
6952 2004-05-18 Marek Safar <marek.safar@seznam.cz>
6954 Fix bug #52585 (Implemented explicit attribute declaration)
6957 (Attributable.ValidAttributeTargets): New abstract method. It gets
6958 list of valid attribute targets for explicit target declaration.
6959 (Attribute.Target): It holds target itself.
6960 (AttributeSection): Removed.
6961 (Attribute.CheckTargets): New method. It checks whether attribute
6962 target is valid for the current element.
6965 (EventProperty): New class. For events that are declared like
6966 property (with add and remove accessors).
6967 (EventField): New class. For events that are declared like field.
6970 * cs-parser.jay: Implemented explicit attribute target declaration.
6972 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
6973 Override ValidAttributeTargets.
6976 (ReturnParameter): Class for applying custom attributes on
6978 (ParameterAtribute): New class. Class for applying custom
6979 attributes on the parameter type.
6981 2004-05-17 Miguel de Icaza <miguel@ximian.com>
6983 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
6986 (Method): Allow UNSAFE here.
6988 * modifiers.cs: Support unsafe reporting.
6990 2004-05-17 Marek Safar <marek.safar@seznam.cz>
6992 * decl.cs: Fix bug #58478.
6994 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6996 * statement.cs: When checking for unreachable code on an EmptyStatement,
6997 set the location. Fixes bug #58488.
6999 2004-05-13 Miguel de Icaza <miguel@ximian.com>
7001 * driver.cs: Add -pkg handling.
7003 From Gonzalo: UseShelLExecute=false
7005 2004-05-12 Marek Safar <marek.safar@seznam.cz>
7008 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
7010 (Attribute.IsClsCompliaceRequired): Moved to base for better
7012 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
7013 when attribute is AttributeUsageAttribute.
7014 (Attribute.GetValidTargets): Simplified.
7015 (Attribute.GetAttributeUsage): New method returns AttributeUsage
7016 attribute for this type.
7017 (Attribute.ApplyAttributes): Method renamed to Emit and make
7019 (GlobalAttributeSection): New class for special handling of global
7020 attributes (assembly, module).
7021 (AttributeSection.Emit): New method.
7023 * class.cs: Implemented Attributable abstract methods.
7024 (MethodCore.LabelParameters): Moved to Parameter class.
7025 (Accessor): Is back simple class.
7026 (PropertyMethod): Implemented Attributable abstract class.
7027 (DelegateMethod): Implemented Attributable abstract class.
7028 (Event): New constructor for disctintion between normal Event
7029 and Event with accessors.
7031 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
7033 * codegen.cs, const.cs, decl.cs, delegate.cs:
7034 (CommonAssemblyModulClass): Implemented Attributable abstract class
7037 * enum.cs: Implement IAttributeSupport interface.
7038 (EnumMember): New class for emum members. Implemented Attributable
7042 (ParameterBase): Is abstract.
7043 (ReturnParameter): New class for easier [return:] attribute handling.
7045 * typemanager.cs: Removed builder_to_attr.
7047 2004-05-11 Raja R Harinath <rharinath@novell.com>
7050 * attribute.cs (Attribute.GetPositionalValue): New function.
7051 * class.cs (TypeContainer.VerifyMembers): New function.
7052 (TypeContainer.Emit): Use it.
7053 (ClassOrStruct): New base class for Class and Struct.
7054 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
7055 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
7057 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
7058 then each non-static field should have a FieldOffset attribute.
7059 Otherwise, none of the fields should have a FieldOffset attribute.
7060 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
7061 and FieldOffset attributes.
7062 * typemanager.cs (TypeManager.struct_layout_attribute_type)
7063 (TypeManager.field_offset_attribute_type): New core types.
7064 (TypeManager.InitCoreTypes): Initialize them.
7066 2004-05-11 Michal Moskal <malekith@pld-linux.org>
7068 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
7069 Return correct type.
7072 2004-05-09 Miguel de Icaza <miguel@ximian.com>
7074 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
7075 be implicitly converted to ulong.
7077 * expression.cs: The logic for allowing operator &, | and ^ worked
7078 was wrong, it worked before because we did not report an error in
7079 an else branch. Fixes 57895.
7081 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
7082 allow volatile fields to be reference types.
7084 2004-05-07 Miguel de Icaza <miguel@ximian.com>
7086 * driver.cs: Add support for /debug-
7088 2004-05-07 Raja R Harinath <rharinath@novell.com>
7090 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
7091 Add a 'complain' parameter to silence errors.
7092 (Attribute.Resolve): Update to changes. Put in sanity check to catch
7093 silently overlooked type-resolutions.
7094 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
7096 (Attributes.Search): New function.
7097 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
7098 (Attributes.GetAttributeFullName): Remove hack.
7099 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
7100 Update to reflect changes.
7101 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
7102 Use Attributes.Search instead of nested loops.
7104 2004-05-07 Marek Safar <marek.safar@seznam.cz>
7107 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
7108 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
7109 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
7111 * report.cs: (Report.Warning): Renamed to Warning_T because of
7112 parameter collision.
7114 2004-05-05 Raja R Harinath <rharinath@novell.com>
7116 * expression.cs (MemberAccess.ResolveMemberAccess):
7117 Exit with non-zero status after Report.Error.
7118 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
7120 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
7122 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7124 * support.cs: Don't hang when the file is empty.
7126 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7128 * support.cs: In SeekableStreamReader, compute the preamble size of the
7129 underlying stream. Position changes should take into account that initial
7132 2004-05-03 Todd Berman <tberman@sevenl.net>
7134 * driver.cs: remove unused GetSysVersion function.
7136 2004-05-03 Todd Berman <tberman@sevenl.net>
7138 * driver.cs: Remove the hack from saturday, as well as the hack
7139 from jackson (LoadAssemblyFromGac), also adds the CWD to the
7140 link_paths to get that bit proper.
7142 2004-05-01 Todd Berman <tberman@sevenl.net>
7144 * driver.cs: Try a LoadFrom before a Load, this checks the current
7145 path. This is currently a bug in mono that is be fixed, however, this
7146 provides a workaround for now. This will be removed when the bug
7149 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
7151 * CryptoConvert.cs: Updated to latest version. Fix issue with
7152 incomplete key pairs (#57941).
7154 2004-05-01 Todd Berman <tberman@sevenl.net>
7156 * driver.cs: Remove '.' from path_chars, now System.* loads properly
7159 2004-04-30 Jackson Harper <jackson@ximian.com>
7161 * codegen.cs: Open keys readonly.
7163 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7165 * typemanager.cs: don't report cyclic struct layout when a struct
7166 contains 2 or more fields of the same type. Failed for Pango.AttrShape
7167 which has 2 Pango.Rectangle fields.
7169 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
7171 * expression.cs: Handle IntPtr comparisons with IL code
7172 rather than a method call.
7174 2004-04-29 Martin Baulig <martin@ximian.com>
7176 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
7177 the list of PropertyInfo's in class hierarchy and find the
7178 accessor. Fixes #56013.
7180 2004-04-29 Martin Baulig <martin@ximian.com>
7182 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
7184 2004-04-29 Martin Baulig <martin@ximian.com>
7186 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7188 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
7190 2004-04-29 Martin Baulig <martin@ximian.com>
7192 * class.cs (ConstructorInitializer.Resolve): Check whether the
7193 parent .ctor is accessible. Fixes #52146.
7195 2004-04-29 Martin Baulig <martin@ximian.com>
7197 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7199 * statement.cs (Using.EmitLocalVariableDecls): Use
7200 TypeManager.idisposable_type, not typeof (IDisposable).
7201 (Foreach.EmitCollectionForeach): Added support for valuetypes.
7203 2004-04-29 Martin Baulig <martin@ximian.com>
7205 * class.cs (Event.Define): Don't emit the field and don't set
7206 RTSpecialName and SpecialName for events on interfaces. Fixes
7209 2004-04-29 Raja R Harinath <rharinath@novell.com>
7211 Refactor Attribute.ApplyAttributes.
7212 * attribute.cs (Attributable): New base class for objects that can
7213 have Attributes applied on them.
7214 (Attribute): Make AttributeUsage fields public.
7215 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
7216 (Attribute.IsInternalCall): New property.
7217 (Attribute.UsageAttr): Convert to a public read-only property.
7218 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
7219 (Attribute.ResolveType, Attribute.Resolve)
7220 (Attribute.ScanForIndexerName): Update to reflect changes.
7221 (Attribute.CheckAttributeTarget): Re-format.
7222 (Attribute.ApplyAttributes): Refactor, to various
7223 Attributable.ApplyAttributeBuilder methods.
7224 * decl.cs (MemberCore): Make Attributable.
7225 * class.cs (Accessor): Make Attributable.
7226 (MethodData.ApplyAttributes): Use proper attribute types, not
7228 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
7229 (TypeContainer.ApplyAttributeBuilder)
7230 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
7231 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
7232 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
7233 (Operator.ApplyAttributeBuilder): New factored-out methods.
7234 * const.cs (Const.ApplyAttributeBuilder): Likewise.
7235 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
7236 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
7237 * parameter.cs (ParameterBase): New Attributable base class
7238 that can also represent Return types.
7239 (Parameter): Update to the changes.
7241 2004-04-29 Jackson Harper <jackson@ximian.com>
7243 * driver.cs: Prefer the corlib system version when looking for
7244 assemblies in the GAC. This is still a hack, but its a better hack
7247 2004-04-29 Marek Safar <marek.safar@seznam.cz>
7249 * decl.cs, enum.cs: Improved error 3005 reporting.
7251 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
7252 (related_symbols): New private member for list of symbols
7253 related to reported error/warning.
7255 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
7257 2004-04-29 Martin Baulig <martin@ximian.com>
7259 * ecore.cs (Expression.Constantify): If we're an enum and
7260 TypeManager.TypeToCoreType() doesn't give us another type, use
7261 t.UnderlyingSystemType. Fixes #56178.
7263 2004-04-29 Martin Baulig <martin@ximian.com>
7265 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
7266 interfaces and for each interface, only add members directly
7267 declared in that interface. Fixes #53255.
7269 2004-04-28 Martin Baulig <martin@ximian.com>
7271 * expression.cs (ConditionalLogicalOperator): Use a temporary
7272 variable for `left' to avoid that we evaluate it more than once;
7275 2004-04-28 Martin Baulig <martin@ximian.com>
7277 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
7280 2004-04-28 Martin Baulig <martin@ximian.com>
7282 * statement.cs (LocalInfo.Resolve): Check whether the type is not
7285 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
7286 whether the type is not void (CS1547).
7288 2004-04-28 Martin Baulig <martin@ximian.com>
7290 * expression.cs (Unary.DoResolveLValue): Override this and report
7291 CS0131 for anything but Operator.Indirection.
7293 2004-04-28 Martin Baulig <martin@ximian.com>
7295 Committing a patch from Ben Maurer; see bug #50820.
7297 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7300 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7303 2004-04-28 Martin Baulig <martin@ximian.com>
7305 Committing a patch from Ben Maurer; see bug #50820.
7307 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7310 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7313 2004-04-28 Martin Baulig <martin@ximian.com>
7315 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
7316 (Block.AddLabel): Call DoLookupLabel() to only search in the
7319 2004-04-28 Martin Baulig <martin@ximian.com>
7321 * cfold.cs (ConstantFold.BinaryFold): Added special support for
7322 comparing StringConstants and NullLiterals in Equality and Inequality.
7324 2004-04-28 Jackson Harper <jackson@ximian.com>
7326 * driver.cs: Attempt to load referenced assemblies from the
7327 GAC. This is the quick and dirty version of this method that
7328 doesnt take into account versions and just takes the first
7329 canidate found. Will be good enough for now as we will not have more
7330 then one version installed into the GAC until I update this method.
7332 2004-04-28 Martin Baulig <martin@ximian.com>
7334 * typemanager.cs (TypeManager.CheckStructCycles): New public
7335 static method to check for cycles in the struct layout.
7337 * rootcontext.cs (RootContext.PopulateTypes): Call
7338 TypeManager.CheckStructCycles() for each TypeContainer.
7339 [Note: We only need to visit each type once.]
7341 2004-04-28 Martin Baulig <martin@ximian.com>
7343 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
7345 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
7346 success and added `out object value'. Use a `bool resolved' field
7347 to check whether we've already been called rather than
7348 `ConstantValue != null' since this breaks for NullLiterals.
7350 2004-04-28 Raja R Harinath <rharinath@novell.com>
7352 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
7353 setting of this flag, since the 'set' method may be non-public.
7355 2004-04-28 Raja R Harinath <rharinath@novell.com>
7357 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
7358 check on current_vector.Block.
7360 2004-04-27 Martin Baulig <martin@ximian.com>
7362 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
7363 a field initializer. Fixes #56459.
7365 2004-04-27 Martin Baulig <martin@ximian.com>
7367 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
7368 we're not attempting to use an indexer. Fixes #52154.
7370 2004-04-27 Martin Baulig <martin@ximian.com>
7372 * statement.cs (Return): Don't create a return label if we don't
7373 need it; reverts my change from January 20th. Thanks to Ben
7376 2004-04-27 Martin Baulig <martin@ximian.com>
7378 According to the spec, `goto' can only leave a nested scope, but
7381 * statement.cs (Block.LookupLabel): Only lookup in the current
7382 block, don't recurse into parent or child blocks.
7383 (Block.AddLabel): Check in parent and child blocks, report
7384 CS0140/CS0158 if we find a duplicate.
7385 (Block): Removed this indexer for label lookups.
7386 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
7387 this already does the error reporting for us.
7390 (FlowBranching.UsageVector.Block): New public variable; may be null.
7391 (FlowBranching.CreateSibling): Added `Block' argument.
7392 (FlowBranching.LookupLabel): New public virtual method. Lookup a
7393 label for the target of a `goto' and check whether we're not
7394 leaving a `finally'.
7396 2004-04-27 Martin Baulig <martin@ximian.com>
7398 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7399 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
7402 2004-04-27 Martin Baulig <martin@ximian.com>
7404 * statement.cs (Block.AddLabel): Also check for implicit blocks
7405 and added a CS0158 check.
7407 2004-04-27 Martin Baulig <martin@ximian.com>
7409 * flowanalysis.cs (FlowBranchingLoop): New class.
7410 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
7411 UsageVector's instead of an ArrayList.
7412 (FlowBranching.Label): Likewise.
7413 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
7414 (FlowBranching.AddBreakVector): New method.
7416 2004-04-27 Miguel de Icaza <miguel@ximian.com>
7418 * attribute.cs: Small regression fix: only convert the type if we
7419 the type is different, fixes System.Drawing build.
7421 2004-04-27 Martin Baulig <martin@ximian.com>
7423 * attribute.cs (Attribute.Resolve): If we have a constant value
7424 for a named field or property, implicity convert it to the correct
7427 2004-04-27 Raja R Harinath <rharinath@novell.com>
7429 * statement.cs (Block.Block): Implicit blocks share
7430 'child_variable_names' fields with parent blocks.
7431 (Block.AddChildVariableNames): Remove.
7432 (Block.AddVariable): Mark variable as "used by a child block" in
7433 every surrounding block.
7434 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
7435 been used in a child block, complain about violation of "Invariant
7436 meaning in blocks" rule.
7437 * cs-parser.jay (declare_local_variables): Don't use
7438 AddChildVariableNames.
7439 (foreach_statement): Don't create an implicit block: 'foreach'
7442 2004-04-23 Miguel de Icaza <miguel@ximian.com>
7444 * convert.cs (ImplicitNumericConversion): 0 is also positive when
7445 converting from 0L to ulong. Fixes 57522.
7447 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7449 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
7450 derived class hides via 'new' keyword field from base class (test-242.cs).
7451 TODO: Handle this in the more general way.
7453 * class.cs (CheckBase): Ditto.
7455 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7457 * decl.cs (caching_flags): New member for storing cached values
7459 (MemberCore.Flags): New enum where bit flags for caching_flags
7461 (MemberCore.cls_compliance): Moved to caching_flags.
7462 (DeclSpace.Created): Moved to caching_flags.
7464 * class.cs: Use caching_flags instead of DeclSpace.Created
7466 2004-04-21 Miguel de Icaza <miguel@ximian.com>
7468 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
7469 if we are only a derived class, not a nested class.
7471 * typemanager.cs: Same as above, but do this at the MemberLookup
7472 level (used by field and methods, properties are handled in
7473 PropertyExpr). Allow for the qualified access if we are a nested
7476 2004-04-21 Marek Safar <marek.safar@seznam.cz>
7478 * class.cs: Refactoring.
7479 (IMethodData): New inteface; Holds links to parent members
7480 to avoid member duplication (reduced memory allocation).
7481 (Method): Implemented IMethodData interface.
7482 (PropertyBase): New inner classes for get/set methods.
7483 (PropertyBase.PropertyMethod): Implemented IMethodData interface
7484 (Event): New inner classes for add/remove methods.
7485 (Event.DelegateMethod): Implemented IMethodData interface.
7487 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7488 EmitContext (related to class.cs refactoring).
7490 2004-04-21 Raja R Harinath <rharinath@novell.com>
7492 * delegate.cs (Delegate.VerifyApplicability): If the number of
7493 arguments are the same as the number of parameters, first try to
7494 verify applicability ignoring any 'params' modifier on the last
7498 2004-04-16 Raja R Harinath <rharinath@novell.com>
7500 * class.cs (TypeContainer.AddIndexer): Use
7501 'ExplicitInterfaceName' to determine if interface name was
7502 explicitly specified. 'InterfaceType' is not initialized at this time.
7503 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7504 Indexers array is already in the required order. Initialize
7505 'IndexerName' only if there are normal indexers.
7506 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7507 (TypeContainer.Emit): Emit DefaultMember attribute only if
7508 IndexerName is initialized.
7511 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7513 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7516 2004-04-15 Raja R Harinath <rharinath@novell.com>
7518 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7522 * attribute.cs (Attribute.Resolve): Check for duplicate named
7526 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7528 * iterators.cs (MarkYield): track whether we are in an exception,
7529 and generate code accordingly. Use a temporary value to store the
7530 result for our state.
7532 I had ignored a bit the interaction of try/catch with iterators
7533 since their behavior was not entirely obvious, but now it is
7534 possible to verify that our behavior is the same as MS .NET 2.0
7538 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7540 * iterators.cs: Avoid creating temporaries if there is no work to
7543 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7544 Enumerations, use TypeManager.EnumToUnderlying and call
7547 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7550 (This.Emit): Use EmitContext.EmitThis to emit our
7553 (This.EmitAssign): Ditto.
7555 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7556 codepaths, we will move all the functionality into
7559 (FieldExpr.EmitAssign): Ditto.
7561 This fixes several hidden bugs that I uncovered while doing a code
7562 review of this today.
7564 * codegen.cs (EmitThis): reworked so the semantics are more clear
7565 and also support value types "this" instances.
7567 * iterators.cs: Changed so that for iterators in value types, we
7568 do not pass the value type as a parameter.
7570 Initialization of the enumerator helpers is now done in the caller
7571 instead of passing the parameters to the constructors and having
7572 the constructor set the fields.
7574 The fields have now `assembly' visibility instead of private.
7576 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7578 * expression.cs (Argument.Resolve): Check if fields passed as ref
7579 or out are contained in a MarshalByRefObject.
7581 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7582 another compiler type.
7584 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7586 * class.cs (Indexer.Define): use the new name checking method.
7587 Also, return false on an error.
7588 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7589 (is_identifier_[start/part]_character): make static.
7591 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7593 * expression.cs (Binary.ResolveOperator): Do no append strings
7594 twice: since we can be invoked more than once (array evaluation)
7595 on the same concatenation, take care of this here. Based on a fix
7596 from Ben (bug #56454)
7598 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7600 * codegen.cs: Fix another case where CS1548 must be reported (when
7601 delay-sign isn't specified and no private is available #56564). Fix
7602 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7603 error when MCS is used on the MS runtime and we need to delay-sign
7604 (which seems unsupported by AssemblyBuilder - see #56621).
7606 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7608 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7609 (TypeManager.ComputeNamespaces): Faster implementation for
7612 * compiler.csproj: Updated AssemblyName to mcs.
7614 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7616 * rootcontext.cs: Add new types to the boot resolution.
7618 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7619 MulticastDelegate is not allowed.
7621 * typemanager.cs: Add new types to lookup: System.TypedReference
7624 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7625 check for TypedReference or ArgIterator, they are not allowed.
7627 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7628 makes us properly catch 1510 in some conditions (see bug 56016 for
7631 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7633 * CryptoConvert.cs: update from corlib version
7636 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7638 * class.cs (Indexer.Define): Check indexername declaration
7640 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7642 * attribute.cs (IsClsCompliant): Fixed problem with handling
7643 all three states (compliant, not-compliant, undetected).
7645 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7647 * attribute.cs (Attribute): Location is now public.
7648 (Resolve): Store resolved arguments (pos_values) in attribute class.
7649 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7650 (GetClsCompliantAttributeValue): New method that gets
7651 CLSCompliantAttribute value.
7652 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7653 if exists else null.
7654 (AttributeTester): New class for CLS-Compliant verification routines.
7656 * class.cs (Emit): Add CLS-Compliant verification.
7657 (Method.GetSignatureForError): Implemented.
7658 (Constructor.GetSignatureForError): Implemented
7659 (Constructor.HasCompliantArgs): Returns if constructor has
7660 CLS-Compliant arguments.
7661 (Constructor.Emit): Override.
7662 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7663 is needed to test only parameters.
7664 (FieldBase.GetSignatureForError): Implemented.
7665 (TypeContainer): New member for storing base interfaces.
7666 (TypeContainer.FindMembers): Search in base interfaces too.
7668 * codegen.cs (GetClsComplianceAttribute): New method that gets
7669 assembly or module CLSCompliantAttribute value.
7670 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7672 (ModuleClass.Emit): Add error 3012 test.
7674 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7676 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7677 state for all decl types.
7678 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7679 if CLS-Compliant tests are required.
7680 (IsClsCompliaceRequired): New method. Analyze whether code
7681 must be CLS-Compliant.
7682 (IsExposedFromAssembly): New method. Returns true when MemberCore
7683 is exposed from assembly.
7684 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7685 value or gets cached value.
7686 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7687 is explicitly marked with CLSCompliantAttribute.
7688 (IsIdentifierClsCompliant): New abstract method. This method is
7689 used to testing error 3005.
7690 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7691 for identifier and parameters CLS-Compliant testing.
7692 (VerifyClsCompliance): New method. The main virtual method for
7693 CLS-Compliant verifications.
7694 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7695 null. I don't know why is null (too many public members !).
7696 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7697 and get value of first CLSCompliantAttribute that found.
7699 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7700 (VerifyClsCompliance): Override and add extra tests.
7702 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7703 clscheck- disable CLS-Compliant verification event if assembly is has
7704 CLSCompliantAttribute(true).
7706 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7707 ApllyAttribute is now called in emit section as in the other cases.
7708 Possible future Emit integration.
7709 (IsIdentifierClsCompliant): New override.
7710 (VerifyClsCompliance): New override.
7711 (GetEnumeratorName): Returns full enum name.
7713 * parameter.cs (GetSignatureForError): Implemented.
7715 * report.cs (WarningData): New struct for Warning message information.
7716 (LocationOfPreviousError): New method.
7717 (Warning): New method. Reports warning based on the warning table.
7718 (Error_T): New method. Reports error based on the error table.
7720 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7721 verifications are done here.
7723 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7725 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7726 CLSCompliantAttribute.
7727 (all_imported_types): New member holds all imported types from other
7729 (LoadAllImportedTypes): New method fills static table with exported types
7730 from all referenced assemblies.
7731 (Modules): New property returns all assembly modules.
7733 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7735 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7736 throwing a parser error.
7738 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7739 which removes the hardcoded get_/set_ prefixes for properties, as
7740 IL allows for the properties to be named something else.
7744 * expression.cs: Do not override operand before we know if it is
7747 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7749 * typemanager.cs: support for pinned variables.
7751 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7753 * decl.cs, typemanager.cs: Avoid using an arraylist
7754 as a buffer if there is only one result set.
7756 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7758 * expression.cs: Make sure you cant call a static method
7759 with an instance expression, bug #56174.
7761 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7763 * class.cs (IsDuplicateImplementation): Improve error reporting to
7764 flag 663 (method only differs in parameter modifier).
7766 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7767 in preprocessor directives.
7769 * location.cs (LookupFile): Allow for the empty path.
7771 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7772 better approach for some of that patch, but its failing with the
7773 CharSet enumeration. For now try/catch will do.
7775 * typemanager.cs: Do not crash if a struct does not have fields.
7778 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7780 * expression.cs: cs0213, cant fix a fixed expression.
7783 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7785 * cs-parser.jay: detect invalid embeded statements gracefully.
7788 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7790 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7793 the invocation type may not be a subclass of the tye of the item/
7794 The type of the item must be a subclass of the invocation item.
7799 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7801 * attribute.cs: Added methods to get a string and a bool from an
7802 attribute. Required to information from AssemblyKeyFileAttribute,
7803 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7804 * codegen.cs: Modified AssemblyName creation to include support for
7805 strongnames. Catch additional exceptions to report them as CS1548.
7806 * compiler.csproj: Updated include CryptoConvert.cs.
7807 * compiler.csproj.user: Removed file - user specific configuration.
7808 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7809 Mono.Security assembly. The original class is maintained and tested in
7810 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7811 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7812 like CSC 8.0 (C# v2) supports.
7813 * Makefile: Added CryptoConvert.cs to mcs sources.
7814 * rootcontext.cs: Added new options for strongnames.
7816 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7818 * driver.cs: For --expect-error, report error code `2'
7819 if the program compiled with no errors, error code `1' if
7820 it compiled with an error other than the one expected.
7822 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7824 * compiler.csproj: Updated for Visual Studio .NET 2003.
7825 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7826 * compiler.sln: Updated for Visual Studio .NET 2003.
7828 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7830 * expression.cs: Fix bug #47234. We basically need to apply the
7831 rule that we prefer the conversion of null to a reference type
7832 when faced with a conversion to 'object' (csc behaviour).
7834 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7836 * statement.cs: Shorter form for foreach, eliminates
7837 a local variable. r=Martin.
7839 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7841 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7842 checks if we can use brtrue/brfalse to test for 0.
7843 * expression.cs: use the above in the test for using brtrue/brfalse.
7846 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7848 * expression.cs: Rewrite string concat stuff. Benefits:
7850 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7851 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7852 rather than a concat chain.
7854 * typemanager.cs: Add lookups for more concat overloads.
7856 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7858 * expression.cs: Emit shorter il code for array init.
7875 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7877 * statement.cs: Before, two switch blocks would be merged if the
7878 total size of the blocks (end_item - begin_item + 1) was less than
7879 two times the combined sizes of the blocks.
7881 Now, it will only merge if after the merge at least half of the
7886 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7888 * class.cs : csc build fix for GetMethods(). See bug #52503.
7890 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7892 * expression.cs: Make sure fp comparisons work with NaN.
7893 This fixes bug #54303. Mig approved this patch a long
7894 time ago, but we were not able to test b/c the runtime
7897 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7899 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7901 2004-03-19 Martin Baulig <martin@ximian.com>
7903 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7904 error here and not in our caller.
7906 2004-03-19 Martin Baulig <martin@ximian.com>
7908 * interface.cs: Completely killed this file.
7909 (Interface): We're now a TypeContainer and live in class.cs.
7911 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7912 argument; we're now also called for interfaces.
7913 (TypeContainer.DefineMembers): Allow this method being called
7915 (TypeContainer.GetMethods): New public method; formerly known as
7916 Interface.GetMethod(). This is used by PendingImplementation.
7917 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7918 it's now private and non-static.
7919 (Interface): Moved this here; it's now implemented similar to
7921 (Method, Property, Event, Indexer): Added `bool is_interface'
7922 argument to their .ctor's.
7923 (MemberBase.IsInterface): New public field.
7925 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7926 instances instead of InterfaceMethod, InterfaceProperty, etc.
7927 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7928 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
7930 2004-03-19 Martin Baulig <martin@ximian.com>
7932 * class.cs (MethodCore.IsDuplicateImplementation): New private
7933 method which does the CS0111 checking.
7934 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
7935 Use IsDuplicateImplementation().
7937 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
7939 * decl.cs (FindMemberToOverride): New method to find the correct
7940 method or property to override in the base class.
7942 - Make Method/Property use the above method to find the
7943 version in the base class.
7944 - Remove the InheritableMemberSignatureCompare as it is now
7947 This patch makes large code bases much faster to compile, as it is
7948 O(n) rather than O(n^2) to do this validation.
7950 Also, it fixes bug 52458 which is that nested classes are not
7951 taken into account when finding the base class member.
7953 Reviewed/Approved by Martin.
7955 2004-03-17 Marek Safar <marek.safar@seznam.cz>
7957 * interface.cs: In all interface classes removed redundant
7958 member initialization.
7960 2004-03-16 Martin Baulig <martin@ximian.com>
7962 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
7964 2004-03-15 Miguel de Icaza <miguel@ximian.com>
7966 * decl.cs (DefineTypeAndParents): New helper method to define a
7967 type's containers before the type itself is defined; This is a
7968 bug exposed by the recent changes to Windows.Forms when an
7969 implemented interface was defined inside a class that had not been
7972 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
7974 (Check): Loop correctly to report errors modifiers
7975 (UNSAFE was not in the loop, since it was the same as TOP).
7977 * interface.cs: Every interface member now takes a ModFlags,
7978 instead of a "is_new" bool, which we set on the base MemberCore.
7980 Every place where we called "UnsafeOk" in the interface, now we
7981 call the proper member (InterfaceMethod.UnsafeOK) instead to get
7982 the unsafe settings from the member declaration instead of the
7983 container interface.
7985 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
7987 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
7988 `set_indexer_name' to the pending bits (one per type).
7990 We fixed a bug today that was picking the wrong method to
7991 override, since for properties the existing InterfaceMethod code
7992 basically ignored the method name. Now we make sure that the
7993 method name is one of the valid indexer names.
7995 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
7997 * support.cs (SeekableStreamReader): Keep track of stream byte
7998 positions and don't mix them with character offsets to the buffer.
8000 Patch from Gustavo Giráldez
8002 2004-03-15 Marek Safar <marek.safar@seznam.cz>
8004 * interface.cs (InterfaceSetGetBase): Removed double member
8005 initialization, base class does it as well.
8007 2004-03-13 Martin Baulig <martin@ximian.com>
8009 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
8010 when compiling corlib.
8012 2004-03-13 Miguel de Icaza <miguel@ximian.com>
8014 * convert.cs (ExplicitConversion): We were reporting an error on
8015 certain conversions (object_type source to a value type, when the
8016 expression was `null') before we had a chance to pass it through
8017 the user defined conversions.
8019 * driver.cs: Replace / and \ in resource specifications to dots.
8022 * class.cs: Add check for duplicate operators. Fixes 52477
8024 2004-03-11 Miguel de Icaza <miguel@ximian.com>
8026 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
8027 that are in the middle of the statements, not only at the end.
8030 * class.cs (TypeContainer.AddField): No longer set the
8031 `HaveStaticConstructor' flag, now we call it
8032 `UserDefineStaticConstructor' to diferentiate the slightly
8033 semantic difference.
8035 The situation is that we were not adding BeforeFieldInit (from
8036 Modifiers.TypeAttr) to classes that could have it.
8037 BeforeFieldInit should be set to classes that have no static
8042 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
8044 And most importantly Zoltan's comment:
8046 http://bugzilla.ximian.com/show_bug.cgi?id=44229
8048 "I think beforefieldinit means 'it's ok to initialize the type sometime
8049 before its static fields are used', i.e. initialization does not need
8050 to be triggered by the first access to the type. Setting this flag
8051 helps the JIT to compile better code, since it can run the static
8052 constructor at JIT time, and does not need to generate code to call it
8053 (possibly lots of times) at runtime. Unfortunately, mcs does not set
8054 this flag for lots of classes like String.
8056 csc sets this flag if the type does not have an explicit static
8057 constructor. The reasoning seems to be that if there are only static
8058 initalizers for a type, and no static constructor, then the programmer
8059 does not care when this initialization happens, so beforefieldinit
8062 This bug prevents the AOT compiler from being usable, since it
8063 generates so many calls to mono_runtime_class_init that the AOT code
8064 is much slower than the JITted code. The JITted code is faster,
8065 because it does not generate these calls if the vtable is type is
8066 already initialized, which is true in the majority of cases. But the
8067 AOT compiler can't do this."
8069 2004-03-10 Miguel de Icaza <miguel@ximian.com>
8071 * class.cs (MethodData.Emit): Refactor the code so symbolic
8072 information is generated for destructors; For some reasons we
8073 were taking a code path that did not generate symbolic information
8076 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
8078 * class.cs: Create a Constructor.CheckBase method that
8079 takes care of all validation type code. The method
8080 contains some code that was moved from Define.
8082 It also includes new code that checks for duplicate ctors.
8083 This fixes bug #55148.
8085 2004-03-09 Joshua Tauberer <tauberer@for.net>
8087 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
8088 a { ... }-style array creation invokes EmitStaticInitializers
8089 which is not good for reference-type arrays. String, decimal
8090 and now null constants (NullCast) are not counted toward
8091 static initializers.
8093 2004-03-05 Martin Baulig <martin@ximian.com>
8095 * location.cs (SourceFile.HasLineDirective): New public field;
8096 specifies whether the file contains or is referenced by a "#line"
8098 (Location.DefineSymbolDocuments): Ignore source files which
8099 either contain or are referenced by a "#line" directive.
8101 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
8103 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
8104 direct access to our parent, so check the method inline there.
8106 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
8108 * expression.cs (Invocation.EmitCall): Miguel's last commit
8109 caused a regression. If you had:
8114 In Foo the implict this would be null.
8116 2004-02-27 Miguel de Icaza <miguel@ximian.com>
8118 * expression.cs (Invocation.EmitCall): If the method is not
8119 virtual, do not emit a CallVirt to it, use Call.
8121 * typemanager.cs (GetFullNameSignature): Improve the method to
8122 cope with ".ctor" and replace it with the type name.
8124 * class.cs (ConstructorInitializer.Resolve): Now the method takes
8125 as an argument the ConstructorBuilder where it is being defined,
8126 to catch the recursive constructor invocations.
8128 2004-02-26 Miguel de Icaza <miguel@ximian.com>
8130 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
8131 routines to check if a type is an enumerable/enumerator allow
8132 classes that implement the IEnumerable or IEnumerator interfaces.
8134 * class.cs (Property, Operator): Implement IIteratorContainer, and
8135 implement SetYields.
8137 (Property.Define): Do the block swapping for get_methods in the
8138 context of iterators. We need to check if Properties also
8139 include indexers or not.
8141 (Operator): Assign the Block before invoking the
8142 OperatorMethod.Define, so we can trigger the Iterator code
8145 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
8146 Property and Operator classes are not created when we parse the
8147 declarator but until we have the block completed, so we use a
8148 singleton SimpleIteratorContainer.Simple to flag whether the
8149 SetYields has been invoked.
8151 We propagate this setting then to the Property or the Operator to
8152 allow the `yield' to function.
8154 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8156 * codegen.cs: Implemented attribute support for modules.
8157 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8158 Assembly/Module functionality.
8160 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8161 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8162 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8164 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8166 * interface.cs (FindMembers): The operation is performed on all base
8167 interfaces and not only on the first. It is required for future CLS Compliance patch.
8169 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8171 * statement.cs, codegen.cs:
8172 This patch deals with patterns such as:
8174 public class List : IEnumerable {
8176 public MyEnumerator GetEnumerator () {
8177 return new MyEnumerator(this);
8180 IEnumerator IEnumerable.GetEnumerator () {
8184 public struct MyEnumerator : IEnumerator {
8189 Before, there were a few things we did wrong:
8190 1) we would emit callvirt on a struct, which is illegal
8191 2) we emited ldarg when we needed to emit ldarga
8192 3) we would mistakenly call the interface methods on an enumerator
8193 type that derived from IEnumerator and was in another assembly. For example:
8195 public class MyEnumerator : IEnumerator
8197 Would have the interface methods called, even if there were public impls of the
8198 method. In a struct, this lead to invalid IL code.
8200 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8202 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8205 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8207 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8209 * cs-parser.jay: Fix small regression: we were not testing V2
8210 compiler features correctly.
8212 * interface.cs: If the emit context is null, then create one
8214 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8216 * decl.cs (GetSignatureForError): New virtual method to get full name
8219 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8220 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8222 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8223 Duplicated members and code in these classes has been removed.
8224 Better encapsulation in these classes.
8226 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8228 * assign.cs (Assign.DoResolve): When dealing with compound
8229 assignments, there is a new rule in ECMA C# 2.4 (might have been
8230 there before, but it is documented here) that states that in:
8234 If b is of type int, and the `op' is a shift-operator, then the
8235 above is evaluated as:
8239 * expression.cs (Binary.ResolveOperator): Instead of testing for
8240 int/uint/long/ulong, try to implicitly convert to any of those
8241 types and use that in pointer arithmetic.
8243 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8244 method to print information for from the type, not from the
8245 null-method we were given.
8247 2004-02-01 Duncan Mak <duncan@ximian.com>
8249 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8250 parsing for cmd, fixes bug #53694.
8252 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8254 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8255 in the member name duplication tests. Property and operator name duplication
8256 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8258 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8260 * interface.cs (PopulateMethod): Fixed crash when interface method
8261 returns not existing type (error test cs0246-3.cs).
8263 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8265 * cs-parser.jay (interface_accessors): Re-write actions to also
8266 store attributes attached to get and set methods. Fix spelling
8269 (inteface_property_declaration): Modify accordingly.
8271 (InterfaceAccessorInfo): New helper class to store information to pass
8272 around between rules that use interface_accessors.
8274 * interface.cs (Emit): Apply attributes on the get and set
8275 accessors of properties and indexers too.
8277 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8278 right MethodBuilder when applying attributes to the get and set accessors.
8280 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8282 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8284 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8286 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8288 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8290 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8291 changes that treat `yield' specially when present before `break'
8294 * cs-tokenizer.cs: yield is no longer a keyword.
8296 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8298 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8299 setting for default constructors.
8300 For default constructors are almost every time set wrong Modifier. The
8301 generated IL code has been alright. But inside mcs this values was
8302 wrong and this was reason why several of my CLS Compliance tests
8305 2004-01-22 Martin Baulig <martin@ximian.com>
8307 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8308 not a QualifiedIdentifier. This is what `type_name_expression'
8309 was previously doing.
8310 (type_name_expression): Removed; the code is now in
8311 `namespace_or_type_name'.
8312 (qualified_identifier): Removed, use `namespace_or_type_name'
8314 (QualifiedIdentifier): Removed this class.
8316 2004-01-22 Martin Baulig <martin@ximian.com>
8318 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8319 not a string as alias name.
8321 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8323 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8324 #52730 bug, and instead compute correctly the need to use a
8325 temporary variable when requesting an address based on the
8326 static/instace modified of the field and the constructor.
8328 2004-01-21 Martin Baulig <martin@ximian.com>
8330 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8331 class and namespace before looking up aliases. Fixes #52517.
8333 2004-01-21 Martin Baulig <martin@ximian.com>
8335 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8336 assinged in a 'try'; fixes exception4.cs.
8338 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8339 * class.cs : Implemented parameter-less constructor for TypeContainer
8341 * decl.cs: Attributes are now stored here. New property OptAttributes
8343 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8345 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8347 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8349 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8350 (CSharpSignature): New method for indexer and property signature.
8352 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8354 * pending.cs (IsVirtualFilter): Faster implementation.
8356 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8358 * typemanager.cs: Avoid inclusion of same assembly more than once.
8360 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8362 * cs-parser.jay: Fixed problem where the last assembly attribute
8363 has been applied also to following declaration (class, struct, etc.)
8365 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8367 * class.cs: Added error CS0538, CS0539 reporting.
8368 Fixed crash on Microsoft runtime when field type is void.
8370 * cs-parser.jay: Added error CS0537 reporting.
8372 * pending.cs: Added error CS0535 reporting.
8373 Improved error report for errors CS0536, CS0534.
8375 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8377 Merge a few bits from the Anonymous Method MCS tree.
8379 * statement.cs (ToplevelBlock): New class for toplevel methods,
8380 will hold anonymous methods, lifted variables.
8382 * cs-parser.jay: Create toplevel blocks for delegates and for
8383 regular blocks of code.
8385 2004-01-20 Martin Baulig <martin@ximian.com>
8387 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8388 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8389 and `NeedExplicitReturn'; added `IsLastStatement'.
8390 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8391 have a `ReturnLabel' or we're not unreachable.
8393 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8394 child's reachability; don't just override ours with it. Fixes
8395 #58058 (lluis's example).
8396 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8397 InFinally(), InLoop(), InSwitch() and
8398 BreakCrossesTryCatchBoundary() methods.
8400 * statement.cs (Return): Do all error checking in Resolve().
8401 Unless we are the last statement in a top-level block, always
8402 create a return label and jump to it.
8403 (Break, Continue): Do all error checking in Resolve(); also make
8404 sure we aren't leaving a `finally'.
8405 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8406 statement in a top-level block.
8407 (Block.Flags): Added `IsDestructor'.
8408 (Block.IsDestructor): New public property.
8410 2004-01-20 Martin Baulig <martin@ximian.com>
8412 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8414 2004-01-20 Martin Baulig <martin@ximian.com>
8416 * statement.cs (Statement.ResolveUnreachable): New public method.
8417 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8418 (Block.Resolve): Resolve unreachable statements.
8420 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8422 * expression.cs: We need to fix the case where we do
8423 not have a temp variable here.
8425 * assign.cs: Only expression compound assignments need
8426 temporary variables.
8428 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8430 * flowanalysis.cs: Reduce memory allocation in a few ways:
8431 - A block with no variables should not allocate a bit
8433 - A method with no out parameters does not need any tracking
8434 for assignment of the parameters, so we need not allocate
8437 public readonly Type[] VariableTypes;
8438 public readonly string[] VariableNames;
8439 Are redundant. The data is already stored in the variable
8440 map, so we need not allocate another array for it.
8441 - We need to add alot of checks for if (params | locals) == null
8442 due to the first two changes.
8444 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8446 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8447 implement IMemoryLocation, we store a copy on a local variable and
8448 take the address of it. Patch from Benjamin Jemlich
8450 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8451 to use a special "type_name_expression" rule which reduces the
8452 number of "QualifiedIdentifier" classes created, and instead
8453 directly creates MemberAccess expressions.
8455 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8457 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8458 that fixes #52853. Null literal assignment to ValueType
8460 * class.cs (MethodData.Emit): Instead of checking the name of the
8461 method to determine if its a destructor, create a new derived
8462 class from Method called Destructor, and test for that.
8464 * cs-parser.jay: Create a Destructor object instead of a Method.
8466 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8470 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8472 * expression.cs (Binary.ResolveOperator): Perform an implicit
8473 conversion from MethodGroups to their delegate types on the
8476 * delegate.cs: Introduce a new class DelegateCreation that is the
8477 base class for `NewDelegate' and `ImplicitDelegateCreation',
8478 factor some code in here.
8480 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8481 conversion from MethodGroups to compatible delegate types.
8483 * ecore.cs (Expression.Resolve): Do not flag error 654
8484 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8485 we allow conversions from MethodGroups to delegate types now.
8487 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8488 assignments in v2 either.
8490 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8492 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8493 static read-only fields in ctors.
8495 Applied patch from Benjamin Jemlich
8497 * expression.cs (UnaryMutator): Avoid leaking local variables.
8499 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8501 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8502 here to return true, as they can be used like this:
8506 Fixed 49836 and all the other dups
8508 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8510 * driver.cs: Implement /win32res and /win32icon.
8512 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8514 * cs-parser.jay: Add a rule to improve error handling for the
8515 common mistake of placing modifiers after the type.
8517 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8519 * cs-parser.jay (interface_event_declaration): Catch
8520 initialization of events on interfaces, and report cs0068
8522 * cs-parser.jay (interface_event_declaration): Catch
8523 initialization of events.
8525 * ecore.cs: Better report missing constructors.
8527 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8528 the error reporting done in the wrong place. Fix.
8530 * expression.cs (Binary.ResolveOperator): Catch the
8531 operator + (E x, E y) error earlier, and later allow for implicit
8532 conversions in operator +/- (E e, U x) from U to the underlying
8535 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8536 52596, if the container class is abstract, the default constructor
8537 is protected otherwise its public (before, we were always public).
8539 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8542 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8543 Jemlich that fixes bug #52597, MCS was generating invalid code for
8544 idisposable structs. Thanks to Ben for following up with this
8547 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8549 * driver.cs: Allow assemblies without code to be generated, fixes
8552 2004-01-07 Nick Drochak <ndrochak@gol.com>
8554 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8556 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8558 * cs-parser.jay: Add rules to improve error reporting if fields or
8559 methods are declared at the namespace level (error 116)
8561 * Add rules to catch event add/remove
8563 2004-01-04 David Sheldon <dave-mono@earth.li>
8565 * expression.cs: Added matching ")" to error message for
8568 2004-01-03 Todd Berman <tberman@gentoo.org>
8570 * ecore.cs, attribute.cs:
8571 Applying fix from #52429.
8573 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8575 * ecore.cs, expression.cs, statement.cs:
8576 Total rewrite of how we handle branching. We
8577 now handle complex boolean expressions with fewer
8578 jumps. As well if (x == 0) no longer emits a ceq.
8580 if (x is Foo) is much faster now, because we generate
8583 Overall, we get a pretty big improvement on our benchmark
8584 tests. The code we generate is smaller and more readable.
8586 I did a full two-stage bootstrap. The patch was reviewed
8587 by Martin and Miguel.
8589 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8591 * cs-parser.jay: Make primary_expression not take a QI.
8592 we dont need this because the member_access rule covers
8593 us here. So we replace the rule with just IDENTIFIER.
8595 This has two good effects. First, we remove a s/r conflict.
8596 Second, we allocate many fewer QualifiedIdentifier objects.
8598 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8600 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8601 set the correct information via SRE. This prevents
8602 hanging on the MS runtime. Fixes #29374.
8604 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8606 * convert.cs: correctly handle conversions to value types
8607 from Enum and ValueType as unboxing conversions.
8609 Fixes bug #52569. Patch by Benjamin Jemlich.
8611 2004-01-02 Ravi Pratap <ravi@ximian.com>
8613 * expression.cs (BetterConversion): Prefer int -> uint
8614 over int -> ulong (csc's behaviour). This fixed bug #52046.
8616 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8618 * decl.cs (MemberCache.FindMembers): now returns a
8621 * typemanager.cs: In general, go with with ^^.
8622 (CopyNewMethods): take an IList.
8623 (RealMemberLookup): Only allocate an arraylist
8624 if we copy from two sets of methods.
8626 This change basically does two things:
8627 1) Fewer array lists allocated due to CopyNewMethods.
8628 2) the explicit cast in MemberList costed ALOT.
8630 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8632 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8633 a hashtable to avoid needless string allocations when an identifier is
8634 used more than once (the common case).
8636 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8638 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8639 is broken, it will not return anything. So, we
8640 have to use the information we have in mcs to
8643 * typemanager.cs: Add a cache for GetInterfaces,
8644 since this will now be used more often (due to ^^)
8646 (GetExplicitInterfaces) New method that gets the
8647 declared, not effective, interfaces on a type
8648 builder (eg, if you have interface IFoo, interface
8649 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8652 This patch makes MCS able to bootstrap itself on
8655 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8657 * expression.cs: Remove the Nop's that Miguel put
8660 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8662 * report.cs, codegen.cs: Give the real stack trace to
8663 the error when an exception is thrown.
8665 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8667 * decl.cs: only allocate hashtables for ifaces if
8670 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8672 * expression.cs: fix the error from cs0121-2.cs
8673 (a parent interface has two child interfaces that
8674 have a function with the same name and 0 params
8675 and the function is called through the parent).
8677 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8679 * class.cs, rootcontext.cs, typmanager.cs: do not
8682 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8684 * codegen.cs: remove stack for the ec flow branching.
8685 It is already a linked list, so no need.
8687 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8689 * Makefile: Allow custom profiler here.
8691 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8693 * typemanager.cs (LookupType):
8694 - Use a static char [], because split takes
8695 a param array for args, so it was allocating
8697 - Do not store true in a hashtable, it boxes.
8699 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8701 * flowanalysis.cs: bytify common enums.
8703 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8705 * modifiers.cs: Add a new set of flags for the
8706 flags allowed on explicit interface impls.
8707 * cs-parser.jay: catch the use of modifiers in
8708 interfaces correctly.
8709 * class.cs: catch private void IFoo.Blah ().
8711 All related to bug #50572.
8713 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8715 * decl.cs: Rewrite the consistant accessability checking.
8716 Accessability is not linear, it must be implemented in
8717 a tableish way. Fixes #49704.
8719 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8721 * expression.cs: Handle negation in a checked context.
8722 We must use subtraction from zero. Fixes #38674.
8724 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8726 * class.cs: Ignore static void main in DLLs.
8727 * rootcontext.cs: Handle the target type here,
8728 since we are have to access it from class.cs
8729 * driver.cs: account for the above.
8731 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8733 * report.cs: Give line numbers and files if available.
8735 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8737 * driver.cs: Implement /addmodule.
8739 * typemanager.cs: Change 'modules' field so it now contains Modules not
8742 2003-12-20 Martin Baulig <martin@ximian.com>
8744 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8745 (FieldBase.IsAssigned): Removed this field.
8746 (FieldBase.SetAssigned): New public method.
8747 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8749 2003-12-20 Martin Baulig <martin@ximian.com>
8751 * expression.cs (LocalVariableReference.DoResolve): Don't set
8752 `vi.Used' if we're called from DoResolveLValue().
8754 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8755 returns the usage vector it just merged into the current one -
8756 pass this one to UsageWarning().
8757 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8758 of the `EmitContext', don't call this recursively on our children.
8760 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8762 * driver.cs: Implement /target:module.
8764 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8766 * support.cs (CharArrayHashtable): New helper class.
8768 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8769 char arrays, not strings, so we can avoid creating a string in
8770 consume_identifier if the identifier is a keyword.
8772 2003-12-16 Martin Baulig <martin@ximian.com>
8774 * statement.cs (LocalInfo.Assigned): Removed this property.
8775 (LocalInfo.Flags): Removed `Assigned'.
8776 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8777 and uses flow analysis.
8778 (Block.UsageWarning): Made this method private.
8779 (Block.Resolve): Call UsageWarning() if appropriate.
8781 * expression.cs (LocalVariableReference.DoResolve): Always set
8782 LocalInfo.Used here.
8784 2003-12-13 Martin Baulig <martin@ximian.com>
8786 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8787 any value here; we're now using flow analysis to figure out
8788 whether a statement/block returns a value.
8790 2003-12-13 Martin Baulig <martin@ximian.com>
8792 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8794 (FlowBranching.MergeFinally): Don't call
8795 `branching.CheckOutParameters()' here, this is called in
8797 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8798 when adding the `finally' vector.
8800 2003-12-13 Martin Baulig <martin@ximian.com>
8803 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8804 actually work and also fix #48962.
8806 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8808 * decl.cs: Do not check System.Object for nested types,
8809 since we know it does not have any. Big bang for buck:
8814 corlib: 17.99 seconds
8818 corlib: 17.39 seconds
8820 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8822 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8823 time we are returning 0 members, so we save alot here.
8825 2003-12-11 Martin Baulig <martin@ximian.com>
8827 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8828 `MergeChild()', also just take the `FlowBranching' as argument;
8829 call Merge() on it and return the result.
8830 (FlowBranching.Merge): We don't need to do anything if we just
8833 2003-12-11 Martin Baulig <martin@ximian.com>
8835 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8836 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8837 Maurer for this idea.
8839 2003-12-11 Martin Baulig <martin@ximian.com>
8841 * flowanalysis.cs (MergeResult): This class is now gone; we now
8842 use the `UsageVector' for this. The reason for this is that if a
8843 branching just has one sibling, we don't need to "merge" them at
8844 all - that's the next step to do.
8845 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8848 2003-12-11 Martin Baulig <martin@ximian.com>
8850 Reworked flow analyis and made it more precise and bug-free. The
8851 most important change is that we're now using a special `Reachability'
8852 class instead of having "magic" meanings of `FlowReturns'. I'll
8853 do some more cleanups and optimizations and also add some more
8854 documentation this week.
8856 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8857 largely reworked this class.
8858 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8859 the new `Reachability' class instead of having "magic" values here.
8860 (FlowBranching): We're now using an instance of `Reachability'
8861 instead of having separate `Returns', `Breaks' etc. fields.
8863 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8864 based on flow analysis; ignore the return value of block.Emit ().
8866 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8868 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8869 if they are private.
8871 2003-12-09 Martin Baulig <martin@ximian.com>
8873 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8874 call them directly on the UsageVector.
8876 2003-12-09 Martin Baulig <martin@ximian.com>
8878 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8879 Changed return type from `FlowReturns' to `Reachability'.
8881 2003-12-09 Martin Baulig <martin@ximian.com>
8883 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8884 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8885 `Reachable' fields with a single `Reachability' one.
8887 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8889 * class.cs (FindMembers): Remove foreach's.
8902 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8907 This patch does a few things:
8908 1. EmptyStatement is now a singleton, so it is never reallocated.
8909 2. All blah is EmptyStatement constructs have been changed to
8910 blah == EmptyStatement.Value, which is much faster and valid
8911 now that EmptyStatement is a singleton.
8912 3. When resolving a block, rather than allocating a new array for
8913 the non-empty statements, empty statements are replaced with
8914 EmptyStatement.Value
8915 4. Some recursive functions have been made non-recursive.
8916 Mainly the performance impact is from (3), however (1) and (2) are needed for
8917 this to work. (4) does not make a big difference in normal situations, however
8918 it makes the profile look saner.
8923 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8924 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8925 Total memory allocated: 56397 KB
8928 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8929 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
8930 Total memory allocated: 55666 KB
8932 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8934 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
8935 than the hashtable in a hashtable version
8937 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
8938 we always end up concating a string. This results in a huge perf
8939 loss, because many strings have to be tracked by the GC. In this
8940 patch, we first use a hashtable that works with two keys, so that
8941 the strings do not need to be concat'ed.
8952 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8954 * Makefile: Add a new target `do-time' that does a quick and simple
8955 profile, leaving easy to parse output.
8957 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
8959 * codegen.cs (Init): Create the dynamic assembly with
8960 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
8962 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
8964 * support.cs: Make the PtrHashtable use only one
8965 instance of its comparer.
8967 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
8969 * typemanager.cs: Fix lookup of GetNamespaces.
8971 2003-11-29 Miguel de Icaza <miguel@ximian.com>
8973 * expression.cs: Removed redundant line.
8975 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
8976 ArrayLists, use for loops with bounds.
8978 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
8981 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
8982 arraylists, use for loop with bounds.
8984 The above three changes give us a 0.071 second performance
8985 improvement out of 3.294 seconds down to 3.223. On my machine
8986 the above changes reduced the memory usage by 1,387 KB during
8989 * cs-parser.jay (QualifiedIdentifier): New class used to represent
8990 QualifiedIdentifiers. Before we created a new string through
8991 concatenation, and mostly later on, the result would be
8992 manipulated by DecomposeQI through string manipulation.
8994 This reduced the compiler memory usage for bootstrapping from
8995 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
8996 compile times in 0.05 seconds.
8998 2003-11-28 Dick Porter <dick@ximian.com>
9000 * support.cs: Do string compares with the Invariant culture.
9008 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
9009 the comparison is done with the Invariant culture.
9011 2003-11-27 Miguel de Icaza <miguel@ximian.com>
9013 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
9014 GetEnumerator method.
9016 (ProbeCollectionType): Iterate starting at the most specific type
9017 upwards looking for a GetEnumerator
9019 * expression.cs: Shift count can be up to 31 for int/uint and 63
9022 2003-11-26 Miguel de Icaza <miguel@ximian.com>
9024 * statement.cs (Block.LookupLabel): Also look for the label on the
9025 children blocks. Use a hash table to keep track of visited
9028 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
9029 we actually did transform the other operand, otherwise fall back
9030 to the common codepath that casts to long.
9032 * cs-tokenizer.cs: Use the same code pattern as the int case.
9033 Maybe I should do the parsing myself, and avoid depending on the
9034 Parse routines to get this done.
9036 2003-11-25 Miguel de Icaza <miguel@ximian.com>
9038 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9039 which fixes bug 51347. This time test it.
9041 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
9042 attributes for example can not tell the difference between these.
9043 The difference was only a syntax feature of the language.
9045 * attribute.cs: Apply attributes to delegates.
9047 * delegate.cs: Call the apply attributes method.
9049 2003-11-24 Miguel de Icaza <miguel@ximian.com>
9051 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
9052 comparing 0 vs Byte.MinValue, not the value
9054 (ImplicitConversionRequired): When reporting a conversion error,
9055 use error 31 to print out the constant error instead of the
9058 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9059 which fixes bug 51347.
9061 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9063 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9064 which fixes the -warnaserror command line option.
9066 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9068 * cfold.cs (DoNumericPromotions): During constant folding of
9069 additions on UIntConstant, special case intconstants with
9070 IntConstants like we do on the expression binary operator.
9072 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9074 * convert.cs (ImplicitReferenceConversion): We were missing a case
9075 (System.Enum are not value types or class types, so we need to
9076 classify them separatedly).
9078 * driver.cs: We do not support error 2007.
9080 2003-11-12 Jackson Harper <jackson@ximian.com>
9082 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9083 system directory. Also use the full file name so users can
9084 libraries names mscorlib-o-tron.dll in a non system dir.
9086 2003-11-10 Martin Baulig <martin@ximian.com>
9088 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9089 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9090 calling `ResolveType()' on them, directly assign their `Type'.
9092 2003-11-08 Martin Baulig <martin@ximian.com>
9094 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9095 return value and the `out parent' parameter.
9096 (TypeContainer.DefineType): Moved the CS0644 check into
9097 GetClassBases(). Don't pass the interface types to the
9098 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9099 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9101 * ecore.cs (TypeExpr.IsAttribute): New property.
9102 (TypeExpr.GetInterfaces): New method.
9104 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9105 TypeExpr instead of a Type.
9106 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9107 (Interface.DefineType): Don't pass the interface types to the
9108 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9109 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9111 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9112 instead of a `Type[]'.
9113 (TypeManager.RegisterBuilder): Likewise.
9114 (TypeManager.AddUserInterface): Likewise.
9115 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9116 `Type[]' and also return a `TypeExpr[]'.
9117 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9119 2003-11-08 Martin Baulig <martin@ximian.com>
9121 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9124 2003-11-08 Martin Baulig <martin@ximian.com>
9126 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9127 TypeManager.ResolveExpressionTypes().
9129 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9130 instead of an Expression.
9131 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9132 (TypeExpression): New public class; formerly known as `TypeExpr'.
9134 * expression.cs (ComposedCast): Derive from TypeExpr.
9136 * typemanager.cs (TypeManager.system_*_expr): These are now
9137 TypExpr's instead of Expression's.
9138 (TypeManager.ResolveExpressionTypes): New public static function;
9139 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9142 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9144 * expression.cs (New.DoResolve): Do not dereference value that
9145 might be a null return.
9147 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9148 sure that the constant value has the right type. Fixes an
9149 unreported bug, similar to 50425.
9151 * const.cs (Const.LookupConstantValue): Call
9152 ImplicitStandardConversionExists before doing a conversion to
9153 avoid havng the TypeManager.ChangeType do conversions.
9155 Reduced the number of casts used
9157 (Const.ChangeType): New routine to enable reuse of the constant
9158 type changing code from statement.
9160 * typemanager.cs (ChangeType): Move common initialization to
9161 static global variables.
9165 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9166 every value type to go through, even if it was void. Fix that.
9168 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9169 character of the define, and the is_identifier_part_character for
9170 the rest of the string.
9172 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9174 * expression.cs (UnaryMutator.EmitCode): When I updated
9175 LocalVariableReference.DoResolve, I overdid it, and dropped an
9176 optimization done on local variable references.
9178 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9180 * ecore.cs: Convert the return from Ldlen into an int.
9182 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9184 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9185 the accessibility, this is a special case for toplevel non-public
9186 classes (internal for instance).
9188 2003-10-20 Nick Drochak <ndrochak@gol.com>
9190 * ecore.cs: Fix typo and build. Needed another right paren.
9192 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9194 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9195 `internal' case regular and protected, but not allowing protected
9196 to be evaluated later. Bug 49840
9198 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9200 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9201 to kb.Nlast, and not the kb.nFirst to isolate the switch
9204 Extract the underlying type, so enumerations of long/ulong are
9205 treated like long/ulong.
9207 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9209 * expression.cs (New): Overload the meaning of RequestedType to
9210 track the possible creation of the NewDelegate type, since
9211 DoResolve is invoked more than once for new constructors on field
9214 See bugs: #48800 and #37014
9216 * cs-parser.jay (declare_local_constants): Take an arraylist
9217 instead of a single constant.
9219 (local_constant_declaration): It should take a
9220 constant_declarators, not a constant_declarator. Fixes 49487
9222 * convert.cs: Fix error report.
9224 2003-10-13 Jackson Harper <jackson@ximian.com>
9226 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9229 2003-10-09 Martin Baulig <martin@ximian.com>
9231 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9233 (MethodCore.DoDefineParameters): Removed the TypeContainer
9234 argument; use the DeclSpace which was passed to the .ctor instead.
9235 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9236 TypeContainer; we only need a DeclSpace here.
9238 2003-10-09 Martin Baulig <martin@ximian.com>
9240 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9242 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9243 EmitContext's .ctor.
9245 2003-10-09 Martin Baulig <martin@ximian.com>
9247 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9248 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9249 AsAccessible(), moved them as well.
9251 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9253 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9255 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9257 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9259 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9260 generation for >=, as spotted by Paolo, bug 48679.
9261 Patch from David Waite.
9263 * cs-tokenizer.cs: Add handling for #pragma.
9265 * cs-parser.jay: Allow for both yield and yield return in the
9266 syntax. The anti-cobolization of C# fight will go on!
9268 * class.cs (TypeBuilder.DefineType): Catch error condition here
9269 (Parent.DefineType erroring out and returning null).
9271 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9272 coping with enumerations variables, we were mistakenly processing
9273 them as a regular value type instead of built-in types. Fixes the
9276 * typemanager.cs (IsBuiltinOrEnum): New method.
9278 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9280 * cs-parser.jay: Upgrade: yield now needs the return clause.
9282 2003-09-19 Martin Baulig <martin@ximian.com>
9284 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9285 `MemberCache parent' argument. Normally, an interface doesn't
9286 have a parent type except System.Object, but we use this in gmcs
9287 for generic type parameters.
9289 2003-09-18 Martin Baulig <martin@ximian.com>
9291 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9292 on `type.IsInterface'; don't check whether the type has a parent
9293 to determine whether it's an interface.
9295 2003-09-15 Martin Baulig <martin@ximian.com>
9297 * class.cs (TypeContainer.DefineType): Added an error flag to
9298 avoid reporting duplicate CS0146's ("class definition is
9301 * driver.cs (Driver.MainDriver): Abort if
9302 RootContext.ResolveTree() reported any errors.
9304 2003-09-07 Martin Baulig <martin@ximian.com>
9306 * report.cs (Error, Warning): Added overloaded versions which take
9307 a `params object[] args' and call String.Format().
9309 2003-09-07 Martin Baulig <martin@ximian.com>
9311 * decl.cs (DeclSpace..ctor): Don't call
9312 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9313 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9314 (DeclSpace.RecordDecl): New method.
9316 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9318 2003-09-02 Ravi Pratap <ravi@ximian.com>
9320 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9321 value attributes to be applied to ParameterBuilders.
9323 * class.cs (MethodCore.LabelParameters): Make static and more
9324 generic so that it can be used from other places - like interface
9325 methods, for instance.
9327 * interface.cs (Interface.Emit): Call LabelParameters before
9328 emitting attributes on the InterfaceMethod.
9330 2003-08-26 Martin Baulig <martin@ximian.com>
9332 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9333 resolving aliases; fixes #47927.
9335 2003-08-26 Martin Baulig <martin@ximian.com>
9337 * statement.cs (Using.DoResolve): This is internally emitting a
9338 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9339 do not always return. Fixes #47681.
9341 2003-08-26 Martin Baulig <martin@ximian.com>
9343 * decl.cs (MemberCore): Moved WarningNotHiding(),
9344 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9346 (AdditionResult): Make this nested in DeclSpace.
9347 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9348 argument; call NamespaceEntry.Define() unless we're nested in a
9351 * namespace.cs (Namespace.DefineName): New public function. This
9352 is called from DeclSpace's .ctor to add
9353 (Namespace.Lookup): Include DeclSpaces in the lookup.
9355 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9357 * const.cs (Const): Derive from MemberBase, not MemberCore.
9359 2003-08-25 Martin Baulig <martin@ximian.com>
9361 * convert.cs (Convert.ExplicitReferenceConversion): When
9362 converting from an interface type to a class, unbox if the target
9363 type is a struct type. Fixes #47822.
9365 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9367 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9370 2003-08-22 Martin Baulig <martin@ximian.com>
9372 * class.cs (TypeManager.DefineType): When defining a nested type,
9373 call DefineType() on our parent; fixes #47801.
9375 2003-08-22 Martin Baulig <martin@ximian.com>
9377 * class.cs (MethodData.Define): While checking if a method is an
9378 interface implementation, improve the test a bit more to fix #47654.
9380 2003-08-22 Martin Baulig <martin@ximian.com>
9382 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9383 correctly; fixes #47722.
9385 2003-08-22 Martin Baulig <martin@ximian.com>
9387 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9388 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9390 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9392 2003-08-22 Martin Baulig <martin@ximian.com>
9394 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9395 can only be assigned in static constructors. Fixes #47161.
9397 2003-08-22 Martin Baulig <martin@ximian.com>
9399 Rewrote and improved the flow analysis code.
9401 * flowbranching.cs (FlowBranching): Make this class abstract.
9402 (FlowBranching.CreateBranching): New static function to create a
9404 (FlowBranchingBlock, FlowBranchingException): New classes.
9405 (FlowBranching.UsageVector.Type): New public readonly field.
9406 (FlowBranching.UsageVector.Breaks): Removed the setter.
9407 (FlowBranching.UsageVector.Returns): Removed the setter.
9408 (FlowBranching.UsageVector): Added Break(), Return(),
9409 NeverReachable() and Throw() methods to modify the reachability.
9410 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9411 done by FlowBranching.Merge().
9412 (FlowBranching.UsageVector.MergeChild): New method; merges the
9413 merge result into the current vector.
9414 (FlowBranching.Merge): New abstract method to merge a branching.
9416 2003-08-12 Martin Baulig <martin@ximian.com>
9418 * expression.cs (Indirection.CacheTemporaries): Create the
9419 LocalTemporary with the pointer type, not its element type.
9421 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9423 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9424 token was a keyword or not.
9426 Add `error' options where an IDENTIFIER was expected; Provide
9427 CheckToken and CheckIdentifierToken convenience error reporting
9430 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9432 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9433 NameSpaceEntry NameSpaceEntry.
9435 (LookupInterfaceOrClass): Avoid creating a full qualified name
9436 from namespace and name: avoid doing lookups when we know the
9437 namespace is non-existant. Use new Tree.LookupByNamespace which
9438 looks up DeclSpaces based on their namespace, name pair.
9440 * driver.cs: Provide a new `parser verbose' to display the
9441 exception thrown during parsing. This is turned off by default
9442 now, so the output of a failure from mcs is more graceful.
9444 * namespace.cs: Track all the namespaces defined in a hashtable
9447 (IsNamespace): New method
9449 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9451 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9452 we know that we need to concatenate (full typename can never be
9457 * statement.cs: Use a bitfield; Do not initialize to null things
9458 which are done by the constructor by default.
9460 * cs-parser.jay: bug fix, parameter was 4, not 3.
9462 * expression.cs: Just use the property;
9464 * statement.cs: No need for GetVariableInfo method.
9466 2003-08-08 Martin Baulig <martin@ximian.com>
9468 * flowanalysis.cs (FlowReturns): This is now nested in the
9469 `FlowBranching' class.
9470 (MyBitVector): Moved this here from statement.cs.
9471 (FlowBranching.SiblingType): New enum type.
9472 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9474 2003-08-07 Martin Baulig <martin@ximian.com>
9476 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9477 `FlowBranching' class and called `BranchingType'.
9479 2003-08-07 Martin Baulig <martin@ximian.com>
9481 * flowanalysis.cs: Moved all the control flow analysis code into
9484 2003-08-07 Martin Baulig <martin@ximian.com>
9486 * assign.cs (Assign.DoResolve): `target' must either be an
9487 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9490 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9492 * expression.cs (BinaryMethod): This kind of expression is created by the
9493 Binary class if it determines that the operator has to be handled
9496 (BinaryDelegate): This kind of expression is created if we are
9497 dealing with a + or - operator on delegates.
9499 (Binary): remove method, argumetns, and DelegateOperator: when
9500 dealing with methods,
9502 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9504 * statement.cs (Block): use bitfields for the three extra booleans
9505 we had in use. Remove unused topblock parameter.
9507 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9509 * assign.cs: Drop extra unneeded tests.
9511 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9513 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9515 * statement.cs (Foreach): Use VariableStorage instead of
9518 * codegen.cs (VariableStorage): New class used by clients that
9519 require a variable stored: locals or fields for variables that
9520 need to live across yield.
9522 Maybe provide a convenience api for EmitThis+EmitLoad?
9524 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9527 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9529 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9530 RemapParameterLValue): New methods that are used to turn a
9531 precomputed FieldInfo into an expression like this:
9535 The idea is to use this instead of making LocalVariableReference
9536 have more than one meaning.
9538 * cs-parser.jay: Add error production to BASE.
9540 * ecore.cs: Deal with TypeManager.GetField returning null, which
9541 is now a valid return value.
9543 (FieldExprNoAddress): New expression for Fields whose address can
9546 * expression.cs (LocalVariableReference): During the resolve
9547 phases, create new expressions if we are in a remapping context.
9548 Remove code that dealt with remapping here.
9550 (ParameterReference): same.
9552 (ProxyInstance): New expression, like the `This' expression, but
9553 it is born fully resolved. We know what we are doing, so remove
9554 the errors that are targeted to user-provided uses of `this'.
9556 * statement.cs (Foreach): our variable is now stored as an
9557 Expression; During resolution, follow the protocol, dont just
9558 assume it will return this.
9560 2003-08-06 Martin Baulig <martin@ximian.com>
9562 * support.cs (SeekableStreamReader.cs): New public class.
9564 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9565 SeekableStreamReader instead of the normal StreamReader.
9567 2003-08-04 Martin Baulig <martin@ximian.com>
9569 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9570 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9571 deambiguate casts and delegate invocations.
9572 (parenthesized_expression): Use the new tokens to ensure this is
9573 not a cast of method invocation.
9575 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9576 when reading a `)' and Deambiguate_CloseParens () was previously
9579 * expression.cs (ParenthesizedExpression): New class. This is
9580 just used for the CS0075 test.
9581 (Binary.DoResolve): Check for CS0075.
9583 2003-07-29 Ravi Pratap <ravi@ximian.com>
9585 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9586 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9587 reference comparison.
9589 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9590 examine the ReturnType for equality - this is necessary in the
9591 cases of implicit and explicit operators whose signature also
9592 includes the return type.
9594 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9596 * namespace.cs: Cache the result of the namespace computation,
9597 instead of computing it every time.
9599 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9601 * decl.cs: Use a global arraylist that we reuse over invocations
9602 to avoid excesive memory consumption. Reduces memory usage on an
9603 mcs compile by one meg (45 average).
9605 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9606 private, work around that.
9608 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9610 * literal.cs (IntLiteral): Define Zero and One static literals.
9612 * cs-parser.jay (integer_literal): use static literals to reduce
9613 memory usage for the most used literals (0, 1 and -1). 211kb
9614 reduced in memory usage.
9616 Replace all calls to `new ArrayList' with `new
9617 ArrayList(4)' which is a good average number for most allocations,
9618 and also requires only 16 bytes of memory for its buffer by
9621 This reduced MCS memory usage in seven megabytes for the RSS after
9624 2003-07-28 Ravi Pratap <ravi@ximian.com>
9626 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9627 handle params methods the correct way by forming only one
9628 applicable set with params and normal methods in them. Earlier we
9629 were looking at params methods only if we found no normal methods
9630 which was not the correct thing to do.
9632 (Invocation.BetterFunction): Take separate arguments indicating
9633 when candidate and the best method are params methods in their
9636 This fixes bugs #43367 and #46199.
9638 * attribute.cs: Documentation updates.
9640 (CheckAttribute): Rename to CheckAttributeTarget.
9641 (GetValidPlaces): Rename to GetValidTargets.
9643 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9644 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9648 2003-07-28 Martin Baulig <martin@ximian.com>
9650 * class.cs (TypeContainer.DefineMembers): Use the base type's full
9651 name when looking up the base class of a nested class. Fixes #46977.
9653 2003-07-26 Martin Baulig <martin@ximian.com>
9655 * expression.cs (Indexers.Indexer): New nested struct; contains
9656 getter, setter and the indexer's type.
9657 (Indexers.Properties): This is now an ArrayList of
9659 (IndexerAccess.DoResolveLValue): Correctly set the type if the
9660 indexer doesn't have any getters.
9662 * assign.cs (Assign.DoResolve): Also do the implicit conversions
9663 for embedded property and indexer assignments.
9665 2003-07-26 Martin Baulig <martin@ximian.com>
9667 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9668 preprocessor directive is not the first non-whitespace character
9671 2003-07-26 Martin Baulig <martin@ximian.com>
9673 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9674 namespace parsing, follow the spec more closely.
9676 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9677 NamespaceEntry.Lookup().
9679 2003-07-25 Martin Baulig <martin@ximian.com>
9681 * MethodCore.cs (OverridesSomething): New public field; it's set
9682 from TypeContainer.DefineMembers if this method overrides
9683 something (which doesn't need to be a method). Fix #39462.
9685 2003-07-25 Ravi Pratap <ravi@ximian.com>
9687 * typemanager.cs (GetMembers): Ensure that the list of members is
9688 reversed. This keeps things in sync.
9690 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9691 find an AttributeUsage attribute.
9693 * expression.cs (Invocation.OverloadResolve): Perform the check
9694 which disallows Invoke to be directly called on a Delegate.
9696 (Error_InvokeOnDelegate): Report error cs1533.
9698 2003-07-25 Martin Baulig <martin@ximian.com>
9700 * expression.cs (Indexers.GetIndexersForType): Only look in the
9701 interface hierarchy if the requested type is already an
9702 interface. Fixes #46788 while keeping #46502 fixed.
9704 2003-07-25 Martin Baulig <martin@ximian.com>
9706 * class.cs (TypeContainer.DefineMembers): Check whether all
9707 readonly fields have been assigned and report warning CS0649 if
9710 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9713 2003-07-24 Ravi Pratap <ravi@ximian.com>
9715 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9716 returned from GetMethods to make things consistent with the
9717 assumptions MCS makes about ordering of methods.
9719 This should comprehensively fix bug #45127 and it does :-)
9721 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9722 ordering is actually reverse.
9724 * Clean up some debug messages I left lying around.
9726 * interface.cs (Populate*): Get rid of code which emits attributes
9727 since the stage in which we emit attributes is the 'Emit' stage,
9728 not the define stage.
9730 (Emit): Move attribute emission for interface members here.
9732 2003-07-22 Ravi Pratap <ravi@ximian.com>
9734 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9735 closely: we eliminate methods in base types when we have an
9736 applicable method in a top-level type.
9738 Please see section 14.5.5.1 for an exact description of what goes
9741 This fixes bug #45127 and a host of other related to corlib compilation.
9743 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9744 array is the method corresponding to the top-level type (this is
9745 because of the changes made to icall.c) so we change this
9748 (MethodGroupExpr.Name): This too.
9750 * typemanager.cs (GetElementType): New method which does the right
9751 thing when compiling corlib.
9753 * everywhere: Make use of the above in the relevant places.
9755 2003-07-22 Martin Baulig <martin@ximian.com>
9757 * cs-parser.jay (invocation_expression): Moved
9758 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9759 `cast_expression', but create a InvocationOrCast which later
9760 resolves to either an Invocation or a Cast.
9762 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9763 method; call this before EmitStatement() to make sure that this
9764 expression can be used as a statement.
9766 * expression.cs (InvocationOrCast): New class; resolves to either
9767 an Invocation or a Cast.
9769 * statement.cs (StatementExpression): Call ResolveStatement() on
9770 the ExpressionStatement before emitting it.
9772 2003-07-21 Martin Baulig <martin@ximian.com>
9774 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9775 `ref' and `out' attributes match; fixes #46220.
9776 (MemberAccess.ResolveMemberAccess): You can't reference a type
9777 through an expression; fixes #33180.
9778 (Indexers.GetIndexersForType): Don't return the indexers from
9779 interfaces the class implements; fixes #46502.
9781 2003-07-21 Martin Baulig <martin@ximian.com>
9783 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9784 CS0661 checks; fixes bug #30442.
9786 2003-07-21 Martin Baulig <martin@ximian.com>
9788 * decl.cs (AdditionResult): Added `Error'.
9790 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9792 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9793 makes cs0031.cs actually work.
9795 2003-07-20 Martin Baulig <martin@ximian.com>
9797 * namespace.cs: Fixed that bug which caused a crash when compiling
9800 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9802 * typemanager.cs (LookupTypeReflection): Never expose types which
9803 are NotPublic, NestedPrivate, NestedAssembly, or
9804 NestedFamANDAssem. We used to return these, and later do a check
9805 that would report a meaningful error, but the problem is that we
9806 would not get the real match, if there was a name override.
9808 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9810 * namespace.cs (Namespace, Name): Do not compute the namespace
9811 name dynamically, compute it in the constructor. This reduced
9812 memory usage by 1697 KB.
9814 * driver.cs: Use --pause to pause at the end.
9816 2003-07-17 Peter Williams <peter@newton.cx>
9818 * Makefile: Change the name of the test target so that it doesn't
9819 conflict with the recursive test target.
9821 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9823 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9824 AddressOf): Do not use EmitThis, that was wrong, use the actual
9827 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9829 * class.cs (MethodData.Define): While checking if a method is an
9830 interface implementation, improve the test: If we are not public
9831 (use new test here: use the computed MethodAttributes directly,
9832 instead of the parsed modifier flags) check if the `implementing'
9833 method comes from an interface or not.
9835 * pending.cs (VerifyPendingMethods): Slightly better error
9838 * makefile: add test target that does the mcs bootstrap.
9840 2003-07-16 Ravi Pratap <ravi@ximian.com>
9842 * interface.cs (Define): Do nothing here since there are no
9843 members to populate etc. Move the attribute emission out of here
9844 since this was just totally the wrong place to put it. Attribute
9845 application happens during the 'Emit' phase, not in the 'Define'
9848 (Emit): Add this method and move the attribute emission here
9850 * rootcontext.cs (EmitCode): Call the Emit method on interface
9853 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9855 * expression.cs (OverloadResolve): Report error only if Location
9856 is not 'Null' which means that there was a probe going on.
9858 2003-07-14 Martin Baulig <martin@ximian.com>
9860 * expression.cs (ConditionalLogicalOperator): New public class to
9861 implement user defined conditional logical operators.
9862 This is section 14.11.2 in the spec and bug #40505.
9864 2003-07-14 Martin Baulig <martin@ximian.com>
9866 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9868 2003-07-14 Martin Baulig <martin@ximian.com>
9870 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9872 * ecore.cs (IVariable.VerifyFixed): New interface method.
9874 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9875 operator, check whether the variable is actually fixed. Fixes bug
9876 #36055. Set a variable definitely assigned when taking its
9877 address as required by the spec.
9879 * statement.cs (LocalInfo.IsFixed): New field.
9880 (LocalInfo.MakePinned): Set `IsFixed' to true.
9882 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9884 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9885 for .ctors, ensure that we only ask for members declared in the
9886 attribute type (BindingFlags.DeclaredOnly).
9890 * expression.cs (Error_WrongNumArguments): Report error 1501
9891 correctly the way CSC does.
9893 2003-07-13 Martin Baulig <martin@ximian.com>
9895 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9896 lookup on the fully qualified name, to make things like "X.X" work
9897 where "X.X" is a fully qualified type name, but we also have a
9898 namespace "X" in the using list. Fixes #41975.
9900 2003-07-13 Martin Baulig <martin@ximian.com>
9902 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9903 function. If we're a CompoundAssign, we need to create an embedded
9904 CompoundAssign, not an embedded Assign.
9905 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9908 2003-07-13 Martin Baulig <martin@ximian.com>
9910 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9911 work to fix bug #46088.
9913 2003-07-13 Ravi Pratap <ravi@ximian.com>
9915 * class.cs (Operator.Emit): Do not emit attributes here - it is
9916 taken care of by the Method class that we delegate too. This takes
9919 2003-07-10 Martin Baulig <martin@ximian.com>
9921 * expression.cs (TypeOfVoid): New class.
9922 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9924 2003-07-10 Martin Baulig <martin@ximian.com>
9926 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9929 2003-07-10 Martin Baulig <martin@ximian.com>
9931 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
9932 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
9934 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
9936 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
9938 2003-07-10 Martin Baulig <martin@ximian.com>
9940 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
9941 of decimal. Fixes #42850.
9943 NOTE: I also fixed the created byte blob, but this doesn't work on
9944 the MS runtime and csc never produces any byte blobs for decimal
9947 2003-07-10 Martin Baulig <martin@ximian.com>
9949 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
9950 structs; fixes #32068.
9951 (Block.AddChildVariableNames): Fixed #44302.
9953 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9955 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
9957 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9959 * attribute.cs: And this test is onger needed.
9961 2003-07-08 Martin Baulig <martin@ximian.com>
9963 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
9964 inaccessible types. Fixes #36313.
9966 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
9968 * namespace.cs (NamespaceEntry): Create implicit entries for all
9969 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
9970 implicit entries for N1.N2 and N1.
9972 2003-07-08 Martin Baulig <martin@ximian.com>
9974 Rewrote the handling of namespaces to fix a lot of the issues
9975 wrt. `using' aliases etc.
9977 * namespace.cs (Namespace): Splitted this class into a
9978 per-assembly `Namespace' and a per-file `NamespaceEntry'.
9980 * typemanager.cs (TypeManager.IsNamespace): Removed.
9981 (TypeManager.ComputeNamespaces): Only compute namespaces from
9982 loaded assemblies here, not the namespaces from the assembly we're
9983 currently compiling.
9985 2003-07-08 Martin Baulig <martin@ximian.com>
9987 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
9989 2003-07-07 Miguel de Icaza <miguel@ximian.com>
9991 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
9994 I thought about the memory savings here, but LookupTypeReflection
9995 is used under already very constrained scenarios. Compiling
9996 corlib or mcs only exposes one hit, so it would not really reduce
9997 any memory consumption.
9999 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10001 * typemanager.cs: fixes bug #45889 by only adding public types from
10002 other assemblies to the list of known types.
10004 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10006 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10007 on the type we resolved.
10009 2003-07-05 Martin Baulig <martin@ximian.com>
10011 * pending.cs (PendingImplementation.ParentImplements): Don't
10012 create the proxy if the parent is abstract.
10014 * class.cs (TypeContainer.DefineIndexers): Process explicit
10015 interface implementations first. Fixes #37714.
10017 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10019 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10020 defined recursively; but since we modify the input parameters
10021 (left is set to `this' temporarily), we reset this value if the
10022 left_is_explicit is false, which gives the original semantics to
10025 * literal.cs (NullPointer): new class used to represent a null
10026 literal in a pointer context.
10028 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10029 type is a pointer, use a NullPointer object instead of a
10030 NullLiteral. Closes 43687
10032 (ExplicitConversion): Convert pointer values using
10033 the conv opcode to the proper type.
10035 * ecore.cs (New): change ValueTypeVariable property into a method,
10036 that returns whether the valuetype is suitable for being used.
10038 * expression.cs (Binary.DoNumericPromotions): Only return if we
10039 the int constant was a valid uint, and we can return both left and
10040 right as uints. If not, we continue processing, to trigger the
10041 type conversion. This fixes 39018.
10043 * statement.cs (Block.EmitMeta): During constant resolution, set
10044 the CurrentBlock property on the emitcontext, so that we resolve
10045 constants propertly.
10047 2003-07-02 Martin Baulig <martin@ximian.com>
10049 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10050 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10052 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10053 than emitting it here.
10055 * statement.cs: Fixed some more flow analysis bugs.
10057 2003-07-02 Martin Baulig <martin@ximian.com>
10059 * class.cs (MethodData.Define): When implementing interface
10060 methods, set Final unless we're Virtual.
10062 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10063 check work for interface methods.
10065 2003-07-01 Martin Baulig <martin@ximian.com>
10067 * ecore.cs (EmitContext.This): Replaced this property with a
10068 GetThis() method which takes a Location argument. This ensures
10069 that we get the correct error location for a CS0188.
10071 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10073 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10074 ImplicitStandardConversion.
10076 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10078 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10080 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10083 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10085 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10088 (MethodData.Define): Turn off initlocals for unsafe methods.
10090 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10092 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10093 complete; Fixes #37521.
10095 * delegate.cs: Use Modifiers.TypeAttr to compute the
10096 TypeAttributes, instead of rolling our own. This makes the flags
10097 correct for the delegates.
10099 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10101 * class.cs (Constructor.Define): Set the private flag for static
10102 constructors as well.
10104 * cs-parser.jay (statement_expression): Set the return value to
10105 null, to avoid a crash when we catch an error.
10107 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10109 * cs-parser.jay: Applied patch from Jackson that adds support for
10110 extern and unsafe modifiers to destructor declarations.
10112 * expression.cs: Report error 21 if the user is trying to index a
10115 * driver.cs: Add an error message, suggested by the bug report.
10117 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10118 if we do not have a ": this ()" constructor initializer. Fixes 45149
10120 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10122 * namespace.cs: Add some information to reduce FAQs.
10124 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10126 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10127 underlying enumeration types. Fixes #43915.
10129 * expression.cs: Treat ushort/short as legal values to be used in
10130 bitwise operations.
10132 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10134 * delegate.cs: transfer custom attributes for paramenters from
10135 the delegate declaration to Invoke and BeginInvoke.
10137 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10139 * attribute.cs: handle custom marshalers and emit marshal info
10142 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10144 * makefile.gnu: Added anonymous.cs to the compiler sources.
10146 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10148 * iterators.cs: Change the name of the proxy class to include two
10151 * cs-parser.jay: Update grammar to include anonymous methods.
10153 * anonymous.cs: new file.
10155 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10157 * class.cs (Field.Define): Add missing test for pointers and
10160 2003-05-27 Ravi Pratap <ravi@ximian.com>
10162 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10163 we use the stobj opcode.
10165 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10166 since it wasn't the correct fix.
10168 It still is puzzling that we are required to use stobj for IntPtr
10169 which seems to be a ValueType.
10171 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10173 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10174 during regular simple name resolution. Now, the trick is that
10175 instead of returning for processing the simplename, we do a
10176 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10177 contextual lookup type). If a match is found, return that, if
10178 not, return for further composition.
10180 This fixes long-standing 30485.
10182 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10183 using the address to initialize an object, do an Stobj instead of
10184 using the regular Stelem.
10186 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10187 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10188 Because if we are a BaseIndexerAccess that value will be true.
10191 * statement.cs (GotoCase.Resolve): Return after reporting an
10192 error, do not attempt to continue.
10194 * expression.cs (PointerArithmetic.Emit): If our operand is a
10195 long, convert our constants to match the operand before
10196 multiplying. Convert to I type before adding. Fixes 43670.
10198 2003-05-14 Ravi Pratap <ravi@ximian.com>
10200 * enum.cs (ImplicitConversionExists) : Rename to
10201 ImplicitEnumConversionExists to remove ambiguity.
10203 * ecore.cs (NullCast): New type of cast expression class which
10204 basically is very similar to EmptyCast with the difference being
10205 it still is a constant since it is used only to cast a null to
10207 (eg. (string) null)
10209 * convert.cs (ImplicitReferenceConversion): When casting a null
10210 literal, we return a NullCast.
10212 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10213 should be around anymore.
10215 The renaming (reported was slightly wrong). Corrections:
10217 ConvertImplicitStandard -> ImplicitConversionStandard
10218 ConvertExplicitStandard -> ExplicitConversionStandard
10220 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10221 before passing them in !
10223 * convert.cs (ImplicitConversionStandard): When comparing for
10224 equal expr and target types, ensure that expr is not a
10227 In general, we must not be checking (expr_type ==
10228 target_type) in the top level conversion methods
10229 (ImplicitConversion, ExplicitConversion etc). This checking is
10230 done in the methods that they delegate to.
10232 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10234 * convert.cs: Move Error_CannotConvertType,
10235 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10236 ImplicitNumericConversion, ImplicitConversionExists,
10237 ImplicitUserConversionExists, StandardConversionExists,
10238 FindMostEncompassedType, FindMostSpecificSource,
10239 FindMostSpecificTarget, ImplicitUserConversion,
10240 ExplicitUserConversion, GetConversionOperators,
10241 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10242 TryImplicitIntConversion, Error_CannotConvertImplicit,
10243 ConvertImplicitRequired, ConvertNumericExplicit,
10244 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10245 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10248 Perform the following renames:
10250 StandardConversionExists -> ImplicitStandardConversionExists
10251 ConvertImplicit -> ImplicitConversion
10252 ConvertImplicitStandard -> ImplicitStandardConversion
10253 TryImplicitIntConversion -> ImplicitIntConversion
10254 ConvertImplicitRequired -> ImplicitConversionRequired
10255 ConvertNumericExplicit -> ExplicitNumericConversion
10256 ConvertReferenceExplicit -> ExplicitReferenceConversion
10257 ConvertExplicit -> ExplicitConversion
10258 ConvertExplicitStandard -> ExplicitStandardConversion
10260 2003-05-19 Martin Baulig <martin@ximian.com>
10262 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10263 (TypeInfo): Added support for structs having structs as fields.
10265 * ecore.cs (FieldExpr): Implement IVariable.
10266 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10267 VariableInfo for the field.
10269 2003-05-18 Martin Baulig <martin@ximian.com>
10271 * expression.cs (This.DoResolve): Report a CS0027 if we're
10272 emitting a field initializer.
10274 2003-05-18 Martin Baulig <martin@ximian.com>
10276 * expression.cs (This.ResolveBase): New public function.
10277 (This.DoResolve): Check for CS0188.
10279 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10282 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10283 `instance_expression' to null if we don't have any non-static
10286 2003-05-18 Martin Baulig <martin@ximian.com>
10288 Reworked the way how local variables and parameters are handled by
10289 the flow analysis code.
10291 * statement.cs (TypeInfo, VariableMap): New public classes.
10292 (VariableInfo): New public class. This is now responsible for
10293 checking whether a variable has been assigned. It is used for
10294 parameters and local variables.
10295 (Block.EmitMeta): Take the InternalParameters as argument; compute
10296 the layout of the flow vectors here.
10297 (Block.LocalMap, Block.ParameterMap): New public properties.
10298 (FlowBranching): The .ctor doesn't get the InternalParameters
10299 anymore since Block.EmitMeta() now computes the layout of the flow
10301 (MyStructInfo): This class is now known as `StructInfo' and nested
10302 in `TypeInfo'; we don't access this directly anymore.
10304 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10305 property and removed IsAssigned(), IsFieldAssigned(),
10306 SetAssigned() and SetFieldAssigned(); we now call them on the
10307 VariableInfo so we don't need to duplicate this code everywhere.
10309 * expression.cs (ParameterReference): Added `Block block' argument
10311 (LocalVariableReference, ParameterReference, This): The new
10312 VariableInfo class is now responsible for all the definite
10315 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10316 IsParameterAssigned, SetParameterAssigned): Removed.
10318 2003-05-18 Martin Baulig <martin@ximian.com>
10320 * typemanager.cs (InitCoreTypes): Try calling
10321 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10322 the 3-args-version. Corlib now also needs our `void_type'.
10323 (GetMethod): Added overloaded version which takes an optional
10324 `bool report_errors' to allow lookups of optional methods.
10326 2003-05-12 Martin Baulig <martin@ximian.com>
10328 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10329 only used for locals and not for parameters.
10331 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10333 * support.cs (InternalParameters.ParameterType): Return the
10334 ExternalType of the parameter.
10336 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10339 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10341 * class.cs (MethodData.Define): Do not set the `newslot' on
10342 interface members, if they are also flagged as "override".
10344 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10345 better code for ++i and i++. This only works for static fields
10346 and local variables.
10348 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10349 want to pull the DeclSpace out of the builder_to_declspace instead
10350 of the TypeBuilder (like in TypeContainer.FindMembers).
10352 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10353 instead of LookupTypeContainer. Fixes the crash on .NET for
10354 looking up interface members.
10356 * const.cs: Create our own emit context during the Definition
10357 stage, so that constants are evaluated in the proper context, when
10358 a recursive definition happens.
10360 2003-05-11 Martin Baulig <martin@ximian.com>
10362 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10363 new block for a switch section.
10364 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10365 the adding/lookup in the switch block. Fixes #39828.
10367 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10369 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10370 functionality: I needed to convert the data after I had performed
10371 the add/sub operation into the operands type size.
10373 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10374 pass the type for the box operation, otherwise the resulting
10375 object would have been of type object.
10377 (BoxedCast): Add constructor to specify the type to box as.
10379 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10381 * iterators.cs: I was reusing the `count' variable inadvertently,
10382 take steps to not allow this to happen.
10384 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10386 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10387 by creating an array at the point where the params starts and
10388 putting all those arguments there, then adjusting the size of the
10391 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10393 * expression.cs (New.AddressOf): Implement interface
10394 IMemoryLocation. This is used when the `new' operator is used in
10395 the context of an invocation to a method on a value type.
10397 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10400 * namespace.cs: Also check the using aliases here.
10402 * driver.cs: Move the test for using validity after the types have
10403 been entered, so we do a single pass that also includes the using
10406 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10407 in the regular case. CreateSiblingForFinally is doing extra
10410 * attribute.cs (GetAttributeArgumentExpression): Store the result
10411 on an out value, and use the return value to indicate failure
10412 instead of using null (which is a valid return for Constant.GetValue).
10414 * statement.cs: Perform the analysis flow for the increment
10415 portion after the statement, because this will be the real flow of
10416 execution. Fixes #42385
10418 * codegen.cs (EmitContext.EmitArgument,
10419 EmitContext.EmitStoreArgument): New helper functions when the
10420 RemapToProxy flag is set.
10422 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10425 Add support for remapping parameters.
10427 * iterators.cs: Propagate parameter values; Store parameter
10428 values in the proxy classes.
10430 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10432 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10433 need a proxy reference; I do not know what I was thinking
10435 * cs-parser.jay (constructor_initializer): catch another error,
10436 and display nice message.
10438 (field_declaration): catch void field declaration
10439 to flag a better error.
10441 * class.cs (MemberBase.CheckBase): Report an error instead of a
10442 warning if a new protected member is declared in a struct.
10443 (Field.Define): catch the error of readonly/volatile.
10445 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10447 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10448 volatile variable is taken
10450 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10452 * statement.cs (Fixed.Resolve): Report an error if we are not in
10455 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10457 * typemanager.cs: reuse the code that handles type clashes for
10458 delegates and enumerations.
10460 * class.cs (Report28): Always report.
10462 * expression.cs (EncodeAsAttribute): Allow nulls here.
10464 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10466 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10467 the functionality for testing whether an expression is valid for
10468 an attribute here. Also handle the case of arrays of elements
10471 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10472 encoding a linear array into an array of objects that are suitable
10473 to be passed to an CustomAttributeBuilder.
10475 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10477 * ecore.cs: (FieldExpr): Handle field remapping here.
10479 * iteratators.cs: Pass the instance variable (if the method is an
10480 instance method) to the constructors, so we can access the field
10481 variables on the class.
10483 TODO: Test this with structs. I think the THIS variable on
10484 structs might have to be a pointer, and not a refenrece
10486 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10488 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10489 local variables to fields in a proxy class.
10491 * iterators.cs (PopulateProxy): Rename our internal fields to
10493 Create a <THIS> field if we are an instance method, so we can
10494 reference our parent container variables.
10495 (MapVariable): Called back from the EmitContext code to enter a
10496 new variable to field mapping into the proxy class (we just create
10500 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10501 for using the remapped locals to fields.
10503 I placed the code here, because that gives the same semantics to
10504 local variables, and only changes the Emit code.
10506 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10507 statements inside iterators.
10508 (VariableInfo): Add a FieldBuilder for the cases when we are
10509 remapping local variables to fields in a proxy class
10511 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10512 current_block != null.
10514 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10515 not cope with strings, as it has been moved to the
10516 TableSwitchEmit. Fixed bug in switch generation.
10518 * expression.cs (New.DoResolve): Provide more context for the user
10519 when reporting an error.
10521 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10524 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10525 check the permissions for it. Note than in a type-resolution
10526 context the check was already present in DeclSpace.ResolveType,
10527 but was missing from the MemberAccess.
10529 (ArrayCreation.CheckIndices): warn if the user has
10530 more nested levels of expressions, but there are no more
10531 dimensions specified. Avoids crash on bug 41906.
10533 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10535 * statement.cs (Block): replace Implicit bool, for a generic
10537 New flag: `Unchecked'. This is used during the EmitMeta phase
10538 (which is out-of-line with the regular Resolve/Emit process for a
10539 statement, as this is done ahead of time, but still gets a chance
10540 to call constant resolve).
10542 (Block.Flags): new enum for adding a new flag.
10544 (Block.EmitMeta): track the state of unchecked.
10546 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10547 to enable constant resolution to work there as well.
10549 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10551 * typemanager.cs (ienumerable_type): Also look up
10552 System.Collections.IEnumerable.
10554 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10556 TODO: Test more than one conditional per method.
10558 * class.cs (Indexer.Define): Report the location where the user is
10559 referencing the unsupported feature.
10561 (MethodData): Overload the use of `conditionals' to
10562 minimize the creation of needless ArrayLists. This saves roughly
10563 212kb on my machine.
10565 (Method): Implement the new IIteratorContainer interface.
10566 (Method.SetYields): Implement the method by setting the ModFlags
10567 to contain METHOD_YIELDS.
10569 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10570 which just got set to null.
10572 * iterators.cs: New file.
10574 (Yield, YieldBreak): New statements.
10576 * statement.cs (Return.Resolve): Flag an error if we are used in
10577 an iterator method.
10579 * codegen.cs (InIterator): New flag set if the code is being
10580 compiled in an iterator method.
10582 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10583 internal modifier, and we just use it to avoid adding extra
10584 fields, as this is seldom used.
10586 * cs-parser.jay: Add yield_statement (yield and yield break).
10588 * driver.cs: New flag -v2 to turn on version 2 features.
10590 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10591 hashtable when v2 is enabled.
10593 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10595 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10596 there is already a namespace defined with this name.
10598 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10599 people upgraded their corlibs.
10601 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10602 always use fully qualified types, no need to use the compiler
10605 (TypeManager.IsNamespace): Use binarysearch.
10607 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10608 AddDelegate): I did not quite use the new IsValid API properly: I
10609 have to pass the short-name and the fullname. I was passing only
10610 the basename instead of the fullname sometimes.
10612 (TypeContainer.DefineType): call NamespaceClash.
10614 * interface.cs (Interface.DefineType): use NamespaceClash before
10617 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10620 * enum.cs: (Enum.DefineType): use NamespaceClash before
10623 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10624 speed increase. First, use the negative_hits cache when we get a
10625 negative. Second, add the type with its full original name
10626 instead of the new . and + encoded name (reflection uses + to
10627 separate type from a nested type). Use LookupTypeReflection
10628 directly which bypasses the type->name hashtable (that we already
10629 know does not contain the type.
10631 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10632 location/container type.
10634 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10636 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10638 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10640 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10641 method is being referenced in the method group from a static
10642 context, and report error 120 if so.
10644 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10647 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10648 is created, we create the A namespace).
10650 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10653 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10655 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10656 invocation to ModuleBuilder.GetType with the same values will
10657 return a new type instance, so we need to cache its return
10660 * expression.cs (Binary.ResolveOperator): Only allow the compare
10661 operators on enums if they are of the same type.
10663 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10664 types of ValueType on their own case. Before we were giving them
10665 the same treatment as objects.
10667 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10668 fullname. Short name is used to compare against container name.
10669 Fullname is used to check against defined namespace names.
10671 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10672 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10674 (Method.CheckBase): Call parent.
10675 (MemberBase.CheckBase): Check for protected members on sealed
10677 (PropertyBase.CheckBase): Call parent.
10678 (Field.Define): Call parent.
10680 * report.cs: Negative error codes are now mapped to 8000 - code,
10681 so that the display is render more nicely.
10683 * typemanager.cs: Do not use try/catch, instead report a regular
10686 (GetPointerType, GetReferenceType): These methods provide
10687 mechanisms to obtain the T* and T& from a T. We had the code
10688 previously scattered around the code base, and it also used
10689 TypeManager.LookupType that would go through plenty of caches.
10690 This one goes directly to the type source.
10692 In some places we did the Type.GetType followed by
10693 ModuleBuilder.GetType, but not in others, so this unifies the
10694 processing as well.
10696 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10697 statements now that we have namespace information.
10699 * typemanager.cs (IsNamespace): New method, returns whether the
10700 string presented is a namespace or not.
10702 (ComputeNamespaces): New public entry point, computes the list of
10703 available namespaces, using the GetNamespaces API call in Mono, or
10704 the slower version in MS.NET.
10706 Now before we start the semantic analysis phase, we have a
10707 complete list of namespaces including everything that the user has
10710 Deleted old code to cache namespaces in .nsc files.
10712 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10714 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10715 class/struct location definition Location for the implicit
10716 constructor location.
10718 (Operator.Define): Use the location of the operator for the
10719 implicit Method definition.
10721 (Constructor.Emit): use the constructor location for the implicit
10722 base initializer constructor.
10724 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10725 and the Expression class now contains two new methods:
10727 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10728 isolate type lookup from the rest of the resolution process.
10730 Since we use Expressions to hold type definitions due to the way
10731 we parse the input we have historically overloaded Resolve to
10732 perform the Type lookups if a special flag is passed. Now this is
10733 eliminated and two methods take their place.
10735 The differences in the two methods between xStep and xTerminal is
10736 that xStep is involved in our current lookup system that uses
10737 SimpleNames to compose a name, while xTerminal is used just to
10738 catch the case where the simplename lookup failed.
10740 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10742 * expression.cs (ResolveMemberAccess): Remove redundant code.
10743 TypeExpr expressions are always born fully resolved.
10745 * interface.cs (PopulateMethod): Do not lookup the types twice.
10746 We were doing it once during SemanticAnalysis and once during
10749 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10750 in local variable type definitions, were being returned as a
10751 SimpleName (we decomposed everything into a string), that is
10752 because primary_expression was being used instead of a type in the
10753 grammar (reduce/reduce conflicts).
10755 The part that was wrong is that we converted the expression into a
10756 string (an oversimplification in one hand, compounded with primary
10757 expressions doing string concatenation).
10763 Would return "A.B.C[]" as a SimpleName. This stopped things like
10764 using clauses from working on this particular context. And a type
10765 was being matched directly against "A.B.C[]".
10767 We now use the correct approach, and allow for ComposedCast to be
10768 part of the unary expression. So the "A.B.C []" become a composed
10769 cast of "A.B.C" (as a nested group of MemberAccess with a
10770 SimpleName at the end) plus the rank composition "[]".
10774 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10776 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10777 for the access level checking.
10779 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10780 `TypeContainer container', because I kept getting confused when I
10781 was debugging this code.
10783 * expression.cs (Indexers): Instead of tracking getters/setters,
10784 we now track them in parallel. We create one arraylist less, but
10785 most importantly it is possible now for the LValue code to find a
10786 matching get for a set.
10788 (IndexerAccess.DoResolveLValue): Update the code.
10789 GetIndexersForType has been modified already to extract all the
10790 indexers from a type. The code assumed it did not.
10792 Also make the code set the correct return type for the indexer.
10793 This was fixed a long time ago for properties, but was missing for
10794 indexers. It used to be void_type.
10796 (Binary.Emit): Test first for doubles instead of
10797 floats, as they are more common.
10799 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10800 when dealing with floats and the <=, >= operators. This fixes bug
10803 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10804 to load the array value by emitting a load on the foreach variable
10805 type. This was incorrect.
10807 We now emit the code to load an element using the the array
10808 variable type, and then we emit the conversion operator.
10812 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10814 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10816 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10818 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10819 test for protection before we test for signatures.
10821 (MethodSignature.ToString): implement.
10823 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10824 to the case where we reduced into a LongConstant.
10826 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10827 depend on whether the information is acurrate, because the
10828 Microsoft runtime will always claim that the array type is public,
10829 regardless of the real state.
10831 If the type is a pointer, another problem happens: the type is
10832 reported as non-public in Microsoft.
10834 In both cases we have to call CheckAccessLevel recursively with
10835 the underlying type as the argument to be tested.
10837 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10839 * assign.cs (Assign.Emit): If we are dealing with a compound
10840 assignment expression, we should use the code path that stores the
10841 intermediate result in a temporary value. This fixes #40903.
10843 *expression.cs (Indirection.ToString): Provide ToString method for
10846 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10848 * class.cs: Null out fields holding references to Block objects so
10849 they can be garbage collected.
10851 * expression.cs (OverloadResolve): Remove unused local.
10853 2003-04-07 Martin Baulig <martin@ximian.com>
10855 * codegen.cs (EmitContext.CurrentFile): New public field.
10856 (EmitContext.Mark): Use the CurrentFile to check whether the
10857 location is in the correct file.
10858 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10860 2003-04-07 Martin Baulig <martin@ximian.com>
10862 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10864 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10865 location. [FIXME: The location argument which gets passed to this
10866 method is sometimes wrong!]
10868 2003-04-07 Nick Drochak <ndrochak@gol.com>
10870 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10872 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10874 * expression.cs (Indirection.EmitAssign): We were using the
10875 temporary, but returning immediately instead of continuing the
10878 2003-04-06 Martin Baulig <martin@ximian.com>
10880 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10881 if it's a nested child, but also deriving from the outer class.
10884 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10885 nested child, but also deriving from the outer class. See
10887 (FilterWithClosure): We may access private members of the outer
10888 class if we're a nested child and deriving from the outer class.
10889 (RealMemberLookup): Only set `closure_private_ok' if the
10890 `original_bf' contained BindingFlags.NonPublic.
10892 2003-04-05 Martin Baulig <martin@ximian.com>
10894 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
10896 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10898 * class.cs (Event.Define): Do not allow abstract events to have
10901 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10903 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10904 block in event declarations.
10906 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10907 value type, get its address.
10909 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10910 leaving a class on the stack instead of a boolean value (int
10911 0/1). Change the code so we compare against null, and then the
10912 result against zero.
10914 * class.cs (TypeContainer.GetClassBases): We were checking for the
10915 parent class being sealed too late.
10917 * expression.cs (Binary.Emit): For <= and >= when dealing with
10918 floating point values, use cgt.un and clt.un instead of cgt and
10921 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10923 * statement.cs: Apply the same optimization as MS: skip the
10924 GetEnumerator returning an IEnumerator, and use the one returning a
10925 CharEnumerator instead. This allows us to avoid the try-finally block
10928 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
10930 * cs-parser.jay: Attributes cannot be applied to
10931 namespaces. Fixes #40473
10933 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10936 (Add*): check if the name is valid using the full name for constants,
10937 fields, properties and events.
10939 2003-03-28 Miguel de Icaza <miguel@ximian.com>
10941 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
10942 char constants to be part of the enumeration.
10944 * expression.cs (Conditional.DoResolve): Add support for operator
10945 true. Implements the missing functionality from 14.12
10947 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
10948 operator true/false as required by the spec.
10950 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
10951 implicit conversion to boolean.
10953 * statement.cs (Statement.ResolveBoolean): A boolean expression is
10954 also one where the type implements `operator true'.
10956 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10957 get an expression that will invoke operator true based on an
10960 (GetConversionOperators): Removed the hack that called op_True
10963 (Expression.ResolveBoolean): Move this from Statement.
10965 2003-03-17 Miguel de Icaza <miguel@ximian.com>
10967 * ecore.cs (FieldExpr): do not allow initialization of initonly
10968 fields on derived classes
10970 2003-03-13 Martin Baulig <martin@ximian.com>
10972 * statement.cs (Block.Emit): Call ig.BeginScope() and
10973 ig.EndScope() when compiling with debugging info; call
10974 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
10976 2003-03-08 Miguel de Icaza <miguel@ximian.com>
10978 * expression.cs (Indexers): Do not construct immediately, allow
10979 for new members to be appended as we go. Fixes 38143
10981 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10983 * expression.cs: save/restore context when resolving an unchecked
10986 2003-03-05 Miguel de Icaza <miguel@ximian.com>
10988 * cfold.cs: Catch division by zero in modulus operator during
10991 2003-03-03 Miguel de Icaza <miguel@ximian.com>
10993 * interface.cs (Interface.DefineMembers): Avoid defining members
10996 2003-02-27 Miguel de Icaza <miguel@ximian.com>
10998 * driver.cs: handle the +/- options for -noconfig
11000 * statement.cs (Unckeched.Resolve): Also track the state of
11001 unchecked in the Resolve phase.
11003 2003-02-27 Martin Baulig <martin@ximian.com>
11005 * ecore.cs (Expression.MemberLookup): Don't create a
11006 MethodGroupExpr for something which is not a method. Fixes #38291.
11008 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11010 * class.cs (MemberBase.CheckParameters): Also check that the type
11011 is unmanaged if it is a pointer.
11013 * expression.cs (SizeOf.Resolve): Add location information.
11015 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11016 a managed type is declared.
11018 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11019 parameter modifiers as well. Fixes bug 38606
11021 * class.cs: Very sad. Am backing out the speed up changes
11022 introduced by the ArrayList -> Array in the TypeContainer, as they
11023 were not actually that much faster, and introduced a bug (no error
11024 reports on duplicated methods).
11026 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11027 source first, this will guarantee that we have a valid expression
11028 before calling in lower levels functions that will require a
11029 resolved object. Then use this original_source in the
11030 target.ResolveLValue instead of the original source that was
11033 Another change. Use target.Resolve instead of LValueResolve.
11034 Although we are resolving for LValues, we will let the Assign code
11035 take care of that (it will be called again from Resolve). This
11036 basically allows code like this:
11038 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11039 class Y { void A (X x) { x [0] += o; }
11041 The problem was that the indexer was trying to resolve for
11042 set_Item (idx, object o) and never finding one. The real set_Item
11043 was set_Item (idx, X). By delaying the process we get the right
11048 2003-02-23 Martin Baulig <martin@ximian.com>
11050 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11051 while calling DoEmit ().
11053 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11054 source files; if you use the #line directive inside a method, the
11055 compiler stops emitting line numbers for the debugger until it
11056 reaches the end of the method or another #line directive which
11057 restores the original file.
11059 2003-02-23 Martin Baulig <martin@ximian.com>
11061 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11063 2003-02-23 Martin Baulig <martin@ximian.com>
11065 * statement.cs (Block.AddChildVariableNames): We need to call this
11066 recursively, not just for our immediate children.
11068 2003-02-23 Martin Baulig <martin@ximian.com>
11070 * class.cs (Event.Define): Always make the field private, like csc does.
11072 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11073 actually work, fixes bug #37521.
11075 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11077 * delegate.cs: When creating the various temporary "Parameters"
11078 classes, make sure that we call the ComputeAndDefineParameterTypes
11079 on those new parameters (just like we do with the formal ones), to
11080 allow them to be resolved in the context of the DeclSpace.
11082 This fixes the bug that Dick observed in Bugzilla #38530.
11084 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11086 * expression.cs (ResolveMemberAccess): When resolving a constant,
11087 do not attempt to pull a constant if the value was not able to
11088 generate a valid constant.
11090 * const.cs (LookupConstantValue): Do not report more errors than required.
11092 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11094 * expression.cs: fixes bug #38328.
11096 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11098 * class.cs: Changed all the various members that can be part of a
11099 class from being an ArrayList to be an Array of the right type.
11100 During the DefineType type_list, interface_list, delegate_list and
11101 enum_list are turned into types, interfaces, delegates and enums
11104 And during the member population, indexer_list, event_list,
11105 constant_list, field_list, instance_constructor_list, method_list,
11106 operator_list and property_list are turned into their real arrays.
11108 Although we could probably perform this operation earlier, for
11109 good error reporting we need to keep the lists and remove the
11110 lists for longer than required.
11112 This optimization was triggered by Paolo profiling the compiler
11113 speed on the output of `gen-sample-program.pl' perl script.
11115 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11116 not crash in methods like MemberLookupFailed that use this field.
11118 This problem arises when the compiler fails to resolve a type
11119 during interface type definition for example.
11121 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11123 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11124 inherit from System.Object, so we have to stop at null, not only
11125 when reaching System.Object.
11127 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11129 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11130 DeclaredOnly because the parent indexer might have had a different
11131 name, but did not loop until the top of the hierarchy was reached.
11133 The problem this one fixes is 35492: when a class implemented an
11134 indexer from an interface, we were getting the interface method
11135 (which was abstract) and we were flagging an error (can not invoke
11138 This also keeps bug 33089 functioning, and test-148 functioning.
11140 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11141 out if a method is special is to see if it is declared in a
11142 property or event, or whether it is one of the predefined operator
11143 names. This should fix correctly #36804.
11145 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11147 The goal here is to remove the dependency on EmptyCast.Peel ().
11148 Killing it completely.
11150 The problem is that currently in a number of places where
11151 constants are expected, we have to "probe" for an EmptyCast, and
11152 Peel, which is not the correct thing to do, as this will be
11153 repetitive and will likely lead to errors.
11155 The idea is to remove any EmptyCasts that are used in casts that
11156 can be reduced to constants, so we only have to cope with
11159 This bug hunt was triggered by Bug 37363 and the desire to remove
11160 the duplicate pattern where we were "peeling" emptycasts to check
11161 whether they were constants. Now constants will always be
11164 * ecore.cs: Use an enumconstant here instead of wrapping with
11167 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11168 throwing me off. By handling this we can get rid of a few hacks.
11170 * statement.cs (Switch): Removed Peel() code.
11172 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11174 * class.cs: Location information for error 508
11176 * expression.cs (New.DoResolve): Add a guard against double
11177 resolution of an expression.
11179 The New DoResolve might be called twice when initializing field
11180 expressions (see EmitFieldInitializers, the call to
11181 GetInitializerExpression will perform a resolve on the expression,
11182 and later the assign will trigger another resolution
11184 This leads to bugs (#37014)
11186 * delegate.cs: The signature for EndInvoke should contain any ref
11187 or out parameters as well. We were not doing this in the past.
11189 * class.cs (Field.Define): Do not overwrite the type definition
11190 inside the `volatile' group. Turns out that volatile enumerations
11191 were changing the type here to perform a validity test, which
11194 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11196 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11197 and structs, we do not want to load the instance variable
11199 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11200 enum_type has to be handled like an object reference (implicit
11201 conversions exists from this to object), but the regular IsClass
11202 and IsValueType tests will never return true for this one.
11204 Also we use TypeManager.IsValueType instead of type.IsValueType,
11205 just for consistency with the rest of the code (this is only
11206 needed if we ever use the construct exposed by test-180.cs inside
11207 corlib, which we dont today).
11209 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11211 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11214 2003-02-09 Martin Baulig <martin@ximian.com>
11216 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11217 (Namespace.DefineNamespaces): New static public method; this is
11218 called when we're compiling with debugging to add all namespaces
11219 to the symbol file.
11221 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11222 pass it to the Namespace's .ctor.
11224 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11225 and MethodBase arguments; pass the namespace ID to the symwriter;
11226 pass the MethodBase instead of the token to the symwriter.
11227 (SymbolWriter.DefineNamespace): New method to add a namespace to
11230 2003-02-09 Martin Baulig <martin@ximian.com>
11232 * symbolwriter.cs: New file. This is a wrapper around
11233 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11234 methods here in near future.
11236 2003-02-09 Martin Baulig <martin@ximian.com>
11238 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11239 ILGenerator.MarkSequencePoint() which are actually used by the
11242 2003-02-09 Martin Baulig <martin@ximian.com>
11244 * location.cs (SourceFile): New public sealed class. This
11245 contains the name and an index which is used in the location's token.
11246 (Location): Reserve an appropriate number of bits in the token for
11247 the source file instead of walking over that list, this gives us a
11248 really huge performance improvement when compiling with debugging.
11250 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11251 `SourceFile' argument instead of a string.
11252 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11253 but don't parse/tokenize here, we need to generate the list of all
11254 source files before we do that.
11255 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11258 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11259 instead of a string.
11261 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11264 2003-02-09 Martin Baulig <martin@ximian.com>
11266 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11267 filename on `#line default'.
11269 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11271 * statement.cs: don't clear the pinned var when the fixed statement
11272 returns from the method (fixes bug#37752).
11274 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11276 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11279 2003-02-07 Martin Baulig <martin@ximian.com>
11281 * driver.cs: Removed the `--debug-args' command line argument.
11283 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11284 automatically by the AsssemblyBuilder.
11285 (CodeGen.InitializeSymbolWriter): We don't need to call any
11286 initialization function on the symbol writer anymore. This method
11287 doesn't take any arguments.
11289 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11291 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11292 from referenced assemblies as well.
11294 2003-02-02 Martin Baulig <martin@ximian.com>
11296 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11298 2003-02-02 Martin Baulig <martin@ximian.com>
11300 * class.cs (Constructor.Emit): Open the symbol writer before
11301 emitting the constructor initializer.
11302 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11303 single-stepping through constructor initializers.
11305 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11307 * class.cs: Handle error 549: do not allow virtual methods in
11310 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11312 * decl.cs: Check access levels when resolving types
11314 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11316 * statement.cs: Add parameters and locals set in catch blocks that might
11317 return to set vector
11319 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11321 * class.cs (Operator): Set the SpecialName flags for operators.
11323 * expression.cs (Invocation.DoResolve): Only block calls to
11324 accessors and operators on SpecialName methods.
11326 (Cast.TryReduce): Handle conversions from char constants.
11329 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11331 * statement.cs: small memory and time optimization in FlowBranching.
11333 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11335 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11336 problem that the last fix but in the other sid (Set).
11338 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11339 access when there is no indexer in the hierarchy.
11341 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11343 * class.cs: Combine some if statements.
11345 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11347 * driver.cs: fixed bug #37187.
11349 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11351 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11352 any indexer, it's needed to build a list with all the indexers in the
11353 hierarchy (AllGetters), else we have problems. Fixes #35653.
11355 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11357 * class.cs (MethodData.Define): It is wrong for an interface
11358 implementation to be static in both cases: explicit and implicit.
11359 We were only handling this in one case.
11361 Improve the if situation there to not have negations.
11363 * class.cs (Field.Define): Turns out that we do not need to check
11364 the unsafe bit on field definition, only on usage. Remove the test.
11366 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11368 * driver.cs: use assembly.Location instead of Codebase (the latest
11369 patch made mcs fail when using MS assemblies).
11371 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11373 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11374 get the path to *corlib.dll.
11376 2003-01-21 Nick Drochak <ndrochak@gol.com>
11380 * typemanager.cs: Remove compiler warnings
11382 2003-01-20 Duncan Mak <duncan@ximian.com>
11384 * AssemblyInfo.cs: Bump the version number to 0.19.
11386 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11388 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11390 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11392 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11394 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11396 * cs-parser.jay: Small fix: we were not comparing the constructor
11397 name correctly. Thanks to Zoltan for the initial pointer.
11399 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11401 * cs-tokenizer.cs: Set file name when specified with #line
11403 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11405 * cs-parser.jay: Only perform the constructor checks here if we
11406 are named like the class; This will help provider a better
11407 error. The constructor path is taken when a type definition is
11408 not found, but most likely the user forgot to add the type, so
11409 report that rather than the constructor error.
11411 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11413 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11416 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11418 * cs-parser.jay: Add cleanup call.
11420 2003-01-13 Duncan Mak <duncan@ximian.com>
11422 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11423 consistent with other methods.
11425 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11427 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11429 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11431 * attribute.cs: only set GuidAttr to true when we have a
11434 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11438 * typemanager.cs: fixes to allow mcs compile corlib with the new
11439 Type.IsSubclassOf fix.
11441 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11443 * expression.cs (LocalVariableReference.DoResolve): Classify a
11444 constant as a value, not as a variable. Also, set the type for
11447 * cs-parser.jay (fixed_statement): take a type instead of a
11448 pointer_type, so we can produce a better error message later.
11450 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11453 (For.DoEmit): Make inifinite loops have a
11454 non-conditional branch back.
11456 (Fixed.DoEmit): First populate the pinned variables, then emit the
11457 statement, then clear the variables. Before I was emitting the
11458 code once for each fixed piece.
11461 2003-01-08 Martin Baulig <martin@ximian.com>
11463 * statement.cs (FlowBranching.MergeChild): A break in a
11464 SWITCH_SECTION does not leave a loop. Fixes #36155.
11466 2003-01-08 Martin Baulig <martin@ximian.com>
11468 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11469 lives in the same number space than `param_map'. Fixes #36154.
11471 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11473 * cs-parser.jay (constructor_declaration): Set the
11474 Constructor.ModFlags before probing for it. This makes the
11475 compiler report 514, 515 and 132 (the code was there, but got
11478 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11479 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11480 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11482 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11484 * enum.cs: create the enum static fields using the enum type.
11486 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11488 * class.cs: don't try to create the ParamBuilder for the return
11489 type if it's not needed (and handle it breaking for the ms runtime
11492 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11494 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11496 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11498 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11499 the command. This showed up while compiling the JANET source
11500 code, which used \r as its only newline separator.
11502 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11504 * class.cs (Method.Define): If we are an operator (because it
11505 reuses our code), then set the SpecialName and HideBySig. #36128
11507 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11509 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11510 exception, report error 120 `object reference required'.
11512 * driver.cs: Add --pause option, used during to measure the size
11513 of the process as it goes with --timestamp.
11515 * expression.cs (Invocation.DoResolve): Do not allow methods with
11516 SpecialName to be invoked.
11518 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11520 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11521 number before adding it.
11523 2002-12-21 Ravi Pratap <ravi@ximian.com>
11525 * ecore.cs (StandardImplicitConversion): When in an unsafe
11526 context, we allow conversion between void * to any other pointer
11527 type. This fixes bug #35973.
11529 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11531 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11532 is not thrown when extensionless outputs are used
11534 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11536 * rootcontext.cs: fixed compilation of corlib.
11538 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11540 * attribute.cs (Attributes.Contains): Add new method.
11542 * class.cs (MethodCore.LabelParameters): if the parameter is an
11543 `out' parameter, check that no attribute `[In]' has been passed.
11545 * enum.cs: Handle the `value__' name in an enumeration.
11547 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11549 * decl.cs: Added special case to allow overrides on "protected
11552 2002-12-18 Ravi Pratap <ravi@ximian.com>
11554 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11555 since it makes much more sense.
11557 (Attributes.ctor): Don't require a Location parameter.
11559 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11561 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11562 since we already have that information per attribute.
11564 * everywhere : make appropriate changes.
11566 * class.cs (LabelParameters): Write the code which actually
11567 applies attributes to the return type. We can't do this on the MS
11568 .NET runtime so we flag a warning in the case an exception is
11571 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11573 * const.cs: Handle implicit null conversions here too.
11575 2002-12-17 Ravi Pratap <ravi@ximian.com>
11577 * class.cs (MethodCore.LabelParameters): Remove the extra
11578 Type [] parameter since it is completely unnecessary. Instead
11579 pass in the method's attributes so that we can extract
11580 the "return" attribute.
11582 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11584 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11585 of ignoring it and letting the compile continue.
11587 * typemanager.cs (ChangeType): use an extra argument to return an
11588 error condition instead of throwing an exception.
11590 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11592 * expression.cs (Unary.TryReduce): mimic the code for the regular
11593 code path. Perform an implicit cast in the cases where we can
11594 implicitly convert to one of the integral types, and then reduce
11595 based on that constant. This fixes bug #35483.
11597 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11599 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11601 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11603 * namespace.cs: fixed bug #35489.
11605 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11607 * class.cs: Remove some dead code.
11609 * cs-parser.jay: Estimate the number of methods needed
11610 (RootContext.MethodCount);
11612 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11613 numbers instead of StringBuilders.
11615 * support.cs (PtrHashtable): Add constructor with initial size;
11616 We can now reduce reallocations of the method table.
11618 2002-12-10 Ravi Pratap <ravi@ximian.com>
11620 * attribute.cs (ApplyAttributes): Keep track of the emitted
11621 attributes on a per-target basis. This fixes bug #35413.
11623 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11625 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11626 default to the Windows 1252 encoding.
11628 (UnixParseOption): Support version, thanks to Alp for the missing
11631 * AssemblyInfo.cs: Add nice assembly information.
11633 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11636 * cs-parser.jay: Allow a trailing comma before the close bracked
11637 in the attribute_section production.
11639 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11640 address of the instance was being taken, I will take this out,
11641 because we take the address of the object immediately here.
11643 2002-12-09 Ravi Pratap <ravi@ximian.com>
11645 * typemanager.cs (AreMultipleAllowed): Take care of the most
11646 obvious case where attribute type is not in the current assembly -
11649 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11651 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11652 definitions, instead of doing that afterwards.
11654 Also we use a nice little hack, depending on the constructor, we
11655 know if we are a "composed" name or a simple name. Hence, we
11656 avoid the IndexOf test, and we avoid
11658 * codegen.cs: Add code to assist in a bug reporter to track down
11659 the source of a compiler crash.
11661 2002-12-07 Ravi Pratap <ravi@ximian.com>
11663 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11664 types have been emitted for a given element and flag an error
11665 if something which does not have AllowMultiple set is used more
11668 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11669 attribute types and their corresponding AllowMultiple properties
11671 (AreMultipleAllowed): Check the property for a given type.
11673 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11674 property in the case we have a TypeContainer.
11676 (Attributes.AddAttribute): Detect duplicates and just skip on
11677 adding them. This trivial fix catches a pretty gross error in our
11678 attribute emission - global attributes were being emitted twice!
11680 Bugzilla bug #33187 is now fixed.
11682 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11684 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11685 instead of pp_and).
11687 * expression.cs (Binary.ResolveOperator): I can only use the
11688 Concat (string, string, string) and Concat (string, string,
11689 string, string) if the child is actually a concatenation of
11692 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11694 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11695 context where we need a 2-character lookahead.
11697 * pending.cs (PendingImplementation): Rework so we can keep track
11698 of interface types all the time, and flag those which were
11699 implemented by parents as optional.
11701 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11703 * expression.cs (Binary.ResolveOperator): Use
11704 String.Concat(string,string,string) or
11705 String.Concat(string,string,string,string) when possible.
11707 * typemanager: More helper methods.
11710 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11712 * pending.cs: remove the bogus return from GetMissingInterfaces()
11713 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11715 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11717 * namespace.cs: avoid duplicated 'using xxx' being added to
11718 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11719 when we get more than one 'using' statement for the same namespace.
11720 Report a CS0105 warning for it.
11722 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11724 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11725 of calling getChar/putback, uses internal knowledge of it.
11727 (xtoken): Reorder tokenizer so most common patterns are checked
11728 first. This reduces the compilation time in another 5% (from 8.11s
11729 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11731 The parsing time is 22% of the compilation in mcs, and from that
11732 64% is spent on the tokenization process.
11734 I tried using a binary search for keywords, but this is slower
11735 than the hashtable. Another option would be to do a couple of
11738 * Not use a StringBuilder, instead use an array of chars,
11739 with a set value. Notice that this way we could catch
11740 the 645 error without having to do it *afterwards*.
11742 * We could write a hand-parser to avoid the hashtable
11743 compares altogether.
11745 The identifier consumption process takes 37% of the tokenization
11746 time. Another 15% is spent on is_number. 56% of the time spent
11747 on is_number is spent on Int64.Parse:
11749 * We could probably choose based on the string length to
11750 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11753 Another 3% is spend on wrapping `xtoken' in the `token' function.
11755 Handle 0xa0 as whitespace (#34752)
11757 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11759 * typemanager.cs (IsCLRType): New routine to tell whether a type
11760 is one of the builtin types.
11762 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11763 typecode in more places instead of doing pointer comparissions.
11764 We could leverage some knowledge about the way the typecodes are
11767 New code to cache namespaces in assemblies, it is currently not
11768 invoked, to be used soon.
11770 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11772 * expression.cs (Binary.ResolveOperator): specially handle
11773 strings, and do not perform user-defined operator overloading for
11776 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11778 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11779 internalcall as it is a pretty simple operation; Avoid whenever
11780 possible to call Char.IsLetter.
11782 (consume_identifier): Cut by half the number of
11783 hashtable calls by merging the is_keyword and GetKeyword behavior.
11785 Do not short-circuit, because if we do, we
11786 report errors (ie, #if false && true would produce an invalid
11790 2002-11-24 Martin Baulig <martin@ximian.com>
11792 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11793 check constant ranges and report a CS0221. Fixes #33186.
11795 2002-11-24 Martin Baulig <martin@ximian.com>
11797 * cs-parser.jay: Make this work for uninitialized variable
11798 declarations in the `for' initializer. Fixes #32416.
11800 2002-11-24 Martin Baulig <martin@ximian.com>
11802 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11803 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11805 2002-11-24 Martin Baulig <martin@ximian.com>
11807 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11808 argument; if true, we also check for user-defined conversions.
11809 This is only needed if both arguments are of a user-defined type.
11810 Fixes #30443, added test-175.cs.
11811 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11813 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11815 2002-11-24 Martin Baulig <martin@ximian.com>
11817 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11818 function to get the store opcode.
11819 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11820 only emit the Ldelema if the store opcode is Stobj. You must run
11821 both test-34 and test-167 to test this. Fixes #34529.
11823 2002-11-23 Martin Baulig <martin@ximian.com>
11825 * ecore.cs (Expression.MemberLookup): Added additional
11826 `qualifier_type' argument which is used when we're being called
11827 from MemberAccess.DoResolve() and null if we're called from a
11829 (Expression.MemberLookupFailed): New method to report errors; this
11830 does the CS1540 check and reports the correct error message.
11832 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11833 argument for the CS1540 check and redone the way how we're dealing
11834 with private members. See the comment in the source code for details.
11835 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11836 `closure_start_type' to `closure_qualifier_type' and check whether
11837 it's not null. It was not this filter being broken, it was just
11838 being called with the wrong arguments.
11840 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11841 and pass it the correct `qualifier_type'; this also does the error
11844 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11846 * expression.cs (Invocation.EmitParams): If the we are dealing
11847 with a non-built-in value type, load its address as well.
11849 (ArrayCreation): Use a a pretty constant instead
11850 of the hardcoded value 2. Use 6 instead of 2 for the number of
11851 static initializers.
11853 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11854 because they are not really value types, just glorified integers.
11856 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11858 * ecore.cs: Remove redundant code for enumerations, make them use
11859 the same code path as everything else, fixes the casting issue
11860 with enumerations in Windows.Forms.
11862 * attribute.cs: Do only cast to string if it is a string, the
11863 validation happens later.
11865 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11866 people upgrade their corlibs.
11868 * ecore.cs: Oops, enumerations were not following the entire code path
11870 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11872 * typemanager.cs (FilterWithClosure): Commented out the test for
11873 1540 in typemanager.cs, as it has problems when accessing
11874 protected methods from a parent class (see test-174.cs).
11876 * attribute.cs (Attribute.ValidateGuid): new method.
11877 (Attribute.Resolve): Use above.
11879 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11881 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11883 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11884 handling for enumerations, as we only needed the TypeContainer
11885 functionality to begin with (this is required for the fix below to
11886 work for enums that reference constants in a container class for
11889 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11891 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11892 a valid TypeBuilder to perform lookups on.o
11894 * class.cs (InheritableMemberSignatureCompare): Use true in the
11895 call to GetGetMethod and GetSetMethod, because we are comparing
11896 the signature, and we need to get the methods *even* if they are
11899 (PropertyBase.CheckBase): ditto.
11901 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11902 GotoCase.Resolve): Use Peel on EmpytCasts.
11904 * ecore.cs (EmptyCast): drop child, add Peel method.
11906 2002-11-17 Martin Baulig <martin@ximian.com>
11908 * ecore.cs (EmptyCast.Child): New public property.
11910 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11911 label resolved to an EmptyCast. Fixes #34162.
11912 (GotoCase.Resolve): Likewise.
11913 (Block.EmitMeta): Likewise.
11915 2002-11-17 Martin Baulig <martin@ximian.com>
11917 * expression.cs (Invocation.BetterConversion): Prefer int over
11918 uint; short over ushort; long over ulong for integer literals.
11919 Use ImplicitConversionExists instead of StandardConversionExists
11920 since we also need to check for user-defined implicit conversions.
11921 Fixes #34165. Added test-173.cs.
11923 2002-11-16 Martin Baulig <martin@ximian.com>
11925 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11926 with the `true' and `false' literals. Fixes #33151.
11928 2002-11-16 Martin Baulig <martin@ximian.com>
11930 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
11931 October 22nd; don't do the cs1540 check for static members.
11933 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
11934 now using our own filter here and doing the cs1540 check again.
11936 2002-11-16 Martin Baulig <martin@ximian.com>
11938 * support.cs (InternalParameters): Don't crash if we don't have
11939 any fixed parameters. Fixes #33532.
11941 2002-11-16 Martin Baulig <martin@ximian.com>
11943 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
11944 when looking up static methods to make this work on Windows.
11947 2002-11-16 Martin Baulig <martin@ximian.com>
11949 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
11950 a setter rather than using PropertyInfo.CanWrite.
11952 2002-11-15 Nick Drochak <ndrochak@gol.com>
11954 * class.cs: Allow acces to block member by subclasses. Fixes build
11957 2002-11-14 Martin Baulig <martin@ximian.com>
11959 * class.cs (Constructor.Emit): Added the extern/block check.
11962 2002-11-14 Martin Baulig <martin@ximian.com>
11964 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
11965 iteration while looking for indexers, this is needed because the
11966 indexer may have a different name in our base classes. Fixed the
11967 error reporting (no indexers at all, not get accessor, no
11968 overloaded match). Fixes bug #33089.
11969 (IndexerAccess.DoResolveLValue): Likewise.
11971 2002-11-14 Martin Baulig <martin@ximian.com>
11973 * class.cs (PropertyBase.CheckBase): Make this work for multiple
11974 indexers. Fixes the first part of bug #33089.
11975 (MethodSignature.InheritableMemberSignatureCompare): Added support
11978 2002-11-13 Ravi Pratap <ravi@ximian.com>
11980 * attribute.cs (Attribute.Resolve): Catch the
11981 NullReferenceException and report it since it isn't supposed to
11984 2002-11-12 Miguel de Icaza <miguel@ximian.com>
11986 * expression.cs (Binary.EmitBranchable): Also handle the cases for
11987 LogicalOr and LogicalAnd that can benefit from recursively
11988 handling EmitBranchable. The code now should be nice for Paolo.
11990 2002-11-08 Miguel de Icaza <miguel@ximian.com>
11992 * typemanager.cs (LookupType): Added a negative-hit hashtable for
11993 the Type lookups, as we perform quite a number of lookups on
11994 non-Types. This can be removed once we can deterministically tell
11995 whether we have a type or a namespace in advance.
11997 But this might require special hacks from our corlib.
12001 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12002 and double which avoids a conversion from an integer to a double.
12004 * expression.cs: tiny optimization, avoid calling IsConstant,
12005 because it effectively performs the lookup twice.
12007 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12009 But a bogus return here to keep the semantics of the old code
12010 until the Mono runtime is fixed.
12012 * pending.cs (GetMissingInterfaces): New method used to remove all
12013 the interfaces that are already implemented by our parent
12014 classes from the list of pending methods.
12016 * interface.cs: Add checks for calls after ResolveTypeExpr.
12018 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12020 * class.cs (Class.Emit): Report warning 67: event not used if the
12021 warning level is beyond 3.
12023 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12024 being a NullLiteral.
12026 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12029 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12030 path that might fail if a type can not be resolved.
12032 * expression.cs (Binary.Emit): Emit unsigned versions of the
12035 * driver.cs: use error 5.
12037 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12039 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12041 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12043 * cs-parser.jay (switch_section): A beautiful patch from Martin
12044 Baulig that fixed 33094.
12046 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12048 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12049 Check whether the base is abstract and report an error if so.
12051 * expression.cs (IndexerAccess.DoResolveLValue,
12052 IndexerAccess.DoResolve): ditto.
12054 (Invocation.DoResolve): ditto.
12056 (Invocation.FullMethodDesc): Improve the report string.
12058 * statement.cs (Block): Eliminate IsVariableDefined as it is
12059 basically just a wrapper for GetVariableInfo.
12061 * ecore.cs (SimpleName): Use new
12063 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12064 type, as we return the actual parameter ref/unref state on a
12067 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12069 * support.cs: Return proper flags REF/OUT fixing the previous
12072 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12073 not used to mean `ref' but `ref or out' in ParameterReference
12075 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12076 full type signature instead of calling TypeManger.CSharpName
12079 * support.cs (InternalParameters.ParameterDesc): Do not compare
12080 directly to the modflags, because REF/OUT will actually be bitsets
12083 * delegate.cs (VerifyMethod): Check also the modifiers.
12085 * cs-tokenizer.cs: Fix bug where floating point values with an
12086 exponent where a sign was missing was ignored.
12088 * driver.cs: Allow multiple assemblies to be specified in a single
12091 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12093 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12094 because identifiers after a parenthesis would end up in this kind
12095 of production, and we needed to desamiguate it for having casts
12098 (UserDefinedType *) xxx
12100 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12102 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12103 we should set on the Bindingflags.NonPublic, but not turn on
12104 private_ok. private_ok controls whether a Private member is
12105 returned (this is chekced on the filter routine), while the
12106 BindingFlags.NonPublic just controls whether private/protected
12107 will be allowed. This fixes the problem part of the problem of
12108 private properties being allowed to be used in derived classes.
12110 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12111 so we can call the children DoResolveLValue method (this will
12112 properly signal errors on lvalue assignments to base properties)
12114 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12115 getter are null, and we have a property info, we know that this
12116 happened because the lookup failed, so we report an error 122 for
12117 protection level violation.
12119 We also silently return if setter and getter are null in the
12120 resolve functions, this condition only happens if we have flagged
12121 the error before. This is the other half of the problem.
12123 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12124 not have accessibility information, that is why we were returning
12125 true in the filter function in typemanager.cs.
12127 To properly report 122 (property is inaccessible because of its
12128 protection level) correctly, we report this error in ResolveAccess
12129 by failing if both the setter and the getter are lacking (ie, the
12132 DoResolve and DoLResolve have been modified to check for both
12133 setter/getter being null and returning silently, the reason being
12134 that I did not want to put the knowledge about this error in upper
12137 int old = Report.Errors;
12138 x = new PropertyExpr (...);
12139 if (old != Report.Errors)
12144 So the property expr is returned, but it is invalid, so the error
12145 will be flagged during the resolve process.
12147 * class.cs: Remove InheritablePropertySignatureCompare from the
12148 class, as we no longer depend on the property signature to compute
12149 whether it is possible to implement a method or not.
12151 The reason is that calling PropertyInfo.GetGetMethod will return
12152 null (in .NET, in Mono it works, and we should change this), in
12153 cases where the Get Method does not exist in that particular
12158 class X { public virtual int A { get { return 1; } } }
12160 class Z : Y { public override int A { get { return 2; } } }
12162 Would fail in Z because the parent (Y) would not have the property
12163 defined. So we avoid this completely now (because the alternative
12164 fix was ugly and slow), and we now depend exclusively on the
12167 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12168 reference method, instead of using the property.
12170 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12171 routines are gone now.
12173 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12174 names, they were incorrectly named.
12176 * cs-tokenizer.cs: Return are more gentle token on failure.
12178 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12179 had an out-of-sync index variable, which caused it to remove from
12180 the list of pending methods the wrong method sometimes.
12182 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12184 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12185 CanWrite, because those refer to this particular instance of the
12186 property, and do not take into account the fact that we can
12187 override single members of a property.
12189 Constructor requires an EmitContext. The resolution process does
12190 not happen here, but we need to compute the accessors before,
12191 because the resolution does not always happen for properties.
12193 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12194 subclass, before we did not update this flag, but we did update
12197 (GetAccessors): Drop this routine, as it did not work in the
12198 presence of partially overwritten set/get methods.
12200 Notice that this broke the cs1540 detection, but that will require
12203 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12207 * driver.cs: issue a warning instead of an error if we don't support
12208 debugging for the platform. Also ignore a couple of errors that may
12209 arise when trying to write the symbols. Undo my previous patch.
12211 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12213 * driver.cs: ignore /debug switch except for Unix platforms.
12215 2002-10-23 Nick Drochak <ndrochak@gol.com>
12217 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12219 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12221 * driver.cs: Do not make mcs-debug conditional, so we do not break
12222 builds that use it.
12224 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12225 review this patch. But basically after all the children variables
12226 have been merged, the value of "Breaks" was not being set to
12227 new_breaks for Switch blocks. I think that it should be set after
12228 it has executed. Currently I set this to the value of new_breaks,
12229 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12230 conservative, but I do not understand this code very well.
12232 I did not break anything in the build, so that is good ;-)
12234 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12236 2002-10-20 Mark Crichton <crichton@gimp.org>
12238 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12240 2002-10-20 Nick Drochak <ndrochak@gol.com>
12242 * cfold.cs: Fixed compile blocker.
12244 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12246 * driver.cs: I was chekcing the key, not the file.
12248 2002-10-19 Ravi Pratap <ravi@ximian.com>
12250 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12251 message that we were generating - we just need to silently return
12254 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12256 * class.cs (Event.Define): Change my previous commit, as this
12257 breaks the debugger. This is a temporary hack, as it seems like
12258 the compiler is generating events incorrectly to begin with.
12260 * expression.cs (Binary.ResolveOperator): Added support for
12261 "U operator - (E x, E y)"
12263 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12266 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12267 init-only variables, but this path did not take into account that
12268 there might be also instance readonly variables. Correct this
12271 This fixes bug 32253
12273 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12276 * driver.cs: Change the extension for modules to `netmodule'
12278 * cs-parser.jay: Improved slightly the location tracking for
12279 the debugger symbols.
12281 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12282 modifiers that were specified instead of the hardcoded value
12283 (FamAndAssem). This was basically ignoring the static modifier,
12284 and others. Fixes 32429.
12286 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12287 fixed a bug in the process (32476)
12289 * expression.cs (ArrayAccess.EmitAssign): Patch from
12290 hwang_rob@yahoo.ca that fixes bug 31834.3
12292 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12294 * driver.cs: Make the module extension .netmodule.
12296 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12298 * driver.cs: Report an error if the resource file is not found
12299 instead of crashing.
12301 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12302 false, like Emit does.
12304 2002-10-16 Nick Drochak <ndrochak@gol.com>
12306 * typemanager.cs: Remove unused private member. Also reported mcs
12307 bug to report this as a warning like csc.
12309 2002-10-15 Martin Baulig <martin@gnome.org>
12311 * statement.cs (Statement.Emit): Made this a virtual method; emits
12312 the line number info and calls DoEmit().
12313 (Statement.DoEmit): New protected abstract method, formerly knows
12314 as Statement.Emit().
12316 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12318 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12320 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12321 have fixed a remaining problem: not every AddXXXX was adding a
12322 fully qualified name.
12324 Now everyone registers a fully qualified name in the DeclSpace as
12325 being defined instead of the partial name.
12327 Downsides: we are slower than we need to be due to the excess
12328 copies and the names being registered this way.
12330 The reason for this is that we currently depend (on the corlib
12331 bootstrap for instance) that types are fully qualified, because
12332 we dump all the types in the namespace, and we should really have
12333 types inserted into the proper namespace, so we can only store the
12334 basenames in the defined_names array.
12336 2002-10-10 Martin Baulig <martin@gnome.org>
12338 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12339 from bug #31834, see the bug report for a testcase which is
12342 2002-10-10 Martin Baulig <martin@gnome.org>
12344 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12345 flow analysis code for this.
12347 * statement.cs (Do, While, For): Tell the flow analysis code about
12349 (FlowBranching.UsageVector): Added support for infinite loops.
12350 (Block.Resolve): Moved the dead code elimination here and use flow
12353 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12355 * class.cs (Field.Define): Catch cycles on struct type
12358 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12359 fields if the fields are static. We only need to check instance
12362 * expression.cs (As.DoResolve): Test for reference type.
12364 * statement.cs (Using.ResolveExpression): Use
12365 ConvertImplicitRequired, not ConvertImplicit which reports an
12367 (Using.ResolveLocalVariableDecls): ditto.
12369 * expression.cs (Binary.ResolveOperator): Report errors in a few
12370 places where we had to.
12372 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12374 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12376 * expression.cs: Use StoreFromPtr instead of extracting the type
12377 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12379 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12380 an enumeration value to a System.Enum, but System.Enum is not a
12381 value type, but an class type, so we need to box.
12383 (Expression.ConvertExplicit): One codepath could return
12384 errors but not flag them. Fix this. Fixes #31853
12386 * parameter.cs (Resolve): Do not allow void as a parameter type.
12388 2002-10-06 Martin Baulig <martin@gnome.org>
12390 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12391 if it's a class type and not a struct. Fixes #31815.
12393 2002-10-06 Martin Baulig <martin@gnome.org>
12395 * statement.cs: Reworked the flow analysis code a bit to make it
12396 usable for dead code elimination.
12398 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12400 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12402 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12404 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12405 to fix the test 165, will investigate deeper.
12407 2002-10-04 Martin Baulig <martin@gnome.org>
12409 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12410 finally blocks actually work.
12411 (Try.Resolve): We don't need to create a sibling for `finally' if
12412 there is no finally block.
12414 2002-10-04 Martin Baulig <martin@gnome.org>
12416 * class.cs (Constructor.Define): The default accessibility for a
12417 non-default constructor is private, not public.
12419 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12421 * class.cs (Constructor): Make AllowedModifiers public, add
12424 * cs-parser.jay: Perform the modifiers test here, as the
12425 constructor for the Constructor class usually receives a zero
12426 because of the way we create it (first we create, later we
12427 customize, and we were never checking the modifiers).
12429 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12430 is a version of LookupTypeReflection that includes the type-name
12431 cache. This can be used as a fast path for functions that know
12432 the fully qualified name and are only calling into *.GetType() to
12433 obtain a composed type.
12435 This is also used by TypeManager.LookupType during its type
12438 (LookupType): We now also track the real type name, as sometimes
12439 we can get a quey for the real type name from things like
12440 ComposedCast. This fixes bug 31422.
12442 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12443 complete type fullname, it does not have to go through the type
12444 resolution system to obtain the composed version of the type (for
12445 obtaining arrays or pointers).
12447 (Conditional.Emit): Use the EmitBoolExpression to
12448 generate nicer code, as requested by Paolo.
12450 (ArrayCreation.CheckIndices): Use the patch from
12451 hwang_rob@yahoo.ca to validate the array initializers.
12453 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12455 * class.cs (ConstructorInitializer.Emit): simplify code by using
12456 Invocation.EmitCall, and at the same time, fix the bugs in calling
12457 parent constructors that took variable arguments.
12459 * ecore.cs (Expression.ConvertNumericExplicit,
12460 Expression.ImplicitNumericConversion): Remove the code that
12461 manually wrapped decimal (InternalTypeConstructor call is now gone
12464 * expression.cs (Cast.TryReduce): Also handle decimal types when
12465 trying to perform a constant fold on the type.
12467 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12469 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12470 that only turned off an error report, and did nothing else.
12472 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12474 * driver.cs: Handle and ignore /fullpaths
12476 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12478 * expression.cs (Binary.ResolveOperator): Catch the case where
12479 DoNumericPromotions returns true,
12481 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12483 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12485 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12488 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12490 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12491 conversion exists, but it is also required that the conversion be
12492 performed. This manifested in "(Type64Enum) 2".
12494 * class.cs (TypeManager.AddMethod): The fix is not to change
12495 AddEnum, because that one was using a fully qualified name (every
12496 DeclSpace derivative does), but to change the AddMethod routine
12497 that was using an un-namespaced name. This now correctly reports
12498 the duplicated name.
12500 Revert patch until I can properly fix it. The issue
12501 is that we have a shared Type space across all namespaces
12502 currently, which is wrong.
12504 Options include making the Namespace a DeclSpace, and merge
12505 current_namespace/current_container in the parser.
12507 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12509 * cs-parser.jay: Improve error reporting when we get a different
12510 kind of expression in local_variable_type and
12511 local_variable_pointer_type.
12513 Propagate this to avoid missleading errors being reported.
12515 * ecore.cs (ImplicitReferenceConversion): treat
12516 TypeManager.value_type as a target just like object_type. As
12521 Is valid, and needs to result in the int 1 being boxed before it
12522 is assigned to the value type v.
12524 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12525 to validate the enumeration name.
12527 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12528 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12529 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12531 * ecore.cs (TryImplicitIntConversion): When doing an
12532 implicit-enumeration-conversion, check if the type is 64-bits and
12533 perform a conversion before passing to EnumConstant.
12535 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12537 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12538 report ambiguous type references. Unlike the MS version, we
12539 report what the ambiguity is. Innovation at work ;-)
12541 (DeclSpace.FindType): Require a location argument to
12542 display when we display an ambiguous error.
12544 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12546 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12548 * expression.cs (EmitDynamicInitializers): Apply patch from
12549 hwang_rob@yahoo.ca that fixes the order in which we emit our
12552 2002-09-21 Martin Baulig <martin@gnome.org>
12554 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12555 delegate takes no arguments.
12557 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12559 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12562 * expression.cs: Extract the underlying type.
12564 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12566 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12568 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12570 * class.cs (TypeContainer.DefineType): We can not use the nice
12571 PackingSize with the size set to 1 DefineType method, because it
12572 will not allow us to define the interfaces that the struct
12575 This completes the fixing of bug 27287
12577 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12578 means also structs. This fixes part of the problem.
12579 (Expresion.ImplicitReferenceConversionExists): ditto.
12581 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12582 error if there were no errors reported during the type lookup
12583 process, to avoid duplicates or redundant errors. Without this
12584 you would get an ambiguous errors plus a type not found. We have
12585 beaten the user enough with the first error.
12587 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12590 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12591 during the resolution process, stop the lookup, this avoids
12592 repeated error reports (same error twice).
12594 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12596 * typemanager.cs (LookupType): Redo the type lookup code to match
12597 the needs of System.Reflection.
12599 The issue is that System.Reflection requires references to nested
12600 types to begin with a "+" sign instead of a dot. So toplevel
12601 types look like: "NameSpace.TopLevelClass", and nested ones look
12602 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12605 2002-09-19 Martin Baulig <martin@gnome.org>
12607 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12608 says that a method always returns or always throws an exception,
12609 don't report the CS0161.
12611 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12612 set `Returns = new_returns'.
12614 2002-09-19 Martin Baulig <martin@gnome.org>
12616 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12617 to an enum constant, check for a CS0176.
12619 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12621 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12622 for operators that must be in pairs and report errors.
12624 * ecore.cs (SimpleName.DoResolveType): During the initial type
12625 resolution process, when we define types recursively, we must
12626 check first for types in our current scope before we perform
12627 lookups in the enclosing scopes.
12629 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12631 (Invocation.VerifyArgumentsCompat): Call
12632 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12633 I thought we were supposed to always call this, but there are a
12634 few places in the code where we dont do it.
12636 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12638 * driver.cs: Add support in -linkres and -resource to specify the
12639 name of the identifier.
12641 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12643 * ecore.cs (StandardConversionExists): Sync with the conversion
12644 code: allow anything-* to void* conversions.
12646 (FindMostSpecificSource): Use an Expression argument
12647 instead of a Type, because we might be handed over a Literal which
12648 gets a few more implicit conversions that plain types do not. So
12649 this information was being lost.
12651 Also, we drop the temporary type-holder expression when not
12654 2002-09-17 Martin Baulig <martin@gnome.org>
12656 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12657 this is an explicit interface implementation.
12659 2002-09-17 Martin Baulig <martin@gnome.org>
12661 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12662 different `IndexerName' attributes.
12664 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12665 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12666 virtual CommonResolve().
12668 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12670 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12671 and convert that to the UnderlyingType.
12673 * statement.cs (Foreach.Resolve): Indexers are just like variables
12674 or PropertyAccesses.
12676 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12677 inside quoted strings, we were not doing this before.
12679 2002-09-16 Martin Baulig <martin@gnome.org>
12681 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12682 resolve it. This is needed for the definite assignment check of the
12683 instance expression, fixes bug #29846.
12684 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12686 2002-09-16 Nick Drochak <ndrochak@gol.com>
12688 * parameter.cs: Fix compile error. Cannot reference static member
12689 from an instance object. Is this an mcs bug?
12691 2002-09-14 Martin Baulig <martin@gnome.org>
12693 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12694 multiple times. Fixes bug #30295, added test-166.cs.
12696 2002-09-14 Martin Baulig <martin@gnome.org>
12698 * statement.cs (Block.Emit): Don't emit unreachable code.
12699 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12700 `break' statements.
12701 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12703 2002-09-14 Martin Baulig <martin@gnome.org>
12705 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12708 2002-09-14 Martin Baulig <martin@gnome.org>
12710 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12711 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12712 be false on the ms runtime.
12714 2002-09-13 Martin Baulig <martin@gnome.org>
12716 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12717 the CS0038 error message.
12719 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12721 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12722 constant inside, return it.
12724 2002-09-12 Martin Baulig <martin@gnome.org>
12726 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12727 implicit conversion can be done between enum types.
12729 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12730 check whether an implicit conversion to the current enum's UnderlyingType
12731 exists and report an error if not.
12733 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12734 without debugging support.
12736 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12737 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12739 2002-09-12 Martin Baulig <martin@gnome.org>
12741 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12743 * ecore.cs (IMemberExpr.DeclaringType): New property.
12744 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12745 nonstatic member of an outer type (CS0038).
12747 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12749 * driver.cs: Activate the using-error detector at warning level
12750 4 (at least for MS-compatible APIs).
12752 * namespace.cs (VerifyUsing): Small buglett fix.
12754 * pending.cs (PendingImplementation): pass the container pointer.
12756 * interface.cs (GetMethods): Allow for recursive definition. Long
12757 term, I would like to move every type to support recursive
12758 definitions, not the current ordering mechanism that we have right
12761 The situation is this: Attributes are handled before interfaces,
12762 so we can apply attributes to interfaces. But some attributes
12763 implement interfaces, we will now handle the simple cases
12764 (recursive definitions will just get an error).
12766 * parameter.cs: Only invalidate types at the end if we fail to
12769 2002-09-09 Martin Baulig <martin@gnome.org>
12771 * ecore.cs (PropertyExpr.Emit): Also check for
12772 TypeManager.system_int_array_get_length so this'll also work when
12773 compiling corlib. Fixes #30003.
12775 2002-09-09 Martin Baulig <martin@gnome.org>
12777 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12778 and throw an exception if we can't get the type's size. Fixed #30040,
12781 2002-09-09 Martin Baulig <martin@gnome.org>
12783 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12785 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12786 context. Fixes bug #30027.
12788 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12789 virtual functions. Fixes bug #30043, added test-164.cs.
12791 2002-09-08 Ravi Pratap <ravi@ximian.com>
12793 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12795 2002-09-08 Nick Drochak <ndrochak@gol.com>
12797 * driver.cs: Use an object to get the windows codepage since it's not a
12800 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12802 * statement.cs (For.Emit): for infinite loops (test == null)
12803 return whether there is a break inside, not always "true".
12805 * namespace.cs (UsingEntry): New struct to hold the name of the
12806 using definition, the location where it is defined, and whether it
12807 has been used in a successful type lookup.
12809 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12814 2002-09-06 Ravi Pratap <ravi@ximian.com>
12816 * attribute.cs : Fix incorrect code which relied on catching
12817 a NullReferenceException to detect a null being passed in
12818 where an object was expected.
12820 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12822 * statement.cs (Try): flag the catch variable as assigned
12824 * expression.cs (Cast): Simplified by using ResolveType instead of
12825 manually resolving.
12827 * statement.cs (Catch): Fix bug by using ResolveType.
12829 2002-09-06 Ravi Pratap <ravi@ximian.com>
12831 * expression.cs (BetterConversion): Special case for when we have
12832 a NullLiteral as the argument and we have to choose between string
12833 and object types - we choose string the way csc does.
12835 * attribute.cs (Attribute.Resolve): Catch the
12836 NullReferenceException and report error #182 since the Mono
12837 runtime no more has the bug and having this exception raised means
12838 we tried to select a constructor which takes an object and is
12841 2002-09-05 Ravi Pratap <ravi@ximian.com>
12843 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12844 message (1502, 1503) when we can't locate a method after overload
12845 resolution. This is much more informative and closes the bug
12848 * interface.cs (PopulateMethod): Return if there are no argument
12849 types. Fixes a NullReferenceException bug.
12851 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12852 expressions too. Previously we were checking only in one place for
12853 positional arguments leaving out named arguments.
12855 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12856 type to the enum type is not allowed. Remove code corresponding to
12859 (ConvertNumericExplicit): Allow explicit conversions from
12860 the underlying type to enum type. This precisely follows the spec
12861 and closes a bug filed by Gonzalo.
12863 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12866 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12868 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12870 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12871 it was important that we stored the right value after the
12872 reduction in `converted'.
12874 2002-09-04 Martin Baulig <martin@gnome.org>
12876 * location.cs (Location.SymbolDocument): Use full pathnames for the
12879 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12881 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12882 of the expression resolve mechanism, because that will catch the
12883 SimpleName error failures.
12885 (Conditional): If we can not resolve the
12886 expression, return, do not crash.
12888 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12891 (location): display token name instead of its number.
12893 2002-08-28 Martin Baulig <martin@gnome.org>
12895 * expression.cs (Binary.ResolveOperator): Don't silently return
12896 but return an error if an operator cannot be applied between two
12899 2002-08-28 Martin Baulig <martin@gnome.org>
12901 * class.cs (Constructor.Define): Set the permission attributes
12902 correctly instead of making all constructors public.
12904 2002-08-28 Martin Baulig <martin@gnome.org>
12906 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12907 for private members before reporting a CS0103; if we find anything,
12910 2002-08-28 Martin Baulig <martin@gnome.org>
12912 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12913 to check whether `closure_start_type == closure_invocation_type',
12914 we also need to check whether `m.DeclaringType == closure_invocation_type'
12915 before bypassing the permission checks. We might be accessing
12916 protected/private members from the base class.
12917 (TypeManager.RealMemberLookup): Only set private_ok if private
12918 members were requested via BindingFlags.NonPublic.
12920 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12922 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12923 MethodGroupExpr.IsExplicitImpl if appropriate.
12924 (Invocation.DoResolve): Don't report the CS0120 for explicit
12925 interface implementations.
12927 2002-08-27 Martin Baulig <martin@gnome.org>
12929 * expression.cs (Invocation.DoResolve): If this is a static
12930 method and we don't have an InstanceExpression, we must report
12933 2002-08-25 Martin Baulig <martin@gnome.org>
12935 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
12936 `==' between a valuetype and an object.
12938 2002-08-25 Miguel de Icaza <miguel@ximian.com>
12940 * ecore.cs (TypeExpr): Provide a ToString method.
12942 2002-08-24 Martin Baulig <martin@gnome.org>
12944 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
12945 now called proggie.dbg and it's a binary file.
12947 2002-08-23 Martin Baulig <martin@gnome.org>
12949 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
12951 2002-08-23 Martin Baulig <martin@gnome.org>
12953 * struct.cs (MyStructInfo.ctor): Make this work with empty
12954 structs; it's not allowed to use foreach() on null.
12956 2002-08-23 Martin Baulig <martin@gnome.org>
12958 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
12959 writer the full pathname of the generated assembly.
12961 2002-08-23 Martin Baulig <martin@gnome.org>
12963 * statements.cs (FlowBranching.UsageVector.MergeChildren):
12964 A `finally' block never returns or breaks; improved handling of
12967 2002-08-23 Martin Baulig <martin@gnome.org>
12969 * statement.cs (Throw.Resolve): Allow `throw null'.
12971 2002-08-23 Martin Baulig <martin@gnome.org>
12973 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
12974 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
12975 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
12976 MemberLookup would return a wrong event if this is an explicit
12977 interface implementation and the class has an event with the same
12980 2002-08-23 Martin Baulig <martin@gnome.org>
12982 * statement.cs (Block.AddChildVariableNames): New public method.
12983 (Block.AddChildVariableName): Likewise.
12984 (Block.IsVariableNameUsedInChildBlock): Likewise.
12985 (Block.AddVariable): Check whether a variable name has already
12986 been used in a child block.
12988 * cs-parser.jay (declare_local_variables): Mark all variable names
12989 from the current block as being used in a child block in the
12992 2002-08-23 Martin Baulig <martin@gnome.org>
12994 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
12995 find the symbol writer.
12997 * driver.cs: csc also allows the arguments to /define being
12998 separated by commas, not only by semicolons.
13000 2002-08-23 Martin Baulig <martin@gnome.org>
13002 * interface.cs (Interface.GetMembers): Added static check for events.
13004 2002-08-15 Martin Baulig <martin@gnome.org>
13006 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13007 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13009 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13010 why the MethodData.EmitDestructor() change was necessary.
13012 2002-08-20 Martin Baulig <martin@gnome.org>
13014 * class.cs (TypeContainer.FindMembers): Added static check for events.
13016 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13018 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13019 use Type.GetEvents(), not Type.FindMembers().
13021 2002-08-20 Martin Baulig <martin@gnome.org>
13023 * decl.cs (MemberCache): Added a special method cache which will
13024 be used for method-only searched. This ensures that a method
13025 search will return a MethodInfo with the correct ReflectedType for
13028 2002-08-20 Martin Baulig <martin@gnome.org>
13030 * decl.cs (DeclSpace.FindMembers): Made this public.
13032 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13034 * delegate.cs: fixed build on windows.
13035 [FIXME: Filed as bug #29150: MCS must report these errors.]
13037 2002-08-19 Ravi Pratap <ravi@ximian.com>
13039 * ecore.cs (StandardConversionExists): Return a false
13040 if we are trying to convert the void type to anything else
13041 since that is not allowed.
13043 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13044 we flag error 70 in the event an event is trying to be accessed
13045 directly from outside the declaring type.
13047 2002-08-20 Martin Baulig <martin@gnome.org>
13049 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13050 MemberCache from typemanager.cs to decl.cs.
13052 2002-08-19 Martin Baulig <martin@gnome.org>
13054 * class.cs (TypeContainer): Implement IMemberContainer.
13055 (TypeContainer.DefineMembers): Create the MemberCache.
13056 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13057 return public members if BindingFlags.Public was given, check
13058 whether members are static.
13060 2002-08-16 Martin Baulig <martin@gnome.org>
13062 * decl.cs (DeclSpace.Define): Splitted this in Define and
13063 DefineMembers. DefineMembers is called first and initializes the
13066 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13067 DefineMembers() on all our DeclSpaces.
13069 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13070 but call DefineMembers() on all nested interfaces. We call their
13071 Define() in our new Define() function.
13073 * interface.cs (Interface): Implement IMemberContainer.
13074 (Interface.Define): Moved all code except the attribute stuf to
13076 (Interface.DefineMembers): Initialize the member cache.
13078 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13079 need this anymore since we can use MemberCache.FindMembers directly.
13081 2002-08-19 Martin Baulig <martin@gnome.org>
13083 * typemanager.cs (MemberCache): When creating the cache for an
13084 interface type, add all inherited members.
13085 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13086 to `out bool used_cache' and documented it.
13087 (TypeManager.MemberLookup): If we already used the cache in the first
13088 iteration, we don't need to do the interfaces check.
13090 2002-08-19 Martin Baulig <martin@gnome.org>
13092 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13093 here from IMemberFinder and don't implement this interface anymore.
13094 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13096 * typemanager.cs (IMemberFinder): This interface is now only used by
13097 classes which actually support the member cache.
13098 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13099 since we only put DeclSpaces into this Hashtable.
13100 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13101 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13103 2002-08-16 Martin Baulig <martin@gnome.org>
13105 * typemanager.cs (ICachingMemberFinder): Removed.
13106 (IMemberFinder.MemberCache): New property.
13107 (TypeManager.FindMembers): Merged this with RealFindMembers().
13108 This function will never be called from TypeManager.MemberLookup()
13109 so we can't use the cache here, just the IMemberFinder.
13110 (TypeManager.MemberLookup_FindMembers): Check whether the
13111 IMemberFinder has a MemberCache and call the cache's FindMembers
13113 (MemberCache): Rewrote larger parts of this yet another time and
13114 cleaned it up a bit.
13116 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13118 * driver.cs (LoadArgs): Support quoting.
13120 (Usage): Show the CSC-like command line arguments.
13122 Improved a few error messages.
13124 2002-08-15 Martin Baulig <martin@gnome.org>
13126 * typemanager.cs (IMemberContainer.Type): New property.
13127 (IMemberContainer.IsInterface): New property.
13129 The following changes are conditional to BROKEN_RUNTIME, which is
13130 defined at the top of the file.
13132 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13133 class'es members, but add all members from TypeHandle.ObjectType
13134 if we're an interface.
13135 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13136 is the current type.
13137 (MemberCache.CacheEntry.Container): Removed this field.
13138 (TypeHandle.GetMembers): Include inherited members.
13140 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13142 * typemanager.cs: fixed compilation and added a comment on a field that
13145 2002-08-15 Martin Baulig <martin@gnome.org>
13147 * class.cs (ConstructorInitializer.Resolve): In the
13148 Expression.MemberLookup call, use the queried_type as
13151 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13152 declared' attribute, it's always true.
13153 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13154 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13155 temporary wrapper for FindMembers which tells MemberLookup whether
13156 members from the base classes are included in the return value.
13157 This will go away soon.
13158 (TypeManager.MemberLookup): Use this temporary hack here; once the
13159 new MemberCache is completed, we don't need to do the DeclaredOnly
13160 looping here anymore since the MemberCache will take care of this.
13161 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13162 (MemberCache): When creating the MemberCache for a class, get
13163 members from the current class and all its base classes.
13164 (MemberCache.CacheEntry.Container): New field. This is a
13165 temporary hack until the Mono runtime is fixed to distinguish
13166 between ReflectedType and DeclaringType. It allows us to use MCS
13167 with both the MS runtime and the unfixed Mono runtime without
13168 problems and without accecting performance.
13169 (MemberCache.SearchMembers): The DeclaredOnly looping from
13170 TypeManager.MemberLookup is now done here.
13172 2002-08-14 Martin Baulig <martin@gnome.org>
13174 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13175 Type.GetFields on dynamic types but get the fields from the
13176 corresponding TypeContainer.
13177 (MyStructInfo.GetStructInfo): Added check for enum types.
13179 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13180 (MemberList.SyncRoot): Implemented.
13181 (TypeManager.FilterWithClosure): No need to check permissions if
13182 closure_start_type == closure_invocation_type, don't crash if
13183 closure_invocation_type is null.
13185 2002-08-13 Martin Baulig <martin@gnome.org>
13187 Rewrote TypeContainer.FindMembers to use a member cache. This
13188 gives us a speed increase of about 35% for the self-hosting MCS
13189 build and of about 15-20% for the class libs (both on GNU/Linux).
13191 * report.cs (Timer): New class to get enhanced profiling. This
13192 whole class is "TIMER" conditional since it remarkably slows down
13195 * class.cs (MemberList): New class. This is an IList wrapper
13196 which we're now using instead of passing MemberInfo[]'s around to
13197 avoid copying this array unnecessarily.
13198 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13199 (ICachingMemberFinder, IMemberContainer): New interface.
13200 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13201 has already been checked, otherwise use it for the name comparision.
13202 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13203 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13204 if possible. Returns a MemberList, not a MemberInfo [].
13205 (TypeHandle): New class, implements IMemberContainer. We create
13206 one instance of this class per type, it contains a MemberCache
13207 which is used to do the member lookups.
13208 (MemberCache): New class. Each instance of this class contains
13209 all members of a type and a name-based hash table.
13210 (MemberCache.FindMembers): This is our new member lookup
13211 function. First, it looks up all members of the requested name in
13212 the hash table. Then, it walks this list and sorts out all
13213 applicable members and returns them.
13215 2002-08-13 Martin Baulig <martin@gnome.org>
13217 In addition to a nice code cleanup, this gives us a performance
13218 increase of about 1.4% on GNU/Linux - not much, but it's already
13219 half a second for the self-hosting MCS compilation.
13221 * typemanager.cs (IMemberFinder): New interface. It is used by
13222 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13223 Enum, Delegate or Interface.
13224 (TypeManager.finder_to_member_finder): New PtrHashtable.
13225 (TypeManager.finder_to_container): Removed.
13226 (TypeManager.finder_to_delegate): Removed.
13227 (TypeManager.finder_to_interface): Removed.
13228 (TypeManager.finder_to_enum): Removed.
13230 * interface.cs (Interface): Implement IMemberFinder.
13232 * delegate.cs (Delegate): Implement IMemberFinder.
13234 * enum.cs (Enum): Implement IMemberFinder.
13236 * class.cs (TypeContainer): Implement IMemberFinder.
13238 2002-08-12 Martin Baulig <martin@gnome.org>
13240 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13242 2002-08-12 Martin Baulig <martin@gnome.org>
13244 * ecore.cs (ITypeExpression): New interface for expressions which
13246 (TypeExpression): Renamed to TypeLookupExpression.
13247 (Expression.DoResolve): If we're doing a types-only lookup, the
13248 expression must implement the ITypeExpression interface and we
13249 call DoResolveType() on it.
13250 (SimpleName): Implement the new ITypeExpression interface.
13251 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13252 hack, the situation that we're only looking up types can't happen
13253 anymore when this method is called. Moved the type lookup code to
13254 DoResolveType() and call it.
13255 (SimpleName.DoResolveType): This ITypeExpression interface method
13256 is now doing the types-only lookup.
13257 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13258 (ResolveFlags): Added MaskExprClass.
13260 * expression.cs (MemberAccess): Implement the ITypeExpression
13262 (MemberAccess.DoResolve): Added support for a types-only lookup
13263 when we're called via ITypeExpression.DoResolveType().
13264 (ComposedCast): Implement the ITypeExpression interface.
13266 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13267 Expression.Resolve() with ResolveFlags.Type instead.
13269 2002-08-12 Martin Baulig <martin@gnome.org>
13271 * interface.cs (Interface.Define): Apply attributes.
13273 * attribute.cs (Attribute.ApplyAttributes): Added support for
13274 interface attributes.
13276 2002-08-11 Martin Baulig <martin@gnome.org>
13278 * statement.cs (Block.Emit): Only check the "this" variable if we
13279 do not always throw an exception.
13281 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13282 whether the property has a set accessor.
13284 2002-08-11 Martin Baulig <martin@gnome.org>
13286 Added control flow analysis support for structs.
13288 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13289 with control flow analysis turned off.
13290 (IVariable): New interface.
13291 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13292 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13293 (FieldExpr.DoResolve): Resolve the instance expression with flow
13294 analysis turned off and do the definite assignment check after the
13295 resolving when we know what the expression will resolve to.
13297 * expression.cs (LocalVariableReference, ParameterReference):
13298 Implement the new IVariable interface, only call the flow analysis
13299 code if ec.DoFlowAnalysis is true.
13300 (This): Added constructor which takes a Block argument. Implement
13301 the new IVariable interface.
13302 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13303 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13304 This does the definite assignment checks for struct members.
13306 * class.cs (Constructor.Emit): If this is a non-static `struct'
13307 constructor which doesn't have any initializer, call
13308 Block.AddThisVariable() to tell the flow analysis code that all
13309 struct elements must be initialized before control returns from
13312 * statement.cs (MyStructInfo): New public class.
13313 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13314 argument to this indexer. If non-zero, check an individual struct
13315 member, not the whole struct.
13316 (FlowBranching.CheckOutParameters): Check struct members.
13317 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13318 overloaded versions of these methods which take an additional
13319 `int field_idx' argument to check struct members.
13320 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13321 overloaded versions of these methods which take an additional
13322 `string field_name' argument to check struct member.s
13323 (VariableInfo): Implement the IVariable interface.
13324 (VariableInfo.StructInfo): New public property. Returns the
13325 MyStructInfo instance of the variable if it's a struct or null.
13326 (Block.AddThisVariable): New public method. This is called from
13327 Constructor.Emit() for non-static `struct' constructor which do
13328 not have any initializer. It creates a special variable for the
13329 "this" instance variable which will be checked by the flow
13330 analysis code to ensure that all of the struct's fields are
13331 initialized before control returns from the constructor.
13332 (UsageVector): Added support for struct members. If a
13333 variable/parameter is a struct with N members, we reserve a slot
13334 in the usage vector for each member. A struct is considered fully
13335 initialized if either the struct itself (slot 0) or all its
13336 members are initialized.
13338 2002-08-08 Martin Baulig <martin@gnome.org>
13340 * driver.cs (Driver.MainDriver): Only report an error CS5001
13341 if there were no compilation errors.
13343 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13344 `UnsafeContext' property to determine whether the parent is in
13345 unsafe context rather than checking the parent's ModFlags:
13346 classes nested in an unsafe class are unsafe as well.
13348 2002-08-08 Martin Baulig <martin@gnome.org>
13350 * statement.cs (UsageVector.MergeChildren): Distinguish between
13351 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13352 we return. Added test17() and test18() to test-154.cs.
13354 2002-08-08 Martin Baulig <martin@gnome.org>
13356 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13357 Family access, make sure the invoking type isn't a subclass of the
13358 queried type (that'd be a CS1540).
13360 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13361 this method which takes an additional `Type invocation_type'.
13363 * expression.cs (BaseAccess.DoResolve): Use the base type as
13364 invocation and query type.
13365 (MemberAccess.DoResolve): If the lookup failed and we're about to
13366 report a CS0122, try a lookup with the ec.ContainerType - if this
13367 succeeds, we must report a CS1540.
13369 2002-08-08 Martin Baulig <martin@gnome.org>
13371 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13372 (MethodGroupExpr): Implement the IMemberExpr interface.
13374 * expression (MemberAccess.ResolveMemberAccess): No need to have
13375 any special code for MethodGroupExprs anymore, they're now
13378 2002-08-08 Martin Baulig <martin@gnome.org>
13380 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13381 Family, FamANDAssem and FamORAssem permissions.
13382 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13384 2002-08-08 Martin Baulig <martin@gnome.org>
13386 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13387 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13390 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13392 * driver.cs: implemented /resource option to embed managed resources.
13394 2002-08-07 Martin Baulig <martin@gnome.org>
13396 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13397 (FieldBase.HasFieldInitializer): New public property.
13398 (FieldBase.GetInitializerExpression): New public method. Resolves and
13399 returns the field initializer and makes sure it is only resolved once.
13400 (TypeContainer.EmitFieldInitializers): Call
13401 FieldBase.GetInitializerExpression to get the initializer, this ensures
13402 that it isn't resolved multiple times.
13404 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13405 the resolving process (SimpleName/MemberLookup) that we're currently
13406 emitting a field initializer (which must not access any instance members,
13407 this is an error CS0236).
13409 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13410 argument, if the `IsFieldInitializer' flag is set, we must report and
13411 error CS0236 and not an error CS0120.
13413 2002-08-07 Martin Baulig <martin@gnome.org>
13415 * ecore.cs (IMemberExpr): New public interface.
13416 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13417 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13418 if the expression is an IMemberExpr.
13420 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13421 to be null, implicitly default to `this' if we're non-static in
13422 this case. Simplified the code a lot by using the new IMemberExpr
13423 interface. Also fixed bug #28176 here.
13425 2002-08-06 Martin Baulig <martin@gnome.org>
13427 * cs-parser.jay (SimpleLookup): Removed. We need to create
13428 ParameterReferences during semantic analysis so that we can do a
13429 type-only search when resolving Cast, TypeOf and SizeOf.
13430 (block): Pass the `current_local_parameters' to the Block's
13433 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13434 argument to the constructor.
13435 (ConstructorInitializer.Resolve): Create a temporary implicit
13436 block with the parameters.
13438 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13439 references here if we aren't doing a type-only search.
13441 * statement.cs (Block): Added constructor which takes a
13442 `Parameters parameters' argument.
13443 (Block.Parameters): New public property.
13445 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13446 to `Parameters' and made it public readonly.
13448 2002-08-06 Martin Baulig <martin@gnome.org>
13450 * ecore.cs (Expression.Warning): Made this public as well.
13452 * report.cs (Report.Debug): Print the contents of collections.
13454 2002-08-06 Martin Baulig <martin@gnome.org>
13456 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13457 used to tell Resolve() which kinds of expressions it may return.
13458 (Expression.Resolve): Added overloaded version of this method which
13459 takes a `ResolveFlags flags' argument. This can be used to tell
13460 Resolve() which kinds of expressions it may return. Reports a
13462 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13463 ResolveFlags.SimpleName.
13464 (Expression.Error118): Added overloaded version of this method which
13465 takes a `ResolveFlags flags' argument. It uses the flags to determine
13466 which kinds of expressions are allowed.
13468 * expression.cs (Argument.ResolveMethodGroup): New public method.
13469 Resolves an argument, but allows a MethodGroup to be returned.
13470 This is used when invoking a delegate.
13472 * TODO: Updated a bit.
13474 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13476 Fixed compilation with csc.
13478 * ecore.cs: Expression.Error made public. Is this correct? Should
13479 Warning be made public too?
13481 * expression.cs: use ea.Location instead of ea.loc.
13482 [FIXME: Filed as bug #28607: MCS must report these errors.]
13484 2002-08-06 Martin Baulig <martin@gnome.org>
13486 * ecore.cs (Expression.loc): Moved the location here instead of
13487 duplicating it in all derived classes.
13488 (Expression.Location): New public property.
13489 (Expression.Error, Expression.Warning): Made them non-static and
13490 removed the location argument.
13491 (Expression.Warning): Added overloaded version which takes an
13492 `int level' argument.
13493 (Expression.Error118): Make this non-static and removed the
13494 expression and location arguments.
13495 (TypeExpr): Added location argument to the constructor.
13497 * expression.cs (StaticCallExpr): Added location argument to
13499 (Indirection, PointerArithmetic): Likewise.
13500 (CheckedExpr, UnCheckedExpr): Likewise.
13501 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13502 (StringPtr): Likewise.
13505 2002-08-05 Martin Baulig <martin@gnome.org>
13507 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13509 * assign.cs (Assign.DoResolve): Check whether the source
13510 expression is a value or variable.
13512 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13513 while resolving the corresponding blocks.
13515 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13516 an error, don't silently return null.
13518 * statement.cs (Block.AddVariable): Do the error reporting here
13519 and distinguish between CS0128 and CS0136.
13520 (Block.DoResolve): Report all unused labels (warning CS0164).
13521 (LabeledStatement): Pass the location to the constructor.
13522 (LabeledStatement.HasBeenReferenced): New property.
13523 (LabeledStatement.Resolve): Set it to true here.
13525 * statement.cs (Return.Emit): Return success even after reporting
13526 a type mismatch error (CS0126 or CS0127), this is what csc does and
13527 it avoids confusing the users with any consecutive errors.
13529 2002-08-05 Martin Baulig <martin@gnome.org>
13531 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13533 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13535 * expression.cs (MemberAccess.DoResolve): Silently return if an
13536 error has already been reported.
13538 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13539 error has already been reported.
13541 2002-08-05 Martin Baulig <martin@gnome.org>
13543 * statement.cs (UsageVector): Only initialize the `parameters'
13544 vector if we actually have any "out" parameters.
13546 2002-08-05 Martin Baulig <martin@gnome.org>
13548 * expression.cs (Binary.ResolveOperator): When combining delegates,
13549 they must have the same type.
13551 2002-08-05 Martin Baulig <martin@gnome.org>
13553 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13554 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13555 work with the ms runtime and we also don't need it: if we're a
13556 PropertyBuilder and not in the `indexer_arguments' hash, then we
13557 are a property and not an indexer.
13559 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13560 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13561 since the latter one doesn't work with the ms runtime.
13563 2002-08-03 Martin Baulig <martin@gnome.org>
13565 Fixed bugs #27998 and #22735.
13567 * class.cs (Method.IsOperator): New public field.
13568 (Method.CheckBase): Report CS0111 if there's already a method
13569 with the same parameters in the current class. Report CS0508 when
13570 attempting to change the return type of an inherited method.
13571 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13572 and it's not marked abstract or extern.
13573 (PropertyBase): New abstract base class for Property and Indexer.
13574 (PropertyBase.CheckBase): Moved here from Property and made it work
13576 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13577 the same so we can reuse it there.
13578 (Property, Indexer): Derive from PropertyBase.
13579 (MethodSignature.inheritable_property_signature_filter): New delegate
13580 to find properties and indexers.
13582 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13583 argument and improved error reporting.
13585 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13586 EmptyReadOnlyParameters and made it a property.
13588 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13589 version of this method which takes a `PropertyInfo indexer'.
13590 (TypeManager.RegisterIndexer): New method.
13592 * class.cs: Added myself as author of this file :-)
13594 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13596 * class.cs: fixed compilation on windoze.
13598 2002-08-03 Martin Baulig <martin@gnome.org>
13600 * interface.cs (Interface.GetInterfaceBases): Check whether all
13601 base interfaces are at least as accessible than the current one.
13603 * class.cs (TypeContainer.GetClassBases): Check whether base types
13604 are at least as accessible than the current type.
13605 (TypeContainer.AsAccessible): Implemented and made non-static.
13606 (MemberBase.CheckParameters): Report errors if the accessibility
13609 * delegate.cs (Delegate.Delegate): The default visibility is
13610 internal for top-level types and private for nested types.
13611 (Delegate.Define): Report errors if the accessibility checks fail.
13613 * enum.cs (Enum.Enum): The default visibility is internal for
13614 top-level types and private for nested types.
13615 (Enum.DefineType): Compute the correct visibility.
13617 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13618 function which takes a `bool is_toplevel' instead of a TypeContainer.
13620 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13623 2002-08-02 Martin Baulig <martin@gnome.org>
13625 * expression.cs (LocalVariableReferenc): Added constructor which
13626 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13627 (LocalVariableReference.IsReadOnly): New property.
13628 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13629 variable is readonly, use our own readonly flag to do this; you can
13630 use the new constructor to get a writable reference to a read-only
13633 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13634 reference to the local variable.
13636 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13638 * rootcontext.cs (ResolveCore): Also include System.Exception
13640 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13641 we reach an EmptyStatement.
13643 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13646 * expression.cs (Binary.ResolveOperator): Check error result in
13649 use brtrue/brfalse directly and avoid compares to null.
13651 2002-08-02 Martin Baulig <martin@gnome.org>
13653 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13654 Fixes bug #28407, added test-155.cs.
13656 2002-08-01 Martin Baulig <martin@gnome.org>
13658 * class.cs (Event.EmitDefaultMethod): Make this work with static
13659 events. Fixes #28311, added verify-3.cs.
13661 2002-08-01 Martin Baulig <martin@gnome.org>
13663 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13664 `is_disposable' fields.
13665 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13666 `hm.is_disposable' if we're using the collection pattern.
13667 (Foreach.EmitCollectionForeach): Use the correct type for the
13668 enumerator's local variable, only emit the try/finally block if
13669 necessary (fixes #27713).
13671 2002-08-01 Martin Baulig <martin@gnome.org>
13673 * ecore.cs (Expression.report118): Renamed to Error118 and made
13676 * statement.cs (Throw.Resolve): Check whether the expression is of
13677 the correct type (CS0118) and whether the type derives from
13678 System.Exception (CS0155).
13679 (Catch.Resolve): New method. Do the type lookup here and check
13680 whether it derives from System.Exception (CS0155).
13681 (Catch.CatchType, Catch.IsGeneral): New public properties.
13683 * typemanager.cs (TypeManager.exception_type): Added.
13685 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13687 * driver.cs: Updated About function.
13689 2002-07-31 Martin Baulig <martin@gnome.org>
13691 Implemented Control Flow Analysis.
13693 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13694 (EmitContext.CurrentBranching): Added.
13695 (EmitContext.StartFlowBranching): Added.
13696 (EmitContext.EndFlowBranching): Added.
13697 (EmitContext.KillFlowBranching): Added.
13698 (EmitContext.IsVariableAssigned): Added.
13699 (EmitContext.SetVariableAssigned): Added.
13700 (EmitContext.IsParameterAssigned): Added.
13701 (EmitContext.SetParameterAssigned): Added.
13702 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13703 Added control flow analysis stuff here.
13705 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13706 resolve the expression as lvalue.
13707 (LocalVariableReference.DoResolve): Check whether the variable has
13708 already been assigned.
13709 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13710 the parameter as assigned here.
13711 (ParameterReference.DoResolve): Check whether the parameter has already
13713 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13714 expression as lvalue.
13716 * statement.cs (FlowBranching): New class for the flow analysis code.
13717 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13718 (LabeledStatement.IsDefined): New public property.
13719 (LabeledStatement.AddUsageVector): New public method to tell flow
13720 analyis that the label may be reached via a forward jump.
13721 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13723 (VariableInfo.Number): New public field. This is used by flow analysis
13724 to number all locals of a block.
13725 (Block.CountVariables): New public property. This is the number of
13726 local variables in this block (including the locals from all parent
13728 (Block.EmitMeta): Number all the variables.
13730 * statement.cs: Added flow analysis support to all classes.
13732 2002-07-31 Martin Baulig <martin@gnome.org>
13734 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13735 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13736 then use this argument.
13738 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13740 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13741 use this to specify /define options.
13743 2002-07-29 Martin Baulig <martin@gnome.org>
13745 * statement.cs (Fixed): Moved all code that does variable lookups
13746 and resolvings from Emit to Resolve.
13748 * statement.cs (For): Moved all code that does variable lookups
13749 and resolvings from Emit to Resolve.
13751 * statement.cs (Using): Moved all code that does variable lookups
13752 and resolvings from Emit to Resolve.
13754 2002-07-29 Martin Baulig <martin@gnome.org>
13756 * attribute.cs (Attribute.Resolve): Explicitly catch a
13757 System.NullReferenceException when creating the
13758 CustromAttributeBuilder and report a different warning message.
13760 2002-07-29 Martin Baulig <martin@gnome.org>
13762 * support.cs (ParameterData.ParameterName): Added method to
13763 get the name of a parameter.
13765 * typemanager.cs (TypeManager.IsValueType): New public method.
13767 2002-07-29 Martin Baulig <martin@gnome.org>
13769 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13770 is a flag which specifies that it's either ref or out.
13771 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13772 the out parameter to `out Parameter.Modifier mod', also set the
13773 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13775 * support.cs (InternalParameters.ParameterModifier): Distinguish
13776 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13777 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13779 * expression.cs (Argument.GetParameterModifier): Distinguish
13780 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13781 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13783 2002-07-29 Martin Baulig <martin@gnome.org>
13785 * expression.cs (ParameterReference.ParameterReference): Added
13786 `Location loc' argument to the constructor.
13788 * cs-parser.jay: Pass location to ParameterReference.
13790 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13792 * statement.cs (Try): Initialize the location.
13794 * cs-parser.jay: pass location to Try.
13796 * expression.cs (Unary.Reduce): Change the prototype to return
13797 whether a constant fold could be performed or not. The result is
13798 returned in an out parameters. In the case of Indirection and
13799 AddressOf, we want to perform the full tests.
13801 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13803 * statement.cs (Statement.Emit): Flag dead code.
13805 2002-07-27 Andrew Birkett <andy@nobugs.org>
13807 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13809 2002-07-27 Martin Baulig <martin@gnome.org>
13811 * class.cs (MethodData.Define): Put back call to
13812 TypeManager.AddMethod(), accidentally commented this out.
13814 * report.cs (Debug): New public method to print debugging information,
13815 this is `[Conditional ("DEBUG")]'.
13817 2002-07-26 Martin Baulig <martin@gnome.org>
13819 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13820 (switch_statement): Push the current_block to the switch_stack and
13821 pop it again when we're done with the switch.
13822 (switch_section): The new block is a child of the current_block.
13823 Fixes bug #24007, added test-152.cs.
13825 2002-07-27 Martin Baulig <martin@gnome.org>
13827 * expression.cs (Invocation.EmitArguments): When calling a varargs
13828 function with only its fixed arguments, we need to pass an empty
13831 2002-07-27 Martin Baulig <martin@gnome.org>
13833 Mono 0.13 has been released.
13835 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13837 * driver.cs: Rename --resource to --linkres, because that is what
13838 we do currently, we dont support --resource yet.
13840 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13842 2002-07-25 Martin Baulig <martin@gnome.org>
13844 * class.cs (MethodData): New public class. This is a `method builder'
13845 class for a method or one accessor of a Property/Indexer/Event.
13846 (MethodData.GetMethodFlags): Moved here from MemberBase.
13847 (MethodData.ApplyAttributes): Likewise.
13848 (MethodData.ApplyObsoleteAttribute): Likewise.
13849 (MethodData.ApplyConditionalAttribute): Likewise.
13850 (MethodData.ApplyDllImportAttribute): Likewise.
13851 (MethodData.CheckAbstractAndExternal): Likewise.
13852 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13853 (MethodData.Emit): Formerly known as Method.Emit().
13854 (MemberBase): Moved everything which was specific to a single
13855 accessor/method to MethodData.
13856 (Method): Create a new MethodData and call Define() and Emit() on it.
13857 (Property, Indexer, Event): Create a new MethodData objects for each
13858 accessor and call Define() and Emit() on them.
13860 2002-07-25 Martin Baulig <martin@gnome.org>
13862 Made MethodCore derive from MemberBase to reuse the code from there.
13863 MemberBase now also checks for attributes.
13865 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13866 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13868 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13869 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13870 (MemberBase.ApplyAttributes): New virtual method; applies the
13871 attributes to a method or accessor.
13872 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13873 (MemberBase.ApplyConditionalAttribute): Likewise.
13874 (MemberBase.ApplyDllImportAttribute): Likewise.
13875 (MemberBase.CheckAbstractAndExternal): Likewise.
13876 (MethodCore.ParameterTypes): This is now a property instead of a
13877 method, it's initialized from DoDefineParameters().
13878 (MethodCore.ParameterInfo): Removed the set accessor.
13879 (MethodCore.DoDefineParameters): New protected virtual method to
13880 initialize ParameterTypes and ParameterInfo.
13881 (Method.GetReturnType): We can now simply return the MemberType.
13882 (Method.GetMethodFlags): Override the MemberBase version and add
13883 the conditional flags.
13884 (Method.CheckBase): Moved some code from Define() here, call
13885 DoDefineParameters() here.
13886 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13887 here to avoid some larger code duplication.
13888 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13889 ensure that abstract and external accessors don't declare a body.
13891 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13892 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13893 lookup in the attribute's parent classes, so we need to abort as soon
13894 as we found the first match.
13895 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13896 the attribute has no arguments.
13898 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13901 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13903 * cs-parser.jay: reverted previous patch.
13905 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13907 * cs-parser.jay: fixed bug #22119.
13909 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13911 * attribute.cs: fixed compilation. The error was:
13912 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13913 be assigned to before control leaves the current method."
13914 [FIXME: Filed as bug #28186: MCS must report this error.]
13916 2002-07-25 Martin Baulig <martin@gnome.org>
13918 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13919 method to pull the condition name ouf of a Conditional attribute.
13920 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13921 the obsolete message and error flag out of an Obsolete attribute.
13923 * class.cs (Method.GetMethodFlags): New public method to get the
13924 TypeManager.MethodFlags for this method.
13925 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13927 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13928 if we're overriding a virtual function, set the new private variable
13929 `parent_method'; call the new TypeManager.AddMethod().
13931 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
13932 the MethodBuilder and the Method in a PtrHashtable.
13933 (TypeManager.builder_to_method): Added for this purpose.
13934 (TypeManager.MethodFlags): Added IsObsoleteError.
13935 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
13936 Obsolete and Conditional arguments in MethodBuilders. If we discover
13937 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
13938 the message from the attribute.
13940 2002-07-24 Martin Baulig <martin@gnome.org>
13942 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
13943 preprocessor directives, ensure that the argument to #define/#undef is
13944 exactly one identifier and that it's actually an identifier.
13946 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
13949 2002-07-24 Martin Baulig <martin@gnome.org>
13951 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
13952 initialize it to TypeManager.object_type in the constructor.
13953 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
13954 of the `hm.get_current' method if we're using the collection pattern.
13955 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
13956 for the explicit conversion to make it work when we're using the collection
13957 pattern and the `Current' property has a different return type than `object'.
13960 2002-07-24 Martin Baulig <martin@gnome.org>
13962 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
13963 does not match, but don't report any errors. This method is called in
13964 order for all methods in a MethodGroupExpr until a matching method is
13965 found, so we don't want to bail out if the first method doesn't match.
13966 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
13967 matches, report the 123. Fixes #28070.
13969 2002-07-24 Martin Baulig <martin@gnome.org>
13971 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
13972 TypeManager.TypeToCoreType() to the top of the method so the
13973 following equality checks will work. Fixes #28107.
13975 2002-07-24 Martin Baulig <martin@gnome.org>
13977 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
13978 operand is of type uint, and the other operand is of type sbyte,
13979 short or int, the operands are converted to type long." -
13980 Actually do what this comment already told us. Fixes bug #28106,
13983 2002-07-24 Martin Baulig <martin@gnome.org>
13985 * class.cs (MethodBase): New abstract class. This is now a base
13986 class for Property, Indexer and Event to avoid some code duplication
13987 in their Define() and DefineMethods() methods.
13988 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
13989 generic methods for Define() and DefineMethods().
13990 (FieldBase): Derive from MemberBase, not MemberCore.
13991 (Property): Derive from MemberBase, not MemberCore.
13992 (Property.DefineMethod): Moved all the code from this method to the
13993 new MethodBase.DefineAccessor(), just call it with appropriate
13995 (Property.Define): Call the new Property.DoDefine(), this does some
13996 sanity checks and we don't need to duplicate the code everywhere.
13997 (Event): Derive from MemberBase, not MemberCore.
13998 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
13999 accessors, this will also make them work with interface events.
14000 (Indexer): Derive from MemberBase, not MemberCore.
14001 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14002 (Indexer.Define): Use the new MethodBase functions.
14004 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14005 argument to the constructor.
14006 (Interface.FindMembers): Added support for interface events.
14007 (Interface.PopluateEvent): Implemented.
14009 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14011 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14013 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14014 but this is required to check for a method name being the same as
14015 the containing class.
14019 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14021 * interface.cs: initialize variable.
14023 2002-07-23 Martin Baulig <martin@gnome.org>
14025 Implemented the IndexerName attribute in interfaces.
14027 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14028 name if this is an explicit interface implementation.
14029 (Indexer.InterfaceIndexerName): New public variable. If we're
14030 implementing an interface indexer, this is the IndexerName in that
14031 interface. Otherwise, it's the IndexerName.
14032 (Indexer.DefineMethod): If we're implementing interface indexer,
14033 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14034 and Pending.ImplementIndexer methods.
14035 (Indexer.Define): Also define the PropertyBuilder if we're
14036 implementing an interface indexer and this is neither an explicit
14037 interface implementation nor do the IndexerName match the one in
14040 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14041 If a method is defined here, then we always need to create a proxy
14042 for it. This is used when implementing interface indexers.
14043 (Pending.IsInterfaceIndexer): New public method.
14044 (Pending.ImplementIndexer): New public method.
14045 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14046 This is used when implementing interface indexers to define a proxy
14048 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14049 define a proxy if necessary.
14051 * interface.cs (Interface.IndexerName): New public variable.
14052 (Interface.PopulateIndexer): Set the IndexerName.
14053 (Interface.DefineIndexers): New private method. Populate all the
14054 indexers and make sure their IndexerNames match.
14056 * typemanager.cs (IndexerPropertyName): Added support for interface
14059 2002-07-22 Martin Baulig <martin@gnome.org>
14061 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14062 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14063 ret if HasReturnLabel.
14064 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14067 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14068 and set the ec.LoopBeginTryCatchLevel.
14069 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14070 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14071 the current ec.TryCatchLevel, the branch goes out of an exception
14072 block. In this case, we need to use Leave and not Br.
14074 2002-07-22 Martin Baulig <martin@gnome.org>
14076 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14077 block unless the block does not always return or it is contained in
14078 another try { ... } catch { ... } block. Fixes bug #26506.
14079 Added verify-1.cs to the test suite.
14081 2002-07-22 Martin Baulig <martin@gnome.org>
14083 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14084 then we do not always return. Fixes bug #24985.
14086 2002-07-22 Martin Baulig <martin@gnome.org>
14088 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14089 lookup on a per-class level; ie. walk up the class hierarchy until we
14090 found at least one applicable method, then choose the best among them.
14091 Fixes bug #24463 and test-29.cs.
14093 2002-07-22 Martin Baulig <martin@gnome.org>
14095 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14096 return types of the methods. The return type is not part of the
14097 signature and we must not check it to make the `new' modifier work.
14098 Fixes bug #27999, also added test-147.cs.
14099 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14101 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14102 on the method's return type.
14104 2002-07-21 Martin Baulig <martin@gnome.org>
14106 * assign.cs: Make this work if the rightmost source is a constant and
14107 we need to do an implicit type conversion. Also adding a few more tests
14108 to test-38.cs which should have caught this.
14110 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14111 target in the makefile for this. The makefile.gnu is primarily intended
14112 for end-users who don't want to debug the compiler.
14114 2002-07-21 Martin Baulig <martin@gnome.org>
14116 * assign.cs: Improved the Assign class so it can now handle embedded
14117 assignments (X = Y = Z = something). As a side-effect this'll now also
14118 consume less local variables. test-38.cs now passes with MCS, added
14119 a few new test cases to that test.
14121 2002-07-20 Martin Baulig <martin@gnome.org>
14123 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14124 instructions. Fixes bug #27977, also added test-146.cs.
14126 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14128 * cs-tokenizer.cs: fixed getHex ().
14130 2002-07-19 Martin Baulig <martin@gnome.org>
14132 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14133 not Type.GetType() to lookup the array type. This is needed when
14134 we're constructing an array of a user-defined type.
14135 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14136 single-dimensional arrays, but also for single-dimensial arrays of
14139 2002-07-19 Martin Baulig <martin@gnome.org>
14141 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14142 this function is called, it's not allowed to share LocalBuilders
14143 among ILGenerators.
14145 2002-07-19 Martin Baulig <martin@gnome.org>
14147 * expression.cs (Argument.Resolve): Report an error 118 when trying
14148 to pass a type as argument.
14150 2002-07-18 Martin Baulig <martin@gnome.org>
14152 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14153 Conv_R_Un for the signed `long' type.
14155 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14157 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14158 `expr' for the temporary result, as that will fail if we do
14159 multiple resolves on the same expression.
14161 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14163 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14164 ec.TypeContainer for looking up aliases.
14166 * class.cs (TypeContainer): Remove LookupAlias from here.
14168 * decl.cs (DeclSpace); Move here.
14170 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14172 * class.cs (FindMembers): Only call filter if the constructor
14173 bulider is not null.
14175 Also handle delegates in `NestedTypes' now. Now we will perform
14176 type lookups using the standard resolution process. This also
14179 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14180 This uses Expressions (the limited kind that can be parsed by the
14181 tree) instead of strings.
14183 * expression.cs (ComposedCast.ToString): Implement, used to flag
14184 errors since now we have to render expressions.
14186 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14189 * ecore.cs (SimpleName.ToString): ditto.
14191 * cs-parser.jay: Instead of using strings to assemble types, use
14192 Expressions to assemble the type (using SimpleName, ComposedCast,
14193 MemberAccess). This should fix the type lookups in declarations,
14194 because we were using a different code path for this.
14196 * statement.cs (Block.Resolve): Continue processing statements
14197 even when there is an error.
14199 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14201 * class.cs (Event.Define): Also remove the `remove' method from
14202 the list of pending items.
14204 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14205 generate more compact code.
14207 2002-07-17 Martin Baulig <martin@gnome.org>
14209 * const.cs (Const.LookupConstantValue): Add support for constant
14210 `unchecked' and `checked' expressions.
14211 Also adding test case test-140.cs for this.
14213 2002-07-17 Martin Baulig <martin@gnome.org>
14215 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14216 check whether mi.ReturnType implements the IEnumerator interface; the
14217 `==' and the IsAssignableFrom() will fail in this situation.
14219 2002-07-16 Ravi Pratap <ravi@ximian.com>
14221 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14224 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14226 * expression.cs: fixed bug #27811.
14228 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14230 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14231 Molaro: when we are a ref, the value already contains a pointer
14232 value, do not take the address of it.
14234 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14235 * removed mb-parser.jay and mb-tokenizer.cs
14237 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14239 * expression.cs: check against the building corlib void type.
14241 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14243 * ecore.cs: fix for valuetype static readonly fields: when
14244 initializing them, we need their address, not the address of a copy.
14246 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14248 * typemanager.cs: register also enum_type in corlib.
14250 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14252 * class.cs: allow calling this (but not base) initializers in structs.
14254 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14256 * ecore.cs: make sure we compare against the building base types
14259 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14261 * typemanager.cs: fix TypeToCoreType() to handle void and object
14262 (corlib gets no more typerefs after this change).
14264 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14266 * expression.cs (ArrayCreation.EmitArrayArguments): use
14267 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14269 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14270 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14271 array indexes, the runtime actually forbids them.
14273 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14274 for array arguments here.
14276 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14277 instead of the default for ValueTypes.
14279 (New.DoEmit): Use IsValueType instead of
14280 IsSubclassOf (value_type)
14281 (New.DoResolve): ditto.
14282 (Invocation.EmitCall): ditto.
14284 * assign.cs (Assign): ditto.
14286 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14287 Statements *are* currently doing part of their resolution during
14290 Expressions do always resolve during resolve, but statements are
14291 only required to propagate resolution to their children.
14293 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14295 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14297 (LoadAssembly): Do not add the dll if it is already specified
14299 (MainDriver): Add the System directory to the link path at the end,
14300 after all the other -L arguments.
14302 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14303 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14304 ldelem.u1) and using the opposite for sbytes.
14306 This fixes Digger, and we can finally run it.
14308 * driver.cs (UnixParseOption): Move the option parsing here.
14309 (CSCParseOption): Implement CSC-like parsing of options.
14311 We now support both modes of operation, the old Unix way, and the
14312 new CSC-like way. This should help those who wanted to make cross
14313 platform makefiles.
14315 The only thing broken is that /r:, /reference: and /lib: are not
14316 implemented, because I want to make those have the same semantics
14317 as the CSC compiler has, and kill once and for all the confussion
14318 around this. Will be doing this tomorrow.
14320 * statement.cs (Unsafe.Resolve): The state is checked during
14321 resolve, not emit, so we have to set the flags for IsUnsfe here.
14323 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14325 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14326 not catch the Error_ObjectRefRequired in SimpleName (as it is
14327 possible to have a class/instance variable name that later gets
14328 deambiguated), we have to check this here.
14330 2002-07-10 Ravi Pratap <ravi@ximian.com>
14332 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14333 make static and put into Expression.
14335 (Event.Define): Register the private field of the event with the
14336 TypeManager so that GetFieldFromEvent can get at it.
14338 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14339 keep track of the private field associated with an event which
14342 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14345 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14347 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14349 * expression.cs (Binary.EmitBranchable): this routine emits the
14350 Binary expression in a branchable context. This basically means:
14351 we need to branch somewhere, not just get the value on the stack.
14353 This works together with Statement.EmitBoolExpression.
14355 * statement.cs (Statement.EmitBoolExpression): Use
14358 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14360 * statement.cs (For): Reduce the number of jumps in loops.
14362 (For): Implement loop inversion for the For statement.
14364 (Break): We can be breaking out of a Try/Catch controlled section
14365 (foreach might have an implicit try/catch clause), so we need to
14366 use Leave instead of Br.
14368 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14369 now). If the instace expression supports IMemoryLocation, we use
14370 the AddressOf method from the IMemoryLocation to extract the
14371 address instead of emitting the instance.
14373 This showed up with `This', as we were emitting the instance
14374 always (Emit) instead of the Address of This. Particularly
14375 interesting when This is a value type, as we dont want the Emit
14376 effect (which was to load the object).
14378 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14380 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14382 * statement.cs (Checked): Set the CheckedState during the resolve
14383 process too, as the ConvCast operations track the checked state on
14384 the resolve process, and not emit.
14386 * cs-parser.jay (namespace_member_declaration): Flag that we have
14387 found a declaration when we do. This is used to flag error 1529
14389 * driver.cs: Report ok when we display the help only.
14391 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14393 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14395 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14397 * cs-tokenizer.cs (define): We also have to track locally the
14398 defines. AllDefines is just used for the Conditional Attribute,
14399 but we also need the local defines for the current source code.
14401 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14403 * statement.cs (While, For, Do): These loops can exit through a
14404 Break statement, use this information to tell whether the
14405 statement is the last piece of code.
14407 (Break): Flag that we break.
14409 * codegen.cs (EmitContexts): New `Breaks' state variable.
14411 2002-07-03 Martin Baulig <martin@gnome.org>
14413 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14414 modifiers in method declarations in structs. Otherwise, you won't
14415 be able to override things like Object.Equals().
14417 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14419 * class.cs (Method, Property, Indexer): Do not allow the public
14420 modifier to be used in explicit interface implementations.
14422 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14423 override modifiers in method declarations in structs
14425 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14427 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14428 integer or real overflow, report an error
14430 2002-07-02 Martin Baulig <martin@gnome.org>
14432 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14433 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14434 to tell the runtime about our newly created System.Object and
14435 System.ValueType types.
14437 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14439 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14440 struct instead of Ldarg/Starg.
14442 2002-07-02 Martin Baulig <martin@gnome.org>
14444 * expression.cs (Indirection.Indirection): Call
14445 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14447 2002-07-02 Martin Baulig <martin@gnome.org>
14449 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14450 ValueType, call TypeManager.TypeToCoreType() on it.
14451 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14452 the OpCodes.Newarr argument.
14454 2002-07-02 Martin Baulig <martin@gnome.org>
14456 * expression.cs (Invocation.EmitCall): When compiling corlib,
14457 replace all calls to the system's System.Array type to calls to
14458 the newly created one.
14460 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14461 System.Array methods.
14462 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14463 from the system's System.Array type which must be replaced.
14465 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14467 * typemanager.cs: load unverifiable_code_ctor so we can build
14468 corlib using the correct type. Avoid using GetTypeCode() with
14470 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14471 TypeManager.object_type to allow building corlib.
14473 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14475 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14477 2002-07-01 Martin Baulig <martin@gnome.org>
14479 * class.cs: Make the last change actually work, we need to check
14480 whether `ifaces != null' to avoid a crash.
14482 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14484 * class.cs: when we build structs without fields that implement
14485 interfaces, we need to add the interfaces separately, since there is
14486 no API to both set the size and add the interfaces at type creation
14489 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14491 * expression.cs: the dimension arguments to the array constructors
14492 need to be converted if they are a long.
14494 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14496 * class.cs: don't emit ldarg.0 if there is no parent constructor
14497 (fixes showstopper for corlib).
14499 2002-06-29 Martin Baulig <martin@gnome.org>
14501 MCS now compiles corlib on GNU/Linux :-)
14503 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14504 ie. check for MethodImplOptions.InternalCall.
14506 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14507 and TypeManager.attribute_type are null, so we must explicitly check
14508 whether parent is not null to find out whether it's an attribute type.
14509 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14510 and SetBuilder, not only if the property is neither abstract nor external.
14511 This is necessary to set the MethodImplOptions on the accessor methods.
14512 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14513 SetBuilder, see Property.Emit().
14515 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14516 populate "System.Object", "System.ValueType" and "System.Attribute" since
14517 they've already been populated from BootCorlib_PopulateCoreTypes().
14519 2002-06-29 Martin Baulig <martin@gnome.org>
14521 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14522 is the NullLiteral, we also need to make sure that target_type is not
14525 2002-06-29 Martin Baulig <martin@gnome.org>
14527 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14528 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14529 before calling BootstrapCorlib_ResolveDelegate ().
14531 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14533 * statement.cs: fixed build-breaker. All tests passed ok.
14535 2002-06-27 Martin Baulig <martin@gnome.org>
14537 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14538 for System.Decimal when compiling corlib.
14540 2002-06-27 Martin Baulig <martin@gnome.org>
14542 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14543 switch blocks which contain nothing but a default clause.
14545 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14547 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14549 2002-06-27 Martin Baulig <martin@gnome.org>
14551 * ecore.cs (PropertyExpr.PropertyExpr): Call
14552 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14554 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14555 is already a TypeBuilder.
14557 2002-06-27 Martin Baulig <martin@gnome.org>
14559 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14560 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14561 the "from an array-type to System.Array" case. This makes it work
14562 when compiling corlib.
14564 2002-06-27 Martin Baulig <martin@gnome.org>
14566 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14567 non-static PropertyExpr, set its InstanceExpression. This makes
14568 the `ICollection.Count' property work in System/Array.cs.
14570 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14572 * driver.cs: Made error handling more consistent. Errors now
14573 tracked by Report class, so many methods which used to return int
14574 now return void. Main() now prints success/failure and
14575 errors/warnings message.
14577 Renamed '--probe' compiler argument to '--expect-error'. Removed
14578 the magic number return values (123 and 124). Now, if the
14579 expected error occurs, the compiler exits with success (exit value
14580 0). If the compilation completes without seeing that particular
14581 error, the compiler exits with failure (exit value 1). The
14582 makefile in mcs/errors has been changed to handle the new behaviour.
14584 * report.cs: Made 'expected error' number a property and renamed
14585 it from 'Probe' to 'ExpectedError'.
14587 * genericparser.cs: Removed error handling support, since it is
14588 now all done by Report class.
14590 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14591 class, so parse() no longer returns an int.
14593 * namespace.cs: Use Report.Error instead of GenericParser.error
14595 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14597 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14598 TypeContainer.AddOperator): At the front of the list put the
14599 explicit implementations, so they get resolved/defined first.
14601 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14603 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14604 interface type is implemented by this TypeContainer. Used during
14605 explicit interface implementation.
14607 (Property.Define, Indexer.Define, Method.Define): Validate that
14608 the given interface in the explicit implementation is one of the
14609 base classes for the containing type.
14611 Also if we are explicitly implementing an interface, but there is
14612 no match in the pending implementation table, report an error.
14614 (Property.Define): Only define the property if we are
14615 not explicitly implementing a property from an interface. Use the
14616 correct name also for those properties (the same CSC uses,
14617 although that is really not needed).
14619 (Property.Emit): Do not emit attributes for explicitly implemented
14620 properties, as there is no TypeBuilder.
14622 (Indexer.Emit): ditto.
14624 Hiding then means that we do not really *implement* a pending
14625 implementation, which makes code fail.
14627 2002-06-22 Martin Baulig <martin@gnome.org>
14629 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14630 the return value of Object.GetType(). [FIXME: we need to do this whenever
14631 we get a type back from the reflection library].
14633 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14635 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14637 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14639 * attribute.cs: Return null if we can not look up the type.
14641 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14642 the interface types found.
14644 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14645 interface types found.
14647 * typemanager.cs (GetInterfaces): Make this routine returns alll
14648 the interfaces and work around the lame differences between
14649 System.Type and System.Reflection.Emit.TypeBuilder in the results
14650 result for GetInterfaces.
14652 (ExpandInterfaces): Given an array of interface types, expand and
14653 eliminate repeated ocurrences of an interface. This expands in
14654 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14657 2002-06-21 Martin Baulig <martin@gnome.org>
14659 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14662 2002-06-21 Martin Baulig <martin@gnome.org>
14664 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14665 and called with one of the core types, return the corresponding typebuilder for
14668 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14671 2002-06-21 Martin Baulig <martin@gnome.org>
14673 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14674 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14675 (Expression.ConvertReferenceExplicit): Likewise.
14677 * expression.cs (ElementAccess.DoResolve): Likewise.
14678 (ElementAccess.DoResolveLValue): Likewise.
14680 2002-06-10 Martin Baulig <martin@gnome.org>
14682 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14683 add the "value" parameter to the parameter list.
14685 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14688 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14690 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14691 the argument to an int, uint, long or ulong, per the spec. Also
14692 catch negative constants in array creation.
14694 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14696 * class.cs: do not allow the same interface to appear twice in
14697 the definition list.
14699 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14701 * ecore.cs: don't use ldlen with System.Array.
14703 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14705 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14707 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14709 * modifiers.cs: produce correct field attributes for protected
14710 internal. Easy fix so miguel can work on ther harder stuff:-)
14712 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14714 * pending.cs: New file. Move the code from class.cs here.
14715 Support clearning the pending flag for all methods (when not doing
14716 explicit interface implementation).
14718 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14720 * rootcontext.cs: added a couple more types needed to bootstrap.
14722 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14724 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14725 constructor in the type, instead of any constructor in the type
14726 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14727 a bug in the Mono runtime when applying the params attribute).
14729 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14730 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14732 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14734 * expression.cs (Unary.ResolveOperator): Use TypeManager
14735 to resolve the type.
14737 2002-06-13 Ravi Pratap <ravi@ximian.com>
14739 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14742 * enum.cs (AddEnumMember): Add support to store the attributes associated
14743 with each member too.
14745 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14746 field builders too - this takes care of the enum member case.
14748 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14750 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14751 address-of operator on both value types and pointers.
14753 2002-06-10 Martin Baulig <martin@gnome.org>
14755 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14756 PropertyBuilder to the `property_builders' list.
14758 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14759 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14760 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14761 find any indexers which are inherited from an interface.
14763 2002-06-09 Martin Baulig <martin@gnome.org>
14765 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14766 the same type as the constant if necessary. There's also a test-130.cs
14769 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14771 * typemanager.cs (TypeManager.ChangeType): Previously known as
14772 Enum.ChangeEnumType().
14774 2002-06-09 Martin Baulig <martin@gnome.org>
14776 * expression.cs (Cast.TryReduce): Added support for consts.
14778 2002-06-08 Ravi Pratap <ravi@ximian.com>
14780 * class.cs (Accessor): Hold attributes information so we can pass
14783 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14784 Modify to pass in attributes attached to the methods.
14786 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14788 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14789 to handle the Accessor kind :-)
14791 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14793 2002-06-08 Martin Baulig <martin@gnome.org>
14795 * expression.cs (Unary.TryReduceNegative): Added support for
14798 2002-06-08 Martin Baulig <martin@gnome.org>
14800 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14801 name can't be found in the `defined_names' - the caller will do a
14802 MemberLookup in this case and thus find methods in System.Enum
14803 such as Enum.IsDefined().
14805 2002-06-08 Martin Baulig <martin@gnome.org>
14807 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14808 Convert.ChangeType() which works with TypeBuilder created types.
14809 (Enum.LookupEnumValue, Enum.Define): Use it here.
14811 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14812 `TypeBuilder.BaseType != null' check.
14813 (TypeContainer.FindMembers): Only lookup parent members if we
14814 actually have a parent.
14815 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14816 (ConstructorInitializer.Resolve): Likewise.
14818 * interface.cs (Interface.FindMembers): Added
14819 `TypeBuilder.BaseType != null' check.
14821 * rootcontext.cs (RootContext.ResolveCore): Added
14822 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14823 classes_second_stage.
14825 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14826 debug_type and trace_type when compiling with --nostdlib.
14828 2002-06-07 Martin Baulig <martin@gnome.org>
14830 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14831 (AddField): Set it to true when adding a non-static field.
14832 (DefineType): Use `have_nonstatic_fields' to find out whether we
14833 have non-static fields, not `Fields != null'.
14835 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14837 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14838 dereferencing a null on the static-field code path)
14840 2002-05-30 Martin Baulig <martin@gnome.org>
14842 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14843 to take command line arguments. Use reflection to call the new
14844 custom `Initialize' function on the symbol writer and pass it the
14845 command line arguments.
14847 * driver.cs (--debug-args): New command line argument to pass command
14848 line arguments to the symbol writer.
14850 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14852 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14853 the target type for indexers and properties. Thanks to Joe for
14856 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14858 * typemanager.cs (MethodFlags): returns the method flags
14859 (Obsolete/ShouldIgnore) that control warning emission and whether
14860 the invocation should be made, or ignored.
14862 * expression.cs (Invocation.Emit): Remove previous hack, we should
14863 not do this on matching a base type, we should do this based on an attribute
14865 Only emit calls to System.Diagnostics.Debug and
14866 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14867 on the command line.
14869 * rootcontext.cs: Global settings for tracing and debugging.
14871 * cs-tokenizer.cs (define): New utility function to track
14872 defines. Set the global settings for TRACE and DEBUG if found.
14874 2002-05-25 Ravi Pratap <ravi@ximian.com>
14876 * interface.cs (Populate*): Pass in the TypeContainer as well as
14877 the DeclSpace as parameters so that we can create EmitContexts and
14878 then use that to apply attributes etc.
14880 (PopulateMethod, PopulateEvent, PopulateProperty)
14881 (PopulateIndexer): Apply attributes everywhere.
14883 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14886 (ApplyAttributes): Update accordingly.
14888 We now apply interface attributes for all members too.
14890 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14892 * class.cs (Indexer.Define); Correctly check if we are explicit
14893 implementation (instead of checking the Name for a ".", we
14894 directly look up if the InterfaceType was specified).
14896 Delay the creation of the PropertyBuilder.
14898 Only create the PropertyBuilder if we are not an explicit
14899 interface implementation. This means that explicit interface
14900 implementation members do not participate in regular function
14901 lookups, and hence fixes another major ambiguity problem in
14902 overload resolution (that was the visible effect).
14904 (DefineMethod): Return whether we are doing an interface
14907 * typemanager.cs: Temporary hack until we get attributes in
14908 interfaces (Ravi is working on that) and we get IndexerName
14909 support in interfaces.
14911 * interface.cs: Register the indexers as properties.
14913 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14914 warning, I have verified that this is a bug in the .NET runtime
14915 (JavaScript suffers of the same problem).
14917 * typemanager.cs (MemberLookup): When looking up members for
14918 interfaces, the parent of an interface is the implicit
14919 System.Object (so we succeed in searches of Object methods in an
14920 interface method invocation. Example: IEnumerable x; x.ToString
14923 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14925 * class.cs (Event): Events should also register if they do
14926 implement the methods that an interface requires.
14928 * typemanager.cs (MemberLookup); use the new GetInterfaces
14931 (GetInterfaces): The code used to lookup interfaces for a type is
14932 used in more than one place, factor it here.
14934 * driver.cs: Track the errors at the bottom of the file, we kept
14937 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
14938 instance if the method we are calling is static!
14940 2002-05-24 Miguel de Icaza <miguel@ximian.com>
14942 * attribute.cs (ApplyAttributes): Make this function filter out
14943 the IndexerName attribute (as that attribute in reality is never
14944 applied) and return the string constant for the IndexerName
14947 * class.cs (TypeContainer.Emit): Validate that all the indexers
14948 have the same IndexerName attribute, and if so, set the
14949 DefaultName attribute on the class.
14951 * typemanager.cs: The return value might contain other stuff (not
14952 only methods). For instance, consider a method with an "Item"
14953 property and an Item method.
14955 * class.cs: If there is a problem with the parameter types,
14958 2002-05-24 Ravi Pratap <ravi@ximian.com>
14960 * ecore.cs (ImplicitConversionExists): Wrapper function which also
14961 looks at user defined conversion after making a call to
14962 StandardConversionExists - we need this for overload resolution.
14964 * expression.cs : Update accordingly the various method calls.
14966 This fixes 2 bugs filed against implicit user defined conversions
14968 2002-05-22 Miguel de Icaza <miguel@ximian.com>
14970 * statement.cs: Track the result of the assignment.
14972 2002-05-21 Miguel de Icaza <miguel@ximian.com>
14974 * expression.cs (MemberAccess): Improved error reporting for
14975 inaccessible members.
14977 2002-05-22 Martin Baulig <martin@gnome.org>
14979 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
14980 itself with debugging support.
14982 2002-05-22 Martin Baulig <martin@gnome.org>
14984 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
14985 Removed, this isn't needed anymore.
14987 2002-05-20 Martin Baulig <martin@gnome.org>
14989 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14990 be underlying type for an enum.
14992 2002-05-20 Miguel de Icaza <miguel@ximian.com>
14994 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14995 that splits out the loading of just the core types.
14997 * rootcontext.cs (ResolveCore): Split the struct resolution in
14998 two, so we can load the enumeration underlying types before any
15001 * expression.cs (Is): Bandaid until we fix properly Switch (see
15002 bug #24985 for details).
15004 * typemanager.cs (ImplementsInterface): The hashtable will contain
15005 a null if there are no interfaces implemented.
15007 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15009 * cs-parser.jay (indexer_declarator): It is fine to have array
15012 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15014 * typemanager.cs: (RegisterBuilder): New function used to register
15015 TypeBuilders that implement interfaces. Since
15016 TypeBuilder.GetInterfaces (as usual) does not work with lame
15018 (AddUserType): register interfaces.
15020 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15021 dealing with TypeBuilder. Also, arrays are showing up as
15022 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15023 methods can not be invoked on them!
15025 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15026 (ImplicitReferenceConversionExists): Split out from
15027 StandardConversionExists.
15029 * expression.cs (As): We were only implementing one of the three
15030 cases for the as operator. We now implement them all.
15031 (Is): Implement the various other cases for Is as well.
15033 * typemanager.cs (CACHE): New define used to control if we want or
15034 not the FindMembers cache. Seems to have a negative impact on
15035 performance currently
15037 (MemberLookup): Nested types have full acess to
15038 enclosing type members
15040 Remove code that coped with instance/static returns for events, we
15041 now catch this in RealFindMembers.
15043 (RealFindMembers): only perform static lookup if the instance
15044 lookup did not return a type or an event.
15046 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15048 * assign.cs (CompoundAssign): We pass more semantic information
15049 now to Compound Assignments than we did before: now we have all
15050 the information at hand, and now we resolve the target *before* we
15051 do the expression expansion, which allows the "CacheValue" method
15052 to have the effect we intended (before, a [x] += 1 would generate
15053 two differen ArrayAccess expressions from the ElementAccess,
15054 during the resolution process).
15056 (CompoundAssign.DoResolve): Resolve target and original_source here.
15058 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15060 * expression.cs (ArrayAccess): dropped debugging information.
15062 * typemanager.cs: Small bug fix: I was always returning i_members,
15063 instead of one of i_members or s_members (depending on which had
15066 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15067 method is invoked before any code generation takes place, and it
15068 is a mechanism to inform that the expression will be invoked more
15069 than once, and that the method should use temporary values to
15070 avoid having side effects
15072 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15074 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15077 * expression.cs (Indirection, ArrayAccess): Add support for
15078 CacheTemporaries in these two bad boys.
15080 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15081 ldobj or ldind_ref.
15082 (StoreFromPtr): Handle stobj as well.
15084 * expression.cs (UnaryMutator): Share more code.
15086 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15087 down: I was not tracking the Filter function as well, which
15088 was affecting the results of the cache.
15090 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15092 * attribute.cs: Remove the hack to handle the CharSet property on
15095 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15097 * attribute.cs (DoResolve): More uglyness, we now only try to
15098 resolve the attribute partially, to extract the CharSet
15099 information (only if we are a StructLayout attribute). Otherwise
15101 (GetExtraTypeInfo): Add some code to conditionally kill in the
15102 future this. I am more and more convinced that the .NET
15103 framework has special code to handle the attribute setting on
15106 * expression.cs (IsParamsMethodApplicable): Revert my previous
15107 foreach change here, it was wrong.
15109 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15111 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15112 (pp_expr): do not abort on unknown input, just return.
15113 (eval): abort if there are pending chars.
15115 * attribute.cs (Attribute.Resolve): Positional parameters are
15116 optional. Deal with that case.
15118 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15119 the Ansi/Unicode/Auto information for the type.
15121 (TypeContainer.DefineType): instantiate the EmitContext here, as
15122 we will be using it during the type definition (to resolve
15123 attributes) and during the emit phase.
15125 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15126 to pull type information out of the attributes
15128 (Attribute.Resolve): track the constructor builder, and allow for
15129 multiple invocations (structs and classes will use this).
15131 * ecore.cs (MemberLookupFinal): new version with all the
15132 parameters customizable.
15134 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15135 constructors. Return if the result value is null (as the error
15136 would have been flagged already by MemberLookupFinal)
15138 Do not allow instances of abstract classes or interfaces to be
15141 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15142 We have to compare the assembly property here when dealing with
15143 FamANDAssem and Assembly access modifiers, because we might be
15144 creating an assembly from *modules* (that means that we are not
15145 getting TypeBuilders for types defined in other modules that are
15146 part of this assembly).
15148 (Method.Emit): If the method is marked abstract and has a body,
15151 (TypeContainer.DefineMembers): If both the defined member and the
15152 parent name match are methods, then do not emit any warnings: let
15153 the Method.Define routine take care of flagging warnings. But if
15154 there is a mismatch (method overrides something else, or method is
15155 overriwritten by something, then emit warning).
15157 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15158 set to null, this means `do not check for the return type on the
15161 (Method.Define): set the return type for the method signature to
15162 null, so that we get methods with the same name and parameters and
15163 different return types. This is used to flag warning 114 (you are
15164 hiding a method, and you probably want to use the new/override
15167 * typemanager.cs (MemberLookup): Implemented proper access
15168 control, closing a long standing set of bug reports. The problem
15169 was that the Framework only has two bits: Public and NonPublic,
15170 and NonPublic includes private and protected methods, but we need
15171 to enforce the FamANDAssem, FamOrAssem and Family.
15173 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15175 * statement.cs (GotoCase): Return true: Ammounts to giving up
15176 knowledge on whether we return or not, and letting the other case
15177 be responsible for it.
15179 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15181 * driver.cs: Do not load directories for each file processed, only
15182 do it if there is a pattern.
15184 * ecore.cs: Report readonly assigns here as well, as we might have
15185 been resolved only by MemberAccess.
15187 (SimpleName.SimpleNameResolve): Also be useful for LValue
15188 resolution. We need this to propagate assign to local readonly variables
15190 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15191 do not want to reuse potential criteria memory.
15193 * class.cs (MyEventBuilder): Set reflected_type;
15195 * ecore.cs (Constantify): Added support for constifying bools.
15197 (RootContext.LookupType): Added a cache for values looked up in
15198 the declaration space.
15200 * typemanager.cs (FindMembers): Now is a front-end to
15201 RealFindMembers, and provides a two-level hashtable-based cache to
15204 15% performance improvement: from 22.5 to 19.2 seconds.
15206 * expression.cs (IsParamsMethodApplicable): use foreach.
15207 (Invocation.DoResolve): ditto.
15208 (New.DoResolve): ditto.
15209 (ArrayCreation.DoResolve): ditto.
15211 * ecore.cs (FindMostEncompassingType): use foreach.
15213 * delegate.cs (NewDelegate.DoResolve): Use foreach
15215 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15216 (RemoveMethods): use foreach.
15218 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15219 nested foreach statements instead of for, and also break out of
15220 the inner loop once a match is found.
15222 (Invocation.OverloadResolve): Use foreach, simplify the code.
15224 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15226 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15227 we actually unwrap the expression to allow for extra information
15230 * expression.cs: Use Shr_Un on unsigned operations.
15232 2002-05-08 Ravi Pratap <ravi@ximian.com>
15234 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15235 applicable operators was not being considered correctly. This closes
15236 the bug Miguel reported.
15238 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15240 * attribute.cs: check that the type derives from System.Attribute
15241 and report the correct error in that case (moved the duplicate code to
15242 its own method, too).
15244 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15246 * attribute.cs: lookup attribute type name as the spec says: first the
15247 bare attribute name and then name + "Attribute" (nant compiles with
15248 mcs after this fix).
15250 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15252 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15253 Because of the way we parse things, we should try to see if a
15254 UIntConstant can fit in an integer.
15256 2002-05-07 Ravi Pratap <ravi@ximian.com>
15258 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15259 when we are in an explicit context.
15261 (ConvertReferenceExplicit): When converting from Iface type S to Class
15262 T make sure the rules are implemented as an OR.
15264 * parameter.cs (ParameterType): Make it a property for now although the
15265 purpose really isn't anything immediate.
15267 * expression.cs (Is*Applicable): Do better checking on the parameter type
15268 of a ref/out parameter. The ones from the system assemblies are already
15269 marked with the correct type so we don't need to do any correction.
15271 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15272 the object type is standard too so include that.
15274 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15276 * ecore.cs (StandardConversionExists): Augment with missing code:
15277 deal with IntConstant, LongConstants and Enumerations.
15279 * assign.cs: Report the error, instead of failing silently
15281 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15282 typecontainer that they are declared, because the
15283 typecontainer/namespace will have the list of using clauses that
15284 need to be applied.
15286 Assembly Attributes were escaping the normal registration
15289 (EmitCode): Apply attributes within an EmitContext that represents
15290 the container they were declared on.
15292 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15294 2002-05-06 Ravi Pratap <ravi@ximian.com>
15296 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15297 Revamp completely - make much cleaner as we now operate only
15300 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15301 to implement the logic detailed in the spec more correctly.
15303 (UserDefinedConversion): Update accordingly.
15305 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15307 * statement.cs: Return flow analysis information up.
15309 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15312 (token): Do not consume an extra character before calling
15315 2002-05-06 Piers Haken <piersh@friskit.com>
15317 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15319 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15321 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15322 EmitContext during the instance constructor initializer
15323 resolution, to stop access to instance variables.
15325 This is mandated by the spec, last paragraph of the `constructor
15326 initializers' section.
15328 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15330 * cs-parser.jay, class.cs (Accessor): new class used to represent
15331 an accessor (get or set). In the past we used `null' to represent
15332 a missing accessor. But this is ambiguous because there was no
15333 way to tell in abstract indexers/properties if one of them was
15336 Now there is a way of addressing that.
15338 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15339 instead of FindMembers.
15341 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15342 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15344 * attribute.cs: Treat indexers and properties as the same in terms
15345 of applying attributes
15347 * ecore.cs (FindMostEncompassedType): Use statically initialized
15348 EmptyExpressions()s like we do elsewhere to avoid creating useless
15349 objects (and we take this out of the tight loop).
15351 (GetConversionOperators): Move the code to extract the actual
15352 operators to a separate routine to clean things up.
15354 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15356 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15357 events are always registered FieldBuilders.
15359 * class.cs (FieldBase): New class shared by Fields
15361 * delegate.cs: If we are a toplevel delegate, use our full name.
15362 If we are a nested delegate, then only use our tail name.
15364 2002-05-02 Ravi Pratap <ravi@ximian.com>
15366 * expression.cs (IsApplicable): Ensure that we add the "&" to
15367 ref/out types before comparing it with the type of the argument.
15369 (IsParamsMethodApplicable): Ditto.
15371 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15374 * delegate.cs : Handle the case when we have more than one applicable
15375 method. Flag an error only when we finish checking all.
15377 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15379 * expression.cs: Add support for boolean static initializers.
15381 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15383 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15385 * parameter.cs (ComputeParameterTypes,
15386 ComputeAndDefineParameterTypes): Better error handling: now we
15387 clear the `types' cache if we fail during any of the type lookups.
15388 We also return the status code correctly to our caller
15390 * delegate.cs: If we fail to define a delegate, abort the extra
15393 * expression.cs (Binary.ResolveOperator): for
15394 operator==(object,object) and operator !=(object, object) we also
15395 have to verify that there is an implicit conversion from one to
15398 (ArrayAccess.DoResolve): Array Access can operate on
15401 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15403 * assign.cs (CompoundAssign): A new class used as a "flag" that
15404 the assignment actually is happening as part of a compound
15405 assignment operator.
15407 During compound assignment, a few new rules exist to enable things
15414 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15415 to the type of x) if y is implicitly convertible to the type of x,
15416 and the operator is a builtin operator and the return type of the
15417 operator is explicitly convertible to the type of x.
15419 * rootcontext.cs: Reset warning level to 2. 4 catches various
15420 "interesting" features in mcs, we must clean this up at some
15421 point, but currently am trying to kill other bugs ;-)
15423 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15424 in container classes as well.
15426 * expression.cs (Binary.ResolveOperator): Handle string case
15427 before anything else (as operator overloading does emit an error
15428 before doing anything else).
15430 This code could go away when we move to a table driven model, but
15431 i could not come up with a good plan last night.
15433 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15435 * typemanager.cs (CSharpName): reimplementation using regex.
15436 * class.cs: added null check for fields in Emit
15437 * rootcontext.cs: set warninglevel to 4
15439 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15441 * typemanager.cs (CSharpName): reimplemented with Lupus
15444 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15446 * statement.cs (If): correclty implement Resolve, because we were
15447 not catching sem errors in there. The same process is needed
15449 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15452 (Statement.Warning_DeadCodeFound): Factorize code.
15453 (While): Report dead code here too.
15455 (Statement): Added Resolve virtual method to allow
15456 for resolution split from the emit code.
15458 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15460 * statement.cs (EmitBoolExpression): No longer try to resolve the
15462 (MakeBoolean): New utility function that resolve, implicitly
15463 converts to boolean and tags the expression.
15466 (If, Do): Implement dead code elimination.
15467 (While): Implement loop inversion
15469 (Do, While, For, If): Resolve the expression prior to calling our
15472 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15475 - added method Report28 (warning: program has more than one entry point)
15476 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15477 - modified method Method.Define, the part at the end of the method
15479 * rootcontext.cs: added static public Location EntryPointLocation;
15481 * ../errors/cs0028.cs : Add test case for the above warning.
15484 - modified method CSharpName to allow arrays of primitive type to
15485 be printed nicely (e.g. instead of System.Int32[][] it now prints
15487 - added method CSharpSignature: returns the signature of a method
15488 in string format to be used in reporting errors, warnings, etc.
15490 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15493 2002-04-26 Ravi Pratap <ravi@ximian.com>
15495 * delegate.cs (Define): Fix extremely silly bug where I was
15496 setting the type of the 'object' parameter of the BeginInvoke
15497 method to System.IAsyncResult instead of System.Object ;-)
15499 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15501 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15504 (Constructor.Emit): return if we fail to initialize the
15505 constructor. Another door closed!
15507 * expression.cs (New.DoResolve): Improve error message (from -6 to
15508 1501). Use DeclaredOnly lookup to find the exact constructor.
15510 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15511 loop. This is useful.
15513 * cs-parser.jay: Adjust the default parameters so that destructors
15514 have the proper signature.
15516 2002-04-26 Martin Baulig <martin@gnome.org>
15518 * driver.cs (LoadAssembly): If `assembly' contains any characters
15519 which are only valid in path names and not in assembly names
15520 (currently slash, backslash and point), use Assembly.LoadFrom ()
15521 instead of Assembly.Load () on the `assembly' (before iteration
15522 over the link_paths).
15524 2002-04-26 Martin Baulig <martin@gnome.org>
15526 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15528 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15530 * class.cs (Property): use the new typemanager.MemberLookup
15532 (TypeContainer.MemberLookup): Implement using the
15533 TypeManager.MemberLookup now.
15535 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15536 and return MemberInfos, so that these can be used without an
15537 EmitContext (what we had before).
15539 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15541 * expression.cs: Fix the case where the argument to params if the
15542 type of the params. I omitted handling this before. Fixed
15544 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15546 * driver.cs: Call BootCorlib_PopulateCoreType
15548 * class.cs (Property.CheckBase): Check for properties only, not
15551 * interface.cs: Temporary hack: try/catch around the
15552 CustomAttributeBuilder, because I am getting an exception that I
15555 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15556 types whose definitions are required to be there (attributes are
15557 defined before standard types).
15559 Compute definitions as we boot the various types, as they are used
15560 immediately (value_type class will need object_type, but if we do
15561 not initialize object_type, we will pass a null, which will let
15562 the runtime pick the System.Object from the existing corlib, which
15563 is not what we want).
15565 2002-04-22 Patrik Torstensson <totte@labs2.com>
15567 * cs-tokenizer.cs: fixed a number of trim() issues.
15569 2002-04-22 Ravi Pratap <ravi@ximian.com>
15571 * expression.cs (Argument.Type): Ensure that we return the correct
15572 type when we have out or ref parameters [in which case we
15575 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15577 * class.cs (Property, Indexer): Allow extern modifier in there.
15579 * typemanager.cs (InitBaseTypes): Initializes object_type and
15580 value_type, since those will be used early on during the bootstrap
15581 process to compile corlib.
15583 (InitCoreTypes): Move code from here to InitBaseTypes.
15585 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15587 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15588 single-dimension arrays as using the ldlen opcode.
15590 Daniel Lewis discovered this optimization.
15592 * typemanager.cs: Add signature for System.Array::get_Length
15594 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15596 * statement.cs: report the error when the foreach does not apply to an
15597 array nor a collection.
15599 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15601 * expression.cs: Add implicit conversions to the operator ~.
15603 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15605 * typemanager.cs: Locate the decimal constructor.
15607 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15609 * attribute.cs: use the new property of TypeOf.
15610 * expression.cs: added 'get' property around typearg.
15612 These changes fix a build breaker reported by NickD. Is this the
15613 correct way to fix? If not, please, revert my changes and make it
15616 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15618 * attribute.cs: Add support for typeof in attribute invocations.
15619 I am not sure that this is right though.
15621 2002-04-14 Duncan Mak <duncan@ximian.com>
15623 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15624 Binary.Operator.Division case.
15626 2002-04-13 Ravi Pratap <ravi@ximian.com>
15628 * class.cs (DefineType): Ensure that we do a proper check on
15629 attribute types and also register it with the TypeManager.
15631 (TypeContainer.Targets): The default for attribute types is
15632 AttributeTargets.All.
15634 * attribute.cs (ApplyAttributes): Registering the attribute type
15635 is done elsewhere, not when we discover we have a Usage attribute.
15637 2002-04-12 Ravi Pratap <ravi@ximian.com>
15639 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15640 and get rid of is_delegate parameter.
15642 * everywhere : update.
15644 2002-04-12 Ravi Pratap <ravi@ximian.com>
15646 * cs-parser.jay (compilation_unit): Revamp completely to use
15647 some new ideas that I got from Rhys' grammar to solve the problems
15648 with assembly level attributes.
15650 (outer_declaration): New grammar production.
15652 (attribute_sections): Add.
15654 (opt_attributes): Base on attribute_sections
15656 (namespace_declaration): Allow opt_attributes to tackle the case
15657 when we have assembly level attributes - we are clever in this
15660 * attribute.cs (ApplyAttributes): Do not worry about assembly
15661 attributes in the non-global context.
15663 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15664 instead of SetGlobalAttributes.
15666 * class.cs, rootcontext.cs : Ensure we define and generate
15667 attribute types before anything else.
15669 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15670 and flag the new error -20 for the case when the attribute type
15671 does not have valid targets specified. csc does not catch this.
15673 * ../errors/errors.txt : update for error # -20
15675 2002-04-11 Ravi Pratap <ravi@ximian.com>
15677 * support.cs (InternalParameters.ParameterModifier): Do some null
15678 checking and return sane values.
15680 * class.cs (Method.Define): If we are a PInvoke method, ensure
15681 that we are static and extern. Report error # 601
15683 * ../errors/cs0601.cs : Add test case for the above error.
15685 2002-04-07 Ravi Pratap <ravi@ximian.com>
15687 * rootcontext.cs (attribute_types): We need to keep type of
15688 all attribute types separately and emit code for them first.
15690 (RegisterAttribute) : Implement.
15692 * class.cs (DefineType): Check if the current Type is a custom
15693 attribute type and register it accordingly.
15695 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15696 adding the first attribute twice and rename to
15698 (SetGlobalAttributes): this.
15700 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15703 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15704 if we are processing global arguments. Hmm, I am unsure of this.
15706 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15708 * expression.cs: added static array of strings to avoid calling
15709 Enum.ToString () for Operator in Binary. Significant recover of
15712 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15714 * class.cs (FindMembers): Allow the Builders of the various
15715 members to be null. If they are skip them. This only happens
15716 during the PInvoke declaration.
15718 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15720 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15721 failure, so we do not keep going afterwards.
15723 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15724 wanted to pass `false' as the `is_delegate' argument. If this is
15725 the case, why not use delegate_type == null to mean `is_delegate =
15726 false' and anything else as is_delegate = true.
15728 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15730 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15731 code for the section, not the beginning of the tests.
15733 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15735 * cfold.cs: Handle operator + (Enum x, Underlying x)
15737 * expression.cs (Binary): same. Warn about errors where we have
15738 Enum/Enum in operator + as well.
15740 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15743 - added support for switch(bool)
15744 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15745 - add TableSwitchEmit() to handle table-based switch statements
15747 2002-04-05 Ravi Pratap <ravi@ximian.com>
15749 * expression.cs (Invocation.OverloadResolve): Factor out code which
15750 does parameter compatibility checking with arguments so that we can
15751 re-use the code even from Delegate.VerifyApplicability
15753 (VerifyArgumentsCompat): Move above code here.
15755 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15756 and instead make a call to the above method.
15758 2002-03-31 Ravi Pratap <ravi@ximian.com>
15760 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15761 We use it to keep track of classes which are attribute types.
15763 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15765 * delegate.cs (Delegate.Define): Correctly define the types in the
15766 presence of fixed and array parameters.
15768 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15771 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15772 include NonPublic after the first iteration.
15774 * class.cs (Indexer.CheckBase): Only check if both parents are
15777 * cs-parser.jay (accessor_body): If empty, set to null.
15779 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15780 same code path here to resolve constants names that we did have in
15781 MemberAccess.DoResolve. There is too much code duplicated here.
15783 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15785 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15787 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15790 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15791 tokens, numbers and strings.
15793 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15796 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15797 asyncronous parameters and the regular parameters.
15799 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15800 specify the target directory.
15802 * expression.cs: (This.DoResolve): Simplify
15803 (As.Emit): Optimize, do not generate IsInst if the expression is
15804 always of the given type.
15806 (Is.DoResolve): Bug fix, we were reporting both always/never for
15809 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15810 creating too many unnecessary arrays.
15812 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15814 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15815 fields instead of rolling our own initializer. Takes care of all
15816 implicit conversions, and drops unnecessary static checks/argument.
15818 2002-03-31 Dick Porter <dick@ximian.com>
15820 * driver.cs: use the GetDirectories() return values properly, and
15821 use "/" as path separator.
15823 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15825 * expression.cs (Unary): Optimize - - expr into expr.
15826 (Binary): Optimize a + (-b) into a -b.
15828 * codegen.cs (CodeGen): Made all methods static.
15830 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15834 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15835 TypeBuilder property.
15837 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15840 * tree.cs: Removed the various RecordXXXX, and replaced with a
15841 single RecordDecl. Removed all the accessor methods, and just
15842 left a single access point Type
15844 * enum.cs: Rename DefineEnum to DefineType.
15846 * decl.cs: New abstract method `DefineType' used to unify the
15847 Defines for Enumerations, Interfaces, TypeContainers and
15850 (FindType): Moved LookupInterfaceOrClass here. Moved the
15851 LookupBaseClasses method that used to live in class.cs and
15852 interface.cs here, and renamed to FindType.
15854 * delegate.cs: Implement DefineType. Take advantage of the
15855 refactored pattern for locating the parent builder without taking
15856 the parent_builder argument (which we know does not work if we are
15857 nested, and triggering a toplevel definition).
15859 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15861 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15862 accessibility of a member has changed during override and report
15865 * class.cs (Method.Define, Property.Define): Only complain on
15866 overrides if the method is private, any other accessibility is
15867 fine (and since we just checked the permission is the same, we are
15870 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15871 and elif are processed always. The other pre-processing
15872 directives are only processed if we are "taking" the path
15874 2002-03-29 Martin Baulig <martin@gnome.org>
15876 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15877 current location is not Null.
15879 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15880 a separate method so we can profile it.
15882 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15883 `span.Seconds' are just seconds, but no minutes or hours.
15884 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15886 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15888 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15889 Remove the gratuitous set of Final:
15891 // If an interface implementation, then we can set Final.
15892 if (((flags & MethodAttributes.Abstract) == 0) &&
15893 implementing.DeclaringType.IsInterface)
15894 flags |= MethodAttributes.Final;
15896 I do not know what I was smoking when I used that.
15899 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15900 step into fixing the name resolution issues for delegates and
15901 unifying the toplevel name resolution.
15903 2002-03-28 Martin Baulig <martin@gnome.org>
15905 * class.cs (Method.Emit): If we have a symbol writer, call its
15906 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15907 tell it about the current method.
15909 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15910 writer that we're going to emit the first byte of IL code for a new
15911 statement (a new source line).
15912 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15913 EmitContext.Mark() before emitting any code.
15915 * location.cs (SymbolDocument): Return null when we're Null.
15917 * statement.cs (Statement): Moved the `Location loc' variable here.
15918 (Statement.EmitBoolExpression): If we have a symbol writer, call
15919 ec.Mark() before emitting any code to tell it that we're at the
15920 beginning of a new statement.
15921 (StatementExpression): Added `Location' argument to the constructor.
15922 (Block): Added public readonly variable `StartLocation' and public
15923 variable `EndLocation'. The latter is to be set using SetEndLocation().
15924 (Block): Added constructor which takes a start and end location.
15925 (Block.SetEndLocation): New method. This sets the end location.
15926 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15927 local variables we create.
15928 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15929 each statement and do also mark the begin and end of the block.
15931 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
15932 tell it the current lexer.Location, use Location.Null for the end of the
15934 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
15935 current block, set its end location using SetEndLocation().
15936 (statement_expression): StatementExpression constructor now takes the
15937 lexer.Location as additional argument.
15938 (for_statement, declare_local_variables): Likewise.
15939 (declare_local_variables): When creating a new implicit block, use the
15940 new Block constructor and pass it the lexer.Location.
15942 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15944 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
15945 members also on the parent interfaces recursively.
15947 2002-03-27 Miguel de Icaza <miguel@ximian.com>
15949 * report.cs: Use new formats, since Gonzalo finished the missing
15952 * expression.cs (Binary.ResolveOperator): added missing operator|
15953 operator& and operator^ for bool/bool.
15955 * cs-parser.jay: CheckDef now takes a Location argument that is
15956 used to report errors more precisly (instead of reporting the end
15957 of a definition, we try to track something which is a lot closer
15958 to the source of the problem).
15960 * cs-tokenizer.cs: Track global token use, so we can properly flag
15961 the use of #define/#undef after the first token has been seen.
15963 Also, rename the reportXXXX to Error_DescriptiveName
15965 * decl.cs (DeclSpace.IsTopLevel): Move property here from
15966 TypeContainer, so that Enum and Interface can use this too.
15968 * class.cs (TypeContainer.LookupInterfaceOrClass,
15969 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
15970 `builder' argument. Typically this was used to pass the parent
15971 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
15974 The problem is that a nested class could trigger the definition of
15975 a toplevel class, and the builder would be obviously wrong in that
15978 So we drop this argument, and we compute dynamically the
15979 TypeBuilder/ModuleBuilder (the correct information was available
15980 to us anyways from DeclSpace.Parent)
15982 * interface.cs (Interface.DefineInterface): Drop builder
15983 parameter cleanup like class.cs
15985 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
15988 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
15991 (Try.Emit): Propagate the returns value from the statement.
15993 (Return.Emit): Even if we are leavning
15995 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
15997 * modifiers.cs: Fix the computation of MethodAttributes flags.
15999 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16001 * driver.cs: allow compilation of files that start with '/'.
16002 Add a default case when checking the argument of --target.
16004 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16006 * interface.cs: Implement the same search algorithm for types in
16007 the interface code.
16009 * delegate.cs: Do not allow multiple definition.
16011 * Recovered ChangeLog that got accidentally amputated
16013 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16015 * rootcontext.cs: Load manually enum to allow core classes to
16016 contain enumerations.
16018 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16019 Update to new static methods in TypeManager.
16021 * typemanager.cs (GetMethod, GetConstructor): Use our
16022 implementation of FindMembers to find the members, since during
16023 corlib compilation, the types are TypeBuilders and GetMethod and
16024 GetConstructor do not work.
16026 Make all methods in TypeManager static.
16028 (InitCodeHelpers): Split the functionality from
16029 the InitCodeTypes function.
16031 * driver.cs: Call InitCodeHelpers after we have populated the
16034 * cs-parser.jay (delegate_declaration): we did not used to compute
16035 the delegate name correctly for void delegates.
16037 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16039 * rootcontext.cs (RootContext): Init the interface_resolve_order
16040 and type_container_resolve_order always.
16042 (ResolveCore, BootstrapCorlib_ResolveClass,
16043 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16044 compiler when compiling with --nostdlib
16046 * class.cs (TypeContainer.DefineType): Check that our parent is
16047 not null. This test is most important when we are bootstraping
16050 * codegen.cs: Split out the symbol writing code.
16052 2002-03-25 Martin Baulig <martin@gnome.org>
16054 * driver.cs (-g): Made -g an alias for --debug.
16056 2002-03-24 Martin Baulig <martin@gnome.org>
16058 * codegen.cs (SymbolWriter): New public variable. Returns the
16059 current symbol writer.
16060 (CodeGen): Added `bool want_debugging_support' argument to the
16061 constructor. If true, tell the ModuleBuild that we want debugging
16062 support and ask it for the ISymbolWriter.
16063 (Save): If we have a symbol writer, call it's Close() method after
16064 saving the assembly.
16066 * driver.c (--debug): New command line argument to create a
16067 debugger information file.
16069 * location.cs (SymbolDocument): New public property. Returns an
16070 ISymbolDocumentWriter object for the current source file or null
16071 if we don't have a symbol writer.
16073 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16075 * driver.cs (LoadAssembly): Correctly return when all the paths
16076 have been tried and not before.
16078 * statement.cs (Switch.Emit): return the actual coverage for this
16079 statement (returns/not-returns)
16081 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16082 switch of the statement if we are the last switch section. That
16083 kills two problems: try/catch problems (we used to emit an empty
16084 nop at the end) and switch statements where all branches would
16087 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16089 * driver.cs: Add default assemblies (the equivalent to the
16090 Microsoft CSC.RSP file)
16092 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16093 also update tokens_seen and set it to false.
16095 * driver.cs: Implement --recurse for Mike.
16097 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16098 correctly splitting out the paths.
16100 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16102 * interface.cs (Interface.PopulateProperty): Instead of using
16103 `parent' as the declaration space for the set parameters, use
16106 * support.cs (InternalParameters): InternalParameters constructor
16107 takes a DeclSpace instead of a TypeContainer.
16109 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16110 types are being initialized, load the address of it before calling
16113 (New): Provide a mechanism to disable the generation of local
16114 value type temporaries when the caller will be providing us with
16115 an address to store it.
16117 (ArrayCreation.EmitDynamicInitializers): Use it.
16119 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16121 * expression.cs (Invocation.EmitArguments): Only probe for array
16122 property if there is more than one argument. Sorry about that.
16124 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16125 empty param arrays.
16127 * class.cs (Method.LabelParameters): Fix incorrect code path that
16128 prevented the `ParamArrayAttribute' from being applied to the
16131 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16133 * support.cs (ReflectionParameters): Correctly compute whether the
16134 last argument is a params array. Fixes the problem with
16137 * typemanager.cs: Make the assemblies array always be non-null
16138 (empty, but non-null)
16140 * tree.cs (RecordDecl): New function that abstracts the recording
16141 of names. This reports error 101, and provides a pointer to the
16142 previous declaration. Fixes a crash in the compiler.
16144 * cs-parser.jay (constructor_declaration): Update to new grammar,
16145 and provide a constructor_body that can be empty.
16147 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16149 * driver.cs: Add support for --resources.
16151 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16152 Make all types for the various array helper methods be integer.
16154 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16155 CheckState to ConvCast.
16157 (ConvCast): Now it takes a `checked' state argument, to avoid
16158 depending on the emit context for the conversion, and just using
16159 the resolve time setting.
16161 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16162 instead of Invocation.EmitArguments. We do not emit the original
16163 arguments, instead we emit those which have been converted to
16164 unsigned int expressions.
16166 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16168 * codegen.cs: ditto.
16170 * expression.cs (LocalVariableReference): Drop the use of the
16171 Store function that depended on the variable index.
16173 * statement.cs (VariableInfo): Drop the `Idx' property from this
16174 class, as this is not taking into account the indexes for
16175 temporaries tat we generate during the execution, getting the
16178 * class.cs: First emit class initializers, then call the parent
16181 * expression.cs (Binary): Fix opcode emision.
16182 (UnaryMutator.EmitCode): Support checked code generation
16184 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16185 matches for events for both the Static and Instance scans,
16186 pointing to the same element. Fix that.
16188 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16190 * rootcontext.cs (ResolveTree): Always set the
16191 interface_resolve_order, because nested interfaces will be calling
16194 * class.cs (GetInterfaceOrClass): Track the same resolution
16195 process used by TypeManager.LookupType. This fixes the nested
16196 type lookups in class declarations (separate path from
16199 (TypeContainer.DefineType): Also define nested interfaces.
16200 (TypeContainer.RegisterOrder): New public function used to
16201 register the order in which child interfaces need to be closed.
16203 Nested interfaces need to be closed after their parents have been
16206 * interface.cs (InterfaceAttr): Put all the logic for computing
16207 the interface attribute here.
16209 (DefineInterface): Register our interface order with the
16210 RootContext or with the TypeContainer depending on the case.
16212 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16214 * cs-parser.jay: rework foreach statement to work with the new
16215 changes to the policy on SimpleNames.
16217 * report.cs: support Stacktrace on warnings as well.
16219 * makefile: drop --unsafe and /unsafe from the compile.
16221 2002-03-13 Ravi Pratap <ravi@ximian.com>
16223 * ecore.cs (StandardConversionExists): Modify to take an Expression
16224 as the first parameter. Ensure we do null -> reference type conversion
16227 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16228 temporary Expression objects.
16230 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16232 * interface.cs: workaround bug in method overloading resolution
16233 (there is already a bugzilla bug for it).
16235 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16237 We could also solve this problem by having a separate path for
16238 performing type lookups, instead of DoResolve, we could have a
16239 ResolveType entry point, and only participating pieces of the
16240 production (simplename, deref, array) would implement this.
16242 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16243 signal SimpleName to only resolve type names and not attempt to
16244 resolve anything else.
16246 * expression.cs (Cast): Set the flag.
16248 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16250 * class.cs: Only report 108 if there is no `new' modifier.
16252 * cs-parser.jay: rework foreach statement to work with the new
16253 changes to the policy on SimpleNames.
16255 * report.cs: support Stacktrace on warnings as well.
16257 * makefile: drop --unsafe and /unsafe from the compile.
16259 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16261 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16262 lookups here, instead of doing that at parse time. This means
16263 that our grammar will not introduce `LocalVariableReferences' as
16264 expressions at this point. That solves the problem of code like
16268 static void Main ()
16272 This is only half the fix. The full fix requires parameters to
16273 also be handled in this way.
16275 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16276 makes the use more obvious of the DeclSpace. The
16277 ec.TypeContainer.TypeBuilder is now only used to pull the
16278 TypeBuilder for it.
16280 My theory is that I can get rid of the TypeBuilder completely from
16281 the EmitContext, and have typecasts where it is used (from
16282 DeclSpace to where it matters).
16284 The only pending problem is that the code that implements Aliases
16285 is on TypeContainer, and probably should go in DeclSpace.
16287 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16288 lookups here, instead of doing that at parse time. This means
16289 that our grammar will not introduce `LocalVariableReferences' as
16290 expressions at this point. That solves the problem of code like
16294 static void Main ()
16298 This is only half the fix. The full fix requires parameters to
16299 also be handled in this way.
16301 * class.cs (Property.DefineMethod): When implementing an interface
16302 method, set newslot, when implementing an abstract method, do not
16303 set the flag (before we tried never setting it, or always setting
16304 it, which is the difference).
16305 (Indexer.DefineMethod): same.
16306 (Method.DefineMethod): same.
16308 * ecore.cs: Only set the status used flag if we get back a Field.
16310 * attribute.cs: Temporary hack, so Paolo can keep working.
16312 2002-03-08 Ravi Pratap <ravi@ximian.com>
16314 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16315 the unmanaged type in the case we have a MarshalAs attribute.
16317 (Resolve): Handle the case when we are parsing the special MarshalAs
16318 attribute [we need to store the unmanaged type to use later]
16320 * typemanager.cs (marshal_as_attr_type): Built in type for the
16321 MarshalAs Attribute.
16323 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16324 on parameters and accordingly set the marshalling info.
16326 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16328 * class.cs: Optimizing slightly by removing redundant code after
16329 we switched to the `NoTypes' return value.
16330 (Property.DefineMethod): use NoTypes here too.
16332 This fixes the bug I introduced in my last batch of changes.
16334 2002-03-05 Ravi Pratap <ravi@ximian.com>
16336 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16338 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16339 Enums since those are types too.
16341 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16343 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16344 thanks to a call during the lookup process.
16346 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16348 * statement.cs (Foreach): Lots of work to accomodate a particular
16349 kind of foreach statement that I had not kept in mind. It is
16350 possible to have foreachs on classes that provide a GetEnumerator
16351 method that return objects that implement the "pattern" for using
16352 a foreach, there is no need to support GetEnumerator
16355 This is needed to compile nant.
16357 * decl.cs: Only report 114 if the member is not `Finalize' and if
16358 the warning level is at least 2.
16360 * class.cs: Moved the compare function from Method to
16363 (MethodSignature.InheritableMemberSignatureCompare): Add new
16364 filter function that is used to extract inheritable methods from a
16367 (Method.Define): Use the new `inheritable_method_signature_filter'
16370 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16373 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16375 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16377 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16379 * expression.cs: Pass location information to
16380 ConvertImplicitStandard.
16382 * class.cs: Added debugging code to track return values from
16385 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16387 * expression.cs (Is.DoResolve): If either side of the `is' is an
16388 interface, do not flag the warning.
16390 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16393 * report.cs: Allow for --fatal to be used with --probe.
16395 * typemanager.cs (NoTypes): Move the definition for the empty Type
16398 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16400 (TypeContainer.DefineProxy): New function used to proxy to parent
16401 implementations when implementing interfaces.
16402 (TypeContainer.ParentImplements): used to lookup if our parent
16403 implements a public function that is required by an interface.
16404 (TypeContainer.VerifyPendingMethods): Hook this up.
16406 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16407 `modules' and `assemblies' arraylists into arrays. We only grow
16408 these are the very early start up of the program, so this improves
16409 the speedof LookupType (nicely measured).
16411 * expression.cs (MakeByteBlob): Replaced unsafe code with
16412 BitConverter, as suggested by Paolo.
16414 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16415 folding of string concatenation, but if either side is a string,
16416 and the other is not, then return null, and let the runtime use
16417 the concatenation on the string plus the object (using
16418 `Object.ToString').
16420 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16422 Constant Folding has been implemented now.
16424 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16425 the error instead on types that are not supported in one's
16428 * constant.cs (Constant and all children): New set of functions to
16429 perform implict and explicit conversions.
16431 * ecore.cs (EnumConstant): Implement the new functions to perform
16432 conversion by proxying to the child expression.
16434 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16435 own separate setting that can not be turned off from the command
16436 line using --unchecked or --checked and is only controlled using
16437 the checked/unchecked statements and expressions. This setting is
16438 used by the constant folder to flag errors.
16440 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16441 ConstantCheckState as well.
16443 During Resolve, they also have to flag the state, because the
16444 constant folder runs completely in the Resolve phase.
16446 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16449 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16451 * cfold.cs: New file, this file contains the constant folder.
16453 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16454 argument to track whether we are using the resulting address to
16455 load or store a value and provide better error messages.
16457 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16458 new AddressOf arguments.
16460 * statement.cs (Foreach.EmitCollectionForeach): Update
16462 * expression.cs (Argument.Emit): Call AddressOf with proper
16463 arguments to track usage.
16465 (New.DoEmit): Call AddressOf with new arguments.
16467 (Unary.Emit): Adjust AddressOf call.
16469 2002-03-01 Ravi Pratap <ravi@ximian.com>
16471 * cs-parser.jay (member_access): Change the case for pre-defined types
16472 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16475 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16478 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16479 essentially like methods and apply attributes like MethodImplOptions to them too.
16481 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16484 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16485 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16488 * Update code everywhere accordingly.
16490 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16492 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16494 2002-02-28 Ravi Pratap <ravi@ximian.com>
16496 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16497 try performing lookups against those instead of jumping straight into using
16498 the 'using' clauses.
16500 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16502 (LookupType): Perform lookups in implicit parents too.
16504 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16505 sequence as RootContext.LookupType.
16507 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16508 the various cases of namespace lookups into this method.
16510 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16512 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16513 in positional arguments)
16515 * class.cs (Operator): Update the AllowedModifiers to contain
16518 * cs-parser.jay: Update operator declaration to allow for the
16519 operator body to be empty.
16521 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16524 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16526 * class.cs (Method.Emit): Label parameters.
16528 * driver.cs: Return 1 or 0 as the program exit code.
16530 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16532 * expression.cs: Special case the `null' object when trying to
16533 auto-compute the type, as anything can be explicitly converted to
16536 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16537 spotting this Paolo.
16539 (Expression.ImplicitNumericConversion): Perform comparissions of
16540 the type using the underlying type in the case of an enumeration
16541 rather than using the enumeration type for the compare.
16543 Cope with the underlying == type case, which is not possible to
16546 (Expression.ConvertNumericExplicit): Perform comparissions of
16547 the type using the underlying type in the case of an enumeration
16548 rather than using the enumeration type for the compare.
16550 * driver.cs: If the user does not supply an extension, assume .exe
16552 * cs-parser.jay (if_statement): Rewrote so that we can track the
16553 location for the if statement.
16555 * expression.cs (Binary.ConstantFold): Only concat strings when
16556 the operation is "+", not everything ;-)
16558 * statement.cs (Statement.EmitBoolExpression): Take a location
16560 (If, While, Do): Track location.
16562 * expression.cs (Binary.ResolveOperator): In the object + string
16563 case, I was missing a call to ConvertImplicit
16565 2002-02-25 Ravi Pratap <ravi@ximian.com>
16567 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16568 Location arguments. Ensure we use RootContext.LookupType to do our work
16569 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16571 * interface.cs (PopulateMethod): Handle the type of the parameter being
16574 * expression.cs (Invocation.BetterFunction): Handle the case when we
16575 have a params method with no fixed arguments and a call is made with no
16578 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16580 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16581 the verbatim-string-literal
16583 * support.cs (InternalParameters.ParameterModifier): handle null
16585 (InternalParameters.ParameterType): ditto.
16587 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16588 duplicating the name of the variable parameter.
16589 (GetParameterByName): Fix bug where we were not looking up array
16590 paramters if they were the only present (thanks Paolo!).
16591 (GetParameterInfo): We only have an empty set of types if both
16592 fixed and array are set to null.
16593 (GetParameterInfo-idx): Handle FixedParameter == null
16595 * cs-parser.jay: Handle the case where there is no catch
16596 statements (missing null test).
16598 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16600 * driver.cs (MainDriver): Be conservative on our command line
16603 Catch DirectoryNotFoundException when calling GetFiles.
16605 (SplitPathAndPattern): Used to split the input specification into
16606 a path and a pattern that we can feed to Directory.GetFiles.
16608 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16610 * statement.cs (Fixed): Implement the last case of the Fixed
16611 statement (string handling).
16613 * expression.cs (StringPtr): New class used to return a char * to
16614 a string; Used by the Fixed statement.
16616 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16618 * expression.cs (Binary.ResolveOperator): Remove redundant
16619 MemberLookup pn parent type.
16620 Optimize union call, we do not need a union if the types are the same.
16621 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16624 Specialize the use of MemberLookup everywhere, instead of using
16625 the default settings.
16627 (StackAlloc): Implement stackalloc keyword.
16629 * cs-parser.jay: Add rule to parse stackalloc.
16631 * driver.cs: Handle /h, /help, /?
16633 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16634 before we supported unsafe code.
16636 * makefile: add --unsafe to the self compilation of mcs.
16638 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16640 * expression.cs (PointerArithmetic): New class that is used to
16641 perform pointer arithmetic.
16642 (Binary.Resolve): Handle pointer arithmetic
16643 Handle pointer comparission.
16644 (ArrayPtr): Utility expression class that is used to take the
16645 address of an array.
16647 (ElementAccess): Implement array access for pointers
16649 * statement.cs (Fixed): Implement fixed statement for arrays, we
16650 are missing one more case before we are done.
16652 * expression.cs (Indirection): Implement EmitAssign and set the
16653 ExprClass to Variable. This allows pointer dereferences to be
16654 treated as variables, and to have values assigned to them.
16656 * ecore.cs (Expression.StoreFromPtr): New utility function to
16657 store values dereferencing.
16659 2002-02-20 Ravi Pratap <ravi@ximian.com>
16661 * expression.cs (Binary.ResolveOperator): Ensure that we are
16662 not trying to operate on a void type - this fixes the reported
16665 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16666 the parent implementation is sealed.
16668 * ../errors/cs0239.cs : Add.
16670 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16672 * typemanager.cs (unverifiable_code_type): Corresponds to
16673 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16674 which have unsafe code in them.
16676 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16679 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16681 * cs-tokenizer.cs: Add support for @"litreal strings"
16683 Make tokenizer accept pre-processor directives
16684 on any column (remove the old C-like limitation).
16686 * rootcontext.cs (EmitCode): Emit any global attributes.
16687 (AddGlobalAttributes): Used to keep track of assembly attributes.
16689 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16691 * cs-parser.jay: Add support for global attributes.
16693 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16695 * expression.cs (Indirection): New helper class. Unary will
16696 create Indirection classes to be able to implement the
16697 IMemoryLocation interface on it.
16699 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16701 * cs-parser.jay (fixed_statement): reference the right statement.
16703 * statement.cs (Fixed.Emit): Finish implementing the fixed
16704 statement for the &x case.
16706 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16708 * class.cs (Property.Define, Method.Define): Remove newslot when
16711 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16712 wrong. NewSlot should only be used if the `new' keyword is present.
16714 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16715 locating our system dir. Sorry about this.
16717 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16719 * driver.cs (GetSystemDir): Compute correctly the location of our
16720 system assemblies. I was using the compiler directory instead of
16721 the library directory.
16723 2002-02-13 Ravi Pratap <ravi@ximian.com>
16725 * expression.cs (BetterFunction): Put back in what Miguel commented out
16726 since it is the correct fix. The problem is elsewhere ;-)
16728 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16729 parameters of the parms method are themselves compatible or not !
16731 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16732 to check that a class implements an interface before saying that an implicit
16733 conversion was allowed. Use ImplementsInterface to do the checking.
16735 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16737 * class.cs (Method.Define): Track whether we are an explicit
16738 implementation or not. And only call DefineMethodOverride if we
16739 are an explicit implementation.
16741 (Property.DefineMethod): Ditto.
16743 2002-02-11 Ravi Pratap <ravi@ximian.com>
16745 * expression.cs (BetterFunction): Catch hideous bug which was
16746 preventing us from detecting ambiguous calls due to implicit casts i.e
16749 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16751 * support.cs (Pair): Remove un-needed method. I figured why I was
16752 getting the error in cs-parser.jay, the variable in a foreach loop
16753 is readonly, and the compiler does not really treat this as a variable.
16755 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16756 instead of EQUALS in grammar.
16758 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16760 * expression.cs (Unary.DoResolve): Check whether the argument is
16763 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16765 * support.cs: Api for Pair to set a value. Despite the fact that
16766 the variables are public the MS C# compiler refuses to compile
16767 code that accesses the field if the variable is part of a foreach
16770 * statement.cs (Fixed): Begin implementation of the fixed
16773 (Block.AddVariable): Return the VariableInfo on success and null
16774 on failure instead of true/false.
16776 * cs-parser.jay (foreach): Catch errors on variables already
16777 defined (we were ignoring this value before) and properly unwind
16778 the block hierarchy
16780 (fixed_statement): grammar for the fixed statement.
16782 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16784 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16785 pointer types to be incretemented.
16787 (SizeOf): Implement.
16789 * cs-parser.jay (pointer_member_access): Implement
16790 expr->IDENTIFIER production.
16792 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16793 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16796 (Unary): Implement indirection.
16798 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16799 use in non-unsafe context).
16801 (SimpleName.DoResolve): Check for pointers in field access on safe
16804 (Expression.LoadFromPtr): Factor the load-indirect code in this
16805 function. This was duplicated in UnboxCast and ParameterReference
16807 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16809 * expression.cs (ComposedCast): report an error if a pointer cast
16810 is used in a safe region.
16812 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16813 pointer type casts in unsafe context.
16815 * codegen.cs (EmitContext): Set up IsUnsafe.
16817 * cs-parser.jay (non_expression_type): Add productions for pointer
16820 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16821 code. We should not use force into static mode if the method is
16822 not virtual. Fixes bug in MIS
16824 * statement.cs (Do.Emit, While.Emit, For.Emit,
16825 Statement.EmitBoolExpression): Add support to Do and While to
16826 propagate infinite loop as `I do return' semantics.
16828 Improve the For case to also test for boolean constants.
16830 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16831 to the list of attributes we can add.
16833 Remove `EmitContext' argument.
16835 * class.cs (Method.Define): Apply parameter attributes.
16836 (Constructor.Define): Apply parameter attributes.
16837 (MethodCore.LabelParameters): Move here the core of labeling
16840 * support.cs (ReflectionParameters.ParameterModifier,
16841 InternalParameters.ParameterModifier): Use IsByRef on the type and
16842 only return the OUT bit for these parameters instead of in/out/ref
16845 This is because I miss-understood things. The ParameterInfo.IsIn
16846 and IsOut represent whether the parameter has the [In] and [Out]
16849 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16851 * ecore.cs (FieldExpr.Emit): Release temporaries.
16853 * assign.cs (LocalTemporary.Release): new function.
16855 * codegen.cs (EmitContext.GetTemporaryStorage,
16856 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16857 temporary storage. Now we can "put back" localbuilders when we
16860 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16862 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16863 need to make a copy of the variable to generate verifiable code.
16865 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16867 * driver.cs: Compute dynamically the system directory.
16869 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16870 Slower, but more generally useful. Used by the abstract
16871 registering implementation.
16873 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16874 the rules for the special rule on Type/instances. First check if
16875 we have the same name, and if so, try that special static path
16876 rather than the instance path.
16878 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16880 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16883 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16884 Enum, ValueType, Delegate or Array for non-corlib compiles.
16886 * cs-tokenizer.cs: Catch long identifiers (645)
16888 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16891 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16892 fix, we were returning too early, so we were not registering
16893 pending methods from abstract classes.
16895 Do not register pending methods if the class is abstract.
16897 * expression.cs (Conditional.DoResolve): Report circular implicit
16898 conversions when we neecd to compute it for conditional
16901 (Is.DoResolve): If the expression is always of the provided type,
16902 flag warning 183. If the expression can not ever be of the
16903 provided type flag warning 184.
16905 * class.cs: Catch 169 as well.
16907 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16910 2002-01-18 Nick Drochak <ndrochak@gol.com>
16912 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16914 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16916 * interface.cs: (PopulateMethod): Check for pointers being defined
16917 only if the unsafe context is active.
16918 (PopulateProperty): ditto.
16919 (PopulateIndexer): ditto.
16921 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16922 specified. If pointers are present, make sure that they are
16923 present in an unsafe context.
16924 (Constructor, Constructor.Define): ditto.
16925 (Field, Field.Define): ditto.
16926 (Property, Property.Define): ditto.
16927 (Event, Event.Define): ditto.
16929 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
16930 hashtable if there are classes or structs defined.
16932 * expression.cs (LocalVariableReference.DoResolve): Simplify this
16933 code, as the constant resolution moved.
16935 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
16936 the metadata, so we can flag error 133.
16938 * decl.cs (MemberCore.UnsafeOK): New function to test that a
16939 pointer is being declared in an unsafe context.
16941 2002-01-16 Miguel de Icaza <miguel@ximian.com>
16943 * modifiers.cs (Modifiers.Check): Require a Location argument.
16944 Report error 227 for Unsafe use.
16946 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
16948 * statement.cs (For.Emit): If the test is null, then report that
16949 we do `return', as we wont reach anything afterwards.
16951 (Switch.SwitchGoverningType): Track the expression that matched
16954 * driver.cs: Allow negative numbers as an error code to flag.
16956 * cs-parser.jay: Handle 1551.
16958 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
16960 2002-01-15 Miguel de Icaza <miguel@ximian.com>
16962 * cs-parser.jay: Report 1518 (type declaration can only contain
16963 class, struct, interface, enum or delegate)
16965 (switch_label): Report 1523 (keywords `case' or `default' must
16968 (opt_switch_sections): Report 1522 (empty switch)
16970 * driver.cs: Report 1515 (response file specified multiple times)
16971 Report 1516 (Source file specified multiple times).
16973 * expression.cs (Argument.Resolve): Signal 1510
16975 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
16976 access not allowed in static code)
16978 2002-01-11 Ravi Pratap <ravi@ximian.com>
16980 * typemanager.cs (IsPointerType): Utility method which we are going
16983 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
16984 the object type, so we take care of that.
16986 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
16988 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
16989 added to non-params parameters :-)
16991 * typemanager.cs (CSharpName): Include 'void' type too.
16993 (void_ptr_type): Include in the set of core types.
16995 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
16998 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17001 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17002 completely forgotten about it.
17004 2002-01-10 Ravi Pratap <ravi@ximian.com>
17006 * cs-parser.jay (pointer_type): Add. This begins our implementation
17007 of parsing rules for unsafe code.
17009 (unsafe_statement): Implement.
17011 (embedded_statement): Modify to include the above.
17013 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17015 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17016 if the current context is an unsafe one.
17018 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17019 are handled differently, we need separate rules for them.
17021 (local_variable_declaration): Update to use local_variable_pointer_type
17022 to allow variable declarations of unmanaged pointer types.
17024 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17025 in unsafe contexts.
17027 * ../errors/cs0214.cs : Add.
17029 2002-01-16 Nick Drochak <ndrochak@gol.com>
17031 * makefile: remove 'response' file when cleaning.
17033 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17035 * cs-parser.jay: Report 1524.
17037 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17039 * typemanager.cs (RegisterMethod): drop checking if we have
17040 registered this from here
17042 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17044 * class.cs (Method.EmitDestructor): Implement calling our base
17047 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17048 value of InFinally.
17050 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17051 this routine and will wrap the call in a try/catch block. Deal
17054 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17056 * ecore.cs (Expression.MemberLookup): instead of taking a
17057 parameter `same_type' that was used to tell whether we could
17058 access private members we compute our containing type from the
17061 (FieldExpr): Added partial support for volatile fields. This does
17062 not work for volatile fields exposed from assemblies, as I can not
17063 figure out how to extract the modreq from it.
17065 Updated all the source files to use this.
17067 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17068 because it is referenced by MemberLookup very often.
17070 2002-01-09 Ravi Pratap <ravi@ximian.com>
17072 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17073 TypeBuilder.GetCustomAttributes to retrieve what we need.
17075 Get rid of redundant default_member_attr_type as this is the same as
17076 default_member_type which already exists.
17078 * interface.cs, attribute.cs : Update accordingly.
17080 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17082 * typemanager.cs: Enable IndexerPropertyName again. It does not
17083 work for TYpeBuilders though. Ravi, can you please fix this?
17085 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17087 * expression.cs (Argument.Emit): Handle the case of ref objects
17088 being passed to ref functions;
17090 (ParameterReference.EmitLoad): Loads the content of the pointer
17091 without dereferencing.
17093 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17095 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17097 2002-01-08 Ravi Pratap <ravi@ximian.com>
17099 * class.cs (Indexer.DefineMethod): Incorporate the interface
17100 type in the name of the method if we are doing explicit interface
17103 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17105 (BetterConversion): Fix extremely trivial bug where we were referring to
17106 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17109 * ../errors/bug16.cs : Add although we have fixed it.
17111 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17113 * expression.cs (BaseIndexer): Begin implementation.
17115 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17117 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17118 production directly to remove a shift/reduce, and implement
17119 explicit interface implementation.
17121 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17122 after a floating point suffix.
17124 * expression.cs (DoNumericPromotions): Improved the conversion for
17125 uint/uint. If we have a constant, we avoid doing a typecast to a
17128 * class.cs (Indexer): Implement explicit interface implementation
17131 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17133 * class.cs: make the default instance constructor public and hidebysig.
17135 2001-01-03 Ravi Pratap <ravi@ximian.com>
17137 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17138 so we can call it from elsewhere.
17140 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17141 we emit it internally if the class has a defined indexer; otherwise the user
17142 emits it by decorating the class definition with the DefaultMemberAttribute.
17144 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17145 attribute is not used on a type which defines an indexer.
17147 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17148 character when we skip whitespace.
17150 * ../errors/cs0646.cs : Add.
17152 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17154 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17157 * makefile: Add practical target `mcs3.exe' which builds the third
17158 generation compiler.
17160 * expression.cs (New): Fix structures constructor calling.
17162 * class.cs (Property, Method, Indexer): Emit Final flag on the
17163 method if we are an interface implementation and we are not
17166 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17167 whether this property is referencing a `base' method.
17169 * expression.cs (Invocation.EmitCall): take an extra argument:
17170 is_base, this is used to determine whether the `call' or
17171 `callvirt' opcode should be used.
17174 * delegate.cs: update EmitCall.
17176 * class.cs (Method.Define): Set NewSlot for the cases where we are
17177 not implementing an interface method.
17179 (Property.Define): ditto.
17181 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17183 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17184 'r'. Allows mcs to parse itself fully.
17186 2002-01-02 Ravi Pratap <ravi@ximian.com>
17188 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17189 of the number of initializers that require the InitializeArray method.
17191 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17192 update the above field where necessary.
17194 (MakeByteBlob): Update accordingly.
17196 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17199 (EmitDynamicInitializers): Update in accordance with the new optimization.
17201 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17202 same OpCode applies.
17204 * cs-parser.jay : Fix some glaring errors I introduced.
17206 2002-01-01 Ravi Pratap <ravi@ximian.com>
17208 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17209 so that we can check for name clashes there too.
17211 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17212 for interface indexers.
17214 * interfaces.cs (Define): Emit the default member attribute.
17216 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17217 variable was being referred to while setting the value ;-)
17219 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17221 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17222 byte-by-byte information when we know the data is zero.
17224 Make the block always a multiple of 4, because
17225 DefineInitializedData has a bug.
17227 * assign.cs: Fix, we should assign from the temporary, not from
17230 * expression.cs (MakeByteBlob): Fix my incorrect code.
17232 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17234 * typemanager.cs (EnumToUnderlying): This function is used to get
17235 the underlying type from an enumeration, because it does not
17238 * constant.cs: Use the I4_S form for values between -128 and 127.
17240 * statement.cs (Block.LookupLabel): Looks up a label.
17241 (Block): Drop support for labeled blocks.
17243 (LabeledStatement): New kind of statement that represents a label
17246 (Goto): Finally implement this bad boy.
17248 * cs-parser.jay: Update to reflect new mechanism to implement
17251 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17253 * codegen.cs (EmitContext.This): a codegen property that keeps the
17254 a single instance of this instead of creating many different this
17257 * delegate.cs (Delegate.DoResolve): Update to use the property;
17259 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17261 * expression.cs (BaseAccess.DoResolve): Ditto.
17263 2001-12-29 Ravi Pratap <ravi@ximian.com>
17265 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17266 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17268 (InitCoreTypes): Update accordingly.
17270 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17271 so we can quickly store the state.
17273 (ApplyAttributes): Set the correct implementation flags
17274 for InternalCall methods.
17276 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17278 * expression.cs (EmitCall): if a method is not virtual, then do
17279 not use callvirt on it.
17281 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17282 user defined stuff) requires the use of stobj, which takes an
17283 address on the stack instead of an array and an index. So emit
17284 the Ldelema operation for it.
17286 (EmitStoreOpcode): Use stobj for valuetypes.
17288 (UnaryMutator.EmitCode): Use the right 1 value depending on
17289 whether we are dealing with int64/uint64, float or doubles.
17291 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17292 constructors that I implemented last night.
17294 (Constructor.IsDefault): Fix to work properly for static
17297 * cs-parser.jay (CheckDef): report method signature errors.
17298 Update error number 103 to be 132.
17300 * decl.cs: New AdditionResult enumeration value: MethodExists.
17301 Although we do this check for methods later on in the semantic
17302 analysis, catching repeated default constructors is so easy that
17303 we catch these here.
17305 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17308 (ParameterReference.EmitAssign, Emit): handle
17311 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17312 (ArrayAccess.EmitStoreOpcode): ditto.
17314 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17316 * expression.cs (MakeByteBlob): Complete all the missing types
17317 (uint, short, ushort, byte, sbyte)
17319 * class.cs: Only init instance field initializers on instance
17322 Rename `constructors' to instance_constructors.
17324 (TypeContainer.AddConstructor): Only add constructors to the list
17325 if it is not static.
17327 Make sure that we handle default_static_constructor independently
17328 everywhere where we handle instance_constructors
17330 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17332 * class.cs: Do not lookup or create a base initializer for a
17333 static constructor.
17335 (ConstructorInitializer.Resolve): use the proper type to lookup
17338 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17340 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17343 * decl.cs: CloseType is now an virtual method, the default
17344 implementation just closes this type.
17346 2001-12-28 Ravi Pratap <ravi@ximian.com>
17348 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17349 to PreserveSig by default. Also emit HideBySig on such methods.
17351 Basically, set the defaults to standard values.
17353 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17354 argument, if candidate is better, it can't be worse than the best !
17356 (Invocation): Re-write bits to differentiate between methods being
17357 applicable in their expanded form and their normal form - for params
17360 Get rid of use_standard everywhere as only standard conversions are allowed
17361 in overload resolution.
17363 More spec conformance.
17365 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17367 * driver.cs: Add --timestamp, to see where the compiler spends
17370 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17371 `this' in static code.
17373 (SimpleName.DoResolve): Implement in terms of a helper function
17374 that allows static-references to be passed upstream to
17377 (Expression.ResolveWithSimpleName): Resolve specially simple
17378 names when called by MemberAccess to implement the special
17381 (Expression.ImplicitReferenceConversion): Handle conversions from
17382 Null to reference types before others, as Null's type is
17385 * expression.cs (Invocation.EmitCall): Handle the special case of
17386 calling methods declared on a reference type from a ValueType
17387 (Base classes System.Object and System.Enum)
17389 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17390 the left hand side is a TypeExpr, not on every enumeration.
17392 (Binary.Resolve): If types are reference types, then do a cast to
17393 object on operators != and == of both arguments.
17395 * typemanager.cs (FindMembers): Extract instance and static
17396 members if requested.
17398 * interface.cs (PopulateProperty): Use void_type instead of null
17399 as the return type for the setter method.
17401 (PopulateIndexer): ditto.
17403 2001-12-27 Ravi Pratap <ravi@ximian.com>
17405 * support.cs (ReflectionParameters): Fix minor bug where we
17406 were examining the wrong parameter for the ParamArray attribute.
17408 Cope with requests for the type of the parameter at position
17409 greater than the params parameter's. We now return the element
17410 type of the params array as that makes more sense.
17412 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17413 accordingly as we no longer have to extract the element type
17416 (Invocation.OverloadResolve): Update.
17418 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17420 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17421 against IEnumerator, test whether the return value is a descendant
17422 of the IEnumerator interface.
17424 * class.cs (Indexer.Define): Use an auxiliary method to implement
17425 the other bits of the method definition. Begin support for
17426 explicit interface implementation.
17428 (Property.DefineMethod): Use TypeManager.void_type instead of null
17429 for an empty return value.
17431 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17433 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17434 dealing with a FieldExpr which is composed of a FieldBuilder, in
17435 the code path we did extract the constant, but we should have
17436 obtained the underlying value to be able to cast it (otherwise we
17437 end up in an infinite loop, this is what Ravi was running into).
17439 (ArrayCreation.UpdateIndices): Arrays might be empty.
17441 (MemberAccess.ResolveMemberAccess): Add support for section
17442 14.5.4.1 that deals with the special case of E.I when E is a type
17443 and something else, that I can be a reference to a static member.
17445 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17446 handle a particular array type to create byte blobs, it is just
17447 something we dont generate byteblobs for.
17449 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17452 * location.cs (Push): remove the key from the hashtable that we
17453 are about to add. This happens for empty files.
17455 * driver.cs: Dispose files after we have parsed them.
17457 (tokenize): new function that only runs the tokenizer on its
17458 input, for speed testing.
17460 2001-12-26 Ravi Pratap <ravi@ximian.com>
17462 * class.cs (Event.Define): Define the private field only if there
17463 are no accessors defined.
17465 * expression.cs (ResolveMemberAccess): If there is no associated
17466 field with the event, that means we have an event defined with its
17467 own accessors and we should flag error cs0070 since transforming
17468 ourselves into a field is not valid in that case.
17470 * ecore.cs (SimpleName.DoResolve): Same as above.
17472 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17473 and charset to sane values.
17475 2001-12-25 Ravi Pratap <ravi@ximian.com>
17477 * assign.cs (DoResolve): Perform check on events only if they
17478 are being accessed outside the declaring type.
17480 * cs-parser.jay (event_declarations): Update rules to correctly
17481 set the type of the implicit parameter etc.
17483 (add_accessor, remove_accessor): Set current local parameters.
17485 * expression.cs (Binary): For delegate addition and subtraction,
17486 cast the return value from the method into the appropriate delegate
17489 2001-12-24 Ravi Pratap <ravi@ximian.com>
17491 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17492 of these as the workaround is unnecessary.
17494 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17495 delegate data - none of that is needed at all.
17497 Re-write bits to extract the instance expression and the delegate method
17500 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17503 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17504 of attaching attributes instead of duplicating code everywhere.
17506 * everywhere : Update code to do attribute emission using the above method.
17508 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17510 * expression.cs (IsParamsMethodApplicable): if there are not
17511 parameters, return immediately.
17513 * ecore.cs: The 0 literal can be implicity converted to an enum
17516 (SimpleName.DoResolve): First lookup the type, then lookup the
17519 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17520 want to get its address. If the InstanceExpression is not
17521 addressable, store the result in a temporary variable, then get
17524 * codegen.cs: Only display 219 errors on warning level or above.
17526 * expression.cs (ArrayAccess): Make it implement the
17527 IMemoryLocation interface.
17529 (Binary.DoResolve): handle the operator == (object a, object b)
17530 and operator != (object a, object b) without incurring into a
17531 BoxedCast (because 5 != o should never be performed).
17533 Handle binary enumerator operators.
17535 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17536 value type, otherwise use Ldelem_ref.
17538 Use precomputed names;
17540 (AddressOf): Implement address of
17542 * cs-parser.jay (labeled_statement): Fix recursive block
17543 addition by reworking the production.
17545 * expression.cs (New.DoEmit): New has a special case:
17547 If we are dealing with a ValueType, we have a few
17548 situations to deal with:
17550 * The target of New is a ValueType variable, that is
17551 easy, we just pass this as the variable reference
17553 * The target of New is being passed as an argument,
17554 to a boxing operation or a function that takes a
17557 In this case, we need to create a temporary variable
17558 that is the argument of New.
17561 2001-12-23 Ravi Pratap <ravi@ximian.com>
17563 * rootcontext.cs (LookupType): Check that current_type is not null before
17564 going about looking at nested types.
17566 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17567 not implement the IAssignMethod interface any more.
17569 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17570 where we tranform them into FieldExprs if they are being resolved from within
17571 the declaring type.
17573 * ecore.cs (SimpleName.DoResolve): Do the same here.
17575 * assign.cs (DoResolve, Emit): Clean up code considerably.
17577 * ../errors/bug10.cs : Add.
17579 * ../errors/cs0070.cs : Add.
17581 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17583 * assign.cs : Get rid of EventIsLocal everywhere.
17585 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17587 * ecore.cs (ConvertIntLiteral): finished the implementation.
17589 * statement.cs (SwitchLabel): Convert the value we are using as a
17590 key before looking up the table.
17592 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17594 * codegen.cs (EmitTopBlock): Require a Location argument now.
17596 * cs-parser.jay (constructor_declarator): We need to setup
17597 current_local_parameters before we parse the
17598 opt_constructor_initializer, to allow the variables to be bound
17599 to the constructor arguments.
17601 * rootcontext.cs (LookupType): First lookup nested classes in our
17602 class and our parents before we go looking outside our class.
17604 * expression.cs (ConstantFold): Extract/debox the values at the
17607 * rootcontext.cs (EmitCode): Resolve the constants first before we
17608 resolve the types. This is not really needed, but it helps debugging.
17610 * statement.cs: report location.
17612 * cs-parser.jay: pass location to throw statement.
17614 * driver.cs: Small bug fix.
17616 * report.cs: Updated format to be 4-zero filled digits.
17618 2001-12-22 Ravi Pratap <ravi@ximian.com>
17620 * expression.cs (CheckIndices): Fix minor bug where the wrong
17621 variable was being referred to ;-)
17623 (DoEmit): Do not call EmitStaticInitializers when the
17624 underlying type is System.Object.
17626 2001-12-21 Ravi Pratap <ravi@ximian.com>
17628 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17629 and do the usual workaround for SRE.
17631 * class.cs (MyEventBuilder.EventType): New member to get at the type
17632 of the event, quickly.
17634 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17636 * assign.cs (Assign.DoResolve): Handle the case when the target
17637 is an EventExpr and perform the necessary checks.
17639 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17642 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17644 (EventExpr): Set the type in the constructor itself since we
17645 are meant to be born fully resolved.
17647 (EventExpr.Define): Revert code I wrote earlier.
17649 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17650 instance expression is null. The instance expression is a This in that case
17651 or a null, depending on whether it is a static method or not.
17653 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17654 refers to more than one method.
17656 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17657 and accordingly flag errors.
17659 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17661 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17663 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17665 * location.cs (ToString): Provide useful rutine.
17667 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17669 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17670 objects, return the actual integral boxed.
17672 * statement.cs (SwitchLabel): define an ILLabel for each
17675 (Switch.CheckSwitch): If the value is a Literal, extract
17676 the underlying literal.
17678 Also in the unused hashtable we had, add the SwitchLabel so we can
17679 quickly look this value up.
17681 * constant.cs: Implement a bunch of new constants. Rewrite
17682 Literal based on this. Made changes everywhere to adapt to this.
17684 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17685 dereferencing array only once, and also copes with enumrations.
17687 bytes are two bytes wide, not one.
17689 (Cast): Perform constant conversions.
17691 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17692 wrappers to the literals here.
17694 * expression.cs (DoNumericPromotions): long literals can converted
17695 to ulong implicity (this is taken care of elsewhere, but I was
17696 missing this spot).
17698 * ecore.cs (Expression.Literalize): Make the return type Literal,
17699 to improve type checking.
17701 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17703 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17705 * literal.cs: Revert code from ravi that checked the bounds. The
17706 bounds are sane by the definition of the type itself.
17708 * typemanager.cs: Fix implementation of ImplementsInterface. We
17709 need to actually look up in our parent hierarchy for interfaces
17712 * const.cs: Use the underlying type for enumerations
17714 * delegate.cs: Compute the basename for the delegate creation,
17715 that should fix the delegate test case, and restore the correct
17716 Type Lookup semantics in rootcontext
17718 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17719 referencing a nested type with the Reflection API is using the "+"
17722 * cs-parser.jay: Do not require EOF token at the end.
17724 2001-12-20 Ravi Pratap <ravi@ximian.com>
17726 * rootcontext.cs (LookupType): Concatenate type names with
17727 a '.' instead of a '+' The test suite passes again.
17729 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17730 field of the enumeration.
17732 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17733 the case when the member is an EventExpr.
17735 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17736 static has an associated instance expression.
17738 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17740 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17742 * class.cs (Event.Define): Register event and perform appropriate checks
17745 We define the Add and Remove methods even if the use provides none because
17746 in that case, we provide default implementations ourselves.
17748 Define a private field of the type of the event. This is done by the CSC compiler
17749 and we should be doing it too ;-)
17751 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17752 More methods we use in code we generate.
17754 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17757 (InitCoreTypes): Update accordingly for the above.
17759 * class.cs (Event.Emit): Generate code for default accessors that we provide
17761 (EmitDefaultMethod): Do the job in the above.
17763 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17766 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17768 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17769 builders even if we were missing one.
17771 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17772 pass the Basename as our class name instead of the Name. The
17773 basename will be correctly composed for us.
17775 * parameter.cs (Paramters): Now takes a Location argument.
17777 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17778 make all the code call directly LookupType in RootContext and take
17779 this chance to pass the Location information everywhere.
17781 * Everywhere: pass Location information.
17783 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17785 * class.cs (Constructor.Define): Updated way of detecting the
17786 length of the parameters.
17788 (TypeContainer.DefineType): Use basename as the type name for
17791 (TypeContainer.Define): Do not recursively define types here, as
17792 definition is taken care in order by the RootContext.
17794 * tree.cs: Keep track of namespaces in a per-file basis.
17796 * parameter.cs (Parameter.ComputeSignature): Update to use
17799 (Parameters.GetSignature): ditto.
17801 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17802 instead of a TypeContainer.
17804 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17805 resolve names. Because we need to be resolve in our context, not
17808 * driver.cs: Implement response files.
17810 * class.cs (TypeContainer.DefineType): If we are defined, do not
17811 redefine ourselves.
17813 (Event.Emit): Emit the code for add/remove handlers.
17814 (Event.Define): Save the MethodBuilders for add/remove.
17816 * typemanager.cs: Use pair here too.
17818 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17819 DictionaryEntry requires the first argument to be non-null.
17821 (enum_declaration): Compute full name for registering the
17824 (delegate_declaration): Instead of using
17825 formal_parameter_list, use opt_formal_parameter_list as the list
17828 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17829 (EventParsing): New property that controls whether `add' and
17830 `remove' are returned as tokens or identifiers (for events);
17832 2001-12-19 Ravi Pratap <ravi@ximian.com>
17834 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17835 use MyEventBuilder only and let it wrap the real builder for us.
17837 (MyEventBuilder): Revamp constructor etc.
17839 Implement all operations that we perform on EventBuilder in precisely the same
17842 (FindMembers): Update to use the EventBuilder member.
17844 (Event.Emit): Update accordingly.
17846 2001-12-18 Ravi Pratap <ravi@ximian.com>
17848 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17849 by calling the appropriate methods.
17851 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17854 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17856 2001-12-17 Ravi Pratap <ravi@ximian.com>
17858 * delegate.cs (Delegate.Populate): Check that the return type
17859 and various parameters types are indeed accessible.
17861 * class.cs (Constructor.Define): Same here.
17863 (Field.Define): Ditto.
17865 (Event.Define): Ditto.
17867 (Operator.Define): Check that the underlying Method defined itself
17868 correctly - so it's MethodBuilder should not be null.
17870 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17871 expression happens to be null.
17873 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17874 members but as of now we don't seem to be able to do anything really useful with it.
17876 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17877 not the EventBuilder.
17879 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17881 * cs-tokenizer.cs: Add support for defines.
17882 Add support for #if, #elif, #else, #endif
17884 (eval_var): evaluates a variable.
17885 (eval): stubbed for evaluating functions.
17887 * cs-parser.jay: Pass the defines information
17889 * driver.cs: Add --define command line option.
17891 * decl.cs: Move MemberCore here.
17893 Make it the base class for DeclSpace. This allows us to catch and
17894 report 108 and 109 for everything now.
17896 * class.cs (TypeContainer.Define): Extract all the members
17897 before populating and emit the warning 108 (new keyword required
17898 to override) instead of having each member implement this.
17900 (MemberCore.Define): New abstract method, we will be using this in
17901 the warning reporting engine in Populate.
17903 (Operator.Define): Adjust to new MemberCore protocol.
17905 * const.cs (Const): This does not derive from Expression, it is a
17906 temporary object we use to create fields, it is a MemberCore.
17908 * class.cs (Method.Define): Allow the entry point to be in a
17911 * driver.cs: Rewrite the argument handler to clean it up a bit.
17913 * rootcontext.cs: Made it just an auxiliary namespace feature by
17914 making everything static.
17916 * driver.cs: Adapt code to use RootContext type name instead of
17919 * delegate.cs: Remove RootContext argument.
17921 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17924 * class.cs (Event.Define): The lookup can fail.
17926 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17928 * expression.cs: Resolve the this instance before invoking the code.
17930 2001-12-17 Miguel de Icaza <miguel@ximian.com>
17932 * cs-parser.jay: Add a production in element_access that allows
17933 the thing to become a "type" reference. This way we can parse
17934 things like "(string [])" as a type.
17936 Note that this still does not handle the more complex rules of
17940 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
17942 * ecore.cs: (CopyNewMethods): new utility function used to
17943 assemble the list of methods from running FindMembers.
17945 (MemberLookup): Rework FindMembers so that
17947 2001-12-16 Miguel de Icaza <miguel@ximian.com>
17949 * class.cs (TypeContainer): Remove Delegates who fail to be
17952 * delegate.cs (Populate): Verify that we dont get null return
17953 values. TODO: Check for AsAccessible.
17955 * cs-parser.jay: Use basename to emit error 574 (destructor should
17956 have the same name as container class), not the full name.
17958 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
17959 possible representation.
17961 Also implements integer type suffixes U and L.
17963 2001-12-15 Miguel de Icaza <miguel@ximian.com>
17965 * expression.cs (ArrayCreation.DoResolve): We need to do the
17966 argument resolution *always*.
17968 * decl.cs: Make this hold the namespace. Hold the root context as
17970 (LookupType): Move here.
17972 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
17974 * location.cs (Row, Name): Fixed the code, it was always returning
17975 references to the first file.
17977 * interface.cs: Register properties defined through interfaces.
17979 * driver.cs: Add support for globbing on the command line
17981 * class.cs (Field): Make it derive from MemberCore as well.
17984 2001-12-15 Ravi Pratap <ravi@ximian.com>
17986 * class.cs (Event::Define): Check that the type of the event is a delegate
17987 type else flag error #66.
17989 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
17992 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
17993 values of EntryPoint, CharSet etc etc.
17995 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
17997 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
17998 be null and we should ignore this. I am not sure if this is really clean. Apparently,
17999 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18000 which needs this to do its work.
18002 * ../errors/cs0066.cs : Add.
18004 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18006 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18009 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18010 clears out the parameters field.
18011 (MemberSignatureCompare): Cleanup
18013 (MemberCore): New base class used to share code between MethodCore
18016 (RegisterRequiredImplementations) BindingFlags.Public requires
18017 either BindingFlags.Instace or Static. Use instance here.
18019 (Property): Refactored code to cope better with the full spec.
18021 * parameter.cs (GetParameterInfo): Return an empty array instead
18024 * class.cs (Property): Abstract or extern properties have no bodies.
18026 * parameter.cs (GetParameterInfo): return a zero-sized array.
18028 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18029 method modifier validation to the typecontainer so we can reuse
18030 this on properties.
18032 (MethodCore.ParameterTypes): return an empty sized array of types.
18034 (Property.Define): Test property modifier validity.
18036 Add tests for sealed/override too.
18038 (Method.Emit): abstract or extern methods have no bodies.
18040 2001-12-14 Ravi Pratap <ravi@ximian.com>
18042 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18045 (Method::Define, ::Emit): Modify accordingly.
18047 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18049 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18051 * makefile: Pass in /unsafe.
18053 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18055 * class.cs (MakeKey): Kill routine.
18057 * class.cs (TypeContainer.Define): Correctly define explicit
18058 method implementations (they require the full interface name plus
18061 * typemanager.cs: Deply the PtrHashtable here and stop using the
18062 lame keys. Things work so much better.
18064 This of course broke everyone who depended on `RegisterMethod' to
18065 do the `test for existance' test. This has to be done elsewhere.
18067 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18068 the object stupid Equals method (because, that like fails all over
18069 the place). We still do not use it.
18071 * class.cs (TypeContainer.SetRequiredInterface,
18072 TypeContainer.RequireMethods): Killed these two routines and moved
18073 all the functionality to RegisterRequiredImplementations.
18075 (TypeContainer.RegisterRequiredImplementations): This routine now
18076 registers all the implementations required in an array for the
18077 interfaces and abstract methods. We use an array of structures
18078 which can be computed ahead of time to reduce memory usage and we
18079 also assume that lookups are cheap as most classes will not
18080 implement too many interfaces.
18082 We also avoid creating too many MethodSignatures.
18084 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18085 clear the "pending" bit if we find that there are problems with
18088 (TypeContainer.VerifyPendingMethods): Update to report errors of
18089 methods that look like implementations but are not.
18091 (TypeContainer.Define): Add support for explicit interface method
18094 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18096 * typemanager.cs: Keep track of the parameters here instead of
18097 being a feature of the TypeContainer.
18099 * class.cs: Drop the registration of parameters here, as
18100 InterfaceMethods are also interface declarations.
18102 * delegate.cs: Register methods with the TypeManager not only with
18103 the TypeContainer. This code was buggy.
18105 * interface.cs: Full registation here.
18107 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18109 * expression.cs: Remove reducer for binary expressions, it can not
18112 * const.cs: Put here the code that used to go into constant.cs
18114 * constant.cs: Put here the code for constants, this is a new base
18115 class for Literals.
18117 * literal.cs: Make Literal derive from Constant.
18119 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18121 * statement.cs (Return.Emit): Report error 157 if the user
18122 attempts to return from a finally block.
18124 (Return.Emit): Instead of emitting a return, jump to the end of
18127 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18128 LocalBuilder to store the result of the function. ReturnLabel is
18129 the target where we jump.
18132 2001-12-09 Radek Doulik <rodo@ximian.com>
18134 * cs-parser.jay: remember alias in current namespace
18136 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18139 * class.cs (LookupAlias): lookup alias in my_namespace
18141 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18143 (LookupAlias): lookup alias in this and if needed in parent
18146 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18150 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18151 making things static. I need this to avoid passing the
18152 TypeContainer when calling ParameterType.
18154 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18155 that did string manipulation to compute the type and then call
18156 GetType. Use Parameter.ParameterType instead.
18158 * cs-tokenizer.cs: Consume the suffix for floating values.
18160 * expression.cs (ParameterReference): figure out whether this is a
18161 reference parameter or not. Kill an extra variable by computing
18162 the arg_idx during emission.
18164 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18165 function that returns whether a parameter is an out/ref value or not.
18167 (Parameter.ParameterType): The type of the parameter (base,
18168 without ref/out applied).
18170 (Parameter.Resolve): Perform resolution here.
18171 (Parameter.ExternalType): The full type (with ref/out applied).
18173 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18174 support for expressions on the using statement.
18176 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18178 * statement.cs (Using.EmitLocalVariableDecls): Split the
18179 localvariable handling of the using statement.
18181 (Block.EmitMeta): Keep track of variable count across blocks. We
18182 were reusing slots on separate branches of blocks.
18184 (Try.Emit): Emit the general code block, we were not emitting it.
18186 Check the type of the declaration to be an IDisposable or
18187 something that can be implicity converted to it.
18189 Emit conversions if required.
18191 * ecore.cs (EmptyExpression): New utility class.
18192 (Expression.ImplicitConversionExists): New utility function.
18194 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18196 * statement.cs (Using): Implement.
18198 * expression.cs (LocalVariableReference): Support read only variables.
18200 * statement.cs: Remove the explicit emit for the Leave opcode.
18201 (VariableInfo): Add a readonly field.
18203 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18205 * ecore.cs (ConvCast): new class used to encapsulate the various
18206 explicit integer conversions that works in both checked and
18207 unchecked contexts.
18209 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18210 properly generate the overflow opcodes.
18212 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18214 * statement.cs: The correct type for the EmptyExpression is the
18215 element_type, not the variable type. Ravi pointed this out.
18217 2001-12-04 Ravi Pratap <ravi@ximian.com>
18219 * class.cs (Method::Define): Handle PInvoke methods specially
18220 by using DefinePInvokeMethod instead of the usual one.
18222 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18223 above to do the task of extracting information and defining the method.
18225 2001-12-04 Ravi Pratap <ravi@ximian.com>
18227 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18228 of the condition for string type.
18230 (Emit): Move that here.
18232 (ArrayCreation::CheckIndices): Keep string literals in their expression
18235 (EmitDynamicInitializers): Handle strings appropriately.
18237 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18239 * codegen.cs (EmitContext): Replace multiple variables with a
18240 single pointer to the current Switch statement.
18242 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18245 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18249 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18252 (Foreach.Emit): Foreach on arrays was not setting
18253 up the loop variables (for break/continue).
18255 (GotoCase): Semi-implented.
18257 2001-12-03 Ravi Pratap <ravi@ximian.com>
18259 * attribute.cs (CheckAttribute): Handle system attributes by using
18260 Attribute.GetAttributes to examine information we need.
18262 (GetValidPlaces): Same here.
18264 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18266 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18268 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18270 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18272 (Method::Emit): Handle the case when we are a PInvoke method.
18274 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18276 * expression.cs: Use ResolveWithSimpleName on compound names.
18278 2001-12-02 Ravi Pratap <ravi@ximian.com>
18280 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18281 before trying to reduce it.
18283 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18285 * constant.cs (LookupConstantValue): Implement.
18287 (EmitConstant): Use the above in emitting the constant.
18289 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18290 that are user-defined by doing a LookupConstantValue on them.
18292 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18295 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18297 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18299 (BaseAccess.DoResolve): Implement.
18301 (MemberAccess.DoResolve): Split this routine into a
18302 ResolveMemberAccess routine that can be used independently
18304 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18306 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18307 As that share bits of the implementation. Is returns a boolean,
18308 while As returns the Type that is being probed.
18310 2001-12-01 Ravi Pratap <ravi@ximian.com>
18312 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18313 instead of a Literal - much easier.
18315 (EnumInTransit): Remove - utterly useless :-)
18317 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18319 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18321 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18322 chain when we have no associated expression.
18324 2001-11-30 Ravi Pratap <ravi@ximian.com>
18326 * constant.cs (Define): Use Location while reporting the errror.
18328 Also emit a warning when 'new' is used and there is no inherited
18331 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18334 (LookupEnumValue): Implement to lookup an enum member's value and define it
18337 (Populate): Re-write accordingly to use the above routine.
18339 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18341 * expression.cs (This): Fix prototype for DoResolveLValue to
18342 override the base class DoResolveLValue.
18344 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18347 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18348 (we need to load the address of the field here). This fixes
18351 (FieldExpr.DoResolveLValue): Call the DoResolve
18352 function to initialize the Instance expression.
18354 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18355 correctly the GetEnumerator operation on a value type.
18357 * cs-parser.jay: Add more simple parsing error catches.
18359 * statement.cs (Switch): Add support for string switches.
18360 Handle null specially.
18362 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18364 2001-11-28 Ravi Pratap <ravi@ximian.com>
18366 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18368 (declare_local_constant): New helper function.
18370 * statement.cs (AddConstant): Keep a separate record of constants
18372 (IsConstant): Implement to determine if a variable is a constant.
18374 (GetConstantExpression): Implement.
18376 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18378 * statement.cs (IsVariableDefined): Re-write.
18380 2001-11-27 Ravi Pratap <ravi@ximian.com>
18382 * class.cs (TypeContainer::FindMembers): Look for constants
18383 in the case when we are looking for MemberTypes.Field
18385 * expression.cs (MemberAccess::DoResolve): Check that in the
18386 case we are a FieldExpr and a Literal, we are not being accessed
18387 by an instance reference.
18389 * cs-parser.jay (local_constant_declaration): Implement.
18391 (declaration_statement): Implement for constant declarations.
18393 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18395 * statement.cs (Switch): Catch double defaults.
18397 (Switch): More work on the switch() statement
18398 implementation. It works for integral values now, need to finish
18402 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18404 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18405 integer literals into other integer literals. To be used by
18408 2001-11-24 Ravi Pratap <ravi@ximian.com>
18410 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18413 (EmitDynamicInitializers): Cope with the above since we extract data
18414 directly from ArrayData now.
18416 (ExpectInitializers): Keep track of whether initializers are mandatory
18419 (Bounds): Make it a hashtable to prevent the same dimension being
18420 recorded for every element in that dimension.
18422 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18425 Also fix bug which was causing the indices to be emitted in the reverse
18428 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18430 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18431 unfinished. They do not work, because the underlying code is
18434 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18436 * cs-parser.jay: Remove bogus fixme.
18438 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18439 on Switch statement.
18441 2001-11-23 Ravi Pratap <ravi@ximian.com>
18443 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18446 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18447 parameter. Apparently, any expression is allowed.
18449 (ValidateInitializers): Update accordingly.
18451 (CheckIndices): Fix some tricky bugs thanks to recursion.
18453 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18454 I was being completely brain-dead.
18456 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18457 and re-write acordingly.
18459 (DelegateInvocation): Re-write accordingly.
18461 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18463 (MakeByteBlob): Handle types more correctly.
18465 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18466 initialization from expressions but it is incomplete because I am a complete
18469 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18471 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18472 on If. Basically, we have to return `true' (ie, we do return to
18473 our caller) only if both branches of the if return.
18475 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18476 short-circuit operators, handle them as short circuit operators.
18478 (Cast.DoResolve): Resolve type.
18479 (Cast.Cast): Take an expression as the target type.
18481 * cs-parser.jay (cast_expression): Remove old hack that only
18482 allowed a limited set of types to be handled. Now we take a
18483 unary_expression and we resolve to a type during semantic
18486 Use the grammar productions from Rhys to handle casts (this is
18487 not complete like Rhys syntax yet, we fail to handle that corner
18488 case that C# has regarding (-x), but we will get there.
18490 2001-11-22 Ravi Pratap <ravi@ximian.com>
18492 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18493 field which is an array type.
18495 * cs-parser.jay (declare_local_variables): Support array initialization too.
18497 * typemanager.cs (MakeKey): Implement.
18499 (everywhere): Use the above appropriately.
18501 * cs-parser.jay (for_statement): Update for array initialization while
18502 declaring variables.
18504 * ecore.cs : The error message was correct, it's the variable's names that
18505 were misleading ;-) Make the code more readable.
18507 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18508 the correct type etc.
18510 (ConvertExplicit): Handle Enum types by examining the underlying type.
18512 2001-11-21 Ravi Pratap <ravi@ximian.com>
18514 * parameter.cs (GetCallingConvention): Always return
18515 CallingConventions.Standard for now.
18517 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18519 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18520 and `r' after calling DoNumericPromotions.
18522 * ecore.cs: Fix error message (the types were in the wrong order).
18524 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18525 BindingFlags.Instance as well
18527 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18528 implicit int literal conversion in an empty cast so that we
18529 propagate the right type upstream.
18531 (UnboxCast): new class used to unbox value types.
18532 (Expression.ConvertExplicit): Add explicit type conversions done
18535 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18536 the target type before applying the implicit LongLiterals to ULong
18539 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18541 * cs-parser.jay (for_statement): Reworked the way For works: now
18542 we declare manually any variables that are introduced in
18543 for_initializer to solve the problem of having out-of-band code
18544 emition (that is what got for broken).
18546 (declaration_statement): Perform the actual variable declaration
18547 that used to be done in local_variable_declaration here.
18549 (local_variable_declaration): Do not declare anything, just pass
18550 the information on a DictionaryEntry
18552 2001-11-20 Ravi Pratap <ravi@ximian.com>
18554 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18555 re-write of the logic to now make it recursive.
18557 (UpdateIndices): Re-write accordingly.
18559 Store element data in a separate ArrayData list in the above methods.
18561 (MakeByteBlob): Implement to dump the array data into a byte array.
18563 2001-11-19 Ravi Pratap <ravi@ximian.com>
18565 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18568 * constant.cs (Define): Implement.
18570 (EmitConstant): Re-write fully.
18572 Pass in location info.
18574 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18577 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18578 DictionaryEntry since we need location info too.
18580 (constant_declaration): Update accordingly.
18582 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18583 code into another method : UpdateIndices.
18585 2001-11-18 Ravi Pratap <ravi@ximian.com>
18587 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18588 some type checking etc.
18590 2001-11-17 Ravi Pratap <ravi@ximian.com>
18592 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18593 bits to provide dimension info if the user skips doing that.
18595 Update second constructor to store the rank correctly.
18597 2001-11-16 Ravi Pratap <ravi@ximian.com>
18599 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18600 and try to implement.
18602 * ../errors/cs0150.cs : Add.
18604 * ../errors/cs0178.cs : Add.
18606 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18608 * statement.cs: Implement foreach on multi-dimensional arrays.
18610 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18611 name of the params argument.
18613 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18614 initializing the array.
18616 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18617 we can use this elsewhere.
18619 * statement.cs: Finish implementation of foreach for single
18622 * cs-parser.jay: Use an out-of-band stack to pass information
18623 around, I wonder why I need this.
18625 foreach_block: Make the new foreach_block the current_block.
18627 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18628 function used to return a static Parameters structure. Used for
18629 empty parameters, as those are created very frequently.
18631 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18633 2001-11-15 Ravi Pratap <ravi@ximian.com>
18635 * interface.cs : Default modifier is private, not public. The
18636 make verify test passes again.
18638 2001-11-15 Ravi Pratap <ravi@ximian.com>
18640 * support.cs (ReflectionParameters): Fix logic to determine
18641 whether the last parameter is a params one. Test 9 passes again.
18643 * delegate.cs (Populate): Register the builders we define with
18644 RegisterParameterForBuilder. Test 19 passes again.
18646 * cs-parser.jay (property_declaration): Reference $6 instead
18647 of $$ to get at the location.
18649 (indexer_declaration): Similar stuff.
18651 (attribute): Ditto.
18653 * class.cs (Property): Register parameters for the Get and Set methods
18654 if they exist. Test 23 passes again.
18656 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18657 call to EmitArguments as we are sure there aren't any params arguments.
18658 Test 32 passes again.
18660 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18661 IndexOutOfRangeException.
18663 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18664 Test 33 now passes again.
18666 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18668 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18669 broke a bunch of things. Will have to come up with a better way
18670 of tracking locations.
18672 * statement.cs: Implemented foreach for single dimension arrays.
18674 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18676 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18677 an error. This removes the lookup from the critical path.
18679 * cs-parser.jay: Removed use of temporary_loc, which is completely
18682 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18684 * support.cs (ReflectionParameters.ParameterModifier): Report
18685 whether the argument is a PARAMS argument or not.
18687 * class.cs: Set the attribute `ParamArrayAttribute' on the
18688 parameter argument.
18690 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18691 and cons_param_array_attribute (ConstructorInfo for
18692 ParamArrayAttribute).,
18694 * codegen.cs: Emit the return using the `Return' statement, that
18695 way we can report the error correctly for missing return values.
18697 * class.cs (Method.Emit): Clean up.
18699 * expression.cs (Argument.Resolve): Take another argument: the
18700 location where this argument is used. Notice that this is not
18701 part of the "Argument" class as to reduce the size of the
18702 structure (we know the approximate location anyways).
18704 Test if the argument is a variable-reference, if not, then
18705 complain with a 206.
18707 (Argument.Emit): Emit addresses of variables.
18709 (Argument.FullDesc): Simplify.
18711 (Invocation.DoResolve): Update for Argument.Resolve.
18713 (ElementAccess.DoResolve): ditto.
18715 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18716 method should be virtual, as this method is always virtual.
18718 (NewDelegate.DoResolve): Update for Argument.Resolve.
18720 * class.cs (ConstructorInitializer.DoResolve): ditto.
18722 * attribute.cs (Attribute.Resolve): ditto.
18724 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18726 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18728 * expression.cs (ParameterReference): Drop IStackStorage and implement
18729 IAssignMethod instead.
18731 (LocalVariableReference): ditto.
18733 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18734 IAssignMethod instead.
18736 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18738 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18739 enumerations that are used in heavily used structures derive from
18740 byte in a laughable and pathetic attempt to reduce memory usage.
18741 This is the kind of pre-optimzations that you should not do at
18742 home without adult supervision.
18744 * expression.cs (UnaryMutator): New class, used to handle ++ and
18745 -- separatedly from the other unary operators. Cleans up the
18746 code, and kills the ExpressionStatement dependency in Unary.
18748 (Unary): Removed `method' and `Arguments' from this class, making
18749 it smaller, and moving it all to SimpleCall, so I can reuse this
18750 code in other locations and avoid creating a lot of transient data
18751 strucutres when not required.
18753 * cs-parser.jay: Adjust for new changes.
18755 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18757 * enum.cs (Enum.Populate): If there is a failure during
18760 * cs-parser.jay (opt_enum_base): we used to catch type errors
18761 here, but this is really incorrect. The type error should be
18762 catched during semantic analysis.
18764 2001-12-11 Ravi Pratap <ravi@ximian.com>
18766 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18767 current_local_parameters as expected since I, in my stupidity, had forgotten
18770 * attribute.cs (GetValidPlaces): Fix stupid bug.
18772 * class.cs (Method::Emit): Perform check on applicability of attributes.
18774 (Constructor::Emit): Ditto.
18776 (Field::Emit): Ditto.
18778 (Field.Location): Store location information.
18780 (Property, Event, Indexer, Operator): Ditto.
18782 * cs-parser.jay (field_declaration): Pass in location for each field.
18784 * ../errors/cs0592.cs : Add.
18786 2001-11-12 Ravi Pratap <ravi@ximian.com>
18788 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18790 (InitCoreTypes): Update accordingly.
18792 (RegisterAttrType, LookupAttr): Implement.
18794 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18795 info about the same.
18797 (Resolve): Update to populate the above as necessary.
18799 (Error592): Helper.
18801 (GetValidPlaces): Helper to the above.
18803 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18805 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18807 2001-11-12 Ravi Pratap <ravi@ximian.com>
18809 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18811 * ../errors/cs0617.cs : Add.
18813 2001-11-11 Ravi Pratap <ravi@ximian.com>
18815 * enum.cs (Emit): Rename to Populate to be more consistent with what
18816 we expect it to do and when exactly it is called.
18818 * class.cs, rootcontext.cs : Update accordingly.
18820 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18821 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18823 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18825 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18826 of a fieldinfo using the above, when dealing with a FieldBuilder.
18828 2001-11-10 Ravi Pratap <ravi@ximian.com>
18830 * ../errors/cs0031.cs : Add.
18832 * ../errors/cs1008.cs : Add.
18834 * ../errrors/cs0543.cs : Add.
18836 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18839 (FindMembers): Implement.
18841 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18842 enums and delegates too.
18844 (enum_types): Rename to builder_to_enum.
18846 (delegate_types): Rename to builder_to_delegate.
18848 * delegate.cs (FindMembers): Implement.
18850 2001-11-09 Ravi Pratap <ravi@ximian.com>
18852 * typemanager.cs (IsEnumType): Implement.
18854 * enum.cs (Emit): Re-write parts to account for the underlying type
18855 better and perform checking etc.
18857 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18858 of the underlying type.
18860 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18863 * enum.cs (error31): Helper to report error #31.
18865 * cs-parser.jay (enum_declaration): Store location of each member too.
18867 * enum.cs (member_to_location): New hashtable.
18869 (AddEnumMember): Update location hashtable.
18871 (Emit): Use the location of each member while reporting errors.
18873 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18875 * cs-parser.jay: A for_initializer if is a
18876 local_variable_declaration really ammount to have an implicit
18877 block with the variable declaration and no initializer for for.
18879 * statement.cs (For.Emit): Cope with null initializers.
18881 This fixes the infinite loop on for initializers.
18883 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18885 * enum.cs: More cleanup.
18887 * ecore.cs: Remove dead code.
18889 * class.cs (Property.Emit): More simplification.
18890 (Event.Emit): ditto.
18892 Reworked to have less levels of indentation.
18894 2001-11-08 Ravi Pratap <ravi@ximian.com>
18896 * class.cs (Property): Emit attributes.
18906 * enum.cs (Emit): Ditto.
18908 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18911 * class.cs (Field, Event, etc.): Move attribute generation into the
18912 Emit method everywhere.
18914 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18915 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18916 as we had no way of defining nested enums !
18918 * rootcontext.cs : Adjust code accordingly.
18920 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18922 2001-11-07 Ravi Pratap <ravi@ximian.com>
18924 * expression.cs (EvalConstantExpression): Move into ecore.cs
18926 * enum.cs (Enum): Rename some members and make them public and readonly
18927 according to our convention.
18929 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
18932 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
18934 (Enum::Emit): Write a simple version for now which doesn't try to compute
18935 expressions. I shall modify this to be more robust in just a while.
18937 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
18939 (TypeContainer::CloseType): Create the Enum types too.
18941 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
18943 * expression.cs (EvalConstantExpression): Get rid of completely.
18945 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
18946 user-defined values and other cases.
18948 (IsValidEnumLiteral): Helper function.
18950 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
18951 out there in the case we had a literal FieldExpr.
18953 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
18955 (Literalize): Revamp a bit to take two arguments.
18957 (EnumLiteral): New class which derives from Literal to wrap enum literals.
18959 2001-11-06 Ravi Pratap <ravi@ximian.com>
18961 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
18963 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
18965 (Resolve): Use the above to ensure we have proper initializers.
18967 2001-11-05 Ravi Pratap <ravi@ximian.com>
18969 * expression.cs (Expression::EvalConstantExpression): New method to
18970 evaluate constant expressions.
18972 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
18974 2001-11-07 Miguel de Icaza <miguel@ximian.com>
18976 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
18979 (Binary.ResolveOperator): Handle operator != (object a, object b)
18980 and operator == (object a, object b);
18982 (Binary.DoNumericPromotions): Indicate whether the numeric
18983 promotion was possible.
18985 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
18988 Made the ArrayAccess implement interface IAssignMethod instead of
18989 IStackStore as the order in which arguments are passed reflects
18992 * assign.cs: Instead of using expr.ExprClass to select the way of
18993 assinging, probe for the IStackStore/IAssignMethod interfaces.
18995 * typemanager.cs: Load InitializeArray definition.
18997 * rootcontext.cs (RootContext.MakeStaticData): Used to define
18998 static data that can be used to initialize arrays.
19000 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19002 * expression.cs: Handle operator== and operator!= for booleans.
19004 (Conditioal.Reduce): Implement reducer for the ?: operator.
19006 (Conditional.Resolve): Implement dead code elimination.
19008 (Binary.Resolve): Catch string literals and return a new
19009 concatenated string.
19011 (Unary.Reduce): Implement reduction of unary expressions.
19013 * ecore.cs: Split out the expression core handling here.
19015 (Expression.Reduce): New method used to perform constant folding
19016 and CSE. This is needed to support constant-expressions.
19018 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19019 targets, and optimize for !x.
19021 2001-11-04 Ravi Pratap <ravi@ximian.com>
19023 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19024 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19025 set custom atttributes.
19027 * literal.cs (Literal::GetValue): New abstract method to return the actual
19028 value of the literal, cast as an object.
19030 (*Literal): Implement GetValue method.
19032 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19033 expressions to the arraylist but objects of type Argument.
19035 * class.cs (TypeContainer::Emit): Emit our attributes too.
19037 (Method::Emit, Constructor::Emit): Ditto.
19039 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19040 to be ignoring earlier.
19042 2001-11-03 Ravi Pratap <ravi@ximian.com>
19044 * attribute.cs (AttributeSection::Define): Implement to do the business
19045 of constructing a CustomAttributeBuilder.
19047 (Attribute): New trivial class. Increases readability of code.
19049 * cs-parser.jay : Update accordingly.
19051 (positional_argument_list, named_argument_list, named_argument): New rules
19053 (attribute_arguments): Use the above so that we are more correct.
19055 2001-11-02 Ravi Pratap <ravi@ximian.com>
19057 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19058 to perform all checks for a method with a params parameter.
19060 (Invocation::OverloadResolve): Update to use the above method and therefore
19061 cope correctly with params method invocations.
19063 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19066 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19067 constructors in our parent too because we can't afford to miss out on
19070 * attribute.cs (AttributeSection): New name for the class Attribute
19072 Other trivial changes to improve readability.
19074 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19075 use the new class names.
19077 2001-11-01 Ravi Pratap <ravi@ximian.com>
19079 * class.cs (Method::Define): Complete definition for params types too
19081 (Indexer::Define): Ditto.
19083 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19084 Cope everywhere with a request for info about the array parameter.
19086 2001-11-01 Ravi Pratap <ravi@ximian.com>
19088 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19090 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19091 local_variable_type to extract the string corresponding to the type.
19093 (local_variable_type): Fixup the action to use the new helper method.
19095 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19098 * expression.cs : Clean out code which uses the above.
19100 2001-10-31 Ravi Pratap <ravi@ximian.com>
19102 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19103 and bale out if necessary by returning a false.
19105 (RegisterProperty): Ditto.
19107 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19108 and print out appropriate error messages.
19110 * interface.cs (everywhere): Ditto.
19112 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19113 location to constructor.
19115 * class.cs (Property, Event, Indexer): Update accordingly.
19117 * ../errors/cs111.cs : Added.
19119 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19120 of a method, as laid down by the spec.
19122 (Invocation::OverloadResolve): Use the above method.
19124 2001-10-31 Ravi Pratap <ravi@ximian.com>
19126 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19127 now take a TypeContainer and a Parameters object.
19129 (ParameterData): Modify return type of ParameterModifier method to be
19130 Parameter.Modifier and not a string.
19132 (ReflectionParameters, InternalParameters): Update accordingly.
19134 * expression.cs (Argument::GetParameterModifier): Same here.
19136 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19137 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19138 symbol in it at all so maybe this is only for now.
19140 2001-10-30 Ravi Pratap <ravi@ximian.com>
19142 * support.cs (InternalParameters): Constructor now takes an extra argument
19143 which is the actual Parameters class.
19145 (ParameterDesc): Update to provide info on ref/out modifiers.
19147 * class.cs (everywhere): Update call to InternalParameters to pass in
19148 the second argument too.
19150 * support.cs (ParameterData): Add ParameterModifier, which is a method
19151 to return the modifier info [ref/out etc]
19153 (InternalParameters, ReflectionParameters): Implement the above.
19155 * expression.cs (Argument::ParameterModifier): Similar function to return
19156 info about the argument's modifiers.
19158 (Invocation::OverloadResolve): Update to take into account matching modifiers
19161 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19162 a new SetFormalParameters object which we pass to InternalParameters.
19164 2001-10-30 Ravi Pratap <ravi@ximian.com>
19166 * expression.cs (NewArray): Merge into the ArrayCreation class.
19168 2001-10-29 Ravi Pratap <ravi@ximian.com>
19170 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19171 NewUserdefinedArray into one as there wasn't much of a use in having
19174 * expression.cs (Argument): Change field's name to ArgType from Type.
19176 (Type): New readonly property which returns the proper type, taking into
19177 account ref/out modifiers.
19179 (everywhere): Adjust code accordingly for the above.
19181 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19182 whether we are emitting for a ref or out parameter.
19184 * expression.cs (Argument::Emit): Use the above field to set the state.
19186 (LocalVariableReference::Emit): Update to honour the flag and emit the
19189 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19191 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19193 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19195 (ReflectionParameters, InternalParameters): Implement the above method.
19197 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19200 (Invocation::FullMethodDesc): Ditto.
19202 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19204 * cs-parser.jay: Add extra production for the second form of array
19207 * expression.cs (ArrayCreation): Update to reflect the above
19210 * Small changes to prepare for Array initialization.
19212 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19214 * typemanager.cs (ImplementsInterface): interface might be null;
19215 Deal with this problem;
19217 Also, we do store negative hits on the cache (null values), so use
19218 this instead of calling t.GetInterfaces on the type everytime.
19220 2001-10-28 Ravi Pratap <ravi@ximian.com>
19222 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19224 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19225 split functionality out into different classes.
19227 (New::FormArrayType): Move into NewBuiltinArray.
19229 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19232 (NewBuiltinArray): New class to handle creation of built-in arrays.
19234 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19235 account creation of one-dimensional arrays.
19237 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19239 (NewUserdefinedArray::DoResolve): Implement.
19241 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19243 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19244 we maintain inside the TypeManager. This is necessary to perform lookups on the
19247 (LookupType): Update to perform GetType on the module builders too.
19249 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19251 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19253 2001-10-23 Ravi Pratap <ravi@ximian.com>
19255 * expression.cs (New::DoResolve): Implement guts of array creation.
19257 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19259 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19261 * expression.cs: Fix bug I introduced lsat night that broke
19264 (Expression.Resolve): Report a 246 error (can not resolve name)
19265 if we find a SimpleName in the stream.
19267 (Expression.ResolveLValue): Ditto.
19269 (Expression.ResolveWithSimpleName): This function is a variant of
19270 ResolveName, this one allows SimpleNames to be returned without a
19271 warning. The only consumer of SimpleNames is MemberAccess
19273 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19275 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19276 might arrive here. I have my doubts that this is correct.
19278 * statement.cs (Lock): Implement lock statement.
19280 * cs-parser.jay: Small fixes to support `lock' and `using'
19282 * cs-tokenizer.cs: Remove extra space
19284 * driver.cs: New flag --checked, allows to turn on integer math
19287 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19288 Threading.Monitor.Exit
19290 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19292 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19293 Expression Class to be IndexerAccess.
19295 Notice that Indexer::DoResolve sets the eclass to Value.
19297 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19299 * class.cs (TypeContainer::Emit): Emit code for indexers.
19301 * assign.cs (IAssignMethod): New interface implemented by Indexers
19302 and Properties for handling assignment.
19304 (Assign::Emit): Simplify and reuse code.
19306 * expression.cs (IndexerAccess, PropertyExpr): Implement
19307 IAssignMethod, clean up old code.
19309 2001-10-22 Ravi Pratap <ravi@ximian.com>
19311 * typemanager.cs (ImplementsInterface): New method to determine if a type
19312 implements a given interface. Provides a nice cache too.
19314 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19317 (ConvertReferenceExplicit): Ditto.
19319 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19320 various methods, with correct names etc.
19322 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19323 Operator.UnaryNegation.
19325 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19326 we have a unary plus or minus operator.
19328 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19331 * everywhere : update accordingly.
19333 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19336 * class.cs (Method::Define): For the case where we are implementing a method
19337 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19338 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19340 2001-10-21 Ravi Pratap <ravi@ximian.com>
19342 * interface.cs (FindMembers): Implement to work around S.R.E
19345 * typemanager.cs (IsInterfaceType): Implement.
19347 (FindMembers): Update to handle interface types too.
19349 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19350 use IsAssignableFrom as that is not correct - it doesn't work.
19352 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19353 and accordingly override EmitStatement.
19355 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19356 using the correct logic :-)
19358 2001-10-19 Ravi Pratap <ravi@ximian.com>
19360 * ../errors/cs-11.cs : Add to demonstrate error -11
19362 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19364 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19365 then pass this as a hint to ResolveLValue.
19367 * expression.cs (FieldExpr): Add Location information
19369 (FieldExpr::LValueResolve): Report assignment to readonly
19372 (Expression::ExprClassFromMemberInfo): Pass location information.
19374 (Expression::ResolveLValue): Add new method that resolves an
19377 (Expression::DoResolveLValue): Default invocation calls
19380 (Indexers): New class used to keep track of indexers in a given
19383 (IStackStore): Renamed from LValue, as it did not really describe
19384 what this did. Also ResolveLValue is gone from this interface and
19385 now is part of Expression.
19387 (ElementAccess): Depending on the element access type
19389 * typemanager.cs: Add `indexer_name_type' as a Core type
19390 (System.Runtime.CompilerServices.IndexerNameAttribute)
19392 * statement.cs (Goto): Take a location.
19394 2001-10-18 Ravi Pratap <ravi@ximian.com>
19396 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19397 if two delegates are compatible.
19399 (NewDelegate::DoResolve): Update to take care of the case when
19400 we instantiate a delegate from another delegate.
19402 * typemanager.cs (FindMembers): Don't even try to look up members
19403 of Delegate types for now.
19405 2001-10-18 Ravi Pratap <ravi@ximian.com>
19407 * delegate.cs (NewDelegate): New class to take care of delegate
19410 * expression.cs (New): Split the delegate related code out into
19411 the NewDelegate class.
19413 * delegate.cs (DelegateInvocation): New class to handle delegate
19416 * expression.cs (Invocation): Split out delegate related code into
19417 the DelegateInvocation class.
19419 2001-10-17 Ravi Pratap <ravi@ximian.com>
19421 * expression.cs (New::DoResolve): Implement delegate creation fully
19422 and according to the spec.
19424 (New::DoEmit): Update to handle delegates differently.
19426 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19427 because of which we were printing out arguments in reverse order !
19429 * delegate.cs (VerifyMethod): Implement to check if the given method
19430 matches the delegate.
19432 (FullDelegateDesc): Implement.
19434 (VerifyApplicability): Implement.
19436 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19437 delegate invocations too.
19439 (Invocation::Emit): Ditto.
19441 * ../errors/cs1593.cs : Added.
19443 * ../errors/cs1594.cs : Added.
19445 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19447 2001-10-16 Ravi Pratap <ravi@ximian.com>
19449 * typemanager.cs (intptr_type): Core type for System.IntPtr
19451 (InitCoreTypes): Update for the same.
19453 (iasyncresult_type, asynccallback_type): Ditto.
19455 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19458 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19461 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19462 the builders for the 4 members of a delegate type :-)
19464 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19467 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19469 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19471 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19473 * statement.cs (Break::Emit): Implement.
19474 (Continue::Emit): Implement.
19476 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19477 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19478 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19479 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19482 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19483 properties that track the label for the current loop (begin of the
19484 loop and end of the loop).
19486 2001-10-15 Ravi Pratap <ravi@ximian.com>
19488 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19489 use of emitting anything at all.
19491 * class.cs, rootcontext.cs : Get rid of calls to the same.
19493 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19495 (Populate): Define the constructor correctly and set the implementation
19498 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19501 (AddDelegateType): Implement.
19503 (IsDelegateType): Implement helper method.
19505 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19507 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19508 and accordingly handle it.
19510 * delegate.cs (Populate): Take TypeContainer argument.
19511 Implement bits to define the Invoke method. However, I still haven't figured out
19512 how to take care of the native int bit :-(
19514 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19515 Qualify the name of the delegate, not its return type !
19517 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19520 (StandardConversionExists): Checking for array types turns out to be recursive.
19522 (ConvertReferenceExplicit): Implement array conversion.
19524 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19526 2001-10-12 Ravi Pratap <ravi@ximian.com>
19528 * cs-parser.jay (delegate_declaration): Store the fully qualified
19529 name as it is a type declaration.
19531 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19534 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19535 as TypeContainer::DefineType.
19537 (Populate): Method in which all the definition of the various methods (Invoke)
19540 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19543 (CloseDelegate): Finally creates the delegate.
19545 * class.cs (TypeContainer::DefineType): Update to define delegates.
19546 (Populate, Emit and CloseType): Do the same thing here too.
19548 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19549 delegates in all these operations.
19551 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19553 * expression.cs: LocalTemporary: a new expression used to
19554 reference a temporary that has been created.
19556 * assign.cs: Handle PropertyAccess back here, so that we can
19557 provide the proper semantic access to properties.
19559 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19560 a few more explicit conversions.
19562 * modifiers.cs: `NEW' modifier maps to HideBySig.
19564 * expression.cs (PropertyExpr): Make this into an
19565 ExpressionStatement, and support the EmitStatement code path.
19567 Perform get/set error checking, clean up the interface.
19569 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19570 them into toplevel access objects.
19572 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19574 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19577 * typemanager.cs: Keep track here of our PropertyBuilders again to
19578 work around lameness in SRE.
19580 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19582 * expression.cs (LValue::LValueResolve): New method in the
19583 interface, used to perform a second resolution pass for LValues.
19585 (This::DoResolve): Catch the use of this in static methods.
19587 (This::LValueResolve): Implement.
19589 (This::Store): Remove warning, assigning to `this' in structures
19592 (Invocation::Emit): Deal with invocation of
19593 methods on value types. We need to pass the address to structure
19594 methods rather than the object itself. (The equivalent code to
19595 emit "this" for structures leaves the entire structure on the
19596 stack instead of a pointer to it).
19598 (ParameterReference::DoResolve): Compute the real index for the
19599 argument based on whether the method takes or not a `this' pointer
19600 (ie, the method is static).
19602 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19603 value types returned from functions when we need to invoke a
19604 method on the sturcture.
19607 2001-10-11 Ravi Pratap <ravi@ximian.com>
19609 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19610 defining the type in the Modulebuilder or Typebuilder. This is to take
19611 care of nested types which need to be defined on the TypeBuilder using
19612 DefineNestedMethod.
19614 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19615 methods in RootContext, only ported to be part of TypeContainer.
19617 (TypeContainer::GetInterfaceOrClass): Ditto.
19619 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19621 * interface.cs (Interface::DefineInterface): New method. Does exactly
19622 what RootContext.CreateInterface did earlier, only it takes care of nested types
19625 (Interface::GetInterfaces): Move from RootContext here and port.
19627 (Interface::GetInterfaceByName): Same here.
19629 * rootcontext.cs (ResolveTree): Re-write.
19631 (PopulateTypes): Re-write.
19633 * class.cs (TypeContainer::Populate): Populate nested types too.
19634 (TypeContainer::Emit): Emit nested members too.
19636 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19637 instead just use the name argument passed in as it is already fully
19640 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19641 to TypeContainer mapping to see if a type is user-defined.
19643 * class.cs (TypeContainer::CloseType): Implement.
19645 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19646 the default constructor.
19648 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19651 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19653 * interface.cs (CloseType): Create the type here.
19655 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19658 Remove all the methods which are now in TypeContainer.
19660 2001-10-10 Ravi Pratap <ravi@ximian.com>
19662 * delegate.cs (Define): Re-write bits to define the delegate
19665 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19667 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19669 * expression.cs (ImplicitReferenceConversion): handle null as well
19670 as a source to convert to any reference type.
19672 * statement.cs (Return): Perform any implicit conversions to
19673 expected return type.
19675 Validate use of return statement.
19677 * codegen.cs (EmitContext): Pass the expected return type here.
19679 * class.cs (Method, Constructor, Property): Pass expected return
19680 type to EmitContext.
19682 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19684 * expression.cs: Make DoResolve take an EmitContext instead of a
19687 Replaced `l' and `location' for `loc', for consistency.
19689 (Error, Warning): Remove unneeded Tc argument.
19691 * assign.cs, literal.cs, constant.cs: Update to new calling
19694 * codegen.cs: EmitContext now contains a flag indicating whether
19695 code is being generated in a static method or not.
19697 * cs-parser.jay: DecomposeQI, new function that replaces the old
19698 QualifiedIdentifier. Now we always decompose the assembled
19699 strings from qualified_identifier productions into a group of
19702 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19704 * rootcontext.cs: Deal with field-less struct types correctly now
19705 by passing the size option to Define Type.
19707 * class.cs: Removed hack that created one static field.
19709 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19711 * statement.cs: Moved most of the code generation here.
19713 2001-10-09 Ravi Pratap <ravi@ximian.com>
19715 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19718 (ElementAccess): Remove useless bits for now - keep checks as the spec
19721 2001-10-08 Ravi Pratap <ravi@ximian.com>
19723 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19724 and start performing checks according to the spec.
19726 2001-10-07 Ravi Pratap <ravi@ximian.com>
19728 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19729 rank_specifiers instead.
19731 (rank_specifiers): Change the order in which the rank specifiers are stored
19733 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19735 * expression.cs (ElementAccess): Implement the LValue interface too.
19737 2001-10-06 Ravi Pratap <ravi@ximian.com>
19739 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19740 except that user defined conversions are not included.
19742 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19743 perform the conversion of the return type, if necessary.
19745 (New::DoResolve): Check whether we are creating an array or an object
19746 and accordingly do the needful.
19748 (New::Emit): Same here.
19750 (New::DoResolve): Implement guts of array creation.
19752 (New::FormLookupType): Helper function.
19754 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19756 * codegen.cs: Removed most of the code generation here, and move the
19757 corresponding code generation bits to the statement classes.
19759 Added support for try/catch/finalize and throw.
19761 * cs-parser.jay: Added support for try/catch/finalize.
19763 * class.cs: Catch static methods having the flags override,
19764 virtual or abstract.
19766 * expression.cs (UserCast): This user cast was not really doing
19767 what it was supposed to do. Which is to be born in fully resolved
19768 state. Parts of the resolution were being performed at Emit time!
19772 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19774 * expression.cs: Implicity convert the result from UserCast.
19776 2001-10-05 Ravi Pratap <ravi@ximian.com>
19778 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19779 prevented it from working correctly.
19781 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19782 merely ConvertImplicit.
19784 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19786 * typemanager.cs: Make the LookupTypeContainer function static,
19787 and not per-instance.
19789 * class.cs: Make static FindMembers (the one that takes a Type
19792 * codegen.cs: Add EmitForeach here.
19794 * cs-parser.jay: Make foreach a toplevel object instead of the
19795 inline expansion, as we need to perform semantic analysis on it.
19797 2001-10-05 Ravi Pratap <ravi@ximian.com>
19799 * expression.cs (Expression::ImplicitUserConversion): Rename to
19800 UserDefinedConversion.
19802 (Expression::UserDefinedConversion): Take an extra argument specifying
19803 whether we look for explicit user conversions too.
19805 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19807 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19809 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19810 with the appropriate arguments.
19812 * cs-parser.jay (cast_expression): Record location too.
19814 * expression.cs (Cast): Record location info.
19816 (Expression::ConvertExplicit): Take location argument.
19818 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19819 to determine if we are doing explicit conversions.
19821 (UserCast::Emit): Update accordingly.
19823 (Expression::ConvertExplicit): Report an error if everything fails.
19825 * ../errors/cs0030.cs : Add.
19827 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19829 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19830 virtual and newslot bits.
19832 * class.cs (TypeContainer::RegisterRequiredImplementations):
19833 Record methods we need.
19835 (TypeContainer::MakeKey): Helper function to make keys for
19836 MethodBases, since the Methodbase key is useless.
19838 (TypeContainer::Populate): Call RegisterRequiredImplementations
19839 before defining the methods.
19841 Create a mapping for method_builders_to_methods ahead of time
19842 instead of inside a tight loop.
19844 (::RequireMethods): Accept an object as the data to set into the
19845 hashtable so we can report interface vs abstract method mismatch.
19847 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19849 * report.cs: Make all of it static.
19851 * rootcontext.cs: Drop object_type and value_type computations, as
19852 we have those in the TypeManager anyways.
19854 Drop report instance variable too, now it is a global.
19856 * driver.cs: Use try/catch on command line handling.
19858 Add --probe option to debug the error reporting system with a test
19861 * report.cs: Add support for exiting program when a probe
19862 condition is reached.
19864 2001-10-03 Ravi Pratap <ravi@ximian.com>
19866 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19867 we do a forcible conversion regardless of type, to check if
19868 ForceConversion returns a null.
19870 (Binary::error19): Use location to report error.
19872 (Unary::error23): Use location here too.
19874 * ../errors/cs0019.cs : Check in.
19876 * ../errors/cs0023.cs : Check in.
19878 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19879 case of a non-null MethodInfo object with a length of 0 !
19881 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19882 an applicable member - according to the spec :-)
19883 Also fix logic to find members in base types.
19885 (Unary::ResolveOperator): Same here.
19887 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19888 as I was getting thoroughly confused between this and error19 :-)
19890 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19891 (::FindMostEncompassedType): Implement.
19892 (::FindMostEncompassingType): Implement.
19893 (::StandardConversionExists): Implement.
19895 (UserImplicitCast): Re-vamp. We now need info about most specific
19896 source and target types so that we can do the necessary conversions.
19898 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19899 mathematical union with no duplicates.
19901 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19903 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19904 in order from base classes to child classes, so that we can in
19905 child classes look up in our parent for method names and
19906 attributes (required for handling abstract, virtual, new, override
19907 constructs: we need to instrospect our base class, and if we dont
19908 populate the classes in order, the introspection might be
19909 incorrect. For example, a method could query its parent before
19910 the parent has any methods and would determine that the parent has
19911 no abstract methods (while it could have had them)).
19913 (RootContext::CreateType): Record the order in which we define the
19916 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19918 * class.cs (TypeContainer::Populate): Also method definitions can
19919 fail now, keep track of this.
19921 (TypeContainer::FindMembers): Implement support for
19922 DeclaredOnly/noDeclaredOnly flag.
19924 (Constructor::Emit) Return the ConstructorBuilder.
19926 (Method::Emit) Return the MethodBuilder.
19927 Check for abstract or virtual methods to be public.
19929 * rootcontext.cs (RootContext::CreateType): Register all the
19930 abstract methods required for the class to be complete and the
19931 interface methods that must be implemented.
19933 * cs-parser.jay: Report error 501 (method requires body if it is
19934 not marked abstract or extern).
19936 * expression.cs (TypeOf::Emit): Implement.
19938 * typemanager.cs: runtime_handle_type, new global type.
19940 * class.cs (Property::Emit): Generate code for properties.
19942 2001-10-02 Ravi Pratap <ravi@ximian.com>
19944 * expression.cs (Unary::ResolveOperator): Find operators on base type
19945 too - we now conform exactly to the spec.
19947 (Binary::ResolveOperator): Same here.
19949 * class.cs (Operator::Define): Fix minor quirk in the tests.
19951 * ../errors/cs0215.cs : Added.
19953 * ../errors/cs0556.cs : Added.
19955 * ../errors/cs0555.cs : Added.
19957 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19959 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
19960 single integer which is really efficient
19962 2001-10-01 Ravi Pratap <ravi@ximian.com>
19964 * expression.cs (Expression::ImplicitUserConversion): Use location
19965 even in the case when we are examining True operators.
19967 * class.cs (Operator::Define): Perform extensive checks to conform
19968 with the rules for operator overloading in the spec.
19970 * expression.cs (Expression::ImplicitReferenceConversion): Implement
19971 some of the other conversions mentioned in the spec.
19973 * typemanager.cs (array_type): New static member for the System.Array built-in
19976 (cloneable_interface): For System.ICloneable interface.
19978 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
19979 we start resolving the tree and populating types.
19981 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
19983 2001-10-01 Miguel de Icaza <miguel@ximian.com>
19985 * expression.cs (Expression::ExprClassFromMemberInfo,
19986 Expression::Literalize): Create literal expressions from
19987 FieldInfos which are literals.
19989 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
19990 type casts, because they were wrong. The test suite in tests
19993 (ImplicitNumericConversion): ushort to ulong requires a widening
19996 Int32 constant to long requires widening cast as well.
19998 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
19999 for integers because the type on the stack is not i4.
20001 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20003 * expression.cs (report118): require location argument.
20005 * parameter.cs: Do not dereference potential null value.
20007 * class.cs: Catch methods that lack the `new' keyword when
20008 overriding a name. Report warnings when `new' is used without
20009 anything being there to override.
20011 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20013 * class.cs: Only add constructor to hashtable if it is non-null
20014 (as now constructors can fail on define).
20016 (TypeManager, Class, Struct): Take location arguments.
20018 Catch field instance initialization in structs as errors.
20020 accepting_filter: a new filter for FindMembers that is static so
20021 that we dont create an instance per invocation.
20023 (Constructor::Define): Catch errors where a struct constructor is
20026 * cs-parser.jay: Pass location information for various new
20029 * delegate.cs (Delegate): take a location argument.
20031 * driver.cs: Do not call EmitCode if there were problesm in the
20032 Definition of the types, as many Builders wont be there.
20034 * decl.cs (Decl::Decl): Require a location argument.
20036 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20037 into integers, and find the most appropiate integer for it.
20039 * literal.cs: Implement ULongLiteral.
20041 * rootcontext.cs: Provide better information about the location of
20042 failure when CreateType fails.
20044 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20046 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20049 * expression.cs (Binary::CheckShiftArguments): Add missing type
20051 (Binary::ResolveOperator): Add type to the logical and and logical
20052 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20055 (Binary::DoNumericPromotions): In the case where either argument
20056 is ulong (and most signed types combined with ulong cause an
20057 error) perform implicit integer constant conversions as well.
20059 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20061 * expression.cs (UserImplicitCast): Method should always be
20063 (Invocation::BetterConversion): Simplified test for IntLiteral.
20065 (Expression::ImplicitNumericConversion): Split this routine out.
20066 Put the code that performs implicit constant integer conversions
20069 (Expression::Resolve): Become a wrapper around DoResolve so we can
20070 check eclass and type being set after resolve.
20072 (Invocation::Badness): Remove this dead function
20074 (Binary::ResolveOperator): Do not compute the expensive argumnets
20075 unless we have a union for it.
20077 (Probe::Emit): Is needs to do an isinst and then
20078 compare against null.
20080 (::CanConvert): Added Location argument. If the Location argument
20081 is null (Location.Null), then we do not report errors. This is
20082 used by the `probe' mechanism of the Explicit conversion. We do
20083 not want to generate an error for something that the user
20084 explicitly requested to be casted. But the pipeline for an
20085 explicit cast first tests for potential implicit casts.
20087 So for now, if the Location is null, it means `Probe only' to
20088 avoid adding another argument. Might have to revise this
20091 (ClassCast): New class used to type cast objects into arbitrary
20092 classes (used in Explicit Reference Conversions).
20094 Implement `as' as well.
20096 Reverted all the patches from Ravi below: they were broken:
20098 * The use of `level' as a mechanism to stop recursive
20099 invocations is wrong. That was there just to catch the
20100 bug with a strack trace but not as a way of addressing
20103 To fix the problem we have to *understand* what is going
20104 on and the interactions and come up with a plan, not
20105 just get things going.
20107 * The use of the type conversion cache that I proposed
20108 last night had an open topic: How does this work across
20109 protection domains. A user defined conversion might not
20110 be public in the location where we are applying the
20111 conversion, a different conversion might be selected
20112 (ie, private A->B (better) but public B->A (worse),
20113 inside A, A->B applies, but outside it, B->A will
20116 * On top of that (ie, even if the above is solved),
20117 conversions in a cache need to be abstract. Ie, `To
20118 convert from an Int to a Short use an OpcodeCast', not
20119 `To convert from an Int to a Short use the OpcodeCast on
20120 the variable 5' (which is what this patch was doing).
20122 2001-09-28 Ravi Pratap <ravi@ximian.com>
20124 * expression.cs (Invocation::ConversionExists): Re-write to use
20125 the conversion cache
20127 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20128 cache all conversions done, not just user-defined ones.
20130 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20131 to determine if a conversion exists instead of acutually trying to
20132 perform the conversion. It's faster too.
20134 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20135 and only then attempt the implicit conversion.
20137 2001-09-28 Ravi Pratap <ravi@ximian.com>
20139 * expression.cs (ConvertImplicit): Use a cache for conversions
20140 already found. Check level of recursion and bail out if necessary.
20142 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20144 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20145 Export standard methods that we expect for string operations.
20147 * statement.cs (Block::UsageWarning): Track usage of variables and
20148 report the errors for not used variables.
20150 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20153 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20155 * codegen.cs: remove unnneded code
20157 * expression.cs: Removed BuiltinTypeAccess class
20159 Fix the order in which implicit conversions are
20162 The previous fixed dropped support for boxed conversions (adding a
20163 test to the test suite now)
20165 (UserImplicitCast::CanConvert): Remove test for source being null,
20166 that code is broken. We should not feed a null to begin with, if
20167 we do, then we should track the bug where the problem originates
20168 and not try to cover it up here.
20170 Return a resolved expression of type UserImplicitCast on success
20171 rather than true/false. Ravi: this is what I was talking about,
20172 the pattern is to use a static method as a "constructor" for
20175 Also, do not create arguments until the very last minute,
20176 otherwise we always create the arguments even for lookups that
20177 will never be performed.
20179 (UserImplicitCast::Resolve): Eliminate, objects of type
20180 UserImplicitCast are born in a fully resolved state.
20182 * typemanager.cs (InitCoreTypes): Init also value_type
20183 (System.ValueType).
20185 * expression.cs (Cast::Resolve): First resolve the child expression.
20187 (LValue): Add new method AddressOf to be used by
20190 Change the argument of Store to take an EmitContext instead of an
20191 ILGenerator, because things like FieldExpr need to be able to call
20192 their children expression to generate the instance code.
20194 (Expression::Error, Expression::Warning): Sugar functions for
20197 (Expression::MemberLookup): Accept a TypeContainer instead of a
20198 Report as the first argument.
20200 (Expression::ResolvePrimary): Killed. I still want to improve
20201 this as currently the code is just not right.
20203 (Expression::ResolveMemberAccess): Simplify, but it is still
20206 (Unary::Resolve): Catch errors in AddressOf operators.
20208 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20209 index to a byte for the short-version, or the compiler will choose
20210 the wrong Emit call, which generates the wrong data.
20212 (ParameterReference::Emit, ::Store): same.
20214 (FieldExpr::AddressOf): Implement.
20216 * typemanager.cs: TypeManager: made public variable instead of
20219 * driver.cs: document --fatal.
20221 * report.cs (ErrorMessage, WarningMessage): new names for the old
20222 Error and Warning classes.
20224 * cs-parser.jay (member_access): Turn built-in access to types
20225 into a normal simplename
20227 2001-09-27 Ravi Pratap <ravi@ximian.com>
20229 * expression.cs (Invocation::BetterConversion): Fix to cope
20230 with q being null, since this was introducing a bug.
20232 * expression.cs (ConvertImplicit): Do built-in conversions first.
20234 2001-09-27 Ravi Pratap <ravi@ximian.com>
20236 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20238 2001-09-27 Ravi Pratap <ravi@ximian.com>
20240 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20241 I had introduced long ago (what's new ?).
20243 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20244 the work of all the checking.
20245 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20246 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20248 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20249 that is the right way.
20251 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20252 overloading resolution. Use everywhere instead of cutting and pasting code.
20254 (Binary::ResolveOperator): Use MakeUnionSet.
20256 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20257 we have to convert to bool types. Not complete yet.
20259 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20261 * typemanager.cs (TypeManager::CSharpName): support ushort.
20263 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20264 to provide an expression that performsn an implicit constant int
20265 conversion (section 6.1.6).
20266 (Expression::ConvertImplicitRequired): Reworked to include
20267 implicit constant expression conversions.
20269 (Expression::ConvertNumericExplicit): Finished.
20271 (Invocation::Emit): If InstanceExpression is null, then it means
20272 that we perform a call on this.
20274 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20276 * expression.cs (Unary::Emit): Remove some dead code.
20277 (Probe): Implement Resolve and Emit for `is'.
20278 (Expression::ConvertImplicitRequired): Attempt to do constant
20279 expression conversions here. Maybe should be moved to
20280 ConvertImplicit, but I am not sure.
20281 (Expression::ImplicitLongConstantConversionPossible,
20282 Expression::ImplicitIntConstantConversionPossible): New functions
20283 that tell whether is it possible to apply an implicit constant
20284 expression conversion.
20286 (ConvertNumericExplicit): Started work on explicit numeric
20289 * cs-parser.jay: Update operator constants.
20291 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20292 (Parameters::GetSignature): Hook up VerifyArgs here.
20293 (Parameters::VerifyArgs): Verifies that no two arguments have the
20296 * class.cs (Operator): Update the operator names to reflect the
20297 ones that the spec expects (as we are just stringizing the
20300 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20301 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20302 previous usage did only work for our methods.
20303 (Expression::ConvertImplicit): Handle decimal implicit numeric
20304 conversions as well.
20305 (Expression::InternalTypeConstructor): Used to invoke constructors
20306 on internal types for default promotions.
20308 (Unary::Emit): Implement special handling for the pre/post
20309 increment/decrement for overloaded operators, as they need to have
20310 the same semantics as the other operators.
20312 (Binary::ResolveOperator): ditto.
20313 (Invocation::ConversionExists): ditto.
20314 (UserImplicitCast::Resolve): ditto.
20316 2001-09-26 Ravi Pratap <ravi@ximian.com>
20318 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20319 operator, return after emitting body. Regression tests pass again !
20321 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20322 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20323 (Invocation::OverloadResolve): Ditto.
20324 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20326 * everywhere : update calls to the above methods accordingly.
20328 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20330 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20332 * expression.cs (ExpressionStatement): New base class used for
20333 expressions that can appear in statements, so that we can provide
20334 an alternate path to generate expression that do not leave a value
20337 (Expression::Emit, and all the derivatives): We no longer return
20338 whether a value is left on the stack or not. Every expression
20339 after being emitted leaves a single value on the stack.
20341 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20342 facilties of ExpressionStatement if possible.
20344 * cs-parser.jay: Update statement_expression.
20346 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20348 * driver.cs: Change the wording of message
20350 2001-09-25 Ravi Pratap <ravi@ximian.com>
20352 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20353 the type of the expression to the return type of the method if
20354 we have an overloaded operator match ! The regression tests pass again !
20355 (Unary::ResolveOperator): Ditto.
20357 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20358 to find "op_Implicit", not "implicit" ;-)
20359 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20360 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20362 * everywhere : Correct calls to the above accordingly.
20364 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20365 (ConvertImplicit): Do user-defined conversion if it exists.
20367 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20369 * assign.cs: track location.
20370 (Resolve): Use implicit conversions on assignment.
20372 * literal.cs: Oops. Not good, Emit of short access values should
20373 pass (Bytes) or the wrong argument will be selected.
20375 * expression.cs (Unary::Emit): Emit code for -expr.
20377 (Unary::ResolveOperator): Handle `Substract' for non-constants
20378 (substract from zero from the non-constants).
20379 Deal with Doubles as well.
20381 (Expression::ConvertImplicitRequired): New routine that reports an
20382 error if no implicit conversion exists.
20384 (Invocation::OverloadResolve): Store the converted implicit
20385 expressions if we make them
20387 2001-09-24 Ravi Pratap <ravi@ximian.com>
20389 * class.cs (ConstructorInitializer): Take a Location argument.
20390 (ConstructorBaseInitializer): Same here.
20391 (ConstructorThisInitializer): Same here.
20393 * cs-parser.jay : Update all calls accordingly.
20395 * expression.cs (Unary, Binary, New): Take location argument.
20396 Update accordingly everywhere.
20398 * cs-parser.jay : Update all calls to the above to take a location
20401 * class.cs : Ditto.
20403 2001-09-24 Ravi Pratap <ravi@ximian.com>
20405 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20406 (Invocation::BetterConversion): Same here
20407 (Invocation::ConversionExists): Ditto.
20409 (Invocation::ConversionExists): Implement.
20411 2001-09-22 Ravi Pratap <ravi@ximian.com>
20413 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20414 Also take an additional TypeContainer argument.
20416 * All over : Pass in TypeContainer as argument to OverloadResolve.
20418 * typemanager.cs (CSharpName): Update to check for the string type and return
20421 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20424 2001-09-21 Ravi Pratap <ravi@ximian.com>
20426 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20427 (Invocation::BetterFunction): Implement.
20428 (Invocation::BetterConversion): Implement.
20429 (Invocation::ConversionExists): Skeleton, no implementation yet.
20431 Okay, things work fine !
20433 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20435 * typemanager.cs: declare and load enum_type, delegate_type and
20438 * expression.cs (Expression::Emit): Now emit returns a value that
20439 tells whether a value is left on the stack or not. This strategy
20440 might be reveted tomorrow with a mechanism that would address
20441 multiple assignments.
20442 (Expression::report118): Utility routine to report mismatches on
20445 (Unary::Report23): Report impossible type/operator combination
20448 (Unary::IsIncrementableNumber): Whether the type can be
20449 incremented or decremented with add.
20450 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20452 (Unary::ResolveOperator): Implement ++, !, ~,
20454 (Invocation::Emit): Deal with new Emit convetion.
20456 * All Expression derivatives: Updated their Emit method to return
20457 whether they leave values on the stack or not.
20459 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20460 stack for expressions that are statements.
20462 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20464 * expression.cs (LValue): New interface. Must be implemented by
20466 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20469 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20470 interface for generating code, simplifies the code.
20472 2001-09-20 Ravi Pratap <ravi@ximian.com>
20474 * expression.cs (everywhere): Comment out return statements in ::Resolve
20475 methods to avoid the warnings.
20477 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20479 * driver.cs (parse): Report error 2001 if we can not open the
20482 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20485 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20488 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20489 otherwise nested blocks end up with the same index.
20491 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20493 * expression.cs: Instead of having FIXMEs in the Resolve
20494 functions, throw exceptions so it is obvious that we are facing a
20497 * cs-parser.jay (invocation_expression): Pass Location information.
20499 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20500 Use a basename for those routines because .NET does not like paths
20503 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20506 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20508 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20509 are loading the correct data types (throws an exception if not).
20510 (TypeManager::InitCoreTypes): Use CoreLookupType
20512 * expression.cs (Unary::ResolveOperator): return the child
20513 expression for expressions which are just +expr.
20514 (Unary::ResolveOperator): Return negative literals for -LITERAL
20515 expressions (otherwise they are Unary {Literal}).
20516 (Invocation::Badness): Take into account `Implicit constant
20517 expression conversions'.
20519 * literal.cs (LongLiteral): Implement long literal class.
20520 (IntLiteral): export the `Value' of the intliteral.
20522 2001-09-19 Ravi Pratap <ravi@ximian.com>
20524 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20526 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20527 instead of 'Operator'
20529 * expression.cs (Binary::ResolveOperator): Update accordingly.
20530 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20533 * cs-parser.jay (unary_expression): Update to use the new names.
20535 * gen-treedump.cs (GetUnary): Same here.
20537 * expression.cs (Unary::Resolve): Implement.
20538 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20539 operators are found instead of making noise ;-)
20540 (Unary::ResolveOperator): New method to do precisely the same thing which
20541 Binary::ResolveOperator does for Binary expressions.
20542 (Unary.method, .Arguments): Add.
20543 (Unary::OperName): Implement.
20544 (Unary::ForceConversion): Copy and Paste !
20546 * class.cs (Operator::Define): Fix a small bug for the case when we have
20549 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20550 for the inbuilt operators. Only overloading works for now ;-)
20552 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20554 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20555 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20557 * expression.cs (This::Emit): Implement.
20558 (This::Resolve): Implement.
20559 (TypeOf:Resolve): Implement.
20560 (Expression::ResolveSimpleName): Add an implicit this to instance
20562 (MemberAccess::Resolve): Deal with Parameters and Fields.
20563 Bind instance variable to Field expressions.
20564 (FieldExpr::Instance): New field used to track the expression that
20565 represents the object instance.
20566 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20568 (FieldExpr::Emit): Implement.
20570 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20571 the last instruction contains a return opcode to avoid generating
20572 the last `ret' instruction (this generates correct code, and it is
20573 nice to pass the peverify output).
20575 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20576 initializer for static and instance variables.
20577 (Constructor::Emit): Allow initializer to be null in the case of
20578 static constructors. Only emit initializer for instance
20581 (TypeContainer::FindMembers): Return a null array if there are no
20584 Also fix the code for the MemberTypes.Method branch, as it was not
20585 scanning that for operators (or tried to access null variables before).
20587 * assign.cs (Assign::Emit): Handle instance and static fields.
20591 * driver.cs: Stop compilation if there are parse errors.
20593 * cs-parser.jay (constructor_declaration): Provide default base
20594 initializer for non-static constructors.
20595 (constructor_declarator): Do not provide a default base
20596 initializers if none was specified.
20597 Catch the fact that constructors should not have parameters.
20599 * class.cs: Do not emit parent class initializers for static
20600 constructors, that should be flagged as an error.
20602 2001-09-18 Ravi Pratap <ravi@ximian.com>
20604 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20605 Move back code into TypeContainer::Populate.
20607 2001-09-18 Ravi Pratap <ravi@ximian.com>
20609 * class.cs (TypeContainer::AddConstructor): Fix the check to
20610 compare against Name, not Basename.
20611 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20613 * cs-parser.jay : Update accordingly.
20615 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20616 for methods, don't forget to look into the operators too.
20617 (RegisterMethodBuilder): Helper method to take care of this for
20618 methods, constructors and operators.
20619 (Operator::Define): Completely revamp.
20620 (Operator.OperatorMethod, MethodName): New fields.
20621 (TypeContainer::Populate): Move the registering of builders into
20622 RegisterMethodBuilder.
20623 (Operator::Emit): Re-write.
20625 * expression.cs (Binary::Emit): Comment out code path to emit method
20626 invocation stuff for the case when we have a user defined operator. I am
20627 just not able to get it right !
20629 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20631 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20634 (Expression::MemberLookup): Provide a version that allows to
20635 specify the MemberTypes and BindingFlags.
20637 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20638 so it was not fetching variable information from outer blocks.
20640 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20641 Beforefieldinit as it was buggy.
20643 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20644 that Ravi put here.
20646 * class.cs (Constructor::Emit): Only emit if block is not null.
20647 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20648 deal with this by semantically definining it as if the user had
20651 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20652 constructors as we now "emit" them at a higher level.
20654 (TypeContainer::DefineDefaultConstructor): Used to define the
20655 default constructors if none was provided.
20657 (ConstructorInitializer): Add methods Resolve and Emit.
20659 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20661 2001-09-17 Ravi Pratap <ravi@ximian.com>
20663 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20664 the default constructor builder with our hashtable for methodbuilders
20667 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20668 and argument_count is 0 in which case we have a match.
20669 (Binary::ResolveOperator): More null checking and miscellaneous coding
20672 2001-09-17 Ravi Pratap <ravi@ximian.com>
20674 * rootcontext.cs (IsNameSpace): Compare against null.
20676 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20678 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20679 and Unary::Operator.
20681 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20684 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20685 we have overloaded operators.
20686 (Binary::ResolveOperator): Implement the part which does the operator overload
20689 * class.cs (Operator::Emit): Implement.
20690 (TypeContainer::Emit): Emit the operators we have too.
20692 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20693 the case when we have a user-defined operator.
20695 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20697 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20699 2001-09-16 Ravi Pratap <ravi@ximian.com>
20701 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20702 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20703 (Constructor::Emit): Implement.
20704 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20705 if we have no work to do.
20706 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20709 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20710 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20712 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20715 2001-09-15 Ravi Pratap <ravi@ximian.com>
20717 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20719 (Tree::RecordNamespace): Method to do what the name says ;-)
20720 (Tree::Namespaces): Property to get at the namespaces hashtable.
20722 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20725 * rootcontext.cs (IsNamespace): Fixed it :-)
20727 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20729 * class.cs (TypeContainer::FindMembers): Add support for
20731 (MethodCore): New class that encapsulates both the shared aspects
20732 of a Constructor and a Method.
20733 (Method, Constructor): Factored pieces into MethodCore.
20735 * driver.cs: Added --fatal which makes errors throw exceptions.
20736 Load System assembly as well as part of the standard library.
20738 * report.cs: Allow throwing exceptions on errors for debugging.
20740 * modifiers.cs: Do not use `parent', instead use the real type
20741 container to evaluate permission settings.
20743 * class.cs: Put Ravi's patch back in. He is right, and we will
20744 have to cope with the
20746 2001-09-14 Ravi Pratap <ravi@ximian.com>
20748 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20749 FamORAssem, not FamANDAssem.
20751 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20753 * driver.cs: Added --parse option that only parses its input files
20756 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20757 incorrect. IsTopLevel is not used to tell whether an object is
20758 root_types or not (that can be achieved by testing this ==
20759 root_types). But to see if this is a top-level *class* (not
20760 necessarly our "toplevel" container).
20762 2001-09-14 Ravi Pratap <ravi@ximian.com>
20764 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20765 parent instead of a direct call to GetType.
20767 2001-09-14 Ravi Pratap <ravi@ximian.com>
20769 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20770 Modifiers.TypeAttr. This should just be a call to that method.
20772 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20773 object so that we can determine if we are top-level or not.
20775 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20778 * enum.cs (Enum::Define): Ditto.
20780 * modifiers.cs (FieldAttr): Re-write.
20782 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20783 (TypeContainer::HaveStaticConstructor): New property to provide access
20784 to precisely that info.
20786 * modifiers.cs (MethodAttr): Re-write.
20787 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20789 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20790 of top-level types as claimed.
20792 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20794 * expression.cs (MemberLookup): Fruitless attempt to lookup
20795 constructors. Maybe I need to emit default constructors? That
20796 might be it (currently .NET emits this for me automatically).
20797 (Invocation::OverloadResolve): Cope with Arguments == null.
20798 (Invocation::EmitArguments): new function, shared by the new
20799 constructor and us.
20800 (Invocation::Emit): Handle static and instance methods. Emit
20801 proper call instruction for virtual or non-virtual invocations.
20802 (New::Emit): Implement.
20803 (New::Resolve): Implement.
20804 (MemberAccess:Resolve): Implement.
20805 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20806 to track instances.
20807 (FieldExpr::Resolve): Set type.
20809 * support.cs: Handle empty arguments.
20811 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20812 SimpleLookup): Auxiliary routines to help parse a qualifier
20815 Update qualifier_identifier rule.
20817 * codegen.cs: Removed debugging messages.
20819 * class.cs: Make this a global thing, this acts just as a "key" to
20820 objects that we might have around.
20822 (Populate): Only initialize method_builders_to_methods once.
20824 * expression.cs (PropertyExpr): Initialize type from the
20827 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20828 Resolve pattern. Attempt to implicitly convert value to boolean.
20831 * expression.cs: Set the type for the int32/int32 argument case.
20832 (Binary::ResolveOperator): Set the return type to boolean for
20833 comparission operators
20835 * typemanager.cs: Remove debugging print code.
20837 (Invocation::Resolve): resolve type.
20839 * class.cs: Allocate a MemberInfo of the correct size, as the code
20840 elsewhere depends on the test to reflect the correct contents.
20842 (Method::) Keep track of parameters, due to System.Reflection holes
20844 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20847 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20848 of the exact size and return that.
20850 (Class::LookupMethodByBuilder): New function that maps
20851 MethodBuilders to its methods. Required to locate the information
20852 on methods because System.Reflection bit us again.
20854 * support.cs: New file, contains an interface ParameterData and
20855 two implementations: ReflectionParameters and InternalParameters
20856 used to access Parameter information. We will need to grow this
20859 * expression.cs (Invocation::GetParameterData): implement a cache
20860 and a wrapper around the ParameterData creation for methods.
20861 (Invocation::OverloadResolve): Use new code.
20863 2001-09-13 Ravi Pratap <ravi@ximian.com>
20865 * class.cs (TypeContainer::EmitField): Remove and move into
20866 (Field::Define): here and modify accordingly.
20867 (Field.FieldBuilder): New member.
20868 (TypeContainer::Populate): Update accordingly.
20869 (TypeContainer::FindMembers): Implement.
20871 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20873 * statement.cs: (VariableInfo::VariableType): New field to be
20874 initialized with the full type once it is resolved.
20876 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20878 * parameter.cs (GetParameterInfo): Use a type cache to compute
20879 things only once, and to reuse this information
20881 * expression.cs (LocalVariableReference::Emit): Implement.
20882 (OpcodeCast::Emit): fix.
20884 (ParameterReference::Resolve): Implement.
20885 (ParameterReference::Emit): Implement.
20887 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20888 that are expressions need to stay as Expressions.
20890 * typemanager.cs (CSharpName): Returns the C# name of a type if
20893 * expression.cs (Expression::ConvertImplicit): New function that
20894 implements implicit type conversions.
20896 (Expression::ImplicitReferenceConversion): Implements implicit
20897 reference conversions.
20899 (EmptyCast): New type for transparent casts.
20901 (OpcodeCast): New type for casts of types that are performed with
20902 a sequence of bytecodes.
20904 (BoxedCast): New type used for casting value types into reference
20905 types. Emits a box opcode.
20907 (Binary::DoNumericPromotions): Implements numeric promotions of
20908 and computation of the Binary::Type.
20910 (Binary::EmitBranchable): Optimization.
20912 (Binary::Emit): Implement code emission for expressions.
20914 * typemanager.cs (TypeManager): Added two new core types: sbyte
20917 2001-09-12 Ravi Pratap <ravi@ximian.com>
20919 * class.cs (TypeContainer::FindMembers): Method which does exactly
20920 what Type.FindMembers does, only we don't have to use reflection. No
20921 implementation yet.
20923 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20924 typecontainer objects as we need to get at them.
20925 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20927 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20928 typecontainer object.
20930 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
20931 of just a Report object.
20933 2001-09-11 Ravi Pratap <ravi@ximian.com>
20935 * class.cs (Event::Define): Go back to using the prefixes "add_" and
20937 (TypeContainer::Populate): Now define the delegates of the type too.
20938 (TypeContainer.Delegates): Property to access the list of delegates defined
20941 * delegates.cs (Delegate::Define): Implement partially.
20943 * modifiers.cs (TypeAttr): Handle more flags.
20945 2001-09-11 Ravi Pratap <ravi@ximian.com>
20947 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
20949 (Operator::Define): Re-write logic to get types by using the LookupType method
20950 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
20951 (Indexer::Define): Ditto.
20952 (Event::Define): Ditto.
20953 (Property::Define): Ditto.
20955 2001-09-10 Ravi Pratap <ravi@ximian.com>
20957 * class.cs (TypeContainer::Populate): Now define operators too.
20958 (TypeContainer.Operators): New property to access the list of operators
20960 (Operator.OperatorMethodBuilder): New member to hold the method builder
20961 for the operator we are defining.
20962 (Operator::Define): Implement.
20964 2001-09-10 Ravi Pratap <ravi@ximian.com>
20966 * class.cs (Event::Define): Make the prefixes of the accessor methods
20967 addOn_ and removeOn_
20969 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
20970 of the location being passed in too. Ideally, this should go later since all
20971 error reporting should be done through the Report object.
20973 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
20974 (Populate): Iterate thru the indexers we have and define them too.
20975 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
20976 for the get and set accessors.
20977 (Indexer::Define): Implement.
20979 2001-09-09 Miguel de Icaza <miguel@ximian.com>
20981 * expression.cs (Binary::Resolve): Beginning of it. I scratched
20982 my previous implementation, did not work.
20984 * typemanager.cs: Add a couple of missing types (the longs).
20986 * literal.cs: Use TypeManager.bool_type instead of getting it.
20988 * expression.cs (EventExpr): New kind of expressions.
20989 (Expressio::ExprClassFromMemberInfo): finish
20991 2001-09-08 Miguel de Icaza <miguel@ximian.com>
20993 * assign.cs: Emit stores to static fields differently.
20995 2001-09-08 Ravi Pratap <ravi@ximian.com>
20997 * Merge in changes and adjust code to tackle conflicts. Backed out my
20998 code in Assign::Resolve ;-)
21000 2001-09-08 Ravi Pratap <ravi@ximian.com>
21002 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21003 instead Report.Error and also pass in the location.
21004 (CSharpParser::Lexer): New readonly property to return the reference
21005 to the Tokenizer object.
21006 (declare_local_variables): Use Report.Error with location instead of plain
21010 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21011 (Operator.CheckBinaryOperator): Ditto.
21013 * cs-parser.jay (operator_declarator): Update accordingly.
21015 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21016 (CheckBinaryOperator): Same here.
21018 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21019 on the name without any prefixes of namespace names etc. This is because we
21020 already might have something already fully qualified like
21021 'System.Console.WriteLine'
21023 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21025 2001-09-07 Ravi Pratap <ravi@ximian.com>
21027 * cs-tokenizer.cs (location): Return a string which also contains
21030 * expression.cs (ElementAccess): New class for expressions of the
21031 type 'element access.'
21032 (BaseAccess): New class for expressions of the type 'base access.'
21033 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21036 * cs-parser.jay (element_access): Implement action.
21037 (base_access): Implement actions.
21038 (checked_expression, unchecked_expression): Implement.
21040 * cs-parser.jay (local_variable_type): Correct and implement.
21041 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21043 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21045 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21046 name and the specifiers.
21048 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21050 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21051 making them all public ;-)
21053 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21056 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21058 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21060 (FieldExpr, PropertyExprs): New resolved expressions.
21061 (SimpleName::MemberStaticCheck): Perform static checks for access
21062 to non-static fields on static methods. Maybe this should be
21063 generalized for MemberAccesses.
21064 (SimpleName::ResolveSimpleName): More work on simple name
21067 * cs-parser.jay (primary_expression/qualified_identifier): track
21068 the parameter index.
21070 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21071 (EmitContext::EmitBoolExpression): Chain to expression generation
21072 instead of temporary hack.
21073 (::EmitStatementExpression): Put generic expression code generation.
21075 * assign.cs (Assign::Emit): Implement variable assignments to
21076 local variables, parameters and fields.
21078 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21080 * statement.cs (Block::GetVariableInfo): New method, returns the
21081 VariableInfo for a variable name in a block.
21082 (Block::GetVariableType): Implement in terms of GetVariableInfo
21084 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21085 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21087 2001-09-06 Ravi Pratap <ravi@ximian.com>
21089 * cs-parser.jay (operator_declaration): Continue on my quest : update
21090 to take attributes argument.
21091 (event_declaration): Ditto.
21092 (enum_declaration): Ditto.
21093 (indexer_declaration): Ditto.
21095 * class.cs (Operator::Operator): Update constructor accordingly.
21096 (Event::Event): Ditto.
21098 * delegate.cs (Delegate::Delegate): Same here.
21100 * enum.cs (Enum::Enum): Same here.
21102 2001-09-05 Ravi Pratap <ravi@ximian.com>
21104 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21106 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21108 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21109 being passed around as an arraylist.
21110 (Attributes::AddAttribute): Method to add attribute sections.
21112 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21113 (struct_declaration): Update accordingly.
21114 (constant_declaration): Update.
21115 (field_declaration): Update.
21116 (method_header): Update.
21117 (fixed_parameter): Update.
21118 (parameter_array): Ditto.
21119 (property_declaration): Ditto.
21120 (destructor_declaration): Ditto.
21122 * class.cs (Struct::Struct): Update constructors accordingly.
21123 (Class::Class): Ditto.
21124 (Field::Field): Ditto.
21125 (Method::Method): Ditto.
21126 (Property::Property): Ditto.
21127 (TypeContainer::OptAttribute): update property's return type.
21129 * interface.cs (Interface.opt_attributes): New member.
21130 (Interface::Interface): Update to take the extra Attributes argument.
21132 * parameter.cs (Parameter::Parameter): Ditto.
21134 * constant.cs (Constant::Constant): Ditto.
21136 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21137 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21138 the attributes as a parameter.
21139 (InterfaceProperty): Update constructor call.
21140 (InterfaceEvent): Ditto.
21141 (InterfaceMethod): Ditto.
21142 (InterfaceIndexer): Ditto.
21144 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21145 pass the attributes too.
21146 (interface_event_declaration): Ditto.
21147 (interface_property_declaration): Ditto.
21148 (interface_method_declaration): Ditto.
21149 (interface_declaration): Ditto.
21151 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21153 * class.cs (Method::Define): Track the "static Main" definition to
21154 create an entry point.
21156 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21157 EntryPoint if we find it.
21159 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21160 (EmitContext::ig): Make this variable public.
21162 * driver.cs: Make the default output file be the first file name
21163 with the .exe extension.
21165 Detect empty compilations
21167 Handle various kinds of output targets. Handle --target and
21168 rename -t to --dumper.
21170 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21171 methods inherited from Expression return now an Expression. This
21172 will is used during the tree rewriting as we resolve them during
21175 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21176 the spec. Missing entirely is the information about
21177 accessability of elements of it.
21179 (Expression::ExprClassFromMemberInfo): New constructor for
21180 Expressions that creates a fully initialized Expression based on
21181 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21184 (Invocation::Resolve): Begin implementing resolution of invocations.
21186 * literal.cs (StringLiteral): Implement Emit.
21188 2001-09-05 Ravi Pratap <ravi@ximian.com>
21190 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21193 2001-09-04 Ravi Pratap <ravi@ximian.com>
21195 * cs-parser.jay (attribute_arguments): Implement actions.
21196 (attribute): Fix bug in production. Implement action.
21197 (attribute_list): Implement.
21198 (attribute_target): Implement.
21199 (attribute_target_specifier, opt_target_specifier): Implement
21200 (CheckAttributeTarget): New method to check if the attribute target
21202 (attribute_section): Implement.
21203 (opt_attributes): Implement.
21205 * attribute.cs : New file to handle attributes.
21206 (Attribute): Class to hold attribute info.
21208 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21209 (attribute_section): Modify production to use 2 different rules to
21210 achieve the same thing. 1 s/r conflict down !
21211 Clean out commented, useless, non-reducing dimension_separator rules.
21213 * class.cs (TypeContainer.attributes): New member to hold list
21214 of attributes for a type.
21215 (Struct::Struct): Modify to take one more argument, the attribute list.
21216 (Class::Class): Ditto.
21217 (Field::Field): Ditto.
21218 (Method::Method): Ditto.
21219 (Property::Property): Ditto.
21221 * cs-parser.jay (struct_declaration): Update constructor call to
21222 pass in the attributes too.
21223 (class_declaration): Ditto.
21224 (constant_declaration): Ditto.
21225 (field_declaration): Ditto.
21226 (method_header): Ditto.
21227 (fixed_parameter): Ditto.
21228 (parameter_array): Ditto.
21229 (property_declaration): Ditto.
21231 * constant.cs (Constant::Constant): Update constructor similarly.
21232 Use System.Collections.
21234 * parameter.cs (Parameter::Parameter): Update as above.
21236 2001-09-02 Ravi Pratap <ravi@ximian.com>
21238 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21239 (TypeContainer.delegates): New member to hold list of delegates.
21241 * cs-parser.jay (delegate_declaration): Implement the action correctly
21242 this time as I seem to be on crack ;-)
21244 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21246 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21247 tell whether an identifier represents a namespace.
21249 * expression.cs (NamespaceExpr): A namespace expression, used only
21250 temporarly during expression resolution.
21251 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21252 utility functions to resolve names on expressions.
21254 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21256 * codegen.cs: Add hook for StatementExpressions.
21258 * class.cs: Fix inverted test for static flag in methods.
21260 2001-09-02 Ravi Pratap <ravi@ximian.com>
21262 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21263 to make it coincide with MS' number.
21264 (Operator::CheckBinaryOperator): Ditto.
21266 * ../errors/errors.txt : Remove error numbers added earlier.
21268 * ../errors/cs1019.cs : Test case for error # 1019
21270 * ../errros/cs1020.cs : Test case for error # 1020
21272 * cs-parser.jay : Clean out commented cruft.
21273 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21274 used anywhere - non-reducing rule.
21275 (namespace_declarations): Non-reducing rule - comment out.
21277 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21278 with TypeContainer::AddEnum.
21280 * delegate.cs : New file for delegate handling classes.
21281 (Delegate): Class for declaring delegates.
21283 * makefile : Update.
21285 * cs-parser.jay (delegate_declaration): Implement.
21287 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21289 * class.cs (Event::Define): Implement.
21290 (Event.EventBuilder): New member.
21292 * class.cs (TypeContainer::Populate): Update to define all enums and events
21294 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21295 readonly fields for all these cases ?
21297 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21299 * class.cs (Property): Revamp to use the convention of making fields readonly.
21300 Accordingly modify code elsewhere.
21302 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21303 the Define method of the Property class.
21305 * class.cs : Clean up applied patch and update references to variables etc. Fix
21307 (TypeContainer::Populate): Update to define all the properties we have. Also
21308 define all enumerations.
21310 * enum.cs (Define): Implement.
21312 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21314 * cs-parser.jay (overloadable_operator): The semantic value is an
21315 enum of the Operator class.
21316 (operator_declarator): Implement actions.
21317 (operator_declaration): Implement.
21319 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21320 validity of definitions.
21321 (Operator::CheckBinaryOperator): Static method to check for binary operators
21322 (TypeContainer::AddOperator): New method to add an operator to a type.
21324 * cs-parser.jay (indexer_declaration): Added line to actually call the
21325 AddIndexer method so it gets added ;-)
21327 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21328 already taken care of by the MS compiler ?
21330 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21332 * class.cs (Operator): New class for operator declarations.
21333 (Operator::OpType): Enum for the various operators.
21335 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21337 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21338 ostensibly handle this in semantic analysis.
21340 * cs-parser.jay (general_catch_clause): Comment out
21341 (specific_catch_clauses, specific_catch_clause): Ditto.
21342 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21343 (catch_args, opt_catch_args): New productions.
21344 (catch_clause): Rewrite to use the new productions above
21345 (catch_clauses): Modify accordingly.
21346 (opt_catch_clauses): New production to use in try_statement
21347 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21348 and re-write the code in the actions to extract the specific and
21349 general catch clauses by being a little smart ;-)
21351 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21352 Hooray, try and catch statements parse fine !
21354 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21356 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21357 string from the hashtable of variables.
21359 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21360 I end up making that mistake ;-)
21361 (catch_clauses): Fixed gross error which made Key and Value of the
21362 DictionaryEntry the same : $1 !!
21364 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21366 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21368 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21369 when the add and remove accessors are specified.
21371 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21373 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21374 information about indexer_declarator.
21375 (indexer_declarator): Implement actions.
21376 (parsing_indexer): New local boolean used to keep track of whether
21377 we are parsing indexers or properties. This is necessary because
21378 implicit_parameters come into picture even for the get accessor in the
21379 case of an indexer.
21380 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21382 * class.cs (Indexer): New class for indexer declarations.
21383 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21384 (TypeContainer::indexers): New member to hold list of indexers for the
21387 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21389 * cs-parser.jay (add_accessor_declaration): Implement action.
21390 (remove_accessor_declaration): Implement action.
21391 (event_accessors_declaration): Implement
21392 (variable_declarators): swap statements for first rule - trivial.
21394 * class.cs (Event): New class to hold information about event
21396 (TypeContainer::AddEvent): New method to add an event to a type
21397 (TypeContainer::events): New member to hold list of events.
21399 * cs-parser.jay (event_declaration): Implement actions.
21401 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21403 * cs-parser.jay (dim_separators): Implement. Make it a string
21404 concatenating all the commas together, just as they appear.
21405 (opt_dim_separators): Modify accordingly
21406 (rank_specifiers): Update accordingly. Basically do the same
21407 thing - instead, collect the brackets here.
21408 (opt_rank_sepcifiers): Modify accordingly.
21409 (array_type): Modify to actually return the complete type string
21410 instead of ignoring the rank_specifiers.
21411 (expression_list): Implement to collect the expressions
21412 (variable_initializer): Implement. We make it a list of expressions
21413 essentially so that we can handle the array_initializer case neatly too.
21414 (variable_initializer_list): Implement.
21415 (array_initializer): Make it a list of variable_initializers
21416 (opt_array_initializer): Modify accordingly.
21418 * expression.cs (New::NType): Add enumeration to help us
21419 keep track of whether we have an object/delegate creation
21420 or an array creation.
21421 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21422 members to hold data about array creation.
21423 (New:New): Modify to update NewType
21424 (New:New): New Overloaded contructor for the array creation
21427 * cs-parser.jay (array_creation_expression): Implement to call
21428 the overloaded New constructor.
21430 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21432 * class.cs (TypeContainer::Constructors): Return member
21433 constructors instead of returning null.
21435 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21437 * typemanager.cs (InitCoreTypes): Initialize the various core
21438 types after we have populated the type manager with the user
21439 defined types (this distinction will be important later while
21440 compiling corlib.dll)
21442 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21443 on Expression Classification. Now all expressions have a method
21444 `Resolve' and a method `Emit'.
21446 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21447 generation from working. Also add some temporary debugging
21450 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21452 * codegen.cs: Lots of code generation pieces. This is only the
21453 beginning, will continue tomorrow with more touches of polish. We
21454 handle the fundamentals of if, while, do, for, return. Others are
21455 trickier and I need to start working on invocations soon.
21457 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21460 * codegen.cs (EmitContext): New struct, used during code
21461 emission to keep a context. Most of the code generation will be
21464 * cs-parser.jay: Add embedded blocks to the list of statements of
21465 this block. So code generation proceeds in a top down fashion.
21467 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21469 * statement.cs: Add support for multiple child blocks.
21471 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21473 * codegen.cs (EmitCode): New function, will emit the code for a
21474 Block of code given a TypeContainer and its ILGenerator.
21476 * statement.cs (Block): Standard public readonly optimization.
21477 (Block::Block constructors): Link children.
21478 (Block::Child): Child Linker.
21479 (Block::EmitVariables): Emits IL variable declarations.
21481 * class.cs: Drop support for MethodGroups here, delay until
21483 (Method::): Applied the same simplification that I did before, and
21484 move from Properties to public readonly fields.
21485 (Method::ParameterTypes): Returns the parameter types for the
21486 function, and implements a cache that will be useful later when I
21487 do error checking and the semantic analysis on the methods is
21489 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21490 and made a method, optional argument tells whether this is a class
21491 or a structure to apply the `has-this' bit.
21492 (Method::GetCallingConvention): Implement, returns the calling
21494 (Method::Define): Defines the type, a second pass is performed
21495 later to populate the methods.
21497 (Constructor::ParameterTypes): implement a cache similar to the
21498 one on Method::ParameterTypes, useful later when we do semantic
21501 (TypeContainer::EmitMethod): New method. Emits methods.
21503 * expression.cs: Removed MethodGroup class from here.
21505 * parameter.cs (Parameters::GetCallingConvention): new method.
21507 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21509 * class.cs (TypeContainer::Populate): Drop RootContext from the
21512 (Constructor::CallingConvention): Returns the calling convention.
21513 (Constructor::ParameterTypes): Returns the constructor parameter
21516 (TypeContainer::AddConstructor): Keep track of default constructor
21517 and the default static constructor.
21519 (Constructor::) Another class that starts using `public readonly'
21520 instead of properties.
21522 (Constructor::IsDefault): Whether this is a default constructor.
21524 (Field::) use readonly public fields instead of properties also.
21526 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21527 track of static constructors; If none is used, turn on
21528 BeforeFieldInit in the TypeAttributes.
21530 * cs-parser.jay (opt_argument_list): now the return can be null
21531 for the cases where there are no arguments.
21533 (constructor_declarator): If there is no implicit `base' or
21534 `this', then invoke the default parent constructor.
21536 * modifiers.cs (MethodAttr): New static function maps a set of
21537 modifiers flags into a MethodAttributes enum
21538 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21539 MethodAttr, TypeAttr to represent the various mappings where the
21540 modifiers are used.
21541 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21543 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21545 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21548 * interface.cs (PopulateIndexer): Implemented the code generator
21549 for interface indexers.
21551 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21553 * interface.cs (InterfaceMemberBase): Now we track the new status
21556 (PopulateProperty): Implement property population. Woohoo! Got
21557 Methods and Properties going today.
21559 Removed all the properties for interfaces, and replaced them with
21560 `public readonly' fields.
21562 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21564 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21565 initialize their hashtables/arraylists only when they are needed
21566 instead of doing this always.
21568 * parameter.cs: Handle refs and out parameters.
21570 * cs-parser.jay: Use an ArrayList to construct the arguments
21571 instead of the ParameterCollection, and then cast that to a
21574 * parameter.cs: Drop the use of ParameterCollection and use
21575 instead arrays of Parameters.
21577 (GetParameterInfo): Use the Type, not the Name when resolving
21580 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21582 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21583 and instead use public readonly fields.
21585 * class.cs: Put back walking code for type containers.
21587 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21589 * class.cs (MakeConstant): Code to define constants.
21591 * rootcontext.cs (LookupType): New function. Used to locate types
21594 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21596 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21597 this System.Reflection code is. Kudos to Microsoft
21599 * typemanager.cs: Implement a type cache and avoid loading all
21600 types at boot time. Wrap in LookupType the internals. This made
21601 the compiler so much faster. Wow. I rule!
21603 * driver.cs: Make sure we always load mscorlib first (for
21604 debugging purposes, nothing really important).
21606 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21607 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21609 * rootcontext.cs: Lookup types on their namespace; Lookup types
21610 on namespaces that have been imported using the `using' keyword.
21612 * class.cs (TypeContainer::TypeAttr): Virtualize.
21613 (Class::TypeAttr): Return attributes suitable for this bad boy.
21614 (Struct::TypeAttr): ditto.
21615 Handle nested classes.
21616 (TypeContainer::) Remove all the type visiting code, it is now
21617 replaced with the rootcontext.cs code
21619 * rootcontext.cs (GetClassBases): Added support for structs.
21621 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21623 * interface.cs, statement.cs, class.cs, parameter.cs,
21624 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21625 Drop use of TypeRefs, and use strings instead.
21627 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21631 * class.cs (Struct::Struct): set the SEALED flags after
21632 checking the modifiers.
21633 (TypeContainer::TypeAttr): new property, returns the
21634 TypeAttributes for a class.
21636 * cs-parser.jay (type_list): Oops, list production was creating a
21637 new list of base types.
21639 * rootcontext.cs (StdLib): New property.
21640 (GetInterfaceTypeByName): returns an interface by type name, and
21641 encapsulates error handling here.
21642 (GetInterfaces): simplified.
21643 (ResolveTree): Encapsulated all the tree resolution here.
21644 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21647 * driver.cs: Add support for --nostdlib, to avoid loading the
21648 default assemblies.
21649 (Main): Do not put tree resolution here.
21651 * rootcontext.cs: Beginning of the class resolution.
21653 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21655 * rootcontext.cs: Provide better error reporting.
21657 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21659 * rootcontext.cs (CreateInterface): Handle the case where there
21660 are no parent interfaces.
21662 (CloseTypes): Routine to flush types at the end.
21663 (CreateInterface): Track types.
21664 (GetInterfaces): Returns an array of Types from the list of
21665 defined interfaces.
21667 * typemanager.c (AddUserType): Mechanism to track user types (puts
21668 the type on the global type hash, and allows us to close it at the
21671 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21673 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21674 RecordInterface instead.
21676 * cs-parser.jay: Updated to reflect changes above.
21678 * decl.cs (Definition): Keep track of the TypeBuilder type that
21679 represents this type here. Not sure we will use it in the long
21680 run, but wont hurt for now.
21682 * driver.cs: Smaller changes to accomodate the new code.
21684 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21687 * rootcontext.cs (CreateInterface): New method, used to create
21688 the System.TypeBuilder type for interfaces.
21689 (ResolveInterfaces): new entry point to resolve the interface
21691 (CodeGen): Property, used to keep track of the code generator.
21693 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21695 * cs-parser.jay: Add a second production for delegate_declaration
21698 (enum_body): Put an opt_comma here instead of putting it on
21699 enum_body or enum_member_declarations so we can handle trailing
21700 commas on enumeration members. Gets rid of a shift/reduce.
21702 (type_list): Need a COMMA in the middle.
21704 (indexer_declaration): Tell tokenizer to recognize get/set
21706 * Remove old targets.
21708 * Re-add the parser target.
21710 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21712 * cs-parser.jay: Add precendence rules for a number of operators
21713 ot reduce the number of shift/reduce conflicts in the grammar.
21715 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21717 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21720 Get rid of old crufty code.
21722 * rootcontext.cs: Use this to keep track of the parsed
21723 representation and the defined types available to the program.
21725 * gen-treedump.cs: adjust for new convention.
21727 * type.cs: Split out the type manager, and the assembly builder
21730 * typemanager.cs: the type manager will live here now.
21732 * cil-codegen.cs: And the code generator here.
21734 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21736 * makefile: Fixed up for easy making.
21738 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21740 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21743 (unary_expression): Expand pre_increment_expression and
21744 post_decrement_expression to reduce a shift/reduce.
21746 2001-07-11 Simon Cozens
21748 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21750 Improve allow_keyword_as_indent name.
21752 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21754 * Adjustments for Beta2.
21756 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21758 * decl.cs: Added `Define' abstract method.
21759 (InTransit): new property, used to catch recursive definitions.
21761 * interface.cs: Implement `Define'.
21763 * modifiers.cs: Map Modifiers.constants to
21764 System.Reflection.TypeAttribute flags.
21766 * class.cs: Keep track of types and user-defined types.
21767 (BuilderInit): New method for creating an assembly
21768 (ResolveType): New function to launch the resolution process, only
21769 used by interfaces for now.
21771 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21772 that are inserted into the name space.
21774 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21776 * ARGH. I have screwed up my tree so many times due to the use of
21777 rsync rather than using CVS. Going to fix this at once.
21779 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21782 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21784 * Experiment successful: Use System.Type rather that our own
21787 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21789 * cs-parser.jay: Removed nsAliases from here.
21791 Use new namespaces, handle `using XXX;'
21793 * namespace.cs: Reimplemented namespace handling, use a recursive
21794 definition of the class. Now we can keep track of using clauses
21795 and catch invalid using clauses.
21797 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21799 * gen-treedump.cs: Adapted for all the renaming.
21801 * expression.cs (Expression): this class now has a Type property
21802 which returns an expression Type.
21804 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21805 `Type', as this has a different meaning now in the base
21807 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21809 * interface.cs, class.cs: Removed from all the sources the
21810 references to signature computation, as we can not do method
21811 signature computation during the parsing time, as we are not
21812 trying to solve at that point distinguishing:
21816 void a (NS.Blah x) {}
21819 Which depending on the context might be valid or not, as we do not
21820 know if Blah is the same thing as NS.Blah at that point.
21822 * Redid everything so the code uses TypeRefs now instead of
21823 Types. TypeRefs are just temporary type placeholders, that need
21824 to be resolved. They initially have a pointer to a string and the
21825 current scope in which they are used. This is used later by the
21826 compiler to resolve the reference to an actual Type.
21828 * DeclSpace is no longer a CIR.Type, and neither are
21829 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21830 are all DeclSpaces, but no Types.
21832 * type.cs (TypeRefManager): This implements the TypeRef manager,
21833 which keeps track of all the types that need to be resolved after
21834 the parsing has finished.
21836 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21838 * ARGH. We are going to have to store `foreach' as a class rather
21839 than resolving it, as we need to verify error 1579 after name
21840 resolution. *OR* we could keep a flag that says `This request to
21841 IEnumerator comes from a foreach statement' which we can then use
21842 to generate the error.
21844 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21846 * class.cs (TypeContainer.AddMethod): we now add methods to the
21847 MethodGroup instead of the method hashtable.
21849 * expression.cs: Add MethodGroup abstraction, which gets us one
21850 step closer to the specification in the way we handle method
21853 * cs-parser.jay (primary_expression): qualified_identifier now
21854 tried to match up an identifier to a local variable reference or
21855 to a parameter reference.
21857 current_local_parameters is now a parser global variable that
21858 points to the current parameters for the block, used during name
21861 (property_declaration): Now creates an implicit `value' argument to
21864 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21866 * parameter.cs: Do not use `param' arguments as part of the
21867 signature, per the spec.
21869 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21871 * decl.cs: Base class for classes, structs and interfaces. This
21872 is the "Declaration Space"
21874 * cs-parser.jay: Use CheckDef for checking declaration errors
21875 instead of having one on each function.
21877 * class.cs: Factor out some code for handling error handling in
21878 accordance to the "Declarations" section in the "Basic Concepts"
21879 chapter in the ECMA C# spec.
21881 * interface.cs: Make all interface member classes derive from
21882 InterfaceMemberBase.
21884 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21886 * Many things: all interfaces are parsed and generated in
21887 gen-treedump. Support for member variables, constructors,
21888 destructors, properties, constants is there.
21890 Beginning of the IL backend, but very little done, just there for
21893 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21895 * cs-parser.jay: Fix labeled statement.
21897 * cs-tokenizer.cs (escape): Escape " and ' always.
21898 ref_line, ref_name: keep track of the line/filename as instructed
21899 by #line by the compiler.
21902 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21904 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21905 to match the values in System.CodeDOM.
21907 Divid renamed to Divide.
21909 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21911 (Statements.set): remove.
21913 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21916 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21917 falseStatements always have valid values.
21919 * cs-parser.jay: Use System.CodeDOM now.