1 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
3 * cs-tokenizer.cs : reverted the latest change: it somehow broke
6 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
8 * doc.cs : so it turned out that we cannot skip override check for
9 interface members. Fixed bug #76954.
11 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
13 * cs-tokenizer.cs : fixed bug #75984:
14 - #warning and #error should not be handled when the source line
16 - #line is not checked strictly when the source line is disabled.
17 - #define and #undef is on the other hand checked strictly at any
20 2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
22 * cs-tokenizer.cs : missing Location (actually, filename) in one of
25 2005-12-05 Marek Safar <marek.safar@seznam.cz>
27 * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only.
29 * class.cs (EmitFieldInitializers): Simplified and fixed to work with
31 (FieldBase.EmitInitializer): Moved from TypeContainer and simplified.
32 (FieldBase.Initializer): Initializer is now optional.
33 (EventField.Define): Only event field can have initializer.
35 * codegen.cs (EmitContext): DeclSpace is not readonly (small hack).
37 * const.cs (Const): Reuse initializer.
39 * cs-parser.jay: Updated after FieldBase changes.
40 Added current_array_type to simplify array initializers.
42 * ecore.cs (NullCast.IsDefaultValue): Implemented.
44 * expression.cs, iterators.cs: Updated.
46 * namespace.cs (NamespaceEntry): Made UsingFound private.
48 2005-12-05 Marek Safar <marek.safar@seznam.cz>
50 * parameterCollection.cs: Obsolete, removed.
51 * parser.cs: Obsolete, removed.
53 2005-12-05 Marek Safar <marek.safar@seznam.cz>
56 * class.cs (Constructor.Emit): Set obsolete checking for whole context.
58 * enum.cs (Enum.Define): Set obsolete context here.
60 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
63 - FindDocumentedMember() now expects 1) paramList as null
64 when "we don't have to check the number of parameters" and
65 2) Type.EmptyTypes when "there is no arguments".
66 - Introduced FoundMember struct to hold the exact type which was
67 used to find the documented member (the above change broke
68 test-xml-044; it might be better just to use DeclaringType than
69 what MS does, like this change does, but it depends on usage.)
71 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
73 * doc.cs : documented member might be from DeclaringType for nested
74 types. Fixed bug #76782.
76 2005-12-03 Ben Maurer <bmaurer@ximian.com>
78 * anonymous.cs: Have the param code handle leaving copies on the
79 stack etc. Allows anonymous params to take part in the assignment
80 code (++, +=, etc). Fixes bug #76550
82 * expression.cs: Handle the prepare_for_load/leave_copy by passing
83 it down to the anon code.
85 * iterators.cs: Use dummy var here
87 * codegen.cs: Handle new vars
89 2005-12-01 Marek Safar <marek.safar@seznam.cz>
92 * class.cs (MethodData.Define): Set proper Obsolete context.
94 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
96 (FieldExpr.DoResolve): Ditto.
98 2005-12-01 Marek Safar <marek.safar@seznam.cz>
101 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
102 parent is not obsolete.
104 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
106 * doc.cs : (FindDocumentedMember) find parameterless members first
107 and get CS0419 in the early stage. Fixed first case of bug #76727.
109 2005-11-30 Marek Safar <marek.safar@seznam.cz>
112 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
113 no error was reported.
115 *expression.cs (Binary.DoResolve): left can be null.
117 2005-11-22 Marek Safar <marek.safar@seznam.cz>
120 * class.cs (MethodData.Emit): Parameters should be labeled first.
122 2005-11-21 Marek Safar <marek.safar@seznam.cz>
125 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
127 2005-11-18 Marek Safar <marek.safar@seznam.cz>
129 * attribute.cs (AreParametersCompliant): Moved to Parameter.
131 * class.cs (MethodCore): Parameter clean up.
132 (IMethodData): Added ParameterInfo.
133 (MethodData): Parameter clean up.
134 (Indexer.Define): Parameter clean up.
146 * typemanager.cs: Parameter clean up.
148 * delegate.cs (Define): Get rid of duplicated code.
150 * expression.cs (ParameterReference): Removed useless parameters
154 * parameter.cs (ParamsParameter): New class, params specialization.
155 (ArglistParameter): Attemp to separate arglist.
156 (Parameter): Refactored to be reusable and faster.
157 (Parameter.Modifier): Made understandable.
158 (Parameters): Changed to be used as a class for `this' assembly
159 parameters. Refactored to use new specialized classes.
161 * support.cs (ParameterData): Added Types property.
162 (InternalParameters): Deleted.
164 2005-08-20 Martin Baulig <martin@ximian.com>
166 Merging this patch from GMCS to fix #75867.
168 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
169 scope if we don't already have it.
171 2005-11-17 Martin Baulig <martin@ximian.com>
174 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
175 inherit the scope from our parent. Fixes #76653.
177 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
179 * doc.cs : the previous patch does not actually fix the bug.
180 PropertyInfo override check is now implemented and really fixed it.
181 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
183 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
185 * doc.cs : apply "override filter" also to properties.
188 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
190 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
191 no need to check overrides. For classes, omit those results from
192 interfaces since they must exist in the class. Fixed bug #76726.
194 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
196 * typemanager.cs : (GetFullNameSignature) differentiate indexers
197 with different parameters. Fixed the second problem in #76685.
199 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
201 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
202 get expected 'protected' access in CheckValidFamilyAccess()).
205 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
207 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
208 Fixed bug #76705. CS1569 was incorrectly commented out.
210 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
212 * doc.cs : use Invocation.IsOverride() to do real override check.
213 * expression.cs : made Invocation.IsOverride() internal.
215 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
217 * doc.cs : use TypeManager.FindMembers() instead of (possible)
218 TypeBuilder.FindMembers() and filter overriden base members out.
221 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
223 * doc.cs : ref/out parameters are represented as '@' (instead of
224 '&' in type FullName). Fixed bug #76630 (additionally crefs).
226 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
228 * doc.cs : when there was no '.' in cref to methods in doc comment,
229 then parameters were missing in the output. Fixed bug #76691.
231 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
233 * driver.cs : don't output docs when there is an error.
236 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
239 Now it should detect indexers. Fixed primary concern in bug #76685.
240 Fixed CS0419 message to not show the identical member signature in
243 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
245 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
246 instead of Type.FindMembers() since it does not handle events.
249 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
251 * codegen.cs: Fixed typo (speficied -> specified).
253 2005-11-11 Marek Safar <marek.safar@seznam.cz>
256 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
258 2005-11-11 Marek Safar <marek.safar@seznam.cz>
260 * attribute.cs: Changed error message.
262 * cs-tokenizer.cs: One more check.
264 2005-11-10 Marek Safar <marek.safar@seznam.cz>
266 * statement.cs (Block.Resolve): Ignore empty statement.
268 2005-11-10 Marek Safar <marek.safar@seznam.cz>
270 * report.cs: Made error/warning methods more strict to avoid
273 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
274 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
275 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
276 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
278 2005-11-08 Marek Safar <marek.safar@seznam.cz>
280 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
281 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
283 * class.cs (TypeContainer.IsComImport): New property.
284 (Constructor.Define): Create proper ctor for ComImport types.
286 * expression.cs (New.CheckComImport): Fixed.
288 2005-11-07 Miguel de Icaza <miguel@novell.com>
290 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
291 that a parameter has been captured does not mean that we do not
292 have to do the rest of the processing. This fixes the second part
293 of #76592. If there was another anonymous method capturing
294 values in the past, the Scope would never be set for the second
295 method that captured the same parameter.
297 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
298 properly manipulate the stack. Second part of fix for #76592.
300 * expression.cs (New): Add support for invoking "new" on
301 interfaces that have been flagged with the ComImport attribute and
302 the CoClass. Fixes #76637
304 * statement.cs (Try.DoEmit): When a variable is captured, do not
305 try to emit the vi.LocalBuilder variable as it has been captured.
306 Create a temporary variable and store the results on the
307 FieldBuilder. Fixes #76642
309 2005-11-07 Marek Safar <marek.safar@seznam.cz>
311 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
313 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
315 * expression.cs (Binary.DoResolve): Added && optimalization.
317 * typemanager.cs (AddUserType): Removed useless argument.
319 2005-11-04 Marek Safar <marek.safar@seznam.cz>
321 * statement.cs (Block.variables): Uses ListDictionary.
323 2005-11-03 Marek Safar <marek.safar@seznam.cz>
326 * class.cs (PartialContainer.EmitType): Customized to emit
328 (ClassPart.ApplyAttributeBuilder): Transform security attribute
331 2005-11-03 Marek Safar <marek.safar@seznam.cz>
334 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
335 access has to be fixed.
337 * typemanager.cs (IsUnmanagedType): Wrong common field type.
339 2005-11-01 Marek Safar <marek.safar@seznam.cz>
342 * ecore.cs (NullCast.Reduce): Implemented.
344 * expression.cs (ArrayCreation.CheckIndices): Correcly check
347 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
349 (Foreach.Resolve): Catch null properly.
351 2005-10-29 Marek Safar <marek.safar@seznam.cz>
353 * cs-tokenizer.cs: Warning text fix.
355 * driver.cs: AllWarningNumbers exposed on public interface.
357 * report.cs (): Reviewed warning numbers.
358 (IsValidWarning): Use binary search.
360 2005-10-29 Marek Safar <marek.safar@seznam.cz>
362 * driver.cs: Implemeted resource visibility.
363 (Resources): New class for code sharing between /res: and
366 2005-10-28 Marek Safar <marek.safar@seznam.cz>
369 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
372 * convert (Convert.ImplicitReferenceConversion): NullCast holds
375 * ecore.cs (NullCast): Child is contant only.
377 * literal.cs (NullLiteral.Reduce): null can be converted to any
380 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
382 * driver.cs: Use Encoding.Default as default code page instead
385 2005-10-27 Raja R Harinath <rharinath@novell.com>
388 * expression.cs (Invocation.Error_InvalidArguments): Handle
389 __arglist parameters.
390 (Invocation.VerifyArgumentsCompat): Likewise.
391 * support.cs (ReflectionParameters.GetSignatureForError): Print
392 __arglist parameters.
393 (InternalParamters.GetSignatureForError): Likewise.
394 * parameter.cs (Parameters.GetSignatureForError): Likewise.
396 2005-10-26 Marek Safar <marek.safar@seznam.cz>
398 * attribute.cs (GetPropertyValue): Made public.
400 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
402 Add new property WrapNonExceptionThrows to handle 2.0 assembly
404 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
407 * driver.cs: Reflect method name change.
409 * statement.cs (Try.Resolve): Warn when try has both general
412 * typemanager.cs: runtime_compatibility_attr_type new predefined
415 2005-10-26 Raja R Harinath <harinath@gmail.com>
418 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
419 treat it as an empty parameter list.
421 2005-10-26 Raja R Harinath <rharinath@novell.com>
424 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
425 ResolveAsTypeStep silent.
426 * statement.cs (Block.AddConstant): Mark block as used.
427 (Block.ResolveMeta): Avoid piling on error messages
428 if a constant initializer resolution fails.
430 2005-10-25 Raja R Harinath <rharinath@novell.com>
432 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
434 (NamespaceEntry.VerifyAllUsing): New.
435 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
436 behaviour. Delegates actual resolution of alias to ...
437 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
438 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
440 * driver.cs (Driver.MainDriver): Update.
442 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
443 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
445 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
447 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
448 RootNamespace.DefineNamespacesForAll.
450 2005-10-24 Raja R Harinath <harinath@gmail.com>
452 * typemanager.cs (assemblies, external_aliases, modules)
453 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
454 (ComputeNamespaces, GetRootNamespace): Remove extra staging
455 overhead. Move resposibility ...
456 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
457 * driver.cs, attribute.cs, codegen.cs: Update to changes.
459 2005-10-23 Raja R Harinath <harinath@gmail.com>
461 * namespace.cs (RootNamespace.all_namespaces): Renamed from
462 cached_namespaces. Improve usage.
463 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
464 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
465 Move from GlobalRootNamespace and simplify.
466 (RootNamespace.Global): Make instance variable.
467 (RootNamespace.RootNamespace): Add "alias name" parameter.
468 (GlobalRootNamespace): Simplify drastically.
469 (Namespace.Lookup): Don't use GetNamespace.
470 * typemanager.cs (GetRootNamespace): Rename from
471 ComputeNamespaceForAlias.
472 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
474 2005-10-23 Marek Safar <marek.safar@seznam.cz>
476 * anonymous.cs (AnonymousContainer): Don't crash when container
479 2005-10-23 Marek Safar <marek.safar@seznam.cz>
481 * expression.cs (Binary.DoResolve): Warn when comparing same
484 2005-10-23 Marek Safar <marek.safar@seznam.cz>
487 * expression.cs (Binary.DoResolve): It looks like there are no
488 convetsion rules in enum context.
490 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
492 Add support for extern alias qualifiers.
493 * typemanager.cs: Move some LookupTypeReflection code
494 to namespace.cs, to have cleaner code. Added some methods
495 to help us keep track of the extern aliased references.
496 * driver.cs: Add suport for extern alias assemblies on command
497 line and check for their warnings/errors. Also keep track of the
498 extern aliased assemblies.
499 * namespace.cs: Move the global functionality of Namespace
500 to GlobalRootNamespace/RootNamespace. Now the global namespace
501 is GlobalRootNamespace.Globa. Also the code moved from
502 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
503 Finally added LocalAliasEntry (AliasEntry before) and
504 ExternAliasEntry, to handle alias statements.
505 * cs-parser.jay: Add support in the grammar for extern alias
507 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
508 Update callings to Namespace (now in GlobalRootNamespace).
510 2005-10-18 Raja R Harinath <rharinath@novell.com>
513 * class.cs (TypeContainer.DefineType): Move updating of
514 topological sort earlier in the code.
515 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
517 2005-10-18 Marek Safar <marek.safar@seznam.cz>
520 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
522 * constant.cs (Constant.TryReduce): Moved from Cast class.
523 (Reduce): Made little bit more OO and fixed missing conversions.
525 * ecore.cs (Reduce): Implemented.
526 (Binary.EnumLiftUp): New method to upgrade values to enum values.
528 * literal.cs (Reduce): Implemented.
530 * class.cs: Reverted Miguel's wrong commit.
532 2005-10-14 Miguel de Icaza <miguel@novell.com>
534 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
536 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
538 * cs-parser.jay, expression.cs : CS0214 was missing error location
539 for constants. Fixed bug #76404.
541 2005-10-11 Marek Safar <marek.safar@seznam.cz>
544 * convert.cs (ExplicitConversionCore): Fixed object->enum
547 2005-10-10 Raja R Harinath <rharinath@novell.com>
549 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
551 (PropertyExpr.EmitCall): Likewise.
552 * expression.cs (Invocation.EmitArguments): Handle case where
554 (Invocation.EmitCall): Avoid allocating temporary variable if
555 there are no arguments.
557 2005-10-07 Raja R Harinath <rharinath@novell.com>
560 * convert.cs (ImplicitConversionStandard): Move conversion of
561 void* to arbitrary pointer types ...
562 (ExplicitConversionStandard): .. here.
563 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
564 error to always print typenames.
566 2005-10-07 Raja R Harinath <rharinath@novell.com>
568 * convert.cs (GetConversionOperator): Rename from
569 GetConversionOperators. Move operator selection code from ...
570 (UserDefinedConversion): ... here.
572 2005-10-06 Marek Safar <marek.safar@seznam.cz>
574 * convert.cs (ExplicitConversionCore): Removed duplicate enum
577 2005-10-05 Marek Safar <marek.safar@seznam.cz>
579 * assign.cs (Assign.DoResolve): Error method changed.
581 * cfold.cs (DoConstantNumericPromotions): Error method changed.
583 * const.cs (ResolveValue): Reset in_transit immediately.
585 * constant.cs: Error method changed.
587 * convert.cs: Removed useless location parameter.
588 (ExplicitNumericConversion): Don't do double enum check.
589 (ExplicitConversionCore): Renamed from ExplicitConversion.
590 (ExplicitUnsafe): Extracted from ExplicitConversion.
591 (ExplicitConversion): Uses for error reporting.
593 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
595 (ResolveBoolean): Uses common error method.
596 (CastToDecimal): Get rid of ec.
597 (CastFromDecimal): Optimized.
598 (ConvCast): Get rid of ec.
600 * enum.cs (ResolveValue): Reset in_transit immediately.
601 (Emit): Return after first error.
603 * expression.cs: Convert changes.
605 * literal.cs: Error method changed.
607 * statement.cs: Error method changed.
609 2005-10-03 Raja R Harinath <rharinath@novell.com>
611 * support.cs (SeekableStreamReader.Position): Don't error out when
612 the requested position is just beyond the end of the current
615 2005-09-28 Raja R Harinath <rharinath@novell.com>
617 * support.cs (SeekableStreamReader): Simplify drastically. Don't
618 try to keep in sync with the byte count of the underlying Stream.
619 However, this limits us to a window size of 2048 characters: i.e.,
620 the maximum lookahead of our lexer/parser can be 2048 characters.
622 2005-09-28 Marek Safar <marek.safar@seznam.cz>
625 * driver.cs: Fix compilation files with full root path.
627 2005-09-25 Miguel de Icaza <miguel@novell.com>
629 * report.cs (SymbolRelatedToPreviousError): Format the output so
630 it does not use an open parenthesis that is never closed.
632 * driver.cs: Follow coding guidelines
634 2005-09-27 Marek Safar <marek.safar@seznam.cz>
637 * const.cs (Const.ResolveValue): Check for assigning non-null
638 value to reference type.
640 2005-09-27 Marek Safar <marek.safar@seznam.cz>
642 * anonymous.cs: Implemented ExprClassName.
644 * assign.cs (Assign.DoResolve): Don't chrash when type is not
647 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
650 * class.cs (StaticClass.DefineContainerMembers): Report protected
653 * codegen.cs: if(ed) PRODUCTION.
655 * convert.cs (Error_CannotImplicitConversion): Better error
658 * cs-parser.jay: More error checks.
660 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
662 * driver.cs (CSCParseOption): Enabled wrong option check.
664 * ecore.cs (Expression.ExprClassName): Turned to property.
665 (MemberExpr.CheckIntermediateModification): For checking boxed
666 value types modification.
668 * statement.cs (Fixed.Resolve): Expression type must be
669 convertible to fixed type.
670 (CollectionForeach.GetEnumeratorFilter,TryType):
671 Small refactoring for easier error checking.
673 2005-09-26 Marek Safar <marek.safar@seznam.cz>
675 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
678 * class.cs (GeneratedBaseInitializer): New class for customization
679 compiler generated initializers.
680 (MemberBase.DoDefine): Check Obsolete attribute here.
681 (FieldMember.DoDefine): Ditto.
683 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
686 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
687 (MemberCore.GetObsoleteAttribute): Removed argument.
688 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
689 (MemberCore.CheckObsoleteType): New helper.
693 * statement.cs: Updates after MemberCore changes.
695 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
696 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
698 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
699 obsolete attribute for compiler construct.
700 (As.DoResolve): Cache result.
702 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
704 2005-09-26 Raja R Harinath <rharinath@novell.com>
707 * expression.cs (This.VerifyFixed): In a value type T, the type of
708 'this' is T&, iow, 'this' is either an out or ref parameter. In a
709 value type R, 'this' is treated as a value parameter.
711 2005-09-22 Miguel de Icaza <miguel@novell.com>
713 * statement.cs (Lock): Use the TemporaryVariable class instead of
714 manually using local variables as those do not work when variables
717 * ecore.cs: Moved the TemporaryVariable class from being a nested
718 class inside Foreach to be a public class that can be employed in
721 2005-09-19 Marek Safar <marek.safar@seznam.cz>
723 * cs-parser.jay: interface_accessors replaced by
724 accessor_declarations.
726 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
729 * statement.cs (GotoCase.Resolve): Convert null constant to
731 (SwitchLabel.ResolveAndReduce): Ditto.
732 (SwitchLabel.NullStringCase): Custom null stamp.
733 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
735 typemanager.cs (CSharpSignature): Don't skip first argument
738 2005-09-18 Miguel de Icaza <miguel@novell.com>
740 * driver.cs: Set InEmacs based on the environment variable EMACS.
742 * location.cs (InEmacs): in this mode, do not report column
743 location as it confuses Emacs.
745 2005-09-16 Marek Safar <marek.safar@seznam.cz>
747 * cfold.cs, constant.cs, convert.cs, ecore.cs,
748 expression.cs, iterators.cs, literal.cs: Store constants and
751 * class.cs (MemberBase.ShortName): Pass location.
753 * cs-parser.jay: Some location fixes.
755 * ecore.cs (Expression.Location): Made virtual.
757 2005-09-05 Miguel de Icaza <miguel@novell.com>
759 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
760 if the underlying types are the same, otherwise we need to produce
761 code that will do the proper cast.
763 This was exposed by Marek's constant rewrite which produced
764 invalid code for the call site:
771 This fixes test-49.cs
773 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
775 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
776 Type/Object should be allowed as well. Fixed bug #75968.
778 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
780 * expression.cs : (Binary.DoResolve): when one is enum constant and
781 another is constant 0, then return enum one *as enum type*.
784 2005-09-02 Raja R Harinath <rharinath@novell.com>
786 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
790 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
791 flow-branching for LocalVariableReferences in case we were invoked
793 * expression.cs (LocalVariableReference.VerifyAssigned): New.
795 (LocalVariableReference.DoResolveBase): ... this.
796 (MemberAccess.Resolve): Do the check that was disabled during
799 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
802 (PartialContainer.Create): check abstract/sealed/static strictly
803 but abstract/sealed can exist only at one side. Fixed bug #75883.
805 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
808 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
809 specified, don't default to UnmanagedType.I4.
811 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
813 * expression.cs : conditional operator should check possibly
814 incorrect assign expression. Fixed bug #75946.
816 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
818 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
819 Reverting the change. gmcs is much complex than mcs on this matter.
821 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
823 * cs-tokenizer.cs : To read another token ahead of the actual
824 consumption, use new SavedToken and cache token instead of moving
825 back the stream with SeekableStreamReader (it seemed problematic).
827 driver.cs : Thus use StreamReader directly.
828 * support.cs : Thus removed SeekableStreamReader.
830 2005-08-30 Raja R Harinath <rharinath@novell.com>
833 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
834 (ScopeInfo.EmitScopeType): Use it to construct field names from
835 names of captured locals.
838 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
839 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
840 Pass 'target_type' to BoxedCast. Don't default to 'object'.
841 (ExplicitConversion): Remove enum cases already handled by
842 implicit conversion. Move implicit conversion check to the beginning.
843 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
844 * expression.cs (ArrayCreation.EmitDynamicInitializers):
845 Don't treat System.Enum as a struct.
847 2005-08-30 Jb Evain <jbevain@gmail.com>
849 * attribute.cs: handles as expression in parameters.
851 2005-08-30 Raja R Harinath <rharinath@novell.com>
854 * class.cs (TypeContainer.VerifyClsName): Don't use a
855 PartialContainer when verifying CLS compliance.
856 (AbstractPropertyEventMethod): Set Parent here, ...
857 (PropertyMethod): ... not here.
859 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
861 * attribute.cs : escaped attribute name should not be allowed to be
862 resolved (e.g. @class as classAttribute). Fixed bug #75930.
864 2005-08-29 Raja R Harinath <rharinath@novell.com>
867 * convert.cs (ImplicitStandardConversionExists): Allow zero also
868 when converting a long constant to unsigned long.
869 * expression.cs (Invocation.OverloadResolve): Add sanity check to
870 detect where IsApplicable and VerifyArgumentsCompat disagree.
872 2005-08-29 Raja R Harinath <rharinath@novell.com>
873 and Carlos Alberto Cortez <carlos@unixmexico.org>
876 * class.cs (TypeContainer.CanElideInitializer): New helper.
877 (TypeContainer.EmitFieldInitializers): Use it to determine if we
878 can safely emitting the initializer of a field.
880 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
882 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
883 allowed inside a switch (without loop). Fixed bug #75433.
885 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
887 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
888 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
890 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
892 * driver.cs : kinda reverting the default encoding changes (not exact
893 revert since I noticed that "codepage:reset" might not work fine).
895 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
897 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
898 Location. Now getter and setter store location correctly.
899 (errors/cs0111-12.cs now reports the expected location.)
901 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
903 * driver.cs : Use default encoding on the environment.
904 Removed (now that) extra parameter for SeekableStreamReader.
905 * support.cs : (SeekableStreamReader) third .ctor() argument for
906 StreamReader is not required (always true). preamble size could
907 be acquired in simpler and safe way.
909 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
911 * cs-parser.jay: report CS0642 at warning level 3
912 and report CS0642 for an if else statement also
913 fixes bug #74745. Patch by John Luke (and a bit
915 Removed extra CS0642 warning check for "while",
917 * statement.cs: In Block.Resolve(), CS0642 check
918 is reimplemented to check a sequence of an empty
919 statement and a block.
923 2005-08-24 Marek Safar <marek.safar@seznam.cz>
925 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
926 detection until I fix it.
928 * cs-tokenizer.cs: Changed error message.
930 * cs-parser.jay: Fixed 2 error locations.
932 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
933 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
936 * enum.cs (GetSignatureForError): Fixed.
938 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
942 * typemanager.cs (RegisterProperty): Removed.
944 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
946 2005-08-24 Raja R Harinath <rharinath@novell.com>
949 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
950 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
952 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
954 * expression.cs : tiny fix is required for not warning positive ulong.
957 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
959 * expression.cs : add CS0652 check for constant and integral
960 expression. Fixed bug #53974.
962 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
964 * expression.cs : in DoNumericPromotions(), check if there is implicit
965 conversion overload for string (to check CS0034). Fixed bug #52492.
967 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
969 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
971 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
973 * ecore.cs : report location when it is *not* Null.
975 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
981 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
982 correctly. Fixed bug #75721.
984 2005-08-23 Raja R Harinath <rharinath@novell.com>
986 * support.cs (SeekableStreamReader.Position): Avoid an expensive
987 loop that performs 'min (pos, char_count)'.
990 * expression.cs (Unary.ResolveOperator): Don't discard implicit
991 converted value in Operator.OnesComplement.
993 2005-08-22 Ben Maurer <bmaurer@ximian.com>
995 * anonymous.cs: If the anon method is pulled into a helper class,
996 it needs to be `internal' not `private'. Fixes runtime behavior on
999 2005-08-20 Martin Baulig <martin@ximian.com>
1001 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
1002 scope if we don't already have it.
1004 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
1005 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
1008 2005-08-17 Marek Safar <marek.safar@seznam.cz>
1011 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
1014 2005-08-16 Marek Safar <marek.safar@seznam.cz>
1016 The big constants rewrite
1017 Fix #75746, #75685 and more
1018 As a side effect saved 1MB for MWF ;-)
1020 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
1021 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
1022 enum based for corlib compilation.
1024 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
1027 * class.cs (FixedField.Define): Use ResolveAsConstant.
1029 * const.cs (IConstant): Interface constants and enums.
1030 (Const.ResolveValue): New method for constant resolvning.
1031 (ExternalConstant): Constants from imported assemblies.
1033 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
1034 conversion; like enums.
1035 (Constant.ToType): Converts this constant to different type.
1036 (Constant.Increment): Adds 1.
1038 * convert.cs (ImplicitConversionRequired): Simplified.
1040 * cs-parser.jay: Create EnumMember directly.
1042 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
1044 * doc.cs (GenerateEnumDocComment): Removed.
1046 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
1047 (ConvertIntLiteral): Removed.
1048 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
1050 * enum.cs (EnumMember): Implement IConstant.
1051 (Enum.IsValidEnumConstant): Removed.
1052 (Enum.GetNextDefaultValue): Removed.
1053 (Enum.FindMembers): Updated.
1054 (Enum.GenerateDocComment): Iterate enum members.
1056 * expression.cs (Cast.TryReduce): Handle enums correctly.
1057 (New.Constantify): Made public.
1058 (MemberAccess.DoResolve): Removed contant specific if(s).
1060 * literal.cs (NullLiteral): Implement new abstract methods.
1062 * statement.cs (GotoCase.Resolve): Use new constant methods.
1063 (SwitchLabel.ResolveAndReduce): Use new constant methods.
1065 * typemanager.cs (LookupEnum): Removed.
1066 (IsEnumType): Fixed to work with corlib.
1067 (RegisterConstant): Removed.
1068 (LookupConstant): Removed.
1069 (GetConstant): Changed to work with IConstant.
1071 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
1073 * location.cs : Fixed overflown (>255) column number.
1075 2005-08-03 Raja R Harinath <rharinath@novell.com>
1077 First cut of the qualified-alias-member feature.
1078 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
1080 * cs-parser.jay (DOUBLE_COLON): New token.
1081 (namespace_or_type_name): Add rule for recognizing
1082 qualified-alias-members.
1083 (primary_expression): Likewise.
1084 (element_access): Allow QualifiedAliasMember as a possible
1085 type-bearing expression.
1086 (local_variable_type, local_variable_pointer_type): Likewise.
1087 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
1088 aliases in the current and enclosing namespace declarations.
1089 (NamespaceEntry.UsingAlias): Add CS0440 warning.
1090 * decl.cs (MemberName.is_double_colon): New.
1091 (MemberName.MemberName): Add new constructor for alias-member.
1092 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
1093 * expression.cs (QualifiedAliasMember): New expression type.
1095 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1097 * location.cs : it borked when no argument was specified.
1099 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1101 * location.cs : tiny ToString() format fix.
1103 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1105 * statement.cs : oops, it was missing.
1107 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1109 A set of fixes for precise line/column location.
1112 "token" field now holds a file/line "delta", a line number offset
1113 from the segment, and a column number. See also:
1114 http://lists.ximian.com/pipermail/mono-devel-list/2004-
1115 December/009508.html
1116 Removed static IsNull. Use instance IsNull property instead.
1118 For some tokens it stores Location. For Identifier it stores
1119 LocatedToken which is a pair of string name and location.
1120 Column numbers are adjusted only at getChar().
1122 Use Location.ToString() for reporting (it now contains column).
1124 Largely modified to use LocatedToken instead of
1125 string (IDENTIFIER), and to acquire Location from some tokens.
1126 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
1127 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
1129 Now MemberName holds Location. DeclSpace.ctor() receives Location
1130 as a parameter. Removed extra parameters to all derived classes.
1131 Replaced Location.IsNull() with instance property.
1132 * assign.cs, expression.cs :
1133 Added .ctor() overload that omits Location.
1135 Added "nameEscaped" flag that indicates the identifier was escaped
1136 in the source file. This fixes bug #57047.
1138 2005-08-02 Marek Safar <marek.safar@seznam.cz>
1140 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
1141 New method, looking for lo-case imported cls type.
1143 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
1146 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
1148 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
1150 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
1152 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
1154 Optimized to save 3.5 MB for SWF compilation.
1156 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1158 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
1159 (PartialContainer.Create): Moved logic AddToContainer.
1160 (PartialContainer.MarkForDuplicationCheck): Shares name.
1162 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
1165 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
1167 (Namespace.GetSignatureForError): New method.
1169 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
1170 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
1172 2005-08-01 Raja R Harinath <rharinath@novell.com>
1175 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
1176 member lookup rather than qualifier_type, since qualifier_type can
1179 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1181 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
1184 2005-07-31 Miguel de Icaza <miguel@novell.com>
1186 * statement.cs: Copy the local exception into the exception
1187 captured local. Fixes 75674
1189 2005-07-31 Raja R Harinath <harinath@gmail.com>
1192 * expression.cs (Invocation.OverloadResolve): Don't report error
1193 CS1501 if error CS1502 has been reported.
1194 (New.DoResolve): Delegate CS1501 reporting to
1195 Invocation.OverloadResolve.
1198 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
1199 invariant-meaning-in-block property in an enclosing block if
1202 2005-07-29 Marek Safar <marek.safar@seznam.cz>
1204 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
1205 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
1206 (Switch.CheckSwitch): Just save 50kb for SWF.
1208 2005-07-27 Martin Baulig <martin@ximian.com>
1210 * anonymous.cs (CaptureContext.AddField): Added
1211 `AnonymousContainer am' argument; compute its toplevel scope if
1212 it's not already computed. Fixes #75649.
1214 2005-07-26 Raja R Harinath <rharinath@novell.com>
1217 * class.cs (Constructor.Emit): Reset block to null if the block
1220 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1222 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
1224 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1226 * class.cs (MethodData.Define): Check whether accessor implementing
1227 interface is public.
1229 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
1231 2005-07-22 Marek Safar <marek.safar@seznam.cz>
1234 * namespace.cs (LookupType): Moved same type check to...
1236 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
1239 2005-07-21 Raja R Harinath <rharinath@novell.com>
1241 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
1242 already found a typebuilder.
1243 * class.cs (MethodCore.IsDuplicateImplementation): Compare
1244 MemberNames, not strings.
1246 * const.cs (Error_ExpressionMustBeConst):
1247 Rename from Error_EpressionMustBeConst.
1248 * const.cs, class.cs, statement.cd: Update.
1250 2005-07-21 Marek Safar <marek.safar@seznam.cz>
1254 * const.cs (Const.LookupConstantValue): Report missing contant expression
1256 (Error_EpressionMustBeConstant): Only one error method.
1258 * class.cs, statement.c: Updated.
1260 2005-07-20 Raja R Harinath <rharinath@novell.com>
1262 * statement.cs (Block.Flags): Add back HasVarargs.
1263 (Block.flags): Make protected.
1264 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
1266 * typemanager.cs (types, typecontainers, user_types): Remove.
1267 (UserTypes, TypeContainers): Likewise.
1268 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
1269 (CleanUp, Reset): Update.
1270 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
1271 (GetNestedType): Use Type.GetNestedType.
1272 (CoreLookupType): Take two arguments, the namespace and the
1273 basename of the type. Update to use the Namespace.Lookup
1275 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
1276 (RealMemberLookup): Use IsNestedChildOf instead of playing with
1277 string concatenation and substring matches.
1278 * class.cs, enum.cs, delegate.cs: Update to changes.
1280 2005-07-20 Marek Safar <marek.safar@seznam.cz>
1282 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
1283 Expression and made virtual.
1285 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
1286 (ImplicitStandardConversionExists): Fixed `byte' typo ?
1288 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
1290 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
1293 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
1296 2005-07-18 Marek Safar <marek.safar@seznam.cz>
1299 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
1300 AssemblyCultureAttribute is not used on executable.
1303 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
1305 2005-07-16 Raja R Harinath <rharinath@novell.com>
1308 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
1309 New. Reports CS0252/CS0253.
1310 Mostly taken from preliminary patch by Duncak Mak.
1311 (Binary.DoResolveOperator): Store results of operator lookup.
1312 Use them to detect if we need to warn about unintended reference
1315 2005-07-15 Raja R Harinath <rharinath@novell.com>
1318 * namespace.cs (Namespace.Lookup): Add back location parameter.
1319 (Namespace.LookupType): Add CS0436 report. Add location parameter.
1320 * delegate.cs, ecore.cs, expression.cs: Update to changes.
1322 * codegen.cs (EmitContext.DeclSpace): Make readonly.
1323 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
1324 (Namespace.LookupType): ... this.
1325 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
1327 * typemanager.cs (LookupTypeReflection): Remove buggy code that
1328 purported to handle pointers.
1329 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
1332 2005-07-15 Marek Safar <marek.safar@seznam.cz>
1334 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
1337 2005-07-15 Raja R Harinath <rharinath@novell.com>
1339 * namespace.cs (Namespace.Lookup): Drop location parameter.
1340 (NamespaceEntry.LookupAlias): Remove. Merge into ...
1341 (NamespaceEntry.Lookup): ... this.
1342 (NamespaceEntry.Error_AmbiguousTypeReference):
1343 Move here from DeclSpace.
1344 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
1346 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
1347 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
1348 Move to NamespaceEntry.
1349 * delegate.cs, expression.cs: Update to changes.
1351 2005-07-14 Marek Safar <marek.safar@seznam.cz>
1353 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
1354 CheckAttributeType and refactored.
1355 (Attribute.ResolvePossibleAttributeType): Changed to reuse
1356 ResolveAsTypeTerminal error handling.
1357 (ResolveAsTypeTerminal): Introduced because of global attributes extra
1359 (GetSignatureForError): Print errors in same way.
1362 * codegen.cs: Reflect attribute GetSignatureForError change.
1365 * expression.cs: Add silent parameter to ResolveAsTypeStep.
1367 * namespace.cs (UsingEntry): Refactored to make fields private.
1370 statement.cs: Error_UnexpectedKind has extra parameter.
1372 2005-07-14 Raja R Harinath <rharinath@novell.com>
1374 * ecore.cs (IAlias): Remove.
1375 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
1376 that implement the interface.
1377 * namespace.cs (Namespace): Likewise.
1378 (Namespace.declspaces): Renamed from 'defined_names'.
1379 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
1380 DeclSpace instead of an IAlias.
1381 * tree.cs (Tree.AddDecl): Update.
1383 2005-07-12 Raja R Harinath <rharinath@novell.com>
1385 * statement.cs (Block.Flags); Remove HasVarargs.
1386 (Block.HasVarargs): Move to ToplevelBlock.
1387 (Block.ThisVariable, Block.AddThisVariable): Likewise.
1388 (Block.Variables): Make protected. Initialize variable hashtable
1390 (Block.AddVariable): Update.
1391 (Block.Resolve): Update to changes.
1392 (ToplevelBlock.HasVarargs): New boolean.
1393 (ToplevelBlock.ThisVariable): Move here from Block.
1394 (ToplevelBlock.AddThisVariable): Likewise.
1395 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
1396 * expression.cs (This.ResolveBase): Update to changes.
1397 (ArglistAccess.DoResolve): Likewise.
1399 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1402 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
1404 * class.cs (TypeContainer.VerifyMembers): Distinguish between
1405 not used and not used & assigned.
1406 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
1408 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1411 * expression.cs (Is.DoResolve): null is never provided type.
1413 2005-07-08 Marek Safar <marek.safar@seznam.cz>
1416 * cs-parser.jay: Less strict event error rule to catch more errors.
1418 2005-07-08 Martin Baulig <martin@ximian.com>
1420 Fix test-iter-10.cs - distinguish whether we `yield' in a property
1421 gettter (allowed) or setter (not allowed).
1423 * class.cs (Accessor): Implement IIteratorContainer.
1424 (Accessor.Yields): New public field.
1425 (PropertyBase.PropertyMethod.Define): Handle iterators on a
1429 (get_accessor_declaration, set_accessor_declaration): Set the
1430 `yields' flag on the accessor, not the property.
1431 (property_declaration): Do the iterators check on a per-accessor
1432 basis and not for the whole property.
1434 2005-07-08 Martin Baulig <martin@ximian.com>
1436 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
1437 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
1439 2005-07-07 Marek Safar <marek.safar@seznam.cz>
1442 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
1443 (ExtractSecurityPermissionSet): Cope with self referencing security
1444 attributes properly.
1446 * driver.cs (SetOutputFile): Made public property OutputFile.
1448 2005-07-07 Raja R Harinath <rharinath@novell.com>
1451 * class.cs (TypeContainer.first_nonstatic_field): Rename from
1452 has_nonstatic_fields. Make into a FieldBase pointer.
1453 (TypeContainer.AddField): Add CS0282 check.
1454 (TypeContainer.EmitType): Update.
1456 2005-07-06 Miguel de Icaza <miguel@novell.com>
1458 * cs-tokenizer.cs (consume_identifier): Do not create strings to
1459 compare if they start with __.
1461 2005-07-06 Raja R Harinath <rharinath@novell.com>
1463 * statement.cs (Switch.SwitchGoverningType): Only look at
1464 UserCasts that don't need implicit standard conversions to one of
1465 the allowed switch types (Fixes test-322.cs).
1466 (LocalInfo.Resolve): Re-enable sanity-test.
1468 2005-07-06 Marek Safar <marek.safar@seznam.cz>
1470 * cs-tokenizer.cs (consume_identifier): Detect double undescores
1472 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
1474 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
1476 2005-07-06 Raja R Harinath <rharinath@novell.com>
1479 * ecore.cs (SimpleName.GetSignatureForError): Add.
1480 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
1481 (MemberAccess.GetSignatureForError): Add.
1483 2005-07-05 Marek Safar <marek.safar@seznam.cz>
1485 The big error and warning messages review.
1515 * typemanager.cs: Updated.
1517 * class.cs: (MethodCore.SetYields): Moved here to share.
1518 (PropertyMethod.Define): Moved iterator setup here.
1520 * iterators.cs: Add orig_method to have full access to parent
1523 2005-07-05 Raja R Harinath <rharinath@novell.com>
1525 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
1526 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
1527 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
1528 variable of struct type.
1529 * expression.cs (Unary.ResolveOperator): Update to change.
1530 (Indirection.VerifyFixed): Likewise.
1531 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
1532 (ParameterReference.VerifyFixed): Value parameters are fixed.
1533 (This.VerifyFixed): Treat 'this' as a value parameter.
1534 * statement.cs (LocalInfo.IsFixed): Remove.
1536 2005-07-01 Martin Baulig <martin@ximian.com>
1538 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
1539 `ec.EmitThis ()' to get the correct scope.
1541 2005-07-01 Martin Baulig <martin@ximian.com>
1543 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
1544 instance is a ParameterReference; fixes #75299.
1546 2005-07-01 Martin Baulig <martin@ximian.com>
1548 Reverted Marek's latest patch (r46725):
1549 - it contains structural changes which are neither mentioned in
1550 the ChangeLog nor explained anywhere; for example the additional
1551 argument of EmitContext's and Iterator's .ctor's and the
1552 TypeContainer.DefineMembers() change.
1553 - structural changes like this should go in in seperate patches
1554 and not be hidden in a huge patch which just seems to affect
1555 warnings and errors.
1556 a big and hard to understand patch.
1557 - it breaks iterators and causes regressions, for instance in
1560 2005-06-30 Raja R Harinath <rharinath@novell.com>
1563 * expression.cs (Indexers.map): Remove.
1564 (Indexers.Append): Filter out inaccessible setters and getters.
1565 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
1568 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
1570 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
1571 (FieldExpr.Emit, PropertyExpr.Emit): Update.
1572 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
1573 * expression.cs (Invocation.EmitCall): Add CS0120 check.
1575 2005-06-30 Marek Safar <marek.safar@seznam.cz>
1578 * class.cs (FieldBase.GetInitializerExpression): One more field
1581 2005-06-28 Miguel de Icaza <miguel@novell.com>
1583 * pending.cs: Do not define a proxy if the base method is virtual,
1584 it will be picked up by the runtime (bug 75270).
1586 2005-06-08 Martin Baulig <martin@ximian.com>
1588 The big Iterators rewrite :-)
1590 * iterators.cs: Rewrite this to use the anonymous methods framework.
1592 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
1593 before the TypeContainers; see 2test-21.cs.
1596 (TypeContainer.DefineType): Don't create a new EmitContext if we
1597 already have one (this only happens if we're an Iterator).
1598 (TypeContainer.Define): Also call Define() on all our iterators.
1599 (Method.CreateEmitContext): Added support for iterators.
1602 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
1603 (AnonymousContainer.CreateMethodHost): Moved here from
1604 AnonymousMethod and made abstract.
1605 (AnonymousContainer.CreateScopeType): New abstract method.
1606 (AnonymousContainer.IsIterator): New public property.
1607 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
1608 get the ScopeTypeBuilder rather than manually defining it here.
1609 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
1612 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
1613 before RootContext.DefineTypes().
1615 * codegen.cs (EmitContext.RemapToProxy): Removed.
1616 (EmitContext.CurrentAnonymousMethod): Changed type from
1617 AnonymousMethod -> AnonymousContainer.
1618 (EmitContext.ResolveTopBlock): Protect from being called twice.
1619 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
1620 (EmitContext.EmitThis): Removed the iterators hacks; use the
1621 anonymous methods framework for that.
1624 (ToplevelBlock.Container): Make this a property, not a field.
1625 (ToplevelBlock.ReParent): New public method; move the
1626 ToplevelBlock into a new container.
1627 (Foreach.TemporaryVariable): Simplify.
1629 2005-06-05 Martin Baulig <martin@ximian.com>
1631 * statement.cs (LocalInfo.CompilerGenerated): New flag.
1632 (Block.AddTemporaryVariable): New public method; creates a new
1633 `LocalInfo' for a temporary variable.
1634 (Block.EmitMeta): Create the LocalBuilders for all the temporary
1636 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
1637 non-iterator variables.
1639 2005-06-05 Martin Baulig <martin@ximian.com>
1641 * statement.cs (Foreach.TemporaryVariable): Create the
1642 LocalBuilder in the Emit phase and not in Resolve since in some
1643 situations, we don't have an ILGenerator during Resolve; see
1644 2test-19.cs for an example.
1646 2005-06-04 Martin Baulig <martin@ximian.com>
1648 **** Merged r45395 from GCS ****
1650 The big Foreach rewrite - Part II.
1652 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
1653 with `PropertyInfo ienumerator_getcurrent'.
1655 * codegen.cs (VariableStorage): Removed.
1658 (Foreach): Derive from Statement, not ExceptionStatement.
1659 (Foreach.CollectionForeach): New nested class. Moved all the code
1660 dealing with collection foreach here.
1661 (Foreach.ForeachHelperMethods): Removed.
1662 (Foreach.TemporaryVariable): Implement IMemoryLocation.
1664 2005-05-23 Martin Baulig <martin@ximian.com>
1666 * statement.cs (Try.DoResolve): Don't create a `finally' if we
1667 don't need to. Fix #75014.
1669 2005-05-20 Martin Baulig <martin@ximian.com>
1671 Merged r44808 from GMCS.
1673 * class.cs (TypeContainer.CircularDepException): Removed.
1674 (TypeContainer.DefineType): Removed the `InTransit' stuff.
1675 (TypeContainer.CheckRecursiveDefinition): Check for circular class
1676 (CS0146) and interface (CS0529) dependencies here.
1678 2005-06-21 Raja R Harinath <rharinath@novell.com>
1680 * expression.cs (Invocation.EmitCall): Fix initialization
1681 'this_call' to reflect current behaviour. Fix indentation.
1683 * convert.cs (FindMostEncompassedType): Add two trivial special
1684 cases (number_of_types == 0 || number_of_types == 1).
1685 (FindMostEncompasingType): Likewise.
1687 2005-06-17 Raja R Harinath <rharinath@novell.com>
1689 Some cleanups preparing for the fix of #75283.
1690 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
1692 (EventExpr.InstanceResolve): Likewise.
1693 (EventExpr.DoResolve): Remove redundant checks.
1695 2005-06-10 Duncan Mak <duncan@novell.com>
1697 * cs-tokenizer.cs (process_directives): New flag for controlling
1698 the processing of preprocessor directives.
1699 (x_token): After seeing a '#', return Token.NONE instead of going
1700 to handle_preprocessing_directive() when not processing
1701 directives. This avoids unnecessary processing during the token peek in
1706 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
1707 the existing error reporting methods instead of Report.Error.
1709 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
1710 after Raja's rewrite.
1712 2005-06-08 Miguel de Icaza <miguel@novell.com>
1714 * class.cs: Small fix.
1716 2005-06-08 Raja R Harinath <rharinath@novell.com>
1719 * class.cs (GetPartialBases): Fix return value check of
1722 2005-06-07 Raja R Harinath <rharinath@novell.com>
1724 Ensure that partial classes are registered in their enclosing
1725 namespace. Initial part of fix of #75160.
1726 * tree.cs (Tree.RecordDecl): Add new namespace argument.
1727 Register declspace with namespace here, not in
1728 DeclSpace.RecordDecl.
1729 * cs-parser.jay: Pass namespace to RecordDecl.
1730 * class.cs (PartialContainer.Create): Likewise.
1731 (ClassPart.DefineType): New sanity-check. Throws an exception if
1733 * decl.cs (Declspace.RecordDecl): Remove.
1734 * namespace.cs (NamespaceEntry.DefineName): Remove.
1736 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1738 * rootcontext.cs: Reset TargetExt as well.
1740 2005-06-03 Raja R Harinath <rharinath@novell.com>
1742 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1745 2005-06-02 Raja R Harinath <rharinath@novell.com>
1747 Fix #75080, cs0119.cs.
1748 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1750 (Expression.Resolve): ... this. Use it. Remove bogus code
1751 allowing ExprClass.Type and ExprClass.Namespace for
1752 ResolveFlags.VariableOrValue.
1753 (Expression.Resolve) [1-argument variant]: Change default resolve
1754 flags based on language version.
1755 (Expression.Error_UnexpectedKind): Use a simple string array
1756 rather than an ArrayList.
1757 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1759 (TypeOfVoid.DoResolve): Likewise.
1760 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1761 flags argument -- it always has the same value.
1763 2005-05-31 Raja R Harinath <rharinath@novell.com>
1766 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1767 Use it in the error message.
1768 * assign.cs, expression.cs, statement.cs: Update.
1770 2005-05-30 Raja R Harinath <rharinath@novell.com>
1773 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1774 the "almostMatchedMember" case too.
1775 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1776 that failed the accessibility checks to 'almost_match'.
1778 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1780 * attribute.cs: Use internal MethodBuilder methods to set
1781 ExactSpelling and SetLastError on PInvoke methods, instead
1782 of passing them via charset. Fixes #75060.
1784 2005-05-27 Raja R Harinath <rharinath@novell.com>
1786 * parameter.cs (Parameter): Remove TODO comment.
1787 (Parameter.DefineParameter): Remove Location parameter.
1788 (Parameters.LabelParameters): Likewise.
1789 * class.cs (Constructor.Emit): Update to change.
1790 (MethodData.Emit): Likewise.
1791 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1792 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1794 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1797 Removed Parameters.Location and added Parameter.Location instead.
1798 Removed Location parameter from Emit() and GetSignature().
1805 Modified all related calls.
1807 2005-05-26 Raja R Harinath <rharinath@novell.com>
1809 Improve user-defined conversion handling.
1810 * convert.cs (GetConversionOperators): Rewrite. Return only the
1811 applicable operators.
1812 (AddConversionOperators): New. Helper for GetConversionOperators.
1813 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1814 there is only one most encompassed/encompassing type.
1815 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1816 "applicable operator" handling.
1817 (UserConversion): Move cache here from GetConversionOperators.
1818 Directly cache the chosen operator, rather than the whole
1820 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1821 case. Allow conversion of decimal to sbyte and byte too.
1822 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1823 New static methods. Used to avoid allocating EmptyExpressions in
1826 2005-05-24 Duncan Mak <duncan@novell.com>
1828 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1829 another class, used in Convert.ExplicitNumericConversion.
1830 (CastToDecimal): New class, similar to above, but casts to
1831 System.Decimal, used in Convert.ImplicitNumericConversion and also
1832 in explicit convesion from double/float to decimal.
1834 * convert.cs (ImplicitNumericConversion): Handle implicit
1835 conversions to System.Decimal.
1836 (ExplicitNumericConversion): handle explicit conversions to
1841 2005-05-20 Miguel de Icaza <miguel@novell.com>
1843 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1844 know the type at this stage, just break through. Fixes #75008
1846 2005-05-19 Martin Baulig <martin@ximian.com>
1849 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1850 to disable error reporting.
1852 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1853 here since we don't want to report an error; see the new test-336.cs.
1855 2005-05-19 Raja R Harinath <rharinath@novell.com>
1857 * statement.cs (ToplevelBlock.GetParameterReference)
1858 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1859 Move here from class Block.
1860 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1861 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1863 2005-05-18 Martin Baulig <martin@ximian.com>
1868 (FlowBranching.Reachability): Add non-static public And() and Or()
1870 (FlowBranchingSwitch): New class; do the `break_origins' thing
1871 like in FlowBranchingLoop.
1872 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1873 reachability, not just locals and parameters.
1874 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1875 switch; MergeBreakOrigins() now takes care of that.
1877 2005-05-18 Martin Baulig <martin@ximian.com>
1879 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1880 a loop and may leave it, reset the barrier; fixes #74974.
1882 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1884 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1887 * cs-parser.jay: Catch more lexical errors.
1889 * report.cs: Add one more Error method.
1892 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1894 2005-05-17 Martin Baulig <martin@ximian.com>
1896 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1899 2005-05-16 Raja R Harinath <rharinath@novell.com>
1901 Fix test-382.cs. Emit values of decimal constants.
1902 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1904 (TypeContainer.AddField): ... this.
1905 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1906 with initializers to include 'Const's.
1907 (ClassPart.RegisterFieldForInitialization): Forward to
1909 * const.cs (Const.Const): Pass initializer to base class.
1910 (Const.Define): In case of decimal constants, register them for
1911 initialization in a static constructor.
1913 2005-05-14 Martin Baulig <martin@ximian.com>
1915 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1916 do not call ResolveUnreachable() on unreachable statements in
1917 here, see the comment in the source code.
1919 2005-05-13 Raja R Harinath <rharinath@novell.com>
1922 * expression.cs (BinaryResolveOperator): If one of the operands of
1923 an equality comparison is 'null' and the other is a pointer type,
1924 convert the null to a NullPointer.
1925 * convert.cs (ImplicitReferenceConversion): If the expression is a
1926 NullLiteral and the target type is a pointer type, return a
1927 NullPointer instead.
1928 (ImplicitConversionStandard): Likewise.
1930 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1932 * cs-parser.jay: Set readonly context based on special constructs.
1934 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1935 readonly variable error handling.
1937 * rootcontext.cs (EmitCode): Don't verify members when error
1940 * statement.cs (LocalInfo): Add reaodnly context information.
1941 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1943 2005-05-13 Raja R Harinath <rharinath@novell.com>
1945 * statement.cs (Block.Resolve): Revert change below. Modify fix
1946 for #74041 to initialize 'resolved' to false only for explicit
1947 blocks. Fixes #74873.
1949 2005-05-12 Raja R Harinath <harinath@gmail.com>
1952 * typemanager.cs (unmanaged_enclosing_types): New.
1953 (IsUnmanagedType): Avoid infloops by using
1954 'unmanaged_enclosing_types' to talk with recursive invocations.
1956 2005-05-13 Martin Baulig <martin@ximian.com>
1958 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
1959 instance variable, not a local. Fix #74873.
1960 (Block.ResolveUnreachable): Set it to true here.
1962 2005-05-11 Duncan Mak <duncan@novell.com>
1964 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
1965 continuing to process for 'arg'.
1966 (handle_preprocessing_directive): Check the argument of the #endif
1967 directive and report error CS1025 if there are any trailing
1970 According to the C# spec, having even whitespace after the #endif
1971 directive is illegal; however, because we call arg.TrimEnd ()
1972 beforehand, we have the same behavior as csc, allowing whitespace
1973 after the directive.
1977 2005-05-11 Marek Safar <marek.safar@seznam.cz>
1981 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
1982 (Constructor.GetObsoleteAttribute): Implemented correctly.
1984 2005-05-10 Martin Baulig <martin@ximian.com>
1986 * support.cs (ReflectionParameters.ParameterModifier): Use
1987 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
1988 and `ParameterAttributes.In'. Fixes #74884.
1990 2005-05-10 Marek Safar <marek.safar@seznam.cz>
1992 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
1994 * expression.cs (Argument.GetParameterModifier): Turned to property.
1995 (Invocation.Error_InvalidArguments): Add more descriptive errors.
1997 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
2000 2005-05-09 Raja R Harinath <rharinath@novell.com>
2003 * decl.cs (MemberCache.AddMethods): Register override methods,
2004 rather than non-override methods.
2005 * typemanager.cs (RegisterOverride): New.
2006 (IsOverride): Update.
2008 2005-05-09 Marek Safar <marek.safar@seznam.cz>
2012 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
2013 recursive declaration.
2015 * statement.cs (Block.ResolveMeta): Report any error in resolving.
2017 2005-05-06 Marek Safar <marek.safar@seznam.cz>
2019 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
2021 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
2023 2005-05-05 Raja R Harinath <rharinath@novell.com>
2026 * decl.cs (DeclSpace.FamilyAccessible):
2027 Use TypeManager.IsNestedFamilyAccessible.
2029 Fix reopened #64812.
2030 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
2033 2005-05-04 Raja R Harinath <rharinath@novell.com>
2034 Abin Thomas <projectmonokochi@rediffmail.com>
2035 Anoob V E <projectmonokochi@rediffmail.com>
2036 Harilal P R <projectmonokochi@rediffmail.com>
2039 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
2040 allow access to all static members.
2042 2005-05-04 Martin Baulig <martin@ximian.com>
2044 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
2046 2005-05-04 Martin Baulig <martin@ximian.com>
2050 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
2051 section at the end; make things work if `default' is not the last
2054 2005-05-04 Martin Baulig <martin@ximian.com>
2058 * statement.cs (Switch): Replaced the `got_default' field with a
2059 `default_section' one.
2060 (Switch.CheckSwitch): Set `default_section' here.
2061 (Switch.Resolve): If we're a constant switch and the constant is
2062 not found, use the default section.
2064 2005-05-03 Martin Baulig <martin@ximian.com>
2066 * expression.cs (ArrayAccess.EmitGetLength): New public method.
2068 * statement.cs (Foreach.ArrayForeach): New nested class.
2069 (Foreach.TemporaryVariable): New nested class.
2070 (Foreach.EmitArrayForeach): Removed; this is now in the new
2073 2005-05-03 Raja R Harinath <rharinath@novell.com>
2075 * pending.cs (BaseImplements): Move the #74773 fix here. This is
2077 (VerifyPendingMethods): Revert change below.
2079 * typemanager.cs (IsOverride, RegisterNonOverride): New.
2080 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
2081 that used to trigger warning -28. Remove warning -28.
2082 * expression.cs (Invocation.OverloadResolve): Use
2083 TypeManager.IsOverride to distinguish override methods.
2086 * pending.cs (VerifyPendingMethods): If a base type implements the
2087 requested interface, don't bother checking individual methods of
2088 the base type. As a side-effect, this prevents the creation of
2089 unnecessary proxies.
2091 2005-05-02 Martin Baulig <martin@ximian.com>
2095 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2096 Also `And' the locals if the old vector is null.
2097 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
2098 null; in this case we basically reset all the variables.
2100 2005-05-02 Martin Baulig <martin@ximian.com>
2104 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
2105 Added `FlowBranching branching' argument; always `and' the
2106 variables instead of `or'ing them unless we're an infinite loop.
2108 * statement.cs (While.Resolve): Create a new sibling unless we're
2111 2005-05-02 Martin Baulig <martin@ximian.com>
2115 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
2116 arguments; use it instead of creating a new TopLevelBlock.
2117 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
2118 our ConstructorInitializer.
2121 (TopLevelBlock.TopLevelBranching): New public property.
2122 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
2123 and create our `TopLevelBranching'.
2125 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
2126 anonymous method host, use `block.TopLevelBranching' rather than
2127 creating a new branching.
2129 2005-04-20 Miguel de Icaza <miguel@novell.com>
2131 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
2132 a ScopeInfo, if any of the current children is a child of the new
2133 entry, move those children there.
2135 2005-04-30 Martin Baulig <martin@ximian.com>
2137 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
2138 at the beginning of a SwitchSection. Fix #73335.
2140 2005-04-27 Marek Safar <marek.safar@seznam.cz>
2143 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
2145 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
2146 (FieldExpr.DoResolve): Obsolete members are ignored for field
2149 2005-04-26 Marek Safar <marek.safar@seznam.cz>
2151 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
2152 of arrays detection.
2154 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
2156 (Field.VerifyClsCompliance): Volatile fields are not compliant.
2158 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
2161 2005-04-25 Ben Maurer <bmaurer@ximian.com>
2163 * cs-parser.jay: Use the prefered version of -unsafe in error
2166 2005-04-22 Marek Safar <marek.safar@seznam.cz>
2168 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
2171 2005-04-20 John Luke <john.luke@gmail.com>
2173 * driver.cs: fix typo in error message, --outout to --output
2175 2005-04-20 Marek Safar <marek.safar@seznam.cz>
2177 * codegen.cs (InRefOutArgumentResolving): New field.
2179 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
2180 fields outside contructor.
2182 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
2184 2005-04-19 Miguel de Icaza <miguel@novell.com>
2186 * anonymous.cs (CaptureContext.EmitParameterInstance): The
2187 parameter code was not completed ever, so it was not as up-to-date
2188 as local variables. Must finish it.
2190 The bug fix was to compare the Toplevel of the block, not the
2191 current block. Thanks for Ben for pointing this out.
2193 2005-04-19 Raja R Harinath <rharinath@novell.com>
2195 * decl.cs (AddMethods): Use the declaring type of the problem
2196 method to determine if we want to squash a warning.
2198 2005-04-19 Marek Safar <marek.safar@seznam.cz>
2200 * attribute.cs: Removed debug output.
2202 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
2204 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
2207 2005-04-18 Raja R Harinath <rharinath@novell.com>
2210 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
2211 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
2212 all null comparisons against reference types.
2214 2005-04-18 Marek Safar <marek.safar@seznam.cz>
2217 * class.cs (TypeContainer.CircularDepException) New nested
2219 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
2220 (TypeContainer.DefineType): Removed error, reset InTransit before
2222 (Class.DefineType): Throw exception when is in Transit.
2223 Catch exception and report error.
2224 (Struct.DefineType): Throw exception when is in Transit.
2225 Catch exception and report error.
2226 (Interface.DefineType): Throw exception when is in Transit.
2227 Catch exception and report error.
2229 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
2230 handle nested exception handlers.
2232 * flowanalysis.cs (InTryWithCatch): New method, search for try with
2235 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
2236 InFinally and InCatch storage.
2238 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
2239 (Catch.Resolve): Set and Restore ec.InCatch.
2240 (Try.Resolve): Set and Restore ec.InFinally.
2241 (Try.HasCatch): True when try has catch.
2243 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
2245 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
2246 for the same event member, so exclude such cases from warning 419.
2249 2005-04-16 Miguel de Icaza <miguel@novell.com>
2251 * expression.cs (Binary.ResolveOperator): Apply patch from John
2252 Luke to fix bug 59864: operators &, | and ^ on enumerations
2253 require that the same enum type on both sides.
2255 * driver.cs: Add warnings to old flag usage, this is to assist
2256 people who produce Makefiles and hope that the Makefiles will be
2259 * class.cs (TypeContainer.EmitType): Moved the definition of the
2260 special $PRIVATE$ field from the resolve phase to the Emit phase.
2261 During resolve we do not know if we are a struct with
2262 HasExplicitLayout, we know this only after the attributes for the
2265 Set the FieldOffset to zero on the dummy field that we create for
2266 the class. Fixes 74590.
2268 2005-04-16 Raja R Harinath <rharinath@novell.com>
2271 * ecore.cs (PropertyExpr.resolved): New.
2272 (DoResolve): Use it to handle a case of double resolution here.
2273 Handle a case of identical-name-and-type-name.
2274 * expression.cs (ArrayCreation.CheckIndices): Avoid double
2275 resolution by storing the results of expression resolution back
2276 into the "probes" array.
2278 2005-04-15 Raja R Harinath <rharinath@novell.com>
2280 Fix cs0208-7.cs and cs0208-8.cs.
2281 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
2282 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
2283 error reporting to point out the reason a struct is not unmanaged.
2285 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2287 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
2288 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
2290 2005-04-13 Raja R Harinath <rharinath@novell.com>
2293 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
2294 IdenticalNameAndTypeName here.
2295 (EventExpr.InstanceResolve): Likewise.
2297 2005-04-13 Marek Safar <marek.safar@seznam.cz>
2299 C# 2.0 DefaultCharSetAttribute implementation
2301 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
2302 which allows us to set GlobalNamespace for every resolve.
2303 (Attribute.ResolveArguments): Cut from Resolve.
2304 (Attribute.GetCharSetValue): Returns CharSet named argument.
2305 (Attribute.DefinePInvokeMethod): Gets default charset from
2307 (GlobalAttribute.ResolveAsTypeStep): Override.
2308 (GlobalAttribute.ResolveArguments): Override.
2310 * class.cs (TypeAttr): Is protected.
2312 * codegen.cs (ModuleClass.DefaultCharSet): New member.
2313 (ModuleClass.DefaultCharSetType): New memeber.
2314 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
2316 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
2317 charset from module.
2319 * delegate.cs (TypeAttr): Override.
2320 (Delegate.DefineType): Use this TypeAttr.
2322 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
2323 at very early stage (before types are defined) to resolve model
2324 module attributes. It will probably not work with corlib but it
2327 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
2328 charset from module.
2330 * typemanager.cs (default_charset_type): New type.
2332 2005-04-13 Raja R Harinath <rharinath@novell.com>
2334 * decl.cs (MemberCache.AddMethods): Don't warn if
2335 System.Object.Finalize has buggy MethodAttributes.
2337 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
2340 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2342 * doc.cs : detect ambiguous reference to overloaded members.
2343 Fixed bug #71603. MS 1.1 csc does not detect it.
2345 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2347 * doc.cs : delegates must not be referenced with parameters.
2350 2005-04-12 Miguel de Icaza <miguel@novell.com>
2352 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
2354 2005-04-10 Miguel de Icaza <miguel@novell.com>
2356 * driver.cs (MainDriver): Stop processing if the CLS stage found
2359 (CompilerCallableEntryPoint.InvokeCompiler): Always
2360 reset after execution; Take a TextWriter argument for the
2363 * report.cs: Use the error stream instead of hardcoding stderr.
2365 2005-04-09 Miguel de Icaza <miguel@novell.com>
2367 * class.cs: Reduce code paths to test, too small of an
2368 optimization to make it worth the extra testing. Always perform
2371 2005-04-08 Raja R Harinath <rharinath@novell.com>
2374 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
2375 operators that had errors reported on them.
2377 2005-04-08 Marek Safar <marek.safar@seznam.cz>
2379 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
2381 (Attribute.Resolve): Add named argument type checking.
2383 * class.cs (FixedField.Define): Use IsPrimitiveType
2385 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
2387 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
2388 unsafe parameter types.
2390 * statement.cs (Using.ResolveExpression): Add better error description.
2392 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
2394 2005-04-08 Raja R Harinath <rharinath@novell.com>
2397 * attribute.cs (Attribute.GetAttributeUsage): Resolve
2398 AttributeUsageAttribute in the emitcontext of the attribute class,
2399 not in the emitcontext of the attributable entity it was attached to.
2400 * cs-parser.jay: Use 'current_class', not 'current_container',
2401 when creating a GlobalAttribute.
2403 2005-04-08 Alp Toker <alp@atoker.com>
2405 * pending.cs: The fix to #58413 failed to compile methods implementing
2406 interfaces with/without params modifiers and vice versa, even though
2407 params modifiers aren't part of the signature. Make the modifier check
2408 less strict as in csc.
2410 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
2411 Anoob V E <projectmonokochi@rediffmail.com>
2412 Harilal P R <projectmonokochi@rediffmail.com>
2415 * pending.cs (TypeAndMethods.mods): New. Store the parameter
2416 modifiers of pending methods.
2417 (PendingImplementation.PendingImplementation): Initialize it.
2418 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
2419 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
2420 with ParameterData. Add check for modifiers.
2421 * class.cs (MethodData.Define): Update to changes.
2423 2005-04-07 Raja R Harinath <rharinath@novell.com>
2425 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
2427 2005-04-07 Marek Safar <marek.safar@seznam.cz>
2429 * class.cs (PropertyMethod.Define): Check private accessor in abstract
2432 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
2435 * typemanager.cs: Registered RequiredAttributeAttribute.
2437 2005-04-06 Marek Safar <marek.safar@seznam.cz>
2439 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
2440 Warning CS0169 is back at level 3.
2441 (IMethodData.SetMemberIsUsed): New method.
2443 * decl.cs (IsUsed): New value; moved from FieldBase.Status
2444 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
2446 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
2448 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
2450 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
2453 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
2456 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
2457 to avoid the problems with nested types.
2459 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
2460 Anoob V.E <projectmonokochi@rediffmail.com>
2461 Harilal P.R <projectmonokochi@rediffmail.com>
2462 Raja R Harinath <rharinath@novell.com>
2465 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
2467 * typemanager (GetConstructor): Make public.
2469 2005-04-05 John Luke <john.luke@gmail.com>
2470 Raja R Harinath <rharinath@novell.com>
2473 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
2474 struct too. Return false quicker in a few cases.
2475 (VerifyUnManaged): Use it.
2477 2005-04-05 Raja R Harinath <rharinath@novell.com>
2480 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
2481 not 'unreachable_seen'.
2483 2005-04-04 Marek Safar <marek.safar@seznam.cz>
2485 * attribute.cs (Attribute.GetValue): Removed unused.
2487 * codegen.cs (CodeGen.TrimExt): Removed unused.
2489 * cs-parser.jay (output): Removed unused.
2491 * cs-tokenizer.cs (hex_digits): Removed unused.
2493 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
2495 * expression.cs (Indirection.LoadExprValue): Removed unused.
2496 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
2498 * iterators.cs (Iterator.param_types): Removed unused.
2500 * statement.cs (Goto.block): Removed unused.
2501 (ToplevelBlock.did): Removed unused.
2502 (Switch.ResolveConstantSwitch): Removed unused.
2504 2005-04-01 Ben Maurer <bmaurer@ximian.com>
2506 * rootcontext.cs: Allow mcs to bootstrap with the compilation
2509 2005-04-01 Raja R Harinath <rharinath@novell.com>
2511 Fix #74232 and cs0208-3.cs.
2512 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
2513 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
2514 unmanaged type. Don't use FieldBuilders when 't' is a
2515 TypeBuilder. Use ModFlags and MemberType fields.
2516 * class.cs (MemberBase.member_type): Rename from MemberType.
2517 (MemberBase.MemberType): New property. Determines member_type on
2519 (MemberBase.DoDefine): Don't initialize MemberType here.
2520 (FieldMember.Define): Likewise.
2522 2005-04-01 Marek Safar <marek.safar@seznam.cz>
2525 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
2526 Attributes are emitted there.
2528 2005-04-01 Raja R Harinath <rharinath@novell.com>
2530 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
2531 keyword in 'partial enum' too.
2532 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
2534 Report from Kamil Skalski <nazgul@omega.pl>.
2537 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
2538 have partial containers too.
2540 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
2541 in block' checks to Block.CheckInvariantMeaningInBlock.
2542 * statement.cs (Block.GetKnownVariableInfo): Make private.
2543 (Block.IsVariableUsedInChildBlock): Remove.
2544 (Block.IsVariableUsedInBlock): Likewise.
2545 (Block.CheckInvariantMeaningInBlock): New. Show location of
2546 conflicting declaration.
2547 (Block.AddVariable): Make error messages less long-winded and more
2548 specific. Show location of conflicting declaration.
2549 * parameter.cs (Parameters.Location): New readonly property.
2551 2005-03-31 Raja R Harinath <rharinath@novell.com>
2553 Clean up semantics of invoking ResolveMemberAccess.
2554 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
2555 can have an instance, ensure that we pass in a non-TypeExpression
2556 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
2557 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
2558 argument. Update to changes and simplify.
2559 (FieldExpr.Emitinstance): Remove CS0120 check.
2560 (PropertyExpr.EmitInstance): Likewise.
2561 * expression.cs (Argument.Resolve): Likewise.
2562 (Invocation.DoResolve): Update to changes in semantics of
2565 2005-03-31 Marek Safar <marek.safar@seznam.cz>
2568 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
2571 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
2573 2005-03-31 Raja R Harinath <rharinath@novell.com>
2575 Fix difference in behaviour with commandline invocation.
2576 * driver.cs (Driver.Reset): New.
2577 (CompilerCallableEntryPoint): Call it.
2579 * statement.cs (If.Resolve): Avoid spurious "uninitialized
2580 variable" warnings if the boolean expression failed to resolve.
2582 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
2584 * attribute.cs: Fix the union of several permissions when some of them
2585 are unrestricted (so the result isn't an unrestricted permission set).
2588 2005-03-30 Raja R Harinath <rharinath@novell.com>
2590 * ecore.cs (MemberExpr): New class. Convert from interface
2592 (MemberExpr.ResolveMemberAccess): Refactor and move here from
2593 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
2595 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
2596 (MethodGroupExpr.IsExplicitImpl): Remove.
2597 (Expression.GetFieldFromEvent): Remove.
2598 (SimpleName.MemberStaticCheck): Remove.
2599 (SimpleName.DoSimpleNameResolve): Update to changes.
2600 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
2601 (MemberAccess.IdenticalNameAndTypeName): Remove.
2602 (MemberAccess.error176): Move to MemberExpr.
2603 (MemberAccess.DoResolve): Update to changes.
2604 (BaseAccess.DoResolve): Likewise.
2606 2005-03-30 Marek Safar <marek.safar@seznam.cz>
2608 C# 2.0 Conditional attribute class implementation
2610 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
2611 Analyzes class whether it has attribute which has ConditionalAttribute
2612 and its condition is not defined.
2614 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
2615 (Class.IsExcluded): New method. Search for at least one defined
2616 condition in ConditionalAttribute of attribute class.
2618 2005-03-30 Raja R Harinath <rharinath@novell.com>
2620 * ecore.cs (PropertyExpr): Derive from Expression, not
2621 ExpressionStatement.
2622 (PropertyExpr.EmitStatement): Remove.
2624 2005-03-29 Raja R Harinath <rharinath@novell.com>
2627 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
2628 internal field "value__" of an enum be private. The examples for
2629 "value__" that I found on MSDN all used FieldAttributes.Private.
2631 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
2632 Don't mention IL method attribute names.
2634 Fix #47991. Remove a TODO.
2635 * statement.cs (Block.Toplevel): Make into a field.
2636 (Block.Parameters): Move into ToplevelBlock.
2637 (Block.known_variables): Rename from child_variable_names.
2638 (Block.Block): Remove variants that take Parameters. Initialize
2639 'Toplevel' with the immediately surrounding toplevel block.
2640 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
2641 LocalInfo parameter.
2642 (Block.GetKnownVariableInfo): New.
2643 (Block.IsVariableNameUsedInChildBlock): Update.
2644 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
2645 the block, even though it may not be in scope.
2646 (Block.AddVariable): Remove Parameters parameter. Use
2647 Toplevel.Parameters instead.
2648 (Block.AddConstant): Remove Parameters parameter.
2649 (Block.GetParameterReference): Update to use Toplevel.Parameters.
2650 (Block.IsParamaterReference): Likewise.
2651 (Block.IsLocalParameter): Likewise. Simplify a lot.
2652 (ToplevelBlock.Parameters): New. Moved from Block.
2653 (ToplevelBlock.ToplevelBlock): Update to changes. Always
2654 initialize Parameters to a non-null value.
2655 * cs-parser.jay: Update to changes.
2656 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
2657 simple names that mean different things in the same block. Use
2658 Block.IsVariableNameUsedInBlock.
2660 2005-03-28 Raja R Harinath <rharinath@novell.com>
2662 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2663 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2664 GetTypeHandle. It is possible for a reflected type to derive from
2665 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2666 System.Array during mscorlib compilation).
2667 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2668 contain a method_hash, don't create one either. Don't create a
2669 deep copy of the base cache's method_hash.
2670 (MemberCache.SetupCache): Rename back from DeepCopy.
2671 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2672 already initialized. If we see an override function, add its
2673 underlying base virtual function to the member_hash too.
2675 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
2677 2005-03-26 Raja R Harinath <harinath@acm.org>
2680 * assign.cs (Assign.DoResolve): When the RHS of an assignment
2681 fails to resolve, ensure that the LHS is still resolved as an
2684 2005-03-25 Raja R Harinath <harinath@acm.org>
2686 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
2688 (Enum.current_ec): Remove.
2689 (Enum.LookupEnumValue): Remove EmitContext argument.
2690 Just uses the one created during DefineType.
2691 (Enum.FindMembers): Update.
2692 * expression.cs (MemberAccess.DoResolve): Update.
2694 2005-03-22 Marek Safar <marek.safar@seznam.cz>
2696 * assign.cs (Assign.DoResolve): Check for CS1717 when
2697 source and target are same (uses Equals).
2699 * expression.cs (LocalVariableReference, ParameterReference,
2700 This): Implemented Equals, GetHashCode.
2702 * statement.cs (Block.GetParameterReference): Removed useless
2705 2005-03-22 Raja R Harinath <rharinath@novell.com>
2708 * statement.cs (Block.AddVariable): Ensure that we skip implicit
2709 blocks before deciding whether the error is cs0136 or cs0128.
2711 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
2712 (using_alias_directive, using_namespace_directive): Pass
2713 MemberName, not an expression to Namespace.UsingAlias and
2715 (MakeName): Use the MemberName of the namespace.
2716 * namespace.cs (Namespace.MemberName): New.
2717 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
2718 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
2720 * decl.cs (MemberName.Name): Make readonly.
2721 (MemberName.FromDotted): New "constructor".
2722 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
2723 (MemberCore.Name): Compute from MemberName on demand.
2724 (MemberCore.SetMemberName): Provide a way to change the
2726 (MemberCore.AddToContainer): Don't take a fullname parameter.
2727 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
2728 fully qualified name of the container to the member name.
2729 (TypeContainer.AddToTypeContainer): Use a fully qualified name
2730 only if the type is a member of the root container.
2731 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
2732 MemberName.Left rather than searching for an embedded ".".
2733 (PartialContainer.CreatePart): Update to changes in RootContext.
2734 (MemberBase.ShortName): Turn into a property. Use
2735 MemberCore.SetMemberName.
2736 (MemberBase.ExplicitInterfaceName): Remove.
2737 (MemberBase.UpdateMemberName): Remove.
2738 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2739 (PropertyBase.SetMemberName): New override.
2740 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2741 (Tree.GetDecl): New.
2742 (Tree.AllDecls): Rename from Decls.
2743 * attribute.cs, enum.cs, report.cs: Update to changes.
2744 * driver.cs (MainDriver): Use MemberName.FromDotted on
2745 RootContext.MainClass.
2747 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2749 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2752 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2754 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2756 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2757 property accessor modifiers.
2759 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2760 fixed buffer attribute (CS1716).
2761 (PropertyMethod.HasCustomAccessModifier): When property accessor
2762 has custom modifier.
2764 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2766 (PropertyExpr.DoResolveLValue): Add CS0272.
2768 2005-03-17 Miguel de Icaza <miguel@novell.com>
2770 * convert.cs: When converting to a pointer, use the proper Conv.U
2771 or Conv.I depending on the source data type.
2773 * cs-tokenizer.cs: Make the size for large decimal constants,
2776 2005-03-17 Martin Baulig <martin@ximian.com>
2778 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2779 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2781 2005-03-17 Martin Baulig <martin@ximian.com>
2783 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2784 to bool so we can return an error condition.
2785 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2788 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2790 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2793 2005-03-16 Raja R Harinath <rharinath@novell.com>
2795 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2796 Refactor to avoid traversing the list of assemblies, and to avoid
2797 string concatenation.
2798 * typemanager.cs (guid_attr_type): Remove.
2799 (negative_hits, pointers, references): Remove hashes.
2801 (GetConstructedType): New. Uses type_hash to handle constructed
2802 types (arrays, references, pointers).
2803 (GetReferenceType, GetPointerType): Use it.
2804 (GetNestedType): New. Uses type_hash to handle nested types of
2806 (LookupType, LookupTypeDirect): Remove.
2807 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2808 'types' hash and LookupTypeReflection directly.
2809 (params_string, params_object): Use GetConstructedType.
2810 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2812 (Namespace.Lookup): Use cached_types.
2813 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2814 provided by old TypeManager.LookupType.
2815 * rootcontext.cs (MakeFQN): Remove.
2816 * decl.cs (DeclSpace.MakeFQN): Likewise.
2817 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2818 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2819 TypeManager.GetConstructedType.
2820 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2822 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2824 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2827 * cs-parser.jay: Reports CS1527 for any namespace element.
2829 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2832 * expression.cs (ParameterReference.IsAssigned): Changed error to
2834 (Error_WrongNumArguments): Moved CS0245 detection here.
2836 * statement.cs (Return.Resolve): Add CS1622 report.
2838 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2840 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2842 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2844 * attribute.cs expression.cs: Get rid of some allocations.
2846 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2848 * doc.cs : just eliminate the latest change.
2850 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2852 * doc.cs : commented out the latest change. It breaks xml-030.cs
2854 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2856 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2857 fail. So invoke CreateType() in FindDocumentedType().
2859 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2861 * cs-tokenizer.cs : added IsKeyword().
2862 * doc.cs : Detect keyword incorrectly used as identifier.
2863 Allow identifiers prefixed by @.
2865 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2867 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2868 It caused exception in namespace resolving (again!).
2870 * class.cs (Class.ctor): Removed exit.
2871 (PropertyMethod.ctor): ditto.
2873 * codegen.cs (Codegen.Reset): Reset static data.
2874 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2876 * cs-tokenizer.cs (Cleanup): Removed.
2878 * driver.cs (GetSystemDir): Rewrote to one line command.
2879 It caused problem with unloaded dynamic modules.
2880 (UnixParseOption): Removed Exit.
2881 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2882 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2883 Now can be mcs used as library.
2885 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2888 * location.cs (Reset): Reset static data.
2890 * namespace.cs (Reset): Reset static data.
2892 * report.cs (Report.Reset): Reset static data.
2894 * rootcontext.cs (RootContext.Reset): Reset static data.
2896 * tree.cs (RootTypes.ctor): Use Location.Null
2898 * typemanager.cs (TypeManager.Reset): Reset static data.
2899 (CoreLookupType): Removed Exit.
2900 (TypeHandle.Reset): Reset static data.
2902 2005-03-10 Raja R Harinath <rharinath@novell.com>
2905 * typemanager.cs (ComputeNamespaces): Import namespaces from
2906 referenced modules too.
2908 2005-03-09 Raja R Harinath <rharinath@novell.com>
2910 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2913 2005-03-09 Raja R Harinath <rharinath@novell.com>
2915 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2916 enclosing DeclSpace. This ensures that a name-lookup populates
2917 more caches and there are fewer 'TypeExpression's. Carve out
2918 nested type lookup into ...
2919 (LookupNestedTypeInHierarchy): ... this.
2921 2005-03-09 Raja R Harinath <rharinath@novell.com>
2923 Clean up a few partial-class semantics.
2924 Fixes test-357.cs and cs1618-2.cs.
2925 * cs-parser.jay (struct_declaration): Use 'current_class' as
2926 parent of newly-created struct. Remove call to Register ().
2927 Use 'pop_current_class' to complete handing the current struct.
2928 (interface_declaration): Likewise.
2929 (class_declaration): Likewise.
2930 (enum_declaration): Use 'current_class' as parent of newly created
2932 (delegate_declaration): Likewise.
2933 (pop_current_class): New function. This is used to handle closing
2934 up the 'current_class' and 'current_container', and pointing them
2935 to the enclosing class/container.
2936 (CSharpParser): Initialize 'current_class' too.
2937 * decl.cs (MemberCore): Add check for invariant: a partial
2938 container is not a parsed entity, and thus does not enclose any
2940 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2941 (DeclSpace.BaseTypeExpr): Use it.
2942 (DeclSpace.LookupType): Add check for invariant.
2943 * class.cs (TypeContainer): Add check for invariant: a nested
2944 class should have the same NamespaceEntry as its enclosing class.
2945 (TypeContainer.EmitFieldInitializers): Make virtual.
2946 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2948 (TypeContainer.Register): Remove.
2949 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2950 null. Use TypeResolveEmitContext for resolving base types and
2951 interfaces. Move initialization of Parts.TypeBuilder here from
2953 (TypeContainer.DefineNestedTypes): ... here.
2954 (PartialContainer): Take a Namespace not a NamespaceEntry.
2955 (PartialContainer.Create): Don't use Register. Call the
2956 appropriate Add... function directly.
2957 (ClassPart): Take both the PartialContainer and the enclosing
2958 class as constructor arguments.
2959 (ClassPart.EmitFieldInitializers): Override.
2960 (ClassPart.PartFindNestedTypes): Remove.
2961 (FieldBase.GetInitializerExpression): Resolve the initializer
2962 expression in the emit context of the enclosing class.
2963 * tree.cs (RootTypes): Remove Register ().
2965 2005-03-08 Marek Safar <marek.safar@seznam.cz>
2967 * cs-parser.jay: Removed CS0134.
2969 * driver.cs: Removed CS1901.
2971 * expression.cs (SizeOf.DoResolve): Don't report CS0233
2972 for predefined types.
2974 2005-03-07 Duncan Mak <duncan@novell.com>
2976 * codegen.cs (Save): Catch UnauthorizedAccessException as
2977 well. Fixes bug #73454.
2979 2005-03-07 Marek Safar <marek.safar@seznam.cz>
2981 * cs-tokenizer.cs (xtoken): Add CS1035.
2983 * class.cs (MethodData.Define): Add CS0683.
2984 (FieldMember.ctor): Add CS0681.
2986 2005-03-07 Raja R Harinath <rharinath@novell.com>
2988 * ecore.cs (SimpleName.DoResolve): Rename from
2989 SimpleName.DoResolveAllowStatic.
2990 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
2991 Pass 'intermediate' flag to MemberStaticCheck.
2992 (SimpleName.MemberStaticCheck): Skip "static check" only in case
2993 of "intermediate" lookups via MemberAccess.
2994 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
2995 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
2997 2005-03-07 Raja R Harinath <rharinath@novell.com>
3000 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
3001 slipped in because of variable names that are identical to a
3002 builtin type's BCL equivalent ('string String;', 'int Int32;').
3003 (PropertyExpr.EmitInstance): Likewise.
3005 2005-03-04 Marek Safar <marek.safar@seznam.cz>
3007 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
3009 * report.cs (warning_ignore_table): Made public.
3011 2005-03-04 Raja R Harinath <rharinath@novell.com>
3014 * class.cs (MethodData.Emit): Pass 'container' to
3015 container.GetObsoleteAttribute instead of 'container.Parent'.
3017 2005-03-03 Marek Safar <marek.safar@seznam.cz>
3019 * cs-parser.jay: Add 1534 error test.
3021 * iterators.cs (Yield.CheckContext): Add error 1629.
3022 (Iterator.ctor): Save unsafe modifier.
3023 (MoveNextMethod.DoEmit): Restore unsafe context.
3025 * namespace.cs (UsingAlias): Better error message.
3027 2005-03-03 Dan Winship <danw@novell.com>
3029 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
3030 the warning message [#73219]
3032 2005-03-03 Raja R Harinath <rharinath@novell.com>
3034 Fix compile with MCS 1.0.0.0.
3035 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
3036 w_restore to not depend on string constant folding.
3038 2005-03-03 Raja R Harinath <rharinath@novell.com>
3040 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
3041 CS0246 check to users who passed 'silent = false'.
3042 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
3044 (SimpleName.SimpleNameResolve): Update.
3045 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
3046 (MemberAccess.IdenticalNameAndTypeName): Update.
3047 * doc.cs (FindDocumentedTypeNonArray): Update.
3049 2005-03-03 Raja R Harinath <rharinath@novell.com>
3051 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
3052 * parameters.cs (ComputeAndDefineParameters): Remove.
3053 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
3054 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
3055 Use GetParameterInfo.
3057 2005-03-02 Marek Safar <marek.safar@seznam.cz>
3059 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
3061 2005-03-02 Raja R Harinath <rharinath@novell.com>
3063 Unify DeclSpace.LookupType and DeclSpace.FindType.
3064 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
3065 is in charge of defining nested types on demand.
3066 (DeclSpace.LookupType): Use it when the current_type is a
3067 TypeBuilder. Use LookupTypeDirect for reflected types.
3068 (DeclSpace.FindType): Remove.
3069 (DeclSpace.LookupInterfaceOrClass): Likewise.
3070 (DeclSpace.DefineTypeAndParents): Likewise.
3071 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
3072 DeclSpace.LookupType.
3073 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
3074 * typemanager.cs (LookupType): Simplify.
3075 (AddUserType): Remove type from negative_hits.
3076 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
3077 * class.cs (TypeContainer.FindMembers): Move handling of nested
3079 (TypeContainer.FindMembers_NestedTypes): ... here.
3080 (TypeContainer.FindNestedType): Implement override.
3081 (ClassPart.FindNestedType): Delegate to PartialContainer.
3082 (ClassPart.PartFindNestedType): Looks up the nested types of the
3085 2005-03-02 Martin Baulig <martin@ximian.com>
3087 * class.cs (TypeContainer.DoDefineMembers): We also need a default
3088 static constructor in static classes.
3090 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
3092 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
3093 sizeParamIndex is not specified.
3095 2005-03-01 Marek Safar <marek.safar@seznam.cz>
3098 * report.cs (WarningMessage.IsEnabled): Missing null check.
3100 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3102 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
3103 in the fields and not in the properties.
3105 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
3107 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
3110 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3112 * attribute.cs: Small refactoring (improved robustness).
3113 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
3114 (ValidateGuid): Removed.
3115 (Resolve): Removed referenced to above mentioned.
3116 (GetAttributeUsage): Made private and changed to work without
3118 (GetIndexerAttributeValue): Don't crash.
3119 (GetConditionalAttributeValue): Ditto.
3120 (GetClsCompliantAttributeValue): Ditto.
3121 (ExtractSecurityPermissionSet): All attributes exceptions are
3123 (GetPropertyValue): New helper.
3124 (GetMethodImplOptions): New method.
3125 (DefinePInvokeMethod): Reuse common code. Implemented handling of
3126 some missing properties.
3128 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
3129 (Method.ApplyAttributeBuilder): Updated.
3131 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
3134 2005-02-28 Raja R Harinath <rharinath@novell.com>
3137 * report.cs (Report.SymbolRelatedToPreviousError): Handle
3138 non-simple types (array, pointer, reference).
3140 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3142 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
3144 * class.cs (MethodCore.IsDuplicateImplementation): Special error
3146 (Method.CheckBase): Catch wrong destructor here.
3147 (MethodData.Define): Add errors 550, 668.
3149 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
3151 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
3153 * pending.cs (VerifyPendingMethods): Add error 551.
3155 * typemanager.cs (CSharpName): Next error report helper.
3157 2005-02-25 Marek Safar <marek.safar@seznam.cz>
3159 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
3160 attributes. Removed useless attribute double check.
3161 It saves almost 2MBs for corlib.
3163 2005-02-25 Raja R Harinath <rharinath@novell.com>
3166 * statement.cs (ExpressionStatement.Resolve): Make robust to being
3167 called twice in case of error.
3169 2005-02-23 Chris Toshok <toshok@ximian.com>
3171 Fix compiler portions of #72827.
3172 * statement.cs (Block.Emit): call Begin/EndScope on the
3173 EmitContext instead of the ILGenerator.
3175 * codegen.cs (EmitContext.BeginScope): new method, call
3176 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
3178 (EmitContext.BeginScope): same, but EndScope and CloseScope
3180 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
3181 offset and call the superclass's OpenScope(int) with it.
3182 (SymbolWriter.CloseScope): get the current il
3183 offset and call superclass's CloseScope(int) with it.
3185 2005-02-23 Marek Safar <marek.safar@seznam.cz>
3187 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
3188 CS1677 for out and ref as well.
3190 * class.cs (Method.Define): Add error CS1599 detection.
3192 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
3194 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
3196 * delegate.cs (Delegate.Define): Add error CS1599 detection.
3198 * support.cs.cs (ModifierDesc): New helper method.
3200 2005-02-23 Raja R Harinath <rharinath@novell.com>
3201 Abin Thomas <projectmonokochi@rediffmail.com>
3202 Anoob V E <projectmonokochi@rediffmail.com>
3203 Harilal P R <projectmonokochi@rediffmail.com>
3206 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
3207 MemberLookup (used for error reporting) actually returns a result.
3208 Fix error report number (122, not 112).
3210 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
3211 Anoob V E <projectmonokochi@rediffmail.com>
3212 Harilal P R <projectmonokochi@rediffmail.com>
3215 * pending.cs (PendingImplementation.GetAbstractMethods):
3216 Find NonPublic members too.
3218 2005-02-22 Marek Safar <marek.safar@seznam.cz>
3220 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
3223 * class.cs (MethodCore.CheckMethodAgainstBase):
3224 Add error 239 report.
3226 2005-02-21 Raja R Harinath <rharinath@novell.com>
3229 * expression.cs (Invocation.IsApplicable): Make public.
3230 (Invocation.IsParamsMethodApplicable): Likewise.
3231 * delegate.cs (Delegate.VerifyApplicability): Don't use
3232 Invocation.VerifyArgumentCompat for parameter applicability
3233 testing. Use Invocation.IsApplicable and
3234 Invocation.IsParamsMethodApplicable.
3236 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3238 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
3240 * class.cs (Operator.Define): Add error 217 report.
3242 2005-02-21 Raja R Harinath <rharinath@novell.com>
3244 * namespace.cs (UsingEntry.Resolve): Undo change below.
3246 2005-02-21 Raja R Harinath <rharinath@novell.com>
3249 * ecore.cs (Expression.MemberLookupFailed): Add argument to
3250 disable the error message when the extended MemberLookup also
3252 (Expression.MemberLookupFinal): Update.
3253 (SimpleName.DoSimpleNameResolve): Update.
3254 * expression.cs (MemberAccess.ResolveNamespaceOrType):
3255 Don't use MemberLookupFinal.
3256 (New.DoResolve): Update.
3257 (BaseAccess.CommonResolve): Update.
3259 2005-02-21 Raja R Harinath <rharinath@novell.com>
3262 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
3263 occured previously, don't resolve again.
3265 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3268 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
3269 argument. Call ResolveAttributeUsage for unresolved.
3270 when types doesn't match ctor arguments.
3272 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
3273 for nested attribute classes.
3274 (Class.attribute_usage): Removed.
3275 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
3276 for attribute class.
3278 * ecore.cs (IsAttribute): Removed.
3280 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
3282 * rootcontext.cs (RegisterAttribute): Removed, attributes are
3284 (attribute_types): Removed.
3285 (EmitCode): Global attributes are emited as the latest.
3287 2005-02-18 Marek Safar <marek.safar@seznam.cz>
3289 * class.cs (EmitFieldInitializers): Don't emit field initializer
3290 for default values when optimilization is on.
3292 * constant.cs (Constant.IsDefaultValue): New property.
3294 * driver.cs: Add /optimize handling.
3298 * literal.cs: Implement new IsDefaultValue property.
3300 * rootcontext.cs (Optimize): New field, holds /optimize option.
3302 2005-02-18 Raja R Harinath <rharinath@novell.com>
3304 Fix crasher in re-opened #72347.
3305 * namespace.cs (Namespace.Lookup): Return null if
3306 DeclSpace.DefineType returns null.
3309 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
3311 2005-02-18 Raja R Harinath <rharinath@novell.com>
3313 Fix remainder of #63202. Change semantics of DoResolveLValue: it
3314 now returns null if it cannot resolve to an lvalue.
3315 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
3316 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
3317 returned null. Remove check for SimpleName.
3318 (EventExpr.DoResolveLValue): New.
3319 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
3320 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
3322 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
3324 (Unary.ResolveOperator): Move CS0211 check ...
3325 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
3327 (Unary.DoResolveLValue): Simplify.
3328 (AddressOf.DoResolveLValue): New.
3329 (ArrayAccess.DoResolveLValue): New.
3331 2005-02-16 Marek Safar <marek.safar@seznam.cz>
3333 * attribute.cs (Attribute.Resolve): Add arguments casting for
3334 when types doesn't match ctor arguments.
3336 2005-02-16 Raja R Harinath <rharinath@novell.com>
3338 Fix parts of #63202.
3339 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
3340 lookup of operator in base type. Ensure that all checks happen
3341 when the operator resolves to an "op_..." method.
3343 2005-02-15 Raja R Harinath <rharinath@novell.com>
3346 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
3347 'ignore_cs0104' parameter. Pass it to ...
3348 (NamespaceEntry.Lookup): ... this.
3349 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
3350 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
3351 (TypeLookupExpression.DoResolveAsTypeStep): Update.
3352 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
3353 Update. Request that cs0104 errors be ignored.
3354 (ComposedCast.ResolveAsTypeStep): Update.
3356 2005-02-14 Raja R Harinath <rharinath@novell.com>
3359 * expression.cs (Invocation.BetterFunction): Remove support for
3360 comparing virtual functions and their overrides.
3361 (Invocation.IsOverride): New.
3362 (Invocation.OverloadResolve): Don't consider 'override' functions
3363 during candidate selection. Store them in a lookaside list.
3364 If the selected method is a 'virtual' function, use the list to
3365 find any overrides that are closer to the LHS type.
3367 2005-02-14 Marek Safar <marek.safar@seznam.cz>
3369 * expression.cs (New.DoResolve): Add complex core type reduction.
3370 (New.Constantify): Converts complex core type syntax like 'new int ()'
3373 2005-02-14 Raja R Harinath <rharinath@novell.com>
3375 * decl.cs (EntryType.EntryType): New constructor to create an
3376 updated copy of a cache entry.
3377 (MemberCache.AddMethods): Use it.
3378 (MemberCache.ClearDeclaredOnly): Remove.
3379 (MemberCache.MemberCache): Update.
3381 2005-02-11 Miguel de Icaza <miguel@novell.com>
3383 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
3384 variable. This one is represents the actual low-level declaration
3385 of the method, as opposed to the semantic level `IsStatic'.
3387 An anonymous method which is hosted into a static method might be
3388 actually an instance method. IsStatic would reflect the
3389 container, while MethodIsStatic represents the actual code
3392 * expression.cs (ParameterReference): Use the new MethodIsStatic
3393 instead of IsStatic.
3395 * anonymous.cs (AnonymousMethod.Compatible): Pass the
3396 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
3397 set on the current EmitContext.
3399 * expression.cs (Cast): Overload DoResolveLValue so we can pass
3400 resolve our casted expression as an LValue. This triggers the
3401 proper LValue processing that is later required by Assign.
3405 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
3407 2005-02-11 Marek Safar <marek.safar@seznam.cz>
3409 C# 2.0 Fixed buffer implementation
3411 * anonymous.cs: Update after RegisterHelperClass renaming.
3413 * attribute.cs (AttributeTester.fixed_buffer_cache):
3414 Cache of external fixed buffers.
3415 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
3416 implementation if field is fixed buffer else null.
3419 (TypeContainer.AddField): Accept FieldMember instead of Field.
3420 (FieldBase.IsFieldClsCompliant): Extracted code from
3421 VerifyClsCompliance descendant customization.
3422 (FixedField): New class handles fixed buffer fields.
3423 (FixedFieldExternal): Keeps information about imported fixed
3425 (IFixedField): Make access to internal or external fixed buffer
3428 * cs-parser.jay: Add fixed buffer parsing.
3430 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
3433 * expression.cs (Indirection): Extended implementation to accept
3435 (PointerArithmetic.Emit): Get element from fixed buffer as well.
3436 (ElementAccess.MakePointerAccess): Get type as parameter.
3437 (DoResolve): Add fixed buffer field expression conversion.
3438 (DoResolveLValue): Ditto.
3439 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
3440 (ArrayPtr): Derives from FixedBufferPtr.
3441 (ArrayPtr.Emit): Add extra emit for array elements.
3443 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
3445 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
3446 for compiler generated types.
3447 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
3449 * statement.cs (Fixed): Refactored to be easier add fixed buffer
3450 and consume less memory.
3451 (Fixed.Resolve): Add fixed buffer case.
3453 * typemanager.cs (compiler_generated_attr_ctor,
3454 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
3455 (HasElementType): Add our own implementation to work on every
3458 2005-02-11 Miguel de Icaza <miguel@novell.com>
3460 * anonymous.cs (CaptureContext): Track whether `this' has been
3463 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
3464 only captured `this' if it was implicitly done (instance
3465 methods/variables were used).
3467 * codegen.cs (EmitContext.CaptureThis): New method to flag that
3468 `this' must be captured.
3470 2005-01-30 Miguel de Icaza <miguel@novell.com>
3472 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
3473 is null it means that there has been no need to capture anything,
3474 so we just create a sibling.
3476 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
3478 Just a partial fix. The other half is fairly elusive.
3480 2005-02-10 Raja R Harinath <rharinath@novell.com>
3482 Fix #52586, cs0121-4.cs.
3483 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
3484 and return a hashtable.
3485 (MemberCache.ClearDeclaredOnly): New.
3486 (MemberCache.MemberCache): Update to change. Make a deep copy of
3487 the method_hash of a base type too.
3488 (MemberCache.AddMethods): Adapt to having a deep copy of the base
3489 type methods. Overwrite entries with the same MethodHandle so
3490 that the ReflectedType is correct. The process leaves in base
3491 virtual functions and their overrides as distinct entries.
3492 (CacheEntry): Now a class instead of a struct. It shouldn't alter
3493 matters since it was boxed in a ArrayList before.
3494 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
3496 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
3497 case of a virtual function and its override (choose the overload
3499 (Invocation.OverloadResolve): Avoid 'override' members during
3500 'applicable_type' calculation.
3502 2005-02-09 Raja R Harinath <rharinath@novell.com>
3504 Combine two near-redundant caches.
3505 * typemanager.cs (method_params): Rename from method_internal_params.
3506 (TypeManager.GetParameterData): New. Replace
3507 Invocation.GetParameterData.
3508 (TypeManager.LookupParametersByBuilder): Remove.
3509 * expression.cs (Invocation.method_parameter_cache): Remove.
3510 (Invocation.GetParameterData): Remove.
3512 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
3515 2005-02-08 Raja R Harinath <rharinath@novell.com>
3518 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
3519 TypeManager.multicast_delegate_type is null, resolve it by looking
3520 up "System.MulticastDelegate".
3521 * rootcontext.cs (RootContext.ResolveCore): Simplify.
3523 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
3524 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
3525 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
3528 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
3529 (LabeledStatement.AddReference): New. Set 'referenced'.
3530 (Goto.Resolve): Use it.
3532 2005-02-05 John Luke <john.luke@gmail.com>
3534 * driver.cs: remove duplicate -doc line in Usage ()
3536 2005-02-04 Raja R Harinath <rharinath@novell.com>
3538 * location.cs (Location.AddFile): Fix CS2002 error report.
3540 2005-02-02 Martin Baulig <martin@ximian.com>
3542 * delegate.cs (Delegate.DefineType): Report an internal error if
3543 TypeManager.multicast_delegate_type is null. See bug #72015 for
3546 2005-02-02 Raja R Harinath <rharinath@novell.com>
3548 Fix a crasher in a variant of #31984.
3549 * const.cs (Constant.CheckBase): New override that defers the
3550 new-or-override check in case the base type hasn't been populated
3552 (Constant.Define): Ensure the new-or-override check is performed.
3554 2005-02-01 Duncan Mak <duncan@ximian.com>
3556 * const.cs (LookupConstantValue): Check that `ce' is not null
3557 before calling GetValue ().
3559 2005-02-01 Raja R Harinath <rharinath@novell.com>
3561 Fix test-334.cs (#69519).
3562 * cs-parser.jay (using_alias_directive): Pass in an expression to
3563 NamespaceEntry.UsingAlias.
3564 (using_namespace_directive): Pass in an expression to
3565 NamespaceEntry.Using.
3566 (namespace_name): Don't flatten to a string.
3567 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
3568 (NamespaceEntry.AliasEntry.Resolve): Lookup using
3570 (NamespaceEntry.UsingEntry): Likewise.
3571 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
3573 (NamespaceEntry.LookupForUsing): Remove.
3574 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
3576 (NamespaceEntry.Lookup): Remove support for dotted names.
3578 2005-02-01 Raja R Harinath <rharinath@novell.com>
3580 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
3582 (NamespaceEntry.ImplicitParent): Compute on demand.
3583 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
3584 parallels the current.
3585 (NamespaceEntry.LookupForUsing): Use it.
3586 (NamespaceEntry.Lookup): If the current namespace-entry is
3587 implicit, don't search aliases and using tables.
3589 2005-02-01 Raja R Harinath <rharinath@novell.com>
3592 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
3594 (TypeContainer.BaseCache): Compute on demand.
3595 (TypeContainer.FindMembers): Define constants and types if they're
3596 not already created.
3597 (FieldMember.Define): Move resetting of ec.InUnsafe before error
3599 * const.cs (Constant.Define): Make idempotent.
3601 2005-01-29 Miguel de Icaza <miguel@novell.com>
3603 * pending.cs: Produce better code (no nops produced by using Ldarg
3606 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
3607 i - 1' it should be arg + 1.
3611 2005-01-28 Raja R Harinath <rharinath@novell.com>
3613 * attribute.cs (Attribute.CheckAttributeType): Make private
3615 (Attribute.ResolveType): Make virtual.
3616 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
3617 handling of RootContext.Tree.Types.
3619 2005-01-27 Raja R Harinath <rharinath@novell.com>
3621 Update attribute-handling to use the SimpleName/MemberAccess
3623 * cs-parser.jay (attribute): Pass in an expression to the
3624 constructors of Attribute and GlobalAttribute.
3625 * attribute.cs (Attribute): Take an expression for the name.
3626 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
3627 passed in attribute name expression.
3628 (Attribute.CheckAttributeType): Use it.
3629 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
3630 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
3631 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
3632 argument to prevent error messages if the lookup fails.
3634 2005-01-27 Marek Safar <marek.safar@seznam.cz>
3636 * expression.cs (Indirection): Implemented IVariable interface
3637 to support indirection in AddressOf operator.
3638 (PointerArithmetic.Emit): Add optimalization for case where
3639 result can be precomputed.
3641 2005-01-26 Martin Baulig <martin@ximian.com>
3643 * class.cs (TypeContainer.AttributeTargets): Return the correct
3644 AttributeTargets depending on our `Kind' instead of throwing an
3645 exception; fixes #71632.
3647 2005-01-26 Marek Safar <marek.safar@seznam.cz>
3650 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
3653 2005-01-25 Raja R Harinath <rharinath@novell.com>
3656 * expression.cs (MemberAccess.DoResolve): Don't complain with
3657 cs0572 when the LHS of a member access has identical name and type
3660 2005-01-25 Marek Safar <marek.safar@seznam.cz>
3663 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
3665 Create custom PermissionSet only for PermissionSetAttribute.
3667 2005-01-24 Marek Safar <marek.safar@seznam.cz>
3670 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
3671 delegates in static class.
3673 2005-01-24 Martin Baulig <martin@ximian.com>
3675 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3676 merging an implicit block, just use its reachability.
3678 * statement.cs (Block.Resolve): Make the unreachable code check
3679 work wrt. implicit blocks; see test-337 from #63842.
3681 2005-01-21 Alp Toker <alp@atoker.com>
3683 * cs-parser.jay: destructor_declaration's container is PartialContainer
3684 not Class when partial types are used, so use Kind prop instead of
3687 2005-01-22 Miguel de Icaza <miguel@ximian.com>
3689 * cs-parser.jay: Improve error reporting when an interface
3692 2005-01-20 Dick Porter <dick@ximian.com>
3694 * support.cs: SeekableStreamReader fix from Sandor Dobos
3695 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
3696 chars are read. Fixes bug 70369.
3698 2005-01-20 Raja R Harinath <rharinath@novell.com>
3700 * cs-parser.jay (catch_clause): Simplify current_block handling
3703 2005-01-17 Miguel de Icaza <miguel@ximian.com>
3705 * convert.cs (ImplicitStandardConversionExists): Synchronize the
3706 code with ImplicitStandardConversion to handle the implicit
3707 conversion of method groups into valid delegate invocations.
3709 The problem is that in parameter handling we were using this code
3710 path. Fixes bug #64698
3712 2005-01-19 Raja R Harinath <rharinath@novell.com>
3714 * cs-parser.jay: Fix several infelicities.
3715 - Avoid assigning to the parser value stack. Code like
3716 '$3 = null' is unclean. Synthesize a value for the code block
3718 - Avoid using oob_stack for storing location information. Use ...
3719 (_mark_): ... this. New (empty) rule. Saves the current location
3721 (foreach_statement): Avoid using oob_stack for current_block
3722 handling. Use technique used in for_statement and
3723 using_statement. Synthesize a value for the code block to store
3724 additional intermediate information.
3726 2005-01-13 Miguel de Icaza <miguel@ximian.com>
3728 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
3729 of a different type is only allowed to private fields of a
3730 containing type, not on fields of a base class.
3732 See test-174.cs and error cs0122-9.cs
3734 2005-01-13 Raja R Harinath <rharinath@novell.com>
3736 Fix test-335.cs (bug #58126).
3737 * cs-parser.jay (argument): Split out non-expression parts of the
3738 rule into 'non_simple_argument'.
3739 (invocation_expression): Support parenthesized invocations with
3740 multiple arguments, and with single non-simple arguments.
3742 2005-01-13 Raja R Harinath <rharinath@novell.com>
3744 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3747 2005-01-12 Raja R Harinath <rharinath@novell.com>
3749 Fix cs0038-1.cs, cs1640-6.cs.
3750 * ecore.cs (Expression.Resolve): Remove special-case for
3751 SimpleName in error-handling.
3752 (Expression.almostMatchedMembers): Relax access permission to
3754 (Expression.MemberLookupFailed): Handle duplicates in
3755 almostMatchedMembers list.
3756 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3757 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3758 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3759 overload if the passed in MemberInfo is a MethodBase.
3761 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3764 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3765 for non-CAS & merge permission sets properly.
3767 2005-01-11 Raja R Harinath <rharinath@novell.com>
3769 Improve standard-compliance of simple name and member access
3770 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3771 * ecore.cs (FullNamedExpression): New abstract base class
3772 for Namespaces and TypeExpressions.
3773 (ResolveFlags.SimpleName): Remove.
3774 (SimpleName): Remove support for dotted names.
3775 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3776 DeclSpace.FindType and DeclSpace.LookupType.
3777 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3778 (Expression.ExprClassName): Make member function.
3779 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3780 a namespace. Remove creation of dotted "SimpleName"s.
3781 (MemberAccess.DoResolve): Likewise.
3782 * decl.cs (DeclSpace.Cache): Make private.
3783 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3784 (DeclSpace.FindType): Update.
3785 (DeclSpace.LookupType): Move here from RootContext. Return a
3786 FullNamedExpression.
3787 * namespace.cs (Namespace): Derive from FullNamedExpression
3788 so that it can be part of expression resolution.
3789 (Namespace.Lookup): Return an FullNamedExpression.
3790 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3792 * rootcontext.cs (NamespaceLookup): Remove.
3793 (LookupType): Move to DeclSpace.
3794 * attribute.cs (CheckAttributeType): Update.
3795 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3796 (FindDocumentedTypeNonArray): Likewise.
3798 2005-01-11 Raja R Harinath <rharinath@novell.com>
3800 Fix cs0509.cs, cs1632.cs.
3801 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3802 is the same as IsInterface.
3803 (TypeContainer.GetClassBases): Likewise.
3804 * statement.cs (LabeledStatement.ig): New field.
3805 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3807 (LabeledStatement.DoEmit): Check that the label was created with
3808 the same ILGenerator.
3810 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3813 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3814 accessors to its properties.
3816 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3817 from accessors to property.
3819 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3822 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3825 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3827 * attribute.cs: Check for null and empty strings.
3829 I have lost another battle to Paolo.
3831 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3834 * class.cs (PropertyMethod): Set Parent field in ctors.
3835 (SetMethod.InternalParameters): Add unsafe switch hack.
3836 Override MarkForDuplicationCheck where it is appropriate.
3838 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3839 It says whether container allows members with the same name.
3841 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3842 Removed is_method parameter.
3844 2005-01-06 Duncan Mak <duncan@ximian.com>
3846 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3847 because the previous change led to incorrect reporting of CS1032
3848 ("Cannot define/undefine preprocessor symbols after first token in
3849 file"). Instead of using `tokens_seen' as the only flag that
3850 triggers CS1040, introduce `comments_seen'. This new flag is used
3851 to signify having seen comments on the current line, so it is
3852 unset after a newline.
3854 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3856 * doc.cs : When searching for a type, find nested type too.
3857 This fixes bug #71040.
3859 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3862 - Warn missing member comment on those classes which also does not
3863 have doc comments. Fixed bug #71041.
3864 - Don't warn missing doc comment on default constructor.
3867 2005-01-06 Duncan Mak <duncan@ximian.com>
3869 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3870 comments, set `tokens_seen' to true. This allows us to detect
3871 misplaced preprocessor directives (i.e. not at the beginning of
3872 the a line, nor after whitespaces). In that case, report error
3873 CS1040. This fixes bug #56460.
3875 * cs-parser.jay (interface_member_declaration): Add checks for
3876 IsExplicitImpl, and report CS0541 error if an interface member is
3877 defined as an explicit interface declaration.
3879 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3882 * class.cs (PropertyMethod): Set Parent field in ctors.
3883 (SetMethod.InternalParameters): Add unsafe switch hack.
3885 * decl.cs (MemberCore.Parent): Cannot be readonly.
3887 2005-01-06 Raja R Harinath <rharinath@novell.com>
3889 * decl.cs (DeclSpace.ResolveType): Remove.
3890 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3891 Merge in code from ...
3892 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3893 * class.cs, enum.cs: Update to changes.
3895 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3897 * anonymous.cs: Ensure that we init the scope of our parent if it
3898 has not been initialized yet.
3900 2004-12-30 Duncan Mak <duncan@ximian.com>
3902 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3903 if field.FieldBuilder is null. Fixes #70758.
3905 * convert.cs: Fixed some typos and updated some of the comments.
3906 (ImplicitStandardConversionExists):
3907 (TryImplicitIntConversion): If `target_type' is an interface and
3908 the type of `ic' implements this interface, return true or a new
3909 BoxedCast instead of null. This fixes #70468.
3911 2004-12-29 Duncan Mak <duncan@ximian.com>
3913 * expression.cs (Argument.Emit): Check that Expr is
3914 IMemoryLocation before casting to it, and report CS1510 otherwise.
3918 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3920 * statement.cs (Block.ThisVariable): remove the recursion here, to
3921 make the --profile more sane.
3923 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3925 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3926 assembly, by JB Evain.
3928 2004-12-17 Raja R Harinath <rharinath@novell.com>
3930 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3931 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3932 "parent" refers to enclosing type/class. "base" refers to superclass.
3934 2004-12-17 Raja R Harinath <rharinath@novell.com>
3936 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3937 Ensure that we only have GlobalAttributes.
3938 * attribute.cs (Attribute.Emit): Make non-virtual.
3939 (GlobalAttribute.Emit): Remove.
3940 (Attribute.Resolve): Make virtual.
3941 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3942 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3943 the argument. Don't create one.
3944 (Attribute.GetObsoleteAttribute): Likewise.
3945 (Attribute.GetClsCompliantAttributeValue): Likewise.
3946 * class.cs, decl.cs: Update to changes.
3948 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3950 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3952 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3954 * statement.cs (Foreach.Resolve): Add error 186 report.
3956 2004-12-16 Marek Safar <marek.safar@seznam.cz>
3958 * expression.cs (Conditional.DoResolve): Add warning 429.
3960 * statement.cs (If.Resolve): Add warning 665.
3962 2004-12-16 Raja R Harinath <rharinath@novell.com>
3964 New invariant: RootContext.Tree.Types.NamespaceEntry == null
3965 except when in the parser, and in GlobalAttribute.
3966 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
3967 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
3968 RootContext.Tree.Types.NamespaceEntry once work is done.
3969 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
3970 and resets RootContext.Tree.Types.NamespaceEntry.
3972 2004-12-15 Marek Safar <marek.safar@seznam.cz>
3974 * cs-parser.jay: Don't create a block for every variable.
3976 2004-12-14 Miguel de Icaza <miguel@ximian.com>
3978 * location.cs: Provide extra information.
3980 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
3981 variables from the captured environment, it is the ldarg_0.
3983 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3985 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
3988 * class.cs: Changed warning level for 169 to avoid developer
3989 displeasure from warning flooding. It will be changed back when they
3990 fix most of current BCL warnings.
3992 * RootContext.cs: Pushed default WarningLevel to 3.
3994 * statement.cs: Removed unused variable.
3996 2004-12-14 Marek Safar <marek.safar@seznam.cz>
3998 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
3999 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
4000 Add error 502 report.
4001 (StaticClass.DefineType): Add error 441 report.
4002 (Class.AllowedModifiersProp): New virtual property as temporary
4003 extension to AllowedModifiers.
4004 (Class.DefineType): Add error 418 report. Moved ModFlags check here
4005 to share implementation with StaticClass and don't call virtual
4008 * driver.cs (MainDriver): Add error 1558 test.
4010 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
4011 report. Moved error 36 test here.
4013 * statement.cs (Throw.Resolve): Add error 724 report.
4015 * typemanager.cs: Add out_attribute_type core type.
4017 2004-12-13 Marek Safar <marek.safar@seznam.cz>
4019 * class.cs (TypeContainer.VerifyClsCompliance): Add error
4021 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
4023 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
4026 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
4028 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
4029 Add error 3023 report.
4030 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
4032 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
4035 2004-12-12 John Luke <john.luke@gmail.com>
4037 * driver.cs (AddArgs): take -- into account when
4038 adding arguments, fixes bug 65710
4040 2004-12-12 Martin Baulig <martin@ximian.com>
4042 * expression.cs (Unary.TryReduceNegative): Added support for
4043 SByteConstant and ByteConstant.
4044 (Unary.Reduce): Check error values from TryReduceNegative().
4046 2004-12-10 Marek Safar <marek.safar@seznam.cz>
4048 * attributes.cs (Attribute.Resolve): Avoid multiple error report
4049 and report exception as error 182.
4051 2004-12-10 Raja R Harinath <rharinath@novell.com>
4053 * driver.cs (Main): Fix message when there are warnings.
4055 2004-12-09 Miguel de Icaza <miguel@ximian.com>
4057 * delegate.cs: Fixed my fix from yesterday, sorry about that.
4059 2004-12-09 Marek Safar <marek.safar@seznam.cz>
4061 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
4062 Reduced number of warnings.
4064 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
4066 2004-12-08 Miguel de Icaza <miguel@ximian.com>
4068 * driver.cs: Removed message.
4070 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
4072 2004-12-08 <vargaz@freemail.hu>
4074 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
4076 2004-12-08 Martin Baulig <martin@ximian.com>
4078 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
4079 instead of a CS3002 for properties and indexer.
4081 2004-12-08 Martin Baulig <martin@ximian.com>
4083 * decl.cs (MemberName.ToString): Make this work again.
4085 2004-12-08 Marek Safar <marek.safar@seznam.cz>
4087 * attribute.cs (Resolve): Add error 591 detection.
4089 * class.cs (FieldMember.Define): Add error 1547 detection.
4090 (Indexer.Define): Add error 620 detection.
4091 (Operator.Define): Add error 590 detection.
4093 * ecore.cs: Missing argument for error 79.
4095 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
4098 2004-12-07 Marek Safar <marek.safar@seznam.cz>
4101 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
4104 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
4106 * cs-parser.jay : handle doc comments on implicit/explicit operators.
4107 Some operator comments were suppressed.
4108 * doc.cs : Implicit/explicit operator name in doc comments are like
4109 "op_Explicit(type)~returnType", so added suffix handling.
4111 2004-12-07 Martin Baulig <martin@ximian.com>
4114 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4115 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4116 (DeclSpace.ec): New protected field; store the EmitContext here.
4117 (DeclSpace.EmitContext): New public property; moved here from
4119 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4122 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4123 (Enum.Emit): Don't create a new EmitContext.
4125 * delegate.cs (Delegate.DefineType): Always create the
4128 * iterators.cs (Iterators.DefineIterator): Create a new
4129 EmitContext and store it in `ec'.
4131 2004-08-24 Martin Baulig <martin@ximian.com>
4134 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
4135 this for accessibility checks.
4136 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
4137 IsNestedFamilyAccessible.
4138 (TypeManager.IsSubclassOf): New method, do what the name actually
4141 2004-12-06 Raja R Harinath <rharinath@novell.com>
4143 Fix crash on cs0657-17.cs.
4144 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4145 Use RootContext.Tree.Types, not 'new RootTypes ()'.
4146 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
4147 the case where the NamespaceEntry gets overwritten.
4149 2004-12-06 Marek Safar <marek.safar@seznam.cz>
4151 Fixed #69195, #56821
4152 * ecore.cs (ResolveBoolean): Tiny refactoring.
4154 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
4155 of right expression resolving when left is false constant and
4156 operator is LogicalAnd OR true constant and operator is LogicalOr.
4158 * statement.cs (ResolveUnreachable): Always reports warning.
4160 2004-12-05 Miguel de Icaza <miguel@ximian.com>
4162 * class.cs: Distinguish between 1721 and 1722 (just a little help
4163 for the programmer).
4165 2004-12-03 Miguel de Icaza <miguel@ximian.com>
4167 * delegate.cs: Only allow this on new versions of the language.
4169 2004-12-02 Duncan Mak <duncan@ximian.com>
4171 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
4173 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
4174 here as a static method. Take an additional bool out parameter
4175 `must_do_cs1540_check' for signaling to InstanceResolve.
4176 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
4177 member field from PropertyExpr class and made it an argument of
4179 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
4180 check for MarshalByRefObject, and report CS0122 instead of CS1540.
4181 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
4182 and `remove_accessor' as well as InstanceResolve: report CS0122
4187 2004-12-03 Raja R Harinath <rharinath@novell.com>
4189 Fix test-327.cs, test-328.cs, and put in early infrastructure
4190 for eventually fixing #52697.
4191 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
4192 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
4194 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
4195 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
4196 (VerifyUsing, error246): Update.
4197 * rootcontext.cs (RootContext.NamespaceLookup): Just use
4198 'NamespaceEntry.LookupNamespaceOrType'.
4200 2004-12-03 Martin Baulig <martin@ximian.com>
4202 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4203 method as our child, call AnonymousMethod.Compatible() on it.
4205 2004-12-03 Raja R Harinath <rharinath@novell.com>
4207 Disable XML documentation support in 'basic' profile.
4208 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
4209 Redirect XmlElement to System.Object.
4210 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
4211 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
4212 * mcs.exe.sources: Add doc-bootstrap.cs.
4213 * doc-bootstrap.cs: New file. Contains empty stub implementation
4216 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
4218 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
4219 comments are allowed.
4221 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4223 * delegate.cs: Add checks for subtypes in paramaters and return values
4224 in VerifyMethod () to add support for Covariance/Contravariance
4227 2004-12-02 Miguel de Icaza <miguel@ximian.com>
4229 * report.cs: Remove extra closing parenthesis.
4231 * convert.cs (Error_CannotImplicitConversion): If the name of the
4232 types are the same, provide some extra information.
4234 * class.cs (FieldBase): Use an unused bit field from the field to
4235 encode the `has_offset' property from the FieldMember. This saves
4236 a couple of Ks on bootstrap compilation.
4238 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4239 method as our child, return the AnonymousMethod resolved
4242 * expression.cs (New.DoResolve): Allow return values from
4243 NewDelegate to also include AnonymousMethods.
4247 2004-12-02 Marek Safar <marek.safar@seznam.cz>
4250 * attribute.cs (Resolve): Improved implementation of params
4251 attribute arguments.
4253 * support.cs (ParameterData): Add HasParams to be faster.
4255 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
4257 all things are for /doc support:
4259 * doc.cs: new file that supports XML documentation generation.
4260 * mcs.exe.sources: added doc.cs.
4262 Handle /doc command line option.
4263 Report error 2006 instead of 5 for missing file name for /doc.
4264 Generate XML documentation when required, after type resolution.
4266 Added support for picking up documentation (/// and /** ... */),
4267 including a new XmlCommentState enumeration.
4269 Added lines to fill Documentation element for field, constant,
4270 property, indexer, method, constructor, destructor, operator, event
4271 and class, struct, interface, delegate, enum.
4272 Added lines to warn incorrect comment.
4274 Added Documentation field (passed only when /doc was specified).
4276 Added DocComment, DocCommentHeader, GenerateDocComment() and
4277 OnGenerateDocComment() and some supporting private members for
4278 /doc feature to MemberCore.
4280 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
4282 Added overriden DocCommentHeader.
4284 Added overriden DocCommentHeader and GenerateDocComment().
4286 2004-12-01 Miguel de Icaza <miguel@ximian.com>
4288 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
4289 unwrapping the enumeration values, chain to
4290 DoConstantNumericPromotions again, so we can promote things to the
4291 fundamental types (takes care of enums that are bytes, sbytes).
4295 2004-12-01 Raja R Harinath <rharinath@novell.com>
4297 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
4298 Fix long-standing bug in type-lookup. Use FindType instead of
4299 LookupType when ec.ResolvingTypeTree.
4300 (Attribute.ResolveType, Attribute.Resolve)
4301 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
4303 (Attributes.Search): Remove internal version. Update.
4304 (Attributes.SearchMulti): Update.
4305 (Attributes.GetClsCompliantAttribute): Remove.
4306 (Attributes.GetIndexerNameAttribute): Remove.
4307 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
4308 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
4309 * class.cs (Indexer.Define): Likewise.
4311 2004-12-01 Marek Safar <marek.safar@seznam.cz>
4314 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
4315 MarshallByReference members access.
4317 * expression.cs: Use CheckMarshallByRefAccess;
4318 Better error CS0197 message.
4320 * report.cs: Print whole related error message.
4322 2004-11-30 Raja R Harinath <rharinath@novell.com>
4324 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
4325 the current directory to help debugging.
4327 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4329 * class (GetClassBases): Better error 60 report.
4330 (EventProperty): Disabled warning 67 detection.
4332 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4335 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
4337 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
4340 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4343 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
4345 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
4347 2004-11-26 Miguel de Icaza <miguel@ximian.com>
4349 * attribute.cs (Attribute.Resolve): Refine error reporting and
4350 report a cs0117 if the identifier does not exist, to distinguish
4351 from 0617 which is a miss-use of the actual identifier.
4353 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
4354 between cs0070 and cs0079.
4356 * class.cs (MemberBase.DoDefine): When reporting a wrong
4357 accessibility level, we use MethodCore to compare instead of
4358 Method (this was a regression in some refactoring effort).
4360 So now we correctly report cs0056 again.
4362 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
4363 testing the target_type (which was known to be object_type) and
4364 not the source type (which is anonymous_method).
4366 Fixed reporting of error cs1660.
4368 * expression.cs (UserCast.Source): Expose the underlying cast.
4370 * statement.cs (Switch.SwitchGoverningType): Sort the list of
4371 allowed types to find a match to int32 first (most common).
4373 In addition, it ignores any ImplicitUserConversions that did an
4374 internal implicit conversion (as the switch statement allows only
4375 one integral conversion to exist).
4377 * class.cs (PartialContainer.Create): rename `name' to
4378 `member_name' for clarity. Then replace the string calls with a
4379 call to MemberName.GetPartialName, as now using
4380 MemberName.ToString is an error (this is due to the side effects
4381 it had, that were fixed in the past).
4383 This will restore the error reporting on a number of partial class
4384 errors that were missusing this (and getting an exception as a
4385 results, which is now just a plain textual warning, because
4386 yyparse debug output would crash otherwise).
4388 2004-11-26 Raja R Harinath <rharinath@novell.com>
4390 * Makefile (PROGRAM_INSTALL_DIR): Remove.
4392 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4394 * rootcontext.cs (LookupType): Make sure to cache lookups that
4395 don't give us a negative result. This saves about 5% of corlib
4398 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4400 * report.cs (AbstractMessage.Print): messages are sent to stderr
4402 * class.cs (TypeContainer.GetClassBases): It is an error to have a
4403 non-interface in the list of interfaces (at this point, either
4404 parent was properly set, or a base class is being listed in the
4405 interfaces section).
4407 This flags error 1722, and resolves the crash from bug 69259.
4409 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4411 * statement.cs (Using.EmitExpressionFinally): make this work right
4412 for valuetypes. Fixes 69926.
4414 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4416 * const.cs (Const.ChangeType): Cope with the "0 literal can be
4417 converted to an enum" here, before we try to change the underlying
4418 type. This code exists, but it is a different code path than the
4419 one used while encoding constants.
4421 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
4422 old bug: when converting from the null literal to a pointer,
4423 return an EmptyCast, not the NullLiteral.
4425 This fixes #69921, the recent null_type changes probably made this
4428 (ImplicitReferenceConversionExists): In addition, resynchronized
4429 the code here, so it matches the same code in
4430 ImplicitReferenceConversionExists for the `from any class-type S
4431 to any interface-type T'.
4434 2004-11-25 Marek Safar <marek.safar@seznam.cz>
4436 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
4438 2004-11-24 Miguel de Icaza <miguel@ximian.com>
4440 * cs-parser.jay: Use verbosity accordingly.
4442 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4444 * expression.cs (Unary.ResolveOperator): Do not report warning;
4445 AddressOf reads from variable.
4447 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
4449 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4453 * attribute.cs (Attributable): Removed CheckTargets.
4454 (Attributes.Emit): Explicit attribute targets are tested here.
4456 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
4457 not enabled for interfaces.
4459 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
4460 (GetAssemblyName): Ouch next bug there.
4462 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4464 * expression.cs: Error 275 added.
4466 2004-11-23 Marek Safar <marek.safar@seznam.cz>
4468 Fix bug #69177 (Implemented decimal constant support)
4470 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
4471 (BinaryFold): Add DecimalConstant.
4473 * const.cs (Define): Decimal constant
4475 (ChangeType): Add decimal type handling.
4476 (LookupConstantValue): Don't set value for decimal type but
4477 emit DecimalConstantAttribute. Needed for constant optimization.
4479 * constant.cs (ToDecimal): New method.
4480 (ConvertToDecimal): New method.
4481 (IntConstant): Implemented ConvertToDecimal.
4482 (DecimalConstant.Emit): Emit optimized version for decimals in
4485 * expression.cs (ResolveOperator): Changed order of constant
4486 reduction to work correctly with native types which have
4487 overloaded operators.
4488 (ResolveMemberAccess): Extract constant value from attribute
4491 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
4493 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
4494 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
4495 (ChangeType): Decimal is special.
4496 (TypeToCoreType): Add decimal type.
4498 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4500 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
4503 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4505 * class.cs (EventField.ApplyAttributeBuilder): Fix error
4508 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4510 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
4512 * pending.cs (PendingImplementation): Grab only interfaces.
4514 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4516 * statement.cs (ForeachHelperMethods): Add location member and
4517 error 202 detection.
4519 2004-11-19 Raja R Harinath <rharinath@novell.com>
4521 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
4522 automatically handled by executable.make.
4523 (PROGRAM): Make profile-specific.
4525 2004-11-18 Marek Safar <marek.safar@seznam.cz>
4527 * expression.cs (DoResolveBase): Fixed wrong warning for out
4530 2004-11-18 Martin Baulig <martin@ximian.com>
4532 Merged latest changes into gmcs. Please keep this comment in
4533 here, it makes it easier for me to see what changed in MCS since
4534 the last time I merged.
4536 2004-11-17 Raja R Harinath <rharinath@novell.com>
4538 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
4539 (TypeHandle.GetMemberCache): New.
4540 (TypeHandle.TypeHandle): Update.
4541 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
4542 (TypeManager.LookupParentInterfacesCache):
4543 Rename from LookupInterfaceCache. Optimize slightly.
4544 (TypeManager.MemberLookup_FindMembers): Update.
4545 * decl.cs (MemberCache.MemberCache): Set Container to null in the
4547 (AddCacheContents): Rename from AddHashtable.
4548 * class.cs (TypeContainer.parent_container): Remove.
4549 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
4550 (TypeContainer.DoDefineMembers): Don't initialize it.
4551 Update to name changes.
4553 2004-11-17 Miguel de Icaza <miguel@ximian.com>
4555 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
4556 that factors the code to check access modifiers on override.
4558 (PropertyBase): Use the code here.
4560 Patch from Lluis S'anchez, fixes bug #69361.
4562 2004-11-15 Miguel de Icaza <miguel@ximian.com>
4564 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
4565 routine that is used to report the use of a captured variable
4566 whose address has been taken.
4568 There are two checks: one when variables are being captured and
4569 the other check is when the address of a variable is taken.
4571 (because an anonymous methods might be resolved before *or* after
4572 the address has been taken) and
4574 * expression.cs (Conditional.DoResolve): Remove the special
4575 casing that Martin added to trueExpr and falseExpr being both
4576 NullLiteral. We get the right behavior now just by introducing
4577 the null_type into the compiler.
4579 * convert.cs (ExplicitConversion): Change the code to use
4580 null_type instead of testing `expr is NullLiteral'.
4581 (ImplicitConversionStandard): use null_type too.
4582 (ImplicitReferenceConversionExists): use null_type too.
4583 (ImplicitReferenceConversion): use null_type too.
4585 * literal.cs: The type of `NullLiteral' is now null_type instead
4587 (Resolve): Set the type here.
4589 * typemanager.cs: Introduce null_type.
4591 2004-11-17 Martin Baulig <martin@ximian.com>
4593 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4594 direction, like FindMembers() does. Fixes #69546, testcase is in
4597 2004-11-16 Martin Baulig <martin@ximian.com>
4599 This is based on a patch from Marek Safar, see bug #69082.
4600 Fixes bugs #63705 and #67130.
4602 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4603 method; create a MemberCache for an interface type and cache the
4606 * decl.cs (IMemberContainer.ParentContainer): Removed.
4607 (IMemberContainer.ParentCache): New property.
4608 (MemberCache.SetupCacheForInterface): Removed.
4609 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4610 to create a cache for an interface's "parent".
4612 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4615 2004-11-16 Martin Baulig <martin@ximian.com>
4617 Merged back from gmcs; these changes already went into gmcs a
4618 couple of weeks ago.
4621 (TypeManager.AddUserType): Removed the `ifaces' argument.
4622 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
4624 (TypeManager.AddUserInterface): Removed.
4625 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
4627 (TypeManager.GetInterfaces): Likewise.
4628 (TypeManager.GetExplicitInterfaces): Likewise.
4630 * ecore.cs (TypeExpr.GetInterfaces): Removed.
4632 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
4633 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
4635 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4637 * statement.cs: Avoid adding bools to a hashtable.
4639 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4641 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4642 calling an unsafe method from a safe location.
4644 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4647 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4649 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4651 * namespace.cs (VerifyUsing): use GetPartialName instead of
4654 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4656 * statement.cs (Return.Resolve): Fix regression in typo: if
4657 `in_exc', we have to request a NeedReturnLabel, this was a typo
4658 introduced in the anonymous method check-in. Fixes #69131.
4660 * Indexers were using the ShortName when defining themselves,
4661 causing a regression in the compiler bootstrap when applying the
4662 patch from 2004-11-02 (first part), now they use their full name
4663 and the bug is gone.
4665 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4667 * driver.cs: Strip the path from the names of embedded resources. Fixes
4670 2004-11-04 Raja R Harinath <rharinath@novell.com>
4672 Fix error message regression: cs0104-2.cs.
4673 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4674 (AliasEntry.Resolve): Update.
4675 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4677 (RootContext.LookupType): Update.
4679 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4681 * cs-parser.jay: Add support for handling accessor modifiers
4682 * class: Add support port accessor modifiers and error checking,
4683 define PropertyMethod.Define as virtual (not abstract anymore)
4684 * ecore.cs: Add checking for proeprties access with access modifiers
4685 * iterators.cs: Modify Accessor constructor call based in the modified
4687 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4689 * expression.cs (StringConcat): Handle being called twice,
4690 as when we have a concat in a field init with more than two
4693 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4695 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4696 special case explicit implementations, we should always produce
4697 the .property or .event declaration.
4699 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4700 since it will not return correct data if people use this
4701 unresolved in the presence of using statements (see test-313).
4703 * class.cs (MethodData.Define): If we are an explicit interface
4704 implementation, set the method name to the full name of the
4705 interface plus the name of the method.
4707 Notice that using the method.MethodName.GetFullName() does not
4708 work, as it will only contain the name as declared on the source
4709 file (it can be a shorthand in the presence of using statements)
4710 and not the fully qualifed type name, for example:
4714 class D : ICloneable {
4715 object ICloneable.Clone () {
4719 Would produce a method called `ICloneable.Clone' instead of
4720 `System.ICloneable.Clone'.
4722 * namespace.cs (Alias.Resolve): Use GetPartialName.
4724 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4726 * cs-parser.jay: Add error 1055 report.
4728 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4730 * assign.cs (Assign.DoResolve): Only do the transform of
4731 assignment into a New if the types are compatible, if not, fall
4732 through and let the implicit code deal with the errors and with
4733 the necessary conversions.
4735 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4737 * cs-parser.jay: Add error 1031 report.
4739 * cs-tokenizer.cs: Add location for error 1038.
4741 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4743 * cs-parser.jay: Add error 1016 report.
4745 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4747 * cs-parser.jay: Add errors 1575,1611 report.
4749 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4751 * cs-parser.jay: Add error 1001 report.
4753 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4756 * attribute.cs (GetMarshal): Add method argument for
4757 caller identification.
4759 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4760 agument for GetMarshal and RuntimeMissingSupport.
4762 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4764 * attribute.cs (ExtractSecurityPermissionSet): Removed
4765 TypeManager.code_access_permission_type.
4767 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4769 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4771 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4772 for obsolete use of a variable here. Fixes regression on errors
4773 cs0619-25 and cs0619-26.
4775 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4777 Fix #62358, implemented security attribute encoding.
4779 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4780 Tests permitted SecurityAction for assembly or other types.
4781 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4782 data from SecurityPermissionAttribute to PermisionSet class.
4784 * class.cs (ApplyAttributeBuilder): Added special handling
4785 for System.Security.Permissions.SecurityAttribute based types.
4787 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4788 special handling for System.Security.Permissions.SecurityAttribute
4791 * enum.cs (ApplyAttributeBuilder): Added special handling
4792 for System.Security.Permissions.SecurityAttribute based types.
4794 * parameter.cs (ApplyAttributeBuilder): Added special handling
4795 for System.Security.Permissions.SecurityAttribute based types.
4797 * rootcontext.cs: Next 2 core types.
4799 * typemanager.cs (TypeManager.security_permission_attr_type):
4800 Built in type for the SecurityPermission Attribute.
4801 (code_access_permission_type): Build in type.
4803 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4805 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4806 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4807 all of this information into
4808 EmitContext.EmitCapturedVariableInstance.
4810 * codegen.cs (EmitCapturedVariableInstance): move here the
4811 funcionality of emitting an ldarg.0 in the presence of a
4812 remapping. This centralizes the instance emit code.
4814 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4815 then emit a load of this: it means that we have reached the
4816 topmost ScopeInfo: the one that contains the pointer to the
4817 instance of the class hosting the anonymous method.
4819 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4820 captures to the topmost CaptureContext.
4822 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4824 * expression.cs (LocalVariableReference): Move the knowledge about
4825 the iterators into codegen's EmitCapturedVariableInstance.
4827 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4829 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4830 all code paths return a value from an anonymous method (it is the
4831 same as the 161 error, but for anonymous methods).
4833 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4835 The introduction of anonymous methods in the compiler changed
4836 various ways of doing things in the compiler. The most
4837 significant one is the hard split between the resolution phase
4838 and the emission phases of the compiler.
4840 For instance, routines that referenced local variables no
4841 longer can safely create temporary variables during the
4842 resolution phase: they must do so from the emission phase,
4843 since the variable might have been "captured", hence access to
4844 it can not be done with the local-variable operations from the runtime.
4848 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4849 is a toplevel block.
4851 (ToplevelBlock): A new kind of Block, these are the blocks that
4852 are created by the parser for all toplevel method bodies. These
4853 include methods, accessors and anonymous methods.
4855 These contain some extra information not found in regular blocks:
4856 A pointer to an optional CaptureContext (for tracking captured
4857 local variables and parameters). A pointer to the parent
4860 (Return.Resolve): Catch missmatches when returning a value from an
4861 anonymous method (error 1662).
4862 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4865 (Break.Resolve): ditto.
4867 (SwitchLabel): instead of defining the labels during the
4868 resolution phase, we now turned the public ILLabel and ILLabelCode
4869 labels into methods called GetILLabelCode() and GetILLabel() that
4870 only define the label during the Emit phase.
4872 (GotoCase): Track the SwitchLabel instead of the computed label
4873 (its contained therein). Emit the code by using
4874 SwitchLabel.GetILLabelCode ().
4876 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4877 whether the Local has been captured or not.
4879 (LocalInfo.IsCaptured): New property, used to tell whether the
4880 local has been captured.
4882 * anonymous.cs: Vastly updated to contain the anonymous method
4885 The main classes here are: CaptureContext which tracks any
4886 captured information for a toplevel block and ScopeInfo used to
4887 track the activation frames for various local variables.
4889 Each toplevel block has an optional capture context associated
4890 with it. When a method contains an anonymous method both the
4891 toplevel method and the anonymous method will create a capture
4892 context. When variables or parameters are captured, they are
4893 recorded on the CaptureContext that owns them, for example:
4897 MyDelegate d = delegate {
4902 Here `a' will be recorded as captured on the toplevel
4903 CapturedContext, the inner captured context will not have anything
4904 (it will only have data if local variables or parameters from it
4905 are captured in a nested anonymous method.
4907 The ScopeInfo is used to track the activation frames for local
4908 variables, for example:
4910 for (int i = 0; i < 10; i++)
4911 for (int j = 0; j < 10; j++){
4912 MyDelegate d = delegate {
4917 At runtime this captures a single captured variable `i', but it
4918 captures 10 different versions of the variable `j'. The variable
4919 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4920 recorded on a child.
4922 The toplevel ScopeInfo will also track information like the `this'
4923 pointer if instance variables were referenced (this is necessary
4924 as the anonymous method lives inside a nested class in the host
4925 type of the method).
4927 (AnonymousMethod): Expanded to track the Toplevel, implement
4928 `AnonymousMethod.Compatible' to tell whether an anonymous method
4929 can be converted to a target delegate type.
4931 The routine now also produces the anonymous method content
4933 (AnonymousDelegate): A helper class that derives from
4934 DelegateCreation, this is used to generate the code necessary to
4935 produce the delegate for the anonymous method that was created.
4937 * assign.cs: API adjustments for new changes in
4938 Convert.ImplicitStandardConversionExists.
4940 * class.cs: Adjustments to cope with the fact that now toplevel
4941 blocks are of type `ToplevelBlock'.
4943 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4944 insteda of standard blocks.
4946 Flag errors if params arguments are passed to anonymous methods.
4948 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4949 `CurrentAnonymousMethod' which points to the current Anonymous
4950 Method. The variable points to the AnonymousMethod class that
4951 holds the code being compiled. It is set in the new EmitContext
4952 created for the anonymous method.
4954 (EmitContext.Phase): Introduce a variable and an enumeration to
4955 assist in enforcing some rules about when and where we are allowed
4956 to invoke certain methods (EmitContext.NeedsReturnLabel is the
4957 only one that enfonces this right now).
4959 (EmitContext.HaveCaptureInfo): new helper method that returns
4960 whether we have a CapturedContext initialized.
4962 (EmitContext.CaptureVariable): New method used to register that a
4963 LocalInfo must be flagged for capturing.
4965 (EmitContext.CapturedParameter): New method used to register that a
4966 parameters must be flagged for capturing.
4968 (EmitContext.CapturedField): New method used to register that a
4969 field must be flagged for capturing.
4971 (EmitContext.HaveCapturedVariables,
4972 EmitContext.HaveCapturedFields): Return whether there are captured
4973 variables or fields.
4975 (EmitContext.EmitMethodHostInstance): This is used to emit the
4976 instance for the anonymous method. The instance might be null
4977 (static methods), this (for anonymous methods that capture nothing
4978 and happen to live side-by-side with the current method body) or a
4979 more complicated expression if the method has a CaptureContext.
4981 (EmitContext.EmitTopBlock): Routine that drives the emission of
4982 code: it will first resolve the top block, then emit any metadata
4983 and then emit the code. The split is done so that we can extract
4984 any anonymous methods and flag any captured variables/parameters.
4986 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
4987 during this phase, the ILGenerator should not be used as labels
4988 and local variables declared here might not be accessible to any
4989 code that is part of an anonymous method.
4991 Exceptions to this include the temporary variables that are
4992 created by some statements internally for holding temporary
4995 (EmitContext.EmitMeta): New routine, in charge of emitting all the
4998 (EmitContext.TemporaryReturn): This method is typically called
4999 from the Emit phase, and its the only place where we allow the
5000 ReturnLabel to be defined other than the EmitMeta. The reason is
5001 that otherwise we would have to duplicate a lot of logic in the
5002 Resolve phases of various methods that today is on the Emit
5005 (EmitContext.NeedReturnLabel): This no longer creates the label,
5006 as the ILGenerator is not valid during the resolve phase.
5008 (EmitContext.EmitThis): Extended the knowledge in this class to
5009 work in anonymous methods in addition to iterators.
5011 (EmitContext.EmitCapturedVariableInstance): This emits whatever
5012 code is necessary on the stack to access the instance to a local
5013 variable (the variable will be accessed as a field).
5015 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
5016 EmitContext.EmitAddressOfParameter): Routines to support
5017 parameters (not completed at this point).
5019 Removals: Removed RemapLocal and RemapLocalLValue. We probably
5020 will also remove the parameters.
5022 * convert.cs (Convert): Define a `ConstantEC' which points to a
5023 null. This is just to prefity some code that uses
5024 ImplicitStandardConversion code and do not have an EmitContext
5027 The idea is to flag explicitly that at that point in time, it is
5028 known that the conversion will not trigger the delegate checking
5029 code in implicit conversions (which requires a valid
5032 Everywhere: pass new EmitContext parameter since
5033 ImplicitStandardConversionExists now requires it to check for
5034 anonymous method conversions.
5036 (Convert.ImplicitStandardConversionExists): If the type of an
5037 expression is the anonymous_method_type, and the type is a
5038 delegate, we invoke the AnonymousMethod.Compatible method to check
5039 whether an implicit conversion is possible.
5041 (Convert.ImplicitConversionStandard): Only do implicit method
5042 group conversions if the language level is not ISO_1.
5044 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
5045 MethodInfo for the Invoke method. used by Delegate and
5048 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
5049 method conversions if the target type is a delegate.
5051 Removed extra debugging nops.
5053 (LocalVariableReference): Turn the `local_info' into a public
5056 Add `prepared' field, the same hack used for FieldExprs to cope
5057 with composed assignments, as Local variables do not necessarily
5058 operate purely on the stack as they used to: they can be captured
5061 Add `temp' for a temporary result, like fields.
5063 Refactor DoResolve and DoResolveLValue into DoResolveBase.
5065 It now copes with Local variables that are captured and emits the
5066 proper instance variable to load it from a field in the captured
5069 (ParameterReference.DoResolveBase): During the resolve phase,
5070 capture parameters if we are in an anonymous method.
5072 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
5073 anonymous method, use the EmitContext helper routines to emit the
5074 parameter reference.
5076 * iterators.cs: Set RemapToProxy to true/false during the
5079 * parameters.cs (GetParameterByName): New helper method.
5081 * typemanager.cs (anonymous_method_type) a new type that
5082 represents an anonyous method. This is always an internal type,
5083 used as a fencepost to test against the anonymous-methodness of an
5086 2004-10-20 Marek Safar <marek.safar@seznam.cz>
5088 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
5090 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
5092 2004-10-18 Martin Baulig <martin@ximian.com>
5094 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
5095 `Type' directly, but call ResolveType() on it.
5096 (Catch.Resolve): Likewise.
5097 (Foreach.Resolve): Likewise.
5099 2004-10-18 Martin Baulig <martin@ximian.com>
5101 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
5102 `Type' directly, but call ResolveType() on it.
5103 (Probe.DoResolve): Likewise.
5104 (ArrayCreation.LookupType): Likewise.
5105 (TypeOf.DoResolve): Likewise.
5106 (SizeOf.DoResolve): Likewise.
5108 2004-10-18 Martin Baulig <martin@ximian.com>
5110 * expression.cs (Invocation.BetterFunction): Put back
5111 TypeManager.TypeToCoreType().
5113 2004-10-18 Raja R Harinath <rharinath@novell.com>
5115 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
5118 2004-10-18 Martin Baulig <martin@ximian.com>
5120 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
5121 `Type' directly, but call ResolveType() on it.
5123 2004-10-18 Martin Baulig <martin@ximian.com>
5125 * class.cs (FieldMember.Define): Don't access the TypeExpr's
5126 `Type' directly, but call ResolveType() on it.
5127 (MemberBase.DoDefine): Likewise.
5129 * expression.cs (New.DoResolve): Don't access the TypeExpr's
5130 `Type' directly, but call ResolveType() on it.
5131 (ComposedCast.DoResolveAsTypeStep): Likewise.
5133 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
5134 `Type' directly, but call ResolveType() on it.
5136 2004-10-17 John Luke <john.luke@gmail.com>
5138 * class.cs (Operator.GetSignatureForError): use CSharpName
5140 * parameter.cs (Parameter.GetSignatureForError): Returns
5141 correct name even if was not defined.
5143 2004-10-13 Raja R Harinath <rharinath@novell.com>
5146 * class.cs (TypeContainer.EmitContext): New property.
5147 (DefineNestedTypes): Create an emitcontext for each part.
5148 (MethodCore.DoDefineParameters): Use container's emitcontext.
5149 Pass type array to InternalParameters.
5150 (MemberBase.DoDefine): Use container's emitcontext.
5151 (FieldMember.Define): Likewise.
5152 (Event.Define): Likewise.
5153 (SetMethod.GetParameterInfo): Change argument to EmitContext.
5154 Pass type array to InternalParameters.
5155 (SetIndexerMethod.GetParameterInfo): Likewise.
5156 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
5157 * delegate.cs (Define): Pass emitcontext to
5158 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
5159 array to InternalParameters.
5160 * expression.cs (ParameterReference.DoResolveBase): Pass
5161 emitcontext to GetParameterInfo.
5162 (ComposedCast.DoResolveAsTypeStep): Remove check on
5163 ec.ResolvingTypeTree.
5164 * parameter.cs (Parameter.Resolve): Change argument to
5165 EmitContext. Use ResolveAsTypeTerminal.
5166 (Parameter.GetSignature): Change argument to EmitContext.
5167 (Parameters.ComputeSignature): Likewise.
5168 (Parameters.ComputeParameterTypes): Likewise.
5169 (Parameters.GetParameterInfo): Likewise.
5170 (Parameters.ComputeAndDefineParameterTypes): Likewise.
5171 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
5172 * support.cs (InternalParameters..ctor): Remove variant that takes
5174 * typemanager.cs (system_intptr_expr): New.
5175 (InitExpressionTypes): Initialize it.
5177 2004-10-12 Chris Toshok <toshok@ximian.com>
5179 * cs-parser.jay: fix location for try_statement and catch_clause.
5181 2004-10-11 Martin Baulig <martin@ximian.com>
5183 * report.cs: Don't make --fatal abort on warnings, we have
5184 -warnaserror for that.
5186 2004-10-07 Raja R Harinath <rharinath@novell.com>
5188 More DeclSpace.ResolveType avoidance.
5189 * decl.cs (MemberCore.InUnsafe): New property.
5190 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
5191 with newly created EmitContext.
5192 (FieldMember.Define): Likewise.
5193 * delegate.cs (Delegate.Define): Likewise.
5194 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
5195 only if normal name-lookup fails.
5196 (TypeExpr.DoResolve): Enable error-checking.
5197 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
5198 (SizeOf.DoResolve): Likewise.
5199 (ComposedCast.DoResolveAsTypeStep): Likewise.
5200 (StackAlloc.DoResolve): Likewise.
5201 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
5202 (Block.Unsafe): New property.
5203 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
5204 (Unsafe): Set 'unsafe' flag of contained block.
5205 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
5206 (Fixed.Resolve): Likewise.
5207 (Catch.Resolve): Likewise.
5208 (Using.ResolveLocalVariableDecls): Likewise.
5209 (Foreach.Resolve): Likewise.
5211 2004-10-05 John Luke <john.luke@gmail.com>
5213 * cs-parser.jay: add location to error CS0175
5215 2004-10-04 Miguel de Icaza <miguel@ximian.com>
5217 * ecore.cs (Expression.Constantity): Add support for turning null
5220 * const.cs (Const.Define): Allow constants to be reference types
5221 as long as the value is Null.
5223 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
5225 * namespace.cs (NamespaceEntry.Using): No matter which warning
5226 level is set, check if this namespace name has already been added.
5228 2004-10-03 Ben Maurer <bmaurer@ximian.com>
5230 * expression.cs: reftype [!=]= null should always use br[true,false].
5233 2004-10-03 Marek Safar <marek.safar@seznam.cz>
5236 * attribute.cs: Enum conversion moved to
5237 GetAttributeArgumentExpression to be applied to the all
5240 2004-10-01 Raja R Harinath <rharinath@novell.com>
5242 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
5243 * class.c (TypeContainer.DefineType): Flag error if
5244 base types aren't accessible due to access permissions.
5245 * decl.cs (DeclSpace.ResolveType): Move logic to
5246 Expression.ResolveAsTypeTerminal.
5247 (DeclSpace.ResolveTypeExpr): Thin layer over
5248 Expression.ResolveAsTypeTerminal.
5249 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
5250 Refactor code into NestedAccess. Use it.
5251 (DeclSpace.NestedAccess): New.
5252 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
5253 argument to silence errors. Check access permissions.
5254 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
5255 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
5256 (Cast.DoResolve): Likewise.
5257 (New.DoResolve): Likewise.
5258 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
5259 (TypeOf.DoResolve): Likewise.
5261 * expression.cs (Invocation.BetterConversion): Return the Type of
5262 the better conversion. Implement section 14.4.2.3 more faithfully.
5263 (Invocation.BetterFunction): Make boolean. Make correspondence to
5264 section 14.4.2.2 explicit.
5265 (Invocation.OverloadResolve): Update.
5266 (Invocation): Remove is_base field.
5267 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
5268 (Invocation.Emit): Likewise.
5270 2004-09-27 Raja R Harinath <rharinath@novell.com>
5272 * README: Update to changes.
5274 2004-09-24 Marek Safar <marek.safar@seznam.cz>
5276 * cs-parser.jay: Reverted 642 warning fix.
5278 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5281 * decl.cs (FindMemberWithSameName): Indexer can have more than
5284 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5286 * expression.cs (LocalVariableReference.DoResolveLValue):
5287 Do not report warning 219 for out values.
5288 (EmptyExpression.Null): New member to avoid extra allocations.
5290 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5292 * cs-parser.jay: Fix wrong warning 642 report.
5294 * cs-tokenizer.cs (CheckNextToken): New helper;
5295 Inspect next character if is same as expected.
5297 2004-09-23 Martin Baulig <martin@ximian.com>
5299 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
5300 (Convert.ImplicitReferenceConversionExists): Likewise.
5302 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5304 * class.cs (Operator.Define): Add error 448 and 559 report.
5306 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5308 * class.cs (MemberBase.IsTypePermitted): New protected
5309 method for checking error CS0610.
5311 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5313 * class.cs (TypeContainer.HasExplicitLayout): New property
5314 Returns whether container has StructLayout attribute set Explicit.
5315 (FieldMember): New abstract class for consts and fields.
5316 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
5317 (Field): Reuse FieldMember.
5319 * const.cs (Const): Reuse FieldMember.
5321 * rootcontext.cs: EmitConstants call moved to class.
5323 2004-09-22 Martin Baulig <martin@ximian.com>
5325 Thanks to Peter Sestoft for this bug report.
5327 * expression.cs (Conditional): If both the `trueExpr' and the
5328 `falseExpr' is a NullLiteral, return a NullLiteral.
5330 2004-09-22 Martin Baulig <martin@ximian.com>
5332 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
5333 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
5334 for the "get_Current" call.
5336 2004-09-22 Martin Baulig <martin@ximian.com>
5338 Marek and me just fixed one of our oldest bugs: #28562 :-)
5340 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
5342 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
5343 we're an EnumConstant, just return that.
5344 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
5345 an EnumConstant. In this case, we need to use GetValueAsEnumType()
5346 to get the value which'll actually be written into the attribute.
5347 However, we have to use GetValue() to access the attribute's value
5350 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5352 * constant.cs (Constant.IsNegative): New abstract property
5355 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
5356 (StackAlloc.DoResolve): Reused IsNegative.
5358 2004-09-21 Martin Baulig <martin@ximian.com>
5360 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
5361 if we're used in an iterator, we may be called from different
5364 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
5365 we actually have an exception block.
5367 2004-09-20 John Luke <jluke@cfl.rr.com>
5369 * class.cs, cs-parser.jay: Improve the error report for 1520:
5370 report the actual line where the error happens, not where the
5373 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
5374 Pass location information that was available elsewhere.
5376 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
5378 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
5379 runtime to delay sign assemblies.
5381 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5383 * cs-parser.jay: Do not report the stack trace, this is barely
5386 2004-08-22 John Luke <john.luke@gmail.com>
5388 * driver.cs : check that a resource id is not already used
5389 before adding it, report CS1508 if it is, bug #63637
5391 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5393 * ecore.cs: Removed dead code.
5395 2004-09-18 Marek Safar <marek.safar@seznam.cz>
5397 * class.cs: Do not report warning CS0067 on the interfaces.
5399 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5401 * cs-parser.jay: Add error 504 report.
5403 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5405 * rootcontext.cs: WarningLevel is 4 by default now.
5407 * statement.cs (Fixed.Resolve): Do not null
5410 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5413 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
5414 deep search when property is not virtual.
5415 (PropertyExpr.ResolveAccessors): Make one call for both
5418 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5421 * statement.cs: Error 152 report constains also location.
5423 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5426 * const.cs: Explicitly set constant as static.
5428 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5431 * cs-parser.jay: Add error 1017 report.
5433 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5435 Fixed bug #59980, #64224
5436 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
5438 * typemanager.cs (IsSpecialMethod): Simplified
5440 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5442 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
5443 condition with better params.
5445 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5448 * attribute.cs (Resolve): Property has to have both
5451 2004-09-14 Martin Baulig <martin@ximian.com>
5453 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
5455 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5458 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
5459 called and is obsolete then this member suppress message
5460 when call is inside next [Obsolete] method or type.
5462 * expression.cs: Use TestObsoleteMethodUsage member.
5464 2004-09-14 Martin Baulig <martin@ximian.com>
5466 * cs-parser.jay: Sync a bit with the GMCS version.
5468 2004-09-14 Martin Baulig <martin@ximian.com>
5470 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
5471 (CSharpParser.yacc_verbose_flag): New public field.
5473 * genericparser.cs: Removed.
5475 2004-09-14 Raja R Harinath <rharinath@novell.com>
5477 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
5479 2004-09-13 Marek Safar <marek.safar@seznam.cz>
5481 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5483 2004-09-10 Martin Baulig <martin@ximian.com>
5485 Backported my MemberName changes from GMCS into MCS.
5487 - we are now using a special `MemberName' class instead of using
5488 strings; in GMCS, the `MemberName' also contains the type
5491 - changed the grammar rules a bit:
5492 * the old `member_name' is now a `namespace_or_type_name':
5493 The rule is that we use `namespace_or_type_name' everywhere
5494 where we expect either a "member name" (GetEnumerator) or a
5495 "member name" with an explicit interface name
5496 (IEnumerable.GetEnumerator).
5497 In GMCS, the explicit interface name may include type arguments
5498 (IEnumerable<T>.GetEnumerator).
5499 * we use `member_name' instead of just `IDENTIFIER' for
5501 The rule is that we use `member_name' wherever a member may
5502 have type parameters in GMCS.
5504 * decl.cs (MemberName): New public class.
5505 (MemberCore.MemberName): New public readonly field.
5506 (MemberCore.ctor): Take a `MemberName' argument, not a string.
5507 (DeclSpace): Likewise.
5509 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
5510 * enum.cs (Enum.ctor): Likewise.
5512 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
5514 (AliasEntry.ctor): Take a MemberName, not an Expression.
5515 (AliasEntry.UsingAlias): Likewise.
5517 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
5518 (IMethodData.MemberName): Changed type from string to MemberName.
5519 (MemberBase.ExplicitInterfaceName): Likewise.
5520 (AbstractPropertyEventMethod.SetupName): Make this private.
5521 (AbstractPropertyEventMethod.ctor): Added `string prefix'
5522 argument; compute the member name here.
5523 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
5524 on the `member.MemberName' and the `prefix'.
5526 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
5528 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
5529 thus, we get a `MemberName' instead of a `string'. These
5530 declarations may have type parameters in GMCS.
5531 (interface_method_declaration, delegate_declaration): Likewise.
5532 (class_declaration, interface_declaration): Likewise.
5533 (method_header): Use `namespace_or_type_name' instead of
5534 `member_name'. We may be an explicit interface implementation.
5535 (property_declaration, event_declaration): Likewise.
5536 (member_name): This is now just an `IDENTIFIER', not a
5537 `namespace_or_type_name'.
5538 (type_name, interface_type): Removed.
5539 (namespace_or_type_name): Return a MemberName, not an Expression.
5540 (primary_expression): Use `member_name' instead of `IDENTIFIER';
5541 call GetTypeExpression() on the MemberName to get an expression.
5542 (IndexerDeclaration.interface_type): Changed type from string to
5544 (MakeName): Operate on MemberName's instead of string's.
5546 2004-09-13 Raja R Harinath <rharinath@novell.com>
5549 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
5550 (NamespaceEntry.Lookup): Add new argument to flag if we want the
5551 lookup to avoid symbols introduced by 'using'.
5552 * rootcontext.cs (NamespaceLookup): Update.
5554 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5556 * class.cs (TypeContainer.DoDefineMembers): Do not call
5557 DefineDefaultConstructor for static classes.
5559 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5561 * attribute.cs (Attribute.Resolve): Add error 653 report.
5563 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5565 (Method.ApplyAttributeBuilder): Add error 685 report.
5566 (Operator.Define): Add error 564 report.
5568 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5570 * expression.cs (Invocation.DoResolve): Add error
5573 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5576 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5578 * class.cs (ConstructorInitializer.Resolve):
5579 Wrong error number (515->516).
5581 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5583 * class.cs (Indexer.Define): Add error 631 report.
5585 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5587 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5589 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5591 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5593 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5595 * cs-parser.jay: Added error CS0241 report.
5597 2004-09-10 Raja R Harinath <rharinath@novell.com>
5599 * cs-parser.jay (fixed_statement): Introduce a scope for the
5600 declaration in the 'fixed' statement.
5602 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5604 * cs-parser.jay: Added CS0230 error report.
5606 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5608 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5610 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5612 * expression.cs (Argument.Resolve): Added error CS0192 and
5615 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5617 C# 2.0 #pragma warning feature
5619 * cs-tokenizer.cs (PreProcessPragma): New method;
5620 Handles #pragma directive.
5622 * report.cs (WarningRegions): New class; Support
5623 class for #pragma warning directive. It tests whether
5624 warning is enabled for a given line.
5626 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5628 * const.cs: Add more descriptive error report, tahnks to
5631 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5633 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5635 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5637 * expression.cs: Apply patch from Ben: Remove dead code from
5638 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5639 as that code just threw an exception anwyays.
5641 * const.cs: Remove the call to the turnintoconstant, for details
5644 * literal.cs: The type of the null-literal is the null type; So
5645 we use a placeholder type (literal.cs:System.Null, defined here)
5648 * expression.cs (Conditional.DoResolve): Remove some old code that
5649 is no longer needed, conversions have been fixed.
5651 (ArrayCreationExpression.DoResolve): Return false if we fail to
5652 resolve the inner expression.
5654 2004-09-07 Raja R Harinath <rharinath@novell.com>
5657 * cs-parser.jay (delegate_declaration): Record a delegate
5658 declaration as a type declaration.
5659 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5661 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5663 * parameter.cs: Do not crash if the type can not be resolved.
5665 * expression.cs: Report errors with unsafe pointers, fixes #64896
5667 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5669 * expression.cs: Pointer arith always needs to do a conv.i
5670 if the operand is a long. fix 65320
5672 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5674 Fixed cs0619-37.cs, cs0619-38.cs
5676 * enum.cs (GetObsoleteAttribute): Removed.
5678 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5679 on Enum member is double staged. The first is tested member
5682 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5684 Fixed #56986, #63631, #65231
5686 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5687 adds member to name container.
5688 (TypeContainer.AddToTypeContainer): New method, adds type to
5690 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5691 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5692 AddOperator): Simplified by reusing AddToMemberContainer.
5693 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5695 (Method.CheckForDuplications): Fixed implementation to test all
5697 (MemberBase): Detection whether member is explicit interface
5698 implementation is now in constructor.
5699 (MemberBase.UpdateMemberName): Handles IndexerName.
5700 (Accessor): Changed to keep also location information.
5701 (AbstractPropertyEventMethod): Is derived from MemberCore.
5702 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5703 will be emited or not.
5704 (PropertyBase.AreAccessorsDuplicateImplementation):
5705 Tests whether accessors are not in collision with some method.
5706 (Operator): Is derived from MethodCore to simplify common
5709 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5711 (DeclSpace.AddToContainer): Adds the member to defined_names
5712 table. It tests for duplications and enclosing name conflicts.
5714 * enum.cs (EnumMember): Clean up to reuse the base structures
5716 2004-09-03 Martin Baulig <martin@ximian.com>
5718 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5719 into TypeContainer, to make partial classes work again.
5721 2004-09-03 Martin Baulig <martin@ximian.com>
5723 * rootcontext.cs (RootContext.V2): Removed.
5725 2004-03-23 Martin Baulig <martin@ximian.com>
5727 * expression.cs (Invocation.OverloadResolve): Added `bool
5728 may_fail' argument and use it instead of the Location.IsNull() hack.
5730 2004-09-03 Martin Baulig <martin@ximian.com>
5732 Merged latest changes into gmcs. Please keep this comment in
5733 here, it makes it easier for me to see what changed in MCS since
5734 the last time I merged.
5736 2004-09-03 Raja R Harinath <rharinath@novell.com>
5739 * expression.cs (BetterConversion): Don't allow either conversion
5740 to be null. Remove redundant implicit conversion test when 'q ==
5741 null' -- when this function is invoked, we already know that the
5742 implicit conversion exists.
5743 (BetterFunction): Assume that 'best' is non-null. Remove
5744 redundant reimplementation of IsApplicable when 'best' is null.
5745 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5746 number of arguments.
5747 (IsAncestralType): Extract from OverloadResolve.
5748 (OverloadResolve): Make robust to the MethodGroupExpr being
5749 unsorted. Implement all the logic of Section 14.5.5.1, and
5750 support overloading of methods from multiple applicable types.
5751 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5753 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5754 (RealError, Warning): Append type of report to related symbol.
5756 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5758 * enum.cs: Fixed CLS-Compliance checks for enum members.
5759 Error tests cs3008-8.cs, cs3014-8.cs
5761 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5763 Fixed bug #62342, #63102
5764 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5765 like ImplementMethod.
5767 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5769 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5772 2004-09-02 Martin Baulig <martin@ximian.com>
5774 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5775 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5778 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5780 C# 2.0 Static classes implemented
5782 * class.cs (TypeContainer): instance_constructors,
5783 initialized_fields, initialized_static_fields,
5784 default_constructor, base_inteface_types are protected to be
5785 accessible from StaticClass.
5786 (TypeContainer.DefineDefaultConstructor): New virtual method
5787 for custom default constructor generating
5788 (StaticClass): New class to handle "Static classes" feature.
5790 * cs-parser.jay: Handle static keyword on class like instance
5793 * driver.cs: Added "/langversion" command line switch with two
5794 options (iso-1, default).
5796 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5798 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5800 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5802 * delegate.cs: Style.
5804 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5806 * delegate.cs: Add seperate instance expr field for miguel.
5808 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5810 * PointerArithmetic (Resolve): make sure we are not doing
5811 pointer arith on void*. Also, make sure we are resolved
5812 by not setting eclass until resolve.
5814 All callers: Make sure that PointerArithmetic gets resolved.
5816 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5818 * ArrayCreation (LookupType): If the type does not resolve
5819 to an array, give an error.
5821 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5823 * statement.cs (Try.Resolve): Fixed bug #64222
5825 2004-08-27 Martin Baulig <martin@ximian.com>
5828 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5831 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5833 * ecore.cs (Constantify): Get underlying type via
5834 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5835 Windows in special cases.
5837 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5839 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5840 for obtaining also private methods.
5841 (GetRemoveMethod): Used GetRemoveMethod (true)
5842 for obtaining also private methods.
5844 2004-08-24 Martin Baulig <martin@ximian.com>
5846 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5847 MethodAttributes.HideBySig for operators.
5849 2004-08-23 Martin Baulig <martin@ximian.com>
5851 Back to the old error reporting system :-)
5853 * report.cs (Message): Removed.
5854 (Report.MessageData, ErrorData, WarningData): Removed.
5855 (Report.Error, Warning): Back to the old system.
5857 2004-08-23 Martin Baulig <martin@ximian.com>
5859 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5861 * class.cs (TypeContainer.ParentContainer): New public virtual
5862 method; replaces the explicit interface implementation.
5863 (ClassPart.ParentContainer): Override.
5865 2004-08-23 Martin Baulig <martin@ximian.com>
5867 * statement.cs (Switch): Added support for constant switches; see
5868 #59428 or test-285.cs.
5870 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5873 * statement.cs (GetEnumeratorFilter): Removed useless
5874 logic because C# specs is strict. GetEnumerator must be
5877 2004-08-22 Martin Baulig <martin@ximian.com>
5879 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5880 a switch and may break, reset the barrier. Fixes #59867.
5882 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5884 CLS-Compliance speed up (~5% for corlib)
5886 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5887 New method. Tests container for CLS-Compliant names
5889 * class.cs (TypeContainer.VerifyClsName): New method.
5890 Checks whether container name is CLS Compliant.
5891 (Constructor): Implements IMethodData.
5893 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5894 low-case table for CLS Compliance test.
5895 (MemberCache.VerifyClsParameterConflict): New method.
5896 Checks method parameters for CS3006 error.
5898 * enum.cs (EnumMember): Is derived from MemberCore.
5899 (Enum.VerifyClsName): Optimized for better performance.
5901 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5903 * report.cs: Renamed Error_T to Error and changed all
5906 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5908 * class.cs (TypeContainer.IndexerArrayList): New inner class
5909 container for indexers.
5910 (TypeContainer.DefaultIndexerName): New constant for default
5911 indexer name. Replaced all "Item" with this constant.
5912 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5914 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5915 DefaultMemberAttribute constructor.
5917 2004-08-05 Martin Baulig <martin@ximian.com>
5919 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5922 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5924 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5925 multi platforms problem.
5927 * compiler.csproj: Included shared files.
5929 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5931 Fix bug 60333, 55971 in the more general way
5932 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5933 Added arg_type argument for constant conversion.
5934 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5936 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5939 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5940 OperatorArrayList, MethodCoreArrayList for typecontainer
5941 containers. Changed class member types to these new types.
5942 (MethodArrayList.DefineMembers): Added test for CS0659.
5944 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5946 * cfold.cs: Synchronize the folding with the code in expression.cs
5947 Binary.DoNumericPromotions for uint operands.
5949 * attribute.cs: Revert patch from Raja, it introduced a regression
5950 while building Blam-1.2.1 (hard to isolate a test case).
5952 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5956 (TypeContainer.Define): Renamed to DefineContainerMembers because of
5958 (MethodCore.parent_method): New member. The method we're overriding
5959 if this is an override method.
5960 (MethodCore.CheckBase): Moved from Method class and made common.
5961 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
5963 (MethodCore.CheckForDuplications): New abstract method. For custom
5964 member duplication search in a container
5965 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
5966 method and its return type.
5967 (Event.conflict_symbol): New member. Symbol with same name in the
5971 (MemberCache.FindMemberWithSameName): New method. The method
5972 is looking for conflict with inherited symbols.
5974 2004-08-04 Martin Baulig <martin@ximian.com>
5976 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
5978 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
5980 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5982 * report.cs (Message): New enum for better error, warning reference in
5984 (MessageData): New inner abstract class. It generally handles printing of
5985 error and warning messages.
5986 Removed unused Error, Warning, Message methods.
5988 2004-08-03 Marek Safar <marek.safar@seznam.cz>
5990 Fix for cs0592-8.cs test
5992 (Attributable.ValidAttributeTargets): Made public.
5993 (Attribute.ExplicitTarget): New member for explicit target value.
5994 (Attribute.CheckTargets): Now we translate explicit attribute
5995 target to Target here.
5997 2004-08-03 Ben Maurer <bmaurer@ximian.com>
5999 * ecore.cs (MethodGroupExpr): new IsBase property.
6001 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
6003 * delegate.cs (DelegateCreation): store a MethodGroupExpr
6004 rather than an instance expr.
6006 (DelegateCreation.Emit): Use the method group rather than
6007 the instance expression. Also, if you have base.Foo as the
6008 method for a delegate, make sure to emit ldftn, not ldftnvirt.
6010 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
6012 (NewDelegate.DoResolve): Only check for the existance of Invoke
6013 if the method is going to be needed. Use MethodGroupExpr.
6015 (NewDelegate.Emit): Remove, DelegateCreation implements this.
6017 * expression.cs: For pointer arith., make sure to use
6018 the size of the type, not the size of the pointer to
6021 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6024 * class.cs (Class): Added error CS0502 test.
6026 2004-08-03 John Luke <jluke@cfl.rr.com>
6027 Raja R Harinath <rharinath@novell.com>
6030 * attribute.cs (Attribute.complained_before): New flag.
6031 (Attribute.ResolveType, Attribute.Resolve),
6032 (Attribute.DefinePInvokeMethod): Set it.
6033 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
6035 2004-08-03 Martin Baulig <martin@ximian.com>
6037 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
6038 use a user-defined operator; we still need to do numeric
6039 promotions in case one argument is a builtin type and the other
6040 one has an implicit conversion to that type. Fixes #62322.
6042 2004-08-02 Martin Baulig <martin@ximian.com>
6044 * statement.cs (LocalInfo.Flags): Added `IsThis'.
6045 (LocalInfo.IsThis): New public property.
6046 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
6048 2004-08-01 Martin Baulig <martin@ximian.com>
6050 * class.cs (TypeContainer.GetClassBases): Don't set the default
6051 here since we may get called from GetPartialBases().
6052 (TypeContainer.DefineType): If GetClassBases() didn't return a
6053 parent, use the default one.
6055 2004-07-30 Duncan Mak <duncan@ximian.com>
6057 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
6059 2004-07-30 Martin Baulig <martin@ximian.com>
6061 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
6063 * class.cs (SourceMethod): New public class, derive from the
6064 symbol writer's ISourceMethod.
6065 (Method): Use the new symbol writer API.
6067 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
6068 as argument and use the new symbol writer.
6071 (SourceFile): Implement the symbol writer's ISourceFile.
6072 (Location.SymbolDocument): Removed.
6073 (Location.SourceFile): New public property.
6075 * symbolwriter.cs: Use the new symbol writer API.
6077 2004-07-30 Raja R Harinath <rharinath@novell.com>
6079 * Makefile (install-local): Remove. Functionality moved to
6082 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
6084 * Makefile: Install mcs.exe.config file together with mcs.exe.
6085 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
6086 correct runtime version.
6088 2004-07-25 Martin Baulig <martin@ximian.com>
6091 (TypeContainer.RegisterOrder): Removed, this was unused.
6092 (TypeContainer, interface_order): Removed.
6093 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
6094 TypeContainer as argument since we can also be called with a
6095 `PartialContainer' for a partial class/struct/interface.
6096 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
6097 of checking whether we're an `Interface' - we could be a
6099 (PartialContainer.Register): Override; call
6100 AddClass()/AddStruct()/AddInterface() on our parent.
6102 * cs-parser.jay (interface_member_declaration): Add things to the
6103 `current_container', not the `current_class'.
6105 * rootcontext.cs (RegisterOrder): The overloaded version which
6106 takes an `Interface' was unused, removed.
6108 * typemanager.cs (TypeManager.LookupInterface): Return a
6109 `TypeContainer', not an `Interface'.
6110 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
6111 contain a `PartialContainer' for an interface, so check it's
6112 `Kind' to figure out what it is.
6114 2004-07-25 Martin Baulig <martin@ximian.com>
6116 * class.cs (Class.DefaultTypeAttributes): New public constant.
6117 (Struct.DefaultTypeAttributes): Likewise.
6118 (Interface.DefaultTypeAttributes): Likewise.
6119 (PartialContainer.TypeAttr): Override this and add the
6120 DefaultTypeAttributes.
6122 2004-07-25 Martin Baulig <martin@ximian.com>
6124 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
6125 we can just use the `Parent' field instead.
6127 2004-07-25 Martin Baulig <martin@ximian.com>
6129 * class.cs (TypeContainer.Emit): Renamed to EmitType().
6131 2004-07-25 Martin Baulig <martin@ximian.com>
6133 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
6134 our parts before defining any methods.
6135 (TypeContainer.VerifyImplements): Make this virtual.
6136 (ClassPart.VerifyImplements): Override and call VerifyImplements()
6137 on our PartialContainer.
6139 2004-07-25 Martin Baulig <martin@ximian.com>
6141 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
6143 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
6144 argument, we can just use the `Parent' field instead.
6147 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
6148 (MemberBase.DoDefine): Likewise.
6150 2004-07-24 Martin Baulig <martin@ximian.com>
6152 * decl.cs (MemberCore.Parent): New public field.
6153 (DeclSpace.Parent): Moved to MemberCore.
6155 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
6156 (MemberBase.ctor): Added TypeContainer argument, pass it to our
6158 (FieldBase, Field, Operator): Likewise.
6159 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
6160 (EventField, Event): Likewise.
6162 2004-07-23 Martin Baulig <martin@ximian.com>
6164 * class.cs (PartialContainer): New public class.
6165 (ClassPart): New public class.
6166 (TypeContainer): Added support for partial classes.
6167 (TypeContainer.GetClassBases): Splitted some of the functionality
6168 out into GetNormalBases() and GetPartialBases().
6170 * cs-tokenizer.cs (Token.PARTIAL): New token.
6171 (Tokenizer.consume_identifier): Added some hacks to recognize
6172 `partial', but only if it's immediately followed by `class',
6173 `struct' or `interface'.
6175 * cs-parser.jay: Added support for partial clases.
6177 2004-07-23 Martin Baulig <martin@ximian.com>
6179 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
6180 a `DeclSpace' and also made it readonly.
6181 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
6182 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
6183 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
6185 * cs-parser.jay: Pass the `current_class', not the
6186 `current_container' (at the moment, this is still the same thing)
6187 to a new Method, Property, Event, Indexer or Constructor.
6189 2004-07-23 Martin Baulig <martin@ximian.com>
6191 * cs-parser.jay (CSharpParser): Added a new `current_class' field
6192 and removed the `current_interface' one.
6193 (struct_declaration, class_declaration, interface_declaration):
6194 Set `current_class' to the newly created class/struct/interface;
6195 set their `Bases' and call Register() before parsing their body.
6197 2004-07-23 Martin Baulig <martin@ximian.com>
6199 * class.cs (Kind): New public enum.
6200 (TypeContainer): Made this class abstract.
6201 (TypeContainer.Kind): New public readonly field.
6202 (TypeContainer.CheckDef): New public method; moved here from
6204 (TypeContainer.Register): New public abstract method.
6205 (TypeContainer.GetPendingImplementations): New public abstract
6207 (TypeContainer.GetClassBases): Removed the `is_class' and
6208 `is_iface' parameters.
6209 (TypeContainer.DefineNestedTypes): Formerly known as
6211 (ClassOrStruct): Made this class abstract.
6213 * tree.cs (RootTypes): New public type.
6215 2004-07-20 Martin Baulig <martin@ximian.com>
6217 * tree.cs (Tree.RecordNamespace): Removed.
6218 (Tree.Namespaces): Removed.
6220 * rootcontext.cs (RootContext.IsNamespace): Removed.
6222 * cs-parser.jay (namespace_declaration): Just create a new
6223 NamespaceEntry here.
6225 2004-07-20 Martin Baulig <martin@ximian.com>
6227 * statement.cs (ExceptionStatement): New abstract class. This is
6228 now used as a base class for everyone who's using `finally'.
6229 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
6230 our local variables before using them.
6232 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
6233 virtual method. This is used by Yield.Resolve() to "steal" an
6234 outer block's `finally' clauses.
6235 (FlowBranchingException): The .ctor now takes an ExceptionStatement
6238 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
6239 version which takes an ExceptionStatement. This version must be
6240 used to create exception branchings.
6243 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
6244 (Iterator.EmitMoveNext): Added exception support; protect the
6245 block with a `fault' clause, properly handle 'finally' clauses.
6246 (Iterator.EmitDispose): Run all the `finally' clauses here.
6248 2004-07-20 Martin Baulig <martin@ximian.com>
6250 * iterator.cs: This is the first of a set of changes in the
6251 iterator code. Match the spec more closely: if we're an
6252 IEnumerable, then GetEnumerator() must be called. The first time
6253 GetEnumerator() is called, it returns the current instance; all
6254 subsequent invocations (if any) must create a copy.
6256 2004-07-19 Miguel de Icaza <miguel@ximian.com>
6258 * expression.cs: Resolve the constant expression before returning
6261 2004-07-19 Martin Baulig <martin@ximian.com>
6263 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
6264 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
6265 the return type of the new EmitContext.
6267 2004-07-18 Martin Baulig <martin@ximian.com>
6269 * class.cs (Property.Define): Fix iterators.
6271 * iterators.cs (Iterator.Define): Moved the
6272 `container.AddInterator (this)' call here from the .ctor; only do
6273 it if we resolved successfully.
6275 2004-07-17 Miguel de Icaza <miguel@ximian.com>
6277 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
6278 `true' for preprocessing directives that we parse. The return
6279 value indicates whether we should return to regular tokenizing or
6280 not, not whether it was parsed successfully.
6282 In the past if we were in: #if false ... #line #endif, we would
6283 resume parsing after `#line'. See bug 61604.
6285 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
6286 building: IsEnumType should return true only for enums, not for
6287 enums or System.Enum itself. This fixes #61593.
6289 Likely what happened is that corlib was wrong: mcs depended on
6290 this bug in some places. The bug got fixed, we had to add the
6291 hack, which caused bug 61593.
6293 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
6294 that was a workaround for the older conditions.
6296 2004-07-16 Ben Maurer <bmaurer@ximian.com>
6298 * assign.cs: IAssignMethod has a new interface, as documented
6299 inline. All assignment code now uses this new api.
6301 * ecore.cs, expression.cs: All classes which implement
6302 IAssignMethod now use the new interface.
6304 * expression.cs (Invocation): add a hack to EmitCall so that
6305 IndexerAccess can be the target of a compound assignment without
6306 evaluating its arguments twice.
6308 * statement.cs: Handle changes in Invocation api.
6310 2004-07-16 Martin Baulig <martin@ximian.com>
6312 * iterators.cs: Rewrote this. We're now using one single Proxy
6313 class for both the IEnumerable and the IEnumerator interface and
6314 `Iterator' derives from Class so we can use the high-level API.
6316 * class.cs (TypeContainer.AddIterator): New method.
6317 (TypeContainer.DoDefineType): New protected virtual method, which
6318 is called from DefineType().
6319 (TypeContainer.DoDefineMembers): Call DefineType() and
6320 DefineMembers() on all our iterators.
6321 (TypeContainer.Emit): Call Emit() on all our iterators.
6322 (TypeContainer.CloseType): Call CloseType() on all our iterators.
6324 * codegen.cs (EmitContext.CurrentIterator): New public field.
6326 2004-07-15 Martin Baulig <martin@ximian.com>
6329 (TypeManager.not_supported_exception_type): New type.
6331 2004-07-14 Martin Baulig <martin@ximian.com>
6333 * iterators.cs: Use real error numbers.
6335 2004-07-14 Martin Baulig <martin@ximian.com>
6337 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
6338 requires this to be a System.Collection.IEnumerable and not a
6339 class implementing that interface.
6340 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
6342 2004-07-13 Marek Safar <marek.safar@seznam.cz>
6344 * class.cs: Fixed previous fix, it broke some error tests.
6346 2004-07-12 Martin Baulig <martin@ximian.com>
6348 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
6351 2004-07-09 Miguel de Icaza <miguel@ximian.com>
6353 * assign.cs (LocalTemporary): Add new argument: is_address,If
6354 `is_address' is true, then the value that we store is the address
6355 to the real value, and not the value itself.
6357 * ecore.cs (PropertyExpr): use the new local temporary
6358 stuff to allow us to handle X.Y += z (where X is a struct)
6360 2004-07-08 Martin Baulig <martin@ximian.com>
6362 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
6363 not always return, just like we're doing in Using.Resolve().
6365 2004-07-07 Miguel de Icaza <miguel@ximian.com>
6367 * cs-parser.jay (fixed_statement): flag this as Pinned.
6369 2004-07-06 Miguel de Icaza <miguel@ximian.com>
6371 * typemanager.cs (TypeManager): Removed MakePinned method, this
6372 mechanism is replaced with the .NET 2.x compatible mechanism of
6373 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
6375 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
6376 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
6377 `IsFixed' property which has a different meaning.
6379 2004-07-02 Raja R Harinath <rharinath@novell.com>
6381 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
6382 visible from inside a nested class, not just the names of the
6383 immediately enclosing class.
6386 2004-06-24 Raja R Harinath <rharinath@novell.com>
6388 * expression.cs (BetterConversion): Remove buggy special-case
6389 handling of "implicit constant expression conversions". At this
6390 point, we already know that the conversion is possible -- we're
6391 only checking to see which is better.
6393 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6395 * cs-parser.jay: Added error CS0210 test.
6397 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6399 * cs-parser.jay: Added error CS0134 test.
6401 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6404 * cs-parser.jay: Added error CS0145 test.
6406 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6408 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
6410 2004-06-23 Ben Maurer <bmaurer@ximian.com>
6412 * expression.cs (StackAlloc.Resolve): The argument may not
6413 be a constant; deal with this case.
6415 2004-06-23 Marek Safar <marek.safar@seznam.cz>
6417 * attribute.cs (IndexerName_GetIndexerName): Renamed to
6418 GetIndexerAttributeValue.
6419 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
6421 * class.cs (Indexer.Define): Added error tests for CS0415,
6424 2004-06-23 Miguel de Icaza <miguel@ximian.com>
6426 * attribute.cs (Attribute.Resolve): Keep field code in sync with
6429 2004-06-23 Martin Baulig <martin@ximian.com>
6431 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
6432 neither return nor throw, reset the barrier as well. Fixes #60457.
6434 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
6436 * class.cs : EventAttributes is now set to None by default.
6437 This fixes bug #60459.
6439 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6442 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6443 Don't throw exception but return null (it's sufficient now).
6445 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6447 * typemanager.cs (GetArgumentTypes): Faster implementation.
6449 2004-06-18 Martin Baulig <martin@ximian.com>
6451 * attribute.cs (Attribute.Resolve): Check whether we're an
6452 EmptyCast which a Constant child. Fixes #60333.
6454 2004-06-17 Ben Maurer <bmaurer@ximian.com>
6456 * statement.cs (EmitCollectionForeach): Account for the fact that
6457 not all valuetypes are in areas which we can take the address of.
6458 For these variables, we store to a temporary variable. Also, make
6459 sure that we dont emit a `callvirt' on a valuetype method.
6461 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6463 * expression.cs (StackAlloc.DoReSolve): Added test for
6464 negative parameter (CS0247).
6466 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6469 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
6471 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6474 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
6477 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6479 Fix bug #58254 & cs1555.cs, cs1556.cs
6480 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
6482 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6484 * cs-parser.jay: Added error CS1669 test for indexers.
6486 2004-06-11 Martin Baulig <martin@ximian.com>
6488 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
6489 call this twice: for params and varargs methods.
6491 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6494 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
6496 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6498 * attribute.cs (Attribute.GetValidTargets): Made public.
6501 (AbstractPropertyEventMethod): New class for better code sharing.
6502 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
6504 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
6506 2004-06-11 Raja R Harinath <rharinath@novell.com>
6509 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
6510 that the call to Resolve is part of a MemberAccess.
6511 (Expression.Resolve): Use it for SimpleName resolution.
6512 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
6513 Add 'intermediate' boolean argument.
6514 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
6515 error message when the SimpleName can be resolved ambiguously
6516 between an expression and a type.
6517 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
6519 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
6520 call on the left-side.
6522 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6525 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
6527 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6529 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
6531 2004-06-11 Martin Baulig <martin@ximian.com>
6533 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
6534 varargs methods if applicable.
6536 2004-06-11 Martin Baulig <martin@ximian.com>
6538 * expression.cs (Invocation.EmitCall): Don't use
6539 `method.CallingConvention == CallingConventions.VarArgs' since the
6540 method could also have `CallingConventions.HasThis'.
6542 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6544 * class.cs (Event.GetSignatureForError): Implemented.
6545 Fixed crash in error test cs3010.cs
6547 2004-06-10 Miguel de Icaza <miguel@ximian.com>
6549 * cs-tokenizer.cs: Change the way we track __arglist to be
6550 consistent with the other keywords.
6552 2004-06-09 Miguel de Icaza <miguel@ximian.com>
6554 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
6557 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
6559 * codegen.cs: Check that all referenced assemblies have a strongname
6560 before strongnaming the compiled assembly. If not report error CS1577.
6561 Fix bug #56563. Patch by Jackson Harper.
6562 * typemanager.cs: Added a method to return all referenced assemblies.
6563 Fix bug #56563. Patch by Jackson Harper.
6565 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6568 (Method.ApplyAttributeBuilder): Moved and added conditional
6569 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
6572 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
6574 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6577 * class.cs: (EventField.attribute_targets): Changed default target.
6579 2004-06-08 Martin Baulig <martin@ximian.com>
6581 * expression.cs (Invocation.EmitCall): Enable varargs methods.
6583 2004-06-08 Martin Baulig <martin@ximian.com>
6585 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
6587 2004-06-07 Martin Baulig <martin@ximian.com>
6589 Added support for varargs methods.
6591 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
6594 * cs-parser.jay: Added support for `__arglist'.
6596 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
6598 * expression.cs (Argument.AType): Added `ArgList'.
6599 (Invocation): Added support for varargs methods.
6600 (ArglistAccess): New public class.
6601 (Arglist): New public class.
6603 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
6605 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
6606 a method's top-level block if the method has varargs.
6608 * support.cs (ReflectionParameters, InternalParameters): Added
6609 support for varargs methods.
6611 2004-06-07 Miguel de Icaza <miguel@ximian.com>
6613 * class.cs: Provide location in indexer error report.
6615 * driver.cs: Use standard names.
6617 * namespace.cs: Catch the use of using after a namespace has been
6618 declared also on using aliases.
6620 2004-06-03 Raja R Harinath <rharinath@novell.com>
6623 * typemanager.cs (closure_private_ok, closure_invocation_type)
6624 (closure_qualifier_type, closure_invocation_assembly)
6625 (FilterWithClosure): Move to ...
6626 (Closure): New internal nested class.
6627 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
6628 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
6629 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
6630 (MemberLookup, MemberLookupFailed): Use it.
6631 * expression.cs (New.DoResolve): Treat the lookup for the
6632 constructor as being qualified by the 'new'ed type.
6633 (Indexers.GetIndexersForTypeOrInterface): Update.
6635 2004-06-03 Marek Safar <marek.safar@seznam.cz>
6638 (GetConditionalAttributeValue): New method. Returns
6639 condition of ConditionalAttribute.
6640 (SearchMulti): New method. Returns all attributes of type 't'.
6641 Use it when attribute is AllowMultiple = true.
6642 (IsConditionalMethodExcluded): New method.
6645 (Method.IsExcluded): Implemented. Returns true if method has conditional
6646 attribute and the conditions is not defined (method is excluded).
6647 (IMethodData): Extended interface for ConditionalAttribute support.
6648 (PropertyMethod.IsExcluded): Implemented.
6651 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
6654 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
6657 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
6659 * expression.cs (ArrayCreationExpression): Make this just an
6660 `expression'. It can't be a statement, so the code here was
6663 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6666 * typemanager.cs (GetFullNameSignature): New method for
6669 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6672 * class.cs (MemberBase.GetSignatureForError): New virtual method.
6673 Use this method when MethodBuilder is null.
6674 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
6675 Added test for error CS0626 (MONO reports error for this situation).
6676 (IMethodData.GetSignatureForError): Extended interface.
6678 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6681 (AttributeTester.GetObsoleteAttribute): Returns instance of
6682 ObsoleteAttribute when type is obsolete.
6685 (TypeContainer.VerifyObsoleteAttribute): Override.
6686 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6687 (MethodCode.VerifyObsoleteAttribute): Override.
6688 (MemberBase.VerifyObsoleteAttribute): Override.
6691 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6692 and report proper error.
6695 Delegate.VerifyObsoleteAttribute): Override.
6698 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6699 and report proper error.
6700 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6703 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6707 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6708 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6709 Added test for ObsoleteAttribute.
6712 (Catch): Derived from Statement.
6714 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6716 Fixed bug #59071 & cs0160.cs
6718 * statement.cs (Try.Resolve): Check here whether order of catch
6719 clauses matches their dependencies.
6721 2004-05-31 Miguel de Icaza <miguel@ximian.com>
6723 * Reverted patch to namespace.cs (Use lookuptypedirect). This
6724 caused a regression: #59343. Referencing nested classes from an
6725 assembly stopped working.
6727 2004-05-31 Martin Baulig <martin@ximian.com>
6729 MCS is now frozen for beta 2.
6731 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6733 * convert.cs: add a trivial cache for overload operator resolution.
6735 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6737 * decl.cs: If possible, use lookuptypedirect here. We can only do
6738 this if there is no `.' after the namespace. Avoids using
6739 LookupType, which does lots of slow processing.
6740 (FindNestedType) New method, does what it says :-).
6741 * namespace.cs: use LookupTypeDirect.
6742 * rootcontext.cs: use membercache, if possible.
6743 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6745 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6748 According to the spec,
6750 In a member access of the form E.I, if E is a single identifier,
6751 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6752 field, property, localvariable, or parameter with the same type as
6753 the meaning of E as a type-name (§3.8), then both possible
6754 meanings of E are permitted.
6756 We did not check that E as a simple-name had the same type as E as
6759 This trivial check gives us 5-7% on bootstrap time.
6761 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6763 * expression.cs (Invocation.OverloadResolve): Avoid the
6764 use of hashtables and boxing here by allocating on demand.
6766 2004-05-30 Martin Baulig <martin@ximian.com>
6768 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6769 we're doing a silent lookup. Don't try to lookup nested types in
6770 TypeManager.object_type (thanks to Ben Maurer).
6772 2004-05-30 Martin Baulig <martin@ximian.com>
6774 Committing a patch from Ben Maurer.
6776 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6778 2004-05-29 Martin Baulig <martin@ximian.com>
6780 * class.cs (IMethodData.ShouldIgnore): New method.
6782 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6783 `Location' argument, we don't need it anywhere. Use
6784 `IMethodData.ShouldIgnore ()' instead of
6785 `MethodData.GetMethodFlags ()'.
6786 (TypeManager.AddMethod): Removed.
6787 (TypeManager.AddMethod2): Renamed to AddMethod.
6789 2004-05-29 Martin Baulig <martin@ximian.com>
6791 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6793 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6794 converting from a class type S to an interface type and we already
6795 have an object on the stack, don't box it again. Fixes #52578.
6797 2004-05-29 Martin Baulig <martin@ximian.com>
6799 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6800 Added support for `params' parameters. Fixes #59267.
6802 2004-05-29 Martin Baulig <martin@ximian.com>
6804 * literal.cs (NullPointer): Provide a private .ctor which sets
6805 `type' to TypeManager.object_type. Fixes #59048.
6807 2004-05-29 Martin Baulig <martin@ximian.com>
6809 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6810 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6812 * ecore.cs (EventExpr.instance_expr): Make the field private.
6814 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6816 Fixed bug #50080 & cs0214-2.cs
6817 * expression.cs (Cast.DoResolve): Check unsafe context here.
6819 * statement.cs (Resolve.DoResolve): Likewise.
6821 2004-05-26 Martin Baulig <martin@ximian.com>
6823 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6825 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6826 (RootContext.LookupType): Pass down the `silent' flag.
6828 2004-05-25 Martin Baulig <martin@ximian.com>
6831 (MethodGroupExpr.IdenticalTypeName): New public property.
6832 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6833 expression actually refers to a type.
6835 2004-05-25 Martin Baulig <martin@ximian.com>
6837 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6838 for #56176 and made it actually work.
6840 2004-05-25 Martin Baulig <martin@ximian.com>
6842 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6843 (FieldExpr, PropertyExpr): Override and implement
6844 CacheTemporaries. Fixes #52279.
6846 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6848 * location.cs: In the new compiler listing a file twice is a
6849 warning, not an error.
6851 2004-05-24 Martin Baulig <martin@ximian.com>
6853 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6854 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6856 2004-05-24 Martin Baulig <martin@ximian.com>
6858 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6859 walking the `using' list. Fixes #53921.
6861 2004-05-24 Martin Baulig <martin@ximian.com>
6863 * const.cs (Const.LookupConstantValue): Added support for
6864 EmptyCast's; fixes #55251.
6866 2004-05-24 Martin Baulig <martin@ximian.com>
6868 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6869 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6870 which does the CS0135 check. The reason is that we first need to
6871 check whether the variable actually exists.
6873 2004-05-24 Martin Baulig <martin@ximian.com>
6875 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6876 than RootContext.LookupType() to find the explicit interface
6879 2004-05-24 Raja R Harinath <rharinath@novell.com>
6881 * Makefile: Simplify. Use executable.make.
6882 * mcs.exe.sources: New file. List of sources of mcs.exe.
6884 2004-05-24 Anders Carlsson <andersca@gnome.org>
6888 Use the invariant culture when doing String.Compare for CLS case
6891 2004-05-23 Martin Baulig <martin@ximian.com>
6893 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6894 don't have any dots. Fixes #52622, added cs0246-8.cs.
6896 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6898 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6900 * class.cs (MemberBase.Define): Reuse MemberType member for
6901 resolved type. Other methods can use it too.
6903 2004-05-23 Martin Baulig <martin@ximian.com>
6905 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6906 the variable also exists in the current block (otherwise, we need
6907 to report a CS0103). Fixes #58670.
6909 2004-05-23 Martin Baulig <martin@ximian.com>
6911 * flowanalysis.cs (Reachability.Reachable): Compute this
6912 on-the-fly rather than storing it as a field.
6914 2004-05-23 Martin Baulig <martin@ximian.com>
6916 * flowanalysis.cs (Reachability.And): Manually compute the
6917 resulting `barrier' from the reachability.
6919 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6922 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6923 instance of ObsoleteAttribute when symbol is obsolete.
6926 (IMethodData): Extended interface for ObsoleteAttribute support.
6928 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6930 * attribute.cs: Fix bug #55970
6932 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6936 (GetObsoleteAttribute): New method. Creates the instance of
6938 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6939 ObsoleteAttribute when member is obsolete.
6940 (AttributeTester.Report_ObsoleteMessage): Common method for
6941 Obsolete error/warning reporting.
6944 (TypeContainer.base_classs_type): New member for storing parent type.
6947 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6948 for this MemberCore.
6950 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6952 * attribute.cs, const.cs: Fix bug #58590
6954 2004-05-21 Martin Baulig <martin@ximian.com>
6956 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
6957 out parameters if the end of the method is unreachable. Fixes
6960 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6962 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
6963 Hari was right, why extra method.
6965 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6967 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
6969 2004-05-20 Martin Baulig <martin@ximian.com>
6971 Merged this back from gmcs to keep the differences to a minumum.
6973 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
6974 instead of a Declspace.
6975 (Attribute.ResolveType): Likewise.
6976 (Attributes.Search): Likewise.
6977 (Attributes.Contains): Likewise.
6978 (Attributes.GetClsCompliantAttribute): Likewise.
6980 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
6982 (MethodData.ApplyAttributes): Take an EmitContext instead of a
6985 2004-05-19 Marek Safar <marek.safar@seznam.cz>
6987 Fix bug #58688 (MCS does not report error when the same attribute
6990 * attribute.cs (Attribute.Emit): Distinction between null and default.
6992 2004-05-19 Raja R Harinath <rharinath@novell.com>
6994 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
6995 of a top-level attribute without an attribute target.
6996 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
6998 (Attribute.Conditional_GetConditionName),
6999 (Attribute.Obsolete_GetObsoleteMessage): Update.
7000 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
7001 part of ScanForIndexerName.
7002 (Attribute.CanIgnoreInvalidAttribute): New function.
7003 (Attribute.ScanForIndexerName): Move to ...
7004 (Attributes.ScanForIndexerName): ... here.
7005 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
7006 (Attributes.Search): New internal variant that can choose not to
7007 complain if types aren't resolved. The original signature now
7009 (Attributes.GetClsCompliantAttribute): Use internal variant, with
7010 complaints suppressed.
7011 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
7012 only if it not useful.
7013 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
7014 top-level for attributes that are shared between the assembly
7015 and a top-level class.
7016 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
7017 * class.cs: Update to reflect changes.
7018 (DefineIndexers): Fuse loops.
7019 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
7020 a couple more variants of attribute names.
7022 2004-05-18 Marek Safar <marek.safar@seznam.cz>
7024 Fix bug #52585 (Implemented explicit attribute declaration)
7027 (Attributable.ValidAttributeTargets): New abstract method. It gets
7028 list of valid attribute targets for explicit target declaration.
7029 (Attribute.Target): It holds target itself.
7030 (AttributeSection): Removed.
7031 (Attribute.CheckTargets): New method. It checks whether attribute
7032 target is valid for the current element.
7035 (EventProperty): New class. For events that are declared like
7036 property (with add and remove accessors).
7037 (EventField): New class. For events that are declared like field.
7040 * cs-parser.jay: Implemented explicit attribute target declaration.
7042 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
7043 Override ValidAttributeTargets.
7046 (ReturnParameter): Class for applying custom attributes on
7048 (ParameterAtribute): New class. Class for applying custom
7049 attributes on the parameter type.
7051 2004-05-17 Miguel de Icaza <miguel@ximian.com>
7053 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
7056 (Method): Allow UNSAFE here.
7058 * modifiers.cs: Support unsafe reporting.
7060 2004-05-17 Marek Safar <marek.safar@seznam.cz>
7062 * decl.cs: Fix bug #58478.
7064 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7066 * statement.cs: When checking for unreachable code on an EmptyStatement,
7067 set the location. Fixes bug #58488.
7069 2004-05-13 Miguel de Icaza <miguel@ximian.com>
7071 * driver.cs: Add -pkg handling.
7073 From Gonzalo: UseShelLExecute=false
7075 2004-05-12 Marek Safar <marek.safar@seznam.cz>
7078 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
7080 (Attribute.IsClsCompliaceRequired): Moved to base for better
7082 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
7083 when attribute is AttributeUsageAttribute.
7084 (Attribute.GetValidTargets): Simplified.
7085 (Attribute.GetAttributeUsage): New method returns AttributeUsage
7086 attribute for this type.
7087 (Attribute.ApplyAttributes): Method renamed to Emit and make
7089 (GlobalAttributeSection): New class for special handling of global
7090 attributes (assembly, module).
7091 (AttributeSection.Emit): New method.
7093 * class.cs: Implemented Attributable abstract methods.
7094 (MethodCore.LabelParameters): Moved to Parameter class.
7095 (Accessor): Is back simple class.
7096 (PropertyMethod): Implemented Attributable abstract class.
7097 (DelegateMethod): Implemented Attributable abstract class.
7098 (Event): New constructor for disctintion between normal Event
7099 and Event with accessors.
7101 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
7103 * codegen.cs, const.cs, decl.cs, delegate.cs:
7104 (CommonAssemblyModulClass): Implemented Attributable abstract class
7107 * enum.cs: Implement IAttributeSupport interface.
7108 (EnumMember): New class for emum members. Implemented Attributable
7112 (ParameterBase): Is abstract.
7113 (ReturnParameter): New class for easier [return:] attribute handling.
7115 * typemanager.cs: Removed builder_to_attr.
7117 2004-05-11 Raja R Harinath <rharinath@novell.com>
7120 * attribute.cs (Attribute.GetPositionalValue): New function.
7121 * class.cs (TypeContainer.VerifyMembers): New function.
7122 (TypeContainer.Emit): Use it.
7123 (ClassOrStruct): New base class for Class and Struct.
7124 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
7125 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
7127 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
7128 then each non-static field should have a FieldOffset attribute.
7129 Otherwise, none of the fields should have a FieldOffset attribute.
7130 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
7131 and FieldOffset attributes.
7132 * typemanager.cs (TypeManager.struct_layout_attribute_type)
7133 (TypeManager.field_offset_attribute_type): New core types.
7134 (TypeManager.InitCoreTypes): Initialize them.
7136 2004-05-11 Michal Moskal <malekith@pld-linux.org>
7138 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
7139 Return correct type.
7142 2004-05-09 Miguel de Icaza <miguel@ximian.com>
7144 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
7145 be implicitly converted to ulong.
7147 * expression.cs: The logic for allowing operator &, | and ^ worked
7148 was wrong, it worked before because we did not report an error in
7149 an else branch. Fixes 57895.
7151 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
7152 allow volatile fields to be reference types.
7154 2004-05-07 Miguel de Icaza <miguel@ximian.com>
7156 * driver.cs: Add support for /debug-
7158 2004-05-07 Raja R Harinath <rharinath@novell.com>
7160 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
7161 Add a 'complain' parameter to silence errors.
7162 (Attribute.Resolve): Update to changes. Put in sanity check to catch
7163 silently overlooked type-resolutions.
7164 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
7166 (Attributes.Search): New function.
7167 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
7168 (Attributes.GetAttributeFullName): Remove hack.
7169 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
7170 Update to reflect changes.
7171 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
7172 Use Attributes.Search instead of nested loops.
7174 2004-05-07 Marek Safar <marek.safar@seznam.cz>
7177 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
7178 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
7179 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
7181 * report.cs: (Report.Warning): Renamed to Warning_T because of
7182 parameter collision.
7184 2004-05-05 Raja R Harinath <rharinath@novell.com>
7186 * expression.cs (MemberAccess.ResolveMemberAccess):
7187 Exit with non-zero status after Report.Error.
7188 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
7190 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
7192 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7194 * support.cs: Don't hang when the file is empty.
7196 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7198 * support.cs: In SeekableStreamReader, compute the preamble size of the
7199 underlying stream. Position changes should take into account that initial
7202 2004-05-03 Todd Berman <tberman@sevenl.net>
7204 * driver.cs: remove unused GetSysVersion function.
7206 2004-05-03 Todd Berman <tberman@sevenl.net>
7208 * driver.cs: Remove the hack from saturday, as well as the hack
7209 from jackson (LoadAssemblyFromGac), also adds the CWD to the
7210 link_paths to get that bit proper.
7212 2004-05-01 Todd Berman <tberman@sevenl.net>
7214 * driver.cs: Try a LoadFrom before a Load, this checks the current
7215 path. This is currently a bug in mono that is be fixed, however, this
7216 provides a workaround for now. This will be removed when the bug
7219 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
7221 * CryptoConvert.cs: Updated to latest version. Fix issue with
7222 incomplete key pairs (#57941).
7224 2004-05-01 Todd Berman <tberman@sevenl.net>
7226 * driver.cs: Remove '.' from path_chars, now System.* loads properly
7229 2004-04-30 Jackson Harper <jackson@ximian.com>
7231 * codegen.cs: Open keys readonly.
7233 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7235 * typemanager.cs: don't report cyclic struct layout when a struct
7236 contains 2 or more fields of the same type. Failed for Pango.AttrShape
7237 which has 2 Pango.Rectangle fields.
7239 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
7241 * expression.cs: Handle IntPtr comparisons with IL code
7242 rather than a method call.
7244 2004-04-29 Martin Baulig <martin@ximian.com>
7246 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
7247 the list of PropertyInfo's in class hierarchy and find the
7248 accessor. Fixes #56013.
7250 2004-04-29 Martin Baulig <martin@ximian.com>
7252 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
7254 2004-04-29 Martin Baulig <martin@ximian.com>
7256 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7258 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
7260 2004-04-29 Martin Baulig <martin@ximian.com>
7262 * class.cs (ConstructorInitializer.Resolve): Check whether the
7263 parent .ctor is accessible. Fixes #52146.
7265 2004-04-29 Martin Baulig <martin@ximian.com>
7267 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7269 * statement.cs (Using.EmitLocalVariableDecls): Use
7270 TypeManager.idisposable_type, not typeof (IDisposable).
7271 (Foreach.EmitCollectionForeach): Added support for valuetypes.
7273 2004-04-29 Martin Baulig <martin@ximian.com>
7275 * class.cs (Event.Define): Don't emit the field and don't set
7276 RTSpecialName and SpecialName for events on interfaces. Fixes
7279 2004-04-29 Raja R Harinath <rharinath@novell.com>
7281 Refactor Attribute.ApplyAttributes.
7282 * attribute.cs (Attributable): New base class for objects that can
7283 have Attributes applied on them.
7284 (Attribute): Make AttributeUsage fields public.
7285 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
7286 (Attribute.IsInternalCall): New property.
7287 (Attribute.UsageAttr): Convert to a public read-only property.
7288 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
7289 (Attribute.ResolveType, Attribute.Resolve)
7290 (Attribute.ScanForIndexerName): Update to reflect changes.
7291 (Attribute.CheckAttributeTarget): Re-format.
7292 (Attribute.ApplyAttributes): Refactor, to various
7293 Attributable.ApplyAttributeBuilder methods.
7294 * decl.cs (MemberCore): Make Attributable.
7295 * class.cs (Accessor): Make Attributable.
7296 (MethodData.ApplyAttributes): Use proper attribute types, not
7298 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
7299 (TypeContainer.ApplyAttributeBuilder)
7300 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
7301 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
7302 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
7303 (Operator.ApplyAttributeBuilder): New factored-out methods.
7304 * const.cs (Const.ApplyAttributeBuilder): Likewise.
7305 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
7306 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
7307 * parameter.cs (ParameterBase): New Attributable base class
7308 that can also represent Return types.
7309 (Parameter): Update to the changes.
7311 2004-04-29 Jackson Harper <jackson@ximian.com>
7313 * driver.cs: Prefer the corlib system version when looking for
7314 assemblies in the GAC. This is still a hack, but its a better hack
7317 2004-04-29 Marek Safar <marek.safar@seznam.cz>
7319 * decl.cs, enum.cs: Improved error 3005 reporting.
7321 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
7322 (related_symbols): New private member for list of symbols
7323 related to reported error/warning.
7325 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
7327 2004-04-29 Martin Baulig <martin@ximian.com>
7329 * ecore.cs (Expression.Constantify): If we're an enum and
7330 TypeManager.TypeToCoreType() doesn't give us another type, use
7331 t.UnderlyingSystemType. Fixes #56178.
7333 2004-04-29 Martin Baulig <martin@ximian.com>
7335 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
7336 interfaces and for each interface, only add members directly
7337 declared in that interface. Fixes #53255.
7339 2004-04-28 Martin Baulig <martin@ximian.com>
7341 * expression.cs (ConditionalLogicalOperator): Use a temporary
7342 variable for `left' to avoid that we evaluate it more than once;
7345 2004-04-28 Martin Baulig <martin@ximian.com>
7347 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
7350 2004-04-28 Martin Baulig <martin@ximian.com>
7352 * statement.cs (LocalInfo.Resolve): Check whether the type is not
7355 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
7356 whether the type is not void (CS1547).
7358 2004-04-28 Martin Baulig <martin@ximian.com>
7360 * expression.cs (Unary.DoResolveLValue): Override this and report
7361 CS0131 for anything but Operator.Indirection.
7363 2004-04-28 Martin Baulig <martin@ximian.com>
7365 Committing a patch from Ben Maurer; see bug #50820.
7367 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7370 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7373 2004-04-28 Martin Baulig <martin@ximian.com>
7375 Committing a patch from Ben Maurer; see bug #50820.
7377 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7380 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7383 2004-04-28 Martin Baulig <martin@ximian.com>
7385 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
7386 (Block.AddLabel): Call DoLookupLabel() to only search in the
7389 2004-04-28 Martin Baulig <martin@ximian.com>
7391 * cfold.cs (ConstantFold.BinaryFold): Added special support for
7392 comparing StringConstants and NullLiterals in Equality and Inequality.
7394 2004-04-28 Jackson Harper <jackson@ximian.com>
7396 * driver.cs: Attempt to load referenced assemblies from the
7397 GAC. This is the quick and dirty version of this method that
7398 doesnt take into account versions and just takes the first
7399 canidate found. Will be good enough for now as we will not have more
7400 then one version installed into the GAC until I update this method.
7402 2004-04-28 Martin Baulig <martin@ximian.com>
7404 * typemanager.cs (TypeManager.CheckStructCycles): New public
7405 static method to check for cycles in the struct layout.
7407 * rootcontext.cs (RootContext.PopulateTypes): Call
7408 TypeManager.CheckStructCycles() for each TypeContainer.
7409 [Note: We only need to visit each type once.]
7411 2004-04-28 Martin Baulig <martin@ximian.com>
7413 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
7415 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
7416 success and added `out object value'. Use a `bool resolved' field
7417 to check whether we've already been called rather than
7418 `ConstantValue != null' since this breaks for NullLiterals.
7420 2004-04-28 Raja R Harinath <rharinath@novell.com>
7422 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
7423 setting of this flag, since the 'set' method may be non-public.
7425 2004-04-28 Raja R Harinath <rharinath@novell.com>
7427 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
7428 check on current_vector.Block.
7430 2004-04-27 Martin Baulig <martin@ximian.com>
7432 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
7433 a field initializer. Fixes #56459.
7435 2004-04-27 Martin Baulig <martin@ximian.com>
7437 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
7438 we're not attempting to use an indexer. Fixes #52154.
7440 2004-04-27 Martin Baulig <martin@ximian.com>
7442 * statement.cs (Return): Don't create a return label if we don't
7443 need it; reverts my change from January 20th. Thanks to Ben
7446 2004-04-27 Martin Baulig <martin@ximian.com>
7448 According to the spec, `goto' can only leave a nested scope, but
7451 * statement.cs (Block.LookupLabel): Only lookup in the current
7452 block, don't recurse into parent or child blocks.
7453 (Block.AddLabel): Check in parent and child blocks, report
7454 CS0140/CS0158 if we find a duplicate.
7455 (Block): Removed this indexer for label lookups.
7456 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
7457 this already does the error reporting for us.
7460 (FlowBranching.UsageVector.Block): New public variable; may be null.
7461 (FlowBranching.CreateSibling): Added `Block' argument.
7462 (FlowBranching.LookupLabel): New public virtual method. Lookup a
7463 label for the target of a `goto' and check whether we're not
7464 leaving a `finally'.
7466 2004-04-27 Martin Baulig <martin@ximian.com>
7468 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7469 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
7472 2004-04-27 Martin Baulig <martin@ximian.com>
7474 * statement.cs (Block.AddLabel): Also check for implicit blocks
7475 and added a CS0158 check.
7477 2004-04-27 Martin Baulig <martin@ximian.com>
7479 * flowanalysis.cs (FlowBranchingLoop): New class.
7480 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
7481 UsageVector's instead of an ArrayList.
7482 (FlowBranching.Label): Likewise.
7483 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
7484 (FlowBranching.AddBreakVector): New method.
7486 2004-04-27 Miguel de Icaza <miguel@ximian.com>
7488 * attribute.cs: Small regression fix: only convert the type if we
7489 the type is different, fixes System.Drawing build.
7491 2004-04-27 Martin Baulig <martin@ximian.com>
7493 * attribute.cs (Attribute.Resolve): If we have a constant value
7494 for a named field or property, implicity convert it to the correct
7497 2004-04-27 Raja R Harinath <rharinath@novell.com>
7499 * statement.cs (Block.Block): Implicit blocks share
7500 'child_variable_names' fields with parent blocks.
7501 (Block.AddChildVariableNames): Remove.
7502 (Block.AddVariable): Mark variable as "used by a child block" in
7503 every surrounding block.
7504 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
7505 been used in a child block, complain about violation of "Invariant
7506 meaning in blocks" rule.
7507 * cs-parser.jay (declare_local_variables): Don't use
7508 AddChildVariableNames.
7509 (foreach_statement): Don't create an implicit block: 'foreach'
7512 2004-04-23 Miguel de Icaza <miguel@ximian.com>
7514 * convert.cs (ImplicitNumericConversion): 0 is also positive when
7515 converting from 0L to ulong. Fixes 57522.
7517 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7519 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
7520 derived class hides via 'new' keyword field from base class (test-242.cs).
7521 TODO: Handle this in the more general way.
7523 * class.cs (CheckBase): Ditto.
7525 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7527 * decl.cs (caching_flags): New member for storing cached values
7529 (MemberCore.Flags): New enum where bit flags for caching_flags
7531 (MemberCore.cls_compliance): Moved to caching_flags.
7532 (DeclSpace.Created): Moved to caching_flags.
7534 * class.cs: Use caching_flags instead of DeclSpace.Created
7536 2004-04-21 Miguel de Icaza <miguel@ximian.com>
7538 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
7539 if we are only a derived class, not a nested class.
7541 * typemanager.cs: Same as above, but do this at the MemberLookup
7542 level (used by field and methods, properties are handled in
7543 PropertyExpr). Allow for the qualified access if we are a nested
7546 2004-04-21 Marek Safar <marek.safar@seznam.cz>
7548 * class.cs: Refactoring.
7549 (IMethodData): New inteface; Holds links to parent members
7550 to avoid member duplication (reduced memory allocation).
7551 (Method): Implemented IMethodData interface.
7552 (PropertyBase): New inner classes for get/set methods.
7553 (PropertyBase.PropertyMethod): Implemented IMethodData interface
7554 (Event): New inner classes for add/remove methods.
7555 (Event.DelegateMethod): Implemented IMethodData interface.
7557 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7558 EmitContext (related to class.cs refactoring).
7560 2004-04-21 Raja R Harinath <rharinath@novell.com>
7562 * delegate.cs (Delegate.VerifyApplicability): If the number of
7563 arguments are the same as the number of parameters, first try to
7564 verify applicability ignoring any 'params' modifier on the last
7568 2004-04-16 Raja R Harinath <rharinath@novell.com>
7570 * class.cs (TypeContainer.AddIndexer): Use
7571 'ExplicitInterfaceName' to determine if interface name was
7572 explicitly specified. 'InterfaceType' is not initialized at this time.
7573 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7574 Indexers array is already in the required order. Initialize
7575 'IndexerName' only if there are normal indexers.
7576 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7577 (TypeContainer.Emit): Emit DefaultMember attribute only if
7578 IndexerName is initialized.
7581 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7583 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7586 2004-04-15 Raja R Harinath <rharinath@novell.com>
7588 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7592 * attribute.cs (Attribute.Resolve): Check for duplicate named
7596 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7598 * iterators.cs (MarkYield): track whether we are in an exception,
7599 and generate code accordingly. Use a temporary value to store the
7600 result for our state.
7602 I had ignored a bit the interaction of try/catch with iterators
7603 since their behavior was not entirely obvious, but now it is
7604 possible to verify that our behavior is the same as MS .NET 2.0
7608 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7610 * iterators.cs: Avoid creating temporaries if there is no work to
7613 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7614 Enumerations, use TypeManager.EnumToUnderlying and call
7617 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7620 (This.Emit): Use EmitContext.EmitThis to emit our
7623 (This.EmitAssign): Ditto.
7625 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7626 codepaths, we will move all the functionality into
7629 (FieldExpr.EmitAssign): Ditto.
7631 This fixes several hidden bugs that I uncovered while doing a code
7632 review of this today.
7634 * codegen.cs (EmitThis): reworked so the semantics are more clear
7635 and also support value types "this" instances.
7637 * iterators.cs: Changed so that for iterators in value types, we
7638 do not pass the value type as a parameter.
7640 Initialization of the enumerator helpers is now done in the caller
7641 instead of passing the parameters to the constructors and having
7642 the constructor set the fields.
7644 The fields have now `assembly' visibility instead of private.
7646 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7648 * expression.cs (Argument.Resolve): Check if fields passed as ref
7649 or out are contained in a MarshalByRefObject.
7651 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7652 another compiler type.
7654 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7656 * class.cs (Indexer.Define): use the new name checking method.
7657 Also, return false on an error.
7658 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7659 (is_identifier_[start/part]_character): make static.
7661 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7663 * expression.cs (Binary.ResolveOperator): Do no append strings
7664 twice: since we can be invoked more than once (array evaluation)
7665 on the same concatenation, take care of this here. Based on a fix
7666 from Ben (bug #56454)
7668 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7670 * codegen.cs: Fix another case where CS1548 must be reported (when
7671 delay-sign isn't specified and no private is available #56564). Fix
7672 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7673 error when MCS is used on the MS runtime and we need to delay-sign
7674 (which seems unsupported by AssemblyBuilder - see #56621).
7676 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7678 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7679 (TypeManager.ComputeNamespaces): Faster implementation for
7682 * compiler.csproj: Updated AssemblyName to mcs.
7684 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7686 * rootcontext.cs: Add new types to the boot resolution.
7688 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7689 MulticastDelegate is not allowed.
7691 * typemanager.cs: Add new types to lookup: System.TypedReference
7694 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7695 check for TypedReference or ArgIterator, they are not allowed.
7697 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7698 makes us properly catch 1510 in some conditions (see bug 56016 for
7701 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7703 * CryptoConvert.cs: update from corlib version
7706 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7708 * class.cs (Indexer.Define): Check indexername declaration
7710 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7712 * attribute.cs (IsClsCompliant): Fixed problem with handling
7713 all three states (compliant, not-compliant, undetected).
7715 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7717 * attribute.cs (Attribute): Location is now public.
7718 (Resolve): Store resolved arguments (pos_values) in attribute class.
7719 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7720 (GetClsCompliantAttributeValue): New method that gets
7721 CLSCompliantAttribute value.
7722 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7723 if exists else null.
7724 (AttributeTester): New class for CLS-Compliant verification routines.
7726 * class.cs (Emit): Add CLS-Compliant verification.
7727 (Method.GetSignatureForError): Implemented.
7728 (Constructor.GetSignatureForError): Implemented
7729 (Constructor.HasCompliantArgs): Returns if constructor has
7730 CLS-Compliant arguments.
7731 (Constructor.Emit): Override.
7732 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7733 is needed to test only parameters.
7734 (FieldBase.GetSignatureForError): Implemented.
7735 (TypeContainer): New member for storing base interfaces.
7736 (TypeContainer.FindMembers): Search in base interfaces too.
7738 * codegen.cs (GetClsComplianceAttribute): New method that gets
7739 assembly or module CLSCompliantAttribute value.
7740 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7742 (ModuleClass.Emit): Add error 3012 test.
7744 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7746 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7747 state for all decl types.
7748 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7749 if CLS-Compliant tests are required.
7750 (IsClsCompliaceRequired): New method. Analyze whether code
7751 must be CLS-Compliant.
7752 (IsExposedFromAssembly): New method. Returns true when MemberCore
7753 is exposed from assembly.
7754 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7755 value or gets cached value.
7756 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7757 is explicitly marked with CLSCompliantAttribute.
7758 (IsIdentifierClsCompliant): New abstract method. This method is
7759 used to testing error 3005.
7760 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7761 for identifier and parameters CLS-Compliant testing.
7762 (VerifyClsCompliance): New method. The main virtual method for
7763 CLS-Compliant verifications.
7764 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7765 null. I don't know why is null (too many public members !).
7766 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7767 and get value of first CLSCompliantAttribute that found.
7769 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7770 (VerifyClsCompliance): Override and add extra tests.
7772 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7773 clscheck- disable CLS-Compliant verification event if assembly is has
7774 CLSCompliantAttribute(true).
7776 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7777 ApllyAttribute is now called in emit section as in the other cases.
7778 Possible future Emit integration.
7779 (IsIdentifierClsCompliant): New override.
7780 (VerifyClsCompliance): New override.
7781 (GetEnumeratorName): Returns full enum name.
7783 * parameter.cs (GetSignatureForError): Implemented.
7785 * report.cs (WarningData): New struct for Warning message information.
7786 (LocationOfPreviousError): New method.
7787 (Warning): New method. Reports warning based on the warning table.
7788 (Error_T): New method. Reports error based on the error table.
7790 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7791 verifications are done here.
7793 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7795 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7796 CLSCompliantAttribute.
7797 (all_imported_types): New member holds all imported types from other
7799 (LoadAllImportedTypes): New method fills static table with exported types
7800 from all referenced assemblies.
7801 (Modules): New property returns all assembly modules.
7803 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7805 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7806 throwing a parser error.
7808 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7809 which removes the hardcoded get_/set_ prefixes for properties, as
7810 IL allows for the properties to be named something else.
7814 * expression.cs: Do not override operand before we know if it is
7817 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7819 * typemanager.cs: support for pinned variables.
7821 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7823 * decl.cs, typemanager.cs: Avoid using an arraylist
7824 as a buffer if there is only one result set.
7826 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7828 * expression.cs: Make sure you cant call a static method
7829 with an instance expression, bug #56174.
7831 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7833 * class.cs (IsDuplicateImplementation): Improve error reporting to
7834 flag 663 (method only differs in parameter modifier).
7836 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7837 in preprocessor directives.
7839 * location.cs (LookupFile): Allow for the empty path.
7841 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7842 better approach for some of that patch, but its failing with the
7843 CharSet enumeration. For now try/catch will do.
7845 * typemanager.cs: Do not crash if a struct does not have fields.
7848 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7850 * expression.cs: cs0213, cant fix a fixed expression.
7853 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7855 * cs-parser.jay: detect invalid embeded statements gracefully.
7858 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7860 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7863 the invocation type may not be a subclass of the tye of the item/
7864 The type of the item must be a subclass of the invocation item.
7869 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7871 * attribute.cs: Added methods to get a string and a bool from an
7872 attribute. Required to information from AssemblyKeyFileAttribute,
7873 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7874 * codegen.cs: Modified AssemblyName creation to include support for
7875 strongnames. Catch additional exceptions to report them as CS1548.
7876 * compiler.csproj: Updated include CryptoConvert.cs.
7877 * compiler.csproj.user: Removed file - user specific configuration.
7878 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7879 Mono.Security assembly. The original class is maintained and tested in
7880 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7881 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7882 like CSC 8.0 (C# v2) supports.
7883 * Makefile: Added CryptoConvert.cs to mcs sources.
7884 * rootcontext.cs: Added new options for strongnames.
7886 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7888 * driver.cs: For --expect-error, report error code `2'
7889 if the program compiled with no errors, error code `1' if
7890 it compiled with an error other than the one expected.
7892 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7894 * compiler.csproj: Updated for Visual Studio .NET 2003.
7895 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7896 * compiler.sln: Updated for Visual Studio .NET 2003.
7898 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7900 * expression.cs: Fix bug #47234. We basically need to apply the
7901 rule that we prefer the conversion of null to a reference type
7902 when faced with a conversion to 'object' (csc behaviour).
7904 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7906 * statement.cs: Shorter form for foreach, eliminates
7907 a local variable. r=Martin.
7909 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7911 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7912 checks if we can use brtrue/brfalse to test for 0.
7913 * expression.cs: use the above in the test for using brtrue/brfalse.
7916 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7918 * expression.cs: Rewrite string concat stuff. Benefits:
7920 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7921 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7922 rather than a concat chain.
7924 * typemanager.cs: Add lookups for more concat overloads.
7926 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7928 * expression.cs: Emit shorter il code for array init.
7945 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7947 * statement.cs: Before, two switch blocks would be merged if the
7948 total size of the blocks (end_item - begin_item + 1) was less than
7949 two times the combined sizes of the blocks.
7951 Now, it will only merge if after the merge at least half of the
7956 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
7958 * class.cs : csc build fix for GetMethods(). See bug #52503.
7960 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
7962 * expression.cs: Make sure fp comparisons work with NaN.
7963 This fixes bug #54303. Mig approved this patch a long
7964 time ago, but we were not able to test b/c the runtime
7967 2004-03-19 Miguel de Icaza <miguel@ximian.com>
7969 * ecore.cs (TypExpr.GetHashCode): implement this overload.
7971 2004-03-19 Martin Baulig <martin@ximian.com>
7973 * class.cs (MemberCore.IsDuplicateImplementation): Report the
7974 error here and not in our caller.
7976 2004-03-19 Martin Baulig <martin@ximian.com>
7978 * interface.cs: Completely killed this file.
7979 (Interface): We're now a TypeContainer and live in class.cs.
7981 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
7982 argument; we're now also called for interfaces.
7983 (TypeContainer.DefineMembers): Allow this method being called
7985 (TypeContainer.GetMethods): New public method; formerly known as
7986 Interface.GetMethod(). This is used by PendingImplementation.
7987 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
7988 it's now private and non-static.
7989 (Interface): Moved this here; it's now implemented similar to
7991 (Method, Property, Event, Indexer): Added `bool is_interface'
7992 argument to their .ctor's.
7993 (MemberBase.IsInterface): New public field.
7995 * cs-parser.jay: Create normal Method, Property, Event, Indexer
7996 instances instead of InterfaceMethod, InterfaceProperty, etc.
7997 (opt_interface_base): Removed; we now use `opt_class_base' instead.
7998 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
8000 2004-03-19 Martin Baulig <martin@ximian.com>
8002 * class.cs (MethodCore.IsDuplicateImplementation): New private
8003 method which does the CS0111 checking.
8004 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
8005 Use IsDuplicateImplementation().
8007 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
8009 * decl.cs (FindMemberToOverride): New method to find the correct
8010 method or property to override in the base class.
8012 - Make Method/Property use the above method to find the
8013 version in the base class.
8014 - Remove the InheritableMemberSignatureCompare as it is now
8017 This patch makes large code bases much faster to compile, as it is
8018 O(n) rather than O(n^2) to do this validation.
8020 Also, it fixes bug 52458 which is that nested classes are not
8021 taken into account when finding the base class member.
8023 Reviewed/Approved by Martin.
8025 2004-03-17 Marek Safar <marek.safar@seznam.cz>
8027 * interface.cs: In all interface classes removed redundant
8028 member initialization.
8030 2004-03-16 Martin Baulig <martin@ximian.com>
8032 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
8034 2004-03-15 Miguel de Icaza <miguel@ximian.com>
8036 * decl.cs (DefineTypeAndParents): New helper method to define a
8037 type's containers before the type itself is defined; This is a
8038 bug exposed by the recent changes to Windows.Forms when an
8039 implemented interface was defined inside a class that had not been
8042 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
8044 (Check): Loop correctly to report errors modifiers
8045 (UNSAFE was not in the loop, since it was the same as TOP).
8047 * interface.cs: Every interface member now takes a ModFlags,
8048 instead of a "is_new" bool, which we set on the base MemberCore.
8050 Every place where we called "UnsafeOk" in the interface, now we
8051 call the proper member (InterfaceMethod.UnsafeOK) instead to get
8052 the unsafe settings from the member declaration instead of the
8053 container interface.
8055 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
8057 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
8058 `set_indexer_name' to the pending bits (one per type).
8060 We fixed a bug today that was picking the wrong method to
8061 override, since for properties the existing InterfaceMethod code
8062 basically ignored the method name. Now we make sure that the
8063 method name is one of the valid indexer names.
8065 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
8067 * support.cs (SeekableStreamReader): Keep track of stream byte
8068 positions and don't mix them with character offsets to the buffer.
8070 Patch from Gustavo Giráldez
8072 2004-03-15 Marek Safar <marek.safar@seznam.cz>
8074 * interface.cs (InterfaceSetGetBase): Removed double member
8075 initialization, base class does it as well.
8077 2004-03-13 Martin Baulig <martin@ximian.com>
8079 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
8080 when compiling corlib.
8082 2004-03-13 Miguel de Icaza <miguel@ximian.com>
8084 * convert.cs (ExplicitConversion): We were reporting an error on
8085 certain conversions (object_type source to a value type, when the
8086 expression was `null') before we had a chance to pass it through
8087 the user defined conversions.
8089 * driver.cs: Replace / and \ in resource specifications to dots.
8092 * class.cs: Add check for duplicate operators. Fixes 52477
8094 2004-03-11 Miguel de Icaza <miguel@ximian.com>
8096 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
8097 that are in the middle of the statements, not only at the end.
8100 * class.cs (TypeContainer.AddField): No longer set the
8101 `HaveStaticConstructor' flag, now we call it
8102 `UserDefineStaticConstructor' to diferentiate the slightly
8103 semantic difference.
8105 The situation is that we were not adding BeforeFieldInit (from
8106 Modifiers.TypeAttr) to classes that could have it.
8107 BeforeFieldInit should be set to classes that have no static
8112 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
8114 And most importantly Zoltan's comment:
8116 http://bugzilla.ximian.com/show_bug.cgi?id=44229
8118 "I think beforefieldinit means 'it's ok to initialize the type sometime
8119 before its static fields are used', i.e. initialization does not need
8120 to be triggered by the first access to the type. Setting this flag
8121 helps the JIT to compile better code, since it can run the static
8122 constructor at JIT time, and does not need to generate code to call it
8123 (possibly lots of times) at runtime. Unfortunately, mcs does not set
8124 this flag for lots of classes like String.
8126 csc sets this flag if the type does not have an explicit static
8127 constructor. The reasoning seems to be that if there are only static
8128 initalizers for a type, and no static constructor, then the programmer
8129 does not care when this initialization happens, so beforefieldinit
8132 This bug prevents the AOT compiler from being usable, since it
8133 generates so many calls to mono_runtime_class_init that the AOT code
8134 is much slower than the JITted code. The JITted code is faster,
8135 because it does not generate these calls if the vtable is type is
8136 already initialized, which is true in the majority of cases. But the
8137 AOT compiler can't do this."
8139 2004-03-10 Miguel de Icaza <miguel@ximian.com>
8141 * class.cs (MethodData.Emit): Refactor the code so symbolic
8142 information is generated for destructors; For some reasons we
8143 were taking a code path that did not generate symbolic information
8146 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
8148 * class.cs: Create a Constructor.CheckBase method that
8149 takes care of all validation type code. The method
8150 contains some code that was moved from Define.
8152 It also includes new code that checks for duplicate ctors.
8153 This fixes bug #55148.
8155 2004-03-09 Joshua Tauberer <tauberer@for.net>
8157 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
8158 a { ... }-style array creation invokes EmitStaticInitializers
8159 which is not good for reference-type arrays. String, decimal
8160 and now null constants (NullCast) are not counted toward
8161 static initializers.
8163 2004-03-05 Martin Baulig <martin@ximian.com>
8165 * location.cs (SourceFile.HasLineDirective): New public field;
8166 specifies whether the file contains or is referenced by a "#line"
8168 (Location.DefineSymbolDocuments): Ignore source files which
8169 either contain or are referenced by a "#line" directive.
8171 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
8173 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
8174 direct access to our parent, so check the method inline there.
8176 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
8178 * expression.cs (Invocation.EmitCall): Miguel's last commit
8179 caused a regression. If you had:
8184 In Foo the implict this would be null.
8186 2004-02-27 Miguel de Icaza <miguel@ximian.com>
8188 * expression.cs (Invocation.EmitCall): If the method is not
8189 virtual, do not emit a CallVirt to it, use Call.
8191 * typemanager.cs (GetFullNameSignature): Improve the method to
8192 cope with ".ctor" and replace it with the type name.
8194 * class.cs (ConstructorInitializer.Resolve): Now the method takes
8195 as an argument the ConstructorBuilder where it is being defined,
8196 to catch the recursive constructor invocations.
8198 2004-02-26 Miguel de Icaza <miguel@ximian.com>
8200 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
8201 routines to check if a type is an enumerable/enumerator allow
8202 classes that implement the IEnumerable or IEnumerator interfaces.
8204 * class.cs (Property, Operator): Implement IIteratorContainer, and
8205 implement SetYields.
8207 (Property.Define): Do the block swapping for get_methods in the
8208 context of iterators. We need to check if Properties also
8209 include indexers or not.
8211 (Operator): Assign the Block before invoking the
8212 OperatorMethod.Define, so we can trigger the Iterator code
8215 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
8216 Property and Operator classes are not created when we parse the
8217 declarator but until we have the block completed, so we use a
8218 singleton SimpleIteratorContainer.Simple to flag whether the
8219 SetYields has been invoked.
8221 We propagate this setting then to the Property or the Operator to
8222 allow the `yield' to function.
8224 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8226 * codegen.cs: Implemented attribute support for modules.
8227 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8228 Assembly/Module functionality.
8230 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8231 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8232 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8234 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8236 * interface.cs (FindMembers): The operation is performed on all base
8237 interfaces and not only on the first. It is required for future CLS Compliance patch.
8239 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8241 * statement.cs, codegen.cs:
8242 This patch deals with patterns such as:
8244 public class List : IEnumerable {
8246 public MyEnumerator GetEnumerator () {
8247 return new MyEnumerator(this);
8250 IEnumerator IEnumerable.GetEnumerator () {
8254 public struct MyEnumerator : IEnumerator {
8259 Before, there were a few things we did wrong:
8260 1) we would emit callvirt on a struct, which is illegal
8261 2) we emited ldarg when we needed to emit ldarga
8262 3) we would mistakenly call the interface methods on an enumerator
8263 type that derived from IEnumerator and was in another assembly. For example:
8265 public class MyEnumerator : IEnumerator
8267 Would have the interface methods called, even if there were public impls of the
8268 method. In a struct, this lead to invalid IL code.
8270 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8272 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8275 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8277 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8279 * cs-parser.jay: Fix small regression: we were not testing V2
8280 compiler features correctly.
8282 * interface.cs: If the emit context is null, then create one
8284 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8286 * decl.cs (GetSignatureForError): New virtual method to get full name
8289 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8290 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8292 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8293 Duplicated members and code in these classes has been removed.
8294 Better encapsulation in these classes.
8296 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8298 * assign.cs (Assign.DoResolve): When dealing with compound
8299 assignments, there is a new rule in ECMA C# 2.4 (might have been
8300 there before, but it is documented here) that states that in:
8304 If b is of type int, and the `op' is a shift-operator, then the
8305 above is evaluated as:
8309 * expression.cs (Binary.ResolveOperator): Instead of testing for
8310 int/uint/long/ulong, try to implicitly convert to any of those
8311 types and use that in pointer arithmetic.
8313 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8314 method to print information for from the type, not from the
8315 null-method we were given.
8317 2004-02-01 Duncan Mak <duncan@ximian.com>
8319 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8320 parsing for cmd, fixes bug #53694.
8322 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8324 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8325 in the member name duplication tests. Property and operator name duplication
8326 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8328 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8330 * interface.cs (PopulateMethod): Fixed crash when interface method
8331 returns not existing type (error test cs0246-3.cs).
8333 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8335 * cs-parser.jay (interface_accessors): Re-write actions to also
8336 store attributes attached to get and set methods. Fix spelling
8339 (inteface_property_declaration): Modify accordingly.
8341 (InterfaceAccessorInfo): New helper class to store information to pass
8342 around between rules that use interface_accessors.
8344 * interface.cs (Emit): Apply attributes on the get and set
8345 accessors of properties and indexers too.
8347 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8348 right MethodBuilder when applying attributes to the get and set accessors.
8350 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8352 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8354 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8356 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8358 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8360 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8361 changes that treat `yield' specially when present before `break'
8364 * cs-tokenizer.cs: yield is no longer a keyword.
8366 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8368 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8369 setting for default constructors.
8370 For default constructors are almost every time set wrong Modifier. The
8371 generated IL code has been alright. But inside mcs this values was
8372 wrong and this was reason why several of my CLS Compliance tests
8375 2004-01-22 Martin Baulig <martin@ximian.com>
8377 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8378 not a QualifiedIdentifier. This is what `type_name_expression'
8379 was previously doing.
8380 (type_name_expression): Removed; the code is now in
8381 `namespace_or_type_name'.
8382 (qualified_identifier): Removed, use `namespace_or_type_name'
8384 (QualifiedIdentifier): Removed this class.
8386 2004-01-22 Martin Baulig <martin@ximian.com>
8388 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8389 not a string as alias name.
8391 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8393 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8394 #52730 bug, and instead compute correctly the need to use a
8395 temporary variable when requesting an address based on the
8396 static/instace modified of the field and the constructor.
8398 2004-01-21 Martin Baulig <martin@ximian.com>
8400 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8401 class and namespace before looking up aliases. Fixes #52517.
8403 2004-01-21 Martin Baulig <martin@ximian.com>
8405 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8406 assinged in a 'try'; fixes exception4.cs.
8408 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8409 * class.cs : Implemented parameter-less constructor for TypeContainer
8411 * decl.cs: Attributes are now stored here. New property OptAttributes
8413 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8415 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8417 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8419 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8420 (CSharpSignature): New method for indexer and property signature.
8422 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8424 * pending.cs (IsVirtualFilter): Faster implementation.
8426 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8428 * typemanager.cs: Avoid inclusion of same assembly more than once.
8430 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8432 * cs-parser.jay: Fixed problem where the last assembly attribute
8433 has been applied also to following declaration (class, struct, etc.)
8435 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8437 * class.cs: Added error CS0538, CS0539 reporting.
8438 Fixed crash on Microsoft runtime when field type is void.
8440 * cs-parser.jay: Added error CS0537 reporting.
8442 * pending.cs: Added error CS0535 reporting.
8443 Improved error report for errors CS0536, CS0534.
8445 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8447 Merge a few bits from the Anonymous Method MCS tree.
8449 * statement.cs (ToplevelBlock): New class for toplevel methods,
8450 will hold anonymous methods, lifted variables.
8452 * cs-parser.jay: Create toplevel blocks for delegates and for
8453 regular blocks of code.
8455 2004-01-20 Martin Baulig <martin@ximian.com>
8457 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8458 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8459 and `NeedExplicitReturn'; added `IsLastStatement'.
8460 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8461 have a `ReturnLabel' or we're not unreachable.
8463 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8464 child's reachability; don't just override ours with it. Fixes
8465 #58058 (lluis's example).
8466 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8467 InFinally(), InLoop(), InSwitch() and
8468 BreakCrossesTryCatchBoundary() methods.
8470 * statement.cs (Return): Do all error checking in Resolve().
8471 Unless we are the last statement in a top-level block, always
8472 create a return label and jump to it.
8473 (Break, Continue): Do all error checking in Resolve(); also make
8474 sure we aren't leaving a `finally'.
8475 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8476 statement in a top-level block.
8477 (Block.Flags): Added `IsDestructor'.
8478 (Block.IsDestructor): New public property.
8480 2004-01-20 Martin Baulig <martin@ximian.com>
8482 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8484 2004-01-20 Martin Baulig <martin@ximian.com>
8486 * statement.cs (Statement.ResolveUnreachable): New public method.
8487 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8488 (Block.Resolve): Resolve unreachable statements.
8490 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8492 * expression.cs: We need to fix the case where we do
8493 not have a temp variable here.
8495 * assign.cs: Only expression compound assignments need
8496 temporary variables.
8498 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8500 * flowanalysis.cs: Reduce memory allocation in a few ways:
8501 - A block with no variables should not allocate a bit
8503 - A method with no out parameters does not need any tracking
8504 for assignment of the parameters, so we need not allocate
8507 public readonly Type[] VariableTypes;
8508 public readonly string[] VariableNames;
8509 Are redundant. The data is already stored in the variable
8510 map, so we need not allocate another array for it.
8511 - We need to add alot of checks for if (params | locals) == null
8512 due to the first two changes.
8514 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8516 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8517 implement IMemoryLocation, we store a copy on a local variable and
8518 take the address of it. Patch from Benjamin Jemlich
8520 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8521 to use a special "type_name_expression" rule which reduces the
8522 number of "QualifiedIdentifier" classes created, and instead
8523 directly creates MemberAccess expressions.
8525 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8527 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8528 that fixes #52853. Null literal assignment to ValueType
8530 * class.cs (MethodData.Emit): Instead of checking the name of the
8531 method to determine if its a destructor, create a new derived
8532 class from Method called Destructor, and test for that.
8534 * cs-parser.jay: Create a Destructor object instead of a Method.
8536 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8540 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8542 * expression.cs (Binary.ResolveOperator): Perform an implicit
8543 conversion from MethodGroups to their delegate types on the
8546 * delegate.cs: Introduce a new class DelegateCreation that is the
8547 base class for `NewDelegate' and `ImplicitDelegateCreation',
8548 factor some code in here.
8550 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8551 conversion from MethodGroups to compatible delegate types.
8553 * ecore.cs (Expression.Resolve): Do not flag error 654
8554 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8555 we allow conversions from MethodGroups to delegate types now.
8557 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8558 assignments in v2 either.
8560 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8562 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8563 static read-only fields in ctors.
8565 Applied patch from Benjamin Jemlich
8567 * expression.cs (UnaryMutator): Avoid leaking local variables.
8569 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8571 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8572 here to return true, as they can be used like this:
8576 Fixed 49836 and all the other dups
8578 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8580 * driver.cs: Implement /win32res and /win32icon.
8582 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8584 * cs-parser.jay: Add a rule to improve error handling for the
8585 common mistake of placing modifiers after the type.
8587 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8589 * cs-parser.jay (interface_event_declaration): Catch
8590 initialization of events on interfaces, and report cs0068
8592 * cs-parser.jay (interface_event_declaration): Catch
8593 initialization of events.
8595 * ecore.cs: Better report missing constructors.
8597 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8598 the error reporting done in the wrong place. Fix.
8600 * expression.cs (Binary.ResolveOperator): Catch the
8601 operator + (E x, E y) error earlier, and later allow for implicit
8602 conversions in operator +/- (E e, U x) from U to the underlying
8605 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8606 52596, if the container class is abstract, the default constructor
8607 is protected otherwise its public (before, we were always public).
8609 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8612 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8613 Jemlich that fixes bug #52597, MCS was generating invalid code for
8614 idisposable structs. Thanks to Ben for following up with this
8617 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8619 * driver.cs: Allow assemblies without code to be generated, fixes
8622 2004-01-07 Nick Drochak <ndrochak@gol.com>
8624 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8626 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8628 * cs-parser.jay: Add rules to improve error reporting if fields or
8629 methods are declared at the namespace level (error 116)
8631 * Add rules to catch event add/remove
8633 2004-01-04 David Sheldon <dave-mono@earth.li>
8635 * expression.cs: Added matching ")" to error message for
8638 2004-01-03 Todd Berman <tberman@gentoo.org>
8640 * ecore.cs, attribute.cs:
8641 Applying fix from #52429.
8643 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8645 * ecore.cs, expression.cs, statement.cs:
8646 Total rewrite of how we handle branching. We
8647 now handle complex boolean expressions with fewer
8648 jumps. As well if (x == 0) no longer emits a ceq.
8650 if (x is Foo) is much faster now, because we generate
8653 Overall, we get a pretty big improvement on our benchmark
8654 tests. The code we generate is smaller and more readable.
8656 I did a full two-stage bootstrap. The patch was reviewed
8657 by Martin and Miguel.
8659 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8661 * cs-parser.jay: Make primary_expression not take a QI.
8662 we dont need this because the member_access rule covers
8663 us here. So we replace the rule with just IDENTIFIER.
8665 This has two good effects. First, we remove a s/r conflict.
8666 Second, we allocate many fewer QualifiedIdentifier objects.
8668 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8670 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8671 set the correct information via SRE. This prevents
8672 hanging on the MS runtime. Fixes #29374.
8674 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8676 * convert.cs: correctly handle conversions to value types
8677 from Enum and ValueType as unboxing conversions.
8679 Fixes bug #52569. Patch by Benjamin Jemlich.
8681 2004-01-02 Ravi Pratap <ravi@ximian.com>
8683 * expression.cs (BetterConversion): Prefer int -> uint
8684 over int -> ulong (csc's behaviour). This fixed bug #52046.
8686 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8688 * decl.cs (MemberCache.FindMembers): now returns a
8691 * typemanager.cs: In general, go with with ^^.
8692 (CopyNewMethods): take an IList.
8693 (RealMemberLookup): Only allocate an arraylist
8694 if we copy from two sets of methods.
8696 This change basically does two things:
8697 1) Fewer array lists allocated due to CopyNewMethods.
8698 2) the explicit cast in MemberList costed ALOT.
8700 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8702 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8703 a hashtable to avoid needless string allocations when an identifier is
8704 used more than once (the common case).
8706 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8708 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8709 is broken, it will not return anything. So, we
8710 have to use the information we have in mcs to
8713 * typemanager.cs: Add a cache for GetInterfaces,
8714 since this will now be used more often (due to ^^)
8716 (GetExplicitInterfaces) New method that gets the
8717 declared, not effective, interfaces on a type
8718 builder (eg, if you have interface IFoo, interface
8719 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8722 This patch makes MCS able to bootstrap itself on
8725 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8727 * expression.cs: Remove the Nop's that Miguel put
8730 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8732 * report.cs, codegen.cs: Give the real stack trace to
8733 the error when an exception is thrown.
8735 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8737 * decl.cs: only allocate hashtables for ifaces if
8740 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8742 * expression.cs: fix the error from cs0121-2.cs
8743 (a parent interface has two child interfaces that
8744 have a function with the same name and 0 params
8745 and the function is called through the parent).
8747 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8749 * class.cs, rootcontext.cs, typmanager.cs: do not
8752 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8754 * codegen.cs: remove stack for the ec flow branching.
8755 It is already a linked list, so no need.
8757 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8759 * Makefile: Allow custom profiler here.
8761 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8763 * typemanager.cs (LookupType):
8764 - Use a static char [], because split takes
8765 a param array for args, so it was allocating
8767 - Do not store true in a hashtable, it boxes.
8769 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8771 * flowanalysis.cs: bytify common enums.
8773 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8775 * modifiers.cs: Add a new set of flags for the
8776 flags allowed on explicit interface impls.
8777 * cs-parser.jay: catch the use of modifiers in
8778 interfaces correctly.
8779 * class.cs: catch private void IFoo.Blah ().
8781 All related to bug #50572.
8783 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8785 * decl.cs: Rewrite the consistant accessability checking.
8786 Accessability is not linear, it must be implemented in
8787 a tableish way. Fixes #49704.
8789 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8791 * expression.cs: Handle negation in a checked context.
8792 We must use subtraction from zero. Fixes #38674.
8794 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8796 * class.cs: Ignore static void main in DLLs.
8797 * rootcontext.cs: Handle the target type here,
8798 since we are have to access it from class.cs
8799 * driver.cs: account for the above.
8801 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8803 * report.cs: Give line numbers and files if available.
8805 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8807 * driver.cs: Implement /addmodule.
8809 * typemanager.cs: Change 'modules' field so it now contains Modules not
8812 2003-12-20 Martin Baulig <martin@ximian.com>
8814 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8815 (FieldBase.IsAssigned): Removed this field.
8816 (FieldBase.SetAssigned): New public method.
8817 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8819 2003-12-20 Martin Baulig <martin@ximian.com>
8821 * expression.cs (LocalVariableReference.DoResolve): Don't set
8822 `vi.Used' if we're called from DoResolveLValue().
8824 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8825 returns the usage vector it just merged into the current one -
8826 pass this one to UsageWarning().
8827 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8828 of the `EmitContext', don't call this recursively on our children.
8830 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8832 * driver.cs: Implement /target:module.
8834 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8836 * support.cs (CharArrayHashtable): New helper class.
8838 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8839 char arrays, not strings, so we can avoid creating a string in
8840 consume_identifier if the identifier is a keyword.
8842 2003-12-16 Martin Baulig <martin@ximian.com>
8844 * statement.cs (LocalInfo.Assigned): Removed this property.
8845 (LocalInfo.Flags): Removed `Assigned'.
8846 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8847 and uses flow analysis.
8848 (Block.UsageWarning): Made this method private.
8849 (Block.Resolve): Call UsageWarning() if appropriate.
8851 * expression.cs (LocalVariableReference.DoResolve): Always set
8852 LocalInfo.Used here.
8854 2003-12-13 Martin Baulig <martin@ximian.com>
8856 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8857 any value here; we're now using flow analysis to figure out
8858 whether a statement/block returns a value.
8860 2003-12-13 Martin Baulig <martin@ximian.com>
8862 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8864 (FlowBranching.MergeFinally): Don't call
8865 `branching.CheckOutParameters()' here, this is called in
8867 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8868 when adding the `finally' vector.
8870 2003-12-13 Martin Baulig <martin@ximian.com>
8873 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8874 actually work and also fix #48962.
8876 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8878 * decl.cs: Do not check System.Object for nested types,
8879 since we know it does not have any. Big bang for buck:
8884 corlib: 17.99 seconds
8888 corlib: 17.39 seconds
8890 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8892 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8893 time we are returning 0 members, so we save alot here.
8895 2003-12-11 Martin Baulig <martin@ximian.com>
8897 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8898 `MergeChild()', also just take the `FlowBranching' as argument;
8899 call Merge() on it and return the result.
8900 (FlowBranching.Merge): We don't need to do anything if we just
8903 2003-12-11 Martin Baulig <martin@ximian.com>
8905 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8906 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8907 Maurer for this idea.
8909 2003-12-11 Martin Baulig <martin@ximian.com>
8911 * flowanalysis.cs (MergeResult): This class is now gone; we now
8912 use the `UsageVector' for this. The reason for this is that if a
8913 branching just has one sibling, we don't need to "merge" them at
8914 all - that's the next step to do.
8915 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8918 2003-12-11 Martin Baulig <martin@ximian.com>
8920 Reworked flow analyis and made it more precise and bug-free. The
8921 most important change is that we're now using a special `Reachability'
8922 class instead of having "magic" meanings of `FlowReturns'. I'll
8923 do some more cleanups and optimizations and also add some more
8924 documentation this week.
8926 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8927 largely reworked this class.
8928 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8929 the new `Reachability' class instead of having "magic" values here.
8930 (FlowBranching): We're now using an instance of `Reachability'
8931 instead of having separate `Returns', `Breaks' etc. fields.
8933 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8934 based on flow analysis; ignore the return value of block.Emit ().
8936 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8938 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8939 if they are private.
8941 2003-12-09 Martin Baulig <martin@ximian.com>
8943 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8944 call them directly on the UsageVector.
8946 2003-12-09 Martin Baulig <martin@ximian.com>
8948 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8949 Changed return type from `FlowReturns' to `Reachability'.
8951 2003-12-09 Martin Baulig <martin@ximian.com>
8953 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8954 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8955 `Reachable' fields with a single `Reachability' one.
8957 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8959 * class.cs (FindMembers): Remove foreach's.
8972 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
8977 This patch does a few things:
8978 1. EmptyStatement is now a singleton, so it is never reallocated.
8979 2. All blah is EmptyStatement constructs have been changed to
8980 blah == EmptyStatement.Value, which is much faster and valid
8981 now that EmptyStatement is a singleton.
8982 3. When resolving a block, rather than allocating a new array for
8983 the non-empty statements, empty statements are replaced with
8984 EmptyStatement.Value
8985 4. Some recursive functions have been made non-recursive.
8986 Mainly the performance impact is from (3), however (1) and (2) are needed for
8987 this to work. (4) does not make a big difference in normal situations, however
8988 it makes the profile look saner.
8993 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8994 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
8995 Total memory allocated: 56397 KB
8998 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
8999 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
9000 Total memory allocated: 55666 KB
9002 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9004 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
9005 than the hashtable in a hashtable version
9007 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
9008 we always end up concating a string. This results in a huge perf
9009 loss, because many strings have to be tracked by the GC. In this
9010 patch, we first use a hashtable that works with two keys, so that
9011 the strings do not need to be concat'ed.
9022 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9024 * Makefile: Add a new target `do-time' that does a quick and simple
9025 profile, leaving easy to parse output.
9027 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
9029 * codegen.cs (Init): Create the dynamic assembly with
9030 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
9032 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
9034 * support.cs: Make the PtrHashtable use only one
9035 instance of its comparer.
9037 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
9039 * typemanager.cs: Fix lookup of GetNamespaces.
9041 2003-11-29 Miguel de Icaza <miguel@ximian.com>
9043 * expression.cs: Removed redundant line.
9045 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
9046 ArrayLists, use for loops with bounds.
9048 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
9051 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
9052 arraylists, use for loop with bounds.
9054 The above three changes give us a 0.071 second performance
9055 improvement out of 3.294 seconds down to 3.223. On my machine
9056 the above changes reduced the memory usage by 1,387 KB during
9059 * cs-parser.jay (QualifiedIdentifier): New class used to represent
9060 QualifiedIdentifiers. Before we created a new string through
9061 concatenation, and mostly later on, the result would be
9062 manipulated by DecomposeQI through string manipulation.
9064 This reduced the compiler memory usage for bootstrapping from
9065 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
9066 compile times in 0.05 seconds.
9068 2003-11-28 Dick Porter <dick@ximian.com>
9070 * support.cs: Do string compares with the Invariant culture.
9078 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
9079 the comparison is done with the Invariant culture.
9081 2003-11-27 Miguel de Icaza <miguel@ximian.com>
9083 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
9084 GetEnumerator method.
9086 (ProbeCollectionType): Iterate starting at the most specific type
9087 upwards looking for a GetEnumerator
9089 * expression.cs: Shift count can be up to 31 for int/uint and 63
9092 2003-11-26 Miguel de Icaza <miguel@ximian.com>
9094 * statement.cs (Block.LookupLabel): Also look for the label on the
9095 children blocks. Use a hash table to keep track of visited
9098 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
9099 we actually did transform the other operand, otherwise fall back
9100 to the common codepath that casts to long.
9102 * cs-tokenizer.cs: Use the same code pattern as the int case.
9103 Maybe I should do the parsing myself, and avoid depending on the
9104 Parse routines to get this done.
9106 2003-11-25 Miguel de Icaza <miguel@ximian.com>
9108 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9109 which fixes bug 51347. This time test it.
9111 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
9112 attributes for example can not tell the difference between these.
9113 The difference was only a syntax feature of the language.
9115 * attribute.cs: Apply attributes to delegates.
9117 * delegate.cs: Call the apply attributes method.
9119 2003-11-24 Miguel de Icaza <miguel@ximian.com>
9121 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
9122 comparing 0 vs Byte.MinValue, not the value
9124 (ImplicitConversionRequired): When reporting a conversion error,
9125 use error 31 to print out the constant error instead of the
9128 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9129 which fixes bug 51347.
9131 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9133 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9134 which fixes the -warnaserror command line option.
9136 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9138 * cfold.cs (DoNumericPromotions): During constant folding of
9139 additions on UIntConstant, special case intconstants with
9140 IntConstants like we do on the expression binary operator.
9142 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9144 * convert.cs (ImplicitReferenceConversion): We were missing a case
9145 (System.Enum are not value types or class types, so we need to
9146 classify them separatedly).
9148 * driver.cs: We do not support error 2007.
9150 2003-11-12 Jackson Harper <jackson@ximian.com>
9152 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9153 system directory. Also use the full file name so users can
9154 libraries names mscorlib-o-tron.dll in a non system dir.
9156 2003-11-10 Martin Baulig <martin@ximian.com>
9158 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9159 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9160 calling `ResolveType()' on them, directly assign their `Type'.
9162 2003-11-08 Martin Baulig <martin@ximian.com>
9164 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9165 return value and the `out parent' parameter.
9166 (TypeContainer.DefineType): Moved the CS0644 check into
9167 GetClassBases(). Don't pass the interface types to the
9168 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9169 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9171 * ecore.cs (TypeExpr.IsAttribute): New property.
9172 (TypeExpr.GetInterfaces): New method.
9174 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9175 TypeExpr instead of a Type.
9176 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9177 (Interface.DefineType): Don't pass the interface types to the
9178 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9179 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9181 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9182 instead of a `Type[]'.
9183 (TypeManager.RegisterBuilder): Likewise.
9184 (TypeManager.AddUserInterface): Likewise.
9185 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9186 `Type[]' and also return a `TypeExpr[]'.
9187 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9189 2003-11-08 Martin Baulig <martin@ximian.com>
9191 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9194 2003-11-08 Martin Baulig <martin@ximian.com>
9196 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9197 TypeManager.ResolveExpressionTypes().
9199 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9200 instead of an Expression.
9201 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9202 (TypeExpression): New public class; formerly known as `TypeExpr'.
9204 * expression.cs (ComposedCast): Derive from TypeExpr.
9206 * typemanager.cs (TypeManager.system_*_expr): These are now
9207 TypExpr's instead of Expression's.
9208 (TypeManager.ResolveExpressionTypes): New public static function;
9209 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9212 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9214 * expression.cs (New.DoResolve): Do not dereference value that
9215 might be a null return.
9217 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9218 sure that the constant value has the right type. Fixes an
9219 unreported bug, similar to 50425.
9221 * const.cs (Const.LookupConstantValue): Call
9222 ImplicitStandardConversionExists before doing a conversion to
9223 avoid havng the TypeManager.ChangeType do conversions.
9225 Reduced the number of casts used
9227 (Const.ChangeType): New routine to enable reuse of the constant
9228 type changing code from statement.
9230 * typemanager.cs (ChangeType): Move common initialization to
9231 static global variables.
9235 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9236 every value type to go through, even if it was void. Fix that.
9238 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9239 character of the define, and the is_identifier_part_character for
9240 the rest of the string.
9242 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9244 * expression.cs (UnaryMutator.EmitCode): When I updated
9245 LocalVariableReference.DoResolve, I overdid it, and dropped an
9246 optimization done on local variable references.
9248 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9250 * ecore.cs: Convert the return from Ldlen into an int.
9252 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9254 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9255 the accessibility, this is a special case for toplevel non-public
9256 classes (internal for instance).
9258 2003-10-20 Nick Drochak <ndrochak@gol.com>
9260 * ecore.cs: Fix typo and build. Needed another right paren.
9262 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9264 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9265 `internal' case regular and protected, but not allowing protected
9266 to be evaluated later. Bug 49840
9268 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9270 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9271 to kb.Nlast, and not the kb.nFirst to isolate the switch
9274 Extract the underlying type, so enumerations of long/ulong are
9275 treated like long/ulong.
9277 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9279 * expression.cs (New): Overload the meaning of RequestedType to
9280 track the possible creation of the NewDelegate type, since
9281 DoResolve is invoked more than once for new constructors on field
9284 See bugs: #48800 and #37014
9286 * cs-parser.jay (declare_local_constants): Take an arraylist
9287 instead of a single constant.
9289 (local_constant_declaration): It should take a
9290 constant_declarators, not a constant_declarator. Fixes 49487
9292 * convert.cs: Fix error report.
9294 2003-10-13 Jackson Harper <jackson@ximian.com>
9296 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9299 2003-10-09 Martin Baulig <martin@ximian.com>
9301 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9303 (MethodCore.DoDefineParameters): Removed the TypeContainer
9304 argument; use the DeclSpace which was passed to the .ctor instead.
9305 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9306 TypeContainer; we only need a DeclSpace here.
9308 2003-10-09 Martin Baulig <martin@ximian.com>
9310 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9312 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9313 EmitContext's .ctor.
9315 2003-10-09 Martin Baulig <martin@ximian.com>
9317 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9318 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9319 AsAccessible(), moved them as well.
9321 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9323 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9325 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9327 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9329 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9330 generation for >=, as spotted by Paolo, bug 48679.
9331 Patch from David Waite.
9333 * cs-tokenizer.cs: Add handling for #pragma.
9335 * cs-parser.jay: Allow for both yield and yield return in the
9336 syntax. The anti-cobolization of C# fight will go on!
9338 * class.cs (TypeBuilder.DefineType): Catch error condition here
9339 (Parent.DefineType erroring out and returning null).
9341 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9342 coping with enumerations variables, we were mistakenly processing
9343 them as a regular value type instead of built-in types. Fixes the
9346 * typemanager.cs (IsBuiltinOrEnum): New method.
9348 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9350 * cs-parser.jay: Upgrade: yield now needs the return clause.
9352 2003-09-19 Martin Baulig <martin@ximian.com>
9354 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9355 `MemberCache parent' argument. Normally, an interface doesn't
9356 have a parent type except System.Object, but we use this in gmcs
9357 for generic type parameters.
9359 2003-09-18 Martin Baulig <martin@ximian.com>
9361 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9362 on `type.IsInterface'; don't check whether the type has a parent
9363 to determine whether it's an interface.
9365 2003-09-15 Martin Baulig <martin@ximian.com>
9367 * class.cs (TypeContainer.DefineType): Added an error flag to
9368 avoid reporting duplicate CS0146's ("class definition is
9371 * driver.cs (Driver.MainDriver): Abort if
9372 RootContext.ResolveTree() reported any errors.
9374 2003-09-07 Martin Baulig <martin@ximian.com>
9376 * report.cs (Error, Warning): Added overloaded versions which take
9377 a `params object[] args' and call String.Format().
9379 2003-09-07 Martin Baulig <martin@ximian.com>
9381 * decl.cs (DeclSpace..ctor): Don't call
9382 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9383 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9384 (DeclSpace.RecordDecl): New method.
9386 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9388 2003-09-02 Ravi Pratap <ravi@ximian.com>
9390 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9391 value attributes to be applied to ParameterBuilders.
9393 * class.cs (MethodCore.LabelParameters): Make static and more
9394 generic so that it can be used from other places - like interface
9395 methods, for instance.
9397 * interface.cs (Interface.Emit): Call LabelParameters before
9398 emitting attributes on the InterfaceMethod.
9400 2003-08-26 Martin Baulig <martin@ximian.com>
9402 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9403 resolving aliases; fixes #47927.
9405 2003-08-26 Martin Baulig <martin@ximian.com>
9407 * statement.cs (Using.DoResolve): This is internally emitting a
9408 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9409 do not always return. Fixes #47681.
9411 2003-08-26 Martin Baulig <martin@ximian.com>
9413 * decl.cs (MemberCore): Moved WarningNotHiding(),
9414 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9416 (AdditionResult): Make this nested in DeclSpace.
9417 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9418 argument; call NamespaceEntry.Define() unless we're nested in a
9421 * namespace.cs (Namespace.DefineName): New public function. This
9422 is called from DeclSpace's .ctor to add
9423 (Namespace.Lookup): Include DeclSpaces in the lookup.
9425 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9427 * const.cs (Const): Derive from MemberBase, not MemberCore.
9429 2003-08-25 Martin Baulig <martin@ximian.com>
9431 * convert.cs (Convert.ExplicitReferenceConversion): When
9432 converting from an interface type to a class, unbox if the target
9433 type is a struct type. Fixes #47822.
9435 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9437 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9440 2003-08-22 Martin Baulig <martin@ximian.com>
9442 * class.cs (TypeManager.DefineType): When defining a nested type,
9443 call DefineType() on our parent; fixes #47801.
9445 2003-08-22 Martin Baulig <martin@ximian.com>
9447 * class.cs (MethodData.Define): While checking if a method is an
9448 interface implementation, improve the test a bit more to fix #47654.
9450 2003-08-22 Martin Baulig <martin@ximian.com>
9452 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9453 correctly; fixes #47722.
9455 2003-08-22 Martin Baulig <martin@ximian.com>
9457 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9458 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9460 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9462 2003-08-22 Martin Baulig <martin@ximian.com>
9464 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9465 can only be assigned in static constructors. Fixes #47161.
9467 2003-08-22 Martin Baulig <martin@ximian.com>
9469 Rewrote and improved the flow analysis code.
9471 * flowbranching.cs (FlowBranching): Make this class abstract.
9472 (FlowBranching.CreateBranching): New static function to create a
9474 (FlowBranchingBlock, FlowBranchingException): New classes.
9475 (FlowBranching.UsageVector.Type): New public readonly field.
9476 (FlowBranching.UsageVector.Breaks): Removed the setter.
9477 (FlowBranching.UsageVector.Returns): Removed the setter.
9478 (FlowBranching.UsageVector): Added Break(), Return(),
9479 NeverReachable() and Throw() methods to modify the reachability.
9480 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9481 done by FlowBranching.Merge().
9482 (FlowBranching.UsageVector.MergeChild): New method; merges the
9483 merge result into the current vector.
9484 (FlowBranching.Merge): New abstract method to merge a branching.
9486 2003-08-12 Martin Baulig <martin@ximian.com>
9488 * expression.cs (Indirection.CacheTemporaries): Create the
9489 LocalTemporary with the pointer type, not its element type.
9491 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9493 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9494 token was a keyword or not.
9496 Add `error' options where an IDENTIFIER was expected; Provide
9497 CheckToken and CheckIdentifierToken convenience error reporting
9500 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9502 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9503 NameSpaceEntry NameSpaceEntry.
9505 (LookupInterfaceOrClass): Avoid creating a full qualified name
9506 from namespace and name: avoid doing lookups when we know the
9507 namespace is non-existant. Use new Tree.LookupByNamespace which
9508 looks up DeclSpaces based on their namespace, name pair.
9510 * driver.cs: Provide a new `parser verbose' to display the
9511 exception thrown during parsing. This is turned off by default
9512 now, so the output of a failure from mcs is more graceful.
9514 * namespace.cs: Track all the namespaces defined in a hashtable
9517 (IsNamespace): New method
9519 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9521 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9522 we know that we need to concatenate (full typename can never be
9527 * statement.cs: Use a bitfield; Do not initialize to null things
9528 which are done by the constructor by default.
9530 * cs-parser.jay: bug fix, parameter was 4, not 3.
9532 * expression.cs: Just use the property;
9534 * statement.cs: No need for GetVariableInfo method.
9536 2003-08-08 Martin Baulig <martin@ximian.com>
9538 * flowanalysis.cs (FlowReturns): This is now nested in the
9539 `FlowBranching' class.
9540 (MyBitVector): Moved this here from statement.cs.
9541 (FlowBranching.SiblingType): New enum type.
9542 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9544 2003-08-07 Martin Baulig <martin@ximian.com>
9546 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9547 `FlowBranching' class and called `BranchingType'.
9549 2003-08-07 Martin Baulig <martin@ximian.com>
9551 * flowanalysis.cs: Moved all the control flow analysis code into
9554 2003-08-07 Martin Baulig <martin@ximian.com>
9556 * assign.cs (Assign.DoResolve): `target' must either be an
9557 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9560 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9562 * expression.cs (BinaryMethod): This kind of expression is created by the
9563 Binary class if it determines that the operator has to be handled
9566 (BinaryDelegate): This kind of expression is created if we are
9567 dealing with a + or - operator on delegates.
9569 (Binary): remove method, argumetns, and DelegateOperator: when
9570 dealing with methods,
9572 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9574 * statement.cs (Block): use bitfields for the three extra booleans
9575 we had in use. Remove unused topblock parameter.
9577 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9579 * assign.cs: Drop extra unneeded tests.
9581 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9583 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9585 * statement.cs (Foreach): Use VariableStorage instead of
9588 * codegen.cs (VariableStorage): New class used by clients that
9589 require a variable stored: locals or fields for variables that
9590 need to live across yield.
9592 Maybe provide a convenience api for EmitThis+EmitLoad?
9594 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9597 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9599 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9600 RemapParameterLValue): New methods that are used to turn a
9601 precomputed FieldInfo into an expression like this:
9605 The idea is to use this instead of making LocalVariableReference
9606 have more than one meaning.
9608 * cs-parser.jay: Add error production to BASE.
9610 * ecore.cs: Deal with TypeManager.GetField returning null, which
9611 is now a valid return value.
9613 (FieldExprNoAddress): New expression for Fields whose address can
9616 * expression.cs (LocalVariableReference): During the resolve
9617 phases, create new expressions if we are in a remapping context.
9618 Remove code that dealt with remapping here.
9620 (ParameterReference): same.
9622 (ProxyInstance): New expression, like the `This' expression, but
9623 it is born fully resolved. We know what we are doing, so remove
9624 the errors that are targeted to user-provided uses of `this'.
9626 * statement.cs (Foreach): our variable is now stored as an
9627 Expression; During resolution, follow the protocol, dont just
9628 assume it will return this.
9630 2003-08-06 Martin Baulig <martin@ximian.com>
9632 * support.cs (SeekableStreamReader.cs): New public class.
9634 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9635 SeekableStreamReader instead of the normal StreamReader.
9637 2003-08-04 Martin Baulig <martin@ximian.com>
9639 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9640 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9641 deambiguate casts and delegate invocations.
9642 (parenthesized_expression): Use the new tokens to ensure this is
9643 not a cast of method invocation.
9645 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9646 when reading a `)' and Deambiguate_CloseParens () was previously
9649 * expression.cs (ParenthesizedExpression): New class. This is
9650 just used for the CS0075 test.
9651 (Binary.DoResolve): Check for CS0075.
9653 2003-07-29 Ravi Pratap <ravi@ximian.com>
9655 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9656 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9657 reference comparison.
9659 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9660 examine the ReturnType for equality - this is necessary in the
9661 cases of implicit and explicit operators whose signature also
9662 includes the return type.
9664 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9666 * namespace.cs: Cache the result of the namespace computation,
9667 instead of computing it every time.
9669 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9671 * decl.cs: Use a global arraylist that we reuse over invocations
9672 to avoid excesive memory consumption. Reduces memory usage on an
9673 mcs compile by one meg (45 average).
9675 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9676 private, work around that.
9678 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9680 * literal.cs (IntLiteral): Define Zero and One static literals.
9682 * cs-parser.jay (integer_literal): use static literals to reduce
9683 memory usage for the most used literals (0, 1 and -1). 211kb
9684 reduced in memory usage.
9686 Replace all calls to `new ArrayList' with `new
9687 ArrayList(4)' which is a good average number for most allocations,
9688 and also requires only 16 bytes of memory for its buffer by
9691 This reduced MCS memory usage in seven megabytes for the RSS after
9694 2003-07-28 Ravi Pratap <ravi@ximian.com>
9696 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9697 handle params methods the correct way by forming only one
9698 applicable set with params and normal methods in them. Earlier we
9699 were looking at params methods only if we found no normal methods
9700 which was not the correct thing to do.
9702 (Invocation.BetterFunction): Take separate arguments indicating
9703 when candidate and the best method are params methods in their
9706 This fixes bugs #43367 and #46199.
9708 * attribute.cs: Documentation updates.
9710 (CheckAttribute): Rename to CheckAttributeTarget.
9711 (GetValidPlaces): Rename to GetValidTargets.
9713 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9714 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9718 2003-07-28 Martin Baulig <martin@ximian.com>
9720 * class.cs (TypeContainer.DefineMembers): Use the base type's full
9721 name when looking up the base class of a nested class. Fixes #46977.
9723 2003-07-26 Martin Baulig <martin@ximian.com>
9725 * expression.cs (Indexers.Indexer): New nested struct; contains
9726 getter, setter and the indexer's type.
9727 (Indexers.Properties): This is now an ArrayList of
9729 (IndexerAccess.DoResolveLValue): Correctly set the type if the
9730 indexer doesn't have any getters.
9732 * assign.cs (Assign.DoResolve): Also do the implicit conversions
9733 for embedded property and indexer assignments.
9735 2003-07-26 Martin Baulig <martin@ximian.com>
9737 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9738 preprocessor directive is not the first non-whitespace character
9741 2003-07-26 Martin Baulig <martin@ximian.com>
9743 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9744 namespace parsing, follow the spec more closely.
9746 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9747 NamespaceEntry.Lookup().
9749 2003-07-25 Martin Baulig <martin@ximian.com>
9751 * MethodCore.cs (OverridesSomething): New public field; it's set
9752 from TypeContainer.DefineMembers if this method overrides
9753 something (which doesn't need to be a method). Fix #39462.
9755 2003-07-25 Ravi Pratap <ravi@ximian.com>
9757 * typemanager.cs (GetMembers): Ensure that the list of members is
9758 reversed. This keeps things in sync.
9760 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9761 find an AttributeUsage attribute.
9763 * expression.cs (Invocation.OverloadResolve): Perform the check
9764 which disallows Invoke to be directly called on a Delegate.
9766 (Error_InvokeOnDelegate): Report error cs1533.
9768 2003-07-25 Martin Baulig <martin@ximian.com>
9770 * expression.cs (Indexers.GetIndexersForType): Only look in the
9771 interface hierarchy if the requested type is already an
9772 interface. Fixes #46788 while keeping #46502 fixed.
9774 2003-07-25 Martin Baulig <martin@ximian.com>
9776 * class.cs (TypeContainer.DefineMembers): Check whether all
9777 readonly fields have been assigned and report warning CS0649 if
9780 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9783 2003-07-24 Ravi Pratap <ravi@ximian.com>
9785 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9786 returned from GetMethods to make things consistent with the
9787 assumptions MCS makes about ordering of methods.
9789 This should comprehensively fix bug #45127 and it does :-)
9791 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9792 ordering is actually reverse.
9794 * Clean up some debug messages I left lying around.
9796 * interface.cs (Populate*): Get rid of code which emits attributes
9797 since the stage in which we emit attributes is the 'Emit' stage,
9798 not the define stage.
9800 (Emit): Move attribute emission for interface members here.
9802 2003-07-22 Ravi Pratap <ravi@ximian.com>
9804 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9805 closely: we eliminate methods in base types when we have an
9806 applicable method in a top-level type.
9808 Please see section 14.5.5.1 for an exact description of what goes
9811 This fixes bug #45127 and a host of other related to corlib compilation.
9813 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9814 array is the method corresponding to the top-level type (this is
9815 because of the changes made to icall.c) so we change this
9818 (MethodGroupExpr.Name): This too.
9820 * typemanager.cs (GetElementType): New method which does the right
9821 thing when compiling corlib.
9823 * everywhere: Make use of the above in the relevant places.
9825 2003-07-22 Martin Baulig <martin@ximian.com>
9827 * cs-parser.jay (invocation_expression): Moved
9828 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9829 `cast_expression', but create a InvocationOrCast which later
9830 resolves to either an Invocation or a Cast.
9832 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9833 method; call this before EmitStatement() to make sure that this
9834 expression can be used as a statement.
9836 * expression.cs (InvocationOrCast): New class; resolves to either
9837 an Invocation or a Cast.
9839 * statement.cs (StatementExpression): Call ResolveStatement() on
9840 the ExpressionStatement before emitting it.
9842 2003-07-21 Martin Baulig <martin@ximian.com>
9844 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9845 `ref' and `out' attributes match; fixes #46220.
9846 (MemberAccess.ResolveMemberAccess): You can't reference a type
9847 through an expression; fixes #33180.
9848 (Indexers.GetIndexersForType): Don't return the indexers from
9849 interfaces the class implements; fixes #46502.
9851 2003-07-21 Martin Baulig <martin@ximian.com>
9853 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9854 CS0661 checks; fixes bug #30442.
9856 2003-07-21 Martin Baulig <martin@ximian.com>
9858 * decl.cs (AdditionResult): Added `Error'.
9860 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9862 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9863 makes cs0031.cs actually work.
9865 2003-07-20 Martin Baulig <martin@ximian.com>
9867 * namespace.cs: Fixed that bug which caused a crash when compiling
9870 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9872 * typemanager.cs (LookupTypeReflection): Never expose types which
9873 are NotPublic, NestedPrivate, NestedAssembly, or
9874 NestedFamANDAssem. We used to return these, and later do a check
9875 that would report a meaningful error, but the problem is that we
9876 would not get the real match, if there was a name override.
9878 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9880 * namespace.cs (Namespace, Name): Do not compute the namespace
9881 name dynamically, compute it in the constructor. This reduced
9882 memory usage by 1697 KB.
9884 * driver.cs: Use --pause to pause at the end.
9886 2003-07-17 Peter Williams <peter@newton.cx>
9888 * Makefile: Change the name of the test target so that it doesn't
9889 conflict with the recursive test target.
9891 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9893 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9894 AddressOf): Do not use EmitThis, that was wrong, use the actual
9897 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9899 * class.cs (MethodData.Define): While checking if a method is an
9900 interface implementation, improve the test: If we are not public
9901 (use new test here: use the computed MethodAttributes directly,
9902 instead of the parsed modifier flags) check if the `implementing'
9903 method comes from an interface or not.
9905 * pending.cs (VerifyPendingMethods): Slightly better error
9908 * makefile: add test target that does the mcs bootstrap.
9910 2003-07-16 Ravi Pratap <ravi@ximian.com>
9912 * interface.cs (Define): Do nothing here since there are no
9913 members to populate etc. Move the attribute emission out of here
9914 since this was just totally the wrong place to put it. Attribute
9915 application happens during the 'Emit' phase, not in the 'Define'
9918 (Emit): Add this method and move the attribute emission here
9920 * rootcontext.cs (EmitCode): Call the Emit method on interface
9923 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9925 * expression.cs (OverloadResolve): Report error only if Location
9926 is not 'Null' which means that there was a probe going on.
9928 2003-07-14 Martin Baulig <martin@ximian.com>
9930 * expression.cs (ConditionalLogicalOperator): New public class to
9931 implement user defined conditional logical operators.
9932 This is section 14.11.2 in the spec and bug #40505.
9934 2003-07-14 Martin Baulig <martin@ximian.com>
9936 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9938 2003-07-14 Martin Baulig <martin@ximian.com>
9940 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9942 * ecore.cs (IVariable.VerifyFixed): New interface method.
9944 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9945 operator, check whether the variable is actually fixed. Fixes bug
9946 #36055. Set a variable definitely assigned when taking its
9947 address as required by the spec.
9949 * statement.cs (LocalInfo.IsFixed): New field.
9950 (LocalInfo.MakePinned): Set `IsFixed' to true.
9952 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9954 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9955 for .ctors, ensure that we only ask for members declared in the
9956 attribute type (BindingFlags.DeclaredOnly).
9960 * expression.cs (Error_WrongNumArguments): Report error 1501
9961 correctly the way CSC does.
9963 2003-07-13 Martin Baulig <martin@ximian.com>
9965 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
9966 lookup on the fully qualified name, to make things like "X.X" work
9967 where "X.X" is a fully qualified type name, but we also have a
9968 namespace "X" in the using list. Fixes #41975.
9970 2003-07-13 Martin Baulig <martin@ximian.com>
9972 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
9973 function. If we're a CompoundAssign, we need to create an embedded
9974 CompoundAssign, not an embedded Assign.
9975 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
9978 2003-07-13 Martin Baulig <martin@ximian.com>
9980 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
9981 work to fix bug #46088.
9983 2003-07-13 Ravi Pratap <ravi@ximian.com>
9985 * class.cs (Operator.Emit): Do not emit attributes here - it is
9986 taken care of by the Method class that we delegate too. This takes
9989 2003-07-10 Martin Baulig <martin@ximian.com>
9991 * expression.cs (TypeOfVoid): New class.
9992 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
9994 2003-07-10 Martin Baulig <martin@ximian.com>
9996 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
9999 2003-07-10 Martin Baulig <martin@ximian.com>
10001 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
10002 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
10004 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
10006 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
10008 2003-07-10 Martin Baulig <martin@ximian.com>
10010 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
10011 of decimal. Fixes #42850.
10013 NOTE: I also fixed the created byte blob, but this doesn't work on
10014 the MS runtime and csc never produces any byte blobs for decimal
10017 2003-07-10 Martin Baulig <martin@ximian.com>
10019 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
10020 structs; fixes #32068.
10021 (Block.AddChildVariableNames): Fixed #44302.
10023 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10025 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
10027 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10029 * attribute.cs: And this test is onger needed.
10031 2003-07-08 Martin Baulig <martin@ximian.com>
10033 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
10034 inaccessible types. Fixes #36313.
10036 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
10038 * namespace.cs (NamespaceEntry): Create implicit entries for all
10039 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
10040 implicit entries for N1.N2 and N1.
10042 2003-07-08 Martin Baulig <martin@ximian.com>
10044 Rewrote the handling of namespaces to fix a lot of the issues
10045 wrt. `using' aliases etc.
10047 * namespace.cs (Namespace): Splitted this class into a
10048 per-assembly `Namespace' and a per-file `NamespaceEntry'.
10050 * typemanager.cs (TypeManager.IsNamespace): Removed.
10051 (TypeManager.ComputeNamespaces): Only compute namespaces from
10052 loaded assemblies here, not the namespaces from the assembly we're
10053 currently compiling.
10055 2003-07-08 Martin Baulig <martin@ximian.com>
10057 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
10059 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10061 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
10064 I thought about the memory savings here, but LookupTypeReflection
10065 is used under already very constrained scenarios. Compiling
10066 corlib or mcs only exposes one hit, so it would not really reduce
10067 any memory consumption.
10069 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10071 * typemanager.cs: fixes bug #45889 by only adding public types from
10072 other assemblies to the list of known types.
10074 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10076 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10077 on the type we resolved.
10079 2003-07-05 Martin Baulig <martin@ximian.com>
10081 * pending.cs (PendingImplementation.ParentImplements): Don't
10082 create the proxy if the parent is abstract.
10084 * class.cs (TypeContainer.DefineIndexers): Process explicit
10085 interface implementations first. Fixes #37714.
10087 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10089 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10090 defined recursively; but since we modify the input parameters
10091 (left is set to `this' temporarily), we reset this value if the
10092 left_is_explicit is false, which gives the original semantics to
10095 * literal.cs (NullPointer): new class used to represent a null
10096 literal in a pointer context.
10098 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10099 type is a pointer, use a NullPointer object instead of a
10100 NullLiteral. Closes 43687
10102 (ExplicitConversion): Convert pointer values using
10103 the conv opcode to the proper type.
10105 * ecore.cs (New): change ValueTypeVariable property into a method,
10106 that returns whether the valuetype is suitable for being used.
10108 * expression.cs (Binary.DoNumericPromotions): Only return if we
10109 the int constant was a valid uint, and we can return both left and
10110 right as uints. If not, we continue processing, to trigger the
10111 type conversion. This fixes 39018.
10113 * statement.cs (Block.EmitMeta): During constant resolution, set
10114 the CurrentBlock property on the emitcontext, so that we resolve
10115 constants propertly.
10117 2003-07-02 Martin Baulig <martin@ximian.com>
10119 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10120 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10122 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10123 than emitting it here.
10125 * statement.cs: Fixed some more flow analysis bugs.
10127 2003-07-02 Martin Baulig <martin@ximian.com>
10129 * class.cs (MethodData.Define): When implementing interface
10130 methods, set Final unless we're Virtual.
10132 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10133 check work for interface methods.
10135 2003-07-01 Martin Baulig <martin@ximian.com>
10137 * ecore.cs (EmitContext.This): Replaced this property with a
10138 GetThis() method which takes a Location argument. This ensures
10139 that we get the correct error location for a CS0188.
10141 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10143 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10144 ImplicitStandardConversion.
10146 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10148 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10150 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10153 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10155 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10158 (MethodData.Define): Turn off initlocals for unsafe methods.
10160 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10162 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10163 complete; Fixes #37521.
10165 * delegate.cs: Use Modifiers.TypeAttr to compute the
10166 TypeAttributes, instead of rolling our own. This makes the flags
10167 correct for the delegates.
10169 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10171 * class.cs (Constructor.Define): Set the private flag for static
10172 constructors as well.
10174 * cs-parser.jay (statement_expression): Set the return value to
10175 null, to avoid a crash when we catch an error.
10177 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10179 * cs-parser.jay: Applied patch from Jackson that adds support for
10180 extern and unsafe modifiers to destructor declarations.
10182 * expression.cs: Report error 21 if the user is trying to index a
10185 * driver.cs: Add an error message, suggested by the bug report.
10187 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10188 if we do not have a ": this ()" constructor initializer. Fixes 45149
10190 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10192 * namespace.cs: Add some information to reduce FAQs.
10194 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10196 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10197 underlying enumeration types. Fixes #43915.
10199 * expression.cs: Treat ushort/short as legal values to be used in
10200 bitwise operations.
10202 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10204 * delegate.cs: transfer custom attributes for paramenters from
10205 the delegate declaration to Invoke and BeginInvoke.
10207 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10209 * attribute.cs: handle custom marshalers and emit marshal info
10212 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10214 * makefile.gnu: Added anonymous.cs to the compiler sources.
10216 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10218 * iterators.cs: Change the name of the proxy class to include two
10221 * cs-parser.jay: Update grammar to include anonymous methods.
10223 * anonymous.cs: new file.
10225 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10227 * class.cs (Field.Define): Add missing test for pointers and
10230 2003-05-27 Ravi Pratap <ravi@ximian.com>
10232 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10233 we use the stobj opcode.
10235 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10236 since it wasn't the correct fix.
10238 It still is puzzling that we are required to use stobj for IntPtr
10239 which seems to be a ValueType.
10241 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10243 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10244 during regular simple name resolution. Now, the trick is that
10245 instead of returning for processing the simplename, we do a
10246 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10247 contextual lookup type). If a match is found, return that, if
10248 not, return for further composition.
10250 This fixes long-standing 30485.
10252 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10253 using the address to initialize an object, do an Stobj instead of
10254 using the regular Stelem.
10256 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10257 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10258 Because if we are a BaseIndexerAccess that value will be true.
10261 * statement.cs (GotoCase.Resolve): Return after reporting an
10262 error, do not attempt to continue.
10264 * expression.cs (PointerArithmetic.Emit): If our operand is a
10265 long, convert our constants to match the operand before
10266 multiplying. Convert to I type before adding. Fixes 43670.
10268 2003-05-14 Ravi Pratap <ravi@ximian.com>
10270 * enum.cs (ImplicitConversionExists) : Rename to
10271 ImplicitEnumConversionExists to remove ambiguity.
10273 * ecore.cs (NullCast): New type of cast expression class which
10274 basically is very similar to EmptyCast with the difference being
10275 it still is a constant since it is used only to cast a null to
10277 (eg. (string) null)
10279 * convert.cs (ImplicitReferenceConversion): When casting a null
10280 literal, we return a NullCast.
10282 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10283 should be around anymore.
10285 The renaming (reported was slightly wrong). Corrections:
10287 ConvertImplicitStandard -> ImplicitConversionStandard
10288 ConvertExplicitStandard -> ExplicitConversionStandard
10290 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10291 before passing them in !
10293 * convert.cs (ImplicitConversionStandard): When comparing for
10294 equal expr and target types, ensure that expr is not a
10297 In general, we must not be checking (expr_type ==
10298 target_type) in the top level conversion methods
10299 (ImplicitConversion, ExplicitConversion etc). This checking is
10300 done in the methods that they delegate to.
10302 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10304 * convert.cs: Move Error_CannotConvertType,
10305 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10306 ImplicitNumericConversion, ImplicitConversionExists,
10307 ImplicitUserConversionExists, StandardConversionExists,
10308 FindMostEncompassedType, FindMostSpecificSource,
10309 FindMostSpecificTarget, ImplicitUserConversion,
10310 ExplicitUserConversion, GetConversionOperators,
10311 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10312 TryImplicitIntConversion, Error_CannotConvertImplicit,
10313 ConvertImplicitRequired, ConvertNumericExplicit,
10314 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10315 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10318 Perform the following renames:
10320 StandardConversionExists -> ImplicitStandardConversionExists
10321 ConvertImplicit -> ImplicitConversion
10322 ConvertImplicitStandard -> ImplicitStandardConversion
10323 TryImplicitIntConversion -> ImplicitIntConversion
10324 ConvertImplicitRequired -> ImplicitConversionRequired
10325 ConvertNumericExplicit -> ExplicitNumericConversion
10326 ConvertReferenceExplicit -> ExplicitReferenceConversion
10327 ConvertExplicit -> ExplicitConversion
10328 ConvertExplicitStandard -> ExplicitStandardConversion
10330 2003-05-19 Martin Baulig <martin@ximian.com>
10332 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10333 (TypeInfo): Added support for structs having structs as fields.
10335 * ecore.cs (FieldExpr): Implement IVariable.
10336 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10337 VariableInfo for the field.
10339 2003-05-18 Martin Baulig <martin@ximian.com>
10341 * expression.cs (This.DoResolve): Report a CS0027 if we're
10342 emitting a field initializer.
10344 2003-05-18 Martin Baulig <martin@ximian.com>
10346 * expression.cs (This.ResolveBase): New public function.
10347 (This.DoResolve): Check for CS0188.
10349 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10352 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10353 `instance_expression' to null if we don't have any non-static
10356 2003-05-18 Martin Baulig <martin@ximian.com>
10358 Reworked the way how local variables and parameters are handled by
10359 the flow analysis code.
10361 * statement.cs (TypeInfo, VariableMap): New public classes.
10362 (VariableInfo): New public class. This is now responsible for
10363 checking whether a variable has been assigned. It is used for
10364 parameters and local variables.
10365 (Block.EmitMeta): Take the InternalParameters as argument; compute
10366 the layout of the flow vectors here.
10367 (Block.LocalMap, Block.ParameterMap): New public properties.
10368 (FlowBranching): The .ctor doesn't get the InternalParameters
10369 anymore since Block.EmitMeta() now computes the layout of the flow
10371 (MyStructInfo): This class is now known as `StructInfo' and nested
10372 in `TypeInfo'; we don't access this directly anymore.
10374 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10375 property and removed IsAssigned(), IsFieldAssigned(),
10376 SetAssigned() and SetFieldAssigned(); we now call them on the
10377 VariableInfo so we don't need to duplicate this code everywhere.
10379 * expression.cs (ParameterReference): Added `Block block' argument
10381 (LocalVariableReference, ParameterReference, This): The new
10382 VariableInfo class is now responsible for all the definite
10385 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10386 IsParameterAssigned, SetParameterAssigned): Removed.
10388 2003-05-18 Martin Baulig <martin@ximian.com>
10390 * typemanager.cs (InitCoreTypes): Try calling
10391 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10392 the 3-args-version. Corlib now also needs our `void_type'.
10393 (GetMethod): Added overloaded version which takes an optional
10394 `bool report_errors' to allow lookups of optional methods.
10396 2003-05-12 Martin Baulig <martin@ximian.com>
10398 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10399 only used for locals and not for parameters.
10401 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10403 * support.cs (InternalParameters.ParameterType): Return the
10404 ExternalType of the parameter.
10406 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10409 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10411 * class.cs (MethodData.Define): Do not set the `newslot' on
10412 interface members, if they are also flagged as "override".
10414 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10415 better code for ++i and i++. This only works for static fields
10416 and local variables.
10418 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10419 want to pull the DeclSpace out of the builder_to_declspace instead
10420 of the TypeBuilder (like in TypeContainer.FindMembers).
10422 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10423 instead of LookupTypeContainer. Fixes the crash on .NET for
10424 looking up interface members.
10426 * const.cs: Create our own emit context during the Definition
10427 stage, so that constants are evaluated in the proper context, when
10428 a recursive definition happens.
10430 2003-05-11 Martin Baulig <martin@ximian.com>
10432 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10433 new block for a switch section.
10434 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10435 the adding/lookup in the switch block. Fixes #39828.
10437 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10439 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10440 functionality: I needed to convert the data after I had performed
10441 the add/sub operation into the operands type size.
10443 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10444 pass the type for the box operation, otherwise the resulting
10445 object would have been of type object.
10447 (BoxedCast): Add constructor to specify the type to box as.
10449 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10451 * iterators.cs: I was reusing the `count' variable inadvertently,
10452 take steps to not allow this to happen.
10454 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10456 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10457 by creating an array at the point where the params starts and
10458 putting all those arguments there, then adjusting the size of the
10461 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10463 * expression.cs (New.AddressOf): Implement interface
10464 IMemoryLocation. This is used when the `new' operator is used in
10465 the context of an invocation to a method on a value type.
10467 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10470 * namespace.cs: Also check the using aliases here.
10472 * driver.cs: Move the test for using validity after the types have
10473 been entered, so we do a single pass that also includes the using
10476 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10477 in the regular case. CreateSiblingForFinally is doing extra
10480 * attribute.cs (GetAttributeArgumentExpression): Store the result
10481 on an out value, and use the return value to indicate failure
10482 instead of using null (which is a valid return for Constant.GetValue).
10484 * statement.cs: Perform the analysis flow for the increment
10485 portion after the statement, because this will be the real flow of
10486 execution. Fixes #42385
10488 * codegen.cs (EmitContext.EmitArgument,
10489 EmitContext.EmitStoreArgument): New helper functions when the
10490 RemapToProxy flag is set.
10492 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10495 Add support for remapping parameters.
10497 * iterators.cs: Propagate parameter values; Store parameter
10498 values in the proxy classes.
10500 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10502 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10503 need a proxy reference; I do not know what I was thinking
10505 * cs-parser.jay (constructor_initializer): catch another error,
10506 and display nice message.
10508 (field_declaration): catch void field declaration
10509 to flag a better error.
10511 * class.cs (MemberBase.CheckBase): Report an error instead of a
10512 warning if a new protected member is declared in a struct.
10513 (Field.Define): catch the error of readonly/volatile.
10515 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10517 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10518 volatile variable is taken
10520 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10522 * statement.cs (Fixed.Resolve): Report an error if we are not in
10525 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10527 * typemanager.cs: reuse the code that handles type clashes for
10528 delegates and enumerations.
10530 * class.cs (Report28): Always report.
10532 * expression.cs (EncodeAsAttribute): Allow nulls here.
10534 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10536 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10537 the functionality for testing whether an expression is valid for
10538 an attribute here. Also handle the case of arrays of elements
10541 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10542 encoding a linear array into an array of objects that are suitable
10543 to be passed to an CustomAttributeBuilder.
10545 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10547 * ecore.cs: (FieldExpr): Handle field remapping here.
10549 * iteratators.cs: Pass the instance variable (if the method is an
10550 instance method) to the constructors, so we can access the field
10551 variables on the class.
10553 TODO: Test this with structs. I think the THIS variable on
10554 structs might have to be a pointer, and not a refenrece
10556 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10558 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10559 local variables to fields in a proxy class.
10561 * iterators.cs (PopulateProxy): Rename our internal fields to
10563 Create a <THIS> field if we are an instance method, so we can
10564 reference our parent container variables.
10565 (MapVariable): Called back from the EmitContext code to enter a
10566 new variable to field mapping into the proxy class (we just create
10570 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10571 for using the remapped locals to fields.
10573 I placed the code here, because that gives the same semantics to
10574 local variables, and only changes the Emit code.
10576 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10577 statements inside iterators.
10578 (VariableInfo): Add a FieldBuilder for the cases when we are
10579 remapping local variables to fields in a proxy class
10581 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10582 current_block != null.
10584 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10585 not cope with strings, as it has been moved to the
10586 TableSwitchEmit. Fixed bug in switch generation.
10588 * expression.cs (New.DoResolve): Provide more context for the user
10589 when reporting an error.
10591 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10594 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10595 check the permissions for it. Note than in a type-resolution
10596 context the check was already present in DeclSpace.ResolveType,
10597 but was missing from the MemberAccess.
10599 (ArrayCreation.CheckIndices): warn if the user has
10600 more nested levels of expressions, but there are no more
10601 dimensions specified. Avoids crash on bug 41906.
10603 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10605 * statement.cs (Block): replace Implicit bool, for a generic
10607 New flag: `Unchecked'. This is used during the EmitMeta phase
10608 (which is out-of-line with the regular Resolve/Emit process for a
10609 statement, as this is done ahead of time, but still gets a chance
10610 to call constant resolve).
10612 (Block.Flags): new enum for adding a new flag.
10614 (Block.EmitMeta): track the state of unchecked.
10616 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10617 to enable constant resolution to work there as well.
10619 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10621 * typemanager.cs (ienumerable_type): Also look up
10622 System.Collections.IEnumerable.
10624 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10626 TODO: Test more than one conditional per method.
10628 * class.cs (Indexer.Define): Report the location where the user is
10629 referencing the unsupported feature.
10631 (MethodData): Overload the use of `conditionals' to
10632 minimize the creation of needless ArrayLists. This saves roughly
10633 212kb on my machine.
10635 (Method): Implement the new IIteratorContainer interface.
10636 (Method.SetYields): Implement the method by setting the ModFlags
10637 to contain METHOD_YIELDS.
10639 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10640 which just got set to null.
10642 * iterators.cs: New file.
10644 (Yield, YieldBreak): New statements.
10646 * statement.cs (Return.Resolve): Flag an error if we are used in
10647 an iterator method.
10649 * codegen.cs (InIterator): New flag set if the code is being
10650 compiled in an iterator method.
10652 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10653 internal modifier, and we just use it to avoid adding extra
10654 fields, as this is seldom used.
10656 * cs-parser.jay: Add yield_statement (yield and yield break).
10658 * driver.cs: New flag -v2 to turn on version 2 features.
10660 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10661 hashtable when v2 is enabled.
10663 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10665 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10666 there is already a namespace defined with this name.
10668 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10669 people upgraded their corlibs.
10671 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10672 always use fully qualified types, no need to use the compiler
10675 (TypeManager.IsNamespace): Use binarysearch.
10677 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10678 AddDelegate): I did not quite use the new IsValid API properly: I
10679 have to pass the short-name and the fullname. I was passing only
10680 the basename instead of the fullname sometimes.
10682 (TypeContainer.DefineType): call NamespaceClash.
10684 * interface.cs (Interface.DefineType): use NamespaceClash before
10687 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10690 * enum.cs: (Enum.DefineType): use NamespaceClash before
10693 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10694 speed increase. First, use the negative_hits cache when we get a
10695 negative. Second, add the type with its full original name
10696 instead of the new . and + encoded name (reflection uses + to
10697 separate type from a nested type). Use LookupTypeReflection
10698 directly which bypasses the type->name hashtable (that we already
10699 know does not contain the type.
10701 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10702 location/container type.
10704 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10706 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10708 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10710 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10711 method is being referenced in the method group from a static
10712 context, and report error 120 if so.
10714 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10717 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10718 is created, we create the A namespace).
10720 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10723 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10725 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10726 invocation to ModuleBuilder.GetType with the same values will
10727 return a new type instance, so we need to cache its return
10730 * expression.cs (Binary.ResolveOperator): Only allow the compare
10731 operators on enums if they are of the same type.
10733 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10734 types of ValueType on their own case. Before we were giving them
10735 the same treatment as objects.
10737 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10738 fullname. Short name is used to compare against container name.
10739 Fullname is used to check against defined namespace names.
10741 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10742 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10744 (Method.CheckBase): Call parent.
10745 (MemberBase.CheckBase): Check for protected members on sealed
10747 (PropertyBase.CheckBase): Call parent.
10748 (Field.Define): Call parent.
10750 * report.cs: Negative error codes are now mapped to 8000 - code,
10751 so that the display is render more nicely.
10753 * typemanager.cs: Do not use try/catch, instead report a regular
10756 (GetPointerType, GetReferenceType): These methods provide
10757 mechanisms to obtain the T* and T& from a T. We had the code
10758 previously scattered around the code base, and it also used
10759 TypeManager.LookupType that would go through plenty of caches.
10760 This one goes directly to the type source.
10762 In some places we did the Type.GetType followed by
10763 ModuleBuilder.GetType, but not in others, so this unifies the
10764 processing as well.
10766 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10767 statements now that we have namespace information.
10769 * typemanager.cs (IsNamespace): New method, returns whether the
10770 string presented is a namespace or not.
10772 (ComputeNamespaces): New public entry point, computes the list of
10773 available namespaces, using the GetNamespaces API call in Mono, or
10774 the slower version in MS.NET.
10776 Now before we start the semantic analysis phase, we have a
10777 complete list of namespaces including everything that the user has
10780 Deleted old code to cache namespaces in .nsc files.
10782 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10784 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10785 class/struct location definition Location for the implicit
10786 constructor location.
10788 (Operator.Define): Use the location of the operator for the
10789 implicit Method definition.
10791 (Constructor.Emit): use the constructor location for the implicit
10792 base initializer constructor.
10794 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10795 and the Expression class now contains two new methods:
10797 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10798 isolate type lookup from the rest of the resolution process.
10800 Since we use Expressions to hold type definitions due to the way
10801 we parse the input we have historically overloaded Resolve to
10802 perform the Type lookups if a special flag is passed. Now this is
10803 eliminated and two methods take their place.
10805 The differences in the two methods between xStep and xTerminal is
10806 that xStep is involved in our current lookup system that uses
10807 SimpleNames to compose a name, while xTerminal is used just to
10808 catch the case where the simplename lookup failed.
10810 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10812 * expression.cs (ResolveMemberAccess): Remove redundant code.
10813 TypeExpr expressions are always born fully resolved.
10815 * interface.cs (PopulateMethod): Do not lookup the types twice.
10816 We were doing it once during SemanticAnalysis and once during
10819 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10820 in local variable type definitions, were being returned as a
10821 SimpleName (we decomposed everything into a string), that is
10822 because primary_expression was being used instead of a type in the
10823 grammar (reduce/reduce conflicts).
10825 The part that was wrong is that we converted the expression into a
10826 string (an oversimplification in one hand, compounded with primary
10827 expressions doing string concatenation).
10833 Would return "A.B.C[]" as a SimpleName. This stopped things like
10834 using clauses from working on this particular context. And a type
10835 was being matched directly against "A.B.C[]".
10837 We now use the correct approach, and allow for ComposedCast to be
10838 part of the unary expression. So the "A.B.C []" become a composed
10839 cast of "A.B.C" (as a nested group of MemberAccess with a
10840 SimpleName at the end) plus the rank composition "[]".
10844 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10846 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10847 for the access level checking.
10849 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10850 `TypeContainer container', because I kept getting confused when I
10851 was debugging this code.
10853 * expression.cs (Indexers): Instead of tracking getters/setters,
10854 we now track them in parallel. We create one arraylist less, but
10855 most importantly it is possible now for the LValue code to find a
10856 matching get for a set.
10858 (IndexerAccess.DoResolveLValue): Update the code.
10859 GetIndexersForType has been modified already to extract all the
10860 indexers from a type. The code assumed it did not.
10862 Also make the code set the correct return type for the indexer.
10863 This was fixed a long time ago for properties, but was missing for
10864 indexers. It used to be void_type.
10866 (Binary.Emit): Test first for doubles instead of
10867 floats, as they are more common.
10869 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10870 when dealing with floats and the <=, >= operators. This fixes bug
10873 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10874 to load the array value by emitting a load on the foreach variable
10875 type. This was incorrect.
10877 We now emit the code to load an element using the the array
10878 variable type, and then we emit the conversion operator.
10882 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10884 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10886 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10888 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10889 test for protection before we test for signatures.
10891 (MethodSignature.ToString): implement.
10893 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10894 to the case where we reduced into a LongConstant.
10896 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10897 depend on whether the information is acurrate, because the
10898 Microsoft runtime will always claim that the array type is public,
10899 regardless of the real state.
10901 If the type is a pointer, another problem happens: the type is
10902 reported as non-public in Microsoft.
10904 In both cases we have to call CheckAccessLevel recursively with
10905 the underlying type as the argument to be tested.
10907 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10909 * assign.cs (Assign.Emit): If we are dealing with a compound
10910 assignment expression, we should use the code path that stores the
10911 intermediate result in a temporary value. This fixes #40903.
10913 *expression.cs (Indirection.ToString): Provide ToString method for
10916 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10918 * class.cs: Null out fields holding references to Block objects so
10919 they can be garbage collected.
10921 * expression.cs (OverloadResolve): Remove unused local.
10923 2003-04-07 Martin Baulig <martin@ximian.com>
10925 * codegen.cs (EmitContext.CurrentFile): New public field.
10926 (EmitContext.Mark): Use the CurrentFile to check whether the
10927 location is in the correct file.
10928 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10930 2003-04-07 Martin Baulig <martin@ximian.com>
10932 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10934 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10935 location. [FIXME: The location argument which gets passed to this
10936 method is sometimes wrong!]
10938 2003-04-07 Nick Drochak <ndrochak@gol.com>
10940 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10942 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10944 * expression.cs (Indirection.EmitAssign): We were using the
10945 temporary, but returning immediately instead of continuing the
10948 2003-04-06 Martin Baulig <martin@ximian.com>
10950 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10951 if it's a nested child, but also deriving from the outer class.
10954 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10955 nested child, but also deriving from the outer class. See
10957 (FilterWithClosure): We may access private members of the outer
10958 class if we're a nested child and deriving from the outer class.
10959 (RealMemberLookup): Only set `closure_private_ok' if the
10960 `original_bf' contained BindingFlags.NonPublic.
10962 2003-04-05 Martin Baulig <martin@ximian.com>
10964 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
10966 2003-04-02 Miguel de Icaza <miguel@ximian.com>
10968 * class.cs (Event.Define): Do not allow abstract events to have
10971 2003-04-01 Miguel de Icaza <miguel@ximian.com>
10973 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
10974 block in event declarations.
10976 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
10977 value type, get its address.
10979 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
10980 leaving a class on the stack instead of a boolean value (int
10981 0/1). Change the code so we compare against null, and then the
10982 result against zero.
10984 * class.cs (TypeContainer.GetClassBases): We were checking for the
10985 parent class being sealed too late.
10987 * expression.cs (Binary.Emit): For <= and >= when dealing with
10988 floating point values, use cgt.un and clt.un instead of cgt and
10991 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
10993 * statement.cs: Apply the same optimization as MS: skip the
10994 GetEnumerator returning an IEnumerator, and use the one returning a
10995 CharEnumerator instead. This allows us to avoid the try-finally block
10998 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
11000 * cs-parser.jay: Attributes cannot be applied to
11001 namespaces. Fixes #40473
11003 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11006 (Add*): check if the name is valid using the full name for constants,
11007 fields, properties and events.
11009 2003-03-28 Miguel de Icaza <miguel@ximian.com>
11011 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
11012 char constants to be part of the enumeration.
11014 * expression.cs (Conditional.DoResolve): Add support for operator
11015 true. Implements the missing functionality from 14.12
11017 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
11018 operator true/false as required by the spec.
11020 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
11021 implicit conversion to boolean.
11023 * statement.cs (Statement.ResolveBoolean): A boolean expression is
11024 also one where the type implements `operator true'.
11026 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
11027 get an expression that will invoke operator true based on an
11030 (GetConversionOperators): Removed the hack that called op_True
11033 (Expression.ResolveBoolean): Move this from Statement.
11035 2003-03-17 Miguel de Icaza <miguel@ximian.com>
11037 * ecore.cs (FieldExpr): do not allow initialization of initonly
11038 fields on derived classes
11040 2003-03-13 Martin Baulig <martin@ximian.com>
11042 * statement.cs (Block.Emit): Call ig.BeginScope() and
11043 ig.EndScope() when compiling with debugging info; call
11044 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
11046 2003-03-08 Miguel de Icaza <miguel@ximian.com>
11048 * expression.cs (Indexers): Do not construct immediately, allow
11049 for new members to be appended as we go. Fixes 38143
11051 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11053 * expression.cs: save/restore context when resolving an unchecked
11056 2003-03-05 Miguel de Icaza <miguel@ximian.com>
11058 * cfold.cs: Catch division by zero in modulus operator during
11061 2003-03-03 Miguel de Icaza <miguel@ximian.com>
11063 * interface.cs (Interface.DefineMembers): Avoid defining members
11066 2003-02-27 Miguel de Icaza <miguel@ximian.com>
11068 * driver.cs: handle the +/- options for -noconfig
11070 * statement.cs (Unckeched.Resolve): Also track the state of
11071 unchecked in the Resolve phase.
11073 2003-02-27 Martin Baulig <martin@ximian.com>
11075 * ecore.cs (Expression.MemberLookup): Don't create a
11076 MethodGroupExpr for something which is not a method. Fixes #38291.
11078 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11080 * class.cs (MemberBase.CheckParameters): Also check that the type
11081 is unmanaged if it is a pointer.
11083 * expression.cs (SizeOf.Resolve): Add location information.
11085 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11086 a managed type is declared.
11088 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11089 parameter modifiers as well. Fixes bug 38606
11091 * class.cs: Very sad. Am backing out the speed up changes
11092 introduced by the ArrayList -> Array in the TypeContainer, as they
11093 were not actually that much faster, and introduced a bug (no error
11094 reports on duplicated methods).
11096 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11097 source first, this will guarantee that we have a valid expression
11098 before calling in lower levels functions that will require a
11099 resolved object. Then use this original_source in the
11100 target.ResolveLValue instead of the original source that was
11103 Another change. Use target.Resolve instead of LValueResolve.
11104 Although we are resolving for LValues, we will let the Assign code
11105 take care of that (it will be called again from Resolve). This
11106 basically allows code like this:
11108 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11109 class Y { void A (X x) { x [0] += o; }
11111 The problem was that the indexer was trying to resolve for
11112 set_Item (idx, object o) and never finding one. The real set_Item
11113 was set_Item (idx, X). By delaying the process we get the right
11118 2003-02-23 Martin Baulig <martin@ximian.com>
11120 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11121 while calling DoEmit ().
11123 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11124 source files; if you use the #line directive inside a method, the
11125 compiler stops emitting line numbers for the debugger until it
11126 reaches the end of the method or another #line directive which
11127 restores the original file.
11129 2003-02-23 Martin Baulig <martin@ximian.com>
11131 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11133 2003-02-23 Martin Baulig <martin@ximian.com>
11135 * statement.cs (Block.AddChildVariableNames): We need to call this
11136 recursively, not just for our immediate children.
11138 2003-02-23 Martin Baulig <martin@ximian.com>
11140 * class.cs (Event.Define): Always make the field private, like csc does.
11142 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11143 actually work, fixes bug #37521.
11145 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11147 * delegate.cs: When creating the various temporary "Parameters"
11148 classes, make sure that we call the ComputeAndDefineParameterTypes
11149 on those new parameters (just like we do with the formal ones), to
11150 allow them to be resolved in the context of the DeclSpace.
11152 This fixes the bug that Dick observed in Bugzilla #38530.
11154 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11156 * expression.cs (ResolveMemberAccess): When resolving a constant,
11157 do not attempt to pull a constant if the value was not able to
11158 generate a valid constant.
11160 * const.cs (LookupConstantValue): Do not report more errors than required.
11162 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11164 * expression.cs: fixes bug #38328.
11166 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11168 * class.cs: Changed all the various members that can be part of a
11169 class from being an ArrayList to be an Array of the right type.
11170 During the DefineType type_list, interface_list, delegate_list and
11171 enum_list are turned into types, interfaces, delegates and enums
11174 And during the member population, indexer_list, event_list,
11175 constant_list, field_list, instance_constructor_list, method_list,
11176 operator_list and property_list are turned into their real arrays.
11178 Although we could probably perform this operation earlier, for
11179 good error reporting we need to keep the lists and remove the
11180 lists for longer than required.
11182 This optimization was triggered by Paolo profiling the compiler
11183 speed on the output of `gen-sample-program.pl' perl script.
11185 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11186 not crash in methods like MemberLookupFailed that use this field.
11188 This problem arises when the compiler fails to resolve a type
11189 during interface type definition for example.
11191 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11193 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11194 inherit from System.Object, so we have to stop at null, not only
11195 when reaching System.Object.
11197 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11199 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11200 DeclaredOnly because the parent indexer might have had a different
11201 name, but did not loop until the top of the hierarchy was reached.
11203 The problem this one fixes is 35492: when a class implemented an
11204 indexer from an interface, we were getting the interface method
11205 (which was abstract) and we were flagging an error (can not invoke
11208 This also keeps bug 33089 functioning, and test-148 functioning.
11210 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11211 out if a method is special is to see if it is declared in a
11212 property or event, or whether it is one of the predefined operator
11213 names. This should fix correctly #36804.
11215 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11217 The goal here is to remove the dependency on EmptyCast.Peel ().
11218 Killing it completely.
11220 The problem is that currently in a number of places where
11221 constants are expected, we have to "probe" for an EmptyCast, and
11222 Peel, which is not the correct thing to do, as this will be
11223 repetitive and will likely lead to errors.
11225 The idea is to remove any EmptyCasts that are used in casts that
11226 can be reduced to constants, so we only have to cope with
11229 This bug hunt was triggered by Bug 37363 and the desire to remove
11230 the duplicate pattern where we were "peeling" emptycasts to check
11231 whether they were constants. Now constants will always be
11234 * ecore.cs: Use an enumconstant here instead of wrapping with
11237 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11238 throwing me off. By handling this we can get rid of a few hacks.
11240 * statement.cs (Switch): Removed Peel() code.
11242 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11244 * class.cs: Location information for error 508
11246 * expression.cs (New.DoResolve): Add a guard against double
11247 resolution of an expression.
11249 The New DoResolve might be called twice when initializing field
11250 expressions (see EmitFieldInitializers, the call to
11251 GetInitializerExpression will perform a resolve on the expression,
11252 and later the assign will trigger another resolution
11254 This leads to bugs (#37014)
11256 * delegate.cs: The signature for EndInvoke should contain any ref
11257 or out parameters as well. We were not doing this in the past.
11259 * class.cs (Field.Define): Do not overwrite the type definition
11260 inside the `volatile' group. Turns out that volatile enumerations
11261 were changing the type here to perform a validity test, which
11264 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11266 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11267 and structs, we do not want to load the instance variable
11269 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11270 enum_type has to be handled like an object reference (implicit
11271 conversions exists from this to object), but the regular IsClass
11272 and IsValueType tests will never return true for this one.
11274 Also we use TypeManager.IsValueType instead of type.IsValueType,
11275 just for consistency with the rest of the code (this is only
11276 needed if we ever use the construct exposed by test-180.cs inside
11277 corlib, which we dont today).
11279 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11281 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11284 2003-02-09 Martin Baulig <martin@ximian.com>
11286 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11287 (Namespace.DefineNamespaces): New static public method; this is
11288 called when we're compiling with debugging to add all namespaces
11289 to the symbol file.
11291 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11292 pass it to the Namespace's .ctor.
11294 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11295 and MethodBase arguments; pass the namespace ID to the symwriter;
11296 pass the MethodBase instead of the token to the symwriter.
11297 (SymbolWriter.DefineNamespace): New method to add a namespace to
11300 2003-02-09 Martin Baulig <martin@ximian.com>
11302 * symbolwriter.cs: New file. This is a wrapper around
11303 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11304 methods here in near future.
11306 2003-02-09 Martin Baulig <martin@ximian.com>
11308 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11309 ILGenerator.MarkSequencePoint() which are actually used by the
11312 2003-02-09 Martin Baulig <martin@ximian.com>
11314 * location.cs (SourceFile): New public sealed class. This
11315 contains the name and an index which is used in the location's token.
11316 (Location): Reserve an appropriate number of bits in the token for
11317 the source file instead of walking over that list, this gives us a
11318 really huge performance improvement when compiling with debugging.
11320 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11321 `SourceFile' argument instead of a string.
11322 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11323 but don't parse/tokenize here, we need to generate the list of all
11324 source files before we do that.
11325 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11328 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11329 instead of a string.
11331 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11334 2003-02-09 Martin Baulig <martin@ximian.com>
11336 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11337 filename on `#line default'.
11339 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11341 * statement.cs: don't clear the pinned var when the fixed statement
11342 returns from the method (fixes bug#37752).
11344 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11346 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11349 2003-02-07 Martin Baulig <martin@ximian.com>
11351 * driver.cs: Removed the `--debug-args' command line argument.
11353 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11354 automatically by the AsssemblyBuilder.
11355 (CodeGen.InitializeSymbolWriter): We don't need to call any
11356 initialization function on the symbol writer anymore. This method
11357 doesn't take any arguments.
11359 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11361 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11362 from referenced assemblies as well.
11364 2003-02-02 Martin Baulig <martin@ximian.com>
11366 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11368 2003-02-02 Martin Baulig <martin@ximian.com>
11370 * class.cs (Constructor.Emit): Open the symbol writer before
11371 emitting the constructor initializer.
11372 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11373 single-stepping through constructor initializers.
11375 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11377 * class.cs: Handle error 549: do not allow virtual methods in
11380 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11382 * decl.cs: Check access levels when resolving types
11384 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11386 * statement.cs: Add parameters and locals set in catch blocks that might
11387 return to set vector
11389 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11391 * class.cs (Operator): Set the SpecialName flags for operators.
11393 * expression.cs (Invocation.DoResolve): Only block calls to
11394 accessors and operators on SpecialName methods.
11396 (Cast.TryReduce): Handle conversions from char constants.
11399 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11401 * statement.cs: small memory and time optimization in FlowBranching.
11403 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11405 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11406 problem that the last fix but in the other sid (Set).
11408 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11409 access when there is no indexer in the hierarchy.
11411 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11413 * class.cs: Combine some if statements.
11415 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11417 * driver.cs: fixed bug #37187.
11419 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11421 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11422 any indexer, it's needed to build a list with all the indexers in the
11423 hierarchy (AllGetters), else we have problems. Fixes #35653.
11425 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11427 * class.cs (MethodData.Define): It is wrong for an interface
11428 implementation to be static in both cases: explicit and implicit.
11429 We were only handling this in one case.
11431 Improve the if situation there to not have negations.
11433 * class.cs (Field.Define): Turns out that we do not need to check
11434 the unsafe bit on field definition, only on usage. Remove the test.
11436 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11438 * driver.cs: use assembly.Location instead of Codebase (the latest
11439 patch made mcs fail when using MS assemblies).
11441 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11443 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11444 get the path to *corlib.dll.
11446 2003-01-21 Nick Drochak <ndrochak@gol.com>
11450 * typemanager.cs: Remove compiler warnings
11452 2003-01-20 Duncan Mak <duncan@ximian.com>
11454 * AssemblyInfo.cs: Bump the version number to 0.19.
11456 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11458 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11460 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11462 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11464 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11466 * cs-parser.jay: Small fix: we were not comparing the constructor
11467 name correctly. Thanks to Zoltan for the initial pointer.
11469 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11471 * cs-tokenizer.cs: Set file name when specified with #line
11473 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11475 * cs-parser.jay: Only perform the constructor checks here if we
11476 are named like the class; This will help provider a better
11477 error. The constructor path is taken when a type definition is
11478 not found, but most likely the user forgot to add the type, so
11479 report that rather than the constructor error.
11481 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11483 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11486 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11488 * cs-parser.jay: Add cleanup call.
11490 2003-01-13 Duncan Mak <duncan@ximian.com>
11492 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11493 consistent with other methods.
11495 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11497 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11499 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11501 * attribute.cs: only set GuidAttr to true when we have a
11504 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11508 * typemanager.cs: fixes to allow mcs compile corlib with the new
11509 Type.IsSubclassOf fix.
11511 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11513 * expression.cs (LocalVariableReference.DoResolve): Classify a
11514 constant as a value, not as a variable. Also, set the type for
11517 * cs-parser.jay (fixed_statement): take a type instead of a
11518 pointer_type, so we can produce a better error message later.
11520 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11523 (For.DoEmit): Make inifinite loops have a
11524 non-conditional branch back.
11526 (Fixed.DoEmit): First populate the pinned variables, then emit the
11527 statement, then clear the variables. Before I was emitting the
11528 code once for each fixed piece.
11531 2003-01-08 Martin Baulig <martin@ximian.com>
11533 * statement.cs (FlowBranching.MergeChild): A break in a
11534 SWITCH_SECTION does not leave a loop. Fixes #36155.
11536 2003-01-08 Martin Baulig <martin@ximian.com>
11538 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11539 lives in the same number space than `param_map'. Fixes #36154.
11541 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11543 * cs-parser.jay (constructor_declaration): Set the
11544 Constructor.ModFlags before probing for it. This makes the
11545 compiler report 514, 515 and 132 (the code was there, but got
11548 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11549 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11550 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11552 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11554 * enum.cs: create the enum static fields using the enum type.
11556 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11558 * class.cs: don't try to create the ParamBuilder for the return
11559 type if it's not needed (and handle it breaking for the ms runtime
11562 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11564 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11566 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11568 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11569 the command. This showed up while compiling the JANET source
11570 code, which used \r as its only newline separator.
11572 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11574 * class.cs (Method.Define): If we are an operator (because it
11575 reuses our code), then set the SpecialName and HideBySig. #36128
11577 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11579 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11580 exception, report error 120 `object reference required'.
11582 * driver.cs: Add --pause option, used during to measure the size
11583 of the process as it goes with --timestamp.
11585 * expression.cs (Invocation.DoResolve): Do not allow methods with
11586 SpecialName to be invoked.
11588 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11590 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11591 number before adding it.
11593 2002-12-21 Ravi Pratap <ravi@ximian.com>
11595 * ecore.cs (StandardImplicitConversion): When in an unsafe
11596 context, we allow conversion between void * to any other pointer
11597 type. This fixes bug #35973.
11599 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11601 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11602 is not thrown when extensionless outputs are used
11604 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11606 * rootcontext.cs: fixed compilation of corlib.
11608 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11610 * attribute.cs (Attributes.Contains): Add new method.
11612 * class.cs (MethodCore.LabelParameters): if the parameter is an
11613 `out' parameter, check that no attribute `[In]' has been passed.
11615 * enum.cs: Handle the `value__' name in an enumeration.
11617 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11619 * decl.cs: Added special case to allow overrides on "protected
11622 2002-12-18 Ravi Pratap <ravi@ximian.com>
11624 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11625 since it makes much more sense.
11627 (Attributes.ctor): Don't require a Location parameter.
11629 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11631 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11632 since we already have that information per attribute.
11634 * everywhere : make appropriate changes.
11636 * class.cs (LabelParameters): Write the code which actually
11637 applies attributes to the return type. We can't do this on the MS
11638 .NET runtime so we flag a warning in the case an exception is
11641 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11643 * const.cs: Handle implicit null conversions here too.
11645 2002-12-17 Ravi Pratap <ravi@ximian.com>
11647 * class.cs (MethodCore.LabelParameters): Remove the extra
11648 Type [] parameter since it is completely unnecessary. Instead
11649 pass in the method's attributes so that we can extract
11650 the "return" attribute.
11652 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11654 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11655 of ignoring it and letting the compile continue.
11657 * typemanager.cs (ChangeType): use an extra argument to return an
11658 error condition instead of throwing an exception.
11660 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11662 * expression.cs (Unary.TryReduce): mimic the code for the regular
11663 code path. Perform an implicit cast in the cases where we can
11664 implicitly convert to one of the integral types, and then reduce
11665 based on that constant. This fixes bug #35483.
11667 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11669 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11671 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11673 * namespace.cs: fixed bug #35489.
11675 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11677 * class.cs: Remove some dead code.
11679 * cs-parser.jay: Estimate the number of methods needed
11680 (RootContext.MethodCount);
11682 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11683 numbers instead of StringBuilders.
11685 * support.cs (PtrHashtable): Add constructor with initial size;
11686 We can now reduce reallocations of the method table.
11688 2002-12-10 Ravi Pratap <ravi@ximian.com>
11690 * attribute.cs (ApplyAttributes): Keep track of the emitted
11691 attributes on a per-target basis. This fixes bug #35413.
11693 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11695 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11696 default to the Windows 1252 encoding.
11698 (UnixParseOption): Support version, thanks to Alp for the missing
11701 * AssemblyInfo.cs: Add nice assembly information.
11703 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11706 * cs-parser.jay: Allow a trailing comma before the close bracked
11707 in the attribute_section production.
11709 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11710 address of the instance was being taken, I will take this out,
11711 because we take the address of the object immediately here.
11713 2002-12-09 Ravi Pratap <ravi@ximian.com>
11715 * typemanager.cs (AreMultipleAllowed): Take care of the most
11716 obvious case where attribute type is not in the current assembly -
11719 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11721 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11722 definitions, instead of doing that afterwards.
11724 Also we use a nice little hack, depending on the constructor, we
11725 know if we are a "composed" name or a simple name. Hence, we
11726 avoid the IndexOf test, and we avoid
11728 * codegen.cs: Add code to assist in a bug reporter to track down
11729 the source of a compiler crash.
11731 2002-12-07 Ravi Pratap <ravi@ximian.com>
11733 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11734 types have been emitted for a given element and flag an error
11735 if something which does not have AllowMultiple set is used more
11738 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11739 attribute types and their corresponding AllowMultiple properties
11741 (AreMultipleAllowed): Check the property for a given type.
11743 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11744 property in the case we have a TypeContainer.
11746 (Attributes.AddAttribute): Detect duplicates and just skip on
11747 adding them. This trivial fix catches a pretty gross error in our
11748 attribute emission - global attributes were being emitted twice!
11750 Bugzilla bug #33187 is now fixed.
11752 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11754 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11755 instead of pp_and).
11757 * expression.cs (Binary.ResolveOperator): I can only use the
11758 Concat (string, string, string) and Concat (string, string,
11759 string, string) if the child is actually a concatenation of
11762 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11764 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11765 context where we need a 2-character lookahead.
11767 * pending.cs (PendingImplementation): Rework so we can keep track
11768 of interface types all the time, and flag those which were
11769 implemented by parents as optional.
11771 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11773 * expression.cs (Binary.ResolveOperator): Use
11774 String.Concat(string,string,string) or
11775 String.Concat(string,string,string,string) when possible.
11777 * typemanager: More helper methods.
11780 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11782 * pending.cs: remove the bogus return from GetMissingInterfaces()
11783 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11785 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11787 * namespace.cs: avoid duplicated 'using xxx' being added to
11788 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11789 when we get more than one 'using' statement for the same namespace.
11790 Report a CS0105 warning for it.
11792 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11794 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11795 of calling getChar/putback, uses internal knowledge of it.
11797 (xtoken): Reorder tokenizer so most common patterns are checked
11798 first. This reduces the compilation time in another 5% (from 8.11s
11799 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11801 The parsing time is 22% of the compilation in mcs, and from that
11802 64% is spent on the tokenization process.
11804 I tried using a binary search for keywords, but this is slower
11805 than the hashtable. Another option would be to do a couple of
11808 * Not use a StringBuilder, instead use an array of chars,
11809 with a set value. Notice that this way we could catch
11810 the 645 error without having to do it *afterwards*.
11812 * We could write a hand-parser to avoid the hashtable
11813 compares altogether.
11815 The identifier consumption process takes 37% of the tokenization
11816 time. Another 15% is spent on is_number. 56% of the time spent
11817 on is_number is spent on Int64.Parse:
11819 * We could probably choose based on the string length to
11820 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11823 Another 3% is spend on wrapping `xtoken' in the `token' function.
11825 Handle 0xa0 as whitespace (#34752)
11827 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11829 * typemanager.cs (IsCLRType): New routine to tell whether a type
11830 is one of the builtin types.
11832 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11833 typecode in more places instead of doing pointer comparissions.
11834 We could leverage some knowledge about the way the typecodes are
11837 New code to cache namespaces in assemblies, it is currently not
11838 invoked, to be used soon.
11840 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11842 * expression.cs (Binary.ResolveOperator): specially handle
11843 strings, and do not perform user-defined operator overloading for
11846 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11848 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11849 internalcall as it is a pretty simple operation; Avoid whenever
11850 possible to call Char.IsLetter.
11852 (consume_identifier): Cut by half the number of
11853 hashtable calls by merging the is_keyword and GetKeyword behavior.
11855 Do not short-circuit, because if we do, we
11856 report errors (ie, #if false && true would produce an invalid
11860 2002-11-24 Martin Baulig <martin@ximian.com>
11862 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11863 check constant ranges and report a CS0221. Fixes #33186.
11865 2002-11-24 Martin Baulig <martin@ximian.com>
11867 * cs-parser.jay: Make this work for uninitialized variable
11868 declarations in the `for' initializer. Fixes #32416.
11870 2002-11-24 Martin Baulig <martin@ximian.com>
11872 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11873 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11875 2002-11-24 Martin Baulig <martin@ximian.com>
11877 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11878 argument; if true, we also check for user-defined conversions.
11879 This is only needed if both arguments are of a user-defined type.
11880 Fixes #30443, added test-175.cs.
11881 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11883 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11885 2002-11-24 Martin Baulig <martin@ximian.com>
11887 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11888 function to get the store opcode.
11889 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11890 only emit the Ldelema if the store opcode is Stobj. You must run
11891 both test-34 and test-167 to test this. Fixes #34529.
11893 2002-11-23 Martin Baulig <martin@ximian.com>
11895 * ecore.cs (Expression.MemberLookup): Added additional
11896 `qualifier_type' argument which is used when we're being called
11897 from MemberAccess.DoResolve() and null if we're called from a
11899 (Expression.MemberLookupFailed): New method to report errors; this
11900 does the CS1540 check and reports the correct error message.
11902 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11903 argument for the CS1540 check and redone the way how we're dealing
11904 with private members. See the comment in the source code for details.
11905 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11906 `closure_start_type' to `closure_qualifier_type' and check whether
11907 it's not null. It was not this filter being broken, it was just
11908 being called with the wrong arguments.
11910 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11911 and pass it the correct `qualifier_type'; this also does the error
11914 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11916 * expression.cs (Invocation.EmitParams): If the we are dealing
11917 with a non-built-in value type, load its address as well.
11919 (ArrayCreation): Use a a pretty constant instead
11920 of the hardcoded value 2. Use 6 instead of 2 for the number of
11921 static initializers.
11923 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11924 because they are not really value types, just glorified integers.
11926 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11928 * ecore.cs: Remove redundant code for enumerations, make them use
11929 the same code path as everything else, fixes the casting issue
11930 with enumerations in Windows.Forms.
11932 * attribute.cs: Do only cast to string if it is a string, the
11933 validation happens later.
11935 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11936 people upgrade their corlibs.
11938 * ecore.cs: Oops, enumerations were not following the entire code path
11940 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11942 * typemanager.cs (FilterWithClosure): Commented out the test for
11943 1540 in typemanager.cs, as it has problems when accessing
11944 protected methods from a parent class (see test-174.cs).
11946 * attribute.cs (Attribute.ValidateGuid): new method.
11947 (Attribute.Resolve): Use above.
11949 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11951 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11953 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11954 handling for enumerations, as we only needed the TypeContainer
11955 functionality to begin with (this is required for the fix below to
11956 work for enums that reference constants in a container class for
11959 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
11961 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
11962 a valid TypeBuilder to perform lookups on.o
11964 * class.cs (InheritableMemberSignatureCompare): Use true in the
11965 call to GetGetMethod and GetSetMethod, because we are comparing
11966 the signature, and we need to get the methods *even* if they are
11969 (PropertyBase.CheckBase): ditto.
11971 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
11972 GotoCase.Resolve): Use Peel on EmpytCasts.
11974 * ecore.cs (EmptyCast): drop child, add Peel method.
11976 2002-11-17 Martin Baulig <martin@ximian.com>
11978 * ecore.cs (EmptyCast.Child): New public property.
11980 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
11981 label resolved to an EmptyCast. Fixes #34162.
11982 (GotoCase.Resolve): Likewise.
11983 (Block.EmitMeta): Likewise.
11985 2002-11-17 Martin Baulig <martin@ximian.com>
11987 * expression.cs (Invocation.BetterConversion): Prefer int over
11988 uint; short over ushort; long over ulong for integer literals.
11989 Use ImplicitConversionExists instead of StandardConversionExists
11990 since we also need to check for user-defined implicit conversions.
11991 Fixes #34165. Added test-173.cs.
11993 2002-11-16 Martin Baulig <martin@ximian.com>
11995 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
11996 with the `true' and `false' literals. Fixes #33151.
11998 2002-11-16 Martin Baulig <martin@ximian.com>
12000 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
12001 October 22nd; don't do the cs1540 check for static members.
12003 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
12004 now using our own filter here and doing the cs1540 check again.
12006 2002-11-16 Martin Baulig <martin@ximian.com>
12008 * support.cs (InternalParameters): Don't crash if we don't have
12009 any fixed parameters. Fixes #33532.
12011 2002-11-16 Martin Baulig <martin@ximian.com>
12013 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
12014 when looking up static methods to make this work on Windows.
12017 2002-11-16 Martin Baulig <martin@ximian.com>
12019 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
12020 a setter rather than using PropertyInfo.CanWrite.
12022 2002-11-15 Nick Drochak <ndrochak@gol.com>
12024 * class.cs: Allow acces to block member by subclasses. Fixes build
12027 2002-11-14 Martin Baulig <martin@ximian.com>
12029 * class.cs (Constructor.Emit): Added the extern/block check.
12032 2002-11-14 Martin Baulig <martin@ximian.com>
12034 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
12035 iteration while looking for indexers, this is needed because the
12036 indexer may have a different name in our base classes. Fixed the
12037 error reporting (no indexers at all, not get accessor, no
12038 overloaded match). Fixes bug #33089.
12039 (IndexerAccess.DoResolveLValue): Likewise.
12041 2002-11-14 Martin Baulig <martin@ximian.com>
12043 * class.cs (PropertyBase.CheckBase): Make this work for multiple
12044 indexers. Fixes the first part of bug #33089.
12045 (MethodSignature.InheritableMemberSignatureCompare): Added support
12048 2002-11-13 Ravi Pratap <ravi@ximian.com>
12050 * attribute.cs (Attribute.Resolve): Catch the
12051 NullReferenceException and report it since it isn't supposed to
12054 2002-11-12 Miguel de Icaza <miguel@ximian.com>
12056 * expression.cs (Binary.EmitBranchable): Also handle the cases for
12057 LogicalOr and LogicalAnd that can benefit from recursively
12058 handling EmitBranchable. The code now should be nice for Paolo.
12060 2002-11-08 Miguel de Icaza <miguel@ximian.com>
12062 * typemanager.cs (LookupType): Added a negative-hit hashtable for
12063 the Type lookups, as we perform quite a number of lookups on
12064 non-Types. This can be removed once we can deterministically tell
12065 whether we have a type or a namespace in advance.
12067 But this might require special hacks from our corlib.
12071 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12072 and double which avoids a conversion from an integer to a double.
12074 * expression.cs: tiny optimization, avoid calling IsConstant,
12075 because it effectively performs the lookup twice.
12077 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12079 But a bogus return here to keep the semantics of the old code
12080 until the Mono runtime is fixed.
12082 * pending.cs (GetMissingInterfaces): New method used to remove all
12083 the interfaces that are already implemented by our parent
12084 classes from the list of pending methods.
12086 * interface.cs: Add checks for calls after ResolveTypeExpr.
12088 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12090 * class.cs (Class.Emit): Report warning 67: event not used if the
12091 warning level is beyond 3.
12093 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12094 being a NullLiteral.
12096 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12099 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12100 path that might fail if a type can not be resolved.
12102 * expression.cs (Binary.Emit): Emit unsigned versions of the
12105 * driver.cs: use error 5.
12107 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12109 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12111 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12113 * cs-parser.jay (switch_section): A beautiful patch from Martin
12114 Baulig that fixed 33094.
12116 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12118 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12119 Check whether the base is abstract and report an error if so.
12121 * expression.cs (IndexerAccess.DoResolveLValue,
12122 IndexerAccess.DoResolve): ditto.
12124 (Invocation.DoResolve): ditto.
12126 (Invocation.FullMethodDesc): Improve the report string.
12128 * statement.cs (Block): Eliminate IsVariableDefined as it is
12129 basically just a wrapper for GetVariableInfo.
12131 * ecore.cs (SimpleName): Use new
12133 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12134 type, as we return the actual parameter ref/unref state on a
12137 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12139 * support.cs: Return proper flags REF/OUT fixing the previous
12142 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12143 not used to mean `ref' but `ref or out' in ParameterReference
12145 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12146 full type signature instead of calling TypeManger.CSharpName
12149 * support.cs (InternalParameters.ParameterDesc): Do not compare
12150 directly to the modflags, because REF/OUT will actually be bitsets
12153 * delegate.cs (VerifyMethod): Check also the modifiers.
12155 * cs-tokenizer.cs: Fix bug where floating point values with an
12156 exponent where a sign was missing was ignored.
12158 * driver.cs: Allow multiple assemblies to be specified in a single
12161 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12163 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12164 because identifiers after a parenthesis would end up in this kind
12165 of production, and we needed to desamiguate it for having casts
12168 (UserDefinedType *) xxx
12170 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12172 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12173 we should set on the Bindingflags.NonPublic, but not turn on
12174 private_ok. private_ok controls whether a Private member is
12175 returned (this is chekced on the filter routine), while the
12176 BindingFlags.NonPublic just controls whether private/protected
12177 will be allowed. This fixes the problem part of the problem of
12178 private properties being allowed to be used in derived classes.
12180 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12181 so we can call the children DoResolveLValue method (this will
12182 properly signal errors on lvalue assignments to base properties)
12184 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12185 getter are null, and we have a property info, we know that this
12186 happened because the lookup failed, so we report an error 122 for
12187 protection level violation.
12189 We also silently return if setter and getter are null in the
12190 resolve functions, this condition only happens if we have flagged
12191 the error before. This is the other half of the problem.
12193 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12194 not have accessibility information, that is why we were returning
12195 true in the filter function in typemanager.cs.
12197 To properly report 122 (property is inaccessible because of its
12198 protection level) correctly, we report this error in ResolveAccess
12199 by failing if both the setter and the getter are lacking (ie, the
12202 DoResolve and DoLResolve have been modified to check for both
12203 setter/getter being null and returning silently, the reason being
12204 that I did not want to put the knowledge about this error in upper
12207 int old = Report.Errors;
12208 x = new PropertyExpr (...);
12209 if (old != Report.Errors)
12214 So the property expr is returned, but it is invalid, so the error
12215 will be flagged during the resolve process.
12217 * class.cs: Remove InheritablePropertySignatureCompare from the
12218 class, as we no longer depend on the property signature to compute
12219 whether it is possible to implement a method or not.
12221 The reason is that calling PropertyInfo.GetGetMethod will return
12222 null (in .NET, in Mono it works, and we should change this), in
12223 cases where the Get Method does not exist in that particular
12228 class X { public virtual int A { get { return 1; } } }
12230 class Z : Y { public override int A { get { return 2; } } }
12232 Would fail in Z because the parent (Y) would not have the property
12233 defined. So we avoid this completely now (because the alternative
12234 fix was ugly and slow), and we now depend exclusively on the
12237 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12238 reference method, instead of using the property.
12240 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12241 routines are gone now.
12243 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12244 names, they were incorrectly named.
12246 * cs-tokenizer.cs: Return are more gentle token on failure.
12248 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12249 had an out-of-sync index variable, which caused it to remove from
12250 the list of pending methods the wrong method sometimes.
12252 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12254 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12255 CanWrite, because those refer to this particular instance of the
12256 property, and do not take into account the fact that we can
12257 override single members of a property.
12259 Constructor requires an EmitContext. The resolution process does
12260 not happen here, but we need to compute the accessors before,
12261 because the resolution does not always happen for properties.
12263 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12264 subclass, before we did not update this flag, but we did update
12267 (GetAccessors): Drop this routine, as it did not work in the
12268 presence of partially overwritten set/get methods.
12270 Notice that this broke the cs1540 detection, but that will require
12273 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12277 * driver.cs: issue a warning instead of an error if we don't support
12278 debugging for the platform. Also ignore a couple of errors that may
12279 arise when trying to write the symbols. Undo my previous patch.
12281 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12283 * driver.cs: ignore /debug switch except for Unix platforms.
12285 2002-10-23 Nick Drochak <ndrochak@gol.com>
12287 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12289 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12291 * driver.cs: Do not make mcs-debug conditional, so we do not break
12292 builds that use it.
12294 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12295 review this patch. But basically after all the children variables
12296 have been merged, the value of "Breaks" was not being set to
12297 new_breaks for Switch blocks. I think that it should be set after
12298 it has executed. Currently I set this to the value of new_breaks,
12299 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12300 conservative, but I do not understand this code very well.
12302 I did not break anything in the build, so that is good ;-)
12304 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12306 2002-10-20 Mark Crichton <crichton@gimp.org>
12308 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12310 2002-10-20 Nick Drochak <ndrochak@gol.com>
12312 * cfold.cs: Fixed compile blocker.
12314 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12316 * driver.cs: I was chekcing the key, not the file.
12318 2002-10-19 Ravi Pratap <ravi@ximian.com>
12320 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12321 message that we were generating - we just need to silently return
12324 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12326 * class.cs (Event.Define): Change my previous commit, as this
12327 breaks the debugger. This is a temporary hack, as it seems like
12328 the compiler is generating events incorrectly to begin with.
12330 * expression.cs (Binary.ResolveOperator): Added support for
12331 "U operator - (E x, E y)"
12333 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12336 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12337 init-only variables, but this path did not take into account that
12338 there might be also instance readonly variables. Correct this
12341 This fixes bug 32253
12343 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12346 * driver.cs: Change the extension for modules to `netmodule'
12348 * cs-parser.jay: Improved slightly the location tracking for
12349 the debugger symbols.
12351 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12352 modifiers that were specified instead of the hardcoded value
12353 (FamAndAssem). This was basically ignoring the static modifier,
12354 and others. Fixes 32429.
12356 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12357 fixed a bug in the process (32476)
12359 * expression.cs (ArrayAccess.EmitAssign): Patch from
12360 hwang_rob@yahoo.ca that fixes bug 31834.3
12362 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12364 * driver.cs: Make the module extension .netmodule.
12366 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12368 * driver.cs: Report an error if the resource file is not found
12369 instead of crashing.
12371 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12372 false, like Emit does.
12374 2002-10-16 Nick Drochak <ndrochak@gol.com>
12376 * typemanager.cs: Remove unused private member. Also reported mcs
12377 bug to report this as a warning like csc.
12379 2002-10-15 Martin Baulig <martin@gnome.org>
12381 * statement.cs (Statement.Emit): Made this a virtual method; emits
12382 the line number info and calls DoEmit().
12383 (Statement.DoEmit): New protected abstract method, formerly knows
12384 as Statement.Emit().
12386 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12388 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12390 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12391 have fixed a remaining problem: not every AddXXXX was adding a
12392 fully qualified name.
12394 Now everyone registers a fully qualified name in the DeclSpace as
12395 being defined instead of the partial name.
12397 Downsides: we are slower than we need to be due to the excess
12398 copies and the names being registered this way.
12400 The reason for this is that we currently depend (on the corlib
12401 bootstrap for instance) that types are fully qualified, because
12402 we dump all the types in the namespace, and we should really have
12403 types inserted into the proper namespace, so we can only store the
12404 basenames in the defined_names array.
12406 2002-10-10 Martin Baulig <martin@gnome.org>
12408 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12409 from bug #31834, see the bug report for a testcase which is
12412 2002-10-10 Martin Baulig <martin@gnome.org>
12414 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12415 flow analysis code for this.
12417 * statement.cs (Do, While, For): Tell the flow analysis code about
12419 (FlowBranching.UsageVector): Added support for infinite loops.
12420 (Block.Resolve): Moved the dead code elimination here and use flow
12423 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12425 * class.cs (Field.Define): Catch cycles on struct type
12428 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12429 fields if the fields are static. We only need to check instance
12432 * expression.cs (As.DoResolve): Test for reference type.
12434 * statement.cs (Using.ResolveExpression): Use
12435 ConvertImplicitRequired, not ConvertImplicit which reports an
12437 (Using.ResolveLocalVariableDecls): ditto.
12439 * expression.cs (Binary.ResolveOperator): Report errors in a few
12440 places where we had to.
12442 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12444 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12446 * expression.cs: Use StoreFromPtr instead of extracting the type
12447 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12449 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12450 an enumeration value to a System.Enum, but System.Enum is not a
12451 value type, but an class type, so we need to box.
12453 (Expression.ConvertExplicit): One codepath could return
12454 errors but not flag them. Fix this. Fixes #31853
12456 * parameter.cs (Resolve): Do not allow void as a parameter type.
12458 2002-10-06 Martin Baulig <martin@gnome.org>
12460 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12461 if it's a class type and not a struct. Fixes #31815.
12463 2002-10-06 Martin Baulig <martin@gnome.org>
12465 * statement.cs: Reworked the flow analysis code a bit to make it
12466 usable for dead code elimination.
12468 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12470 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12472 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12474 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12475 to fix the test 165, will investigate deeper.
12477 2002-10-04 Martin Baulig <martin@gnome.org>
12479 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12480 finally blocks actually work.
12481 (Try.Resolve): We don't need to create a sibling for `finally' if
12482 there is no finally block.
12484 2002-10-04 Martin Baulig <martin@gnome.org>
12486 * class.cs (Constructor.Define): The default accessibility for a
12487 non-default constructor is private, not public.
12489 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12491 * class.cs (Constructor): Make AllowedModifiers public, add
12494 * cs-parser.jay: Perform the modifiers test here, as the
12495 constructor for the Constructor class usually receives a zero
12496 because of the way we create it (first we create, later we
12497 customize, and we were never checking the modifiers).
12499 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12500 is a version of LookupTypeReflection that includes the type-name
12501 cache. This can be used as a fast path for functions that know
12502 the fully qualified name and are only calling into *.GetType() to
12503 obtain a composed type.
12505 This is also used by TypeManager.LookupType during its type
12508 (LookupType): We now also track the real type name, as sometimes
12509 we can get a quey for the real type name from things like
12510 ComposedCast. This fixes bug 31422.
12512 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12513 complete type fullname, it does not have to go through the type
12514 resolution system to obtain the composed version of the type (for
12515 obtaining arrays or pointers).
12517 (Conditional.Emit): Use the EmitBoolExpression to
12518 generate nicer code, as requested by Paolo.
12520 (ArrayCreation.CheckIndices): Use the patch from
12521 hwang_rob@yahoo.ca to validate the array initializers.
12523 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12525 * class.cs (ConstructorInitializer.Emit): simplify code by using
12526 Invocation.EmitCall, and at the same time, fix the bugs in calling
12527 parent constructors that took variable arguments.
12529 * ecore.cs (Expression.ConvertNumericExplicit,
12530 Expression.ImplicitNumericConversion): Remove the code that
12531 manually wrapped decimal (InternalTypeConstructor call is now gone
12534 * expression.cs (Cast.TryReduce): Also handle decimal types when
12535 trying to perform a constant fold on the type.
12537 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12539 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12540 that only turned off an error report, and did nothing else.
12542 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12544 * driver.cs: Handle and ignore /fullpaths
12546 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12548 * expression.cs (Binary.ResolveOperator): Catch the case where
12549 DoNumericPromotions returns true,
12551 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12553 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12555 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12558 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12560 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12561 conversion exists, but it is also required that the conversion be
12562 performed. This manifested in "(Type64Enum) 2".
12564 * class.cs (TypeManager.AddMethod): The fix is not to change
12565 AddEnum, because that one was using a fully qualified name (every
12566 DeclSpace derivative does), but to change the AddMethod routine
12567 that was using an un-namespaced name. This now correctly reports
12568 the duplicated name.
12570 Revert patch until I can properly fix it. The issue
12571 is that we have a shared Type space across all namespaces
12572 currently, which is wrong.
12574 Options include making the Namespace a DeclSpace, and merge
12575 current_namespace/current_container in the parser.
12577 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12579 * cs-parser.jay: Improve error reporting when we get a different
12580 kind of expression in local_variable_type and
12581 local_variable_pointer_type.
12583 Propagate this to avoid missleading errors being reported.
12585 * ecore.cs (ImplicitReferenceConversion): treat
12586 TypeManager.value_type as a target just like object_type. As
12591 Is valid, and needs to result in the int 1 being boxed before it
12592 is assigned to the value type v.
12594 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12595 to validate the enumeration name.
12597 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12598 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12599 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12601 * ecore.cs (TryImplicitIntConversion): When doing an
12602 implicit-enumeration-conversion, check if the type is 64-bits and
12603 perform a conversion before passing to EnumConstant.
12605 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12607 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12608 report ambiguous type references. Unlike the MS version, we
12609 report what the ambiguity is. Innovation at work ;-)
12611 (DeclSpace.FindType): Require a location argument to
12612 display when we display an ambiguous error.
12614 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12616 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12618 * expression.cs (EmitDynamicInitializers): Apply patch from
12619 hwang_rob@yahoo.ca that fixes the order in which we emit our
12622 2002-09-21 Martin Baulig <martin@gnome.org>
12624 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12625 delegate takes no arguments.
12627 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12629 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12632 * expression.cs: Extract the underlying type.
12634 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12636 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12638 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12640 * class.cs (TypeContainer.DefineType): We can not use the nice
12641 PackingSize with the size set to 1 DefineType method, because it
12642 will not allow us to define the interfaces that the struct
12645 This completes the fixing of bug 27287
12647 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12648 means also structs. This fixes part of the problem.
12649 (Expresion.ImplicitReferenceConversionExists): ditto.
12651 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12652 error if there were no errors reported during the type lookup
12653 process, to avoid duplicates or redundant errors. Without this
12654 you would get an ambiguous errors plus a type not found. We have
12655 beaten the user enough with the first error.
12657 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12660 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12661 during the resolution process, stop the lookup, this avoids
12662 repeated error reports (same error twice).
12664 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12666 * typemanager.cs (LookupType): Redo the type lookup code to match
12667 the needs of System.Reflection.
12669 The issue is that System.Reflection requires references to nested
12670 types to begin with a "+" sign instead of a dot. So toplevel
12671 types look like: "NameSpace.TopLevelClass", and nested ones look
12672 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12675 2002-09-19 Martin Baulig <martin@gnome.org>
12677 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12678 says that a method always returns or always throws an exception,
12679 don't report the CS0161.
12681 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12682 set `Returns = new_returns'.
12684 2002-09-19 Martin Baulig <martin@gnome.org>
12686 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12687 to an enum constant, check for a CS0176.
12689 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12691 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12692 for operators that must be in pairs and report errors.
12694 * ecore.cs (SimpleName.DoResolveType): During the initial type
12695 resolution process, when we define types recursively, we must
12696 check first for types in our current scope before we perform
12697 lookups in the enclosing scopes.
12699 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12701 (Invocation.VerifyArgumentsCompat): Call
12702 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12703 I thought we were supposed to always call this, but there are a
12704 few places in the code where we dont do it.
12706 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12708 * driver.cs: Add support in -linkres and -resource to specify the
12709 name of the identifier.
12711 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12713 * ecore.cs (StandardConversionExists): Sync with the conversion
12714 code: allow anything-* to void* conversions.
12716 (FindMostSpecificSource): Use an Expression argument
12717 instead of a Type, because we might be handed over a Literal which
12718 gets a few more implicit conversions that plain types do not. So
12719 this information was being lost.
12721 Also, we drop the temporary type-holder expression when not
12724 2002-09-17 Martin Baulig <martin@gnome.org>
12726 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12727 this is an explicit interface implementation.
12729 2002-09-17 Martin Baulig <martin@gnome.org>
12731 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12732 different `IndexerName' attributes.
12734 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12735 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12736 virtual CommonResolve().
12738 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12740 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12741 and convert that to the UnderlyingType.
12743 * statement.cs (Foreach.Resolve): Indexers are just like variables
12744 or PropertyAccesses.
12746 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12747 inside quoted strings, we were not doing this before.
12749 2002-09-16 Martin Baulig <martin@gnome.org>
12751 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12752 resolve it. This is needed for the definite assignment check of the
12753 instance expression, fixes bug #29846.
12754 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12756 2002-09-16 Nick Drochak <ndrochak@gol.com>
12758 * parameter.cs: Fix compile error. Cannot reference static member
12759 from an instance object. Is this an mcs bug?
12761 2002-09-14 Martin Baulig <martin@gnome.org>
12763 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12764 multiple times. Fixes bug #30295, added test-166.cs.
12766 2002-09-14 Martin Baulig <martin@gnome.org>
12768 * statement.cs (Block.Emit): Don't emit unreachable code.
12769 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12770 `break' statements.
12771 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12773 2002-09-14 Martin Baulig <martin@gnome.org>
12775 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12778 2002-09-14 Martin Baulig <martin@gnome.org>
12780 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12781 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12782 be false on the ms runtime.
12784 2002-09-13 Martin Baulig <martin@gnome.org>
12786 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12787 the CS0038 error message.
12789 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12791 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12792 constant inside, return it.
12794 2002-09-12 Martin Baulig <martin@gnome.org>
12796 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12797 implicit conversion can be done between enum types.
12799 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12800 check whether an implicit conversion to the current enum's UnderlyingType
12801 exists and report an error if not.
12803 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12804 without debugging support.
12806 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12807 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12809 2002-09-12 Martin Baulig <martin@gnome.org>
12811 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12813 * ecore.cs (IMemberExpr.DeclaringType): New property.
12814 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12815 nonstatic member of an outer type (CS0038).
12817 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12819 * driver.cs: Activate the using-error detector at warning level
12820 4 (at least for MS-compatible APIs).
12822 * namespace.cs (VerifyUsing): Small buglett fix.
12824 * pending.cs (PendingImplementation): pass the container pointer.
12826 * interface.cs (GetMethods): Allow for recursive definition. Long
12827 term, I would like to move every type to support recursive
12828 definitions, not the current ordering mechanism that we have right
12831 The situation is this: Attributes are handled before interfaces,
12832 so we can apply attributes to interfaces. But some attributes
12833 implement interfaces, we will now handle the simple cases
12834 (recursive definitions will just get an error).
12836 * parameter.cs: Only invalidate types at the end if we fail to
12839 2002-09-09 Martin Baulig <martin@gnome.org>
12841 * ecore.cs (PropertyExpr.Emit): Also check for
12842 TypeManager.system_int_array_get_length so this'll also work when
12843 compiling corlib. Fixes #30003.
12845 2002-09-09 Martin Baulig <martin@gnome.org>
12847 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12848 and throw an exception if we can't get the type's size. Fixed #30040,
12851 2002-09-09 Martin Baulig <martin@gnome.org>
12853 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12855 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12856 context. Fixes bug #30027.
12858 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12859 virtual functions. Fixes bug #30043, added test-164.cs.
12861 2002-09-08 Ravi Pratap <ravi@ximian.com>
12863 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12865 2002-09-08 Nick Drochak <ndrochak@gol.com>
12867 * driver.cs: Use an object to get the windows codepage since it's not a
12870 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12872 * statement.cs (For.Emit): for infinite loops (test == null)
12873 return whether there is a break inside, not always "true".
12875 * namespace.cs (UsingEntry): New struct to hold the name of the
12876 using definition, the location where it is defined, and whether it
12877 has been used in a successful type lookup.
12879 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12884 2002-09-06 Ravi Pratap <ravi@ximian.com>
12886 * attribute.cs : Fix incorrect code which relied on catching
12887 a NullReferenceException to detect a null being passed in
12888 where an object was expected.
12890 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12892 * statement.cs (Try): flag the catch variable as assigned
12894 * expression.cs (Cast): Simplified by using ResolveType instead of
12895 manually resolving.
12897 * statement.cs (Catch): Fix bug by using ResolveType.
12899 2002-09-06 Ravi Pratap <ravi@ximian.com>
12901 * expression.cs (BetterConversion): Special case for when we have
12902 a NullLiteral as the argument and we have to choose between string
12903 and object types - we choose string the way csc does.
12905 * attribute.cs (Attribute.Resolve): Catch the
12906 NullReferenceException and report error #182 since the Mono
12907 runtime no more has the bug and having this exception raised means
12908 we tried to select a constructor which takes an object and is
12911 2002-09-05 Ravi Pratap <ravi@ximian.com>
12913 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12914 message (1502, 1503) when we can't locate a method after overload
12915 resolution. This is much more informative and closes the bug
12918 * interface.cs (PopulateMethod): Return if there are no argument
12919 types. Fixes a NullReferenceException bug.
12921 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12922 expressions too. Previously we were checking only in one place for
12923 positional arguments leaving out named arguments.
12925 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12926 type to the enum type is not allowed. Remove code corresponding to
12929 (ConvertNumericExplicit): Allow explicit conversions from
12930 the underlying type to enum type. This precisely follows the spec
12931 and closes a bug filed by Gonzalo.
12933 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12936 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12938 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12940 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12941 it was important that we stored the right value after the
12942 reduction in `converted'.
12944 2002-09-04 Martin Baulig <martin@gnome.org>
12946 * location.cs (Location.SymbolDocument): Use full pathnames for the
12949 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12951 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12952 of the expression resolve mechanism, because that will catch the
12953 SimpleName error failures.
12955 (Conditional): If we can not resolve the
12956 expression, return, do not crash.
12958 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12961 (location): display token name instead of its number.
12963 2002-08-28 Martin Baulig <martin@gnome.org>
12965 * expression.cs (Binary.ResolveOperator): Don't silently return
12966 but return an error if an operator cannot be applied between two
12969 2002-08-28 Martin Baulig <martin@gnome.org>
12971 * class.cs (Constructor.Define): Set the permission attributes
12972 correctly instead of making all constructors public.
12974 2002-08-28 Martin Baulig <martin@gnome.org>
12976 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
12977 for private members before reporting a CS0103; if we find anything,
12980 2002-08-28 Martin Baulig <martin@gnome.org>
12982 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
12983 to check whether `closure_start_type == closure_invocation_type',
12984 we also need to check whether `m.DeclaringType == closure_invocation_type'
12985 before bypassing the permission checks. We might be accessing
12986 protected/private members from the base class.
12987 (TypeManager.RealMemberLookup): Only set private_ok if private
12988 members were requested via BindingFlags.NonPublic.
12990 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
12992 * expression.cs (MemberAccess.ResolveMemberAccess): Set
12993 MethodGroupExpr.IsExplicitImpl if appropriate.
12994 (Invocation.DoResolve): Don't report the CS0120 for explicit
12995 interface implementations.
12997 2002-08-27 Martin Baulig <martin@gnome.org>
12999 * expression.cs (Invocation.DoResolve): If this is a static
13000 method and we don't have an InstanceExpression, we must report
13003 2002-08-25 Martin Baulig <martin@gnome.org>
13005 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
13006 `==' between a valuetype and an object.
13008 2002-08-25 Miguel de Icaza <miguel@ximian.com>
13010 * ecore.cs (TypeExpr): Provide a ToString method.
13012 2002-08-24 Martin Baulig <martin@gnome.org>
13014 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
13015 now called proggie.dbg and it's a binary file.
13017 2002-08-23 Martin Baulig <martin@gnome.org>
13019 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
13021 2002-08-23 Martin Baulig <martin@gnome.org>
13023 * struct.cs (MyStructInfo.ctor): Make this work with empty
13024 structs; it's not allowed to use foreach() on null.
13026 2002-08-23 Martin Baulig <martin@gnome.org>
13028 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
13029 writer the full pathname of the generated assembly.
13031 2002-08-23 Martin Baulig <martin@gnome.org>
13033 * statements.cs (FlowBranching.UsageVector.MergeChildren):
13034 A `finally' block never returns or breaks; improved handling of
13037 2002-08-23 Martin Baulig <martin@gnome.org>
13039 * statement.cs (Throw.Resolve): Allow `throw null'.
13041 2002-08-23 Martin Baulig <martin@gnome.org>
13043 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
13044 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
13045 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
13046 MemberLookup would return a wrong event if this is an explicit
13047 interface implementation and the class has an event with the same
13050 2002-08-23 Martin Baulig <martin@gnome.org>
13052 * statement.cs (Block.AddChildVariableNames): New public method.
13053 (Block.AddChildVariableName): Likewise.
13054 (Block.IsVariableNameUsedInChildBlock): Likewise.
13055 (Block.AddVariable): Check whether a variable name has already
13056 been used in a child block.
13058 * cs-parser.jay (declare_local_variables): Mark all variable names
13059 from the current block as being used in a child block in the
13062 2002-08-23 Martin Baulig <martin@gnome.org>
13064 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
13065 find the symbol writer.
13067 * driver.cs: csc also allows the arguments to /define being
13068 separated by commas, not only by semicolons.
13070 2002-08-23 Martin Baulig <martin@gnome.org>
13072 * interface.cs (Interface.GetMembers): Added static check for events.
13074 2002-08-15 Martin Baulig <martin@gnome.org>
13076 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13077 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13079 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13080 why the MethodData.EmitDestructor() change was necessary.
13082 2002-08-20 Martin Baulig <martin@gnome.org>
13084 * class.cs (TypeContainer.FindMembers): Added static check for events.
13086 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13088 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13089 use Type.GetEvents(), not Type.FindMembers().
13091 2002-08-20 Martin Baulig <martin@gnome.org>
13093 * decl.cs (MemberCache): Added a special method cache which will
13094 be used for method-only searched. This ensures that a method
13095 search will return a MethodInfo with the correct ReflectedType for
13098 2002-08-20 Martin Baulig <martin@gnome.org>
13100 * decl.cs (DeclSpace.FindMembers): Made this public.
13102 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13104 * delegate.cs: fixed build on windows.
13105 [FIXME: Filed as bug #29150: MCS must report these errors.]
13107 2002-08-19 Ravi Pratap <ravi@ximian.com>
13109 * ecore.cs (StandardConversionExists): Return a false
13110 if we are trying to convert the void type to anything else
13111 since that is not allowed.
13113 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13114 we flag error 70 in the event an event is trying to be accessed
13115 directly from outside the declaring type.
13117 2002-08-20 Martin Baulig <martin@gnome.org>
13119 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13120 MemberCache from typemanager.cs to decl.cs.
13122 2002-08-19 Martin Baulig <martin@gnome.org>
13124 * class.cs (TypeContainer): Implement IMemberContainer.
13125 (TypeContainer.DefineMembers): Create the MemberCache.
13126 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13127 return public members if BindingFlags.Public was given, check
13128 whether members are static.
13130 2002-08-16 Martin Baulig <martin@gnome.org>
13132 * decl.cs (DeclSpace.Define): Splitted this in Define and
13133 DefineMembers. DefineMembers is called first and initializes the
13136 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13137 DefineMembers() on all our DeclSpaces.
13139 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13140 but call DefineMembers() on all nested interfaces. We call their
13141 Define() in our new Define() function.
13143 * interface.cs (Interface): Implement IMemberContainer.
13144 (Interface.Define): Moved all code except the attribute stuf to
13146 (Interface.DefineMembers): Initialize the member cache.
13148 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13149 need this anymore since we can use MemberCache.FindMembers directly.
13151 2002-08-19 Martin Baulig <martin@gnome.org>
13153 * typemanager.cs (MemberCache): When creating the cache for an
13154 interface type, add all inherited members.
13155 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13156 to `out bool used_cache' and documented it.
13157 (TypeManager.MemberLookup): If we already used the cache in the first
13158 iteration, we don't need to do the interfaces check.
13160 2002-08-19 Martin Baulig <martin@gnome.org>
13162 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13163 here from IMemberFinder and don't implement this interface anymore.
13164 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13166 * typemanager.cs (IMemberFinder): This interface is now only used by
13167 classes which actually support the member cache.
13168 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13169 since we only put DeclSpaces into this Hashtable.
13170 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13171 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13173 2002-08-16 Martin Baulig <martin@gnome.org>
13175 * typemanager.cs (ICachingMemberFinder): Removed.
13176 (IMemberFinder.MemberCache): New property.
13177 (TypeManager.FindMembers): Merged this with RealFindMembers().
13178 This function will never be called from TypeManager.MemberLookup()
13179 so we can't use the cache here, just the IMemberFinder.
13180 (TypeManager.MemberLookup_FindMembers): Check whether the
13181 IMemberFinder has a MemberCache and call the cache's FindMembers
13183 (MemberCache): Rewrote larger parts of this yet another time and
13184 cleaned it up a bit.
13186 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13188 * driver.cs (LoadArgs): Support quoting.
13190 (Usage): Show the CSC-like command line arguments.
13192 Improved a few error messages.
13194 2002-08-15 Martin Baulig <martin@gnome.org>
13196 * typemanager.cs (IMemberContainer.Type): New property.
13197 (IMemberContainer.IsInterface): New property.
13199 The following changes are conditional to BROKEN_RUNTIME, which is
13200 defined at the top of the file.
13202 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13203 class'es members, but add all members from TypeHandle.ObjectType
13204 if we're an interface.
13205 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13206 is the current type.
13207 (MemberCache.CacheEntry.Container): Removed this field.
13208 (TypeHandle.GetMembers): Include inherited members.
13210 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13212 * typemanager.cs: fixed compilation and added a comment on a field that
13215 2002-08-15 Martin Baulig <martin@gnome.org>
13217 * class.cs (ConstructorInitializer.Resolve): In the
13218 Expression.MemberLookup call, use the queried_type as
13221 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13222 declared' attribute, it's always true.
13223 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13224 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13225 temporary wrapper for FindMembers which tells MemberLookup whether
13226 members from the base classes are included in the return value.
13227 This will go away soon.
13228 (TypeManager.MemberLookup): Use this temporary hack here; once the
13229 new MemberCache is completed, we don't need to do the DeclaredOnly
13230 looping here anymore since the MemberCache will take care of this.
13231 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13232 (MemberCache): When creating the MemberCache for a class, get
13233 members from the current class and all its base classes.
13234 (MemberCache.CacheEntry.Container): New field. This is a
13235 temporary hack until the Mono runtime is fixed to distinguish
13236 between ReflectedType and DeclaringType. It allows us to use MCS
13237 with both the MS runtime and the unfixed Mono runtime without
13238 problems and without accecting performance.
13239 (MemberCache.SearchMembers): The DeclaredOnly looping from
13240 TypeManager.MemberLookup is now done here.
13242 2002-08-14 Martin Baulig <martin@gnome.org>
13244 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13245 Type.GetFields on dynamic types but get the fields from the
13246 corresponding TypeContainer.
13247 (MyStructInfo.GetStructInfo): Added check for enum types.
13249 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13250 (MemberList.SyncRoot): Implemented.
13251 (TypeManager.FilterWithClosure): No need to check permissions if
13252 closure_start_type == closure_invocation_type, don't crash if
13253 closure_invocation_type is null.
13255 2002-08-13 Martin Baulig <martin@gnome.org>
13257 Rewrote TypeContainer.FindMembers to use a member cache. This
13258 gives us a speed increase of about 35% for the self-hosting MCS
13259 build and of about 15-20% for the class libs (both on GNU/Linux).
13261 * report.cs (Timer): New class to get enhanced profiling. This
13262 whole class is "TIMER" conditional since it remarkably slows down
13265 * class.cs (MemberList): New class. This is an IList wrapper
13266 which we're now using instead of passing MemberInfo[]'s around to
13267 avoid copying this array unnecessarily.
13268 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13269 (ICachingMemberFinder, IMemberContainer): New interface.
13270 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13271 has already been checked, otherwise use it for the name comparision.
13272 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13273 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13274 if possible. Returns a MemberList, not a MemberInfo [].
13275 (TypeHandle): New class, implements IMemberContainer. We create
13276 one instance of this class per type, it contains a MemberCache
13277 which is used to do the member lookups.
13278 (MemberCache): New class. Each instance of this class contains
13279 all members of a type and a name-based hash table.
13280 (MemberCache.FindMembers): This is our new member lookup
13281 function. First, it looks up all members of the requested name in
13282 the hash table. Then, it walks this list and sorts out all
13283 applicable members and returns them.
13285 2002-08-13 Martin Baulig <martin@gnome.org>
13287 In addition to a nice code cleanup, this gives us a performance
13288 increase of about 1.4% on GNU/Linux - not much, but it's already
13289 half a second for the self-hosting MCS compilation.
13291 * typemanager.cs (IMemberFinder): New interface. It is used by
13292 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13293 Enum, Delegate or Interface.
13294 (TypeManager.finder_to_member_finder): New PtrHashtable.
13295 (TypeManager.finder_to_container): Removed.
13296 (TypeManager.finder_to_delegate): Removed.
13297 (TypeManager.finder_to_interface): Removed.
13298 (TypeManager.finder_to_enum): Removed.
13300 * interface.cs (Interface): Implement IMemberFinder.
13302 * delegate.cs (Delegate): Implement IMemberFinder.
13304 * enum.cs (Enum): Implement IMemberFinder.
13306 * class.cs (TypeContainer): Implement IMemberFinder.
13308 2002-08-12 Martin Baulig <martin@gnome.org>
13310 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13312 2002-08-12 Martin Baulig <martin@gnome.org>
13314 * ecore.cs (ITypeExpression): New interface for expressions which
13316 (TypeExpression): Renamed to TypeLookupExpression.
13317 (Expression.DoResolve): If we're doing a types-only lookup, the
13318 expression must implement the ITypeExpression interface and we
13319 call DoResolveType() on it.
13320 (SimpleName): Implement the new ITypeExpression interface.
13321 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13322 hack, the situation that we're only looking up types can't happen
13323 anymore when this method is called. Moved the type lookup code to
13324 DoResolveType() and call it.
13325 (SimpleName.DoResolveType): This ITypeExpression interface method
13326 is now doing the types-only lookup.
13327 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13328 (ResolveFlags): Added MaskExprClass.
13330 * expression.cs (MemberAccess): Implement the ITypeExpression
13332 (MemberAccess.DoResolve): Added support for a types-only lookup
13333 when we're called via ITypeExpression.DoResolveType().
13334 (ComposedCast): Implement the ITypeExpression interface.
13336 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13337 Expression.Resolve() with ResolveFlags.Type instead.
13339 2002-08-12 Martin Baulig <martin@gnome.org>
13341 * interface.cs (Interface.Define): Apply attributes.
13343 * attribute.cs (Attribute.ApplyAttributes): Added support for
13344 interface attributes.
13346 2002-08-11 Martin Baulig <martin@gnome.org>
13348 * statement.cs (Block.Emit): Only check the "this" variable if we
13349 do not always throw an exception.
13351 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13352 whether the property has a set accessor.
13354 2002-08-11 Martin Baulig <martin@gnome.org>
13356 Added control flow analysis support for structs.
13358 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13359 with control flow analysis turned off.
13360 (IVariable): New interface.
13361 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13362 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13363 (FieldExpr.DoResolve): Resolve the instance expression with flow
13364 analysis turned off and do the definite assignment check after the
13365 resolving when we know what the expression will resolve to.
13367 * expression.cs (LocalVariableReference, ParameterReference):
13368 Implement the new IVariable interface, only call the flow analysis
13369 code if ec.DoFlowAnalysis is true.
13370 (This): Added constructor which takes a Block argument. Implement
13371 the new IVariable interface.
13372 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13373 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13374 This does the definite assignment checks for struct members.
13376 * class.cs (Constructor.Emit): If this is a non-static `struct'
13377 constructor which doesn't have any initializer, call
13378 Block.AddThisVariable() to tell the flow analysis code that all
13379 struct elements must be initialized before control returns from
13382 * statement.cs (MyStructInfo): New public class.
13383 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13384 argument to this indexer. If non-zero, check an individual struct
13385 member, not the whole struct.
13386 (FlowBranching.CheckOutParameters): Check struct members.
13387 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13388 overloaded versions of these methods which take an additional
13389 `int field_idx' argument to check struct members.
13390 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13391 overloaded versions of these methods which take an additional
13392 `string field_name' argument to check struct member.s
13393 (VariableInfo): Implement the IVariable interface.
13394 (VariableInfo.StructInfo): New public property. Returns the
13395 MyStructInfo instance of the variable if it's a struct or null.
13396 (Block.AddThisVariable): New public method. This is called from
13397 Constructor.Emit() for non-static `struct' constructor which do
13398 not have any initializer. It creates a special variable for the
13399 "this" instance variable which will be checked by the flow
13400 analysis code to ensure that all of the struct's fields are
13401 initialized before control returns from the constructor.
13402 (UsageVector): Added support for struct members. If a
13403 variable/parameter is a struct with N members, we reserve a slot
13404 in the usage vector for each member. A struct is considered fully
13405 initialized if either the struct itself (slot 0) or all its
13406 members are initialized.
13408 2002-08-08 Martin Baulig <martin@gnome.org>
13410 * driver.cs (Driver.MainDriver): Only report an error CS5001
13411 if there were no compilation errors.
13413 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13414 `UnsafeContext' property to determine whether the parent is in
13415 unsafe context rather than checking the parent's ModFlags:
13416 classes nested in an unsafe class are unsafe as well.
13418 2002-08-08 Martin Baulig <martin@gnome.org>
13420 * statement.cs (UsageVector.MergeChildren): Distinguish between
13421 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13422 we return. Added test17() and test18() to test-154.cs.
13424 2002-08-08 Martin Baulig <martin@gnome.org>
13426 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13427 Family access, make sure the invoking type isn't a subclass of the
13428 queried type (that'd be a CS1540).
13430 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13431 this method which takes an additional `Type invocation_type'.
13433 * expression.cs (BaseAccess.DoResolve): Use the base type as
13434 invocation and query type.
13435 (MemberAccess.DoResolve): If the lookup failed and we're about to
13436 report a CS0122, try a lookup with the ec.ContainerType - if this
13437 succeeds, we must report a CS1540.
13439 2002-08-08 Martin Baulig <martin@gnome.org>
13441 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13442 (MethodGroupExpr): Implement the IMemberExpr interface.
13444 * expression (MemberAccess.ResolveMemberAccess): No need to have
13445 any special code for MethodGroupExprs anymore, they're now
13448 2002-08-08 Martin Baulig <martin@gnome.org>
13450 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13451 Family, FamANDAssem and FamORAssem permissions.
13452 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13454 2002-08-08 Martin Baulig <martin@gnome.org>
13456 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13457 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13460 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13462 * driver.cs: implemented /resource option to embed managed resources.
13464 2002-08-07 Martin Baulig <martin@gnome.org>
13466 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13467 (FieldBase.HasFieldInitializer): New public property.
13468 (FieldBase.GetInitializerExpression): New public method. Resolves and
13469 returns the field initializer and makes sure it is only resolved once.
13470 (TypeContainer.EmitFieldInitializers): Call
13471 FieldBase.GetInitializerExpression to get the initializer, this ensures
13472 that it isn't resolved multiple times.
13474 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13475 the resolving process (SimpleName/MemberLookup) that we're currently
13476 emitting a field initializer (which must not access any instance members,
13477 this is an error CS0236).
13479 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13480 argument, if the `IsFieldInitializer' flag is set, we must report and
13481 error CS0236 and not an error CS0120.
13483 2002-08-07 Martin Baulig <martin@gnome.org>
13485 * ecore.cs (IMemberExpr): New public interface.
13486 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13487 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13488 if the expression is an IMemberExpr.
13490 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13491 to be null, implicitly default to `this' if we're non-static in
13492 this case. Simplified the code a lot by using the new IMemberExpr
13493 interface. Also fixed bug #28176 here.
13495 2002-08-06 Martin Baulig <martin@gnome.org>
13497 * cs-parser.jay (SimpleLookup): Removed. We need to create
13498 ParameterReferences during semantic analysis so that we can do a
13499 type-only search when resolving Cast, TypeOf and SizeOf.
13500 (block): Pass the `current_local_parameters' to the Block's
13503 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13504 argument to the constructor.
13505 (ConstructorInitializer.Resolve): Create a temporary implicit
13506 block with the parameters.
13508 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13509 references here if we aren't doing a type-only search.
13511 * statement.cs (Block): Added constructor which takes a
13512 `Parameters parameters' argument.
13513 (Block.Parameters): New public property.
13515 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13516 to `Parameters' and made it public readonly.
13518 2002-08-06 Martin Baulig <martin@gnome.org>
13520 * ecore.cs (Expression.Warning): Made this public as well.
13522 * report.cs (Report.Debug): Print the contents of collections.
13524 2002-08-06 Martin Baulig <martin@gnome.org>
13526 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13527 used to tell Resolve() which kinds of expressions it may return.
13528 (Expression.Resolve): Added overloaded version of this method which
13529 takes a `ResolveFlags flags' argument. This can be used to tell
13530 Resolve() which kinds of expressions it may return. Reports a
13532 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13533 ResolveFlags.SimpleName.
13534 (Expression.Error118): Added overloaded version of this method which
13535 takes a `ResolveFlags flags' argument. It uses the flags to determine
13536 which kinds of expressions are allowed.
13538 * expression.cs (Argument.ResolveMethodGroup): New public method.
13539 Resolves an argument, but allows a MethodGroup to be returned.
13540 This is used when invoking a delegate.
13542 * TODO: Updated a bit.
13544 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13546 Fixed compilation with csc.
13548 * ecore.cs: Expression.Error made public. Is this correct? Should
13549 Warning be made public too?
13551 * expression.cs: use ea.Location instead of ea.loc.
13552 [FIXME: Filed as bug #28607: MCS must report these errors.]
13554 2002-08-06 Martin Baulig <martin@gnome.org>
13556 * ecore.cs (Expression.loc): Moved the location here instead of
13557 duplicating it in all derived classes.
13558 (Expression.Location): New public property.
13559 (Expression.Error, Expression.Warning): Made them non-static and
13560 removed the location argument.
13561 (Expression.Warning): Added overloaded version which takes an
13562 `int level' argument.
13563 (Expression.Error118): Make this non-static and removed the
13564 expression and location arguments.
13565 (TypeExpr): Added location argument to the constructor.
13567 * expression.cs (StaticCallExpr): Added location argument to
13569 (Indirection, PointerArithmetic): Likewise.
13570 (CheckedExpr, UnCheckedExpr): Likewise.
13571 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13572 (StringPtr): Likewise.
13575 2002-08-05 Martin Baulig <martin@gnome.org>
13577 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13579 * assign.cs (Assign.DoResolve): Check whether the source
13580 expression is a value or variable.
13582 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13583 while resolving the corresponding blocks.
13585 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13586 an error, don't silently return null.
13588 * statement.cs (Block.AddVariable): Do the error reporting here
13589 and distinguish between CS0128 and CS0136.
13590 (Block.DoResolve): Report all unused labels (warning CS0164).
13591 (LabeledStatement): Pass the location to the constructor.
13592 (LabeledStatement.HasBeenReferenced): New property.
13593 (LabeledStatement.Resolve): Set it to true here.
13595 * statement.cs (Return.Emit): Return success even after reporting
13596 a type mismatch error (CS0126 or CS0127), this is what csc does and
13597 it avoids confusing the users with any consecutive errors.
13599 2002-08-05 Martin Baulig <martin@gnome.org>
13601 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13603 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13605 * expression.cs (MemberAccess.DoResolve): Silently return if an
13606 error has already been reported.
13608 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13609 error has already been reported.
13611 2002-08-05 Martin Baulig <martin@gnome.org>
13613 * statement.cs (UsageVector): Only initialize the `parameters'
13614 vector if we actually have any "out" parameters.
13616 2002-08-05 Martin Baulig <martin@gnome.org>
13618 * expression.cs (Binary.ResolveOperator): When combining delegates,
13619 they must have the same type.
13621 2002-08-05 Martin Baulig <martin@gnome.org>
13623 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13624 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13625 work with the ms runtime and we also don't need it: if we're a
13626 PropertyBuilder and not in the `indexer_arguments' hash, then we
13627 are a property and not an indexer.
13629 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13630 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13631 since the latter one doesn't work with the ms runtime.
13633 2002-08-03 Martin Baulig <martin@gnome.org>
13635 Fixed bugs #27998 and #22735.
13637 * class.cs (Method.IsOperator): New public field.
13638 (Method.CheckBase): Report CS0111 if there's already a method
13639 with the same parameters in the current class. Report CS0508 when
13640 attempting to change the return type of an inherited method.
13641 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13642 and it's not marked abstract or extern.
13643 (PropertyBase): New abstract base class for Property and Indexer.
13644 (PropertyBase.CheckBase): Moved here from Property and made it work
13646 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13647 the same so we can reuse it there.
13648 (Property, Indexer): Derive from PropertyBase.
13649 (MethodSignature.inheritable_property_signature_filter): New delegate
13650 to find properties and indexers.
13652 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13653 argument and improved error reporting.
13655 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13656 EmptyReadOnlyParameters and made it a property.
13658 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13659 version of this method which takes a `PropertyInfo indexer'.
13660 (TypeManager.RegisterIndexer): New method.
13662 * class.cs: Added myself as author of this file :-)
13664 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13666 * class.cs: fixed compilation on windoze.
13668 2002-08-03 Martin Baulig <martin@gnome.org>
13670 * interface.cs (Interface.GetInterfaceBases): Check whether all
13671 base interfaces are at least as accessible than the current one.
13673 * class.cs (TypeContainer.GetClassBases): Check whether base types
13674 are at least as accessible than the current type.
13675 (TypeContainer.AsAccessible): Implemented and made non-static.
13676 (MemberBase.CheckParameters): Report errors if the accessibility
13679 * delegate.cs (Delegate.Delegate): The default visibility is
13680 internal for top-level types and private for nested types.
13681 (Delegate.Define): Report errors if the accessibility checks fail.
13683 * enum.cs (Enum.Enum): The default visibility is internal for
13684 top-level types and private for nested types.
13685 (Enum.DefineType): Compute the correct visibility.
13687 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13688 function which takes a `bool is_toplevel' instead of a TypeContainer.
13690 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13693 2002-08-02 Martin Baulig <martin@gnome.org>
13695 * expression.cs (LocalVariableReferenc): Added constructor which
13696 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13697 (LocalVariableReference.IsReadOnly): New property.
13698 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13699 variable is readonly, use our own readonly flag to do this; you can
13700 use the new constructor to get a writable reference to a read-only
13703 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13704 reference to the local variable.
13706 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13708 * rootcontext.cs (ResolveCore): Also include System.Exception
13710 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13711 we reach an EmptyStatement.
13713 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13716 * expression.cs (Binary.ResolveOperator): Check error result in
13719 use brtrue/brfalse directly and avoid compares to null.
13721 2002-08-02 Martin Baulig <martin@gnome.org>
13723 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13724 Fixes bug #28407, added test-155.cs.
13726 2002-08-01 Martin Baulig <martin@gnome.org>
13728 * class.cs (Event.EmitDefaultMethod): Make this work with static
13729 events. Fixes #28311, added verify-3.cs.
13731 2002-08-01 Martin Baulig <martin@gnome.org>
13733 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13734 `is_disposable' fields.
13735 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13736 `hm.is_disposable' if we're using the collection pattern.
13737 (Foreach.EmitCollectionForeach): Use the correct type for the
13738 enumerator's local variable, only emit the try/finally block if
13739 necessary (fixes #27713).
13741 2002-08-01 Martin Baulig <martin@gnome.org>
13743 * ecore.cs (Expression.report118): Renamed to Error118 and made
13746 * statement.cs (Throw.Resolve): Check whether the expression is of
13747 the correct type (CS0118) and whether the type derives from
13748 System.Exception (CS0155).
13749 (Catch.Resolve): New method. Do the type lookup here and check
13750 whether it derives from System.Exception (CS0155).
13751 (Catch.CatchType, Catch.IsGeneral): New public properties.
13753 * typemanager.cs (TypeManager.exception_type): Added.
13755 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13757 * driver.cs: Updated About function.
13759 2002-07-31 Martin Baulig <martin@gnome.org>
13761 Implemented Control Flow Analysis.
13763 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13764 (EmitContext.CurrentBranching): Added.
13765 (EmitContext.StartFlowBranching): Added.
13766 (EmitContext.EndFlowBranching): Added.
13767 (EmitContext.KillFlowBranching): Added.
13768 (EmitContext.IsVariableAssigned): Added.
13769 (EmitContext.SetVariableAssigned): Added.
13770 (EmitContext.IsParameterAssigned): Added.
13771 (EmitContext.SetParameterAssigned): Added.
13772 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13773 Added control flow analysis stuff here.
13775 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13776 resolve the expression as lvalue.
13777 (LocalVariableReference.DoResolve): Check whether the variable has
13778 already been assigned.
13779 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13780 the parameter as assigned here.
13781 (ParameterReference.DoResolve): Check whether the parameter has already
13783 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13784 expression as lvalue.
13786 * statement.cs (FlowBranching): New class for the flow analysis code.
13787 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13788 (LabeledStatement.IsDefined): New public property.
13789 (LabeledStatement.AddUsageVector): New public method to tell flow
13790 analyis that the label may be reached via a forward jump.
13791 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13793 (VariableInfo.Number): New public field. This is used by flow analysis
13794 to number all locals of a block.
13795 (Block.CountVariables): New public property. This is the number of
13796 local variables in this block (including the locals from all parent
13798 (Block.EmitMeta): Number all the variables.
13800 * statement.cs: Added flow analysis support to all classes.
13802 2002-07-31 Martin Baulig <martin@gnome.org>
13804 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13805 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13806 then use this argument.
13808 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13810 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13811 use this to specify /define options.
13813 2002-07-29 Martin Baulig <martin@gnome.org>
13815 * statement.cs (Fixed): Moved all code that does variable lookups
13816 and resolvings from Emit to Resolve.
13818 * statement.cs (For): Moved all code that does variable lookups
13819 and resolvings from Emit to Resolve.
13821 * statement.cs (Using): Moved all code that does variable lookups
13822 and resolvings from Emit to Resolve.
13824 2002-07-29 Martin Baulig <martin@gnome.org>
13826 * attribute.cs (Attribute.Resolve): Explicitly catch a
13827 System.NullReferenceException when creating the
13828 CustromAttributeBuilder and report a different warning message.
13830 2002-07-29 Martin Baulig <martin@gnome.org>
13832 * support.cs (ParameterData.ParameterName): Added method to
13833 get the name of a parameter.
13835 * typemanager.cs (TypeManager.IsValueType): New public method.
13837 2002-07-29 Martin Baulig <martin@gnome.org>
13839 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13840 is a flag which specifies that it's either ref or out.
13841 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13842 the out parameter to `out Parameter.Modifier mod', also set the
13843 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13845 * support.cs (InternalParameters.ParameterModifier): Distinguish
13846 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13847 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13849 * expression.cs (Argument.GetParameterModifier): Distinguish
13850 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13851 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13853 2002-07-29 Martin Baulig <martin@gnome.org>
13855 * expression.cs (ParameterReference.ParameterReference): Added
13856 `Location loc' argument to the constructor.
13858 * cs-parser.jay: Pass location to ParameterReference.
13860 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13862 * statement.cs (Try): Initialize the location.
13864 * cs-parser.jay: pass location to Try.
13866 * expression.cs (Unary.Reduce): Change the prototype to return
13867 whether a constant fold could be performed or not. The result is
13868 returned in an out parameters. In the case of Indirection and
13869 AddressOf, we want to perform the full tests.
13871 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13873 * statement.cs (Statement.Emit): Flag dead code.
13875 2002-07-27 Andrew Birkett <andy@nobugs.org>
13877 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13879 2002-07-27 Martin Baulig <martin@gnome.org>
13881 * class.cs (MethodData.Define): Put back call to
13882 TypeManager.AddMethod(), accidentally commented this out.
13884 * report.cs (Debug): New public method to print debugging information,
13885 this is `[Conditional ("DEBUG")]'.
13887 2002-07-26 Martin Baulig <martin@gnome.org>
13889 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13890 (switch_statement): Push the current_block to the switch_stack and
13891 pop it again when we're done with the switch.
13892 (switch_section): The new block is a child of the current_block.
13893 Fixes bug #24007, added test-152.cs.
13895 2002-07-27 Martin Baulig <martin@gnome.org>
13897 * expression.cs (Invocation.EmitArguments): When calling a varargs
13898 function with only its fixed arguments, we need to pass an empty
13901 2002-07-27 Martin Baulig <martin@gnome.org>
13903 Mono 0.13 has been released.
13905 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13907 * driver.cs: Rename --resource to --linkres, because that is what
13908 we do currently, we dont support --resource yet.
13910 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13912 2002-07-25 Martin Baulig <martin@gnome.org>
13914 * class.cs (MethodData): New public class. This is a `method builder'
13915 class for a method or one accessor of a Property/Indexer/Event.
13916 (MethodData.GetMethodFlags): Moved here from MemberBase.
13917 (MethodData.ApplyAttributes): Likewise.
13918 (MethodData.ApplyObsoleteAttribute): Likewise.
13919 (MethodData.ApplyConditionalAttribute): Likewise.
13920 (MethodData.ApplyDllImportAttribute): Likewise.
13921 (MethodData.CheckAbstractAndExternal): Likewise.
13922 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13923 (MethodData.Emit): Formerly known as Method.Emit().
13924 (MemberBase): Moved everything which was specific to a single
13925 accessor/method to MethodData.
13926 (Method): Create a new MethodData and call Define() and Emit() on it.
13927 (Property, Indexer, Event): Create a new MethodData objects for each
13928 accessor and call Define() and Emit() on them.
13930 2002-07-25 Martin Baulig <martin@gnome.org>
13932 Made MethodCore derive from MemberBase to reuse the code from there.
13933 MemberBase now also checks for attributes.
13935 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13936 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13938 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13939 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13940 (MemberBase.ApplyAttributes): New virtual method; applies the
13941 attributes to a method or accessor.
13942 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13943 (MemberBase.ApplyConditionalAttribute): Likewise.
13944 (MemberBase.ApplyDllImportAttribute): Likewise.
13945 (MemberBase.CheckAbstractAndExternal): Likewise.
13946 (MethodCore.ParameterTypes): This is now a property instead of a
13947 method, it's initialized from DoDefineParameters().
13948 (MethodCore.ParameterInfo): Removed the set accessor.
13949 (MethodCore.DoDefineParameters): New protected virtual method to
13950 initialize ParameterTypes and ParameterInfo.
13951 (Method.GetReturnType): We can now simply return the MemberType.
13952 (Method.GetMethodFlags): Override the MemberBase version and add
13953 the conditional flags.
13954 (Method.CheckBase): Moved some code from Define() here, call
13955 DoDefineParameters() here.
13956 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
13957 here to avoid some larger code duplication.
13958 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
13959 ensure that abstract and external accessors don't declare a body.
13961 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
13962 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
13963 lookup in the attribute's parent classes, so we need to abort as soon
13964 as we found the first match.
13965 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
13966 the attribute has no arguments.
13968 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
13971 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13973 * cs-parser.jay: reverted previous patch.
13975 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13977 * cs-parser.jay: fixed bug #22119.
13979 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13981 * attribute.cs: fixed compilation. The error was:
13982 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
13983 be assigned to before control leaves the current method."
13984 [FIXME: Filed as bug #28186: MCS must report this error.]
13986 2002-07-25 Martin Baulig <martin@gnome.org>
13988 * attribute.cs (Attribute.Conditional_GetConditionName): New static
13989 method to pull the condition name ouf of a Conditional attribute.
13990 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
13991 the obsolete message and error flag out of an Obsolete attribute.
13993 * class.cs (Method.GetMethodFlags): New public method to get the
13994 TypeManager.MethodFlags for this method.
13995 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
13997 (Method.Define): Get and apply the Obsolete and Conditional attributes;
13998 if we're overriding a virtual function, set the new private variable
13999 `parent_method'; call the new TypeManager.AddMethod().
14001 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
14002 the MethodBuilder and the Method in a PtrHashtable.
14003 (TypeManager.builder_to_method): Added for this purpose.
14004 (TypeManager.MethodFlags): Added IsObsoleteError.
14005 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
14006 Obsolete and Conditional arguments in MethodBuilders. If we discover
14007 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
14008 the message from the attribute.
14010 2002-07-24 Martin Baulig <martin@gnome.org>
14012 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
14013 preprocessor directives, ensure that the argument to #define/#undef is
14014 exactly one identifier and that it's actually an identifier.
14016 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
14019 2002-07-24 Martin Baulig <martin@gnome.org>
14021 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
14022 initialize it to TypeManager.object_type in the constructor.
14023 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
14024 of the `hm.get_current' method if we're using the collection pattern.
14025 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
14026 for the explicit conversion to make it work when we're using the collection
14027 pattern and the `Current' property has a different return type than `object'.
14030 2002-07-24 Martin Baulig <martin@gnome.org>
14032 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
14033 does not match, but don't report any errors. This method is called in
14034 order for all methods in a MethodGroupExpr until a matching method is
14035 found, so we don't want to bail out if the first method doesn't match.
14036 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
14037 matches, report the 123. Fixes #28070.
14039 2002-07-24 Martin Baulig <martin@gnome.org>
14041 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
14042 TypeManager.TypeToCoreType() to the top of the method so the
14043 following equality checks will work. Fixes #28107.
14045 2002-07-24 Martin Baulig <martin@gnome.org>
14047 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
14048 operand is of type uint, and the other operand is of type sbyte,
14049 short or int, the operands are converted to type long." -
14050 Actually do what this comment already told us. Fixes bug #28106,
14053 2002-07-24 Martin Baulig <martin@gnome.org>
14055 * class.cs (MethodBase): New abstract class. This is now a base
14056 class for Property, Indexer and Event to avoid some code duplication
14057 in their Define() and DefineMethods() methods.
14058 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
14059 generic methods for Define() and DefineMethods().
14060 (FieldBase): Derive from MemberBase, not MemberCore.
14061 (Property): Derive from MemberBase, not MemberCore.
14062 (Property.DefineMethod): Moved all the code from this method to the
14063 new MethodBase.DefineAccessor(), just call it with appropriate
14065 (Property.Define): Call the new Property.DoDefine(), this does some
14066 sanity checks and we don't need to duplicate the code everywhere.
14067 (Event): Derive from MemberBase, not MemberCore.
14068 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
14069 accessors, this will also make them work with interface events.
14070 (Indexer): Derive from MemberBase, not MemberCore.
14071 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14072 (Indexer.Define): Use the new MethodBase functions.
14074 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14075 argument to the constructor.
14076 (Interface.FindMembers): Added support for interface events.
14077 (Interface.PopluateEvent): Implemented.
14079 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14081 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14083 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14084 but this is required to check for a method name being the same as
14085 the containing class.
14089 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14091 * interface.cs: initialize variable.
14093 2002-07-23 Martin Baulig <martin@gnome.org>
14095 Implemented the IndexerName attribute in interfaces.
14097 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14098 name if this is an explicit interface implementation.
14099 (Indexer.InterfaceIndexerName): New public variable. If we're
14100 implementing an interface indexer, this is the IndexerName in that
14101 interface. Otherwise, it's the IndexerName.
14102 (Indexer.DefineMethod): If we're implementing interface indexer,
14103 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14104 and Pending.ImplementIndexer methods.
14105 (Indexer.Define): Also define the PropertyBuilder if we're
14106 implementing an interface indexer and this is neither an explicit
14107 interface implementation nor do the IndexerName match the one in
14110 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14111 If a method is defined here, then we always need to create a proxy
14112 for it. This is used when implementing interface indexers.
14113 (Pending.IsInterfaceIndexer): New public method.
14114 (Pending.ImplementIndexer): New public method.
14115 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14116 This is used when implementing interface indexers to define a proxy
14118 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14119 define a proxy if necessary.
14121 * interface.cs (Interface.IndexerName): New public variable.
14122 (Interface.PopulateIndexer): Set the IndexerName.
14123 (Interface.DefineIndexers): New private method. Populate all the
14124 indexers and make sure their IndexerNames match.
14126 * typemanager.cs (IndexerPropertyName): Added support for interface
14129 2002-07-22 Martin Baulig <martin@gnome.org>
14131 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14132 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14133 ret if HasReturnLabel.
14134 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14137 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14138 and set the ec.LoopBeginTryCatchLevel.
14139 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14140 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14141 the current ec.TryCatchLevel, the branch goes out of an exception
14142 block. In this case, we need to use Leave and not Br.
14144 2002-07-22 Martin Baulig <martin@gnome.org>
14146 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14147 block unless the block does not always return or it is contained in
14148 another try { ... } catch { ... } block. Fixes bug #26506.
14149 Added verify-1.cs to the test suite.
14151 2002-07-22 Martin Baulig <martin@gnome.org>
14153 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14154 then we do not always return. Fixes bug #24985.
14156 2002-07-22 Martin Baulig <martin@gnome.org>
14158 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14159 lookup on a per-class level; ie. walk up the class hierarchy until we
14160 found at least one applicable method, then choose the best among them.
14161 Fixes bug #24463 and test-29.cs.
14163 2002-07-22 Martin Baulig <martin@gnome.org>
14165 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14166 return types of the methods. The return type is not part of the
14167 signature and we must not check it to make the `new' modifier work.
14168 Fixes bug #27999, also added test-147.cs.
14169 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14171 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14172 on the method's return type.
14174 2002-07-21 Martin Baulig <martin@gnome.org>
14176 * assign.cs: Make this work if the rightmost source is a constant and
14177 we need to do an implicit type conversion. Also adding a few more tests
14178 to test-38.cs which should have caught this.
14180 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14181 target in the makefile for this. The makefile.gnu is primarily intended
14182 for end-users who don't want to debug the compiler.
14184 2002-07-21 Martin Baulig <martin@gnome.org>
14186 * assign.cs: Improved the Assign class so it can now handle embedded
14187 assignments (X = Y = Z = something). As a side-effect this'll now also
14188 consume less local variables. test-38.cs now passes with MCS, added
14189 a few new test cases to that test.
14191 2002-07-20 Martin Baulig <martin@gnome.org>
14193 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14194 instructions. Fixes bug #27977, also added test-146.cs.
14196 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14198 * cs-tokenizer.cs: fixed getHex ().
14200 2002-07-19 Martin Baulig <martin@gnome.org>
14202 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14203 not Type.GetType() to lookup the array type. This is needed when
14204 we're constructing an array of a user-defined type.
14205 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14206 single-dimensional arrays, but also for single-dimensial arrays of
14209 2002-07-19 Martin Baulig <martin@gnome.org>
14211 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14212 this function is called, it's not allowed to share LocalBuilders
14213 among ILGenerators.
14215 2002-07-19 Martin Baulig <martin@gnome.org>
14217 * expression.cs (Argument.Resolve): Report an error 118 when trying
14218 to pass a type as argument.
14220 2002-07-18 Martin Baulig <martin@gnome.org>
14222 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14223 Conv_R_Un for the signed `long' type.
14225 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14227 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14228 `expr' for the temporary result, as that will fail if we do
14229 multiple resolves on the same expression.
14231 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14233 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14234 ec.TypeContainer for looking up aliases.
14236 * class.cs (TypeContainer): Remove LookupAlias from here.
14238 * decl.cs (DeclSpace); Move here.
14240 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14242 * class.cs (FindMembers): Only call filter if the constructor
14243 bulider is not null.
14245 Also handle delegates in `NestedTypes' now. Now we will perform
14246 type lookups using the standard resolution process. This also
14249 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14250 This uses Expressions (the limited kind that can be parsed by the
14251 tree) instead of strings.
14253 * expression.cs (ComposedCast.ToString): Implement, used to flag
14254 errors since now we have to render expressions.
14256 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14259 * ecore.cs (SimpleName.ToString): ditto.
14261 * cs-parser.jay: Instead of using strings to assemble types, use
14262 Expressions to assemble the type (using SimpleName, ComposedCast,
14263 MemberAccess). This should fix the type lookups in declarations,
14264 because we were using a different code path for this.
14266 * statement.cs (Block.Resolve): Continue processing statements
14267 even when there is an error.
14269 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14271 * class.cs (Event.Define): Also remove the `remove' method from
14272 the list of pending items.
14274 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14275 generate more compact code.
14277 2002-07-17 Martin Baulig <martin@gnome.org>
14279 * const.cs (Const.LookupConstantValue): Add support for constant
14280 `unchecked' and `checked' expressions.
14281 Also adding test case test-140.cs for this.
14283 2002-07-17 Martin Baulig <martin@gnome.org>
14285 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14286 check whether mi.ReturnType implements the IEnumerator interface; the
14287 `==' and the IsAssignableFrom() will fail in this situation.
14289 2002-07-16 Ravi Pratap <ravi@ximian.com>
14291 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14294 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14296 * expression.cs: fixed bug #27811.
14298 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14300 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14301 Molaro: when we are a ref, the value already contains a pointer
14302 value, do not take the address of it.
14304 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14305 * removed mb-parser.jay and mb-tokenizer.cs
14307 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14309 * expression.cs: check against the building corlib void type.
14311 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14313 * ecore.cs: fix for valuetype static readonly fields: when
14314 initializing them, we need their address, not the address of a copy.
14316 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14318 * typemanager.cs: register also enum_type in corlib.
14320 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14322 * class.cs: allow calling this (but not base) initializers in structs.
14324 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14326 * ecore.cs: make sure we compare against the building base types
14329 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14331 * typemanager.cs: fix TypeToCoreType() to handle void and object
14332 (corlib gets no more typerefs after this change).
14334 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14336 * expression.cs (ArrayCreation.EmitArrayArguments): use
14337 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14339 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14340 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14341 array indexes, the runtime actually forbids them.
14343 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14344 for array arguments here.
14346 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14347 instead of the default for ValueTypes.
14349 (New.DoEmit): Use IsValueType instead of
14350 IsSubclassOf (value_type)
14351 (New.DoResolve): ditto.
14352 (Invocation.EmitCall): ditto.
14354 * assign.cs (Assign): ditto.
14356 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14357 Statements *are* currently doing part of their resolution during
14360 Expressions do always resolve during resolve, but statements are
14361 only required to propagate resolution to their children.
14363 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14365 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14367 (LoadAssembly): Do not add the dll if it is already specified
14369 (MainDriver): Add the System directory to the link path at the end,
14370 after all the other -L arguments.
14372 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14373 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14374 ldelem.u1) and using the opposite for sbytes.
14376 This fixes Digger, and we can finally run it.
14378 * driver.cs (UnixParseOption): Move the option parsing here.
14379 (CSCParseOption): Implement CSC-like parsing of options.
14381 We now support both modes of operation, the old Unix way, and the
14382 new CSC-like way. This should help those who wanted to make cross
14383 platform makefiles.
14385 The only thing broken is that /r:, /reference: and /lib: are not
14386 implemented, because I want to make those have the same semantics
14387 as the CSC compiler has, and kill once and for all the confussion
14388 around this. Will be doing this tomorrow.
14390 * statement.cs (Unsafe.Resolve): The state is checked during
14391 resolve, not emit, so we have to set the flags for IsUnsfe here.
14393 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14395 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14396 not catch the Error_ObjectRefRequired in SimpleName (as it is
14397 possible to have a class/instance variable name that later gets
14398 deambiguated), we have to check this here.
14400 2002-07-10 Ravi Pratap <ravi@ximian.com>
14402 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14403 make static and put into Expression.
14405 (Event.Define): Register the private field of the event with the
14406 TypeManager so that GetFieldFromEvent can get at it.
14408 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14409 keep track of the private field associated with an event which
14412 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14415 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14417 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14419 * expression.cs (Binary.EmitBranchable): this routine emits the
14420 Binary expression in a branchable context. This basically means:
14421 we need to branch somewhere, not just get the value on the stack.
14423 This works together with Statement.EmitBoolExpression.
14425 * statement.cs (Statement.EmitBoolExpression): Use
14428 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14430 * statement.cs (For): Reduce the number of jumps in loops.
14432 (For): Implement loop inversion for the For statement.
14434 (Break): We can be breaking out of a Try/Catch controlled section
14435 (foreach might have an implicit try/catch clause), so we need to
14436 use Leave instead of Br.
14438 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14439 now). If the instace expression supports IMemoryLocation, we use
14440 the AddressOf method from the IMemoryLocation to extract the
14441 address instead of emitting the instance.
14443 This showed up with `This', as we were emitting the instance
14444 always (Emit) instead of the Address of This. Particularly
14445 interesting when This is a value type, as we dont want the Emit
14446 effect (which was to load the object).
14448 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14450 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14452 * statement.cs (Checked): Set the CheckedState during the resolve
14453 process too, as the ConvCast operations track the checked state on
14454 the resolve process, and not emit.
14456 * cs-parser.jay (namespace_member_declaration): Flag that we have
14457 found a declaration when we do. This is used to flag error 1529
14459 * driver.cs: Report ok when we display the help only.
14461 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14463 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14465 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14467 * cs-tokenizer.cs (define): We also have to track locally the
14468 defines. AllDefines is just used for the Conditional Attribute,
14469 but we also need the local defines for the current source code.
14471 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14473 * statement.cs (While, For, Do): These loops can exit through a
14474 Break statement, use this information to tell whether the
14475 statement is the last piece of code.
14477 (Break): Flag that we break.
14479 * codegen.cs (EmitContexts): New `Breaks' state variable.
14481 2002-07-03 Martin Baulig <martin@gnome.org>
14483 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14484 modifiers in method declarations in structs. Otherwise, you won't
14485 be able to override things like Object.Equals().
14487 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14489 * class.cs (Method, Property, Indexer): Do not allow the public
14490 modifier to be used in explicit interface implementations.
14492 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14493 override modifiers in method declarations in structs
14495 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14497 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14498 integer or real overflow, report an error
14500 2002-07-02 Martin Baulig <martin@gnome.org>
14502 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14503 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14504 to tell the runtime about our newly created System.Object and
14505 System.ValueType types.
14507 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14509 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14510 struct instead of Ldarg/Starg.
14512 2002-07-02 Martin Baulig <martin@gnome.org>
14514 * expression.cs (Indirection.Indirection): Call
14515 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14517 2002-07-02 Martin Baulig <martin@gnome.org>
14519 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14520 ValueType, call TypeManager.TypeToCoreType() on it.
14521 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14522 the OpCodes.Newarr argument.
14524 2002-07-02 Martin Baulig <martin@gnome.org>
14526 * expression.cs (Invocation.EmitCall): When compiling corlib,
14527 replace all calls to the system's System.Array type to calls to
14528 the newly created one.
14530 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14531 System.Array methods.
14532 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14533 from the system's System.Array type which must be replaced.
14535 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14537 * typemanager.cs: load unverifiable_code_ctor so we can build
14538 corlib using the correct type. Avoid using GetTypeCode() with
14540 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14541 TypeManager.object_type to allow building corlib.
14543 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14545 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14547 2002-07-01 Martin Baulig <martin@gnome.org>
14549 * class.cs: Make the last change actually work, we need to check
14550 whether `ifaces != null' to avoid a crash.
14552 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14554 * class.cs: when we build structs without fields that implement
14555 interfaces, we need to add the interfaces separately, since there is
14556 no API to both set the size and add the interfaces at type creation
14559 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14561 * expression.cs: the dimension arguments to the array constructors
14562 need to be converted if they are a long.
14564 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14566 * class.cs: don't emit ldarg.0 if there is no parent constructor
14567 (fixes showstopper for corlib).
14569 2002-06-29 Martin Baulig <martin@gnome.org>
14571 MCS now compiles corlib on GNU/Linux :-)
14573 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14574 ie. check for MethodImplOptions.InternalCall.
14576 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14577 and TypeManager.attribute_type are null, so we must explicitly check
14578 whether parent is not null to find out whether it's an attribute type.
14579 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14580 and SetBuilder, not only if the property is neither abstract nor external.
14581 This is necessary to set the MethodImplOptions on the accessor methods.
14582 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14583 SetBuilder, see Property.Emit().
14585 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14586 populate "System.Object", "System.ValueType" and "System.Attribute" since
14587 they've already been populated from BootCorlib_PopulateCoreTypes().
14589 2002-06-29 Martin Baulig <martin@gnome.org>
14591 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14592 is the NullLiteral, we also need to make sure that target_type is not
14595 2002-06-29 Martin Baulig <martin@gnome.org>
14597 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14598 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14599 before calling BootstrapCorlib_ResolveDelegate ().
14601 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14603 * statement.cs: fixed build-breaker. All tests passed ok.
14605 2002-06-27 Martin Baulig <martin@gnome.org>
14607 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14608 for System.Decimal when compiling corlib.
14610 2002-06-27 Martin Baulig <martin@gnome.org>
14612 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14613 switch blocks which contain nothing but a default clause.
14615 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14617 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14619 2002-06-27 Martin Baulig <martin@gnome.org>
14621 * ecore.cs (PropertyExpr.PropertyExpr): Call
14622 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14624 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14625 is already a TypeBuilder.
14627 2002-06-27 Martin Baulig <martin@gnome.org>
14629 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14630 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14631 the "from an array-type to System.Array" case. This makes it work
14632 when compiling corlib.
14634 2002-06-27 Martin Baulig <martin@gnome.org>
14636 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14637 non-static PropertyExpr, set its InstanceExpression. This makes
14638 the `ICollection.Count' property work in System/Array.cs.
14640 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14642 * driver.cs: Made error handling more consistent. Errors now
14643 tracked by Report class, so many methods which used to return int
14644 now return void. Main() now prints success/failure and
14645 errors/warnings message.
14647 Renamed '--probe' compiler argument to '--expect-error'. Removed
14648 the magic number return values (123 and 124). Now, if the
14649 expected error occurs, the compiler exits with success (exit value
14650 0). If the compilation completes without seeing that particular
14651 error, the compiler exits with failure (exit value 1). The
14652 makefile in mcs/errors has been changed to handle the new behaviour.
14654 * report.cs: Made 'expected error' number a property and renamed
14655 it from 'Probe' to 'ExpectedError'.
14657 * genericparser.cs: Removed error handling support, since it is
14658 now all done by Report class.
14660 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14661 class, so parse() no longer returns an int.
14663 * namespace.cs: Use Report.Error instead of GenericParser.error
14665 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14667 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14668 TypeContainer.AddOperator): At the front of the list put the
14669 explicit implementations, so they get resolved/defined first.
14671 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14673 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14674 interface type is implemented by this TypeContainer. Used during
14675 explicit interface implementation.
14677 (Property.Define, Indexer.Define, Method.Define): Validate that
14678 the given interface in the explicit implementation is one of the
14679 base classes for the containing type.
14681 Also if we are explicitly implementing an interface, but there is
14682 no match in the pending implementation table, report an error.
14684 (Property.Define): Only define the property if we are
14685 not explicitly implementing a property from an interface. Use the
14686 correct name also for those properties (the same CSC uses,
14687 although that is really not needed).
14689 (Property.Emit): Do not emit attributes for explicitly implemented
14690 properties, as there is no TypeBuilder.
14692 (Indexer.Emit): ditto.
14694 Hiding then means that we do not really *implement* a pending
14695 implementation, which makes code fail.
14697 2002-06-22 Martin Baulig <martin@gnome.org>
14699 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14700 the return value of Object.GetType(). [FIXME: we need to do this whenever
14701 we get a type back from the reflection library].
14703 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14705 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14707 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14709 * attribute.cs: Return null if we can not look up the type.
14711 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14712 the interface types found.
14714 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14715 interface types found.
14717 * typemanager.cs (GetInterfaces): Make this routine returns alll
14718 the interfaces and work around the lame differences between
14719 System.Type and System.Reflection.Emit.TypeBuilder in the results
14720 result for GetInterfaces.
14722 (ExpandInterfaces): Given an array of interface types, expand and
14723 eliminate repeated ocurrences of an interface. This expands in
14724 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14727 2002-06-21 Martin Baulig <martin@gnome.org>
14729 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14732 2002-06-21 Martin Baulig <martin@gnome.org>
14734 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14735 and called with one of the core types, return the corresponding typebuilder for
14738 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14741 2002-06-21 Martin Baulig <martin@gnome.org>
14743 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14744 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14745 (Expression.ConvertReferenceExplicit): Likewise.
14747 * expression.cs (ElementAccess.DoResolve): Likewise.
14748 (ElementAccess.DoResolveLValue): Likewise.
14750 2002-06-10 Martin Baulig <martin@gnome.org>
14752 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14753 add the "value" parameter to the parameter list.
14755 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14758 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14760 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14761 the argument to an int, uint, long or ulong, per the spec. Also
14762 catch negative constants in array creation.
14764 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14766 * class.cs: do not allow the same interface to appear twice in
14767 the definition list.
14769 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14771 * ecore.cs: don't use ldlen with System.Array.
14773 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14775 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14777 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14779 * modifiers.cs: produce correct field attributes for protected
14780 internal. Easy fix so miguel can work on ther harder stuff:-)
14782 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14784 * pending.cs: New file. Move the code from class.cs here.
14785 Support clearning the pending flag for all methods (when not doing
14786 explicit interface implementation).
14788 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14790 * rootcontext.cs: added a couple more types needed to bootstrap.
14792 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14794 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14795 constructor in the type, instead of any constructor in the type
14796 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14797 a bug in the Mono runtime when applying the params attribute).
14799 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14800 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14802 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14804 * expression.cs (Unary.ResolveOperator): Use TypeManager
14805 to resolve the type.
14807 2002-06-13 Ravi Pratap <ravi@ximian.com>
14809 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14812 * enum.cs (AddEnumMember): Add support to store the attributes associated
14813 with each member too.
14815 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14816 field builders too - this takes care of the enum member case.
14818 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14820 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14821 address-of operator on both value types and pointers.
14823 2002-06-10 Martin Baulig <martin@gnome.org>
14825 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14826 PropertyBuilder to the `property_builders' list.
14828 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14829 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14830 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14831 find any indexers which are inherited from an interface.
14833 2002-06-09 Martin Baulig <martin@gnome.org>
14835 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14836 the same type as the constant if necessary. There's also a test-130.cs
14839 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14841 * typemanager.cs (TypeManager.ChangeType): Previously known as
14842 Enum.ChangeEnumType().
14844 2002-06-09 Martin Baulig <martin@gnome.org>
14846 * expression.cs (Cast.TryReduce): Added support for consts.
14848 2002-06-08 Ravi Pratap <ravi@ximian.com>
14850 * class.cs (Accessor): Hold attributes information so we can pass
14853 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14854 Modify to pass in attributes attached to the methods.
14856 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14858 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14859 to handle the Accessor kind :-)
14861 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14863 2002-06-08 Martin Baulig <martin@gnome.org>
14865 * expression.cs (Unary.TryReduceNegative): Added support for
14868 2002-06-08 Martin Baulig <martin@gnome.org>
14870 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14871 name can't be found in the `defined_names' - the caller will do a
14872 MemberLookup in this case and thus find methods in System.Enum
14873 such as Enum.IsDefined().
14875 2002-06-08 Martin Baulig <martin@gnome.org>
14877 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14878 Convert.ChangeType() which works with TypeBuilder created types.
14879 (Enum.LookupEnumValue, Enum.Define): Use it here.
14881 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14882 `TypeBuilder.BaseType != null' check.
14883 (TypeContainer.FindMembers): Only lookup parent members if we
14884 actually have a parent.
14885 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14886 (ConstructorInitializer.Resolve): Likewise.
14888 * interface.cs (Interface.FindMembers): Added
14889 `TypeBuilder.BaseType != null' check.
14891 * rootcontext.cs (RootContext.ResolveCore): Added
14892 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14893 classes_second_stage.
14895 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14896 debug_type and trace_type when compiling with --nostdlib.
14898 2002-06-07 Martin Baulig <martin@gnome.org>
14900 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14901 (AddField): Set it to true when adding a non-static field.
14902 (DefineType): Use `have_nonstatic_fields' to find out whether we
14903 have non-static fields, not `Fields != null'.
14905 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14907 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14908 dereferencing a null on the static-field code path)
14910 2002-05-30 Martin Baulig <martin@gnome.org>
14912 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14913 to take command line arguments. Use reflection to call the new
14914 custom `Initialize' function on the symbol writer and pass it the
14915 command line arguments.
14917 * driver.cs (--debug-args): New command line argument to pass command
14918 line arguments to the symbol writer.
14920 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14922 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14923 the target type for indexers and properties. Thanks to Joe for
14926 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14928 * typemanager.cs (MethodFlags): returns the method flags
14929 (Obsolete/ShouldIgnore) that control warning emission and whether
14930 the invocation should be made, or ignored.
14932 * expression.cs (Invocation.Emit): Remove previous hack, we should
14933 not do this on matching a base type, we should do this based on an attribute
14935 Only emit calls to System.Diagnostics.Debug and
14936 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14937 on the command line.
14939 * rootcontext.cs: Global settings for tracing and debugging.
14941 * cs-tokenizer.cs (define): New utility function to track
14942 defines. Set the global settings for TRACE and DEBUG if found.
14944 2002-05-25 Ravi Pratap <ravi@ximian.com>
14946 * interface.cs (Populate*): Pass in the TypeContainer as well as
14947 the DeclSpace as parameters so that we can create EmitContexts and
14948 then use that to apply attributes etc.
14950 (PopulateMethod, PopulateEvent, PopulateProperty)
14951 (PopulateIndexer): Apply attributes everywhere.
14953 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14956 (ApplyAttributes): Update accordingly.
14958 We now apply interface attributes for all members too.
14960 2002-05-26 Miguel de Icaza <miguel@ximian.com>
14962 * class.cs (Indexer.Define); Correctly check if we are explicit
14963 implementation (instead of checking the Name for a ".", we
14964 directly look up if the InterfaceType was specified).
14966 Delay the creation of the PropertyBuilder.
14968 Only create the PropertyBuilder if we are not an explicit
14969 interface implementation. This means that explicit interface
14970 implementation members do not participate in regular function
14971 lookups, and hence fixes another major ambiguity problem in
14972 overload resolution (that was the visible effect).
14974 (DefineMethod): Return whether we are doing an interface
14977 * typemanager.cs: Temporary hack until we get attributes in
14978 interfaces (Ravi is working on that) and we get IndexerName
14979 support in interfaces.
14981 * interface.cs: Register the indexers as properties.
14983 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
14984 warning, I have verified that this is a bug in the .NET runtime
14985 (JavaScript suffers of the same problem).
14987 * typemanager.cs (MemberLookup): When looking up members for
14988 interfaces, the parent of an interface is the implicit
14989 System.Object (so we succeed in searches of Object methods in an
14990 interface method invocation. Example: IEnumerable x; x.ToString
14993 2002-05-25 Miguel de Icaza <miguel@ximian.com>
14995 * class.cs (Event): Events should also register if they do
14996 implement the methods that an interface requires.
14998 * typemanager.cs (MemberLookup); use the new GetInterfaces
15001 (GetInterfaces): The code used to lookup interfaces for a type is
15002 used in more than one place, factor it here.
15004 * driver.cs: Track the errors at the bottom of the file, we kept
15007 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
15008 instance if the method we are calling is static!
15010 2002-05-24 Miguel de Icaza <miguel@ximian.com>
15012 * attribute.cs (ApplyAttributes): Make this function filter out
15013 the IndexerName attribute (as that attribute in reality is never
15014 applied) and return the string constant for the IndexerName
15017 * class.cs (TypeContainer.Emit): Validate that all the indexers
15018 have the same IndexerName attribute, and if so, set the
15019 DefaultName attribute on the class.
15021 * typemanager.cs: The return value might contain other stuff (not
15022 only methods). For instance, consider a method with an "Item"
15023 property and an Item method.
15025 * class.cs: If there is a problem with the parameter types,
15028 2002-05-24 Ravi Pratap <ravi@ximian.com>
15030 * ecore.cs (ImplicitConversionExists): Wrapper function which also
15031 looks at user defined conversion after making a call to
15032 StandardConversionExists - we need this for overload resolution.
15034 * expression.cs : Update accordingly the various method calls.
15036 This fixes 2 bugs filed against implicit user defined conversions
15038 2002-05-22 Miguel de Icaza <miguel@ximian.com>
15040 * statement.cs: Track the result of the assignment.
15042 2002-05-21 Miguel de Icaza <miguel@ximian.com>
15044 * expression.cs (MemberAccess): Improved error reporting for
15045 inaccessible members.
15047 2002-05-22 Martin Baulig <martin@gnome.org>
15049 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
15050 itself with debugging support.
15052 2002-05-22 Martin Baulig <martin@gnome.org>
15054 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
15055 Removed, this isn't needed anymore.
15057 2002-05-20 Martin Baulig <martin@gnome.org>
15059 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
15060 be underlying type for an enum.
15062 2002-05-20 Miguel de Icaza <miguel@ximian.com>
15064 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
15065 that splits out the loading of just the core types.
15067 * rootcontext.cs (ResolveCore): Split the struct resolution in
15068 two, so we can load the enumeration underlying types before any
15071 * expression.cs (Is): Bandaid until we fix properly Switch (see
15072 bug #24985 for details).
15074 * typemanager.cs (ImplementsInterface): The hashtable will contain
15075 a null if there are no interfaces implemented.
15077 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15079 * cs-parser.jay (indexer_declarator): It is fine to have array
15082 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15084 * typemanager.cs: (RegisterBuilder): New function used to register
15085 TypeBuilders that implement interfaces. Since
15086 TypeBuilder.GetInterfaces (as usual) does not work with lame
15088 (AddUserType): register interfaces.
15090 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15091 dealing with TypeBuilder. Also, arrays are showing up as
15092 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15093 methods can not be invoked on them!
15095 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15096 (ImplicitReferenceConversionExists): Split out from
15097 StandardConversionExists.
15099 * expression.cs (As): We were only implementing one of the three
15100 cases for the as operator. We now implement them all.
15101 (Is): Implement the various other cases for Is as well.
15103 * typemanager.cs (CACHE): New define used to control if we want or
15104 not the FindMembers cache. Seems to have a negative impact on
15105 performance currently
15107 (MemberLookup): Nested types have full acess to
15108 enclosing type members
15110 Remove code that coped with instance/static returns for events, we
15111 now catch this in RealFindMembers.
15113 (RealFindMembers): only perform static lookup if the instance
15114 lookup did not return a type or an event.
15116 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15118 * assign.cs (CompoundAssign): We pass more semantic information
15119 now to Compound Assignments than we did before: now we have all
15120 the information at hand, and now we resolve the target *before* we
15121 do the expression expansion, which allows the "CacheValue" method
15122 to have the effect we intended (before, a [x] += 1 would generate
15123 two differen ArrayAccess expressions from the ElementAccess,
15124 during the resolution process).
15126 (CompoundAssign.DoResolve): Resolve target and original_source here.
15128 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15130 * expression.cs (ArrayAccess): dropped debugging information.
15132 * typemanager.cs: Small bug fix: I was always returning i_members,
15133 instead of one of i_members or s_members (depending on which had
15136 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15137 method is invoked before any code generation takes place, and it
15138 is a mechanism to inform that the expression will be invoked more
15139 than once, and that the method should use temporary values to
15140 avoid having side effects
15142 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15144 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15147 * expression.cs (Indirection, ArrayAccess): Add support for
15148 CacheTemporaries in these two bad boys.
15150 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15151 ldobj or ldind_ref.
15152 (StoreFromPtr): Handle stobj as well.
15154 * expression.cs (UnaryMutator): Share more code.
15156 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15157 down: I was not tracking the Filter function as well, which
15158 was affecting the results of the cache.
15160 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15162 * attribute.cs: Remove the hack to handle the CharSet property on
15165 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15167 * attribute.cs (DoResolve): More uglyness, we now only try to
15168 resolve the attribute partially, to extract the CharSet
15169 information (only if we are a StructLayout attribute). Otherwise
15171 (GetExtraTypeInfo): Add some code to conditionally kill in the
15172 future this. I am more and more convinced that the .NET
15173 framework has special code to handle the attribute setting on
15176 * expression.cs (IsParamsMethodApplicable): Revert my previous
15177 foreach change here, it was wrong.
15179 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15181 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15182 (pp_expr): do not abort on unknown input, just return.
15183 (eval): abort if there are pending chars.
15185 * attribute.cs (Attribute.Resolve): Positional parameters are
15186 optional. Deal with that case.
15188 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15189 the Ansi/Unicode/Auto information for the type.
15191 (TypeContainer.DefineType): instantiate the EmitContext here, as
15192 we will be using it during the type definition (to resolve
15193 attributes) and during the emit phase.
15195 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15196 to pull type information out of the attributes
15198 (Attribute.Resolve): track the constructor builder, and allow for
15199 multiple invocations (structs and classes will use this).
15201 * ecore.cs (MemberLookupFinal): new version with all the
15202 parameters customizable.
15204 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15205 constructors. Return if the result value is null (as the error
15206 would have been flagged already by MemberLookupFinal)
15208 Do not allow instances of abstract classes or interfaces to be
15211 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15212 We have to compare the assembly property here when dealing with
15213 FamANDAssem and Assembly access modifiers, because we might be
15214 creating an assembly from *modules* (that means that we are not
15215 getting TypeBuilders for types defined in other modules that are
15216 part of this assembly).
15218 (Method.Emit): If the method is marked abstract and has a body,
15221 (TypeContainer.DefineMembers): If both the defined member and the
15222 parent name match are methods, then do not emit any warnings: let
15223 the Method.Define routine take care of flagging warnings. But if
15224 there is a mismatch (method overrides something else, or method is
15225 overriwritten by something, then emit warning).
15227 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15228 set to null, this means `do not check for the return type on the
15231 (Method.Define): set the return type for the method signature to
15232 null, so that we get methods with the same name and parameters and
15233 different return types. This is used to flag warning 114 (you are
15234 hiding a method, and you probably want to use the new/override
15237 * typemanager.cs (MemberLookup): Implemented proper access
15238 control, closing a long standing set of bug reports. The problem
15239 was that the Framework only has two bits: Public and NonPublic,
15240 and NonPublic includes private and protected methods, but we need
15241 to enforce the FamANDAssem, FamOrAssem and Family.
15243 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15245 * statement.cs (GotoCase): Return true: Ammounts to giving up
15246 knowledge on whether we return or not, and letting the other case
15247 be responsible for it.
15249 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15251 * driver.cs: Do not load directories for each file processed, only
15252 do it if there is a pattern.
15254 * ecore.cs: Report readonly assigns here as well, as we might have
15255 been resolved only by MemberAccess.
15257 (SimpleName.SimpleNameResolve): Also be useful for LValue
15258 resolution. We need this to propagate assign to local readonly variables
15260 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15261 do not want to reuse potential criteria memory.
15263 * class.cs (MyEventBuilder): Set reflected_type;
15265 * ecore.cs (Constantify): Added support for constifying bools.
15267 (RootContext.LookupType): Added a cache for values looked up in
15268 the declaration space.
15270 * typemanager.cs (FindMembers): Now is a front-end to
15271 RealFindMembers, and provides a two-level hashtable-based cache to
15274 15% performance improvement: from 22.5 to 19.2 seconds.
15276 * expression.cs (IsParamsMethodApplicable): use foreach.
15277 (Invocation.DoResolve): ditto.
15278 (New.DoResolve): ditto.
15279 (ArrayCreation.DoResolve): ditto.
15281 * ecore.cs (FindMostEncompassingType): use foreach.
15283 * delegate.cs (NewDelegate.DoResolve): Use foreach
15285 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15286 (RemoveMethods): use foreach.
15288 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15289 nested foreach statements instead of for, and also break out of
15290 the inner loop once a match is found.
15292 (Invocation.OverloadResolve): Use foreach, simplify the code.
15294 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15296 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15297 we actually unwrap the expression to allow for extra information
15300 * expression.cs: Use Shr_Un on unsigned operations.
15302 2002-05-08 Ravi Pratap <ravi@ximian.com>
15304 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15305 applicable operators was not being considered correctly. This closes
15306 the bug Miguel reported.
15308 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15310 * attribute.cs: check that the type derives from System.Attribute
15311 and report the correct error in that case (moved the duplicate code to
15312 its own method, too).
15314 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15316 * attribute.cs: lookup attribute type name as the spec says: first the
15317 bare attribute name and then name + "Attribute" (nant compiles with
15318 mcs after this fix).
15320 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15322 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15323 Because of the way we parse things, we should try to see if a
15324 UIntConstant can fit in an integer.
15326 2002-05-07 Ravi Pratap <ravi@ximian.com>
15328 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15329 when we are in an explicit context.
15331 (ConvertReferenceExplicit): When converting from Iface type S to Class
15332 T make sure the rules are implemented as an OR.
15334 * parameter.cs (ParameterType): Make it a property for now although the
15335 purpose really isn't anything immediate.
15337 * expression.cs (Is*Applicable): Do better checking on the parameter type
15338 of a ref/out parameter. The ones from the system assemblies are already
15339 marked with the correct type so we don't need to do any correction.
15341 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15342 the object type is standard too so include that.
15344 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15346 * ecore.cs (StandardConversionExists): Augment with missing code:
15347 deal with IntConstant, LongConstants and Enumerations.
15349 * assign.cs: Report the error, instead of failing silently
15351 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15352 typecontainer that they are declared, because the
15353 typecontainer/namespace will have the list of using clauses that
15354 need to be applied.
15356 Assembly Attributes were escaping the normal registration
15359 (EmitCode): Apply attributes within an EmitContext that represents
15360 the container they were declared on.
15362 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15364 2002-05-06 Ravi Pratap <ravi@ximian.com>
15366 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15367 Revamp completely - make much cleaner as we now operate only
15370 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15371 to implement the logic detailed in the spec more correctly.
15373 (UserDefinedConversion): Update accordingly.
15375 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15377 * statement.cs: Return flow analysis information up.
15379 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15382 (token): Do not consume an extra character before calling
15385 2002-05-06 Piers Haken <piersh@friskit.com>
15387 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15389 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15391 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15392 EmitContext during the instance constructor initializer
15393 resolution, to stop access to instance variables.
15395 This is mandated by the spec, last paragraph of the `constructor
15396 initializers' section.
15398 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15400 * cs-parser.jay, class.cs (Accessor): new class used to represent
15401 an accessor (get or set). In the past we used `null' to represent
15402 a missing accessor. But this is ambiguous because there was no
15403 way to tell in abstract indexers/properties if one of them was
15406 Now there is a way of addressing that.
15408 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15409 instead of FindMembers.
15411 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15412 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15414 * attribute.cs: Treat indexers and properties as the same in terms
15415 of applying attributes
15417 * ecore.cs (FindMostEncompassedType): Use statically initialized
15418 EmptyExpressions()s like we do elsewhere to avoid creating useless
15419 objects (and we take this out of the tight loop).
15421 (GetConversionOperators): Move the code to extract the actual
15422 operators to a separate routine to clean things up.
15424 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15426 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15427 events are always registered FieldBuilders.
15429 * class.cs (FieldBase): New class shared by Fields
15431 * delegate.cs: If we are a toplevel delegate, use our full name.
15432 If we are a nested delegate, then only use our tail name.
15434 2002-05-02 Ravi Pratap <ravi@ximian.com>
15436 * expression.cs (IsApplicable): Ensure that we add the "&" to
15437 ref/out types before comparing it with the type of the argument.
15439 (IsParamsMethodApplicable): Ditto.
15441 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15444 * delegate.cs : Handle the case when we have more than one applicable
15445 method. Flag an error only when we finish checking all.
15447 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15449 * expression.cs: Add support for boolean static initializers.
15451 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15453 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15455 * parameter.cs (ComputeParameterTypes,
15456 ComputeAndDefineParameterTypes): Better error handling: now we
15457 clear the `types' cache if we fail during any of the type lookups.
15458 We also return the status code correctly to our caller
15460 * delegate.cs: If we fail to define a delegate, abort the extra
15463 * expression.cs (Binary.ResolveOperator): for
15464 operator==(object,object) and operator !=(object, object) we also
15465 have to verify that there is an implicit conversion from one to
15468 (ArrayAccess.DoResolve): Array Access can operate on
15471 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15473 * assign.cs (CompoundAssign): A new class used as a "flag" that
15474 the assignment actually is happening as part of a compound
15475 assignment operator.
15477 During compound assignment, a few new rules exist to enable things
15484 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15485 to the type of x) if y is implicitly convertible to the type of x,
15486 and the operator is a builtin operator and the return type of the
15487 operator is explicitly convertible to the type of x.
15489 * rootcontext.cs: Reset warning level to 2. 4 catches various
15490 "interesting" features in mcs, we must clean this up at some
15491 point, but currently am trying to kill other bugs ;-)
15493 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15494 in container classes as well.
15496 * expression.cs (Binary.ResolveOperator): Handle string case
15497 before anything else (as operator overloading does emit an error
15498 before doing anything else).
15500 This code could go away when we move to a table driven model, but
15501 i could not come up with a good plan last night.
15503 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15505 * typemanager.cs (CSharpName): reimplementation using regex.
15506 * class.cs: added null check for fields in Emit
15507 * rootcontext.cs: set warninglevel to 4
15509 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15511 * typemanager.cs (CSharpName): reimplemented with Lupus
15514 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15516 * statement.cs (If): correclty implement Resolve, because we were
15517 not catching sem errors in there. The same process is needed
15519 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15522 (Statement.Warning_DeadCodeFound): Factorize code.
15523 (While): Report dead code here too.
15525 (Statement): Added Resolve virtual method to allow
15526 for resolution split from the emit code.
15528 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15530 * statement.cs (EmitBoolExpression): No longer try to resolve the
15532 (MakeBoolean): New utility function that resolve, implicitly
15533 converts to boolean and tags the expression.
15536 (If, Do): Implement dead code elimination.
15537 (While): Implement loop inversion
15539 (Do, While, For, If): Resolve the expression prior to calling our
15542 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15545 - added method Report28 (warning: program has more than one entry point)
15546 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15547 - modified method Method.Define, the part at the end of the method
15549 * rootcontext.cs: added static public Location EntryPointLocation;
15551 * ../errors/cs0028.cs : Add test case for the above warning.
15554 - modified method CSharpName to allow arrays of primitive type to
15555 be printed nicely (e.g. instead of System.Int32[][] it now prints
15557 - added method CSharpSignature: returns the signature of a method
15558 in string format to be used in reporting errors, warnings, etc.
15560 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15563 2002-04-26 Ravi Pratap <ravi@ximian.com>
15565 * delegate.cs (Define): Fix extremely silly bug where I was
15566 setting the type of the 'object' parameter of the BeginInvoke
15567 method to System.IAsyncResult instead of System.Object ;-)
15569 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15571 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15574 (Constructor.Emit): return if we fail to initialize the
15575 constructor. Another door closed!
15577 * expression.cs (New.DoResolve): Improve error message (from -6 to
15578 1501). Use DeclaredOnly lookup to find the exact constructor.
15580 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15581 loop. This is useful.
15583 * cs-parser.jay: Adjust the default parameters so that destructors
15584 have the proper signature.
15586 2002-04-26 Martin Baulig <martin@gnome.org>
15588 * driver.cs (LoadAssembly): If `assembly' contains any characters
15589 which are only valid in path names and not in assembly names
15590 (currently slash, backslash and point), use Assembly.LoadFrom ()
15591 instead of Assembly.Load () on the `assembly' (before iteration
15592 over the link_paths).
15594 2002-04-26 Martin Baulig <martin@gnome.org>
15596 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15598 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15600 * class.cs (Property): use the new typemanager.MemberLookup
15602 (TypeContainer.MemberLookup): Implement using the
15603 TypeManager.MemberLookup now.
15605 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15606 and return MemberInfos, so that these can be used without an
15607 EmitContext (what we had before).
15609 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15611 * expression.cs: Fix the case where the argument to params if the
15612 type of the params. I omitted handling this before. Fixed
15614 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15616 * driver.cs: Call BootCorlib_PopulateCoreType
15618 * class.cs (Property.CheckBase): Check for properties only, not
15621 * interface.cs: Temporary hack: try/catch around the
15622 CustomAttributeBuilder, because I am getting an exception that I
15625 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15626 types whose definitions are required to be there (attributes are
15627 defined before standard types).
15629 Compute definitions as we boot the various types, as they are used
15630 immediately (value_type class will need object_type, but if we do
15631 not initialize object_type, we will pass a null, which will let
15632 the runtime pick the System.Object from the existing corlib, which
15633 is not what we want).
15635 2002-04-22 Patrik Torstensson <totte@labs2.com>
15637 * cs-tokenizer.cs: fixed a number of trim() issues.
15639 2002-04-22 Ravi Pratap <ravi@ximian.com>
15641 * expression.cs (Argument.Type): Ensure that we return the correct
15642 type when we have out or ref parameters [in which case we
15645 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15647 * class.cs (Property, Indexer): Allow extern modifier in there.
15649 * typemanager.cs (InitBaseTypes): Initializes object_type and
15650 value_type, since those will be used early on during the bootstrap
15651 process to compile corlib.
15653 (InitCoreTypes): Move code from here to InitBaseTypes.
15655 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15657 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15658 single-dimension arrays as using the ldlen opcode.
15660 Daniel Lewis discovered this optimization.
15662 * typemanager.cs: Add signature for System.Array::get_Length
15664 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15666 * statement.cs: report the error when the foreach does not apply to an
15667 array nor a collection.
15669 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15671 * expression.cs: Add implicit conversions to the operator ~.
15673 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15675 * typemanager.cs: Locate the decimal constructor.
15677 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15679 * attribute.cs: use the new property of TypeOf.
15680 * expression.cs: added 'get' property around typearg.
15682 These changes fix a build breaker reported by NickD. Is this the
15683 correct way to fix? If not, please, revert my changes and make it
15686 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15688 * attribute.cs: Add support for typeof in attribute invocations.
15689 I am not sure that this is right though.
15691 2002-04-14 Duncan Mak <duncan@ximian.com>
15693 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15694 Binary.Operator.Division case.
15696 2002-04-13 Ravi Pratap <ravi@ximian.com>
15698 * class.cs (DefineType): Ensure that we do a proper check on
15699 attribute types and also register it with the TypeManager.
15701 (TypeContainer.Targets): The default for attribute types is
15702 AttributeTargets.All.
15704 * attribute.cs (ApplyAttributes): Registering the attribute type
15705 is done elsewhere, not when we discover we have a Usage attribute.
15707 2002-04-12 Ravi Pratap <ravi@ximian.com>
15709 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15710 and get rid of is_delegate parameter.
15712 * everywhere : update.
15714 2002-04-12 Ravi Pratap <ravi@ximian.com>
15716 * cs-parser.jay (compilation_unit): Revamp completely to use
15717 some new ideas that I got from Rhys' grammar to solve the problems
15718 with assembly level attributes.
15720 (outer_declaration): New grammar production.
15722 (attribute_sections): Add.
15724 (opt_attributes): Base on attribute_sections
15726 (namespace_declaration): Allow opt_attributes to tackle the case
15727 when we have assembly level attributes - we are clever in this
15730 * attribute.cs (ApplyAttributes): Do not worry about assembly
15731 attributes in the non-global context.
15733 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15734 instead of SetGlobalAttributes.
15736 * class.cs, rootcontext.cs : Ensure we define and generate
15737 attribute types before anything else.
15739 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15740 and flag the new error -20 for the case when the attribute type
15741 does not have valid targets specified. csc does not catch this.
15743 * ../errors/errors.txt : update for error # -20
15745 2002-04-11 Ravi Pratap <ravi@ximian.com>
15747 * support.cs (InternalParameters.ParameterModifier): Do some null
15748 checking and return sane values.
15750 * class.cs (Method.Define): If we are a PInvoke method, ensure
15751 that we are static and extern. Report error # 601
15753 * ../errors/cs0601.cs : Add test case for the above error.
15755 2002-04-07 Ravi Pratap <ravi@ximian.com>
15757 * rootcontext.cs (attribute_types): We need to keep type of
15758 all attribute types separately and emit code for them first.
15760 (RegisterAttribute) : Implement.
15762 * class.cs (DefineType): Check if the current Type is a custom
15763 attribute type and register it accordingly.
15765 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15766 adding the first attribute twice and rename to
15768 (SetGlobalAttributes): this.
15770 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15773 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15774 if we are processing global arguments. Hmm, I am unsure of this.
15776 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15778 * expression.cs: added static array of strings to avoid calling
15779 Enum.ToString () for Operator in Binary. Significant recover of
15782 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15784 * class.cs (FindMembers): Allow the Builders of the various
15785 members to be null. If they are skip them. This only happens
15786 during the PInvoke declaration.
15788 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15790 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15791 failure, so we do not keep going afterwards.
15793 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15794 wanted to pass `false' as the `is_delegate' argument. If this is
15795 the case, why not use delegate_type == null to mean `is_delegate =
15796 false' and anything else as is_delegate = true.
15798 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15800 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15801 code for the section, not the beginning of the tests.
15803 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15805 * cfold.cs: Handle operator + (Enum x, Underlying x)
15807 * expression.cs (Binary): same. Warn about errors where we have
15808 Enum/Enum in operator + as well.
15810 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15813 - added support for switch(bool)
15814 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15815 - add TableSwitchEmit() to handle table-based switch statements
15817 2002-04-05 Ravi Pratap <ravi@ximian.com>
15819 * expression.cs (Invocation.OverloadResolve): Factor out code which
15820 does parameter compatibility checking with arguments so that we can
15821 re-use the code even from Delegate.VerifyApplicability
15823 (VerifyArgumentsCompat): Move above code here.
15825 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15826 and instead make a call to the above method.
15828 2002-03-31 Ravi Pratap <ravi@ximian.com>
15830 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15831 We use it to keep track of classes which are attribute types.
15833 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15835 * delegate.cs (Delegate.Define): Correctly define the types in the
15836 presence of fixed and array parameters.
15838 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15841 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15842 include NonPublic after the first iteration.
15844 * class.cs (Indexer.CheckBase): Only check if both parents are
15847 * cs-parser.jay (accessor_body): If empty, set to null.
15849 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15850 same code path here to resolve constants names that we did have in
15851 MemberAccess.DoResolve. There is too much code duplicated here.
15853 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15855 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15857 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15860 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15861 tokens, numbers and strings.
15863 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15866 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15867 asyncronous parameters and the regular parameters.
15869 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15870 specify the target directory.
15872 * expression.cs: (This.DoResolve): Simplify
15873 (As.Emit): Optimize, do not generate IsInst if the expression is
15874 always of the given type.
15876 (Is.DoResolve): Bug fix, we were reporting both always/never for
15879 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15880 creating too many unnecessary arrays.
15882 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15884 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15885 fields instead of rolling our own initializer. Takes care of all
15886 implicit conversions, and drops unnecessary static checks/argument.
15888 2002-03-31 Dick Porter <dick@ximian.com>
15890 * driver.cs: use the GetDirectories() return values properly, and
15891 use "/" as path separator.
15893 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15895 * expression.cs (Unary): Optimize - - expr into expr.
15896 (Binary): Optimize a + (-b) into a -b.
15898 * codegen.cs (CodeGen): Made all methods static.
15900 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15904 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15905 TypeBuilder property.
15907 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15910 * tree.cs: Removed the various RecordXXXX, and replaced with a
15911 single RecordDecl. Removed all the accessor methods, and just
15912 left a single access point Type
15914 * enum.cs: Rename DefineEnum to DefineType.
15916 * decl.cs: New abstract method `DefineType' used to unify the
15917 Defines for Enumerations, Interfaces, TypeContainers and
15920 (FindType): Moved LookupInterfaceOrClass here. Moved the
15921 LookupBaseClasses method that used to live in class.cs and
15922 interface.cs here, and renamed to FindType.
15924 * delegate.cs: Implement DefineType. Take advantage of the
15925 refactored pattern for locating the parent builder without taking
15926 the parent_builder argument (which we know does not work if we are
15927 nested, and triggering a toplevel definition).
15929 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15931 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15932 accessibility of a member has changed during override and report
15935 * class.cs (Method.Define, Property.Define): Only complain on
15936 overrides if the method is private, any other accessibility is
15937 fine (and since we just checked the permission is the same, we are
15940 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15941 and elif are processed always. The other pre-processing
15942 directives are only processed if we are "taking" the path
15944 2002-03-29 Martin Baulig <martin@gnome.org>
15946 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15947 current location is not Null.
15949 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15950 a separate method so we can profile it.
15952 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15953 `span.Seconds' are just seconds, but no minutes or hours.
15954 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15956 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15958 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
15959 Remove the gratuitous set of Final:
15961 // If an interface implementation, then we can set Final.
15962 if (((flags & MethodAttributes.Abstract) == 0) &&
15963 implementing.DeclaringType.IsInterface)
15964 flags |= MethodAttributes.Final;
15966 I do not know what I was smoking when I used that.
15969 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
15970 step into fixing the name resolution issues for delegates and
15971 unifying the toplevel name resolution.
15973 2002-03-28 Martin Baulig <martin@gnome.org>
15975 * class.cs (Method.Emit): If we have a symbol writer, call its
15976 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
15977 tell it about the current method.
15979 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
15980 writer that we're going to emit the first byte of IL code for a new
15981 statement (a new source line).
15982 (EmitContext.EmitTopBlock): If we have a symbol writer, call
15983 EmitContext.Mark() before emitting any code.
15985 * location.cs (SymbolDocument): Return null when we're Null.
15987 * statement.cs (Statement): Moved the `Location loc' variable here.
15988 (Statement.EmitBoolExpression): If we have a symbol writer, call
15989 ec.Mark() before emitting any code to tell it that we're at the
15990 beginning of a new statement.
15991 (StatementExpression): Added `Location' argument to the constructor.
15992 (Block): Added public readonly variable `StartLocation' and public
15993 variable `EndLocation'. The latter is to be set using SetEndLocation().
15994 (Block): Added constructor which takes a start and end location.
15995 (Block.SetEndLocation): New method. This sets the end location.
15996 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
15997 local variables we create.
15998 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
15999 each statement and do also mark the begin and end of the block.
16001 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
16002 tell it the current lexer.Location, use Location.Null for the end of the
16004 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
16005 current block, set its end location using SetEndLocation().
16006 (statement_expression): StatementExpression constructor now takes the
16007 lexer.Location as additional argument.
16008 (for_statement, declare_local_variables): Likewise.
16009 (declare_local_variables): When creating a new implicit block, use the
16010 new Block constructor and pass it the lexer.Location.
16012 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16014 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
16015 members also on the parent interfaces recursively.
16017 2002-03-27 Miguel de Icaza <miguel@ximian.com>
16019 * report.cs: Use new formats, since Gonzalo finished the missing
16022 * expression.cs (Binary.ResolveOperator): added missing operator|
16023 operator& and operator^ for bool/bool.
16025 * cs-parser.jay: CheckDef now takes a Location argument that is
16026 used to report errors more precisly (instead of reporting the end
16027 of a definition, we try to track something which is a lot closer
16028 to the source of the problem).
16030 * cs-tokenizer.cs: Track global token use, so we can properly flag
16031 the use of #define/#undef after the first token has been seen.
16033 Also, rename the reportXXXX to Error_DescriptiveName
16035 * decl.cs (DeclSpace.IsTopLevel): Move property here from
16036 TypeContainer, so that Enum and Interface can use this too.
16038 * class.cs (TypeContainer.LookupInterfaceOrClass,
16039 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
16040 `builder' argument. Typically this was used to pass the parent
16041 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
16044 The problem is that a nested class could trigger the definition of
16045 a toplevel class, and the builder would be obviously wrong in that
16048 So we drop this argument, and we compute dynamically the
16049 TypeBuilder/ModuleBuilder (the correct information was available
16050 to us anyways from DeclSpace.Parent)
16052 * interface.cs (Interface.DefineInterface): Drop builder
16053 parameter cleanup like class.cs
16055 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
16058 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
16061 (Try.Emit): Propagate the returns value from the statement.
16063 (Return.Emit): Even if we are leavning
16065 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
16067 * modifiers.cs: Fix the computation of MethodAttributes flags.
16069 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16071 * driver.cs: allow compilation of files that start with '/'.
16072 Add a default case when checking the argument of --target.
16074 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16076 * interface.cs: Implement the same search algorithm for types in
16077 the interface code.
16079 * delegate.cs: Do not allow multiple definition.
16081 * Recovered ChangeLog that got accidentally amputated
16083 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16085 * rootcontext.cs: Load manually enum to allow core classes to
16086 contain enumerations.
16088 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16089 Update to new static methods in TypeManager.
16091 * typemanager.cs (GetMethod, GetConstructor): Use our
16092 implementation of FindMembers to find the members, since during
16093 corlib compilation, the types are TypeBuilders and GetMethod and
16094 GetConstructor do not work.
16096 Make all methods in TypeManager static.
16098 (InitCodeHelpers): Split the functionality from
16099 the InitCodeTypes function.
16101 * driver.cs: Call InitCodeHelpers after we have populated the
16104 * cs-parser.jay (delegate_declaration): we did not used to compute
16105 the delegate name correctly for void delegates.
16107 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16109 * rootcontext.cs (RootContext): Init the interface_resolve_order
16110 and type_container_resolve_order always.
16112 (ResolveCore, BootstrapCorlib_ResolveClass,
16113 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16114 compiler when compiling with --nostdlib
16116 * class.cs (TypeContainer.DefineType): Check that our parent is
16117 not null. This test is most important when we are bootstraping
16120 * codegen.cs: Split out the symbol writing code.
16122 2002-03-25 Martin Baulig <martin@gnome.org>
16124 * driver.cs (-g): Made -g an alias for --debug.
16126 2002-03-24 Martin Baulig <martin@gnome.org>
16128 * codegen.cs (SymbolWriter): New public variable. Returns the
16129 current symbol writer.
16130 (CodeGen): Added `bool want_debugging_support' argument to the
16131 constructor. If true, tell the ModuleBuild that we want debugging
16132 support and ask it for the ISymbolWriter.
16133 (Save): If we have a symbol writer, call it's Close() method after
16134 saving the assembly.
16136 * driver.c (--debug): New command line argument to create a
16137 debugger information file.
16139 * location.cs (SymbolDocument): New public property. Returns an
16140 ISymbolDocumentWriter object for the current source file or null
16141 if we don't have a symbol writer.
16143 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16145 * driver.cs (LoadAssembly): Correctly return when all the paths
16146 have been tried and not before.
16148 * statement.cs (Switch.Emit): return the actual coverage for this
16149 statement (returns/not-returns)
16151 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16152 switch of the statement if we are the last switch section. That
16153 kills two problems: try/catch problems (we used to emit an empty
16154 nop at the end) and switch statements where all branches would
16157 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16159 * driver.cs: Add default assemblies (the equivalent to the
16160 Microsoft CSC.RSP file)
16162 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16163 also update tokens_seen and set it to false.
16165 * driver.cs: Implement --recurse for Mike.
16167 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16168 correctly splitting out the paths.
16170 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16172 * interface.cs (Interface.PopulateProperty): Instead of using
16173 `parent' as the declaration space for the set parameters, use
16176 * support.cs (InternalParameters): InternalParameters constructor
16177 takes a DeclSpace instead of a TypeContainer.
16179 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16180 types are being initialized, load the address of it before calling
16183 (New): Provide a mechanism to disable the generation of local
16184 value type temporaries when the caller will be providing us with
16185 an address to store it.
16187 (ArrayCreation.EmitDynamicInitializers): Use it.
16189 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16191 * expression.cs (Invocation.EmitArguments): Only probe for array
16192 property if there is more than one argument. Sorry about that.
16194 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16195 empty param arrays.
16197 * class.cs (Method.LabelParameters): Fix incorrect code path that
16198 prevented the `ParamArrayAttribute' from being applied to the
16201 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16203 * support.cs (ReflectionParameters): Correctly compute whether the
16204 last argument is a params array. Fixes the problem with
16207 * typemanager.cs: Make the assemblies array always be non-null
16208 (empty, but non-null)
16210 * tree.cs (RecordDecl): New function that abstracts the recording
16211 of names. This reports error 101, and provides a pointer to the
16212 previous declaration. Fixes a crash in the compiler.
16214 * cs-parser.jay (constructor_declaration): Update to new grammar,
16215 and provide a constructor_body that can be empty.
16217 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16219 * driver.cs: Add support for --resources.
16221 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16222 Make all types for the various array helper methods be integer.
16224 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16225 CheckState to ConvCast.
16227 (ConvCast): Now it takes a `checked' state argument, to avoid
16228 depending on the emit context for the conversion, and just using
16229 the resolve time setting.
16231 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16232 instead of Invocation.EmitArguments. We do not emit the original
16233 arguments, instead we emit those which have been converted to
16234 unsigned int expressions.
16236 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16238 * codegen.cs: ditto.
16240 * expression.cs (LocalVariableReference): Drop the use of the
16241 Store function that depended on the variable index.
16243 * statement.cs (VariableInfo): Drop the `Idx' property from this
16244 class, as this is not taking into account the indexes for
16245 temporaries tat we generate during the execution, getting the
16248 * class.cs: First emit class initializers, then call the parent
16251 * expression.cs (Binary): Fix opcode emision.
16252 (UnaryMutator.EmitCode): Support checked code generation
16254 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16255 matches for events for both the Static and Instance scans,
16256 pointing to the same element. Fix that.
16258 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16260 * rootcontext.cs (ResolveTree): Always set the
16261 interface_resolve_order, because nested interfaces will be calling
16264 * class.cs (GetInterfaceOrClass): Track the same resolution
16265 process used by TypeManager.LookupType. This fixes the nested
16266 type lookups in class declarations (separate path from
16269 (TypeContainer.DefineType): Also define nested interfaces.
16270 (TypeContainer.RegisterOrder): New public function used to
16271 register the order in which child interfaces need to be closed.
16273 Nested interfaces need to be closed after their parents have been
16276 * interface.cs (InterfaceAttr): Put all the logic for computing
16277 the interface attribute here.
16279 (DefineInterface): Register our interface order with the
16280 RootContext or with the TypeContainer depending on the case.
16282 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16284 * cs-parser.jay: rework foreach statement to work with the new
16285 changes to the policy on SimpleNames.
16287 * report.cs: support Stacktrace on warnings as well.
16289 * makefile: drop --unsafe and /unsafe from the compile.
16291 2002-03-13 Ravi Pratap <ravi@ximian.com>
16293 * ecore.cs (StandardConversionExists): Modify to take an Expression
16294 as the first parameter. Ensure we do null -> reference type conversion
16297 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16298 temporary Expression objects.
16300 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16302 * interface.cs: workaround bug in method overloading resolution
16303 (there is already a bugzilla bug for it).
16305 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16307 We could also solve this problem by having a separate path for
16308 performing type lookups, instead of DoResolve, we could have a
16309 ResolveType entry point, and only participating pieces of the
16310 production (simplename, deref, array) would implement this.
16312 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16313 signal SimpleName to only resolve type names and not attempt to
16314 resolve anything else.
16316 * expression.cs (Cast): Set the flag.
16318 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16320 * class.cs: Only report 108 if there is no `new' modifier.
16322 * cs-parser.jay: rework foreach statement to work with the new
16323 changes to the policy on SimpleNames.
16325 * report.cs: support Stacktrace on warnings as well.
16327 * makefile: drop --unsafe and /unsafe from the compile.
16329 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16331 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16332 lookups here, instead of doing that at parse time. This means
16333 that our grammar will not introduce `LocalVariableReferences' as
16334 expressions at this point. That solves the problem of code like
16338 static void Main ()
16342 This is only half the fix. The full fix requires parameters to
16343 also be handled in this way.
16345 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16346 makes the use more obvious of the DeclSpace. The
16347 ec.TypeContainer.TypeBuilder is now only used to pull the
16348 TypeBuilder for it.
16350 My theory is that I can get rid of the TypeBuilder completely from
16351 the EmitContext, and have typecasts where it is used (from
16352 DeclSpace to where it matters).
16354 The only pending problem is that the code that implements Aliases
16355 is on TypeContainer, and probably should go in DeclSpace.
16357 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16358 lookups here, instead of doing that at parse time. This means
16359 that our grammar will not introduce `LocalVariableReferences' as
16360 expressions at this point. That solves the problem of code like
16364 static void Main ()
16368 This is only half the fix. The full fix requires parameters to
16369 also be handled in this way.
16371 * class.cs (Property.DefineMethod): When implementing an interface
16372 method, set newslot, when implementing an abstract method, do not
16373 set the flag (before we tried never setting it, or always setting
16374 it, which is the difference).
16375 (Indexer.DefineMethod): same.
16376 (Method.DefineMethod): same.
16378 * ecore.cs: Only set the status used flag if we get back a Field.
16380 * attribute.cs: Temporary hack, so Paolo can keep working.
16382 2002-03-08 Ravi Pratap <ravi@ximian.com>
16384 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16385 the unmanaged type in the case we have a MarshalAs attribute.
16387 (Resolve): Handle the case when we are parsing the special MarshalAs
16388 attribute [we need to store the unmanaged type to use later]
16390 * typemanager.cs (marshal_as_attr_type): Built in type for the
16391 MarshalAs Attribute.
16393 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16394 on parameters and accordingly set the marshalling info.
16396 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16398 * class.cs: Optimizing slightly by removing redundant code after
16399 we switched to the `NoTypes' return value.
16400 (Property.DefineMethod): use NoTypes here too.
16402 This fixes the bug I introduced in my last batch of changes.
16404 2002-03-05 Ravi Pratap <ravi@ximian.com>
16406 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16408 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16409 Enums since those are types too.
16411 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16413 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16414 thanks to a call during the lookup process.
16416 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16418 * statement.cs (Foreach): Lots of work to accomodate a particular
16419 kind of foreach statement that I had not kept in mind. It is
16420 possible to have foreachs on classes that provide a GetEnumerator
16421 method that return objects that implement the "pattern" for using
16422 a foreach, there is no need to support GetEnumerator
16425 This is needed to compile nant.
16427 * decl.cs: Only report 114 if the member is not `Finalize' and if
16428 the warning level is at least 2.
16430 * class.cs: Moved the compare function from Method to
16433 (MethodSignature.InheritableMemberSignatureCompare): Add new
16434 filter function that is used to extract inheritable methods from a
16437 (Method.Define): Use the new `inheritable_method_signature_filter'
16440 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16443 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16445 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16447 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16449 * expression.cs: Pass location information to
16450 ConvertImplicitStandard.
16452 * class.cs: Added debugging code to track return values from
16455 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16457 * expression.cs (Is.DoResolve): If either side of the `is' is an
16458 interface, do not flag the warning.
16460 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16463 * report.cs: Allow for --fatal to be used with --probe.
16465 * typemanager.cs (NoTypes): Move the definition for the empty Type
16468 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16470 (TypeContainer.DefineProxy): New function used to proxy to parent
16471 implementations when implementing interfaces.
16472 (TypeContainer.ParentImplements): used to lookup if our parent
16473 implements a public function that is required by an interface.
16474 (TypeContainer.VerifyPendingMethods): Hook this up.
16476 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16477 `modules' and `assemblies' arraylists into arrays. We only grow
16478 these are the very early start up of the program, so this improves
16479 the speedof LookupType (nicely measured).
16481 * expression.cs (MakeByteBlob): Replaced unsafe code with
16482 BitConverter, as suggested by Paolo.
16484 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16485 folding of string concatenation, but if either side is a string,
16486 and the other is not, then return null, and let the runtime use
16487 the concatenation on the string plus the object (using
16488 `Object.ToString').
16490 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16492 Constant Folding has been implemented now.
16494 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16495 the error instead on types that are not supported in one's
16498 * constant.cs (Constant and all children): New set of functions to
16499 perform implict and explicit conversions.
16501 * ecore.cs (EnumConstant): Implement the new functions to perform
16502 conversion by proxying to the child expression.
16504 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16505 own separate setting that can not be turned off from the command
16506 line using --unchecked or --checked and is only controlled using
16507 the checked/unchecked statements and expressions. This setting is
16508 used by the constant folder to flag errors.
16510 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16511 ConstantCheckState as well.
16513 During Resolve, they also have to flag the state, because the
16514 constant folder runs completely in the Resolve phase.
16516 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16519 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16521 * cfold.cs: New file, this file contains the constant folder.
16523 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16524 argument to track whether we are using the resulting address to
16525 load or store a value and provide better error messages.
16527 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16528 new AddressOf arguments.
16530 * statement.cs (Foreach.EmitCollectionForeach): Update
16532 * expression.cs (Argument.Emit): Call AddressOf with proper
16533 arguments to track usage.
16535 (New.DoEmit): Call AddressOf with new arguments.
16537 (Unary.Emit): Adjust AddressOf call.
16539 2002-03-01 Ravi Pratap <ravi@ximian.com>
16541 * cs-parser.jay (member_access): Change the case for pre-defined types
16542 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16545 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16548 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16549 essentially like methods and apply attributes like MethodImplOptions to them too.
16551 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16554 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16555 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16558 * Update code everywhere accordingly.
16560 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16562 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16564 2002-02-28 Ravi Pratap <ravi@ximian.com>
16566 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16567 try performing lookups against those instead of jumping straight into using
16568 the 'using' clauses.
16570 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16572 (LookupType): Perform lookups in implicit parents too.
16574 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16575 sequence as RootContext.LookupType.
16577 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16578 the various cases of namespace lookups into this method.
16580 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16582 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16583 in positional arguments)
16585 * class.cs (Operator): Update the AllowedModifiers to contain
16588 * cs-parser.jay: Update operator declaration to allow for the
16589 operator body to be empty.
16591 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16594 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16596 * class.cs (Method.Emit): Label parameters.
16598 * driver.cs: Return 1 or 0 as the program exit code.
16600 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16602 * expression.cs: Special case the `null' object when trying to
16603 auto-compute the type, as anything can be explicitly converted to
16606 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16607 spotting this Paolo.
16609 (Expression.ImplicitNumericConversion): Perform comparissions of
16610 the type using the underlying type in the case of an enumeration
16611 rather than using the enumeration type for the compare.
16613 Cope with the underlying == type case, which is not possible to
16616 (Expression.ConvertNumericExplicit): Perform comparissions of
16617 the type using the underlying type in the case of an enumeration
16618 rather than using the enumeration type for the compare.
16620 * driver.cs: If the user does not supply an extension, assume .exe
16622 * cs-parser.jay (if_statement): Rewrote so that we can track the
16623 location for the if statement.
16625 * expression.cs (Binary.ConstantFold): Only concat strings when
16626 the operation is "+", not everything ;-)
16628 * statement.cs (Statement.EmitBoolExpression): Take a location
16630 (If, While, Do): Track location.
16632 * expression.cs (Binary.ResolveOperator): In the object + string
16633 case, I was missing a call to ConvertImplicit
16635 2002-02-25 Ravi Pratap <ravi@ximian.com>
16637 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16638 Location arguments. Ensure we use RootContext.LookupType to do our work
16639 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16641 * interface.cs (PopulateMethod): Handle the type of the parameter being
16644 * expression.cs (Invocation.BetterFunction): Handle the case when we
16645 have a params method with no fixed arguments and a call is made with no
16648 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16650 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16651 the verbatim-string-literal
16653 * support.cs (InternalParameters.ParameterModifier): handle null
16655 (InternalParameters.ParameterType): ditto.
16657 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16658 duplicating the name of the variable parameter.
16659 (GetParameterByName): Fix bug where we were not looking up array
16660 paramters if they were the only present (thanks Paolo!).
16661 (GetParameterInfo): We only have an empty set of types if both
16662 fixed and array are set to null.
16663 (GetParameterInfo-idx): Handle FixedParameter == null
16665 * cs-parser.jay: Handle the case where there is no catch
16666 statements (missing null test).
16668 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16670 * driver.cs (MainDriver): Be conservative on our command line
16673 Catch DirectoryNotFoundException when calling GetFiles.
16675 (SplitPathAndPattern): Used to split the input specification into
16676 a path and a pattern that we can feed to Directory.GetFiles.
16678 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16680 * statement.cs (Fixed): Implement the last case of the Fixed
16681 statement (string handling).
16683 * expression.cs (StringPtr): New class used to return a char * to
16684 a string; Used by the Fixed statement.
16686 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16688 * expression.cs (Binary.ResolveOperator): Remove redundant
16689 MemberLookup pn parent type.
16690 Optimize union call, we do not need a union if the types are the same.
16691 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16694 Specialize the use of MemberLookup everywhere, instead of using
16695 the default settings.
16697 (StackAlloc): Implement stackalloc keyword.
16699 * cs-parser.jay: Add rule to parse stackalloc.
16701 * driver.cs: Handle /h, /help, /?
16703 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16704 before we supported unsafe code.
16706 * makefile: add --unsafe to the self compilation of mcs.
16708 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16710 * expression.cs (PointerArithmetic): New class that is used to
16711 perform pointer arithmetic.
16712 (Binary.Resolve): Handle pointer arithmetic
16713 Handle pointer comparission.
16714 (ArrayPtr): Utility expression class that is used to take the
16715 address of an array.
16717 (ElementAccess): Implement array access for pointers
16719 * statement.cs (Fixed): Implement fixed statement for arrays, we
16720 are missing one more case before we are done.
16722 * expression.cs (Indirection): Implement EmitAssign and set the
16723 ExprClass to Variable. This allows pointer dereferences to be
16724 treated as variables, and to have values assigned to them.
16726 * ecore.cs (Expression.StoreFromPtr): New utility function to
16727 store values dereferencing.
16729 2002-02-20 Ravi Pratap <ravi@ximian.com>
16731 * expression.cs (Binary.ResolveOperator): Ensure that we are
16732 not trying to operate on a void type - this fixes the reported
16735 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16736 the parent implementation is sealed.
16738 * ../errors/cs0239.cs : Add.
16740 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16742 * typemanager.cs (unverifiable_code_type): Corresponds to
16743 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16744 which have unsafe code in them.
16746 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16749 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16751 * cs-tokenizer.cs: Add support for @"litreal strings"
16753 Make tokenizer accept pre-processor directives
16754 on any column (remove the old C-like limitation).
16756 * rootcontext.cs (EmitCode): Emit any global attributes.
16757 (AddGlobalAttributes): Used to keep track of assembly attributes.
16759 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16761 * cs-parser.jay: Add support for global attributes.
16763 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16765 * expression.cs (Indirection): New helper class. Unary will
16766 create Indirection classes to be able to implement the
16767 IMemoryLocation interface on it.
16769 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16771 * cs-parser.jay (fixed_statement): reference the right statement.
16773 * statement.cs (Fixed.Emit): Finish implementing the fixed
16774 statement for the &x case.
16776 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16778 * class.cs (Property.Define, Method.Define): Remove newslot when
16781 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16782 wrong. NewSlot should only be used if the `new' keyword is present.
16784 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16785 locating our system dir. Sorry about this.
16787 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16789 * driver.cs (GetSystemDir): Compute correctly the location of our
16790 system assemblies. I was using the compiler directory instead of
16791 the library directory.
16793 2002-02-13 Ravi Pratap <ravi@ximian.com>
16795 * expression.cs (BetterFunction): Put back in what Miguel commented out
16796 since it is the correct fix. The problem is elsewhere ;-)
16798 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16799 parameters of the parms method are themselves compatible or not !
16801 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16802 to check that a class implements an interface before saying that an implicit
16803 conversion was allowed. Use ImplementsInterface to do the checking.
16805 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16807 * class.cs (Method.Define): Track whether we are an explicit
16808 implementation or not. And only call DefineMethodOverride if we
16809 are an explicit implementation.
16811 (Property.DefineMethod): Ditto.
16813 2002-02-11 Ravi Pratap <ravi@ximian.com>
16815 * expression.cs (BetterFunction): Catch hideous bug which was
16816 preventing us from detecting ambiguous calls due to implicit casts i.e
16819 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16821 * support.cs (Pair): Remove un-needed method. I figured why I was
16822 getting the error in cs-parser.jay, the variable in a foreach loop
16823 is readonly, and the compiler does not really treat this as a variable.
16825 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16826 instead of EQUALS in grammar.
16828 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16830 * expression.cs (Unary.DoResolve): Check whether the argument is
16833 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16835 * support.cs: Api for Pair to set a value. Despite the fact that
16836 the variables are public the MS C# compiler refuses to compile
16837 code that accesses the field if the variable is part of a foreach
16840 * statement.cs (Fixed): Begin implementation of the fixed
16843 (Block.AddVariable): Return the VariableInfo on success and null
16844 on failure instead of true/false.
16846 * cs-parser.jay (foreach): Catch errors on variables already
16847 defined (we were ignoring this value before) and properly unwind
16848 the block hierarchy
16850 (fixed_statement): grammar for the fixed statement.
16852 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16854 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16855 pointer types to be incretemented.
16857 (SizeOf): Implement.
16859 * cs-parser.jay (pointer_member_access): Implement
16860 expr->IDENTIFIER production.
16862 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16863 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16866 (Unary): Implement indirection.
16868 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16869 use in non-unsafe context).
16871 (SimpleName.DoResolve): Check for pointers in field access on safe
16874 (Expression.LoadFromPtr): Factor the load-indirect code in this
16875 function. This was duplicated in UnboxCast and ParameterReference
16877 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16879 * expression.cs (ComposedCast): report an error if a pointer cast
16880 is used in a safe region.
16882 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16883 pointer type casts in unsafe context.
16885 * codegen.cs (EmitContext): Set up IsUnsafe.
16887 * cs-parser.jay (non_expression_type): Add productions for pointer
16890 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16891 code. We should not use force into static mode if the method is
16892 not virtual. Fixes bug in MIS
16894 * statement.cs (Do.Emit, While.Emit, For.Emit,
16895 Statement.EmitBoolExpression): Add support to Do and While to
16896 propagate infinite loop as `I do return' semantics.
16898 Improve the For case to also test for boolean constants.
16900 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16901 to the list of attributes we can add.
16903 Remove `EmitContext' argument.
16905 * class.cs (Method.Define): Apply parameter attributes.
16906 (Constructor.Define): Apply parameter attributes.
16907 (MethodCore.LabelParameters): Move here the core of labeling
16910 * support.cs (ReflectionParameters.ParameterModifier,
16911 InternalParameters.ParameterModifier): Use IsByRef on the type and
16912 only return the OUT bit for these parameters instead of in/out/ref
16915 This is because I miss-understood things. The ParameterInfo.IsIn
16916 and IsOut represent whether the parameter has the [In] and [Out]
16919 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16921 * ecore.cs (FieldExpr.Emit): Release temporaries.
16923 * assign.cs (LocalTemporary.Release): new function.
16925 * codegen.cs (EmitContext.GetTemporaryStorage,
16926 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16927 temporary storage. Now we can "put back" localbuilders when we
16930 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16932 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16933 need to make a copy of the variable to generate verifiable code.
16935 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16937 * driver.cs: Compute dynamically the system directory.
16939 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16940 Slower, but more generally useful. Used by the abstract
16941 registering implementation.
16943 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16944 the rules for the special rule on Type/instances. First check if
16945 we have the same name, and if so, try that special static path
16946 rather than the instance path.
16948 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16950 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16953 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16954 Enum, ValueType, Delegate or Array for non-corlib compiles.
16956 * cs-tokenizer.cs: Catch long identifiers (645)
16958 * typemanager.cs (IndexerPropetyName): Ravi never tested this
16961 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
16962 fix, we were returning too early, so we were not registering
16963 pending methods from abstract classes.
16965 Do not register pending methods if the class is abstract.
16967 * expression.cs (Conditional.DoResolve): Report circular implicit
16968 conversions when we neecd to compute it for conditional
16971 (Is.DoResolve): If the expression is always of the provided type,
16972 flag warning 183. If the expression can not ever be of the
16973 provided type flag warning 184.
16975 * class.cs: Catch 169 as well.
16977 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
16980 2002-01-18 Nick Drochak <ndrochak@gol.com>
16982 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
16984 2002-01-17 Miguel de Icaza <miguel@ximian.com>
16986 * interface.cs: (PopulateMethod): Check for pointers being defined
16987 only if the unsafe context is active.
16988 (PopulateProperty): ditto.
16989 (PopulateIndexer): ditto.
16991 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
16992 specified. If pointers are present, make sure that they are
16993 present in an unsafe context.
16994 (Constructor, Constructor.Define): ditto.
16995 (Field, Field.Define): ditto.
16996 (Property, Property.Define): ditto.
16997 (Event, Event.Define): ditto.
16999 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
17000 hashtable if there are classes or structs defined.
17002 * expression.cs (LocalVariableReference.DoResolve): Simplify this
17003 code, as the constant resolution moved.
17005 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
17006 the metadata, so we can flag error 133.
17008 * decl.cs (MemberCore.UnsafeOK): New function to test that a
17009 pointer is being declared in an unsafe context.
17011 2002-01-16 Miguel de Icaza <miguel@ximian.com>
17013 * modifiers.cs (Modifiers.Check): Require a Location argument.
17014 Report error 227 for Unsafe use.
17016 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
17018 * statement.cs (For.Emit): If the test is null, then report that
17019 we do `return', as we wont reach anything afterwards.
17021 (Switch.SwitchGoverningType): Track the expression that matched
17024 * driver.cs: Allow negative numbers as an error code to flag.
17026 * cs-parser.jay: Handle 1551.
17028 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
17030 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17032 * cs-parser.jay: Report 1518 (type declaration can only contain
17033 class, struct, interface, enum or delegate)
17035 (switch_label): Report 1523 (keywords `case' or `default' must
17038 (opt_switch_sections): Report 1522 (empty switch)
17040 * driver.cs: Report 1515 (response file specified multiple times)
17041 Report 1516 (Source file specified multiple times).
17043 * expression.cs (Argument.Resolve): Signal 1510
17045 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
17046 access not allowed in static code)
17048 2002-01-11 Ravi Pratap <ravi@ximian.com>
17050 * typemanager.cs (IsPointerType): Utility method which we are going
17053 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
17054 the object type, so we take care of that.
17056 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
17058 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
17059 added to non-params parameters :-)
17061 * typemanager.cs (CSharpName): Include 'void' type too.
17063 (void_ptr_type): Include in the set of core types.
17065 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
17068 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17071 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17072 completely forgotten about it.
17074 2002-01-10 Ravi Pratap <ravi@ximian.com>
17076 * cs-parser.jay (pointer_type): Add. This begins our implementation
17077 of parsing rules for unsafe code.
17079 (unsafe_statement): Implement.
17081 (embedded_statement): Modify to include the above.
17083 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17085 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17086 if the current context is an unsafe one.
17088 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17089 are handled differently, we need separate rules for them.
17091 (local_variable_declaration): Update to use local_variable_pointer_type
17092 to allow variable declarations of unmanaged pointer types.
17094 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17095 in unsafe contexts.
17097 * ../errors/cs0214.cs : Add.
17099 2002-01-16 Nick Drochak <ndrochak@gol.com>
17101 * makefile: remove 'response' file when cleaning.
17103 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17105 * cs-parser.jay: Report 1524.
17107 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17109 * typemanager.cs (RegisterMethod): drop checking if we have
17110 registered this from here
17112 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17114 * class.cs (Method.EmitDestructor): Implement calling our base
17117 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17118 value of InFinally.
17120 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17121 this routine and will wrap the call in a try/catch block. Deal
17124 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17126 * ecore.cs (Expression.MemberLookup): instead of taking a
17127 parameter `same_type' that was used to tell whether we could
17128 access private members we compute our containing type from the
17131 (FieldExpr): Added partial support for volatile fields. This does
17132 not work for volatile fields exposed from assemblies, as I can not
17133 figure out how to extract the modreq from it.
17135 Updated all the source files to use this.
17137 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17138 because it is referenced by MemberLookup very often.
17140 2002-01-09 Ravi Pratap <ravi@ximian.com>
17142 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17143 TypeBuilder.GetCustomAttributes to retrieve what we need.
17145 Get rid of redundant default_member_attr_type as this is the same as
17146 default_member_type which already exists.
17148 * interface.cs, attribute.cs : Update accordingly.
17150 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17152 * typemanager.cs: Enable IndexerPropertyName again. It does not
17153 work for TYpeBuilders though. Ravi, can you please fix this?
17155 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17157 * expression.cs (Argument.Emit): Handle the case of ref objects
17158 being passed to ref functions;
17160 (ParameterReference.EmitLoad): Loads the content of the pointer
17161 without dereferencing.
17163 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17165 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17167 2002-01-08 Ravi Pratap <ravi@ximian.com>
17169 * class.cs (Indexer.DefineMethod): Incorporate the interface
17170 type in the name of the method if we are doing explicit interface
17173 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17175 (BetterConversion): Fix extremely trivial bug where we were referring to
17176 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17179 * ../errors/bug16.cs : Add although we have fixed it.
17181 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17183 * expression.cs (BaseIndexer): Begin implementation.
17185 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17187 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17188 production directly to remove a shift/reduce, and implement
17189 explicit interface implementation.
17191 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17192 after a floating point suffix.
17194 * expression.cs (DoNumericPromotions): Improved the conversion for
17195 uint/uint. If we have a constant, we avoid doing a typecast to a
17198 * class.cs (Indexer): Implement explicit interface implementation
17201 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17203 * class.cs: make the default instance constructor public and hidebysig.
17205 2001-01-03 Ravi Pratap <ravi@ximian.com>
17207 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17208 so we can call it from elsewhere.
17210 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17211 we emit it internally if the class has a defined indexer; otherwise the user
17212 emits it by decorating the class definition with the DefaultMemberAttribute.
17214 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17215 attribute is not used on a type which defines an indexer.
17217 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17218 character when we skip whitespace.
17220 * ../errors/cs0646.cs : Add.
17222 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17224 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17227 * makefile: Add practical target `mcs3.exe' which builds the third
17228 generation compiler.
17230 * expression.cs (New): Fix structures constructor calling.
17232 * class.cs (Property, Method, Indexer): Emit Final flag on the
17233 method if we are an interface implementation and we are not
17236 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17237 whether this property is referencing a `base' method.
17239 * expression.cs (Invocation.EmitCall): take an extra argument:
17240 is_base, this is used to determine whether the `call' or
17241 `callvirt' opcode should be used.
17244 * delegate.cs: update EmitCall.
17246 * class.cs (Method.Define): Set NewSlot for the cases where we are
17247 not implementing an interface method.
17249 (Property.Define): ditto.
17251 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17253 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17254 'r'. Allows mcs to parse itself fully.
17256 2002-01-02 Ravi Pratap <ravi@ximian.com>
17258 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17259 of the number of initializers that require the InitializeArray method.
17261 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17262 update the above field where necessary.
17264 (MakeByteBlob): Update accordingly.
17266 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17269 (EmitDynamicInitializers): Update in accordance with the new optimization.
17271 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17272 same OpCode applies.
17274 * cs-parser.jay : Fix some glaring errors I introduced.
17276 2002-01-01 Ravi Pratap <ravi@ximian.com>
17278 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17279 so that we can check for name clashes there too.
17281 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17282 for interface indexers.
17284 * interfaces.cs (Define): Emit the default member attribute.
17286 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17287 variable was being referred to while setting the value ;-)
17289 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17291 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17292 byte-by-byte information when we know the data is zero.
17294 Make the block always a multiple of 4, because
17295 DefineInitializedData has a bug.
17297 * assign.cs: Fix, we should assign from the temporary, not from
17300 * expression.cs (MakeByteBlob): Fix my incorrect code.
17302 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17304 * typemanager.cs (EnumToUnderlying): This function is used to get
17305 the underlying type from an enumeration, because it does not
17308 * constant.cs: Use the I4_S form for values between -128 and 127.
17310 * statement.cs (Block.LookupLabel): Looks up a label.
17311 (Block): Drop support for labeled blocks.
17313 (LabeledStatement): New kind of statement that represents a label
17316 (Goto): Finally implement this bad boy.
17318 * cs-parser.jay: Update to reflect new mechanism to implement
17321 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17323 * codegen.cs (EmitContext.This): a codegen property that keeps the
17324 a single instance of this instead of creating many different this
17327 * delegate.cs (Delegate.DoResolve): Update to use the property;
17329 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17331 * expression.cs (BaseAccess.DoResolve): Ditto.
17333 2001-12-29 Ravi Pratap <ravi@ximian.com>
17335 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17336 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17338 (InitCoreTypes): Update accordingly.
17340 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17341 so we can quickly store the state.
17343 (ApplyAttributes): Set the correct implementation flags
17344 for InternalCall methods.
17346 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17348 * expression.cs (EmitCall): if a method is not virtual, then do
17349 not use callvirt on it.
17351 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17352 user defined stuff) requires the use of stobj, which takes an
17353 address on the stack instead of an array and an index. So emit
17354 the Ldelema operation for it.
17356 (EmitStoreOpcode): Use stobj for valuetypes.
17358 (UnaryMutator.EmitCode): Use the right 1 value depending on
17359 whether we are dealing with int64/uint64, float or doubles.
17361 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17362 constructors that I implemented last night.
17364 (Constructor.IsDefault): Fix to work properly for static
17367 * cs-parser.jay (CheckDef): report method signature errors.
17368 Update error number 103 to be 132.
17370 * decl.cs: New AdditionResult enumeration value: MethodExists.
17371 Although we do this check for methods later on in the semantic
17372 analysis, catching repeated default constructors is so easy that
17373 we catch these here.
17375 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17378 (ParameterReference.EmitAssign, Emit): handle
17381 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17382 (ArrayAccess.EmitStoreOpcode): ditto.
17384 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17386 * expression.cs (MakeByteBlob): Complete all the missing types
17387 (uint, short, ushort, byte, sbyte)
17389 * class.cs: Only init instance field initializers on instance
17392 Rename `constructors' to instance_constructors.
17394 (TypeContainer.AddConstructor): Only add constructors to the list
17395 if it is not static.
17397 Make sure that we handle default_static_constructor independently
17398 everywhere where we handle instance_constructors
17400 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17402 * class.cs: Do not lookup or create a base initializer for a
17403 static constructor.
17405 (ConstructorInitializer.Resolve): use the proper type to lookup
17408 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17410 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17413 * decl.cs: CloseType is now an virtual method, the default
17414 implementation just closes this type.
17416 2001-12-28 Ravi Pratap <ravi@ximian.com>
17418 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17419 to PreserveSig by default. Also emit HideBySig on such methods.
17421 Basically, set the defaults to standard values.
17423 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17424 argument, if candidate is better, it can't be worse than the best !
17426 (Invocation): Re-write bits to differentiate between methods being
17427 applicable in their expanded form and their normal form - for params
17430 Get rid of use_standard everywhere as only standard conversions are allowed
17431 in overload resolution.
17433 More spec conformance.
17435 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17437 * driver.cs: Add --timestamp, to see where the compiler spends
17440 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17441 `this' in static code.
17443 (SimpleName.DoResolve): Implement in terms of a helper function
17444 that allows static-references to be passed upstream to
17447 (Expression.ResolveWithSimpleName): Resolve specially simple
17448 names when called by MemberAccess to implement the special
17451 (Expression.ImplicitReferenceConversion): Handle conversions from
17452 Null to reference types before others, as Null's type is
17455 * expression.cs (Invocation.EmitCall): Handle the special case of
17456 calling methods declared on a reference type from a ValueType
17457 (Base classes System.Object and System.Enum)
17459 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17460 the left hand side is a TypeExpr, not on every enumeration.
17462 (Binary.Resolve): If types are reference types, then do a cast to
17463 object on operators != and == of both arguments.
17465 * typemanager.cs (FindMembers): Extract instance and static
17466 members if requested.
17468 * interface.cs (PopulateProperty): Use void_type instead of null
17469 as the return type for the setter method.
17471 (PopulateIndexer): ditto.
17473 2001-12-27 Ravi Pratap <ravi@ximian.com>
17475 * support.cs (ReflectionParameters): Fix minor bug where we
17476 were examining the wrong parameter for the ParamArray attribute.
17478 Cope with requests for the type of the parameter at position
17479 greater than the params parameter's. We now return the element
17480 type of the params array as that makes more sense.
17482 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17483 accordingly as we no longer have to extract the element type
17486 (Invocation.OverloadResolve): Update.
17488 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17490 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17491 against IEnumerator, test whether the return value is a descendant
17492 of the IEnumerator interface.
17494 * class.cs (Indexer.Define): Use an auxiliary method to implement
17495 the other bits of the method definition. Begin support for
17496 explicit interface implementation.
17498 (Property.DefineMethod): Use TypeManager.void_type instead of null
17499 for an empty return value.
17501 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17503 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17504 dealing with a FieldExpr which is composed of a FieldBuilder, in
17505 the code path we did extract the constant, but we should have
17506 obtained the underlying value to be able to cast it (otherwise we
17507 end up in an infinite loop, this is what Ravi was running into).
17509 (ArrayCreation.UpdateIndices): Arrays might be empty.
17511 (MemberAccess.ResolveMemberAccess): Add support for section
17512 14.5.4.1 that deals with the special case of E.I when E is a type
17513 and something else, that I can be a reference to a static member.
17515 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17516 handle a particular array type to create byte blobs, it is just
17517 something we dont generate byteblobs for.
17519 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17522 * location.cs (Push): remove the key from the hashtable that we
17523 are about to add. This happens for empty files.
17525 * driver.cs: Dispose files after we have parsed them.
17527 (tokenize): new function that only runs the tokenizer on its
17528 input, for speed testing.
17530 2001-12-26 Ravi Pratap <ravi@ximian.com>
17532 * class.cs (Event.Define): Define the private field only if there
17533 are no accessors defined.
17535 * expression.cs (ResolveMemberAccess): If there is no associated
17536 field with the event, that means we have an event defined with its
17537 own accessors and we should flag error cs0070 since transforming
17538 ourselves into a field is not valid in that case.
17540 * ecore.cs (SimpleName.DoResolve): Same as above.
17542 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17543 and charset to sane values.
17545 2001-12-25 Ravi Pratap <ravi@ximian.com>
17547 * assign.cs (DoResolve): Perform check on events only if they
17548 are being accessed outside the declaring type.
17550 * cs-parser.jay (event_declarations): Update rules to correctly
17551 set the type of the implicit parameter etc.
17553 (add_accessor, remove_accessor): Set current local parameters.
17555 * expression.cs (Binary): For delegate addition and subtraction,
17556 cast the return value from the method into the appropriate delegate
17559 2001-12-24 Ravi Pratap <ravi@ximian.com>
17561 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17562 of these as the workaround is unnecessary.
17564 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17565 delegate data - none of that is needed at all.
17567 Re-write bits to extract the instance expression and the delegate method
17570 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17573 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17574 of attaching attributes instead of duplicating code everywhere.
17576 * everywhere : Update code to do attribute emission using the above method.
17578 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17580 * expression.cs (IsParamsMethodApplicable): if there are not
17581 parameters, return immediately.
17583 * ecore.cs: The 0 literal can be implicity converted to an enum
17586 (SimpleName.DoResolve): First lookup the type, then lookup the
17589 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17590 want to get its address. If the InstanceExpression is not
17591 addressable, store the result in a temporary variable, then get
17594 * codegen.cs: Only display 219 errors on warning level or above.
17596 * expression.cs (ArrayAccess): Make it implement the
17597 IMemoryLocation interface.
17599 (Binary.DoResolve): handle the operator == (object a, object b)
17600 and operator != (object a, object b) without incurring into a
17601 BoxedCast (because 5 != o should never be performed).
17603 Handle binary enumerator operators.
17605 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17606 value type, otherwise use Ldelem_ref.
17608 Use precomputed names;
17610 (AddressOf): Implement address of
17612 * cs-parser.jay (labeled_statement): Fix recursive block
17613 addition by reworking the production.
17615 * expression.cs (New.DoEmit): New has a special case:
17617 If we are dealing with a ValueType, we have a few
17618 situations to deal with:
17620 * The target of New is a ValueType variable, that is
17621 easy, we just pass this as the variable reference
17623 * The target of New is being passed as an argument,
17624 to a boxing operation or a function that takes a
17627 In this case, we need to create a temporary variable
17628 that is the argument of New.
17631 2001-12-23 Ravi Pratap <ravi@ximian.com>
17633 * rootcontext.cs (LookupType): Check that current_type is not null before
17634 going about looking at nested types.
17636 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17637 not implement the IAssignMethod interface any more.
17639 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17640 where we tranform them into FieldExprs if they are being resolved from within
17641 the declaring type.
17643 * ecore.cs (SimpleName.DoResolve): Do the same here.
17645 * assign.cs (DoResolve, Emit): Clean up code considerably.
17647 * ../errors/bug10.cs : Add.
17649 * ../errors/cs0070.cs : Add.
17651 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17653 * assign.cs : Get rid of EventIsLocal everywhere.
17655 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17657 * ecore.cs (ConvertIntLiteral): finished the implementation.
17659 * statement.cs (SwitchLabel): Convert the value we are using as a
17660 key before looking up the table.
17662 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17664 * codegen.cs (EmitTopBlock): Require a Location argument now.
17666 * cs-parser.jay (constructor_declarator): We need to setup
17667 current_local_parameters before we parse the
17668 opt_constructor_initializer, to allow the variables to be bound
17669 to the constructor arguments.
17671 * rootcontext.cs (LookupType): First lookup nested classes in our
17672 class and our parents before we go looking outside our class.
17674 * expression.cs (ConstantFold): Extract/debox the values at the
17677 * rootcontext.cs (EmitCode): Resolve the constants first before we
17678 resolve the types. This is not really needed, but it helps debugging.
17680 * statement.cs: report location.
17682 * cs-parser.jay: pass location to throw statement.
17684 * driver.cs: Small bug fix.
17686 * report.cs: Updated format to be 4-zero filled digits.
17688 2001-12-22 Ravi Pratap <ravi@ximian.com>
17690 * expression.cs (CheckIndices): Fix minor bug where the wrong
17691 variable was being referred to ;-)
17693 (DoEmit): Do not call EmitStaticInitializers when the
17694 underlying type is System.Object.
17696 2001-12-21 Ravi Pratap <ravi@ximian.com>
17698 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17699 and do the usual workaround for SRE.
17701 * class.cs (MyEventBuilder.EventType): New member to get at the type
17702 of the event, quickly.
17704 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17706 * assign.cs (Assign.DoResolve): Handle the case when the target
17707 is an EventExpr and perform the necessary checks.
17709 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17712 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17714 (EventExpr): Set the type in the constructor itself since we
17715 are meant to be born fully resolved.
17717 (EventExpr.Define): Revert code I wrote earlier.
17719 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17720 instance expression is null. The instance expression is a This in that case
17721 or a null, depending on whether it is a static method or not.
17723 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17724 refers to more than one method.
17726 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17727 and accordingly flag errors.
17729 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17731 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17733 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17735 * location.cs (ToString): Provide useful rutine.
17737 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17739 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17740 objects, return the actual integral boxed.
17742 * statement.cs (SwitchLabel): define an ILLabel for each
17745 (Switch.CheckSwitch): If the value is a Literal, extract
17746 the underlying literal.
17748 Also in the unused hashtable we had, add the SwitchLabel so we can
17749 quickly look this value up.
17751 * constant.cs: Implement a bunch of new constants. Rewrite
17752 Literal based on this. Made changes everywhere to adapt to this.
17754 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17755 dereferencing array only once, and also copes with enumrations.
17757 bytes are two bytes wide, not one.
17759 (Cast): Perform constant conversions.
17761 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17762 wrappers to the literals here.
17764 * expression.cs (DoNumericPromotions): long literals can converted
17765 to ulong implicity (this is taken care of elsewhere, but I was
17766 missing this spot).
17768 * ecore.cs (Expression.Literalize): Make the return type Literal,
17769 to improve type checking.
17771 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17773 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17775 * literal.cs: Revert code from ravi that checked the bounds. The
17776 bounds are sane by the definition of the type itself.
17778 * typemanager.cs: Fix implementation of ImplementsInterface. We
17779 need to actually look up in our parent hierarchy for interfaces
17782 * const.cs: Use the underlying type for enumerations
17784 * delegate.cs: Compute the basename for the delegate creation,
17785 that should fix the delegate test case, and restore the correct
17786 Type Lookup semantics in rootcontext
17788 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17789 referencing a nested type with the Reflection API is using the "+"
17792 * cs-parser.jay: Do not require EOF token at the end.
17794 2001-12-20 Ravi Pratap <ravi@ximian.com>
17796 * rootcontext.cs (LookupType): Concatenate type names with
17797 a '.' instead of a '+' The test suite passes again.
17799 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17800 field of the enumeration.
17802 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17803 the case when the member is an EventExpr.
17805 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17806 static has an associated instance expression.
17808 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17810 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17812 * class.cs (Event.Define): Register event and perform appropriate checks
17815 We define the Add and Remove methods even if the use provides none because
17816 in that case, we provide default implementations ourselves.
17818 Define a private field of the type of the event. This is done by the CSC compiler
17819 and we should be doing it too ;-)
17821 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17822 More methods we use in code we generate.
17824 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17827 (InitCoreTypes): Update accordingly for the above.
17829 * class.cs (Event.Emit): Generate code for default accessors that we provide
17831 (EmitDefaultMethod): Do the job in the above.
17833 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17836 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17838 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17839 builders even if we were missing one.
17841 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17842 pass the Basename as our class name instead of the Name. The
17843 basename will be correctly composed for us.
17845 * parameter.cs (Paramters): Now takes a Location argument.
17847 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17848 make all the code call directly LookupType in RootContext and take
17849 this chance to pass the Location information everywhere.
17851 * Everywhere: pass Location information.
17853 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17855 * class.cs (Constructor.Define): Updated way of detecting the
17856 length of the parameters.
17858 (TypeContainer.DefineType): Use basename as the type name for
17861 (TypeContainer.Define): Do not recursively define types here, as
17862 definition is taken care in order by the RootContext.
17864 * tree.cs: Keep track of namespaces in a per-file basis.
17866 * parameter.cs (Parameter.ComputeSignature): Update to use
17869 (Parameters.GetSignature): ditto.
17871 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17872 instead of a TypeContainer.
17874 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17875 resolve names. Because we need to be resolve in our context, not
17878 * driver.cs: Implement response files.
17880 * class.cs (TypeContainer.DefineType): If we are defined, do not
17881 redefine ourselves.
17883 (Event.Emit): Emit the code for add/remove handlers.
17884 (Event.Define): Save the MethodBuilders for add/remove.
17886 * typemanager.cs: Use pair here too.
17888 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17889 DictionaryEntry requires the first argument to be non-null.
17891 (enum_declaration): Compute full name for registering the
17894 (delegate_declaration): Instead of using
17895 formal_parameter_list, use opt_formal_parameter_list as the list
17898 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17899 (EventParsing): New property that controls whether `add' and
17900 `remove' are returned as tokens or identifiers (for events);
17902 2001-12-19 Ravi Pratap <ravi@ximian.com>
17904 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17905 use MyEventBuilder only and let it wrap the real builder for us.
17907 (MyEventBuilder): Revamp constructor etc.
17909 Implement all operations that we perform on EventBuilder in precisely the same
17912 (FindMembers): Update to use the EventBuilder member.
17914 (Event.Emit): Update accordingly.
17916 2001-12-18 Ravi Pratap <ravi@ximian.com>
17918 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17919 by calling the appropriate methods.
17921 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17924 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17926 2001-12-17 Ravi Pratap <ravi@ximian.com>
17928 * delegate.cs (Delegate.Populate): Check that the return type
17929 and various parameters types are indeed accessible.
17931 * class.cs (Constructor.Define): Same here.
17933 (Field.Define): Ditto.
17935 (Event.Define): Ditto.
17937 (Operator.Define): Check that the underlying Method defined itself
17938 correctly - so it's MethodBuilder should not be null.
17940 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17941 expression happens to be null.
17943 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17944 members but as of now we don't seem to be able to do anything really useful with it.
17946 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17947 not the EventBuilder.
17949 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17951 * cs-tokenizer.cs: Add support for defines.
17952 Add support for #if, #elif, #else, #endif
17954 (eval_var): evaluates a variable.
17955 (eval): stubbed for evaluating functions.
17957 * cs-parser.jay: Pass the defines information
17959 * driver.cs: Add --define command line option.
17961 * decl.cs: Move MemberCore here.
17963 Make it the base class for DeclSpace. This allows us to catch and
17964 report 108 and 109 for everything now.
17966 * class.cs (TypeContainer.Define): Extract all the members
17967 before populating and emit the warning 108 (new keyword required
17968 to override) instead of having each member implement this.
17970 (MemberCore.Define): New abstract method, we will be using this in
17971 the warning reporting engine in Populate.
17973 (Operator.Define): Adjust to new MemberCore protocol.
17975 * const.cs (Const): This does not derive from Expression, it is a
17976 temporary object we use to create fields, it is a MemberCore.
17978 * class.cs (Method.Define): Allow the entry point to be in a
17981 * driver.cs: Rewrite the argument handler to clean it up a bit.
17983 * rootcontext.cs: Made it just an auxiliary namespace feature by
17984 making everything static.
17986 * driver.cs: Adapt code to use RootContext type name instead of
17989 * delegate.cs: Remove RootContext argument.
17991 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
17994 * class.cs (Event.Define): The lookup can fail.
17996 * cs-tokenizer.cs: Begin implementation of pre-procesor.
17998 * expression.cs: Resolve the this instance before invoking the code.
18000 2001-12-17 Miguel de Icaza <miguel@ximian.com>
18002 * cs-parser.jay: Add a production in element_access that allows
18003 the thing to become a "type" reference. This way we can parse
18004 things like "(string [])" as a type.
18006 Note that this still does not handle the more complex rules of
18010 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
18012 * ecore.cs: (CopyNewMethods): new utility function used to
18013 assemble the list of methods from running FindMembers.
18015 (MemberLookup): Rework FindMembers so that
18017 2001-12-16 Miguel de Icaza <miguel@ximian.com>
18019 * class.cs (TypeContainer): Remove Delegates who fail to be
18022 * delegate.cs (Populate): Verify that we dont get null return
18023 values. TODO: Check for AsAccessible.
18025 * cs-parser.jay: Use basename to emit error 574 (destructor should
18026 have the same name as container class), not the full name.
18028 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
18029 possible representation.
18031 Also implements integer type suffixes U and L.
18033 2001-12-15 Miguel de Icaza <miguel@ximian.com>
18035 * expression.cs (ArrayCreation.DoResolve): We need to do the
18036 argument resolution *always*.
18038 * decl.cs: Make this hold the namespace. Hold the root context as
18040 (LookupType): Move here.
18042 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
18044 * location.cs (Row, Name): Fixed the code, it was always returning
18045 references to the first file.
18047 * interface.cs: Register properties defined through interfaces.
18049 * driver.cs: Add support for globbing on the command line
18051 * class.cs (Field): Make it derive from MemberCore as well.
18054 2001-12-15 Ravi Pratap <ravi@ximian.com>
18056 * class.cs (Event::Define): Check that the type of the event is a delegate
18057 type else flag error #66.
18059 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
18062 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
18063 values of EntryPoint, CharSet etc etc.
18065 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
18067 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
18068 be null and we should ignore this. I am not sure if this is really clean. Apparently,
18069 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18070 which needs this to do its work.
18072 * ../errors/cs0066.cs : Add.
18074 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18076 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18079 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18080 clears out the parameters field.
18081 (MemberSignatureCompare): Cleanup
18083 (MemberCore): New base class used to share code between MethodCore
18086 (RegisterRequiredImplementations) BindingFlags.Public requires
18087 either BindingFlags.Instace or Static. Use instance here.
18089 (Property): Refactored code to cope better with the full spec.
18091 * parameter.cs (GetParameterInfo): Return an empty array instead
18094 * class.cs (Property): Abstract or extern properties have no bodies.
18096 * parameter.cs (GetParameterInfo): return a zero-sized array.
18098 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18099 method modifier validation to the typecontainer so we can reuse
18100 this on properties.
18102 (MethodCore.ParameterTypes): return an empty sized array of types.
18104 (Property.Define): Test property modifier validity.
18106 Add tests for sealed/override too.
18108 (Method.Emit): abstract or extern methods have no bodies.
18110 2001-12-14 Ravi Pratap <ravi@ximian.com>
18112 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18115 (Method::Define, ::Emit): Modify accordingly.
18117 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18119 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18121 * makefile: Pass in /unsafe.
18123 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18125 * class.cs (MakeKey): Kill routine.
18127 * class.cs (TypeContainer.Define): Correctly define explicit
18128 method implementations (they require the full interface name plus
18131 * typemanager.cs: Deply the PtrHashtable here and stop using the
18132 lame keys. Things work so much better.
18134 This of course broke everyone who depended on `RegisterMethod' to
18135 do the `test for existance' test. This has to be done elsewhere.
18137 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18138 the object stupid Equals method (because, that like fails all over
18139 the place). We still do not use it.
18141 * class.cs (TypeContainer.SetRequiredInterface,
18142 TypeContainer.RequireMethods): Killed these two routines and moved
18143 all the functionality to RegisterRequiredImplementations.
18145 (TypeContainer.RegisterRequiredImplementations): This routine now
18146 registers all the implementations required in an array for the
18147 interfaces and abstract methods. We use an array of structures
18148 which can be computed ahead of time to reduce memory usage and we
18149 also assume that lookups are cheap as most classes will not
18150 implement too many interfaces.
18152 We also avoid creating too many MethodSignatures.
18154 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18155 clear the "pending" bit if we find that there are problems with
18158 (TypeContainer.VerifyPendingMethods): Update to report errors of
18159 methods that look like implementations but are not.
18161 (TypeContainer.Define): Add support for explicit interface method
18164 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18166 * typemanager.cs: Keep track of the parameters here instead of
18167 being a feature of the TypeContainer.
18169 * class.cs: Drop the registration of parameters here, as
18170 InterfaceMethods are also interface declarations.
18172 * delegate.cs: Register methods with the TypeManager not only with
18173 the TypeContainer. This code was buggy.
18175 * interface.cs: Full registation here.
18177 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18179 * expression.cs: Remove reducer for binary expressions, it can not
18182 * const.cs: Put here the code that used to go into constant.cs
18184 * constant.cs: Put here the code for constants, this is a new base
18185 class for Literals.
18187 * literal.cs: Make Literal derive from Constant.
18189 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18191 * statement.cs (Return.Emit): Report error 157 if the user
18192 attempts to return from a finally block.
18194 (Return.Emit): Instead of emitting a return, jump to the end of
18197 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18198 LocalBuilder to store the result of the function. ReturnLabel is
18199 the target where we jump.
18202 2001-12-09 Radek Doulik <rodo@ximian.com>
18204 * cs-parser.jay: remember alias in current namespace
18206 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18209 * class.cs (LookupAlias): lookup alias in my_namespace
18211 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18213 (LookupAlias): lookup alias in this and if needed in parent
18216 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18220 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18221 making things static. I need this to avoid passing the
18222 TypeContainer when calling ParameterType.
18224 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18225 that did string manipulation to compute the type and then call
18226 GetType. Use Parameter.ParameterType instead.
18228 * cs-tokenizer.cs: Consume the suffix for floating values.
18230 * expression.cs (ParameterReference): figure out whether this is a
18231 reference parameter or not. Kill an extra variable by computing
18232 the arg_idx during emission.
18234 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18235 function that returns whether a parameter is an out/ref value or not.
18237 (Parameter.ParameterType): The type of the parameter (base,
18238 without ref/out applied).
18240 (Parameter.Resolve): Perform resolution here.
18241 (Parameter.ExternalType): The full type (with ref/out applied).
18243 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18244 support for expressions on the using statement.
18246 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18248 * statement.cs (Using.EmitLocalVariableDecls): Split the
18249 localvariable handling of the using statement.
18251 (Block.EmitMeta): Keep track of variable count across blocks. We
18252 were reusing slots on separate branches of blocks.
18254 (Try.Emit): Emit the general code block, we were not emitting it.
18256 Check the type of the declaration to be an IDisposable or
18257 something that can be implicity converted to it.
18259 Emit conversions if required.
18261 * ecore.cs (EmptyExpression): New utility class.
18262 (Expression.ImplicitConversionExists): New utility function.
18264 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18266 * statement.cs (Using): Implement.
18268 * expression.cs (LocalVariableReference): Support read only variables.
18270 * statement.cs: Remove the explicit emit for the Leave opcode.
18271 (VariableInfo): Add a readonly field.
18273 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18275 * ecore.cs (ConvCast): new class used to encapsulate the various
18276 explicit integer conversions that works in both checked and
18277 unchecked contexts.
18279 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18280 properly generate the overflow opcodes.
18282 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18284 * statement.cs: The correct type for the EmptyExpression is the
18285 element_type, not the variable type. Ravi pointed this out.
18287 2001-12-04 Ravi Pratap <ravi@ximian.com>
18289 * class.cs (Method::Define): Handle PInvoke methods specially
18290 by using DefinePInvokeMethod instead of the usual one.
18292 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18293 above to do the task of extracting information and defining the method.
18295 2001-12-04 Ravi Pratap <ravi@ximian.com>
18297 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18298 of the condition for string type.
18300 (Emit): Move that here.
18302 (ArrayCreation::CheckIndices): Keep string literals in their expression
18305 (EmitDynamicInitializers): Handle strings appropriately.
18307 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18309 * codegen.cs (EmitContext): Replace multiple variables with a
18310 single pointer to the current Switch statement.
18312 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18315 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18319 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18322 (Foreach.Emit): Foreach on arrays was not setting
18323 up the loop variables (for break/continue).
18325 (GotoCase): Semi-implented.
18327 2001-12-03 Ravi Pratap <ravi@ximian.com>
18329 * attribute.cs (CheckAttribute): Handle system attributes by using
18330 Attribute.GetAttributes to examine information we need.
18332 (GetValidPlaces): Same here.
18334 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18336 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18338 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18340 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18342 (Method::Emit): Handle the case when we are a PInvoke method.
18344 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18346 * expression.cs: Use ResolveWithSimpleName on compound names.
18348 2001-12-02 Ravi Pratap <ravi@ximian.com>
18350 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18351 before trying to reduce it.
18353 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18355 * constant.cs (LookupConstantValue): Implement.
18357 (EmitConstant): Use the above in emitting the constant.
18359 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18360 that are user-defined by doing a LookupConstantValue on them.
18362 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18365 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18367 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18369 (BaseAccess.DoResolve): Implement.
18371 (MemberAccess.DoResolve): Split this routine into a
18372 ResolveMemberAccess routine that can be used independently
18374 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18376 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18377 As that share bits of the implementation. Is returns a boolean,
18378 while As returns the Type that is being probed.
18380 2001-12-01 Ravi Pratap <ravi@ximian.com>
18382 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18383 instead of a Literal - much easier.
18385 (EnumInTransit): Remove - utterly useless :-)
18387 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18389 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18391 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18392 chain when we have no associated expression.
18394 2001-11-30 Ravi Pratap <ravi@ximian.com>
18396 * constant.cs (Define): Use Location while reporting the errror.
18398 Also emit a warning when 'new' is used and there is no inherited
18401 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18404 (LookupEnumValue): Implement to lookup an enum member's value and define it
18407 (Populate): Re-write accordingly to use the above routine.
18409 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18411 * expression.cs (This): Fix prototype for DoResolveLValue to
18412 override the base class DoResolveLValue.
18414 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18417 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18418 (we need to load the address of the field here). This fixes
18421 (FieldExpr.DoResolveLValue): Call the DoResolve
18422 function to initialize the Instance expression.
18424 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18425 correctly the GetEnumerator operation on a value type.
18427 * cs-parser.jay: Add more simple parsing error catches.
18429 * statement.cs (Switch): Add support for string switches.
18430 Handle null specially.
18432 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18434 2001-11-28 Ravi Pratap <ravi@ximian.com>
18436 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18438 (declare_local_constant): New helper function.
18440 * statement.cs (AddConstant): Keep a separate record of constants
18442 (IsConstant): Implement to determine if a variable is a constant.
18444 (GetConstantExpression): Implement.
18446 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18448 * statement.cs (IsVariableDefined): Re-write.
18450 2001-11-27 Ravi Pratap <ravi@ximian.com>
18452 * class.cs (TypeContainer::FindMembers): Look for constants
18453 in the case when we are looking for MemberTypes.Field
18455 * expression.cs (MemberAccess::DoResolve): Check that in the
18456 case we are a FieldExpr and a Literal, we are not being accessed
18457 by an instance reference.
18459 * cs-parser.jay (local_constant_declaration): Implement.
18461 (declaration_statement): Implement for constant declarations.
18463 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18465 * statement.cs (Switch): Catch double defaults.
18467 (Switch): More work on the switch() statement
18468 implementation. It works for integral values now, need to finish
18472 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18474 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18475 integer literals into other integer literals. To be used by
18478 2001-11-24 Ravi Pratap <ravi@ximian.com>
18480 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18483 (EmitDynamicInitializers): Cope with the above since we extract data
18484 directly from ArrayData now.
18486 (ExpectInitializers): Keep track of whether initializers are mandatory
18489 (Bounds): Make it a hashtable to prevent the same dimension being
18490 recorded for every element in that dimension.
18492 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18495 Also fix bug which was causing the indices to be emitted in the reverse
18498 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18500 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18501 unfinished. They do not work, because the underlying code is
18504 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18506 * cs-parser.jay: Remove bogus fixme.
18508 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18509 on Switch statement.
18511 2001-11-23 Ravi Pratap <ravi@ximian.com>
18513 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18516 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18517 parameter. Apparently, any expression is allowed.
18519 (ValidateInitializers): Update accordingly.
18521 (CheckIndices): Fix some tricky bugs thanks to recursion.
18523 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18524 I was being completely brain-dead.
18526 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18527 and re-write acordingly.
18529 (DelegateInvocation): Re-write accordingly.
18531 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18533 (MakeByteBlob): Handle types more correctly.
18535 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18536 initialization from expressions but it is incomplete because I am a complete
18539 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18541 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18542 on If. Basically, we have to return `true' (ie, we do return to
18543 our caller) only if both branches of the if return.
18545 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18546 short-circuit operators, handle them as short circuit operators.
18548 (Cast.DoResolve): Resolve type.
18549 (Cast.Cast): Take an expression as the target type.
18551 * cs-parser.jay (cast_expression): Remove old hack that only
18552 allowed a limited set of types to be handled. Now we take a
18553 unary_expression and we resolve to a type during semantic
18556 Use the grammar productions from Rhys to handle casts (this is
18557 not complete like Rhys syntax yet, we fail to handle that corner
18558 case that C# has regarding (-x), but we will get there.
18560 2001-11-22 Ravi Pratap <ravi@ximian.com>
18562 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18563 field which is an array type.
18565 * cs-parser.jay (declare_local_variables): Support array initialization too.
18567 * typemanager.cs (MakeKey): Implement.
18569 (everywhere): Use the above appropriately.
18571 * cs-parser.jay (for_statement): Update for array initialization while
18572 declaring variables.
18574 * ecore.cs : The error message was correct, it's the variable's names that
18575 were misleading ;-) Make the code more readable.
18577 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18578 the correct type etc.
18580 (ConvertExplicit): Handle Enum types by examining the underlying type.
18582 2001-11-21 Ravi Pratap <ravi@ximian.com>
18584 * parameter.cs (GetCallingConvention): Always return
18585 CallingConventions.Standard for now.
18587 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18589 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18590 and `r' after calling DoNumericPromotions.
18592 * ecore.cs: Fix error message (the types were in the wrong order).
18594 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18595 BindingFlags.Instance as well
18597 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18598 implicit int literal conversion in an empty cast so that we
18599 propagate the right type upstream.
18601 (UnboxCast): new class used to unbox value types.
18602 (Expression.ConvertExplicit): Add explicit type conversions done
18605 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18606 the target type before applying the implicit LongLiterals to ULong
18609 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18611 * cs-parser.jay (for_statement): Reworked the way For works: now
18612 we declare manually any variables that are introduced in
18613 for_initializer to solve the problem of having out-of-band code
18614 emition (that is what got for broken).
18616 (declaration_statement): Perform the actual variable declaration
18617 that used to be done in local_variable_declaration here.
18619 (local_variable_declaration): Do not declare anything, just pass
18620 the information on a DictionaryEntry
18622 2001-11-20 Ravi Pratap <ravi@ximian.com>
18624 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18625 re-write of the logic to now make it recursive.
18627 (UpdateIndices): Re-write accordingly.
18629 Store element data in a separate ArrayData list in the above methods.
18631 (MakeByteBlob): Implement to dump the array data into a byte array.
18633 2001-11-19 Ravi Pratap <ravi@ximian.com>
18635 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18638 * constant.cs (Define): Implement.
18640 (EmitConstant): Re-write fully.
18642 Pass in location info.
18644 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18647 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18648 DictionaryEntry since we need location info too.
18650 (constant_declaration): Update accordingly.
18652 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18653 code into another method : UpdateIndices.
18655 2001-11-18 Ravi Pratap <ravi@ximian.com>
18657 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18658 some type checking etc.
18660 2001-11-17 Ravi Pratap <ravi@ximian.com>
18662 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18663 bits to provide dimension info if the user skips doing that.
18665 Update second constructor to store the rank correctly.
18667 2001-11-16 Ravi Pratap <ravi@ximian.com>
18669 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18670 and try to implement.
18672 * ../errors/cs0150.cs : Add.
18674 * ../errors/cs0178.cs : Add.
18676 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18678 * statement.cs: Implement foreach on multi-dimensional arrays.
18680 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18681 name of the params argument.
18683 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18684 initializing the array.
18686 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18687 we can use this elsewhere.
18689 * statement.cs: Finish implementation of foreach for single
18692 * cs-parser.jay: Use an out-of-band stack to pass information
18693 around, I wonder why I need this.
18695 foreach_block: Make the new foreach_block the current_block.
18697 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18698 function used to return a static Parameters structure. Used for
18699 empty parameters, as those are created very frequently.
18701 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18703 2001-11-15 Ravi Pratap <ravi@ximian.com>
18705 * interface.cs : Default modifier is private, not public. The
18706 make verify test passes again.
18708 2001-11-15 Ravi Pratap <ravi@ximian.com>
18710 * support.cs (ReflectionParameters): Fix logic to determine
18711 whether the last parameter is a params one. Test 9 passes again.
18713 * delegate.cs (Populate): Register the builders we define with
18714 RegisterParameterForBuilder. Test 19 passes again.
18716 * cs-parser.jay (property_declaration): Reference $6 instead
18717 of $$ to get at the location.
18719 (indexer_declaration): Similar stuff.
18721 (attribute): Ditto.
18723 * class.cs (Property): Register parameters for the Get and Set methods
18724 if they exist. Test 23 passes again.
18726 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18727 call to EmitArguments as we are sure there aren't any params arguments.
18728 Test 32 passes again.
18730 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18731 IndexOutOfRangeException.
18733 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18734 Test 33 now passes again.
18736 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18738 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18739 broke a bunch of things. Will have to come up with a better way
18740 of tracking locations.
18742 * statement.cs: Implemented foreach for single dimension arrays.
18744 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18746 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18747 an error. This removes the lookup from the critical path.
18749 * cs-parser.jay: Removed use of temporary_loc, which is completely
18752 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18754 * support.cs (ReflectionParameters.ParameterModifier): Report
18755 whether the argument is a PARAMS argument or not.
18757 * class.cs: Set the attribute `ParamArrayAttribute' on the
18758 parameter argument.
18760 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18761 and cons_param_array_attribute (ConstructorInfo for
18762 ParamArrayAttribute).,
18764 * codegen.cs: Emit the return using the `Return' statement, that
18765 way we can report the error correctly for missing return values.
18767 * class.cs (Method.Emit): Clean up.
18769 * expression.cs (Argument.Resolve): Take another argument: the
18770 location where this argument is used. Notice that this is not
18771 part of the "Argument" class as to reduce the size of the
18772 structure (we know the approximate location anyways).
18774 Test if the argument is a variable-reference, if not, then
18775 complain with a 206.
18777 (Argument.Emit): Emit addresses of variables.
18779 (Argument.FullDesc): Simplify.
18781 (Invocation.DoResolve): Update for Argument.Resolve.
18783 (ElementAccess.DoResolve): ditto.
18785 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18786 method should be virtual, as this method is always virtual.
18788 (NewDelegate.DoResolve): Update for Argument.Resolve.
18790 * class.cs (ConstructorInitializer.DoResolve): ditto.
18792 * attribute.cs (Attribute.Resolve): ditto.
18794 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18796 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18798 * expression.cs (ParameterReference): Drop IStackStorage and implement
18799 IAssignMethod instead.
18801 (LocalVariableReference): ditto.
18803 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18804 IAssignMethod instead.
18806 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18808 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18809 enumerations that are used in heavily used structures derive from
18810 byte in a laughable and pathetic attempt to reduce memory usage.
18811 This is the kind of pre-optimzations that you should not do at
18812 home without adult supervision.
18814 * expression.cs (UnaryMutator): New class, used to handle ++ and
18815 -- separatedly from the other unary operators. Cleans up the
18816 code, and kills the ExpressionStatement dependency in Unary.
18818 (Unary): Removed `method' and `Arguments' from this class, making
18819 it smaller, and moving it all to SimpleCall, so I can reuse this
18820 code in other locations and avoid creating a lot of transient data
18821 strucutres when not required.
18823 * cs-parser.jay: Adjust for new changes.
18825 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18827 * enum.cs (Enum.Populate): If there is a failure during
18830 * cs-parser.jay (opt_enum_base): we used to catch type errors
18831 here, but this is really incorrect. The type error should be
18832 catched during semantic analysis.
18834 2001-12-11 Ravi Pratap <ravi@ximian.com>
18836 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18837 current_local_parameters as expected since I, in my stupidity, had forgotten
18840 * attribute.cs (GetValidPlaces): Fix stupid bug.
18842 * class.cs (Method::Emit): Perform check on applicability of attributes.
18844 (Constructor::Emit): Ditto.
18846 (Field::Emit): Ditto.
18848 (Field.Location): Store location information.
18850 (Property, Event, Indexer, Operator): Ditto.
18852 * cs-parser.jay (field_declaration): Pass in location for each field.
18854 * ../errors/cs0592.cs : Add.
18856 2001-11-12 Ravi Pratap <ravi@ximian.com>
18858 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18860 (InitCoreTypes): Update accordingly.
18862 (RegisterAttrType, LookupAttr): Implement.
18864 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18865 info about the same.
18867 (Resolve): Update to populate the above as necessary.
18869 (Error592): Helper.
18871 (GetValidPlaces): Helper to the above.
18873 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18875 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18877 2001-11-12 Ravi Pratap <ravi@ximian.com>
18879 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18881 * ../errors/cs0617.cs : Add.
18883 2001-11-11 Ravi Pratap <ravi@ximian.com>
18885 * enum.cs (Emit): Rename to Populate to be more consistent with what
18886 we expect it to do and when exactly it is called.
18888 * class.cs, rootcontext.cs : Update accordingly.
18890 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18891 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18893 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18895 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18896 of a fieldinfo using the above, when dealing with a FieldBuilder.
18898 2001-11-10 Ravi Pratap <ravi@ximian.com>
18900 * ../errors/cs0031.cs : Add.
18902 * ../errors/cs1008.cs : Add.
18904 * ../errrors/cs0543.cs : Add.
18906 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18909 (FindMembers): Implement.
18911 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18912 enums and delegates too.
18914 (enum_types): Rename to builder_to_enum.
18916 (delegate_types): Rename to builder_to_delegate.
18918 * delegate.cs (FindMembers): Implement.
18920 2001-11-09 Ravi Pratap <ravi@ximian.com>
18922 * typemanager.cs (IsEnumType): Implement.
18924 * enum.cs (Emit): Re-write parts to account for the underlying type
18925 better and perform checking etc.
18927 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18928 of the underlying type.
18930 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18933 * enum.cs (error31): Helper to report error #31.
18935 * cs-parser.jay (enum_declaration): Store location of each member too.
18937 * enum.cs (member_to_location): New hashtable.
18939 (AddEnumMember): Update location hashtable.
18941 (Emit): Use the location of each member while reporting errors.
18943 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18945 * cs-parser.jay: A for_initializer if is a
18946 local_variable_declaration really ammount to have an implicit
18947 block with the variable declaration and no initializer for for.
18949 * statement.cs (For.Emit): Cope with null initializers.
18951 This fixes the infinite loop on for initializers.
18953 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18955 * enum.cs: More cleanup.
18957 * ecore.cs: Remove dead code.
18959 * class.cs (Property.Emit): More simplification.
18960 (Event.Emit): ditto.
18962 Reworked to have less levels of indentation.
18964 2001-11-08 Ravi Pratap <ravi@ximian.com>
18966 * class.cs (Property): Emit attributes.
18976 * enum.cs (Emit): Ditto.
18978 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
18981 * class.cs (Field, Event, etc.): Move attribute generation into the
18982 Emit method everywhere.
18984 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
18985 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
18986 as we had no way of defining nested enums !
18988 * rootcontext.cs : Adjust code accordingly.
18990 * typemanager.cs (AddEnumType): To keep track of enum types separately.
18992 2001-11-07 Ravi Pratap <ravi@ximian.com>
18994 * expression.cs (EvalConstantExpression): Move into ecore.cs
18996 * enum.cs (Enum): Rename some members and make them public and readonly
18997 according to our convention.
18999 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
19002 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
19004 (Enum::Emit): Write a simple version for now which doesn't try to compute
19005 expressions. I shall modify this to be more robust in just a while.
19007 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
19009 (TypeContainer::CloseType): Create the Enum types too.
19011 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
19013 * expression.cs (EvalConstantExpression): Get rid of completely.
19015 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
19016 user-defined values and other cases.
19018 (IsValidEnumLiteral): Helper function.
19020 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
19021 out there in the case we had a literal FieldExpr.
19023 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
19025 (Literalize): Revamp a bit to take two arguments.
19027 (EnumLiteral): New class which derives from Literal to wrap enum literals.
19029 2001-11-06 Ravi Pratap <ravi@ximian.com>
19031 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
19033 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
19035 (Resolve): Use the above to ensure we have proper initializers.
19037 2001-11-05 Ravi Pratap <ravi@ximian.com>
19039 * expression.cs (Expression::EvalConstantExpression): New method to
19040 evaluate constant expressions.
19042 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
19044 2001-11-07 Miguel de Icaza <miguel@ximian.com>
19046 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
19049 (Binary.ResolveOperator): Handle operator != (object a, object b)
19050 and operator == (object a, object b);
19052 (Binary.DoNumericPromotions): Indicate whether the numeric
19053 promotion was possible.
19055 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
19058 Made the ArrayAccess implement interface IAssignMethod instead of
19059 IStackStore as the order in which arguments are passed reflects
19062 * assign.cs: Instead of using expr.ExprClass to select the way of
19063 assinging, probe for the IStackStore/IAssignMethod interfaces.
19065 * typemanager.cs: Load InitializeArray definition.
19067 * rootcontext.cs (RootContext.MakeStaticData): Used to define
19068 static data that can be used to initialize arrays.
19070 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19072 * expression.cs: Handle operator== and operator!= for booleans.
19074 (Conditioal.Reduce): Implement reducer for the ?: operator.
19076 (Conditional.Resolve): Implement dead code elimination.
19078 (Binary.Resolve): Catch string literals and return a new
19079 concatenated string.
19081 (Unary.Reduce): Implement reduction of unary expressions.
19083 * ecore.cs: Split out the expression core handling here.
19085 (Expression.Reduce): New method used to perform constant folding
19086 and CSE. This is needed to support constant-expressions.
19088 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19089 targets, and optimize for !x.
19091 2001-11-04 Ravi Pratap <ravi@ximian.com>
19093 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19094 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19095 set custom atttributes.
19097 * literal.cs (Literal::GetValue): New abstract method to return the actual
19098 value of the literal, cast as an object.
19100 (*Literal): Implement GetValue method.
19102 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19103 expressions to the arraylist but objects of type Argument.
19105 * class.cs (TypeContainer::Emit): Emit our attributes too.
19107 (Method::Emit, Constructor::Emit): Ditto.
19109 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19110 to be ignoring earlier.
19112 2001-11-03 Ravi Pratap <ravi@ximian.com>
19114 * attribute.cs (AttributeSection::Define): Implement to do the business
19115 of constructing a CustomAttributeBuilder.
19117 (Attribute): New trivial class. Increases readability of code.
19119 * cs-parser.jay : Update accordingly.
19121 (positional_argument_list, named_argument_list, named_argument): New rules
19123 (attribute_arguments): Use the above so that we are more correct.
19125 2001-11-02 Ravi Pratap <ravi@ximian.com>
19127 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19128 to perform all checks for a method with a params parameter.
19130 (Invocation::OverloadResolve): Update to use the above method and therefore
19131 cope correctly with params method invocations.
19133 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19136 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19137 constructors in our parent too because we can't afford to miss out on
19140 * attribute.cs (AttributeSection): New name for the class Attribute
19142 Other trivial changes to improve readability.
19144 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19145 use the new class names.
19147 2001-11-01 Ravi Pratap <ravi@ximian.com>
19149 * class.cs (Method::Define): Complete definition for params types too
19151 (Indexer::Define): Ditto.
19153 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19154 Cope everywhere with a request for info about the array parameter.
19156 2001-11-01 Ravi Pratap <ravi@ximian.com>
19158 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19160 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19161 local_variable_type to extract the string corresponding to the type.
19163 (local_variable_type): Fixup the action to use the new helper method.
19165 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19168 * expression.cs : Clean out code which uses the above.
19170 2001-10-31 Ravi Pratap <ravi@ximian.com>
19172 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19173 and bale out if necessary by returning a false.
19175 (RegisterProperty): Ditto.
19177 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19178 and print out appropriate error messages.
19180 * interface.cs (everywhere): Ditto.
19182 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19183 location to constructor.
19185 * class.cs (Property, Event, Indexer): Update accordingly.
19187 * ../errors/cs111.cs : Added.
19189 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19190 of a method, as laid down by the spec.
19192 (Invocation::OverloadResolve): Use the above method.
19194 2001-10-31 Ravi Pratap <ravi@ximian.com>
19196 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19197 now take a TypeContainer and a Parameters object.
19199 (ParameterData): Modify return type of ParameterModifier method to be
19200 Parameter.Modifier and not a string.
19202 (ReflectionParameters, InternalParameters): Update accordingly.
19204 * expression.cs (Argument::GetParameterModifier): Same here.
19206 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19207 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19208 symbol in it at all so maybe this is only for now.
19210 2001-10-30 Ravi Pratap <ravi@ximian.com>
19212 * support.cs (InternalParameters): Constructor now takes an extra argument
19213 which is the actual Parameters class.
19215 (ParameterDesc): Update to provide info on ref/out modifiers.
19217 * class.cs (everywhere): Update call to InternalParameters to pass in
19218 the second argument too.
19220 * support.cs (ParameterData): Add ParameterModifier, which is a method
19221 to return the modifier info [ref/out etc]
19223 (InternalParameters, ReflectionParameters): Implement the above.
19225 * expression.cs (Argument::ParameterModifier): Similar function to return
19226 info about the argument's modifiers.
19228 (Invocation::OverloadResolve): Update to take into account matching modifiers
19231 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19232 a new SetFormalParameters object which we pass to InternalParameters.
19234 2001-10-30 Ravi Pratap <ravi@ximian.com>
19236 * expression.cs (NewArray): Merge into the ArrayCreation class.
19238 2001-10-29 Ravi Pratap <ravi@ximian.com>
19240 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19241 NewUserdefinedArray into one as there wasn't much of a use in having
19244 * expression.cs (Argument): Change field's name to ArgType from Type.
19246 (Type): New readonly property which returns the proper type, taking into
19247 account ref/out modifiers.
19249 (everywhere): Adjust code accordingly for the above.
19251 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19252 whether we are emitting for a ref or out parameter.
19254 * expression.cs (Argument::Emit): Use the above field to set the state.
19256 (LocalVariableReference::Emit): Update to honour the flag and emit the
19259 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19261 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19263 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19265 (ReflectionParameters, InternalParameters): Implement the above method.
19267 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19270 (Invocation::FullMethodDesc): Ditto.
19272 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19274 * cs-parser.jay: Add extra production for the second form of array
19277 * expression.cs (ArrayCreation): Update to reflect the above
19280 * Small changes to prepare for Array initialization.
19282 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19284 * typemanager.cs (ImplementsInterface): interface might be null;
19285 Deal with this problem;
19287 Also, we do store negative hits on the cache (null values), so use
19288 this instead of calling t.GetInterfaces on the type everytime.
19290 2001-10-28 Ravi Pratap <ravi@ximian.com>
19292 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19294 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19295 split functionality out into different classes.
19297 (New::FormArrayType): Move into NewBuiltinArray.
19299 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19302 (NewBuiltinArray): New class to handle creation of built-in arrays.
19304 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19305 account creation of one-dimensional arrays.
19307 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19309 (NewUserdefinedArray::DoResolve): Implement.
19311 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19313 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19314 we maintain inside the TypeManager. This is necessary to perform lookups on the
19317 (LookupType): Update to perform GetType on the module builders too.
19319 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19321 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19323 2001-10-23 Ravi Pratap <ravi@ximian.com>
19325 * expression.cs (New::DoResolve): Implement guts of array creation.
19327 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19329 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19331 * expression.cs: Fix bug I introduced lsat night that broke
19334 (Expression.Resolve): Report a 246 error (can not resolve name)
19335 if we find a SimpleName in the stream.
19337 (Expression.ResolveLValue): Ditto.
19339 (Expression.ResolveWithSimpleName): This function is a variant of
19340 ResolveName, this one allows SimpleNames to be returned without a
19341 warning. The only consumer of SimpleNames is MemberAccess
19343 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19345 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19346 might arrive here. I have my doubts that this is correct.
19348 * statement.cs (Lock): Implement lock statement.
19350 * cs-parser.jay: Small fixes to support `lock' and `using'
19352 * cs-tokenizer.cs: Remove extra space
19354 * driver.cs: New flag --checked, allows to turn on integer math
19357 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19358 Threading.Monitor.Exit
19360 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19362 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19363 Expression Class to be IndexerAccess.
19365 Notice that Indexer::DoResolve sets the eclass to Value.
19367 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19369 * class.cs (TypeContainer::Emit): Emit code for indexers.
19371 * assign.cs (IAssignMethod): New interface implemented by Indexers
19372 and Properties for handling assignment.
19374 (Assign::Emit): Simplify and reuse code.
19376 * expression.cs (IndexerAccess, PropertyExpr): Implement
19377 IAssignMethod, clean up old code.
19379 2001-10-22 Ravi Pratap <ravi@ximian.com>
19381 * typemanager.cs (ImplementsInterface): New method to determine if a type
19382 implements a given interface. Provides a nice cache too.
19384 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19387 (ConvertReferenceExplicit): Ditto.
19389 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19390 various methods, with correct names etc.
19392 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19393 Operator.UnaryNegation.
19395 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19396 we have a unary plus or minus operator.
19398 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19401 * everywhere : update accordingly.
19403 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19406 * class.cs (Method::Define): For the case where we are implementing a method
19407 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19408 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19410 2001-10-21 Ravi Pratap <ravi@ximian.com>
19412 * interface.cs (FindMembers): Implement to work around S.R.E
19415 * typemanager.cs (IsInterfaceType): Implement.
19417 (FindMembers): Update to handle interface types too.
19419 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19420 use IsAssignableFrom as that is not correct - it doesn't work.
19422 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19423 and accordingly override EmitStatement.
19425 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19426 using the correct logic :-)
19428 2001-10-19 Ravi Pratap <ravi@ximian.com>
19430 * ../errors/cs-11.cs : Add to demonstrate error -11
19432 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19434 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19435 then pass this as a hint to ResolveLValue.
19437 * expression.cs (FieldExpr): Add Location information
19439 (FieldExpr::LValueResolve): Report assignment to readonly
19442 (Expression::ExprClassFromMemberInfo): Pass location information.
19444 (Expression::ResolveLValue): Add new method that resolves an
19447 (Expression::DoResolveLValue): Default invocation calls
19450 (Indexers): New class used to keep track of indexers in a given
19453 (IStackStore): Renamed from LValue, as it did not really describe
19454 what this did. Also ResolveLValue is gone from this interface and
19455 now is part of Expression.
19457 (ElementAccess): Depending on the element access type
19459 * typemanager.cs: Add `indexer_name_type' as a Core type
19460 (System.Runtime.CompilerServices.IndexerNameAttribute)
19462 * statement.cs (Goto): Take a location.
19464 2001-10-18 Ravi Pratap <ravi@ximian.com>
19466 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19467 if two delegates are compatible.
19469 (NewDelegate::DoResolve): Update to take care of the case when
19470 we instantiate a delegate from another delegate.
19472 * typemanager.cs (FindMembers): Don't even try to look up members
19473 of Delegate types for now.
19475 2001-10-18 Ravi Pratap <ravi@ximian.com>
19477 * delegate.cs (NewDelegate): New class to take care of delegate
19480 * expression.cs (New): Split the delegate related code out into
19481 the NewDelegate class.
19483 * delegate.cs (DelegateInvocation): New class to handle delegate
19486 * expression.cs (Invocation): Split out delegate related code into
19487 the DelegateInvocation class.
19489 2001-10-17 Ravi Pratap <ravi@ximian.com>
19491 * expression.cs (New::DoResolve): Implement delegate creation fully
19492 and according to the spec.
19494 (New::DoEmit): Update to handle delegates differently.
19496 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19497 because of which we were printing out arguments in reverse order !
19499 * delegate.cs (VerifyMethod): Implement to check if the given method
19500 matches the delegate.
19502 (FullDelegateDesc): Implement.
19504 (VerifyApplicability): Implement.
19506 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19507 delegate invocations too.
19509 (Invocation::Emit): Ditto.
19511 * ../errors/cs1593.cs : Added.
19513 * ../errors/cs1594.cs : Added.
19515 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19517 2001-10-16 Ravi Pratap <ravi@ximian.com>
19519 * typemanager.cs (intptr_type): Core type for System.IntPtr
19521 (InitCoreTypes): Update for the same.
19523 (iasyncresult_type, asynccallback_type): Ditto.
19525 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19528 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19531 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19532 the builders for the 4 members of a delegate type :-)
19534 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19537 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19539 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19541 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19543 * statement.cs (Break::Emit): Implement.
19544 (Continue::Emit): Implement.
19546 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19547 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19548 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19549 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19552 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19553 properties that track the label for the current loop (begin of the
19554 loop and end of the loop).
19556 2001-10-15 Ravi Pratap <ravi@ximian.com>
19558 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19559 use of emitting anything at all.
19561 * class.cs, rootcontext.cs : Get rid of calls to the same.
19563 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19565 (Populate): Define the constructor correctly and set the implementation
19568 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19571 (AddDelegateType): Implement.
19573 (IsDelegateType): Implement helper method.
19575 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19577 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19578 and accordingly handle it.
19580 * delegate.cs (Populate): Take TypeContainer argument.
19581 Implement bits to define the Invoke method. However, I still haven't figured out
19582 how to take care of the native int bit :-(
19584 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19585 Qualify the name of the delegate, not its return type !
19587 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19590 (StandardConversionExists): Checking for array types turns out to be recursive.
19592 (ConvertReferenceExplicit): Implement array conversion.
19594 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19596 2001-10-12 Ravi Pratap <ravi@ximian.com>
19598 * cs-parser.jay (delegate_declaration): Store the fully qualified
19599 name as it is a type declaration.
19601 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19604 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19605 as TypeContainer::DefineType.
19607 (Populate): Method in which all the definition of the various methods (Invoke)
19610 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19613 (CloseDelegate): Finally creates the delegate.
19615 * class.cs (TypeContainer::DefineType): Update to define delegates.
19616 (Populate, Emit and CloseType): Do the same thing here too.
19618 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19619 delegates in all these operations.
19621 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19623 * expression.cs: LocalTemporary: a new expression used to
19624 reference a temporary that has been created.
19626 * assign.cs: Handle PropertyAccess back here, so that we can
19627 provide the proper semantic access to properties.
19629 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19630 a few more explicit conversions.
19632 * modifiers.cs: `NEW' modifier maps to HideBySig.
19634 * expression.cs (PropertyExpr): Make this into an
19635 ExpressionStatement, and support the EmitStatement code path.
19637 Perform get/set error checking, clean up the interface.
19639 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19640 them into toplevel access objects.
19642 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19644 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19647 * typemanager.cs: Keep track here of our PropertyBuilders again to
19648 work around lameness in SRE.
19650 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19652 * expression.cs (LValue::LValueResolve): New method in the
19653 interface, used to perform a second resolution pass for LValues.
19655 (This::DoResolve): Catch the use of this in static methods.
19657 (This::LValueResolve): Implement.
19659 (This::Store): Remove warning, assigning to `this' in structures
19662 (Invocation::Emit): Deal with invocation of
19663 methods on value types. We need to pass the address to structure
19664 methods rather than the object itself. (The equivalent code to
19665 emit "this" for structures leaves the entire structure on the
19666 stack instead of a pointer to it).
19668 (ParameterReference::DoResolve): Compute the real index for the
19669 argument based on whether the method takes or not a `this' pointer
19670 (ie, the method is static).
19672 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19673 value types returned from functions when we need to invoke a
19674 method on the sturcture.
19677 2001-10-11 Ravi Pratap <ravi@ximian.com>
19679 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19680 defining the type in the Modulebuilder or Typebuilder. This is to take
19681 care of nested types which need to be defined on the TypeBuilder using
19682 DefineNestedMethod.
19684 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19685 methods in RootContext, only ported to be part of TypeContainer.
19687 (TypeContainer::GetInterfaceOrClass): Ditto.
19689 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19691 * interface.cs (Interface::DefineInterface): New method. Does exactly
19692 what RootContext.CreateInterface did earlier, only it takes care of nested types
19695 (Interface::GetInterfaces): Move from RootContext here and port.
19697 (Interface::GetInterfaceByName): Same here.
19699 * rootcontext.cs (ResolveTree): Re-write.
19701 (PopulateTypes): Re-write.
19703 * class.cs (TypeContainer::Populate): Populate nested types too.
19704 (TypeContainer::Emit): Emit nested members too.
19706 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19707 instead just use the name argument passed in as it is already fully
19710 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19711 to TypeContainer mapping to see if a type is user-defined.
19713 * class.cs (TypeContainer::CloseType): Implement.
19715 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19716 the default constructor.
19718 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19721 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19723 * interface.cs (CloseType): Create the type here.
19725 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19728 Remove all the methods which are now in TypeContainer.
19730 2001-10-10 Ravi Pratap <ravi@ximian.com>
19732 * delegate.cs (Define): Re-write bits to define the delegate
19735 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19737 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19739 * expression.cs (ImplicitReferenceConversion): handle null as well
19740 as a source to convert to any reference type.
19742 * statement.cs (Return): Perform any implicit conversions to
19743 expected return type.
19745 Validate use of return statement.
19747 * codegen.cs (EmitContext): Pass the expected return type here.
19749 * class.cs (Method, Constructor, Property): Pass expected return
19750 type to EmitContext.
19752 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19754 * expression.cs: Make DoResolve take an EmitContext instead of a
19757 Replaced `l' and `location' for `loc', for consistency.
19759 (Error, Warning): Remove unneeded Tc argument.
19761 * assign.cs, literal.cs, constant.cs: Update to new calling
19764 * codegen.cs: EmitContext now contains a flag indicating whether
19765 code is being generated in a static method or not.
19767 * cs-parser.jay: DecomposeQI, new function that replaces the old
19768 QualifiedIdentifier. Now we always decompose the assembled
19769 strings from qualified_identifier productions into a group of
19772 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19774 * rootcontext.cs: Deal with field-less struct types correctly now
19775 by passing the size option to Define Type.
19777 * class.cs: Removed hack that created one static field.
19779 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19781 * statement.cs: Moved most of the code generation here.
19783 2001-10-09 Ravi Pratap <ravi@ximian.com>
19785 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19788 (ElementAccess): Remove useless bits for now - keep checks as the spec
19791 2001-10-08 Ravi Pratap <ravi@ximian.com>
19793 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19794 and start performing checks according to the spec.
19796 2001-10-07 Ravi Pratap <ravi@ximian.com>
19798 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19799 rank_specifiers instead.
19801 (rank_specifiers): Change the order in which the rank specifiers are stored
19803 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19805 * expression.cs (ElementAccess): Implement the LValue interface too.
19807 2001-10-06 Ravi Pratap <ravi@ximian.com>
19809 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19810 except that user defined conversions are not included.
19812 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19813 perform the conversion of the return type, if necessary.
19815 (New::DoResolve): Check whether we are creating an array or an object
19816 and accordingly do the needful.
19818 (New::Emit): Same here.
19820 (New::DoResolve): Implement guts of array creation.
19822 (New::FormLookupType): Helper function.
19824 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19826 * codegen.cs: Removed most of the code generation here, and move the
19827 corresponding code generation bits to the statement classes.
19829 Added support for try/catch/finalize and throw.
19831 * cs-parser.jay: Added support for try/catch/finalize.
19833 * class.cs: Catch static methods having the flags override,
19834 virtual or abstract.
19836 * expression.cs (UserCast): This user cast was not really doing
19837 what it was supposed to do. Which is to be born in fully resolved
19838 state. Parts of the resolution were being performed at Emit time!
19842 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19844 * expression.cs: Implicity convert the result from UserCast.
19846 2001-10-05 Ravi Pratap <ravi@ximian.com>
19848 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19849 prevented it from working correctly.
19851 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19852 merely ConvertImplicit.
19854 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19856 * typemanager.cs: Make the LookupTypeContainer function static,
19857 and not per-instance.
19859 * class.cs: Make static FindMembers (the one that takes a Type
19862 * codegen.cs: Add EmitForeach here.
19864 * cs-parser.jay: Make foreach a toplevel object instead of the
19865 inline expansion, as we need to perform semantic analysis on it.
19867 2001-10-05 Ravi Pratap <ravi@ximian.com>
19869 * expression.cs (Expression::ImplicitUserConversion): Rename to
19870 UserDefinedConversion.
19872 (Expression::UserDefinedConversion): Take an extra argument specifying
19873 whether we look for explicit user conversions too.
19875 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19877 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19879 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19880 with the appropriate arguments.
19882 * cs-parser.jay (cast_expression): Record location too.
19884 * expression.cs (Cast): Record location info.
19886 (Expression::ConvertExplicit): Take location argument.
19888 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19889 to determine if we are doing explicit conversions.
19891 (UserCast::Emit): Update accordingly.
19893 (Expression::ConvertExplicit): Report an error if everything fails.
19895 * ../errors/cs0030.cs : Add.
19897 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19899 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19900 virtual and newslot bits.
19902 * class.cs (TypeContainer::RegisterRequiredImplementations):
19903 Record methods we need.
19905 (TypeContainer::MakeKey): Helper function to make keys for
19906 MethodBases, since the Methodbase key is useless.
19908 (TypeContainer::Populate): Call RegisterRequiredImplementations
19909 before defining the methods.
19911 Create a mapping for method_builders_to_methods ahead of time
19912 instead of inside a tight loop.
19914 (::RequireMethods): Accept an object as the data to set into the
19915 hashtable so we can report interface vs abstract method mismatch.
19917 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19919 * report.cs: Make all of it static.
19921 * rootcontext.cs: Drop object_type and value_type computations, as
19922 we have those in the TypeManager anyways.
19924 Drop report instance variable too, now it is a global.
19926 * driver.cs: Use try/catch on command line handling.
19928 Add --probe option to debug the error reporting system with a test
19931 * report.cs: Add support for exiting program when a probe
19932 condition is reached.
19934 2001-10-03 Ravi Pratap <ravi@ximian.com>
19936 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19937 we do a forcible conversion regardless of type, to check if
19938 ForceConversion returns a null.
19940 (Binary::error19): Use location to report error.
19942 (Unary::error23): Use location here too.
19944 * ../errors/cs0019.cs : Check in.
19946 * ../errors/cs0023.cs : Check in.
19948 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19949 case of a non-null MethodInfo object with a length of 0 !
19951 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19952 an applicable member - according to the spec :-)
19953 Also fix logic to find members in base types.
19955 (Unary::ResolveOperator): Same here.
19957 (Unary::report23): Change name to error23 and make first argument a TypeContainer
19958 as I was getting thoroughly confused between this and error19 :-)
19960 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
19961 (::FindMostEncompassedType): Implement.
19962 (::FindMostEncompassingType): Implement.
19963 (::StandardConversionExists): Implement.
19965 (UserImplicitCast): Re-vamp. We now need info about most specific
19966 source and target types so that we can do the necessary conversions.
19968 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
19969 mathematical union with no duplicates.
19971 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19973 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
19974 in order from base classes to child classes, so that we can in
19975 child classes look up in our parent for method names and
19976 attributes (required for handling abstract, virtual, new, override
19977 constructs: we need to instrospect our base class, and if we dont
19978 populate the classes in order, the introspection might be
19979 incorrect. For example, a method could query its parent before
19980 the parent has any methods and would determine that the parent has
19981 no abstract methods (while it could have had them)).
19983 (RootContext::CreateType): Record the order in which we define the
19986 2001-10-02 Miguel de Icaza <miguel@ximian.com>
19988 * class.cs (TypeContainer::Populate): Also method definitions can
19989 fail now, keep track of this.
19991 (TypeContainer::FindMembers): Implement support for
19992 DeclaredOnly/noDeclaredOnly flag.
19994 (Constructor::Emit) Return the ConstructorBuilder.
19996 (Method::Emit) Return the MethodBuilder.
19997 Check for abstract or virtual methods to be public.
19999 * rootcontext.cs (RootContext::CreateType): Register all the
20000 abstract methods required for the class to be complete and the
20001 interface methods that must be implemented.
20003 * cs-parser.jay: Report error 501 (method requires body if it is
20004 not marked abstract or extern).
20006 * expression.cs (TypeOf::Emit): Implement.
20008 * typemanager.cs: runtime_handle_type, new global type.
20010 * class.cs (Property::Emit): Generate code for properties.
20012 2001-10-02 Ravi Pratap <ravi@ximian.com>
20014 * expression.cs (Unary::ResolveOperator): Find operators on base type
20015 too - we now conform exactly to the spec.
20017 (Binary::ResolveOperator): Same here.
20019 * class.cs (Operator::Define): Fix minor quirk in the tests.
20021 * ../errors/cs0215.cs : Added.
20023 * ../errors/cs0556.cs : Added.
20025 * ../errors/cs0555.cs : Added.
20027 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20029 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
20030 single integer which is really efficient
20032 2001-10-01 Ravi Pratap <ravi@ximian.com>
20034 * expression.cs (Expression::ImplicitUserConversion): Use location
20035 even in the case when we are examining True operators.
20037 * class.cs (Operator::Define): Perform extensive checks to conform
20038 with the rules for operator overloading in the spec.
20040 * expression.cs (Expression::ImplicitReferenceConversion): Implement
20041 some of the other conversions mentioned in the spec.
20043 * typemanager.cs (array_type): New static member for the System.Array built-in
20046 (cloneable_interface): For System.ICloneable interface.
20048 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
20049 we start resolving the tree and populating types.
20051 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
20053 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20055 * expression.cs (Expression::ExprClassFromMemberInfo,
20056 Expression::Literalize): Create literal expressions from
20057 FieldInfos which are literals.
20059 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
20060 type casts, because they were wrong. The test suite in tests
20063 (ImplicitNumericConversion): ushort to ulong requires a widening
20066 Int32 constant to long requires widening cast as well.
20068 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
20069 for integers because the type on the stack is not i4.
20071 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20073 * expression.cs (report118): require location argument.
20075 * parameter.cs: Do not dereference potential null value.
20077 * class.cs: Catch methods that lack the `new' keyword when
20078 overriding a name. Report warnings when `new' is used without
20079 anything being there to override.
20081 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20083 * class.cs: Only add constructor to hashtable if it is non-null
20084 (as now constructors can fail on define).
20086 (TypeManager, Class, Struct): Take location arguments.
20088 Catch field instance initialization in structs as errors.
20090 accepting_filter: a new filter for FindMembers that is static so
20091 that we dont create an instance per invocation.
20093 (Constructor::Define): Catch errors where a struct constructor is
20096 * cs-parser.jay: Pass location information for various new
20099 * delegate.cs (Delegate): take a location argument.
20101 * driver.cs: Do not call EmitCode if there were problesm in the
20102 Definition of the types, as many Builders wont be there.
20104 * decl.cs (Decl::Decl): Require a location argument.
20106 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20107 into integers, and find the most appropiate integer for it.
20109 * literal.cs: Implement ULongLiteral.
20111 * rootcontext.cs: Provide better information about the location of
20112 failure when CreateType fails.
20114 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20116 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20119 * expression.cs (Binary::CheckShiftArguments): Add missing type
20121 (Binary::ResolveOperator): Add type to the logical and and logical
20122 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20125 (Binary::DoNumericPromotions): In the case where either argument
20126 is ulong (and most signed types combined with ulong cause an
20127 error) perform implicit integer constant conversions as well.
20129 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20131 * expression.cs (UserImplicitCast): Method should always be
20133 (Invocation::BetterConversion): Simplified test for IntLiteral.
20135 (Expression::ImplicitNumericConversion): Split this routine out.
20136 Put the code that performs implicit constant integer conversions
20139 (Expression::Resolve): Become a wrapper around DoResolve so we can
20140 check eclass and type being set after resolve.
20142 (Invocation::Badness): Remove this dead function
20144 (Binary::ResolveOperator): Do not compute the expensive argumnets
20145 unless we have a union for it.
20147 (Probe::Emit): Is needs to do an isinst and then
20148 compare against null.
20150 (::CanConvert): Added Location argument. If the Location argument
20151 is null (Location.Null), then we do not report errors. This is
20152 used by the `probe' mechanism of the Explicit conversion. We do
20153 not want to generate an error for something that the user
20154 explicitly requested to be casted. But the pipeline for an
20155 explicit cast first tests for potential implicit casts.
20157 So for now, if the Location is null, it means `Probe only' to
20158 avoid adding another argument. Might have to revise this
20161 (ClassCast): New class used to type cast objects into arbitrary
20162 classes (used in Explicit Reference Conversions).
20164 Implement `as' as well.
20166 Reverted all the patches from Ravi below: they were broken:
20168 * The use of `level' as a mechanism to stop recursive
20169 invocations is wrong. That was there just to catch the
20170 bug with a strack trace but not as a way of addressing
20173 To fix the problem we have to *understand* what is going
20174 on and the interactions and come up with a plan, not
20175 just get things going.
20177 * The use of the type conversion cache that I proposed
20178 last night had an open topic: How does this work across
20179 protection domains. A user defined conversion might not
20180 be public in the location where we are applying the
20181 conversion, a different conversion might be selected
20182 (ie, private A->B (better) but public B->A (worse),
20183 inside A, A->B applies, but outside it, B->A will
20186 * On top of that (ie, even if the above is solved),
20187 conversions in a cache need to be abstract. Ie, `To
20188 convert from an Int to a Short use an OpcodeCast', not
20189 `To convert from an Int to a Short use the OpcodeCast on
20190 the variable 5' (which is what this patch was doing).
20192 2001-09-28 Ravi Pratap <ravi@ximian.com>
20194 * expression.cs (Invocation::ConversionExists): Re-write to use
20195 the conversion cache
20197 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20198 cache all conversions done, not just user-defined ones.
20200 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20201 to determine if a conversion exists instead of acutually trying to
20202 perform the conversion. It's faster too.
20204 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20205 and only then attempt the implicit conversion.
20207 2001-09-28 Ravi Pratap <ravi@ximian.com>
20209 * expression.cs (ConvertImplicit): Use a cache for conversions
20210 already found. Check level of recursion and bail out if necessary.
20212 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20214 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20215 Export standard methods that we expect for string operations.
20217 * statement.cs (Block::UsageWarning): Track usage of variables and
20218 report the errors for not used variables.
20220 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20223 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20225 * codegen.cs: remove unnneded code
20227 * expression.cs: Removed BuiltinTypeAccess class
20229 Fix the order in which implicit conversions are
20232 The previous fixed dropped support for boxed conversions (adding a
20233 test to the test suite now)
20235 (UserImplicitCast::CanConvert): Remove test for source being null,
20236 that code is broken. We should not feed a null to begin with, if
20237 we do, then we should track the bug where the problem originates
20238 and not try to cover it up here.
20240 Return a resolved expression of type UserImplicitCast on success
20241 rather than true/false. Ravi: this is what I was talking about,
20242 the pattern is to use a static method as a "constructor" for
20245 Also, do not create arguments until the very last minute,
20246 otherwise we always create the arguments even for lookups that
20247 will never be performed.
20249 (UserImplicitCast::Resolve): Eliminate, objects of type
20250 UserImplicitCast are born in a fully resolved state.
20252 * typemanager.cs (InitCoreTypes): Init also value_type
20253 (System.ValueType).
20255 * expression.cs (Cast::Resolve): First resolve the child expression.
20257 (LValue): Add new method AddressOf to be used by
20260 Change the argument of Store to take an EmitContext instead of an
20261 ILGenerator, because things like FieldExpr need to be able to call
20262 their children expression to generate the instance code.
20264 (Expression::Error, Expression::Warning): Sugar functions for
20267 (Expression::MemberLookup): Accept a TypeContainer instead of a
20268 Report as the first argument.
20270 (Expression::ResolvePrimary): Killed. I still want to improve
20271 this as currently the code is just not right.
20273 (Expression::ResolveMemberAccess): Simplify, but it is still
20276 (Unary::Resolve): Catch errors in AddressOf operators.
20278 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20279 index to a byte for the short-version, or the compiler will choose
20280 the wrong Emit call, which generates the wrong data.
20282 (ParameterReference::Emit, ::Store): same.
20284 (FieldExpr::AddressOf): Implement.
20286 * typemanager.cs: TypeManager: made public variable instead of
20289 * driver.cs: document --fatal.
20291 * report.cs (ErrorMessage, WarningMessage): new names for the old
20292 Error and Warning classes.
20294 * cs-parser.jay (member_access): Turn built-in access to types
20295 into a normal simplename
20297 2001-09-27 Ravi Pratap <ravi@ximian.com>
20299 * expression.cs (Invocation::BetterConversion): Fix to cope
20300 with q being null, since this was introducing a bug.
20302 * expression.cs (ConvertImplicit): Do built-in conversions first.
20304 2001-09-27 Ravi Pratap <ravi@ximian.com>
20306 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20308 2001-09-27 Ravi Pratap <ravi@ximian.com>
20310 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20311 I had introduced long ago (what's new ?).
20313 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20314 the work of all the checking.
20315 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20316 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20318 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20319 that is the right way.
20321 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20322 overloading resolution. Use everywhere instead of cutting and pasting code.
20324 (Binary::ResolveOperator): Use MakeUnionSet.
20326 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20327 we have to convert to bool types. Not complete yet.
20329 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20331 * typemanager.cs (TypeManager::CSharpName): support ushort.
20333 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20334 to provide an expression that performsn an implicit constant int
20335 conversion (section 6.1.6).
20336 (Expression::ConvertImplicitRequired): Reworked to include
20337 implicit constant expression conversions.
20339 (Expression::ConvertNumericExplicit): Finished.
20341 (Invocation::Emit): If InstanceExpression is null, then it means
20342 that we perform a call on this.
20344 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20346 * expression.cs (Unary::Emit): Remove some dead code.
20347 (Probe): Implement Resolve and Emit for `is'.
20348 (Expression::ConvertImplicitRequired): Attempt to do constant
20349 expression conversions here. Maybe should be moved to
20350 ConvertImplicit, but I am not sure.
20351 (Expression::ImplicitLongConstantConversionPossible,
20352 Expression::ImplicitIntConstantConversionPossible): New functions
20353 that tell whether is it possible to apply an implicit constant
20354 expression conversion.
20356 (ConvertNumericExplicit): Started work on explicit numeric
20359 * cs-parser.jay: Update operator constants.
20361 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20362 (Parameters::GetSignature): Hook up VerifyArgs here.
20363 (Parameters::VerifyArgs): Verifies that no two arguments have the
20366 * class.cs (Operator): Update the operator names to reflect the
20367 ones that the spec expects (as we are just stringizing the
20370 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20371 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20372 previous usage did only work for our methods.
20373 (Expression::ConvertImplicit): Handle decimal implicit numeric
20374 conversions as well.
20375 (Expression::InternalTypeConstructor): Used to invoke constructors
20376 on internal types for default promotions.
20378 (Unary::Emit): Implement special handling for the pre/post
20379 increment/decrement for overloaded operators, as they need to have
20380 the same semantics as the other operators.
20382 (Binary::ResolveOperator): ditto.
20383 (Invocation::ConversionExists): ditto.
20384 (UserImplicitCast::Resolve): ditto.
20386 2001-09-26 Ravi Pratap <ravi@ximian.com>
20388 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20389 operator, return after emitting body. Regression tests pass again !
20391 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20392 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20393 (Invocation::OverloadResolve): Ditto.
20394 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20396 * everywhere : update calls to the above methods accordingly.
20398 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20400 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20402 * expression.cs (ExpressionStatement): New base class used for
20403 expressions that can appear in statements, so that we can provide
20404 an alternate path to generate expression that do not leave a value
20407 (Expression::Emit, and all the derivatives): We no longer return
20408 whether a value is left on the stack or not. Every expression
20409 after being emitted leaves a single value on the stack.
20411 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20412 facilties of ExpressionStatement if possible.
20414 * cs-parser.jay: Update statement_expression.
20416 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20418 * driver.cs: Change the wording of message
20420 2001-09-25 Ravi Pratap <ravi@ximian.com>
20422 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20423 the type of the expression to the return type of the method if
20424 we have an overloaded operator match ! The regression tests pass again !
20425 (Unary::ResolveOperator): Ditto.
20427 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20428 to find "op_Implicit", not "implicit" ;-)
20429 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20430 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20432 * everywhere : Correct calls to the above accordingly.
20434 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20435 (ConvertImplicit): Do user-defined conversion if it exists.
20437 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20439 * assign.cs: track location.
20440 (Resolve): Use implicit conversions on assignment.
20442 * literal.cs: Oops. Not good, Emit of short access values should
20443 pass (Bytes) or the wrong argument will be selected.
20445 * expression.cs (Unary::Emit): Emit code for -expr.
20447 (Unary::ResolveOperator): Handle `Substract' for non-constants
20448 (substract from zero from the non-constants).
20449 Deal with Doubles as well.
20451 (Expression::ConvertImplicitRequired): New routine that reports an
20452 error if no implicit conversion exists.
20454 (Invocation::OverloadResolve): Store the converted implicit
20455 expressions if we make them
20457 2001-09-24 Ravi Pratap <ravi@ximian.com>
20459 * class.cs (ConstructorInitializer): Take a Location argument.
20460 (ConstructorBaseInitializer): Same here.
20461 (ConstructorThisInitializer): Same here.
20463 * cs-parser.jay : Update all calls accordingly.
20465 * expression.cs (Unary, Binary, New): Take location argument.
20466 Update accordingly everywhere.
20468 * cs-parser.jay : Update all calls to the above to take a location
20471 * class.cs : Ditto.
20473 2001-09-24 Ravi Pratap <ravi@ximian.com>
20475 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20476 (Invocation::BetterConversion): Same here
20477 (Invocation::ConversionExists): Ditto.
20479 (Invocation::ConversionExists): Implement.
20481 2001-09-22 Ravi Pratap <ravi@ximian.com>
20483 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20484 Also take an additional TypeContainer argument.
20486 * All over : Pass in TypeContainer as argument to OverloadResolve.
20488 * typemanager.cs (CSharpName): Update to check for the string type and return
20491 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20494 2001-09-21 Ravi Pratap <ravi@ximian.com>
20496 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20497 (Invocation::BetterFunction): Implement.
20498 (Invocation::BetterConversion): Implement.
20499 (Invocation::ConversionExists): Skeleton, no implementation yet.
20501 Okay, things work fine !
20503 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20505 * typemanager.cs: declare and load enum_type, delegate_type and
20508 * expression.cs (Expression::Emit): Now emit returns a value that
20509 tells whether a value is left on the stack or not. This strategy
20510 might be reveted tomorrow with a mechanism that would address
20511 multiple assignments.
20512 (Expression::report118): Utility routine to report mismatches on
20515 (Unary::Report23): Report impossible type/operator combination
20518 (Unary::IsIncrementableNumber): Whether the type can be
20519 incremented or decremented with add.
20520 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20522 (Unary::ResolveOperator): Implement ++, !, ~,
20524 (Invocation::Emit): Deal with new Emit convetion.
20526 * All Expression derivatives: Updated their Emit method to return
20527 whether they leave values on the stack or not.
20529 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20530 stack for expressions that are statements.
20532 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20534 * expression.cs (LValue): New interface. Must be implemented by
20536 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20539 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20540 interface for generating code, simplifies the code.
20542 2001-09-20 Ravi Pratap <ravi@ximian.com>
20544 * expression.cs (everywhere): Comment out return statements in ::Resolve
20545 methods to avoid the warnings.
20547 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20549 * driver.cs (parse): Report error 2001 if we can not open the
20552 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20555 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20558 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20559 otherwise nested blocks end up with the same index.
20561 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20563 * expression.cs: Instead of having FIXMEs in the Resolve
20564 functions, throw exceptions so it is obvious that we are facing a
20567 * cs-parser.jay (invocation_expression): Pass Location information.
20569 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20570 Use a basename for those routines because .NET does not like paths
20573 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20576 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20578 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20579 are loading the correct data types (throws an exception if not).
20580 (TypeManager::InitCoreTypes): Use CoreLookupType
20582 * expression.cs (Unary::ResolveOperator): return the child
20583 expression for expressions which are just +expr.
20584 (Unary::ResolveOperator): Return negative literals for -LITERAL
20585 expressions (otherwise they are Unary {Literal}).
20586 (Invocation::Badness): Take into account `Implicit constant
20587 expression conversions'.
20589 * literal.cs (LongLiteral): Implement long literal class.
20590 (IntLiteral): export the `Value' of the intliteral.
20592 2001-09-19 Ravi Pratap <ravi@ximian.com>
20594 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20596 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20597 instead of 'Operator'
20599 * expression.cs (Binary::ResolveOperator): Update accordingly.
20600 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20603 * cs-parser.jay (unary_expression): Update to use the new names.
20605 * gen-treedump.cs (GetUnary): Same here.
20607 * expression.cs (Unary::Resolve): Implement.
20608 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20609 operators are found instead of making noise ;-)
20610 (Unary::ResolveOperator): New method to do precisely the same thing which
20611 Binary::ResolveOperator does for Binary expressions.
20612 (Unary.method, .Arguments): Add.
20613 (Unary::OperName): Implement.
20614 (Unary::ForceConversion): Copy and Paste !
20616 * class.cs (Operator::Define): Fix a small bug for the case when we have
20619 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20620 for the inbuilt operators. Only overloading works for now ;-)
20622 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20624 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20625 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20627 * expression.cs (This::Emit): Implement.
20628 (This::Resolve): Implement.
20629 (TypeOf:Resolve): Implement.
20630 (Expression::ResolveSimpleName): Add an implicit this to instance
20632 (MemberAccess::Resolve): Deal with Parameters and Fields.
20633 Bind instance variable to Field expressions.
20634 (FieldExpr::Instance): New field used to track the expression that
20635 represents the object instance.
20636 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20638 (FieldExpr::Emit): Implement.
20640 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20641 the last instruction contains a return opcode to avoid generating
20642 the last `ret' instruction (this generates correct code, and it is
20643 nice to pass the peverify output).
20645 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20646 initializer for static and instance variables.
20647 (Constructor::Emit): Allow initializer to be null in the case of
20648 static constructors. Only emit initializer for instance
20651 (TypeContainer::FindMembers): Return a null array if there are no
20654 Also fix the code for the MemberTypes.Method branch, as it was not
20655 scanning that for operators (or tried to access null variables before).
20657 * assign.cs (Assign::Emit): Handle instance and static fields.
20661 * driver.cs: Stop compilation if there are parse errors.
20663 * cs-parser.jay (constructor_declaration): Provide default base
20664 initializer for non-static constructors.
20665 (constructor_declarator): Do not provide a default base
20666 initializers if none was specified.
20667 Catch the fact that constructors should not have parameters.
20669 * class.cs: Do not emit parent class initializers for static
20670 constructors, that should be flagged as an error.
20672 2001-09-18 Ravi Pratap <ravi@ximian.com>
20674 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20675 Move back code into TypeContainer::Populate.
20677 2001-09-18 Ravi Pratap <ravi@ximian.com>
20679 * class.cs (TypeContainer::AddConstructor): Fix the check to
20680 compare against Name, not Basename.
20681 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20683 * cs-parser.jay : Update accordingly.
20685 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20686 for methods, don't forget to look into the operators too.
20687 (RegisterMethodBuilder): Helper method to take care of this for
20688 methods, constructors and operators.
20689 (Operator::Define): Completely revamp.
20690 (Operator.OperatorMethod, MethodName): New fields.
20691 (TypeContainer::Populate): Move the registering of builders into
20692 RegisterMethodBuilder.
20693 (Operator::Emit): Re-write.
20695 * expression.cs (Binary::Emit): Comment out code path to emit method
20696 invocation stuff for the case when we have a user defined operator. I am
20697 just not able to get it right !
20699 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20701 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20704 (Expression::MemberLookup): Provide a version that allows to
20705 specify the MemberTypes and BindingFlags.
20707 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20708 so it was not fetching variable information from outer blocks.
20710 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20711 Beforefieldinit as it was buggy.
20713 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20714 that Ravi put here.
20716 * class.cs (Constructor::Emit): Only emit if block is not null.
20717 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20718 deal with this by semantically definining it as if the user had
20721 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20722 constructors as we now "emit" them at a higher level.
20724 (TypeContainer::DefineDefaultConstructor): Used to define the
20725 default constructors if none was provided.
20727 (ConstructorInitializer): Add methods Resolve and Emit.
20729 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20731 2001-09-17 Ravi Pratap <ravi@ximian.com>
20733 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20734 the default constructor builder with our hashtable for methodbuilders
20737 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20738 and argument_count is 0 in which case we have a match.
20739 (Binary::ResolveOperator): More null checking and miscellaneous coding
20742 2001-09-17 Ravi Pratap <ravi@ximian.com>
20744 * rootcontext.cs (IsNameSpace): Compare against null.
20746 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20748 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20749 and Unary::Operator.
20751 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20754 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20755 we have overloaded operators.
20756 (Binary::ResolveOperator): Implement the part which does the operator overload
20759 * class.cs (Operator::Emit): Implement.
20760 (TypeContainer::Emit): Emit the operators we have too.
20762 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20763 the case when we have a user-defined operator.
20765 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20767 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20769 2001-09-16 Ravi Pratap <ravi@ximian.com>
20771 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20772 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20773 (Constructor::Emit): Implement.
20774 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20775 if we have no work to do.
20776 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20779 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20780 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20782 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20785 2001-09-15 Ravi Pratap <ravi@ximian.com>
20787 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20789 (Tree::RecordNamespace): Method to do what the name says ;-)
20790 (Tree::Namespaces): Property to get at the namespaces hashtable.
20792 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20795 * rootcontext.cs (IsNamespace): Fixed it :-)
20797 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20799 * class.cs (TypeContainer::FindMembers): Add support for
20801 (MethodCore): New class that encapsulates both the shared aspects
20802 of a Constructor and a Method.
20803 (Method, Constructor): Factored pieces into MethodCore.
20805 * driver.cs: Added --fatal which makes errors throw exceptions.
20806 Load System assembly as well as part of the standard library.
20808 * report.cs: Allow throwing exceptions on errors for debugging.
20810 * modifiers.cs: Do not use `parent', instead use the real type
20811 container to evaluate permission settings.
20813 * class.cs: Put Ravi's patch back in. He is right, and we will
20814 have to cope with the
20816 2001-09-14 Ravi Pratap <ravi@ximian.com>
20818 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20819 FamORAssem, not FamANDAssem.
20821 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20823 * driver.cs: Added --parse option that only parses its input files
20826 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20827 incorrect. IsTopLevel is not used to tell whether an object is
20828 root_types or not (that can be achieved by testing this ==
20829 root_types). But to see if this is a top-level *class* (not
20830 necessarly our "toplevel" container).
20832 2001-09-14 Ravi Pratap <ravi@ximian.com>
20834 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20835 parent instead of a direct call to GetType.
20837 2001-09-14 Ravi Pratap <ravi@ximian.com>
20839 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20840 Modifiers.TypeAttr. This should just be a call to that method.
20842 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20843 object so that we can determine if we are top-level or not.
20845 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20848 * enum.cs (Enum::Define): Ditto.
20850 * modifiers.cs (FieldAttr): Re-write.
20852 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20853 (TypeContainer::HaveStaticConstructor): New property to provide access
20854 to precisely that info.
20856 * modifiers.cs (MethodAttr): Re-write.
20857 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20859 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20860 of top-level types as claimed.
20862 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20864 * expression.cs (MemberLookup): Fruitless attempt to lookup
20865 constructors. Maybe I need to emit default constructors? That
20866 might be it (currently .NET emits this for me automatically).
20867 (Invocation::OverloadResolve): Cope with Arguments == null.
20868 (Invocation::EmitArguments): new function, shared by the new
20869 constructor and us.
20870 (Invocation::Emit): Handle static and instance methods. Emit
20871 proper call instruction for virtual or non-virtual invocations.
20872 (New::Emit): Implement.
20873 (New::Resolve): Implement.
20874 (MemberAccess:Resolve): Implement.
20875 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20876 to track instances.
20877 (FieldExpr::Resolve): Set type.
20879 * support.cs: Handle empty arguments.
20881 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20882 SimpleLookup): Auxiliary routines to help parse a qualifier
20885 Update qualifier_identifier rule.
20887 * codegen.cs: Removed debugging messages.
20889 * class.cs: Make this a global thing, this acts just as a "key" to
20890 objects that we might have around.
20892 (Populate): Only initialize method_builders_to_methods once.
20894 * expression.cs (PropertyExpr): Initialize type from the
20897 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20898 Resolve pattern. Attempt to implicitly convert value to boolean.
20901 * expression.cs: Set the type for the int32/int32 argument case.
20902 (Binary::ResolveOperator): Set the return type to boolean for
20903 comparission operators
20905 * typemanager.cs: Remove debugging print code.
20907 (Invocation::Resolve): resolve type.
20909 * class.cs: Allocate a MemberInfo of the correct size, as the code
20910 elsewhere depends on the test to reflect the correct contents.
20912 (Method::) Keep track of parameters, due to System.Reflection holes
20914 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20917 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20918 of the exact size and return that.
20920 (Class::LookupMethodByBuilder): New function that maps
20921 MethodBuilders to its methods. Required to locate the information
20922 on methods because System.Reflection bit us again.
20924 * support.cs: New file, contains an interface ParameterData and
20925 two implementations: ReflectionParameters and InternalParameters
20926 used to access Parameter information. We will need to grow this
20929 * expression.cs (Invocation::GetParameterData): implement a cache
20930 and a wrapper around the ParameterData creation for methods.
20931 (Invocation::OverloadResolve): Use new code.
20933 2001-09-13 Ravi Pratap <ravi@ximian.com>
20935 * class.cs (TypeContainer::EmitField): Remove and move into
20936 (Field::Define): here and modify accordingly.
20937 (Field.FieldBuilder): New member.
20938 (TypeContainer::Populate): Update accordingly.
20939 (TypeContainer::FindMembers): Implement.
20941 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20943 * statement.cs: (VariableInfo::VariableType): New field to be
20944 initialized with the full type once it is resolved.
20946 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20948 * parameter.cs (GetParameterInfo): Use a type cache to compute
20949 things only once, and to reuse this information
20951 * expression.cs (LocalVariableReference::Emit): Implement.
20952 (OpcodeCast::Emit): fix.
20954 (ParameterReference::Resolve): Implement.
20955 (ParameterReference::Emit): Implement.
20957 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
20958 that are expressions need to stay as Expressions.
20960 * typemanager.cs (CSharpName): Returns the C# name of a type if
20963 * expression.cs (Expression::ConvertImplicit): New function that
20964 implements implicit type conversions.
20966 (Expression::ImplicitReferenceConversion): Implements implicit
20967 reference conversions.
20969 (EmptyCast): New type for transparent casts.
20971 (OpcodeCast): New type for casts of types that are performed with
20972 a sequence of bytecodes.
20974 (BoxedCast): New type used for casting value types into reference
20975 types. Emits a box opcode.
20977 (Binary::DoNumericPromotions): Implements numeric promotions of
20978 and computation of the Binary::Type.
20980 (Binary::EmitBranchable): Optimization.
20982 (Binary::Emit): Implement code emission for expressions.
20984 * typemanager.cs (TypeManager): Added two new core types: sbyte
20987 2001-09-12 Ravi Pratap <ravi@ximian.com>
20989 * class.cs (TypeContainer::FindMembers): Method which does exactly
20990 what Type.FindMembers does, only we don't have to use reflection. No
20991 implementation yet.
20993 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
20994 typecontainer objects as we need to get at them.
20995 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
20997 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
20998 typecontainer object.
21000 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
21001 of just a Report object.
21003 2001-09-11 Ravi Pratap <ravi@ximian.com>
21005 * class.cs (Event::Define): Go back to using the prefixes "add_" and
21007 (TypeContainer::Populate): Now define the delegates of the type too.
21008 (TypeContainer.Delegates): Property to access the list of delegates defined
21011 * delegates.cs (Delegate::Define): Implement partially.
21013 * modifiers.cs (TypeAttr): Handle more flags.
21015 2001-09-11 Ravi Pratap <ravi@ximian.com>
21017 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
21019 (Operator::Define): Re-write logic to get types by using the LookupType method
21020 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
21021 (Indexer::Define): Ditto.
21022 (Event::Define): Ditto.
21023 (Property::Define): Ditto.
21025 2001-09-10 Ravi Pratap <ravi@ximian.com>
21027 * class.cs (TypeContainer::Populate): Now define operators too.
21028 (TypeContainer.Operators): New property to access the list of operators
21030 (Operator.OperatorMethodBuilder): New member to hold the method builder
21031 for the operator we are defining.
21032 (Operator::Define): Implement.
21034 2001-09-10 Ravi Pratap <ravi@ximian.com>
21036 * class.cs (Event::Define): Make the prefixes of the accessor methods
21037 addOn_ and removeOn_
21039 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
21040 of the location being passed in too. Ideally, this should go later since all
21041 error reporting should be done through the Report object.
21043 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
21044 (Populate): Iterate thru the indexers we have and define them too.
21045 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
21046 for the get and set accessors.
21047 (Indexer::Define): Implement.
21049 2001-09-09 Miguel de Icaza <miguel@ximian.com>
21051 * expression.cs (Binary::Resolve): Beginning of it. I scratched
21052 my previous implementation, did not work.
21054 * typemanager.cs: Add a couple of missing types (the longs).
21056 * literal.cs: Use TypeManager.bool_type instead of getting it.
21058 * expression.cs (EventExpr): New kind of expressions.
21059 (Expressio::ExprClassFromMemberInfo): finish
21061 2001-09-08 Miguel de Icaza <miguel@ximian.com>
21063 * assign.cs: Emit stores to static fields differently.
21065 2001-09-08 Ravi Pratap <ravi@ximian.com>
21067 * Merge in changes and adjust code to tackle conflicts. Backed out my
21068 code in Assign::Resolve ;-)
21070 2001-09-08 Ravi Pratap <ravi@ximian.com>
21072 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21073 instead Report.Error and also pass in the location.
21074 (CSharpParser::Lexer): New readonly property to return the reference
21075 to the Tokenizer object.
21076 (declare_local_variables): Use Report.Error with location instead of plain
21080 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21081 (Operator.CheckBinaryOperator): Ditto.
21083 * cs-parser.jay (operator_declarator): Update accordingly.
21085 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21086 (CheckBinaryOperator): Same here.
21088 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21089 on the name without any prefixes of namespace names etc. This is because we
21090 already might have something already fully qualified like
21091 'System.Console.WriteLine'
21093 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21095 2001-09-07 Ravi Pratap <ravi@ximian.com>
21097 * cs-tokenizer.cs (location): Return a string which also contains
21100 * expression.cs (ElementAccess): New class for expressions of the
21101 type 'element access.'
21102 (BaseAccess): New class for expressions of the type 'base access.'
21103 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21106 * cs-parser.jay (element_access): Implement action.
21107 (base_access): Implement actions.
21108 (checked_expression, unchecked_expression): Implement.
21110 * cs-parser.jay (local_variable_type): Correct and implement.
21111 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21113 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21115 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21116 name and the specifiers.
21118 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21120 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21121 making them all public ;-)
21123 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21126 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21128 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21130 (FieldExpr, PropertyExprs): New resolved expressions.
21131 (SimpleName::MemberStaticCheck): Perform static checks for access
21132 to non-static fields on static methods. Maybe this should be
21133 generalized for MemberAccesses.
21134 (SimpleName::ResolveSimpleName): More work on simple name
21137 * cs-parser.jay (primary_expression/qualified_identifier): track
21138 the parameter index.
21140 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21141 (EmitContext::EmitBoolExpression): Chain to expression generation
21142 instead of temporary hack.
21143 (::EmitStatementExpression): Put generic expression code generation.
21145 * assign.cs (Assign::Emit): Implement variable assignments to
21146 local variables, parameters and fields.
21148 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21150 * statement.cs (Block::GetVariableInfo): New method, returns the
21151 VariableInfo for a variable name in a block.
21152 (Block::GetVariableType): Implement in terms of GetVariableInfo
21154 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21155 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21157 2001-09-06 Ravi Pratap <ravi@ximian.com>
21159 * cs-parser.jay (operator_declaration): Continue on my quest : update
21160 to take attributes argument.
21161 (event_declaration): Ditto.
21162 (enum_declaration): Ditto.
21163 (indexer_declaration): Ditto.
21165 * class.cs (Operator::Operator): Update constructor accordingly.
21166 (Event::Event): Ditto.
21168 * delegate.cs (Delegate::Delegate): Same here.
21170 * enum.cs (Enum::Enum): Same here.
21172 2001-09-05 Ravi Pratap <ravi@ximian.com>
21174 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21176 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21178 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21179 being passed around as an arraylist.
21180 (Attributes::AddAttribute): Method to add attribute sections.
21182 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21183 (struct_declaration): Update accordingly.
21184 (constant_declaration): Update.
21185 (field_declaration): Update.
21186 (method_header): Update.
21187 (fixed_parameter): Update.
21188 (parameter_array): Ditto.
21189 (property_declaration): Ditto.
21190 (destructor_declaration): Ditto.
21192 * class.cs (Struct::Struct): Update constructors accordingly.
21193 (Class::Class): Ditto.
21194 (Field::Field): Ditto.
21195 (Method::Method): Ditto.
21196 (Property::Property): Ditto.
21197 (TypeContainer::OptAttribute): update property's return type.
21199 * interface.cs (Interface.opt_attributes): New member.
21200 (Interface::Interface): Update to take the extra Attributes argument.
21202 * parameter.cs (Parameter::Parameter): Ditto.
21204 * constant.cs (Constant::Constant): Ditto.
21206 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21207 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21208 the attributes as a parameter.
21209 (InterfaceProperty): Update constructor call.
21210 (InterfaceEvent): Ditto.
21211 (InterfaceMethod): Ditto.
21212 (InterfaceIndexer): Ditto.
21214 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21215 pass the attributes too.
21216 (interface_event_declaration): Ditto.
21217 (interface_property_declaration): Ditto.
21218 (interface_method_declaration): Ditto.
21219 (interface_declaration): Ditto.
21221 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21223 * class.cs (Method::Define): Track the "static Main" definition to
21224 create an entry point.
21226 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21227 EntryPoint if we find it.
21229 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21230 (EmitContext::ig): Make this variable public.
21232 * driver.cs: Make the default output file be the first file name
21233 with the .exe extension.
21235 Detect empty compilations
21237 Handle various kinds of output targets. Handle --target and
21238 rename -t to --dumper.
21240 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21241 methods inherited from Expression return now an Expression. This
21242 will is used during the tree rewriting as we resolve them during
21245 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21246 the spec. Missing entirely is the information about
21247 accessability of elements of it.
21249 (Expression::ExprClassFromMemberInfo): New constructor for
21250 Expressions that creates a fully initialized Expression based on
21251 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21254 (Invocation::Resolve): Begin implementing resolution of invocations.
21256 * literal.cs (StringLiteral): Implement Emit.
21258 2001-09-05 Ravi Pratap <ravi@ximian.com>
21260 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21263 2001-09-04 Ravi Pratap <ravi@ximian.com>
21265 * cs-parser.jay (attribute_arguments): Implement actions.
21266 (attribute): Fix bug in production. Implement action.
21267 (attribute_list): Implement.
21268 (attribute_target): Implement.
21269 (attribute_target_specifier, opt_target_specifier): Implement
21270 (CheckAttributeTarget): New method to check if the attribute target
21272 (attribute_section): Implement.
21273 (opt_attributes): Implement.
21275 * attribute.cs : New file to handle attributes.
21276 (Attribute): Class to hold attribute info.
21278 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21279 (attribute_section): Modify production to use 2 different rules to
21280 achieve the same thing. 1 s/r conflict down !
21281 Clean out commented, useless, non-reducing dimension_separator rules.
21283 * class.cs (TypeContainer.attributes): New member to hold list
21284 of attributes for a type.
21285 (Struct::Struct): Modify to take one more argument, the attribute list.
21286 (Class::Class): Ditto.
21287 (Field::Field): Ditto.
21288 (Method::Method): Ditto.
21289 (Property::Property): Ditto.
21291 * cs-parser.jay (struct_declaration): Update constructor call to
21292 pass in the attributes too.
21293 (class_declaration): Ditto.
21294 (constant_declaration): Ditto.
21295 (field_declaration): Ditto.
21296 (method_header): Ditto.
21297 (fixed_parameter): Ditto.
21298 (parameter_array): Ditto.
21299 (property_declaration): Ditto.
21301 * constant.cs (Constant::Constant): Update constructor similarly.
21302 Use System.Collections.
21304 * parameter.cs (Parameter::Parameter): Update as above.
21306 2001-09-02 Ravi Pratap <ravi@ximian.com>
21308 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21309 (TypeContainer.delegates): New member to hold list of delegates.
21311 * cs-parser.jay (delegate_declaration): Implement the action correctly
21312 this time as I seem to be on crack ;-)
21314 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21316 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21317 tell whether an identifier represents a namespace.
21319 * expression.cs (NamespaceExpr): A namespace expression, used only
21320 temporarly during expression resolution.
21321 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21322 utility functions to resolve names on expressions.
21324 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21326 * codegen.cs: Add hook for StatementExpressions.
21328 * class.cs: Fix inverted test for static flag in methods.
21330 2001-09-02 Ravi Pratap <ravi@ximian.com>
21332 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21333 to make it coincide with MS' number.
21334 (Operator::CheckBinaryOperator): Ditto.
21336 * ../errors/errors.txt : Remove error numbers added earlier.
21338 * ../errors/cs1019.cs : Test case for error # 1019
21340 * ../errros/cs1020.cs : Test case for error # 1020
21342 * cs-parser.jay : Clean out commented cruft.
21343 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21344 used anywhere - non-reducing rule.
21345 (namespace_declarations): Non-reducing rule - comment out.
21347 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21348 with TypeContainer::AddEnum.
21350 * delegate.cs : New file for delegate handling classes.
21351 (Delegate): Class for declaring delegates.
21353 * makefile : Update.
21355 * cs-parser.jay (delegate_declaration): Implement.
21357 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21359 * class.cs (Event::Define): Implement.
21360 (Event.EventBuilder): New member.
21362 * class.cs (TypeContainer::Populate): Update to define all enums and events
21364 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21365 readonly fields for all these cases ?
21367 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21369 * class.cs (Property): Revamp to use the convention of making fields readonly.
21370 Accordingly modify code elsewhere.
21372 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21373 the Define method of the Property class.
21375 * class.cs : Clean up applied patch and update references to variables etc. Fix
21377 (TypeContainer::Populate): Update to define all the properties we have. Also
21378 define all enumerations.
21380 * enum.cs (Define): Implement.
21382 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21384 * cs-parser.jay (overloadable_operator): The semantic value is an
21385 enum of the Operator class.
21386 (operator_declarator): Implement actions.
21387 (operator_declaration): Implement.
21389 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21390 validity of definitions.
21391 (Operator::CheckBinaryOperator): Static method to check for binary operators
21392 (TypeContainer::AddOperator): New method to add an operator to a type.
21394 * cs-parser.jay (indexer_declaration): Added line to actually call the
21395 AddIndexer method so it gets added ;-)
21397 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21398 already taken care of by the MS compiler ?
21400 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21402 * class.cs (Operator): New class for operator declarations.
21403 (Operator::OpType): Enum for the various operators.
21405 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21407 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21408 ostensibly handle this in semantic analysis.
21410 * cs-parser.jay (general_catch_clause): Comment out
21411 (specific_catch_clauses, specific_catch_clause): Ditto.
21412 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21413 (catch_args, opt_catch_args): New productions.
21414 (catch_clause): Rewrite to use the new productions above
21415 (catch_clauses): Modify accordingly.
21416 (opt_catch_clauses): New production to use in try_statement
21417 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21418 and re-write the code in the actions to extract the specific and
21419 general catch clauses by being a little smart ;-)
21421 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21422 Hooray, try and catch statements parse fine !
21424 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21426 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21427 string from the hashtable of variables.
21429 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21430 I end up making that mistake ;-)
21431 (catch_clauses): Fixed gross error which made Key and Value of the
21432 DictionaryEntry the same : $1 !!
21434 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21436 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21438 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21439 when the add and remove accessors are specified.
21441 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21443 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21444 information about indexer_declarator.
21445 (indexer_declarator): Implement actions.
21446 (parsing_indexer): New local boolean used to keep track of whether
21447 we are parsing indexers or properties. This is necessary because
21448 implicit_parameters come into picture even for the get accessor in the
21449 case of an indexer.
21450 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21452 * class.cs (Indexer): New class for indexer declarations.
21453 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21454 (TypeContainer::indexers): New member to hold list of indexers for the
21457 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21459 * cs-parser.jay (add_accessor_declaration): Implement action.
21460 (remove_accessor_declaration): Implement action.
21461 (event_accessors_declaration): Implement
21462 (variable_declarators): swap statements for first rule - trivial.
21464 * class.cs (Event): New class to hold information about event
21466 (TypeContainer::AddEvent): New method to add an event to a type
21467 (TypeContainer::events): New member to hold list of events.
21469 * cs-parser.jay (event_declaration): Implement actions.
21471 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21473 * cs-parser.jay (dim_separators): Implement. Make it a string
21474 concatenating all the commas together, just as they appear.
21475 (opt_dim_separators): Modify accordingly
21476 (rank_specifiers): Update accordingly. Basically do the same
21477 thing - instead, collect the brackets here.
21478 (opt_rank_sepcifiers): Modify accordingly.
21479 (array_type): Modify to actually return the complete type string
21480 instead of ignoring the rank_specifiers.
21481 (expression_list): Implement to collect the expressions
21482 (variable_initializer): Implement. We make it a list of expressions
21483 essentially so that we can handle the array_initializer case neatly too.
21484 (variable_initializer_list): Implement.
21485 (array_initializer): Make it a list of variable_initializers
21486 (opt_array_initializer): Modify accordingly.
21488 * expression.cs (New::NType): Add enumeration to help us
21489 keep track of whether we have an object/delegate creation
21490 or an array creation.
21491 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21492 members to hold data about array creation.
21493 (New:New): Modify to update NewType
21494 (New:New): New Overloaded contructor for the array creation
21497 * cs-parser.jay (array_creation_expression): Implement to call
21498 the overloaded New constructor.
21500 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21502 * class.cs (TypeContainer::Constructors): Return member
21503 constructors instead of returning null.
21505 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21507 * typemanager.cs (InitCoreTypes): Initialize the various core
21508 types after we have populated the type manager with the user
21509 defined types (this distinction will be important later while
21510 compiling corlib.dll)
21512 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21513 on Expression Classification. Now all expressions have a method
21514 `Resolve' and a method `Emit'.
21516 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21517 generation from working. Also add some temporary debugging
21520 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21522 * codegen.cs: Lots of code generation pieces. This is only the
21523 beginning, will continue tomorrow with more touches of polish. We
21524 handle the fundamentals of if, while, do, for, return. Others are
21525 trickier and I need to start working on invocations soon.
21527 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21530 * codegen.cs (EmitContext): New struct, used during code
21531 emission to keep a context. Most of the code generation will be
21534 * cs-parser.jay: Add embedded blocks to the list of statements of
21535 this block. So code generation proceeds in a top down fashion.
21537 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21539 * statement.cs: Add support for multiple child blocks.
21541 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21543 * codegen.cs (EmitCode): New function, will emit the code for a
21544 Block of code given a TypeContainer and its ILGenerator.
21546 * statement.cs (Block): Standard public readonly optimization.
21547 (Block::Block constructors): Link children.
21548 (Block::Child): Child Linker.
21549 (Block::EmitVariables): Emits IL variable declarations.
21551 * class.cs: Drop support for MethodGroups here, delay until
21553 (Method::): Applied the same simplification that I did before, and
21554 move from Properties to public readonly fields.
21555 (Method::ParameterTypes): Returns the parameter types for the
21556 function, and implements a cache that will be useful later when I
21557 do error checking and the semantic analysis on the methods is
21559 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21560 and made a method, optional argument tells whether this is a class
21561 or a structure to apply the `has-this' bit.
21562 (Method::GetCallingConvention): Implement, returns the calling
21564 (Method::Define): Defines the type, a second pass is performed
21565 later to populate the methods.
21567 (Constructor::ParameterTypes): implement a cache similar to the
21568 one on Method::ParameterTypes, useful later when we do semantic
21571 (TypeContainer::EmitMethod): New method. Emits methods.
21573 * expression.cs: Removed MethodGroup class from here.
21575 * parameter.cs (Parameters::GetCallingConvention): new method.
21577 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21579 * class.cs (TypeContainer::Populate): Drop RootContext from the
21582 (Constructor::CallingConvention): Returns the calling convention.
21583 (Constructor::ParameterTypes): Returns the constructor parameter
21586 (TypeContainer::AddConstructor): Keep track of default constructor
21587 and the default static constructor.
21589 (Constructor::) Another class that starts using `public readonly'
21590 instead of properties.
21592 (Constructor::IsDefault): Whether this is a default constructor.
21594 (Field::) use readonly public fields instead of properties also.
21596 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21597 track of static constructors; If none is used, turn on
21598 BeforeFieldInit in the TypeAttributes.
21600 * cs-parser.jay (opt_argument_list): now the return can be null
21601 for the cases where there are no arguments.
21603 (constructor_declarator): If there is no implicit `base' or
21604 `this', then invoke the default parent constructor.
21606 * modifiers.cs (MethodAttr): New static function maps a set of
21607 modifiers flags into a MethodAttributes enum
21608 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21609 MethodAttr, TypeAttr to represent the various mappings where the
21610 modifiers are used.
21611 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21613 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21615 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21618 * interface.cs (PopulateIndexer): Implemented the code generator
21619 for interface indexers.
21621 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21623 * interface.cs (InterfaceMemberBase): Now we track the new status
21626 (PopulateProperty): Implement property population. Woohoo! Got
21627 Methods and Properties going today.
21629 Removed all the properties for interfaces, and replaced them with
21630 `public readonly' fields.
21632 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21634 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21635 initialize their hashtables/arraylists only when they are needed
21636 instead of doing this always.
21638 * parameter.cs: Handle refs and out parameters.
21640 * cs-parser.jay: Use an ArrayList to construct the arguments
21641 instead of the ParameterCollection, and then cast that to a
21644 * parameter.cs: Drop the use of ParameterCollection and use
21645 instead arrays of Parameters.
21647 (GetParameterInfo): Use the Type, not the Name when resolving
21650 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21652 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21653 and instead use public readonly fields.
21655 * class.cs: Put back walking code for type containers.
21657 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21659 * class.cs (MakeConstant): Code to define constants.
21661 * rootcontext.cs (LookupType): New function. Used to locate types
21664 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21666 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21667 this System.Reflection code is. Kudos to Microsoft
21669 * typemanager.cs: Implement a type cache and avoid loading all
21670 types at boot time. Wrap in LookupType the internals. This made
21671 the compiler so much faster. Wow. I rule!
21673 * driver.cs: Make sure we always load mscorlib first (for
21674 debugging purposes, nothing really important).
21676 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21677 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21679 * rootcontext.cs: Lookup types on their namespace; Lookup types
21680 on namespaces that have been imported using the `using' keyword.
21682 * class.cs (TypeContainer::TypeAttr): Virtualize.
21683 (Class::TypeAttr): Return attributes suitable for this bad boy.
21684 (Struct::TypeAttr): ditto.
21685 Handle nested classes.
21686 (TypeContainer::) Remove all the type visiting code, it is now
21687 replaced with the rootcontext.cs code
21689 * rootcontext.cs (GetClassBases): Added support for structs.
21691 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21693 * interface.cs, statement.cs, class.cs, parameter.cs,
21694 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21695 Drop use of TypeRefs, and use strings instead.
21697 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21701 * class.cs (Struct::Struct): set the SEALED flags after
21702 checking the modifiers.
21703 (TypeContainer::TypeAttr): new property, returns the
21704 TypeAttributes for a class.
21706 * cs-parser.jay (type_list): Oops, list production was creating a
21707 new list of base types.
21709 * rootcontext.cs (StdLib): New property.
21710 (GetInterfaceTypeByName): returns an interface by type name, and
21711 encapsulates error handling here.
21712 (GetInterfaces): simplified.
21713 (ResolveTree): Encapsulated all the tree resolution here.
21714 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21717 * driver.cs: Add support for --nostdlib, to avoid loading the
21718 default assemblies.
21719 (Main): Do not put tree resolution here.
21721 * rootcontext.cs: Beginning of the class resolution.
21723 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21725 * rootcontext.cs: Provide better error reporting.
21727 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21729 * rootcontext.cs (CreateInterface): Handle the case where there
21730 are no parent interfaces.
21732 (CloseTypes): Routine to flush types at the end.
21733 (CreateInterface): Track types.
21734 (GetInterfaces): Returns an array of Types from the list of
21735 defined interfaces.
21737 * typemanager.c (AddUserType): Mechanism to track user types (puts
21738 the type on the global type hash, and allows us to close it at the
21741 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21743 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21744 RecordInterface instead.
21746 * cs-parser.jay: Updated to reflect changes above.
21748 * decl.cs (Definition): Keep track of the TypeBuilder type that
21749 represents this type here. Not sure we will use it in the long
21750 run, but wont hurt for now.
21752 * driver.cs: Smaller changes to accomodate the new code.
21754 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21757 * rootcontext.cs (CreateInterface): New method, used to create
21758 the System.TypeBuilder type for interfaces.
21759 (ResolveInterfaces): new entry point to resolve the interface
21761 (CodeGen): Property, used to keep track of the code generator.
21763 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21765 * cs-parser.jay: Add a second production for delegate_declaration
21768 (enum_body): Put an opt_comma here instead of putting it on
21769 enum_body or enum_member_declarations so we can handle trailing
21770 commas on enumeration members. Gets rid of a shift/reduce.
21772 (type_list): Need a COMMA in the middle.
21774 (indexer_declaration): Tell tokenizer to recognize get/set
21776 * Remove old targets.
21778 * Re-add the parser target.
21780 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21782 * cs-parser.jay: Add precendence rules for a number of operators
21783 ot reduce the number of shift/reduce conflicts in the grammar.
21785 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21787 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21790 Get rid of old crufty code.
21792 * rootcontext.cs: Use this to keep track of the parsed
21793 representation and the defined types available to the program.
21795 * gen-treedump.cs: adjust for new convention.
21797 * type.cs: Split out the type manager, and the assembly builder
21800 * typemanager.cs: the type manager will live here now.
21802 * cil-codegen.cs: And the code generator here.
21804 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21806 * makefile: Fixed up for easy making.
21808 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21810 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21813 (unary_expression): Expand pre_increment_expression and
21814 post_decrement_expression to reduce a shift/reduce.
21816 2001-07-11 Simon Cozens
21818 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21820 Improve allow_keyword_as_indent name.
21822 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21824 * Adjustments for Beta2.
21826 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21828 * decl.cs: Added `Define' abstract method.
21829 (InTransit): new property, used to catch recursive definitions.
21831 * interface.cs: Implement `Define'.
21833 * modifiers.cs: Map Modifiers.constants to
21834 System.Reflection.TypeAttribute flags.
21836 * class.cs: Keep track of types and user-defined types.
21837 (BuilderInit): New method for creating an assembly
21838 (ResolveType): New function to launch the resolution process, only
21839 used by interfaces for now.
21841 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21842 that are inserted into the name space.
21844 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21846 * ARGH. I have screwed up my tree so many times due to the use of
21847 rsync rather than using CVS. Going to fix this at once.
21849 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21852 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21854 * Experiment successful: Use System.Type rather that our own
21857 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21859 * cs-parser.jay: Removed nsAliases from here.
21861 Use new namespaces, handle `using XXX;'
21863 * namespace.cs: Reimplemented namespace handling, use a recursive
21864 definition of the class. Now we can keep track of using clauses
21865 and catch invalid using clauses.
21867 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21869 * gen-treedump.cs: Adapted for all the renaming.
21871 * expression.cs (Expression): this class now has a Type property
21872 which returns an expression Type.
21874 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21875 `Type', as this has a different meaning now in the base
21877 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21879 * interface.cs, class.cs: Removed from all the sources the
21880 references to signature computation, as we can not do method
21881 signature computation during the parsing time, as we are not
21882 trying to solve at that point distinguishing:
21886 void a (NS.Blah x) {}
21889 Which depending on the context might be valid or not, as we do not
21890 know if Blah is the same thing as NS.Blah at that point.
21892 * Redid everything so the code uses TypeRefs now instead of
21893 Types. TypeRefs are just temporary type placeholders, that need
21894 to be resolved. They initially have a pointer to a string and the
21895 current scope in which they are used. This is used later by the
21896 compiler to resolve the reference to an actual Type.
21898 * DeclSpace is no longer a CIR.Type, and neither are
21899 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21900 are all DeclSpaces, but no Types.
21902 * type.cs (TypeRefManager): This implements the TypeRef manager,
21903 which keeps track of all the types that need to be resolved after
21904 the parsing has finished.
21906 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21908 * ARGH. We are going to have to store `foreach' as a class rather
21909 than resolving it, as we need to verify error 1579 after name
21910 resolution. *OR* we could keep a flag that says `This request to
21911 IEnumerator comes from a foreach statement' which we can then use
21912 to generate the error.
21914 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21916 * class.cs (TypeContainer.AddMethod): we now add methods to the
21917 MethodGroup instead of the method hashtable.
21919 * expression.cs: Add MethodGroup abstraction, which gets us one
21920 step closer to the specification in the way we handle method
21923 * cs-parser.jay (primary_expression): qualified_identifier now
21924 tried to match up an identifier to a local variable reference or
21925 to a parameter reference.
21927 current_local_parameters is now a parser global variable that
21928 points to the current parameters for the block, used during name
21931 (property_declaration): Now creates an implicit `value' argument to
21934 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21936 * parameter.cs: Do not use `param' arguments as part of the
21937 signature, per the spec.
21939 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21941 * decl.cs: Base class for classes, structs and interfaces. This
21942 is the "Declaration Space"
21944 * cs-parser.jay: Use CheckDef for checking declaration errors
21945 instead of having one on each function.
21947 * class.cs: Factor out some code for handling error handling in
21948 accordance to the "Declarations" section in the "Basic Concepts"
21949 chapter in the ECMA C# spec.
21951 * interface.cs: Make all interface member classes derive from
21952 InterfaceMemberBase.
21954 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21956 * Many things: all interfaces are parsed and generated in
21957 gen-treedump. Support for member variables, constructors,
21958 destructors, properties, constants is there.
21960 Beginning of the IL backend, but very little done, just there for
21963 2001-04-29 Miguel de Icaza <miguel@ximian.com>
21965 * cs-parser.jay: Fix labeled statement.
21967 * cs-tokenizer.cs (escape): Escape " and ' always.
21968 ref_line, ref_name: keep track of the line/filename as instructed
21969 by #line by the compiler.
21972 2001-04-27 Miguel de Icaza <miguel@ximian.com>
21974 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
21975 to match the values in System.CodeDOM.
21977 Divid renamed to Divide.
21979 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
21981 (Statements.set): remove.
21983 * System.CodeDOM/CodeCatchClause.cs: always have a valid
21986 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
21987 falseStatements always have valid values.
21989 * cs-parser.jay: Use System.CodeDOM now.