1 2005-12-16 Raja R Harinath <rharinath@novell.com>
4 * enum.cs (EnumMember.EnumMember): Pass the parent_enum as the
5 'parent' argument to the base constructor.
7 Remove all mention of TypeContainer from decl.cs.
8 * decl.cs (MemberCore.Parent): Change into a DeclSpace.
9 (MemberCore.MemberCore): Change type of 'parent' argument to DeclSpace.
10 (DeclSpace.DeclSpace): Likewise.
11 (DeclSpace.DefineMembers): Remove unused argument.
12 * cs-parser.jay (pop_current_class): Update to changes. Simplify
13 debugging check -- we don't care if the debug code throws an
14 InvalidCastException instead of an InternalErrorException.
15 * class.cs (TypeContainer.DefineMembers): Update to changes.
16 (TypeContainer.DoDefineMembers): Likewise.
17 (TypeContainer.GetMethods): Likewise.
18 (PropertyMember.Define): Likewise.
19 (MemberBase.Parent): New property that forwards to
20 MemberCore.Parent, but ensures that we get a TypeContainer.
21 * rootcontext.cs (RootContext.PopulateCoreType): Update to changes.
22 (RootContext.PopulateTypes): Likewise. Remove special case code
23 for !RootContext.StdLib: DefineMembers is idempotent.
25 2005-12-14 Miguel de Icaza <miguel@novell.com>
27 * convert.cs (ExplicitConversionCore): Check the return value from
28 ExplicitConversionCore which can return null on failure. Fixes #76914
30 2005-12-13 Marek Safar <marek.safar@seznam.cz>
32 * class.cs (Method.ApplyAttributeBuilder): Test out modifier properly.
34 2005-12-11 Atsushi Enomoto <atsushi@ximian.com>
36 * doc.cs : The search for referenced namespace was insufficient to
37 get global one as it used to do. Fixed bug #76965.
39 2005-12-10 Atsushi Enomoto <atsushi@ximian.com>
41 * doc.cs : check name in cref in the last phase that whether it is
44 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
46 * cs-tokenizer.cs : reverted the latest change: it somehow broke
49 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
51 * doc.cs : so it turned out that we cannot skip override check for
52 interface members. Fixed bug #76954.
54 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
56 * cs-tokenizer.cs : fixed bug #75984:
57 - #warning and #error should not be handled when the source line
59 - #line is not checked strictly when the source line is disabled.
60 - #define and #undef is on the other hand checked strictly at any
63 2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
65 * cs-tokenizer.cs : missing Location (actually, filename) in one of
68 2005-12-05 Marek Safar <marek.safar@seznam.cz>
70 * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only.
72 * class.cs (EmitFieldInitializers): Simplified and fixed to work with
74 (FieldBase.EmitInitializer): Moved from TypeContainer and simplified.
75 (FieldBase.Initializer): Initializer is now optional.
76 (EventField.Define): Only event field can have initializer.
78 * codegen.cs (EmitContext): DeclSpace is not readonly (small hack).
80 * const.cs (Const): Reuse initializer.
82 * cs-parser.jay: Updated after FieldBase changes.
83 Added current_array_type to simplify array initializers.
85 * ecore.cs (NullCast.IsDefaultValue): Implemented.
87 * expression.cs, iterators.cs: Updated.
89 * namespace.cs (NamespaceEntry): Made UsingFound private.
91 2005-12-05 Marek Safar <marek.safar@seznam.cz>
93 * parameterCollection.cs: Obsolete, removed.
94 * parser.cs: Obsolete, removed.
96 2005-12-05 Marek Safar <marek.safar@seznam.cz>
99 * class.cs (Constructor.Emit): Set obsolete checking for whole context.
101 * enum.cs (Enum.Define): Set obsolete context here.
103 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
106 - FindDocumentedMember() now expects 1) paramList as null
107 when "we don't have to check the number of parameters" and
108 2) Type.EmptyTypes when "there is no arguments".
109 - Introduced FoundMember struct to hold the exact type which was
110 used to find the documented member (the above change broke
111 test-xml-044; it might be better just to use DeclaringType than
112 what MS does, like this change does, but it depends on usage.)
114 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
116 * doc.cs : documented member might be from DeclaringType for nested
117 types. Fixed bug #76782.
119 2005-12-03 Ben Maurer <bmaurer@ximian.com>
121 * anonymous.cs: Have the param code handle leaving copies on the
122 stack etc. Allows anonymous params to take part in the assignment
123 code (++, +=, etc). Fixes bug #76550
125 * expression.cs: Handle the prepare_for_load/leave_copy by passing
126 it down to the anon code.
128 * iterators.cs: Use dummy var here
130 * codegen.cs: Handle new vars
132 2005-12-01 Marek Safar <marek.safar@seznam.cz>
135 * class.cs (MethodData.Define): Set proper Obsolete context.
137 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
139 (FieldExpr.DoResolve): Ditto.
141 2005-12-01 Marek Safar <marek.safar@seznam.cz>
144 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
145 parent is not obsolete.
147 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
149 * doc.cs : (FindDocumentedMember) find parameterless members first
150 and get CS0419 in the early stage. Fixed first case of bug #76727.
152 2005-11-30 Marek Safar <marek.safar@seznam.cz>
155 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
156 no error was reported.
158 *expression.cs (Binary.DoResolve): left can be null.
160 2005-11-22 Marek Safar <marek.safar@seznam.cz>
163 * class.cs (MethodData.Emit): Parameters should be labeled first.
165 2005-11-21 Marek Safar <marek.safar@seznam.cz>
168 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
170 2005-11-18 Marek Safar <marek.safar@seznam.cz>
172 * attribute.cs (AreParametersCompliant): Moved to Parameter.
174 * class.cs (MethodCore): Parameter clean up.
175 (IMethodData): Added ParameterInfo.
176 (MethodData): Parameter clean up.
177 (Indexer.Define): Parameter clean up.
189 * typemanager.cs: Parameter clean up.
191 * delegate.cs (Define): Get rid of duplicated code.
193 * expression.cs (ParameterReference): Removed useless parameters
197 * parameter.cs (ParamsParameter): New class, params specialization.
198 (ArglistParameter): Attemp to separate arglist.
199 (Parameter): Refactored to be reusable and faster.
200 (Parameter.Modifier): Made understandable.
201 (Parameters): Changed to be used as a class for `this' assembly
202 parameters. Refactored to use new specialized classes.
204 * support.cs (ParameterData): Added Types property.
205 (InternalParameters): Deleted.
207 2005-08-20 Martin Baulig <martin@ximian.com>
209 Merging this patch from GMCS to fix #75867.
211 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
212 scope if we don't already have it.
214 2005-11-17 Martin Baulig <martin@ximian.com>
217 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
218 inherit the scope from our parent. Fixes #76653.
220 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
222 * doc.cs : the previous patch does not actually fix the bug.
223 PropertyInfo override check is now implemented and really fixed it.
224 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
226 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
228 * doc.cs : apply "override filter" also to properties.
231 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
233 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
234 no need to check overrides. For classes, omit those results from
235 interfaces since they must exist in the class. Fixed bug #76726.
237 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
239 * typemanager.cs : (GetFullNameSignature) differentiate indexers
240 with different parameters. Fixed the second problem in #76685.
242 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
244 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
245 get expected 'protected' access in CheckValidFamilyAccess()).
248 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
250 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
251 Fixed bug #76705. CS1569 was incorrectly commented out.
253 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
255 * doc.cs : use Invocation.IsOverride() to do real override check.
256 * expression.cs : made Invocation.IsOverride() internal.
258 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
260 * doc.cs : use TypeManager.FindMembers() instead of (possible)
261 TypeBuilder.FindMembers() and filter overriden base members out.
264 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
266 * doc.cs : ref/out parameters are represented as '@' (instead of
267 '&' in type FullName). Fixed bug #76630 (additionally crefs).
269 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
271 * doc.cs : when there was no '.' in cref to methods in doc comment,
272 then parameters were missing in the output. Fixed bug #76691.
274 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
276 * driver.cs : don't output docs when there is an error.
279 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
282 Now it should detect indexers. Fixed primary concern in bug #76685.
283 Fixed CS0419 message to not show the identical member signature in
286 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
288 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
289 instead of Type.FindMembers() since it does not handle events.
292 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
294 * codegen.cs: Fixed typo (speficied -> specified).
296 2005-11-11 Marek Safar <marek.safar@seznam.cz>
299 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
301 2005-11-11 Marek Safar <marek.safar@seznam.cz>
303 * attribute.cs: Changed error message.
305 * cs-tokenizer.cs: One more check.
307 2005-11-10 Marek Safar <marek.safar@seznam.cz>
309 * statement.cs (Block.Resolve): Ignore empty statement.
311 2005-11-10 Marek Safar <marek.safar@seznam.cz>
313 * report.cs: Made error/warning methods more strict to avoid
316 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
317 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
318 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
319 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
321 2005-11-08 Marek Safar <marek.safar@seznam.cz>
323 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
324 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
326 * class.cs (TypeContainer.IsComImport): New property.
327 (Constructor.Define): Create proper ctor for ComImport types.
329 * expression.cs (New.CheckComImport): Fixed.
331 2005-11-07 Miguel de Icaza <miguel@novell.com>
333 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
334 that a parameter has been captured does not mean that we do not
335 have to do the rest of the processing. This fixes the second part
336 of #76592. If there was another anonymous method capturing
337 values in the past, the Scope would never be set for the second
338 method that captured the same parameter.
340 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
341 properly manipulate the stack. Second part of fix for #76592.
343 * expression.cs (New): Add support for invoking "new" on
344 interfaces that have been flagged with the ComImport attribute and
345 the CoClass. Fixes #76637
347 * statement.cs (Try.DoEmit): When a variable is captured, do not
348 try to emit the vi.LocalBuilder variable as it has been captured.
349 Create a temporary variable and store the results on the
350 FieldBuilder. Fixes #76642
352 2005-11-07 Marek Safar <marek.safar@seznam.cz>
354 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
356 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
358 * expression.cs (Binary.DoResolve): Added && optimalization.
360 * typemanager.cs (AddUserType): Removed useless argument.
362 2005-11-04 Marek Safar <marek.safar@seznam.cz>
364 * statement.cs (Block.variables): Uses ListDictionary.
366 2005-11-03 Marek Safar <marek.safar@seznam.cz>
369 * class.cs (PartialContainer.EmitType): Customized to emit
371 (ClassPart.ApplyAttributeBuilder): Transform security attribute
374 2005-11-03 Marek Safar <marek.safar@seznam.cz>
377 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
378 access has to be fixed.
380 * typemanager.cs (IsUnmanagedType): Wrong common field type.
382 2005-11-01 Marek Safar <marek.safar@seznam.cz>
385 * ecore.cs (NullCast.Reduce): Implemented.
387 * expression.cs (ArrayCreation.CheckIndices): Correcly check
390 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
392 (Foreach.Resolve): Catch null properly.
394 2005-10-29 Marek Safar <marek.safar@seznam.cz>
396 * cs-tokenizer.cs: Warning text fix.
398 * driver.cs: AllWarningNumbers exposed on public interface.
400 * report.cs (): Reviewed warning numbers.
401 (IsValidWarning): Use binary search.
403 2005-10-29 Marek Safar <marek.safar@seznam.cz>
405 * driver.cs: Implemeted resource visibility.
406 (Resources): New class for code sharing between /res: and
409 2005-10-28 Marek Safar <marek.safar@seznam.cz>
412 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
415 * convert (Convert.ImplicitReferenceConversion): NullCast holds
418 * ecore.cs (NullCast): Child is contant only.
420 * literal.cs (NullLiteral.Reduce): null can be converted to any
423 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
425 * driver.cs: Use Encoding.Default as default code page instead
428 2005-10-27 Raja R Harinath <rharinath@novell.com>
431 * expression.cs (Invocation.Error_InvalidArguments): Handle
432 __arglist parameters.
433 (Invocation.VerifyArgumentsCompat): Likewise.
434 * support.cs (ReflectionParameters.GetSignatureForError): Print
435 __arglist parameters.
436 (InternalParamters.GetSignatureForError): Likewise.
437 * parameter.cs (Parameters.GetSignatureForError): Likewise.
439 2005-10-26 Marek Safar <marek.safar@seznam.cz>
441 * attribute.cs (GetPropertyValue): Made public.
443 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
445 Add new property WrapNonExceptionThrows to handle 2.0 assembly
447 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
450 * driver.cs: Reflect method name change.
452 * statement.cs (Try.Resolve): Warn when try has both general
455 * typemanager.cs: runtime_compatibility_attr_type new predefined
458 2005-10-26 Raja R Harinath <harinath@gmail.com>
461 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
462 treat it as an empty parameter list.
464 2005-10-26 Raja R Harinath <rharinath@novell.com>
467 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
468 ResolveAsTypeStep silent.
469 * statement.cs (Block.AddConstant): Mark block as used.
470 (Block.ResolveMeta): Avoid piling on error messages
471 if a constant initializer resolution fails.
473 2005-10-25 Raja R Harinath <rharinath@novell.com>
475 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
477 (NamespaceEntry.VerifyAllUsing): New.
478 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
479 behaviour. Delegates actual resolution of alias to ...
480 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
481 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
483 * driver.cs (Driver.MainDriver): Update.
485 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
486 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
488 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
490 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
491 RootNamespace.DefineNamespacesForAll.
493 2005-10-24 Raja R Harinath <harinath@gmail.com>
495 * typemanager.cs (assemblies, external_aliases, modules)
496 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
497 (ComputeNamespaces, GetRootNamespace): Remove extra staging
498 overhead. Move resposibility ...
499 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
500 * driver.cs, attribute.cs, codegen.cs: Update to changes.
502 2005-10-23 Raja R Harinath <harinath@gmail.com>
504 * namespace.cs (RootNamespace.all_namespaces): Renamed from
505 cached_namespaces. Improve usage.
506 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
507 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
508 Move from GlobalRootNamespace and simplify.
509 (RootNamespace.Global): Make instance variable.
510 (RootNamespace.RootNamespace): Add "alias name" parameter.
511 (GlobalRootNamespace): Simplify drastically.
512 (Namespace.Lookup): Don't use GetNamespace.
513 * typemanager.cs (GetRootNamespace): Rename from
514 ComputeNamespaceForAlias.
515 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
517 2005-10-23 Marek Safar <marek.safar@seznam.cz>
519 * anonymous.cs (AnonymousContainer): Don't crash when container
522 2005-10-23 Marek Safar <marek.safar@seznam.cz>
524 * expression.cs (Binary.DoResolve): Warn when comparing same
527 2005-10-23 Marek Safar <marek.safar@seznam.cz>
530 * expression.cs (Binary.DoResolve): It looks like there are no
531 convetsion rules in enum context.
533 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
535 Add support for extern alias qualifiers.
536 * typemanager.cs: Move some LookupTypeReflection code
537 to namespace.cs, to have cleaner code. Added some methods
538 to help us keep track of the extern aliased references.
539 * driver.cs: Add suport for extern alias assemblies on command
540 line and check for their warnings/errors. Also keep track of the
541 extern aliased assemblies.
542 * namespace.cs: Move the global functionality of Namespace
543 to GlobalRootNamespace/RootNamespace. Now the global namespace
544 is GlobalRootNamespace.Globa. Also the code moved from
545 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
546 Finally added LocalAliasEntry (AliasEntry before) and
547 ExternAliasEntry, to handle alias statements.
548 * cs-parser.jay: Add support in the grammar for extern alias
550 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
551 Update callings to Namespace (now in GlobalRootNamespace).
553 2005-10-18 Raja R Harinath <rharinath@novell.com>
556 * class.cs (TypeContainer.DefineType): Move updating of
557 topological sort earlier in the code.
558 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
560 2005-10-18 Marek Safar <marek.safar@seznam.cz>
563 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
565 * constant.cs (Constant.TryReduce): Moved from Cast class.
566 (Reduce): Made little bit more OO and fixed missing conversions.
568 * ecore.cs (Reduce): Implemented.
569 (Binary.EnumLiftUp): New method to upgrade values to enum values.
571 * literal.cs (Reduce): Implemented.
573 * class.cs: Reverted Miguel's wrong commit.
575 2005-10-14 Miguel de Icaza <miguel@novell.com>
577 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
579 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
581 * cs-parser.jay, expression.cs : CS0214 was missing error location
582 for constants. Fixed bug #76404.
584 2005-10-11 Marek Safar <marek.safar@seznam.cz>
587 * convert.cs (ExplicitConversionCore): Fixed object->enum
590 2005-10-10 Raja R Harinath <rharinath@novell.com>
592 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
594 (PropertyExpr.EmitCall): Likewise.
595 * expression.cs (Invocation.EmitArguments): Handle case where
597 (Invocation.EmitCall): Avoid allocating temporary variable if
598 there are no arguments.
600 2005-10-07 Raja R Harinath <rharinath@novell.com>
603 * convert.cs (ImplicitConversionStandard): Move conversion of
604 void* to arbitrary pointer types ...
605 (ExplicitConversionStandard): .. here.
606 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
607 error to always print typenames.
609 2005-10-07 Raja R Harinath <rharinath@novell.com>
611 * convert.cs (GetConversionOperator): Rename from
612 GetConversionOperators. Move operator selection code from ...
613 (UserDefinedConversion): ... here.
615 2005-10-06 Marek Safar <marek.safar@seznam.cz>
617 * convert.cs (ExplicitConversionCore): Removed duplicate enum
620 2005-10-05 Marek Safar <marek.safar@seznam.cz>
622 * assign.cs (Assign.DoResolve): Error method changed.
624 * cfold.cs (DoConstantNumericPromotions): Error method changed.
626 * const.cs (ResolveValue): Reset in_transit immediately.
628 * constant.cs: Error method changed.
630 * convert.cs: Removed useless location parameter.
631 (ExplicitNumericConversion): Don't do double enum check.
632 (ExplicitConversionCore): Renamed from ExplicitConversion.
633 (ExplicitUnsafe): Extracted from ExplicitConversion.
634 (ExplicitConversion): Uses for error reporting.
636 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
638 (ResolveBoolean): Uses common error method.
639 (CastToDecimal): Get rid of ec.
640 (CastFromDecimal): Optimized.
641 (ConvCast): Get rid of ec.
643 * enum.cs (ResolveValue): Reset in_transit immediately.
644 (Emit): Return after first error.
646 * expression.cs: Convert changes.
648 * literal.cs: Error method changed.
650 * statement.cs: Error method changed.
652 2005-10-03 Raja R Harinath <rharinath@novell.com>
654 * support.cs (SeekableStreamReader.Position): Don't error out when
655 the requested position is just beyond the end of the current
658 2005-09-28 Raja R Harinath <rharinath@novell.com>
660 * support.cs (SeekableStreamReader): Simplify drastically. Don't
661 try to keep in sync with the byte count of the underlying Stream.
662 However, this limits us to a window size of 2048 characters: i.e.,
663 the maximum lookahead of our lexer/parser can be 2048 characters.
665 2005-09-28 Marek Safar <marek.safar@seznam.cz>
668 * driver.cs: Fix compilation files with full root path.
670 2005-09-25 Miguel de Icaza <miguel@novell.com>
672 * report.cs (SymbolRelatedToPreviousError): Format the output so
673 it does not use an open parenthesis that is never closed.
675 * driver.cs: Follow coding guidelines
677 2005-09-27 Marek Safar <marek.safar@seznam.cz>
680 * const.cs (Const.ResolveValue): Check for assigning non-null
681 value to reference type.
683 2005-09-27 Marek Safar <marek.safar@seznam.cz>
685 * anonymous.cs: Implemented ExprClassName.
687 * assign.cs (Assign.DoResolve): Don't chrash when type is not
690 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
693 * class.cs (StaticClass.DefineContainerMembers): Report protected
696 * codegen.cs: if(ed) PRODUCTION.
698 * convert.cs (Error_CannotImplicitConversion): Better error
701 * cs-parser.jay: More error checks.
703 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
705 * driver.cs (CSCParseOption): Enabled wrong option check.
707 * ecore.cs (Expression.ExprClassName): Turned to property.
708 (MemberExpr.CheckIntermediateModification): For checking boxed
709 value types modification.
711 * statement.cs (Fixed.Resolve): Expression type must be
712 convertible to fixed type.
713 (CollectionForeach.GetEnumeratorFilter,TryType):
714 Small refactoring for easier error checking.
716 2005-09-26 Marek Safar <marek.safar@seznam.cz>
718 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
721 * class.cs (GeneratedBaseInitializer): New class for customization
722 compiler generated initializers.
723 (MemberBase.DoDefine): Check Obsolete attribute here.
724 (FieldMember.DoDefine): Ditto.
726 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
729 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
730 (MemberCore.GetObsoleteAttribute): Removed argument.
731 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
732 (MemberCore.CheckObsoleteType): New helper.
736 * statement.cs: Updates after MemberCore changes.
738 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
739 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
741 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
742 obsolete attribute for compiler construct.
743 (As.DoResolve): Cache result.
745 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
747 2005-09-26 Raja R Harinath <rharinath@novell.com>
750 * expression.cs (This.VerifyFixed): In a value type T, the type of
751 'this' is T&, iow, 'this' is either an out or ref parameter. In a
752 value type R, 'this' is treated as a value parameter.
754 2005-09-22 Miguel de Icaza <miguel@novell.com>
756 * statement.cs (Lock): Use the TemporaryVariable class instead of
757 manually using local variables as those do not work when variables
760 * ecore.cs: Moved the TemporaryVariable class from being a nested
761 class inside Foreach to be a public class that can be employed in
764 2005-09-19 Marek Safar <marek.safar@seznam.cz>
766 * cs-parser.jay: interface_accessors replaced by
767 accessor_declarations.
769 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
772 * statement.cs (GotoCase.Resolve): Convert null constant to
774 (SwitchLabel.ResolveAndReduce): Ditto.
775 (SwitchLabel.NullStringCase): Custom null stamp.
776 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
778 typemanager.cs (CSharpSignature): Don't skip first argument
781 2005-09-18 Miguel de Icaza <miguel@novell.com>
783 * driver.cs: Set InEmacs based on the environment variable EMACS.
785 * location.cs (InEmacs): in this mode, do not report column
786 location as it confuses Emacs.
788 2005-09-16 Marek Safar <marek.safar@seznam.cz>
790 * cfold.cs, constant.cs, convert.cs, ecore.cs,
791 expression.cs, iterators.cs, literal.cs: Store constants and
794 * class.cs (MemberBase.ShortName): Pass location.
796 * cs-parser.jay: Some location fixes.
798 * ecore.cs (Expression.Location): Made virtual.
800 2005-09-05 Miguel de Icaza <miguel@novell.com>
802 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
803 if the underlying types are the same, otherwise we need to produce
804 code that will do the proper cast.
806 This was exposed by Marek's constant rewrite which produced
807 invalid code for the call site:
814 This fixes test-49.cs
816 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
818 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
819 Type/Object should be allowed as well. Fixed bug #75968.
821 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
823 * expression.cs : (Binary.DoResolve): when one is enum constant and
824 another is constant 0, then return enum one *as enum type*.
827 2005-09-02 Raja R Harinath <rharinath@novell.com>
829 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
833 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
834 flow-branching for LocalVariableReferences in case we were invoked
836 * expression.cs (LocalVariableReference.VerifyAssigned): New.
838 (LocalVariableReference.DoResolveBase): ... this.
839 (MemberAccess.Resolve): Do the check that was disabled during
842 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
845 (PartialContainer.Create): check abstract/sealed/static strictly
846 but abstract/sealed can exist only at one side. Fixed bug #75883.
848 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
851 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
852 specified, don't default to UnmanagedType.I4.
854 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
856 * expression.cs : conditional operator should check possibly
857 incorrect assign expression. Fixed bug #75946.
859 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
861 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
862 Reverting the change. gmcs is much complex than mcs on this matter.
864 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
866 * cs-tokenizer.cs : To read another token ahead of the actual
867 consumption, use new SavedToken and cache token instead of moving
868 back the stream with SeekableStreamReader (it seemed problematic).
870 driver.cs : Thus use StreamReader directly.
871 * support.cs : Thus removed SeekableStreamReader.
873 2005-08-30 Raja R Harinath <rharinath@novell.com>
876 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
877 (ScopeInfo.EmitScopeType): Use it to construct field names from
878 names of captured locals.
881 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
882 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
883 Pass 'target_type' to BoxedCast. Don't default to 'object'.
884 (ExplicitConversion): Remove enum cases already handled by
885 implicit conversion. Move implicit conversion check to the beginning.
886 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
887 * expression.cs (ArrayCreation.EmitDynamicInitializers):
888 Don't treat System.Enum as a struct.
890 2005-08-30 Jb Evain <jbevain@gmail.com>
892 * attribute.cs: handles as expression in parameters.
894 2005-08-30 Raja R Harinath <rharinath@novell.com>
897 * class.cs (TypeContainer.VerifyClsName): Don't use a
898 PartialContainer when verifying CLS compliance.
899 (AbstractPropertyEventMethod): Set Parent here, ...
900 (PropertyMethod): ... not here.
902 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
904 * attribute.cs : escaped attribute name should not be allowed to be
905 resolved (e.g. @class as classAttribute). Fixed bug #75930.
907 2005-08-29 Raja R Harinath <rharinath@novell.com>
910 * convert.cs (ImplicitStandardConversionExists): Allow zero also
911 when converting a long constant to unsigned long.
912 * expression.cs (Invocation.OverloadResolve): Add sanity check to
913 detect where IsApplicable and VerifyArgumentsCompat disagree.
915 2005-08-29 Raja R Harinath <rharinath@novell.com>
916 and Carlos Alberto Cortez <carlos@unixmexico.org>
919 * class.cs (TypeContainer.CanElideInitializer): New helper.
920 (TypeContainer.EmitFieldInitializers): Use it to determine if we
921 can safely emitting the initializer of a field.
923 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
925 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
926 allowed inside a switch (without loop). Fixed bug #75433.
928 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
930 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
931 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
933 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
935 * driver.cs : kinda reverting the default encoding changes (not exact
936 revert since I noticed that "codepage:reset" might not work fine).
938 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
940 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
941 Location. Now getter and setter store location correctly.
942 (errors/cs0111-12.cs now reports the expected location.)
944 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
946 * driver.cs : Use default encoding on the environment.
947 Removed (now that) extra parameter for SeekableStreamReader.
948 * support.cs : (SeekableStreamReader) third .ctor() argument for
949 StreamReader is not required (always true). preamble size could
950 be acquired in simpler and safe way.
952 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
954 * cs-parser.jay: report CS0642 at warning level 3
955 and report CS0642 for an if else statement also
956 fixes bug #74745. Patch by John Luke (and a bit
958 Removed extra CS0642 warning check for "while",
960 * statement.cs: In Block.Resolve(), CS0642 check
961 is reimplemented to check a sequence of an empty
962 statement and a block.
966 2005-08-24 Marek Safar <marek.safar@seznam.cz>
968 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
969 detection until I fix it.
971 * cs-tokenizer.cs: Changed error message.
973 * cs-parser.jay: Fixed 2 error locations.
975 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
976 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
979 * enum.cs (GetSignatureForError): Fixed.
981 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
985 * typemanager.cs (RegisterProperty): Removed.
987 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
989 2005-08-24 Raja R Harinath <rharinath@novell.com>
992 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
993 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
995 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
997 * expression.cs : tiny fix is required for not warning positive ulong.
1000 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1002 * expression.cs : add CS0652 check for constant and integral
1003 expression. Fixed bug #53974.
1005 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1007 * expression.cs : in DoNumericPromotions(), check if there is implicit
1008 conversion overload for string (to check CS0034). Fixed bug #52492.
1010 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1012 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
1014 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1016 * ecore.cs : report location when it is *not* Null.
1018 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1024 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
1025 correctly. Fixed bug #75721.
1027 2005-08-23 Raja R Harinath <rharinath@novell.com>
1029 * support.cs (SeekableStreamReader.Position): Avoid an expensive
1030 loop that performs 'min (pos, char_count)'.
1033 * expression.cs (Unary.ResolveOperator): Don't discard implicit
1034 converted value in Operator.OnesComplement.
1036 2005-08-22 Ben Maurer <bmaurer@ximian.com>
1038 * anonymous.cs: If the anon method is pulled into a helper class,
1039 it needs to be `internal' not `private'. Fixes runtime behavior on
1042 2005-08-20 Martin Baulig <martin@ximian.com>
1044 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
1045 scope if we don't already have it.
1047 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
1048 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
1051 2005-08-17 Marek Safar <marek.safar@seznam.cz>
1054 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
1057 2005-08-16 Marek Safar <marek.safar@seznam.cz>
1059 The big constants rewrite
1060 Fix #75746, #75685 and more
1061 As a side effect saved 1MB for MWF ;-)
1063 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
1064 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
1065 enum based for corlib compilation.
1067 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
1070 * class.cs (FixedField.Define): Use ResolveAsConstant.
1072 * const.cs (IConstant): Interface constants and enums.
1073 (Const.ResolveValue): New method for constant resolvning.
1074 (ExternalConstant): Constants from imported assemblies.
1076 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
1077 conversion; like enums.
1078 (Constant.ToType): Converts this constant to different type.
1079 (Constant.Increment): Adds 1.
1081 * convert.cs (ImplicitConversionRequired): Simplified.
1083 * cs-parser.jay: Create EnumMember directly.
1085 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
1087 * doc.cs (GenerateEnumDocComment): Removed.
1089 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
1090 (ConvertIntLiteral): Removed.
1091 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
1093 * enum.cs (EnumMember): Implement IConstant.
1094 (Enum.IsValidEnumConstant): Removed.
1095 (Enum.GetNextDefaultValue): Removed.
1096 (Enum.FindMembers): Updated.
1097 (Enum.GenerateDocComment): Iterate enum members.
1099 * expression.cs (Cast.TryReduce): Handle enums correctly.
1100 (New.Constantify): Made public.
1101 (MemberAccess.DoResolve): Removed contant specific if(s).
1103 * literal.cs (NullLiteral): Implement new abstract methods.
1105 * statement.cs (GotoCase.Resolve): Use new constant methods.
1106 (SwitchLabel.ResolveAndReduce): Use new constant methods.
1108 * typemanager.cs (LookupEnum): Removed.
1109 (IsEnumType): Fixed to work with corlib.
1110 (RegisterConstant): Removed.
1111 (LookupConstant): Removed.
1112 (GetConstant): Changed to work with IConstant.
1114 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
1116 * location.cs : Fixed overflown (>255) column number.
1118 2005-08-03 Raja R Harinath <rharinath@novell.com>
1120 First cut of the qualified-alias-member feature.
1121 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
1123 * cs-parser.jay (DOUBLE_COLON): New token.
1124 (namespace_or_type_name): Add rule for recognizing
1125 qualified-alias-members.
1126 (primary_expression): Likewise.
1127 (element_access): Allow QualifiedAliasMember as a possible
1128 type-bearing expression.
1129 (local_variable_type, local_variable_pointer_type): Likewise.
1130 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
1131 aliases in the current and enclosing namespace declarations.
1132 (NamespaceEntry.UsingAlias): Add CS0440 warning.
1133 * decl.cs (MemberName.is_double_colon): New.
1134 (MemberName.MemberName): Add new constructor for alias-member.
1135 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
1136 * expression.cs (QualifiedAliasMember): New expression type.
1138 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1140 * location.cs : it borked when no argument was specified.
1142 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1144 * location.cs : tiny ToString() format fix.
1146 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1148 * statement.cs : oops, it was missing.
1150 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1152 A set of fixes for precise line/column location.
1155 "token" field now holds a file/line "delta", a line number offset
1156 from the segment, and a column number. See also:
1157 http://lists.ximian.com/pipermail/mono-devel-list/2004-
1158 December/009508.html
1159 Removed static IsNull. Use instance IsNull property instead.
1161 For some tokens it stores Location. For Identifier it stores
1162 LocatedToken which is a pair of string name and location.
1163 Column numbers are adjusted only at getChar().
1165 Use Location.ToString() for reporting (it now contains column).
1167 Largely modified to use LocatedToken instead of
1168 string (IDENTIFIER), and to acquire Location from some tokens.
1169 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
1170 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
1172 Now MemberName holds Location. DeclSpace.ctor() receives Location
1173 as a parameter. Removed extra parameters to all derived classes.
1174 Replaced Location.IsNull() with instance property.
1175 * assign.cs, expression.cs :
1176 Added .ctor() overload that omits Location.
1178 Added "nameEscaped" flag that indicates the identifier was escaped
1179 in the source file. This fixes bug #57047.
1181 2005-08-02 Marek Safar <marek.safar@seznam.cz>
1183 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
1184 New method, looking for lo-case imported cls type.
1186 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
1189 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
1191 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
1193 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
1195 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
1197 Optimized to save 3.5 MB for SWF compilation.
1199 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1201 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
1202 (PartialContainer.Create): Moved logic AddToContainer.
1203 (PartialContainer.MarkForDuplicationCheck): Shares name.
1205 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
1208 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
1210 (Namespace.GetSignatureForError): New method.
1212 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
1213 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
1215 2005-08-01 Raja R Harinath <rharinath@novell.com>
1218 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
1219 member lookup rather than qualifier_type, since qualifier_type can
1222 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1224 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
1227 2005-07-31 Miguel de Icaza <miguel@novell.com>
1229 * statement.cs: Copy the local exception into the exception
1230 captured local. Fixes 75674
1232 2005-07-31 Raja R Harinath <harinath@gmail.com>
1235 * expression.cs (Invocation.OverloadResolve): Don't report error
1236 CS1501 if error CS1502 has been reported.
1237 (New.DoResolve): Delegate CS1501 reporting to
1238 Invocation.OverloadResolve.
1241 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
1242 invariant-meaning-in-block property in an enclosing block if
1245 2005-07-29 Marek Safar <marek.safar@seznam.cz>
1247 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
1248 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
1249 (Switch.CheckSwitch): Just save 50kb for SWF.
1251 2005-07-27 Martin Baulig <martin@ximian.com>
1253 * anonymous.cs (CaptureContext.AddField): Added
1254 `AnonymousContainer am' argument; compute its toplevel scope if
1255 it's not already computed. Fixes #75649.
1257 2005-07-26 Raja R Harinath <rharinath@novell.com>
1260 * class.cs (Constructor.Emit): Reset block to null if the block
1263 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1265 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
1267 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1269 * class.cs (MethodData.Define): Check whether accessor implementing
1270 interface is public.
1272 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
1274 2005-07-22 Marek Safar <marek.safar@seznam.cz>
1277 * namespace.cs (LookupType): Moved same type check to...
1279 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
1282 2005-07-21 Raja R Harinath <rharinath@novell.com>
1284 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
1285 already found a typebuilder.
1286 * class.cs (MethodCore.IsDuplicateImplementation): Compare
1287 MemberNames, not strings.
1289 * const.cs (Error_ExpressionMustBeConst):
1290 Rename from Error_EpressionMustBeConst.
1291 * const.cs, class.cs, statement.cd: Update.
1293 2005-07-21 Marek Safar <marek.safar@seznam.cz>
1297 * const.cs (Const.LookupConstantValue): Report missing contant expression
1299 (Error_EpressionMustBeConstant): Only one error method.
1301 * class.cs, statement.c: Updated.
1303 2005-07-20 Raja R Harinath <rharinath@novell.com>
1305 * statement.cs (Block.Flags): Add back HasVarargs.
1306 (Block.flags): Make protected.
1307 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
1309 * typemanager.cs (types, typecontainers, user_types): Remove.
1310 (UserTypes, TypeContainers): Likewise.
1311 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
1312 (CleanUp, Reset): Update.
1313 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
1314 (GetNestedType): Use Type.GetNestedType.
1315 (CoreLookupType): Take two arguments, the namespace and the
1316 basename of the type. Update to use the Namespace.Lookup
1318 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
1319 (RealMemberLookup): Use IsNestedChildOf instead of playing with
1320 string concatenation and substring matches.
1321 * class.cs, enum.cs, delegate.cs: Update to changes.
1323 2005-07-20 Marek Safar <marek.safar@seznam.cz>
1325 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
1326 Expression and made virtual.
1328 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
1329 (ImplicitStandardConversionExists): Fixed `byte' typo ?
1331 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
1333 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
1336 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
1339 2005-07-18 Marek Safar <marek.safar@seznam.cz>
1342 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
1343 AssemblyCultureAttribute is not used on executable.
1346 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
1348 2005-07-16 Raja R Harinath <rharinath@novell.com>
1351 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
1352 New. Reports CS0252/CS0253.
1353 Mostly taken from preliminary patch by Duncak Mak.
1354 (Binary.DoResolveOperator): Store results of operator lookup.
1355 Use them to detect if we need to warn about unintended reference
1358 2005-07-15 Raja R Harinath <rharinath@novell.com>
1361 * namespace.cs (Namespace.Lookup): Add back location parameter.
1362 (Namespace.LookupType): Add CS0436 report. Add location parameter.
1363 * delegate.cs, ecore.cs, expression.cs: Update to changes.
1365 * codegen.cs (EmitContext.DeclSpace): Make readonly.
1366 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
1367 (Namespace.LookupType): ... this.
1368 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
1370 * typemanager.cs (LookupTypeReflection): Remove buggy code that
1371 purported to handle pointers.
1372 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
1375 2005-07-15 Marek Safar <marek.safar@seznam.cz>
1377 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
1380 2005-07-15 Raja R Harinath <rharinath@novell.com>
1382 * namespace.cs (Namespace.Lookup): Drop location parameter.
1383 (NamespaceEntry.LookupAlias): Remove. Merge into ...
1384 (NamespaceEntry.Lookup): ... this.
1385 (NamespaceEntry.Error_AmbiguousTypeReference):
1386 Move here from DeclSpace.
1387 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
1389 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
1390 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
1391 Move to NamespaceEntry.
1392 * delegate.cs, expression.cs: Update to changes.
1394 2005-07-14 Marek Safar <marek.safar@seznam.cz>
1396 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
1397 CheckAttributeType and refactored.
1398 (Attribute.ResolvePossibleAttributeType): Changed to reuse
1399 ResolveAsTypeTerminal error handling.
1400 (ResolveAsTypeTerminal): Introduced because of global attributes extra
1402 (GetSignatureForError): Print errors in same way.
1405 * codegen.cs: Reflect attribute GetSignatureForError change.
1408 * expression.cs: Add silent parameter to ResolveAsTypeStep.
1410 * namespace.cs (UsingEntry): Refactored to make fields private.
1413 statement.cs: Error_UnexpectedKind has extra parameter.
1415 2005-07-14 Raja R Harinath <rharinath@novell.com>
1417 * ecore.cs (IAlias): Remove.
1418 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
1419 that implement the interface.
1420 * namespace.cs (Namespace): Likewise.
1421 (Namespace.declspaces): Renamed from 'defined_names'.
1422 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
1423 DeclSpace instead of an IAlias.
1424 * tree.cs (Tree.AddDecl): Update.
1426 2005-07-12 Raja R Harinath <rharinath@novell.com>
1428 * statement.cs (Block.Flags); Remove HasVarargs.
1429 (Block.HasVarargs): Move to ToplevelBlock.
1430 (Block.ThisVariable, Block.AddThisVariable): Likewise.
1431 (Block.Variables): Make protected. Initialize variable hashtable
1433 (Block.AddVariable): Update.
1434 (Block.Resolve): Update to changes.
1435 (ToplevelBlock.HasVarargs): New boolean.
1436 (ToplevelBlock.ThisVariable): Move here from Block.
1437 (ToplevelBlock.AddThisVariable): Likewise.
1438 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
1439 * expression.cs (This.ResolveBase): Update to changes.
1440 (ArglistAccess.DoResolve): Likewise.
1442 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1445 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
1447 * class.cs (TypeContainer.VerifyMembers): Distinguish between
1448 not used and not used & assigned.
1449 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
1451 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1454 * expression.cs (Is.DoResolve): null is never provided type.
1456 2005-07-08 Marek Safar <marek.safar@seznam.cz>
1459 * cs-parser.jay: Less strict event error rule to catch more errors.
1461 2005-07-08 Martin Baulig <martin@ximian.com>
1463 Fix test-iter-10.cs - distinguish whether we `yield' in a property
1464 gettter (allowed) or setter (not allowed).
1466 * class.cs (Accessor): Implement IIteratorContainer.
1467 (Accessor.Yields): New public field.
1468 (PropertyBase.PropertyMethod.Define): Handle iterators on a
1472 (get_accessor_declaration, set_accessor_declaration): Set the
1473 `yields' flag on the accessor, not the property.
1474 (property_declaration): Do the iterators check on a per-accessor
1475 basis and not for the whole property.
1477 2005-07-08 Martin Baulig <martin@ximian.com>
1479 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
1480 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
1482 2005-07-07 Marek Safar <marek.safar@seznam.cz>
1485 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
1486 (ExtractSecurityPermissionSet): Cope with self referencing security
1487 attributes properly.
1489 * driver.cs (SetOutputFile): Made public property OutputFile.
1491 2005-07-07 Raja R Harinath <rharinath@novell.com>
1494 * class.cs (TypeContainer.first_nonstatic_field): Rename from
1495 has_nonstatic_fields. Make into a FieldBase pointer.
1496 (TypeContainer.AddField): Add CS0282 check.
1497 (TypeContainer.EmitType): Update.
1499 2005-07-06 Miguel de Icaza <miguel@novell.com>
1501 * cs-tokenizer.cs (consume_identifier): Do not create strings to
1502 compare if they start with __.
1504 2005-07-06 Raja R Harinath <rharinath@novell.com>
1506 * statement.cs (Switch.SwitchGoverningType): Only look at
1507 UserCasts that don't need implicit standard conversions to one of
1508 the allowed switch types (Fixes test-322.cs).
1509 (LocalInfo.Resolve): Re-enable sanity-test.
1511 2005-07-06 Marek Safar <marek.safar@seznam.cz>
1513 * cs-tokenizer.cs (consume_identifier): Detect double undescores
1515 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
1517 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
1519 2005-07-06 Raja R Harinath <rharinath@novell.com>
1522 * ecore.cs (SimpleName.GetSignatureForError): Add.
1523 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
1524 (MemberAccess.GetSignatureForError): Add.
1526 2005-07-05 Marek Safar <marek.safar@seznam.cz>
1528 The big error and warning messages review.
1558 * typemanager.cs: Updated.
1560 * class.cs: (MethodCore.SetYields): Moved here to share.
1561 (PropertyMethod.Define): Moved iterator setup here.
1563 * iterators.cs: Add orig_method to have full access to parent
1566 2005-07-05 Raja R Harinath <rharinath@novell.com>
1568 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
1569 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
1570 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
1571 variable of struct type.
1572 * expression.cs (Unary.ResolveOperator): Update to change.
1573 (Indirection.VerifyFixed): Likewise.
1574 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
1575 (ParameterReference.VerifyFixed): Value parameters are fixed.
1576 (This.VerifyFixed): Treat 'this' as a value parameter.
1577 * statement.cs (LocalInfo.IsFixed): Remove.
1579 2005-07-01 Martin Baulig <martin@ximian.com>
1581 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
1582 `ec.EmitThis ()' to get the correct scope.
1584 2005-07-01 Martin Baulig <martin@ximian.com>
1586 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
1587 instance is a ParameterReference; fixes #75299.
1589 2005-07-01 Martin Baulig <martin@ximian.com>
1591 Reverted Marek's latest patch (r46725):
1592 - it contains structural changes which are neither mentioned in
1593 the ChangeLog nor explained anywhere; for example the additional
1594 argument of EmitContext's and Iterator's .ctor's and the
1595 TypeContainer.DefineMembers() change.
1596 - structural changes like this should go in in seperate patches
1597 and not be hidden in a huge patch which just seems to affect
1598 warnings and errors.
1599 a big and hard to understand patch.
1600 - it breaks iterators and causes regressions, for instance in
1603 2005-06-30 Raja R Harinath <rharinath@novell.com>
1606 * expression.cs (Indexers.map): Remove.
1607 (Indexers.Append): Filter out inaccessible setters and getters.
1608 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
1611 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
1613 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
1614 (FieldExpr.Emit, PropertyExpr.Emit): Update.
1615 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
1616 * expression.cs (Invocation.EmitCall): Add CS0120 check.
1618 2005-06-30 Marek Safar <marek.safar@seznam.cz>
1621 * class.cs (FieldBase.GetInitializerExpression): One more field
1624 2005-06-28 Miguel de Icaza <miguel@novell.com>
1626 * pending.cs: Do not define a proxy if the base method is virtual,
1627 it will be picked up by the runtime (bug 75270).
1629 2005-06-08 Martin Baulig <martin@ximian.com>
1631 The big Iterators rewrite :-)
1633 * iterators.cs: Rewrite this to use the anonymous methods framework.
1635 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
1636 before the TypeContainers; see 2test-21.cs.
1639 (TypeContainer.DefineType): Don't create a new EmitContext if we
1640 already have one (this only happens if we're an Iterator).
1641 (TypeContainer.Define): Also call Define() on all our iterators.
1642 (Method.CreateEmitContext): Added support for iterators.
1645 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
1646 (AnonymousContainer.CreateMethodHost): Moved here from
1647 AnonymousMethod and made abstract.
1648 (AnonymousContainer.CreateScopeType): New abstract method.
1649 (AnonymousContainer.IsIterator): New public property.
1650 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
1651 get the ScopeTypeBuilder rather than manually defining it here.
1652 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
1655 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
1656 before RootContext.DefineTypes().
1658 * codegen.cs (EmitContext.RemapToProxy): Removed.
1659 (EmitContext.CurrentAnonymousMethod): Changed type from
1660 AnonymousMethod -> AnonymousContainer.
1661 (EmitContext.ResolveTopBlock): Protect from being called twice.
1662 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
1663 (EmitContext.EmitThis): Removed the iterators hacks; use the
1664 anonymous methods framework for that.
1667 (ToplevelBlock.Container): Make this a property, not a field.
1668 (ToplevelBlock.ReParent): New public method; move the
1669 ToplevelBlock into a new container.
1670 (Foreach.TemporaryVariable): Simplify.
1672 2005-06-05 Martin Baulig <martin@ximian.com>
1674 * statement.cs (LocalInfo.CompilerGenerated): New flag.
1675 (Block.AddTemporaryVariable): New public method; creates a new
1676 `LocalInfo' for a temporary variable.
1677 (Block.EmitMeta): Create the LocalBuilders for all the temporary
1679 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
1680 non-iterator variables.
1682 2005-06-05 Martin Baulig <martin@ximian.com>
1684 * statement.cs (Foreach.TemporaryVariable): Create the
1685 LocalBuilder in the Emit phase and not in Resolve since in some
1686 situations, we don't have an ILGenerator during Resolve; see
1687 2test-19.cs for an example.
1689 2005-06-04 Martin Baulig <martin@ximian.com>
1691 **** Merged r45395 from GCS ****
1693 The big Foreach rewrite - Part II.
1695 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
1696 with `PropertyInfo ienumerator_getcurrent'.
1698 * codegen.cs (VariableStorage): Removed.
1701 (Foreach): Derive from Statement, not ExceptionStatement.
1702 (Foreach.CollectionForeach): New nested class. Moved all the code
1703 dealing with collection foreach here.
1704 (Foreach.ForeachHelperMethods): Removed.
1705 (Foreach.TemporaryVariable): Implement IMemoryLocation.
1707 2005-05-23 Martin Baulig <martin@ximian.com>
1709 * statement.cs (Try.DoResolve): Don't create a `finally' if we
1710 don't need to. Fix #75014.
1712 2005-05-20 Martin Baulig <martin@ximian.com>
1714 Merged r44808 from GMCS.
1716 * class.cs (TypeContainer.CircularDepException): Removed.
1717 (TypeContainer.DefineType): Removed the `InTransit' stuff.
1718 (TypeContainer.CheckRecursiveDefinition): Check for circular class
1719 (CS0146) and interface (CS0529) dependencies here.
1721 2005-06-21 Raja R Harinath <rharinath@novell.com>
1723 * expression.cs (Invocation.EmitCall): Fix initialization
1724 'this_call' to reflect current behaviour. Fix indentation.
1726 * convert.cs (FindMostEncompassedType): Add two trivial special
1727 cases (number_of_types == 0 || number_of_types == 1).
1728 (FindMostEncompasingType): Likewise.
1730 2005-06-17 Raja R Harinath <rharinath@novell.com>
1732 Some cleanups preparing for the fix of #75283.
1733 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
1735 (EventExpr.InstanceResolve): Likewise.
1736 (EventExpr.DoResolve): Remove redundant checks.
1738 2005-06-10 Duncan Mak <duncan@novell.com>
1740 * cs-tokenizer.cs (process_directives): New flag for controlling
1741 the processing of preprocessor directives.
1742 (x_token): After seeing a '#', return Token.NONE instead of going
1743 to handle_preprocessing_directive() when not processing
1744 directives. This avoids unnecessary processing during the token peek in
1749 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
1750 the existing error reporting methods instead of Report.Error.
1752 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
1753 after Raja's rewrite.
1755 2005-06-08 Miguel de Icaza <miguel@novell.com>
1757 * class.cs: Small fix.
1759 2005-06-08 Raja R Harinath <rharinath@novell.com>
1762 * class.cs (GetPartialBases): Fix return value check of
1765 2005-06-07 Raja R Harinath <rharinath@novell.com>
1767 Ensure that partial classes are registered in their enclosing
1768 namespace. Initial part of fix of #75160.
1769 * tree.cs (Tree.RecordDecl): Add new namespace argument.
1770 Register declspace with namespace here, not in
1771 DeclSpace.RecordDecl.
1772 * cs-parser.jay: Pass namespace to RecordDecl.
1773 * class.cs (PartialContainer.Create): Likewise.
1774 (ClassPart.DefineType): New sanity-check. Throws an exception if
1776 * decl.cs (Declspace.RecordDecl): Remove.
1777 * namespace.cs (NamespaceEntry.DefineName): Remove.
1779 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1781 * rootcontext.cs: Reset TargetExt as well.
1783 2005-06-03 Raja R Harinath <rharinath@novell.com>
1785 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1788 2005-06-02 Raja R Harinath <rharinath@novell.com>
1790 Fix #75080, cs0119.cs.
1791 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1793 (Expression.Resolve): ... this. Use it. Remove bogus code
1794 allowing ExprClass.Type and ExprClass.Namespace for
1795 ResolveFlags.VariableOrValue.
1796 (Expression.Resolve) [1-argument variant]: Change default resolve
1797 flags based on language version.
1798 (Expression.Error_UnexpectedKind): Use a simple string array
1799 rather than an ArrayList.
1800 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1802 (TypeOfVoid.DoResolve): Likewise.
1803 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1804 flags argument -- it always has the same value.
1806 2005-05-31 Raja R Harinath <rharinath@novell.com>
1809 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1810 Use it in the error message.
1811 * assign.cs, expression.cs, statement.cs: Update.
1813 2005-05-30 Raja R Harinath <rharinath@novell.com>
1816 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1817 the "almostMatchedMember" case too.
1818 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1819 that failed the accessibility checks to 'almost_match'.
1821 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1823 * attribute.cs: Use internal MethodBuilder methods to set
1824 ExactSpelling and SetLastError on PInvoke methods, instead
1825 of passing them via charset. Fixes #75060.
1827 2005-05-27 Raja R Harinath <rharinath@novell.com>
1829 * parameter.cs (Parameter): Remove TODO comment.
1830 (Parameter.DefineParameter): Remove Location parameter.
1831 (Parameters.LabelParameters): Likewise.
1832 * class.cs (Constructor.Emit): Update to change.
1833 (MethodData.Emit): Likewise.
1834 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1835 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1837 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1840 Removed Parameters.Location and added Parameter.Location instead.
1841 Removed Location parameter from Emit() and GetSignature().
1848 Modified all related calls.
1850 2005-05-26 Raja R Harinath <rharinath@novell.com>
1852 Improve user-defined conversion handling.
1853 * convert.cs (GetConversionOperators): Rewrite. Return only the
1854 applicable operators.
1855 (AddConversionOperators): New. Helper for GetConversionOperators.
1856 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1857 there is only one most encompassed/encompassing type.
1858 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1859 "applicable operator" handling.
1860 (UserConversion): Move cache here from GetConversionOperators.
1861 Directly cache the chosen operator, rather than the whole
1863 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1864 case. Allow conversion of decimal to sbyte and byte too.
1865 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1866 New static methods. Used to avoid allocating EmptyExpressions in
1869 2005-05-24 Duncan Mak <duncan@novell.com>
1871 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1872 another class, used in Convert.ExplicitNumericConversion.
1873 (CastToDecimal): New class, similar to above, but casts to
1874 System.Decimal, used in Convert.ImplicitNumericConversion and also
1875 in explicit convesion from double/float to decimal.
1877 * convert.cs (ImplicitNumericConversion): Handle implicit
1878 conversions to System.Decimal.
1879 (ExplicitNumericConversion): handle explicit conversions to
1884 2005-05-20 Miguel de Icaza <miguel@novell.com>
1886 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1887 know the type at this stage, just break through. Fixes #75008
1889 2005-05-19 Martin Baulig <martin@ximian.com>
1892 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1893 to disable error reporting.
1895 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1896 here since we don't want to report an error; see the new test-336.cs.
1898 2005-05-19 Raja R Harinath <rharinath@novell.com>
1900 * statement.cs (ToplevelBlock.GetParameterReference)
1901 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1902 Move here from class Block.
1903 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1904 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1906 2005-05-18 Martin Baulig <martin@ximian.com>
1911 (FlowBranching.Reachability): Add non-static public And() and Or()
1913 (FlowBranchingSwitch): New class; do the `break_origins' thing
1914 like in FlowBranchingLoop.
1915 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1916 reachability, not just locals and parameters.
1917 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1918 switch; MergeBreakOrigins() now takes care of that.
1920 2005-05-18 Martin Baulig <martin@ximian.com>
1922 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1923 a loop and may leave it, reset the barrier; fixes #74974.
1925 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1927 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1930 * cs-parser.jay: Catch more lexical errors.
1932 * report.cs: Add one more Error method.
1935 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1937 2005-05-17 Martin Baulig <martin@ximian.com>
1939 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1942 2005-05-16 Raja R Harinath <rharinath@novell.com>
1944 Fix test-382.cs. Emit values of decimal constants.
1945 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1947 (TypeContainer.AddField): ... this.
1948 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1949 with initializers to include 'Const's.
1950 (ClassPart.RegisterFieldForInitialization): Forward to
1952 * const.cs (Const.Const): Pass initializer to base class.
1953 (Const.Define): In case of decimal constants, register them for
1954 initialization in a static constructor.
1956 2005-05-14 Martin Baulig <martin@ximian.com>
1958 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1959 do not call ResolveUnreachable() on unreachable statements in
1960 here, see the comment in the source code.
1962 2005-05-13 Raja R Harinath <rharinath@novell.com>
1965 * expression.cs (BinaryResolveOperator): If one of the operands of
1966 an equality comparison is 'null' and the other is a pointer type,
1967 convert the null to a NullPointer.
1968 * convert.cs (ImplicitReferenceConversion): If the expression is a
1969 NullLiteral and the target type is a pointer type, return a
1970 NullPointer instead.
1971 (ImplicitConversionStandard): Likewise.
1973 2005-05-13 Marek Safar <marek.safar@seznam.cz>
1975 * cs-parser.jay: Set readonly context based on special constructs.
1977 * expression.cs (LocalVariableReference.DoResolveBase): Improved
1978 readonly variable error handling.
1980 * rootcontext.cs (EmitCode): Don't verify members when error
1983 * statement.cs (LocalInfo): Add reaodnly context information.
1984 (SetReadOnlyContext, GetReadOnlyContext): New methods.
1986 2005-05-13 Raja R Harinath <rharinath@novell.com>
1988 * statement.cs (Block.Resolve): Revert change below. Modify fix
1989 for #74041 to initialize 'resolved' to false only for explicit
1990 blocks. Fixes #74873.
1992 2005-05-12 Raja R Harinath <harinath@gmail.com>
1995 * typemanager.cs (unmanaged_enclosing_types): New.
1996 (IsUnmanagedType): Avoid infloops by using
1997 'unmanaged_enclosing_types' to talk with recursive invocations.
1999 2005-05-13 Martin Baulig <martin@ximian.com>
2001 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
2002 instance variable, not a local. Fix #74873.
2003 (Block.ResolveUnreachable): Set it to true here.
2005 2005-05-11 Duncan Mak <duncan@novell.com>
2007 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
2008 continuing to process for 'arg'.
2009 (handle_preprocessing_directive): Check the argument of the #endif
2010 directive and report error CS1025 if there are any trailing
2013 According to the C# spec, having even whitespace after the #endif
2014 directive is illegal; however, because we call arg.TrimEnd ()
2015 beforehand, we have the same behavior as csc, allowing whitespace
2016 after the directive.
2020 2005-05-11 Marek Safar <marek.safar@seznam.cz>
2024 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
2025 (Constructor.GetObsoleteAttribute): Implemented correctly.
2027 2005-05-10 Martin Baulig <martin@ximian.com>
2029 * support.cs (ReflectionParameters.ParameterModifier): Use
2030 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
2031 and `ParameterAttributes.In'. Fixes #74884.
2033 2005-05-10 Marek Safar <marek.safar@seznam.cz>
2035 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
2037 * expression.cs (Argument.GetParameterModifier): Turned to property.
2038 (Invocation.Error_InvalidArguments): Add more descriptive errors.
2040 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
2043 2005-05-09 Raja R Harinath <rharinath@novell.com>
2046 * decl.cs (MemberCache.AddMethods): Register override methods,
2047 rather than non-override methods.
2048 * typemanager.cs (RegisterOverride): New.
2049 (IsOverride): Update.
2051 2005-05-09 Marek Safar <marek.safar@seznam.cz>
2055 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
2056 recursive declaration.
2058 * statement.cs (Block.ResolveMeta): Report any error in resolving.
2060 2005-05-06 Marek Safar <marek.safar@seznam.cz>
2062 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
2064 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
2066 2005-05-05 Raja R Harinath <rharinath@novell.com>
2069 * decl.cs (DeclSpace.FamilyAccessible):
2070 Use TypeManager.IsNestedFamilyAccessible.
2072 Fix reopened #64812.
2073 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
2076 2005-05-04 Raja R Harinath <rharinath@novell.com>
2077 Abin Thomas <projectmonokochi@rediffmail.com>
2078 Anoob V E <projectmonokochi@rediffmail.com>
2079 Harilal P R <projectmonokochi@rediffmail.com>
2082 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
2083 allow access to all static members.
2085 2005-05-04 Martin Baulig <martin@ximian.com>
2087 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
2089 2005-05-04 Martin Baulig <martin@ximian.com>
2093 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
2094 section at the end; make things work if `default' is not the last
2097 2005-05-04 Martin Baulig <martin@ximian.com>
2101 * statement.cs (Switch): Replaced the `got_default' field with a
2102 `default_section' one.
2103 (Switch.CheckSwitch): Set `default_section' here.
2104 (Switch.Resolve): If we're a constant switch and the constant is
2105 not found, use the default section.
2107 2005-05-03 Martin Baulig <martin@ximian.com>
2109 * expression.cs (ArrayAccess.EmitGetLength): New public method.
2111 * statement.cs (Foreach.ArrayForeach): New nested class.
2112 (Foreach.TemporaryVariable): New nested class.
2113 (Foreach.EmitArrayForeach): Removed; this is now in the new
2116 2005-05-03 Raja R Harinath <rharinath@novell.com>
2118 * pending.cs (BaseImplements): Move the #74773 fix here. This is
2120 (VerifyPendingMethods): Revert change below.
2122 * typemanager.cs (IsOverride, RegisterNonOverride): New.
2123 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
2124 that used to trigger warning -28. Remove warning -28.
2125 * expression.cs (Invocation.OverloadResolve): Use
2126 TypeManager.IsOverride to distinguish override methods.
2129 * pending.cs (VerifyPendingMethods): If a base type implements the
2130 requested interface, don't bother checking individual methods of
2131 the base type. As a side-effect, this prevents the creation of
2132 unnecessary proxies.
2134 2005-05-02 Martin Baulig <martin@ximian.com>
2138 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2139 Also `And' the locals if the old vector is null.
2140 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
2141 null; in this case we basically reset all the variables.
2143 2005-05-02 Martin Baulig <martin@ximian.com>
2147 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
2148 Added `FlowBranching branching' argument; always `and' the
2149 variables instead of `or'ing them unless we're an infinite loop.
2151 * statement.cs (While.Resolve): Create a new sibling unless we're
2154 2005-05-02 Martin Baulig <martin@ximian.com>
2158 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
2159 arguments; use it instead of creating a new TopLevelBlock.
2160 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
2161 our ConstructorInitializer.
2164 (TopLevelBlock.TopLevelBranching): New public property.
2165 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
2166 and create our `TopLevelBranching'.
2168 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
2169 anonymous method host, use `block.TopLevelBranching' rather than
2170 creating a new branching.
2172 2005-04-20 Miguel de Icaza <miguel@novell.com>
2174 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
2175 a ScopeInfo, if any of the current children is a child of the new
2176 entry, move those children there.
2178 2005-04-30 Martin Baulig <martin@ximian.com>
2180 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
2181 at the beginning of a SwitchSection. Fix #73335.
2183 2005-04-27 Marek Safar <marek.safar@seznam.cz>
2186 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
2188 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
2189 (FieldExpr.DoResolve): Obsolete members are ignored for field
2192 2005-04-26 Marek Safar <marek.safar@seznam.cz>
2194 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
2195 of arrays detection.
2197 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
2199 (Field.VerifyClsCompliance): Volatile fields are not compliant.
2201 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
2204 2005-04-25 Ben Maurer <bmaurer@ximian.com>
2206 * cs-parser.jay: Use the prefered version of -unsafe in error
2209 2005-04-22 Marek Safar <marek.safar@seznam.cz>
2211 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
2214 2005-04-20 John Luke <john.luke@gmail.com>
2216 * driver.cs: fix typo in error message, --outout to --output
2218 2005-04-20 Marek Safar <marek.safar@seznam.cz>
2220 * codegen.cs (InRefOutArgumentResolving): New field.
2222 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
2223 fields outside contructor.
2225 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
2227 2005-04-19 Miguel de Icaza <miguel@novell.com>
2229 * anonymous.cs (CaptureContext.EmitParameterInstance): The
2230 parameter code was not completed ever, so it was not as up-to-date
2231 as local variables. Must finish it.
2233 The bug fix was to compare the Toplevel of the block, not the
2234 current block. Thanks for Ben for pointing this out.
2236 2005-04-19 Raja R Harinath <rharinath@novell.com>
2238 * decl.cs (AddMethods): Use the declaring type of the problem
2239 method to determine if we want to squash a warning.
2241 2005-04-19 Marek Safar <marek.safar@seznam.cz>
2243 * attribute.cs: Removed debug output.
2245 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
2247 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
2250 2005-04-18 Raja R Harinath <rharinath@novell.com>
2253 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
2254 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
2255 all null comparisons against reference types.
2257 2005-04-18 Marek Safar <marek.safar@seznam.cz>
2260 * class.cs (TypeContainer.CircularDepException) New nested
2262 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
2263 (TypeContainer.DefineType): Removed error, reset InTransit before
2265 (Class.DefineType): Throw exception when is in Transit.
2266 Catch exception and report error.
2267 (Struct.DefineType): Throw exception when is in Transit.
2268 Catch exception and report error.
2269 (Interface.DefineType): Throw exception when is in Transit.
2270 Catch exception and report error.
2272 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
2273 handle nested exception handlers.
2275 * flowanalysis.cs (InTryWithCatch): New method, search for try with
2278 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
2279 InFinally and InCatch storage.
2281 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
2282 (Catch.Resolve): Set and Restore ec.InCatch.
2283 (Try.Resolve): Set and Restore ec.InFinally.
2284 (Try.HasCatch): True when try has catch.
2286 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
2288 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
2289 for the same event member, so exclude such cases from warning 419.
2292 2005-04-16 Miguel de Icaza <miguel@novell.com>
2294 * expression.cs (Binary.ResolveOperator): Apply patch from John
2295 Luke to fix bug 59864: operators &, | and ^ on enumerations
2296 require that the same enum type on both sides.
2298 * driver.cs: Add warnings to old flag usage, this is to assist
2299 people who produce Makefiles and hope that the Makefiles will be
2302 * class.cs (TypeContainer.EmitType): Moved the definition of the
2303 special $PRIVATE$ field from the resolve phase to the Emit phase.
2304 During resolve we do not know if we are a struct with
2305 HasExplicitLayout, we know this only after the attributes for the
2308 Set the FieldOffset to zero on the dummy field that we create for
2309 the class. Fixes 74590.
2311 2005-04-16 Raja R Harinath <rharinath@novell.com>
2314 * ecore.cs (PropertyExpr.resolved): New.
2315 (DoResolve): Use it to handle a case of double resolution here.
2316 Handle a case of identical-name-and-type-name.
2317 * expression.cs (ArrayCreation.CheckIndices): Avoid double
2318 resolution by storing the results of expression resolution back
2319 into the "probes" array.
2321 2005-04-15 Raja R Harinath <rharinath@novell.com>
2323 Fix cs0208-7.cs and cs0208-8.cs.
2324 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
2325 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
2326 error reporting to point out the reason a struct is not unmanaged.
2328 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2330 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
2331 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
2333 2005-04-13 Raja R Harinath <rharinath@novell.com>
2336 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
2337 IdenticalNameAndTypeName here.
2338 (EventExpr.InstanceResolve): Likewise.
2340 2005-04-13 Marek Safar <marek.safar@seznam.cz>
2342 C# 2.0 DefaultCharSetAttribute implementation
2344 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
2345 which allows us to set GlobalNamespace for every resolve.
2346 (Attribute.ResolveArguments): Cut from Resolve.
2347 (Attribute.GetCharSetValue): Returns CharSet named argument.
2348 (Attribute.DefinePInvokeMethod): Gets default charset from
2350 (GlobalAttribute.ResolveAsTypeStep): Override.
2351 (GlobalAttribute.ResolveArguments): Override.
2353 * class.cs (TypeAttr): Is protected.
2355 * codegen.cs (ModuleClass.DefaultCharSet): New member.
2356 (ModuleClass.DefaultCharSetType): New memeber.
2357 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
2359 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
2360 charset from module.
2362 * delegate.cs (TypeAttr): Override.
2363 (Delegate.DefineType): Use this TypeAttr.
2365 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
2366 at very early stage (before types are defined) to resolve model
2367 module attributes. It will probably not work with corlib but it
2370 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
2371 charset from module.
2373 * typemanager.cs (default_charset_type): New type.
2375 2005-04-13 Raja R Harinath <rharinath@novell.com>
2377 * decl.cs (MemberCache.AddMethods): Don't warn if
2378 System.Object.Finalize has buggy MethodAttributes.
2380 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
2383 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2385 * doc.cs : detect ambiguous reference to overloaded members.
2386 Fixed bug #71603. MS 1.1 csc does not detect it.
2388 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2390 * doc.cs : delegates must not be referenced with parameters.
2393 2005-04-12 Miguel de Icaza <miguel@novell.com>
2395 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
2397 2005-04-10 Miguel de Icaza <miguel@novell.com>
2399 * driver.cs (MainDriver): Stop processing if the CLS stage found
2402 (CompilerCallableEntryPoint.InvokeCompiler): Always
2403 reset after execution; Take a TextWriter argument for the
2406 * report.cs: Use the error stream instead of hardcoding stderr.
2408 2005-04-09 Miguel de Icaza <miguel@novell.com>
2410 * class.cs: Reduce code paths to test, too small of an
2411 optimization to make it worth the extra testing. Always perform
2414 2005-04-08 Raja R Harinath <rharinath@novell.com>
2417 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
2418 operators that had errors reported on them.
2420 2005-04-08 Marek Safar <marek.safar@seznam.cz>
2422 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
2424 (Attribute.Resolve): Add named argument type checking.
2426 * class.cs (FixedField.Define): Use IsPrimitiveType
2428 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
2430 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
2431 unsafe parameter types.
2433 * statement.cs (Using.ResolveExpression): Add better error description.
2435 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
2437 2005-04-08 Raja R Harinath <rharinath@novell.com>
2440 * attribute.cs (Attribute.GetAttributeUsage): Resolve
2441 AttributeUsageAttribute in the emitcontext of the attribute class,
2442 not in the emitcontext of the attributable entity it was attached to.
2443 * cs-parser.jay: Use 'current_class', not 'current_container',
2444 when creating a GlobalAttribute.
2446 2005-04-08 Alp Toker <alp@atoker.com>
2448 * pending.cs: The fix to #58413 failed to compile methods implementing
2449 interfaces with/without params modifiers and vice versa, even though
2450 params modifiers aren't part of the signature. Make the modifier check
2451 less strict as in csc.
2453 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
2454 Anoob V E <projectmonokochi@rediffmail.com>
2455 Harilal P R <projectmonokochi@rediffmail.com>
2458 * pending.cs (TypeAndMethods.mods): New. Store the parameter
2459 modifiers of pending methods.
2460 (PendingImplementation.PendingImplementation): Initialize it.
2461 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
2462 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
2463 with ParameterData. Add check for modifiers.
2464 * class.cs (MethodData.Define): Update to changes.
2466 2005-04-07 Raja R Harinath <rharinath@novell.com>
2468 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
2470 2005-04-07 Marek Safar <marek.safar@seznam.cz>
2472 * class.cs (PropertyMethod.Define): Check private accessor in abstract
2475 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
2478 * typemanager.cs: Registered RequiredAttributeAttribute.
2480 2005-04-06 Marek Safar <marek.safar@seznam.cz>
2482 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
2483 Warning CS0169 is back at level 3.
2484 (IMethodData.SetMemberIsUsed): New method.
2486 * decl.cs (IsUsed): New value; moved from FieldBase.Status
2487 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
2489 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
2491 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
2493 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
2496 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
2499 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
2500 to avoid the problems with nested types.
2502 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
2503 Anoob V.E <projectmonokochi@rediffmail.com>
2504 Harilal P.R <projectmonokochi@rediffmail.com>
2505 Raja R Harinath <rharinath@novell.com>
2508 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
2510 * typemanager (GetConstructor): Make public.
2512 2005-04-05 John Luke <john.luke@gmail.com>
2513 Raja R Harinath <rharinath@novell.com>
2516 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
2517 struct too. Return false quicker in a few cases.
2518 (VerifyUnManaged): Use it.
2520 2005-04-05 Raja R Harinath <rharinath@novell.com>
2523 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
2524 not 'unreachable_seen'.
2526 2005-04-04 Marek Safar <marek.safar@seznam.cz>
2528 * attribute.cs (Attribute.GetValue): Removed unused.
2530 * codegen.cs (CodeGen.TrimExt): Removed unused.
2532 * cs-parser.jay (output): Removed unused.
2534 * cs-tokenizer.cs (hex_digits): Removed unused.
2536 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
2538 * expression.cs (Indirection.LoadExprValue): Removed unused.
2539 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
2541 * iterators.cs (Iterator.param_types): Removed unused.
2543 * statement.cs (Goto.block): Removed unused.
2544 (ToplevelBlock.did): Removed unused.
2545 (Switch.ResolveConstantSwitch): Removed unused.
2547 2005-04-01 Ben Maurer <bmaurer@ximian.com>
2549 * rootcontext.cs: Allow mcs to bootstrap with the compilation
2552 2005-04-01 Raja R Harinath <rharinath@novell.com>
2554 Fix #74232 and cs0208-3.cs.
2555 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
2556 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
2557 unmanaged type. Don't use FieldBuilders when 't' is a
2558 TypeBuilder. Use ModFlags and MemberType fields.
2559 * class.cs (MemberBase.member_type): Rename from MemberType.
2560 (MemberBase.MemberType): New property. Determines member_type on
2562 (MemberBase.DoDefine): Don't initialize MemberType here.
2563 (FieldMember.Define): Likewise.
2565 2005-04-01 Marek Safar <marek.safar@seznam.cz>
2568 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
2569 Attributes are emitted there.
2571 2005-04-01 Raja R Harinath <rharinath@novell.com>
2573 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
2574 keyword in 'partial enum' too.
2575 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
2577 Report from Kamil Skalski <nazgul@omega.pl>.
2580 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
2581 have partial containers too.
2583 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
2584 in block' checks to Block.CheckInvariantMeaningInBlock.
2585 * statement.cs (Block.GetKnownVariableInfo): Make private.
2586 (Block.IsVariableUsedInChildBlock): Remove.
2587 (Block.IsVariableUsedInBlock): Likewise.
2588 (Block.CheckInvariantMeaningInBlock): New. Show location of
2589 conflicting declaration.
2590 (Block.AddVariable): Make error messages less long-winded and more
2591 specific. Show location of conflicting declaration.
2592 * parameter.cs (Parameters.Location): New readonly property.
2594 2005-03-31 Raja R Harinath <rharinath@novell.com>
2596 Clean up semantics of invoking ResolveMemberAccess.
2597 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
2598 can have an instance, ensure that we pass in a non-TypeExpression
2599 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
2600 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
2601 argument. Update to changes and simplify.
2602 (FieldExpr.Emitinstance): Remove CS0120 check.
2603 (PropertyExpr.EmitInstance): Likewise.
2604 * expression.cs (Argument.Resolve): Likewise.
2605 (Invocation.DoResolve): Update to changes in semantics of
2608 2005-03-31 Marek Safar <marek.safar@seznam.cz>
2611 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
2614 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
2616 2005-03-31 Raja R Harinath <rharinath@novell.com>
2618 Fix difference in behaviour with commandline invocation.
2619 * driver.cs (Driver.Reset): New.
2620 (CompilerCallableEntryPoint): Call it.
2622 * statement.cs (If.Resolve): Avoid spurious "uninitialized
2623 variable" warnings if the boolean expression failed to resolve.
2625 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
2627 * attribute.cs: Fix the union of several permissions when some of them
2628 are unrestricted (so the result isn't an unrestricted permission set).
2631 2005-03-30 Raja R Harinath <rharinath@novell.com>
2633 * ecore.cs (MemberExpr): New class. Convert from interface
2635 (MemberExpr.ResolveMemberAccess): Refactor and move here from
2636 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
2638 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
2639 (MethodGroupExpr.IsExplicitImpl): Remove.
2640 (Expression.GetFieldFromEvent): Remove.
2641 (SimpleName.MemberStaticCheck): Remove.
2642 (SimpleName.DoSimpleNameResolve): Update to changes.
2643 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
2644 (MemberAccess.IdenticalNameAndTypeName): Remove.
2645 (MemberAccess.error176): Move to MemberExpr.
2646 (MemberAccess.DoResolve): Update to changes.
2647 (BaseAccess.DoResolve): Likewise.
2649 2005-03-30 Marek Safar <marek.safar@seznam.cz>
2651 C# 2.0 Conditional attribute class implementation
2653 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
2654 Analyzes class whether it has attribute which has ConditionalAttribute
2655 and its condition is not defined.
2657 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
2658 (Class.IsExcluded): New method. Search for at least one defined
2659 condition in ConditionalAttribute of attribute class.
2661 2005-03-30 Raja R Harinath <rharinath@novell.com>
2663 * ecore.cs (PropertyExpr): Derive from Expression, not
2664 ExpressionStatement.
2665 (PropertyExpr.EmitStatement): Remove.
2667 2005-03-29 Raja R Harinath <rharinath@novell.com>
2670 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
2671 internal field "value__" of an enum be private. The examples for
2672 "value__" that I found on MSDN all used FieldAttributes.Private.
2674 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
2675 Don't mention IL method attribute names.
2677 Fix #47991. Remove a TODO.
2678 * statement.cs (Block.Toplevel): Make into a field.
2679 (Block.Parameters): Move into ToplevelBlock.
2680 (Block.known_variables): Rename from child_variable_names.
2681 (Block.Block): Remove variants that take Parameters. Initialize
2682 'Toplevel' with the immediately surrounding toplevel block.
2683 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
2684 LocalInfo parameter.
2685 (Block.GetKnownVariableInfo): New.
2686 (Block.IsVariableNameUsedInChildBlock): Update.
2687 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
2688 the block, even though it may not be in scope.
2689 (Block.AddVariable): Remove Parameters parameter. Use
2690 Toplevel.Parameters instead.
2691 (Block.AddConstant): Remove Parameters parameter.
2692 (Block.GetParameterReference): Update to use Toplevel.Parameters.
2693 (Block.IsParamaterReference): Likewise.
2694 (Block.IsLocalParameter): Likewise. Simplify a lot.
2695 (ToplevelBlock.Parameters): New. Moved from Block.
2696 (ToplevelBlock.ToplevelBlock): Update to changes. Always
2697 initialize Parameters to a non-null value.
2698 * cs-parser.jay: Update to changes.
2699 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
2700 simple names that mean different things in the same block. Use
2701 Block.IsVariableNameUsedInBlock.
2703 2005-03-28 Raja R Harinath <rharinath@novell.com>
2705 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2706 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2707 GetTypeHandle. It is possible for a reflected type to derive from
2708 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2709 System.Array during mscorlib compilation).
2710 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2711 contain a method_hash, don't create one either. Don't create a
2712 deep copy of the base cache's method_hash.
2713 (MemberCache.SetupCache): Rename back from DeepCopy.
2714 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2715 already initialized. If we see an override function, add its
2716 underlying base virtual function to the member_hash too.
2718 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
2720 2005-03-26 Raja R Harinath <harinath@acm.org>
2723 * assign.cs (Assign.DoResolve): When the RHS of an assignment
2724 fails to resolve, ensure that the LHS is still resolved as an
2727 2005-03-25 Raja R Harinath <harinath@acm.org>
2729 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
2731 (Enum.current_ec): Remove.
2732 (Enum.LookupEnumValue): Remove EmitContext argument.
2733 Just uses the one created during DefineType.
2734 (Enum.FindMembers): Update.
2735 * expression.cs (MemberAccess.DoResolve): Update.
2737 2005-03-22 Marek Safar <marek.safar@seznam.cz>
2739 * assign.cs (Assign.DoResolve): Check for CS1717 when
2740 source and target are same (uses Equals).
2742 * expression.cs (LocalVariableReference, ParameterReference,
2743 This): Implemented Equals, GetHashCode.
2745 * statement.cs (Block.GetParameterReference): Removed useless
2748 2005-03-22 Raja R Harinath <rharinath@novell.com>
2751 * statement.cs (Block.AddVariable): Ensure that we skip implicit
2752 blocks before deciding whether the error is cs0136 or cs0128.
2754 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
2755 (using_alias_directive, using_namespace_directive): Pass
2756 MemberName, not an expression to Namespace.UsingAlias and
2758 (MakeName): Use the MemberName of the namespace.
2759 * namespace.cs (Namespace.MemberName): New.
2760 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
2761 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
2763 * decl.cs (MemberName.Name): Make readonly.
2764 (MemberName.FromDotted): New "constructor".
2765 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
2766 (MemberCore.Name): Compute from MemberName on demand.
2767 (MemberCore.SetMemberName): Provide a way to change the
2769 (MemberCore.AddToContainer): Don't take a fullname parameter.
2770 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
2771 fully qualified name of the container to the member name.
2772 (TypeContainer.AddToTypeContainer): Use a fully qualified name
2773 only if the type is a member of the root container.
2774 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
2775 MemberName.Left rather than searching for an embedded ".".
2776 (PartialContainer.CreatePart): Update to changes in RootContext.
2777 (MemberBase.ShortName): Turn into a property. Use
2778 MemberCore.SetMemberName.
2779 (MemberBase.ExplicitInterfaceName): Remove.
2780 (MemberBase.UpdateMemberName): Remove.
2781 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2782 (PropertyBase.SetMemberName): New override.
2783 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2784 (Tree.GetDecl): New.
2785 (Tree.AllDecls): Rename from Decls.
2786 * attribute.cs, enum.cs, report.cs: Update to changes.
2787 * driver.cs (MainDriver): Use MemberName.FromDotted on
2788 RootContext.MainClass.
2790 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2792 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2795 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2797 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2799 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2800 property accessor modifiers.
2802 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2803 fixed buffer attribute (CS1716).
2804 (PropertyMethod.HasCustomAccessModifier): When property accessor
2805 has custom modifier.
2807 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2809 (PropertyExpr.DoResolveLValue): Add CS0272.
2811 2005-03-17 Miguel de Icaza <miguel@novell.com>
2813 * convert.cs: When converting to a pointer, use the proper Conv.U
2814 or Conv.I depending on the source data type.
2816 * cs-tokenizer.cs: Make the size for large decimal constants,
2819 2005-03-17 Martin Baulig <martin@ximian.com>
2821 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2822 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2824 2005-03-17 Martin Baulig <martin@ximian.com>
2826 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2827 to bool so we can return an error condition.
2828 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2831 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2833 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2836 2005-03-16 Raja R Harinath <rharinath@novell.com>
2838 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2839 Refactor to avoid traversing the list of assemblies, and to avoid
2840 string concatenation.
2841 * typemanager.cs (guid_attr_type): Remove.
2842 (negative_hits, pointers, references): Remove hashes.
2844 (GetConstructedType): New. Uses type_hash to handle constructed
2845 types (arrays, references, pointers).
2846 (GetReferenceType, GetPointerType): Use it.
2847 (GetNestedType): New. Uses type_hash to handle nested types of
2849 (LookupType, LookupTypeDirect): Remove.
2850 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2851 'types' hash and LookupTypeReflection directly.
2852 (params_string, params_object): Use GetConstructedType.
2853 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2855 (Namespace.Lookup): Use cached_types.
2856 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2857 provided by old TypeManager.LookupType.
2858 * rootcontext.cs (MakeFQN): Remove.
2859 * decl.cs (DeclSpace.MakeFQN): Likewise.
2860 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2861 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2862 TypeManager.GetConstructedType.
2863 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2865 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2867 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2870 * cs-parser.jay: Reports CS1527 for any namespace element.
2872 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2875 * expression.cs (ParameterReference.IsAssigned): Changed error to
2877 (Error_WrongNumArguments): Moved CS0245 detection here.
2879 * statement.cs (Return.Resolve): Add CS1622 report.
2881 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2883 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2885 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2887 * attribute.cs expression.cs: Get rid of some allocations.
2889 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2891 * doc.cs : just eliminate the latest change.
2893 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2895 * doc.cs : commented out the latest change. It breaks xml-030.cs
2897 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2899 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2900 fail. So invoke CreateType() in FindDocumentedType().
2902 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2904 * cs-tokenizer.cs : added IsKeyword().
2905 * doc.cs : Detect keyword incorrectly used as identifier.
2906 Allow identifiers prefixed by @.
2908 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2910 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2911 It caused exception in namespace resolving (again!).
2913 * class.cs (Class.ctor): Removed exit.
2914 (PropertyMethod.ctor): ditto.
2916 * codegen.cs (Codegen.Reset): Reset static data.
2917 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2919 * cs-tokenizer.cs (Cleanup): Removed.
2921 * driver.cs (GetSystemDir): Rewrote to one line command.
2922 It caused problem with unloaded dynamic modules.
2923 (UnixParseOption): Removed Exit.
2924 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2925 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2926 Now can be mcs used as library.
2928 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2931 * location.cs (Reset): Reset static data.
2933 * namespace.cs (Reset): Reset static data.
2935 * report.cs (Report.Reset): Reset static data.
2937 * rootcontext.cs (RootContext.Reset): Reset static data.
2939 * tree.cs (RootTypes.ctor): Use Location.Null
2941 * typemanager.cs (TypeManager.Reset): Reset static data.
2942 (CoreLookupType): Removed Exit.
2943 (TypeHandle.Reset): Reset static data.
2945 2005-03-10 Raja R Harinath <rharinath@novell.com>
2948 * typemanager.cs (ComputeNamespaces): Import namespaces from
2949 referenced modules too.
2951 2005-03-09 Raja R Harinath <rharinath@novell.com>
2953 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2956 2005-03-09 Raja R Harinath <rharinath@novell.com>
2958 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2959 enclosing DeclSpace. This ensures that a name-lookup populates
2960 more caches and there are fewer 'TypeExpression's. Carve out
2961 nested type lookup into ...
2962 (LookupNestedTypeInHierarchy): ... this.
2964 2005-03-09 Raja R Harinath <rharinath@novell.com>
2966 Clean up a few partial-class semantics.
2967 Fixes test-357.cs and cs1618-2.cs.
2968 * cs-parser.jay (struct_declaration): Use 'current_class' as
2969 parent of newly-created struct. Remove call to Register ().
2970 Use 'pop_current_class' to complete handing the current struct.
2971 (interface_declaration): Likewise.
2972 (class_declaration): Likewise.
2973 (enum_declaration): Use 'current_class' as parent of newly created
2975 (delegate_declaration): Likewise.
2976 (pop_current_class): New function. This is used to handle closing
2977 up the 'current_class' and 'current_container', and pointing them
2978 to the enclosing class/container.
2979 (CSharpParser): Initialize 'current_class' too.
2980 * decl.cs (MemberCore): Add check for invariant: a partial
2981 container is not a parsed entity, and thus does not enclose any
2983 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
2984 (DeclSpace.BaseTypeExpr): Use it.
2985 (DeclSpace.LookupType): Add check for invariant.
2986 * class.cs (TypeContainer): Add check for invariant: a nested
2987 class should have the same NamespaceEntry as its enclosing class.
2988 (TypeContainer.EmitFieldInitializers): Make virtual.
2989 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
2991 (TypeContainer.Register): Remove.
2992 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
2993 null. Use TypeResolveEmitContext for resolving base types and
2994 interfaces. Move initialization of Parts.TypeBuilder here from
2996 (TypeContainer.DefineNestedTypes): ... here.
2997 (PartialContainer): Take a Namespace not a NamespaceEntry.
2998 (PartialContainer.Create): Don't use Register. Call the
2999 appropriate Add... function directly.
3000 (ClassPart): Take both the PartialContainer and the enclosing
3001 class as constructor arguments.
3002 (ClassPart.EmitFieldInitializers): Override.
3003 (ClassPart.PartFindNestedTypes): Remove.
3004 (FieldBase.GetInitializerExpression): Resolve the initializer
3005 expression in the emit context of the enclosing class.
3006 * tree.cs (RootTypes): Remove Register ().
3008 2005-03-08 Marek Safar <marek.safar@seznam.cz>
3010 * cs-parser.jay: Removed CS0134.
3012 * driver.cs: Removed CS1901.
3014 * expression.cs (SizeOf.DoResolve): Don't report CS0233
3015 for predefined types.
3017 2005-03-07 Duncan Mak <duncan@novell.com>
3019 * codegen.cs (Save): Catch UnauthorizedAccessException as
3020 well. Fixes bug #73454.
3022 2005-03-07 Marek Safar <marek.safar@seznam.cz>
3024 * cs-tokenizer.cs (xtoken): Add CS1035.
3026 * class.cs (MethodData.Define): Add CS0683.
3027 (FieldMember.ctor): Add CS0681.
3029 2005-03-07 Raja R Harinath <rharinath@novell.com>
3031 * ecore.cs (SimpleName.DoResolve): Rename from
3032 SimpleName.DoResolveAllowStatic.
3033 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
3034 Pass 'intermediate' flag to MemberStaticCheck.
3035 (SimpleName.MemberStaticCheck): Skip "static check" only in case
3036 of "intermediate" lookups via MemberAccess.
3037 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
3038 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
3040 2005-03-07 Raja R Harinath <rharinath@novell.com>
3043 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
3044 slipped in because of variable names that are identical to a
3045 builtin type's BCL equivalent ('string String;', 'int Int32;').
3046 (PropertyExpr.EmitInstance): Likewise.
3048 2005-03-04 Marek Safar <marek.safar@seznam.cz>
3050 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
3052 * report.cs (warning_ignore_table): Made public.
3054 2005-03-04 Raja R Harinath <rharinath@novell.com>
3057 * class.cs (MethodData.Emit): Pass 'container' to
3058 container.GetObsoleteAttribute instead of 'container.Parent'.
3060 2005-03-03 Marek Safar <marek.safar@seznam.cz>
3062 * cs-parser.jay: Add 1534 error test.
3064 * iterators.cs (Yield.CheckContext): Add error 1629.
3065 (Iterator.ctor): Save unsafe modifier.
3066 (MoveNextMethod.DoEmit): Restore unsafe context.
3068 * namespace.cs (UsingAlias): Better error message.
3070 2005-03-03 Dan Winship <danw@novell.com>
3072 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
3073 the warning message [#73219]
3075 2005-03-03 Raja R Harinath <rharinath@novell.com>
3077 Fix compile with MCS 1.0.0.0.
3078 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
3079 w_restore to not depend on string constant folding.
3081 2005-03-03 Raja R Harinath <rharinath@novell.com>
3083 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
3084 CS0246 check to users who passed 'silent = false'.
3085 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
3087 (SimpleName.SimpleNameResolve): Update.
3088 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
3089 (MemberAccess.IdenticalNameAndTypeName): Update.
3090 * doc.cs (FindDocumentedTypeNonArray): Update.
3092 2005-03-03 Raja R Harinath <rharinath@novell.com>
3094 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
3095 * parameters.cs (ComputeAndDefineParameters): Remove.
3096 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
3097 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
3098 Use GetParameterInfo.
3100 2005-03-02 Marek Safar <marek.safar@seznam.cz>
3102 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
3104 2005-03-02 Raja R Harinath <rharinath@novell.com>
3106 Unify DeclSpace.LookupType and DeclSpace.FindType.
3107 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
3108 is in charge of defining nested types on demand.
3109 (DeclSpace.LookupType): Use it when the current_type is a
3110 TypeBuilder. Use LookupTypeDirect for reflected types.
3111 (DeclSpace.FindType): Remove.
3112 (DeclSpace.LookupInterfaceOrClass): Likewise.
3113 (DeclSpace.DefineTypeAndParents): Likewise.
3114 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
3115 DeclSpace.LookupType.
3116 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
3117 * typemanager.cs (LookupType): Simplify.
3118 (AddUserType): Remove type from negative_hits.
3119 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
3120 * class.cs (TypeContainer.FindMembers): Move handling of nested
3122 (TypeContainer.FindMembers_NestedTypes): ... here.
3123 (TypeContainer.FindNestedType): Implement override.
3124 (ClassPart.FindNestedType): Delegate to PartialContainer.
3125 (ClassPart.PartFindNestedType): Looks up the nested types of the
3128 2005-03-02 Martin Baulig <martin@ximian.com>
3130 * class.cs (TypeContainer.DoDefineMembers): We also need a default
3131 static constructor in static classes.
3133 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
3135 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
3136 sizeParamIndex is not specified.
3138 2005-03-01 Marek Safar <marek.safar@seznam.cz>
3141 * report.cs (WarningMessage.IsEnabled): Missing null check.
3143 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3145 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
3146 in the fields and not in the properties.
3148 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
3150 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
3153 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3155 * attribute.cs: Small refactoring (improved robustness).
3156 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
3157 (ValidateGuid): Removed.
3158 (Resolve): Removed referenced to above mentioned.
3159 (GetAttributeUsage): Made private and changed to work without
3161 (GetIndexerAttributeValue): Don't crash.
3162 (GetConditionalAttributeValue): Ditto.
3163 (GetClsCompliantAttributeValue): Ditto.
3164 (ExtractSecurityPermissionSet): All attributes exceptions are
3166 (GetPropertyValue): New helper.
3167 (GetMethodImplOptions): New method.
3168 (DefinePInvokeMethod): Reuse common code. Implemented handling of
3169 some missing properties.
3171 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
3172 (Method.ApplyAttributeBuilder): Updated.
3174 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
3177 2005-02-28 Raja R Harinath <rharinath@novell.com>
3180 * report.cs (Report.SymbolRelatedToPreviousError): Handle
3181 non-simple types (array, pointer, reference).
3183 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3185 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
3187 * class.cs (MethodCore.IsDuplicateImplementation): Special error
3189 (Method.CheckBase): Catch wrong destructor here.
3190 (MethodData.Define): Add errors 550, 668.
3192 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
3194 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
3196 * pending.cs (VerifyPendingMethods): Add error 551.
3198 * typemanager.cs (CSharpName): Next error report helper.
3200 2005-02-25 Marek Safar <marek.safar@seznam.cz>
3202 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
3203 attributes. Removed useless attribute double check.
3204 It saves almost 2MBs for corlib.
3206 2005-02-25 Raja R Harinath <rharinath@novell.com>
3209 * statement.cs (ExpressionStatement.Resolve): Make robust to being
3210 called twice in case of error.
3212 2005-02-23 Chris Toshok <toshok@ximian.com>
3214 Fix compiler portions of #72827.
3215 * statement.cs (Block.Emit): call Begin/EndScope on the
3216 EmitContext instead of the ILGenerator.
3218 * codegen.cs (EmitContext.BeginScope): new method, call
3219 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
3221 (EmitContext.BeginScope): same, but EndScope and CloseScope
3223 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
3224 offset and call the superclass's OpenScope(int) with it.
3225 (SymbolWriter.CloseScope): get the current il
3226 offset and call superclass's CloseScope(int) with it.
3228 2005-02-23 Marek Safar <marek.safar@seznam.cz>
3230 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
3231 CS1677 for out and ref as well.
3233 * class.cs (Method.Define): Add error CS1599 detection.
3235 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
3237 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
3239 * delegate.cs (Delegate.Define): Add error CS1599 detection.
3241 * support.cs.cs (ModifierDesc): New helper method.
3243 2005-02-23 Raja R Harinath <rharinath@novell.com>
3244 Abin Thomas <projectmonokochi@rediffmail.com>
3245 Anoob V E <projectmonokochi@rediffmail.com>
3246 Harilal P R <projectmonokochi@rediffmail.com>
3249 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
3250 MemberLookup (used for error reporting) actually returns a result.
3251 Fix error report number (122, not 112).
3253 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
3254 Anoob V E <projectmonokochi@rediffmail.com>
3255 Harilal P R <projectmonokochi@rediffmail.com>
3258 * pending.cs (PendingImplementation.GetAbstractMethods):
3259 Find NonPublic members too.
3261 2005-02-22 Marek Safar <marek.safar@seznam.cz>
3263 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
3266 * class.cs (MethodCore.CheckMethodAgainstBase):
3267 Add error 239 report.
3269 2005-02-21 Raja R Harinath <rharinath@novell.com>
3272 * expression.cs (Invocation.IsApplicable): Make public.
3273 (Invocation.IsParamsMethodApplicable): Likewise.
3274 * delegate.cs (Delegate.VerifyApplicability): Don't use
3275 Invocation.VerifyArgumentCompat for parameter applicability
3276 testing. Use Invocation.IsApplicable and
3277 Invocation.IsParamsMethodApplicable.
3279 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3281 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
3283 * class.cs (Operator.Define): Add error 217 report.
3285 2005-02-21 Raja R Harinath <rharinath@novell.com>
3287 * namespace.cs (UsingEntry.Resolve): Undo change below.
3289 2005-02-21 Raja R Harinath <rharinath@novell.com>
3292 * ecore.cs (Expression.MemberLookupFailed): Add argument to
3293 disable the error message when the extended MemberLookup also
3295 (Expression.MemberLookupFinal): Update.
3296 (SimpleName.DoSimpleNameResolve): Update.
3297 * expression.cs (MemberAccess.ResolveNamespaceOrType):
3298 Don't use MemberLookupFinal.
3299 (New.DoResolve): Update.
3300 (BaseAccess.CommonResolve): Update.
3302 2005-02-21 Raja R Harinath <rharinath@novell.com>
3305 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
3306 occured previously, don't resolve again.
3308 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3311 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
3312 argument. Call ResolveAttributeUsage for unresolved.
3313 when types doesn't match ctor arguments.
3315 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
3316 for nested attribute classes.
3317 (Class.attribute_usage): Removed.
3318 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
3319 for attribute class.
3321 * ecore.cs (IsAttribute): Removed.
3323 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
3325 * rootcontext.cs (RegisterAttribute): Removed, attributes are
3327 (attribute_types): Removed.
3328 (EmitCode): Global attributes are emited as the latest.
3330 2005-02-18 Marek Safar <marek.safar@seznam.cz>
3332 * class.cs (EmitFieldInitializers): Don't emit field initializer
3333 for default values when optimilization is on.
3335 * constant.cs (Constant.IsDefaultValue): New property.
3337 * driver.cs: Add /optimize handling.
3341 * literal.cs: Implement new IsDefaultValue property.
3343 * rootcontext.cs (Optimize): New field, holds /optimize option.
3345 2005-02-18 Raja R Harinath <rharinath@novell.com>
3347 Fix crasher in re-opened #72347.
3348 * namespace.cs (Namespace.Lookup): Return null if
3349 DeclSpace.DefineType returns null.
3352 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
3354 2005-02-18 Raja R Harinath <rharinath@novell.com>
3356 Fix remainder of #63202. Change semantics of DoResolveLValue: it
3357 now returns null if it cannot resolve to an lvalue.
3358 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
3359 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
3360 returned null. Remove check for SimpleName.
3361 (EventExpr.DoResolveLValue): New.
3362 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
3363 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
3365 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
3367 (Unary.ResolveOperator): Move CS0211 check ...
3368 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
3370 (Unary.DoResolveLValue): Simplify.
3371 (AddressOf.DoResolveLValue): New.
3372 (ArrayAccess.DoResolveLValue): New.
3374 2005-02-16 Marek Safar <marek.safar@seznam.cz>
3376 * attribute.cs (Attribute.Resolve): Add arguments casting for
3377 when types doesn't match ctor arguments.
3379 2005-02-16 Raja R Harinath <rharinath@novell.com>
3381 Fix parts of #63202.
3382 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
3383 lookup of operator in base type. Ensure that all checks happen
3384 when the operator resolves to an "op_..." method.
3386 2005-02-15 Raja R Harinath <rharinath@novell.com>
3389 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
3390 'ignore_cs0104' parameter. Pass it to ...
3391 (NamespaceEntry.Lookup): ... this.
3392 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
3393 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
3394 (TypeLookupExpression.DoResolveAsTypeStep): Update.
3395 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
3396 Update. Request that cs0104 errors be ignored.
3397 (ComposedCast.ResolveAsTypeStep): Update.
3399 2005-02-14 Raja R Harinath <rharinath@novell.com>
3402 * expression.cs (Invocation.BetterFunction): Remove support for
3403 comparing virtual functions and their overrides.
3404 (Invocation.IsOverride): New.
3405 (Invocation.OverloadResolve): Don't consider 'override' functions
3406 during candidate selection. Store them in a lookaside list.
3407 If the selected method is a 'virtual' function, use the list to
3408 find any overrides that are closer to the LHS type.
3410 2005-02-14 Marek Safar <marek.safar@seznam.cz>
3412 * expression.cs (New.DoResolve): Add complex core type reduction.
3413 (New.Constantify): Converts complex core type syntax like 'new int ()'
3416 2005-02-14 Raja R Harinath <rharinath@novell.com>
3418 * decl.cs (EntryType.EntryType): New constructor to create an
3419 updated copy of a cache entry.
3420 (MemberCache.AddMethods): Use it.
3421 (MemberCache.ClearDeclaredOnly): Remove.
3422 (MemberCache.MemberCache): Update.
3424 2005-02-11 Miguel de Icaza <miguel@novell.com>
3426 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
3427 variable. This one is represents the actual low-level declaration
3428 of the method, as opposed to the semantic level `IsStatic'.
3430 An anonymous method which is hosted into a static method might be
3431 actually an instance method. IsStatic would reflect the
3432 container, while MethodIsStatic represents the actual code
3435 * expression.cs (ParameterReference): Use the new MethodIsStatic
3436 instead of IsStatic.
3438 * anonymous.cs (AnonymousMethod.Compatible): Pass the
3439 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
3440 set on the current EmitContext.
3442 * expression.cs (Cast): Overload DoResolveLValue so we can pass
3443 resolve our casted expression as an LValue. This triggers the
3444 proper LValue processing that is later required by Assign.
3448 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
3450 2005-02-11 Marek Safar <marek.safar@seznam.cz>
3452 C# 2.0 Fixed buffer implementation
3454 * anonymous.cs: Update after RegisterHelperClass renaming.
3456 * attribute.cs (AttributeTester.fixed_buffer_cache):
3457 Cache of external fixed buffers.
3458 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
3459 implementation if field is fixed buffer else null.
3462 (TypeContainer.AddField): Accept FieldMember instead of Field.
3463 (FieldBase.IsFieldClsCompliant): Extracted code from
3464 VerifyClsCompliance descendant customization.
3465 (FixedField): New class handles fixed buffer fields.
3466 (FixedFieldExternal): Keeps information about imported fixed
3468 (IFixedField): Make access to internal or external fixed buffer
3471 * cs-parser.jay: Add fixed buffer parsing.
3473 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
3476 * expression.cs (Indirection): Extended implementation to accept
3478 (PointerArithmetic.Emit): Get element from fixed buffer as well.
3479 (ElementAccess.MakePointerAccess): Get type as parameter.
3480 (DoResolve): Add fixed buffer field expression conversion.
3481 (DoResolveLValue): Ditto.
3482 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
3483 (ArrayPtr): Derives from FixedBufferPtr.
3484 (ArrayPtr.Emit): Add extra emit for array elements.
3486 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
3488 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
3489 for compiler generated types.
3490 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
3492 * statement.cs (Fixed): Refactored to be easier add fixed buffer
3493 and consume less memory.
3494 (Fixed.Resolve): Add fixed buffer case.
3496 * typemanager.cs (compiler_generated_attr_ctor,
3497 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
3498 (HasElementType): Add our own implementation to work on every
3501 2005-02-11 Miguel de Icaza <miguel@novell.com>
3503 * anonymous.cs (CaptureContext): Track whether `this' has been
3506 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
3507 only captured `this' if it was implicitly done (instance
3508 methods/variables were used).
3510 * codegen.cs (EmitContext.CaptureThis): New method to flag that
3511 `this' must be captured.
3513 2005-01-30 Miguel de Icaza <miguel@novell.com>
3515 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
3516 is null it means that there has been no need to capture anything,
3517 so we just create a sibling.
3519 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
3521 Just a partial fix. The other half is fairly elusive.
3523 2005-02-10 Raja R Harinath <rharinath@novell.com>
3525 Fix #52586, cs0121-4.cs.
3526 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
3527 and return a hashtable.
3528 (MemberCache.ClearDeclaredOnly): New.
3529 (MemberCache.MemberCache): Update to change. Make a deep copy of
3530 the method_hash of a base type too.
3531 (MemberCache.AddMethods): Adapt to having a deep copy of the base
3532 type methods. Overwrite entries with the same MethodHandle so
3533 that the ReflectedType is correct. The process leaves in base
3534 virtual functions and their overrides as distinct entries.
3535 (CacheEntry): Now a class instead of a struct. It shouldn't alter
3536 matters since it was boxed in a ArrayList before.
3537 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
3539 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
3540 case of a virtual function and its override (choose the overload
3542 (Invocation.OverloadResolve): Avoid 'override' members during
3543 'applicable_type' calculation.
3545 2005-02-09 Raja R Harinath <rharinath@novell.com>
3547 Combine two near-redundant caches.
3548 * typemanager.cs (method_params): Rename from method_internal_params.
3549 (TypeManager.GetParameterData): New. Replace
3550 Invocation.GetParameterData.
3551 (TypeManager.LookupParametersByBuilder): Remove.
3552 * expression.cs (Invocation.method_parameter_cache): Remove.
3553 (Invocation.GetParameterData): Remove.
3555 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
3558 2005-02-08 Raja R Harinath <rharinath@novell.com>
3561 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
3562 TypeManager.multicast_delegate_type is null, resolve it by looking
3563 up "System.MulticastDelegate".
3564 * rootcontext.cs (RootContext.ResolveCore): Simplify.
3566 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
3567 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
3568 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
3571 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
3572 (LabeledStatement.AddReference): New. Set 'referenced'.
3573 (Goto.Resolve): Use it.
3575 2005-02-05 John Luke <john.luke@gmail.com>
3577 * driver.cs: remove duplicate -doc line in Usage ()
3579 2005-02-04 Raja R Harinath <rharinath@novell.com>
3581 * location.cs (Location.AddFile): Fix CS2002 error report.
3583 2005-02-02 Martin Baulig <martin@ximian.com>
3585 * delegate.cs (Delegate.DefineType): Report an internal error if
3586 TypeManager.multicast_delegate_type is null. See bug #72015 for
3589 2005-02-02 Raja R Harinath <rharinath@novell.com>
3591 Fix a crasher in a variant of #31984.
3592 * const.cs (Constant.CheckBase): New override that defers the
3593 new-or-override check in case the base type hasn't been populated
3595 (Constant.Define): Ensure the new-or-override check is performed.
3597 2005-02-01 Duncan Mak <duncan@ximian.com>
3599 * const.cs (LookupConstantValue): Check that `ce' is not null
3600 before calling GetValue ().
3602 2005-02-01 Raja R Harinath <rharinath@novell.com>
3604 Fix test-334.cs (#69519).
3605 * cs-parser.jay (using_alias_directive): Pass in an expression to
3606 NamespaceEntry.UsingAlias.
3607 (using_namespace_directive): Pass in an expression to
3608 NamespaceEntry.Using.
3609 (namespace_name): Don't flatten to a string.
3610 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
3611 (NamespaceEntry.AliasEntry.Resolve): Lookup using
3613 (NamespaceEntry.UsingEntry): Likewise.
3614 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
3616 (NamespaceEntry.LookupForUsing): Remove.
3617 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
3619 (NamespaceEntry.Lookup): Remove support for dotted names.
3621 2005-02-01 Raja R Harinath <rharinath@novell.com>
3623 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
3625 (NamespaceEntry.ImplicitParent): Compute on demand.
3626 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
3627 parallels the current.
3628 (NamespaceEntry.LookupForUsing): Use it.
3629 (NamespaceEntry.Lookup): If the current namespace-entry is
3630 implicit, don't search aliases and using tables.
3632 2005-02-01 Raja R Harinath <rharinath@novell.com>
3635 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
3637 (TypeContainer.BaseCache): Compute on demand.
3638 (TypeContainer.FindMembers): Define constants and types if they're
3639 not already created.
3640 (FieldMember.Define): Move resetting of ec.InUnsafe before error
3642 * const.cs (Constant.Define): Make idempotent.
3644 2005-01-29 Miguel de Icaza <miguel@novell.com>
3646 * pending.cs: Produce better code (no nops produced by using Ldarg
3649 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
3650 i - 1' it should be arg + 1.
3654 2005-01-28 Raja R Harinath <rharinath@novell.com>
3656 * attribute.cs (Attribute.CheckAttributeType): Make private
3658 (Attribute.ResolveType): Make virtual.
3659 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
3660 handling of RootContext.Tree.Types.
3662 2005-01-27 Raja R Harinath <rharinath@novell.com>
3664 Update attribute-handling to use the SimpleName/MemberAccess
3666 * cs-parser.jay (attribute): Pass in an expression to the
3667 constructors of Attribute and GlobalAttribute.
3668 * attribute.cs (Attribute): Take an expression for the name.
3669 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
3670 passed in attribute name expression.
3671 (Attribute.CheckAttributeType): Use it.
3672 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
3673 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
3674 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
3675 argument to prevent error messages if the lookup fails.
3677 2005-01-27 Marek Safar <marek.safar@seznam.cz>
3679 * expression.cs (Indirection): Implemented IVariable interface
3680 to support indirection in AddressOf operator.
3681 (PointerArithmetic.Emit): Add optimalization for case where
3682 result can be precomputed.
3684 2005-01-26 Martin Baulig <martin@ximian.com>
3686 * class.cs (TypeContainer.AttributeTargets): Return the correct
3687 AttributeTargets depending on our `Kind' instead of throwing an
3688 exception; fixes #71632.
3690 2005-01-26 Marek Safar <marek.safar@seznam.cz>
3693 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
3696 2005-01-25 Raja R Harinath <rharinath@novell.com>
3699 * expression.cs (MemberAccess.DoResolve): Don't complain with
3700 cs0572 when the LHS of a member access has identical name and type
3703 2005-01-25 Marek Safar <marek.safar@seznam.cz>
3706 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
3708 Create custom PermissionSet only for PermissionSetAttribute.
3710 2005-01-24 Marek Safar <marek.safar@seznam.cz>
3713 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
3714 delegates in static class.
3716 2005-01-24 Martin Baulig <martin@ximian.com>
3718 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3719 merging an implicit block, just use its reachability.
3721 * statement.cs (Block.Resolve): Make the unreachable code check
3722 work wrt. implicit blocks; see test-337 from #63842.
3724 2005-01-21 Alp Toker <alp@atoker.com>
3726 * cs-parser.jay: destructor_declaration's container is PartialContainer
3727 not Class when partial types are used, so use Kind prop instead of
3730 2005-01-22 Miguel de Icaza <miguel@ximian.com>
3732 * cs-parser.jay: Improve error reporting when an interface
3735 2005-01-20 Dick Porter <dick@ximian.com>
3737 * support.cs: SeekableStreamReader fix from Sandor Dobos
3738 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
3739 chars are read. Fixes bug 70369.
3741 2005-01-20 Raja R Harinath <rharinath@novell.com>
3743 * cs-parser.jay (catch_clause): Simplify current_block handling
3746 2005-01-17 Miguel de Icaza <miguel@ximian.com>
3748 * convert.cs (ImplicitStandardConversionExists): Synchronize the
3749 code with ImplicitStandardConversion to handle the implicit
3750 conversion of method groups into valid delegate invocations.
3752 The problem is that in parameter handling we were using this code
3753 path. Fixes bug #64698
3755 2005-01-19 Raja R Harinath <rharinath@novell.com>
3757 * cs-parser.jay: Fix several infelicities.
3758 - Avoid assigning to the parser value stack. Code like
3759 '$3 = null' is unclean. Synthesize a value for the code block
3761 - Avoid using oob_stack for storing location information. Use ...
3762 (_mark_): ... this. New (empty) rule. Saves the current location
3764 (foreach_statement): Avoid using oob_stack for current_block
3765 handling. Use technique used in for_statement and
3766 using_statement. Synthesize a value for the code block to store
3767 additional intermediate information.
3769 2005-01-13 Miguel de Icaza <miguel@ximian.com>
3771 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
3772 of a different type is only allowed to private fields of a
3773 containing type, not on fields of a base class.
3775 See test-174.cs and error cs0122-9.cs
3777 2005-01-13 Raja R Harinath <rharinath@novell.com>
3779 Fix test-335.cs (bug #58126).
3780 * cs-parser.jay (argument): Split out non-expression parts of the
3781 rule into 'non_simple_argument'.
3782 (invocation_expression): Support parenthesized invocations with
3783 multiple arguments, and with single non-simple arguments.
3785 2005-01-13 Raja R Harinath <rharinath@novell.com>
3787 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3790 2005-01-12 Raja R Harinath <rharinath@novell.com>
3792 Fix cs0038-1.cs, cs1640-6.cs.
3793 * ecore.cs (Expression.Resolve): Remove special-case for
3794 SimpleName in error-handling.
3795 (Expression.almostMatchedMembers): Relax access permission to
3797 (Expression.MemberLookupFailed): Handle duplicates in
3798 almostMatchedMembers list.
3799 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3800 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3801 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3802 overload if the passed in MemberInfo is a MethodBase.
3804 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3807 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3808 for non-CAS & merge permission sets properly.
3810 2005-01-11 Raja R Harinath <rharinath@novell.com>
3812 Improve standard-compliance of simple name and member access
3813 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3814 * ecore.cs (FullNamedExpression): New abstract base class
3815 for Namespaces and TypeExpressions.
3816 (ResolveFlags.SimpleName): Remove.
3817 (SimpleName): Remove support for dotted names.
3818 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3819 DeclSpace.FindType and DeclSpace.LookupType.
3820 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3821 (Expression.ExprClassName): Make member function.
3822 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3823 a namespace. Remove creation of dotted "SimpleName"s.
3824 (MemberAccess.DoResolve): Likewise.
3825 * decl.cs (DeclSpace.Cache): Make private.
3826 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3827 (DeclSpace.FindType): Update.
3828 (DeclSpace.LookupType): Move here from RootContext. Return a
3829 FullNamedExpression.
3830 * namespace.cs (Namespace): Derive from FullNamedExpression
3831 so that it can be part of expression resolution.
3832 (Namespace.Lookup): Return an FullNamedExpression.
3833 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3835 * rootcontext.cs (NamespaceLookup): Remove.
3836 (LookupType): Move to DeclSpace.
3837 * attribute.cs (CheckAttributeType): Update.
3838 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3839 (FindDocumentedTypeNonArray): Likewise.
3841 2005-01-11 Raja R Harinath <rharinath@novell.com>
3843 Fix cs0509.cs, cs1632.cs.
3844 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3845 is the same as IsInterface.
3846 (TypeContainer.GetClassBases): Likewise.
3847 * statement.cs (LabeledStatement.ig): New field.
3848 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3850 (LabeledStatement.DoEmit): Check that the label was created with
3851 the same ILGenerator.
3853 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3856 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3857 accessors to its properties.
3859 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3860 from accessors to property.
3862 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3865 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3868 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3870 * attribute.cs: Check for null and empty strings.
3872 I have lost another battle to Paolo.
3874 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3877 * class.cs (PropertyMethod): Set Parent field in ctors.
3878 (SetMethod.InternalParameters): Add unsafe switch hack.
3879 Override MarkForDuplicationCheck where it is appropriate.
3881 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3882 It says whether container allows members with the same name.
3884 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3885 Removed is_method parameter.
3887 2005-01-06 Duncan Mak <duncan@ximian.com>
3889 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3890 because the previous change led to incorrect reporting of CS1032
3891 ("Cannot define/undefine preprocessor symbols after first token in
3892 file"). Instead of using `tokens_seen' as the only flag that
3893 triggers CS1040, introduce `comments_seen'. This new flag is used
3894 to signify having seen comments on the current line, so it is
3895 unset after a newline.
3897 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3899 * doc.cs : When searching for a type, find nested type too.
3900 This fixes bug #71040.
3902 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3905 - Warn missing member comment on those classes which also does not
3906 have doc comments. Fixed bug #71041.
3907 - Don't warn missing doc comment on default constructor.
3910 2005-01-06 Duncan Mak <duncan@ximian.com>
3912 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3913 comments, set `tokens_seen' to true. This allows us to detect
3914 misplaced preprocessor directives (i.e. not at the beginning of
3915 the a line, nor after whitespaces). In that case, report error
3916 CS1040. This fixes bug #56460.
3918 * cs-parser.jay (interface_member_declaration): Add checks for
3919 IsExplicitImpl, and report CS0541 error if an interface member is
3920 defined as an explicit interface declaration.
3922 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3925 * class.cs (PropertyMethod): Set Parent field in ctors.
3926 (SetMethod.InternalParameters): Add unsafe switch hack.
3928 * decl.cs (MemberCore.Parent): Cannot be readonly.
3930 2005-01-06 Raja R Harinath <rharinath@novell.com>
3932 * decl.cs (DeclSpace.ResolveType): Remove.
3933 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3934 Merge in code from ...
3935 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3936 * class.cs, enum.cs: Update to changes.
3938 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3940 * anonymous.cs: Ensure that we init the scope of our parent if it
3941 has not been initialized yet.
3943 2004-12-30 Duncan Mak <duncan@ximian.com>
3945 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3946 if field.FieldBuilder is null. Fixes #70758.
3948 * convert.cs: Fixed some typos and updated some of the comments.
3949 (ImplicitStandardConversionExists):
3950 (TryImplicitIntConversion): If `target_type' is an interface and
3951 the type of `ic' implements this interface, return true or a new
3952 BoxedCast instead of null. This fixes #70468.
3954 2004-12-29 Duncan Mak <duncan@ximian.com>
3956 * expression.cs (Argument.Emit): Check that Expr is
3957 IMemoryLocation before casting to it, and report CS1510 otherwise.
3961 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3963 * statement.cs (Block.ThisVariable): remove the recursion here, to
3964 make the --profile more sane.
3966 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3968 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3969 assembly, by JB Evain.
3971 2004-12-17 Raja R Harinath <rharinath@novell.com>
3973 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
3974 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
3975 "parent" refers to enclosing type/class. "base" refers to superclass.
3977 2004-12-17 Raja R Harinath <rharinath@novell.com>
3979 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3980 Ensure that we only have GlobalAttributes.
3981 * attribute.cs (Attribute.Emit): Make non-virtual.
3982 (GlobalAttribute.Emit): Remove.
3983 (Attribute.Resolve): Make virtual.
3984 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
3985 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
3986 the argument. Don't create one.
3987 (Attribute.GetObsoleteAttribute): Likewise.
3988 (Attribute.GetClsCompliantAttributeValue): Likewise.
3989 * class.cs, decl.cs: Update to changes.
3991 2004-12-17 Marek Safar <marek.safar@seznam.cz>
3993 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
3995 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
3997 * statement.cs (Foreach.Resolve): Add error 186 report.
3999 2004-12-16 Marek Safar <marek.safar@seznam.cz>
4001 * expression.cs (Conditional.DoResolve): Add warning 429.
4003 * statement.cs (If.Resolve): Add warning 665.
4005 2004-12-16 Raja R Harinath <rharinath@novell.com>
4007 New invariant: RootContext.Tree.Types.NamespaceEntry == null
4008 except when in the parser, and in GlobalAttribute.
4009 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
4010 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
4011 RootContext.Tree.Types.NamespaceEntry once work is done.
4012 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
4013 and resets RootContext.Tree.Types.NamespaceEntry.
4015 2004-12-15 Marek Safar <marek.safar@seznam.cz>
4017 * cs-parser.jay: Don't create a block for every variable.
4019 2004-12-14 Miguel de Icaza <miguel@ximian.com>
4021 * location.cs: Provide extra information.
4023 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
4024 variables from the captured environment, it is the ldarg_0.
4026 2004-12-14 Marek Safar <marek.safar@seznam.cz>
4028 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
4031 * class.cs: Changed warning level for 169 to avoid developer
4032 displeasure from warning flooding. It will be changed back when they
4033 fix most of current BCL warnings.
4035 * RootContext.cs: Pushed default WarningLevel to 3.
4037 * statement.cs: Removed unused variable.
4039 2004-12-14 Marek Safar <marek.safar@seznam.cz>
4041 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
4042 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
4043 Add error 502 report.
4044 (StaticClass.DefineType): Add error 441 report.
4045 (Class.AllowedModifiersProp): New virtual property as temporary
4046 extension to AllowedModifiers.
4047 (Class.DefineType): Add error 418 report. Moved ModFlags check here
4048 to share implementation with StaticClass and don't call virtual
4051 * driver.cs (MainDriver): Add error 1558 test.
4053 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
4054 report. Moved error 36 test here.
4056 * statement.cs (Throw.Resolve): Add error 724 report.
4058 * typemanager.cs: Add out_attribute_type core type.
4060 2004-12-13 Marek Safar <marek.safar@seznam.cz>
4062 * class.cs (TypeContainer.VerifyClsCompliance): Add error
4064 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
4066 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
4069 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
4071 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
4072 Add error 3023 report.
4073 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
4075 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
4078 2004-12-12 John Luke <john.luke@gmail.com>
4080 * driver.cs (AddArgs): take -- into account when
4081 adding arguments, fixes bug 65710
4083 2004-12-12 Martin Baulig <martin@ximian.com>
4085 * expression.cs (Unary.TryReduceNegative): Added support for
4086 SByteConstant and ByteConstant.
4087 (Unary.Reduce): Check error values from TryReduceNegative().
4089 2004-12-10 Marek Safar <marek.safar@seznam.cz>
4091 * attributes.cs (Attribute.Resolve): Avoid multiple error report
4092 and report exception as error 182.
4094 2004-12-10 Raja R Harinath <rharinath@novell.com>
4096 * driver.cs (Main): Fix message when there are warnings.
4098 2004-12-09 Miguel de Icaza <miguel@ximian.com>
4100 * delegate.cs: Fixed my fix from yesterday, sorry about that.
4102 2004-12-09 Marek Safar <marek.safar@seznam.cz>
4104 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
4105 Reduced number of warnings.
4107 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
4109 2004-12-08 Miguel de Icaza <miguel@ximian.com>
4111 * driver.cs: Removed message.
4113 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
4115 2004-12-08 <vargaz@freemail.hu>
4117 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
4119 2004-12-08 Martin Baulig <martin@ximian.com>
4121 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
4122 instead of a CS3002 for properties and indexer.
4124 2004-12-08 Martin Baulig <martin@ximian.com>
4126 * decl.cs (MemberName.ToString): Make this work again.
4128 2004-12-08 Marek Safar <marek.safar@seznam.cz>
4130 * attribute.cs (Resolve): Add error 591 detection.
4132 * class.cs (FieldMember.Define): Add error 1547 detection.
4133 (Indexer.Define): Add error 620 detection.
4134 (Operator.Define): Add error 590 detection.
4136 * ecore.cs: Missing argument for error 79.
4138 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
4141 2004-12-07 Marek Safar <marek.safar@seznam.cz>
4144 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
4147 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
4149 * cs-parser.jay : handle doc comments on implicit/explicit operators.
4150 Some operator comments were suppressed.
4151 * doc.cs : Implicit/explicit operator name in doc comments are like
4152 "op_Explicit(type)~returnType", so added suffix handling.
4154 2004-12-07 Martin Baulig <martin@ximian.com>
4157 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4158 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4159 (DeclSpace.ec): New protected field; store the EmitContext here.
4160 (DeclSpace.EmitContext): New public property; moved here from
4162 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4165 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4166 (Enum.Emit): Don't create a new EmitContext.
4168 * delegate.cs (Delegate.DefineType): Always create the
4171 * iterators.cs (Iterators.DefineIterator): Create a new
4172 EmitContext and store it in `ec'.
4174 2004-08-24 Martin Baulig <martin@ximian.com>
4177 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
4178 this for accessibility checks.
4179 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
4180 IsNestedFamilyAccessible.
4181 (TypeManager.IsSubclassOf): New method, do what the name actually
4184 2004-12-06 Raja R Harinath <rharinath@novell.com>
4186 Fix crash on cs0657-17.cs.
4187 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4188 Use RootContext.Tree.Types, not 'new RootTypes ()'.
4189 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
4190 the case where the NamespaceEntry gets overwritten.
4192 2004-12-06 Marek Safar <marek.safar@seznam.cz>
4194 Fixed #69195, #56821
4195 * ecore.cs (ResolveBoolean): Tiny refactoring.
4197 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
4198 of right expression resolving when left is false constant and
4199 operator is LogicalAnd OR true constant and operator is LogicalOr.
4201 * statement.cs (ResolveUnreachable): Always reports warning.
4203 2004-12-05 Miguel de Icaza <miguel@ximian.com>
4205 * class.cs: Distinguish between 1721 and 1722 (just a little help
4206 for the programmer).
4208 2004-12-03 Miguel de Icaza <miguel@ximian.com>
4210 * delegate.cs: Only allow this on new versions of the language.
4212 2004-12-02 Duncan Mak <duncan@ximian.com>
4214 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
4216 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
4217 here as a static method. Take an additional bool out parameter
4218 `must_do_cs1540_check' for signaling to InstanceResolve.
4219 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
4220 member field from PropertyExpr class and made it an argument of
4222 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
4223 check for MarshalByRefObject, and report CS0122 instead of CS1540.
4224 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
4225 and `remove_accessor' as well as InstanceResolve: report CS0122
4230 2004-12-03 Raja R Harinath <rharinath@novell.com>
4232 Fix test-327.cs, test-328.cs, and put in early infrastructure
4233 for eventually fixing #52697.
4234 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
4235 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
4237 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
4238 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
4239 (VerifyUsing, error246): Update.
4240 * rootcontext.cs (RootContext.NamespaceLookup): Just use
4241 'NamespaceEntry.LookupNamespaceOrType'.
4243 2004-12-03 Martin Baulig <martin@ximian.com>
4245 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4246 method as our child, call AnonymousMethod.Compatible() on it.
4248 2004-12-03 Raja R Harinath <rharinath@novell.com>
4250 Disable XML documentation support in 'basic' profile.
4251 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
4252 Redirect XmlElement to System.Object.
4253 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
4254 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
4255 * mcs.exe.sources: Add doc-bootstrap.cs.
4256 * doc-bootstrap.cs: New file. Contains empty stub implementation
4259 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
4261 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
4262 comments are allowed.
4264 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4266 * delegate.cs: Add checks for subtypes in paramaters and return values
4267 in VerifyMethod () to add support for Covariance/Contravariance
4270 2004-12-02 Miguel de Icaza <miguel@ximian.com>
4272 * report.cs: Remove extra closing parenthesis.
4274 * convert.cs (Error_CannotImplicitConversion): If the name of the
4275 types are the same, provide some extra information.
4277 * class.cs (FieldBase): Use an unused bit field from the field to
4278 encode the `has_offset' property from the FieldMember. This saves
4279 a couple of Ks on bootstrap compilation.
4281 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4282 method as our child, return the AnonymousMethod resolved
4285 * expression.cs (New.DoResolve): Allow return values from
4286 NewDelegate to also include AnonymousMethods.
4290 2004-12-02 Marek Safar <marek.safar@seznam.cz>
4293 * attribute.cs (Resolve): Improved implementation of params
4294 attribute arguments.
4296 * support.cs (ParameterData): Add HasParams to be faster.
4298 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
4300 all things are for /doc support:
4302 * doc.cs: new file that supports XML documentation generation.
4303 * mcs.exe.sources: added doc.cs.
4305 Handle /doc command line option.
4306 Report error 2006 instead of 5 for missing file name for /doc.
4307 Generate XML documentation when required, after type resolution.
4309 Added support for picking up documentation (/// and /** ... */),
4310 including a new XmlCommentState enumeration.
4312 Added lines to fill Documentation element for field, constant,
4313 property, indexer, method, constructor, destructor, operator, event
4314 and class, struct, interface, delegate, enum.
4315 Added lines to warn incorrect comment.
4317 Added Documentation field (passed only when /doc was specified).
4319 Added DocComment, DocCommentHeader, GenerateDocComment() and
4320 OnGenerateDocComment() and some supporting private members for
4321 /doc feature to MemberCore.
4323 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
4325 Added overriden DocCommentHeader.
4327 Added overriden DocCommentHeader and GenerateDocComment().
4329 2004-12-01 Miguel de Icaza <miguel@ximian.com>
4331 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
4332 unwrapping the enumeration values, chain to
4333 DoConstantNumericPromotions again, so we can promote things to the
4334 fundamental types (takes care of enums that are bytes, sbytes).
4338 2004-12-01 Raja R Harinath <rharinath@novell.com>
4340 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
4341 Fix long-standing bug in type-lookup. Use FindType instead of
4342 LookupType when ec.ResolvingTypeTree.
4343 (Attribute.ResolveType, Attribute.Resolve)
4344 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
4346 (Attributes.Search): Remove internal version. Update.
4347 (Attributes.SearchMulti): Update.
4348 (Attributes.GetClsCompliantAttribute): Remove.
4349 (Attributes.GetIndexerNameAttribute): Remove.
4350 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
4351 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
4352 * class.cs (Indexer.Define): Likewise.
4354 2004-12-01 Marek Safar <marek.safar@seznam.cz>
4357 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
4358 MarshallByReference members access.
4360 * expression.cs: Use CheckMarshallByRefAccess;
4361 Better error CS0197 message.
4363 * report.cs: Print whole related error message.
4365 2004-11-30 Raja R Harinath <rharinath@novell.com>
4367 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
4368 the current directory to help debugging.
4370 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4372 * class (GetClassBases): Better error 60 report.
4373 (EventProperty): Disabled warning 67 detection.
4375 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4378 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
4380 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
4383 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4386 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
4388 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
4390 2004-11-26 Miguel de Icaza <miguel@ximian.com>
4392 * attribute.cs (Attribute.Resolve): Refine error reporting and
4393 report a cs0117 if the identifier does not exist, to distinguish
4394 from 0617 which is a miss-use of the actual identifier.
4396 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
4397 between cs0070 and cs0079.
4399 * class.cs (MemberBase.DoDefine): When reporting a wrong
4400 accessibility level, we use MethodCore to compare instead of
4401 Method (this was a regression in some refactoring effort).
4403 So now we correctly report cs0056 again.
4405 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
4406 testing the target_type (which was known to be object_type) and
4407 not the source type (which is anonymous_method).
4409 Fixed reporting of error cs1660.
4411 * expression.cs (UserCast.Source): Expose the underlying cast.
4413 * statement.cs (Switch.SwitchGoverningType): Sort the list of
4414 allowed types to find a match to int32 first (most common).
4416 In addition, it ignores any ImplicitUserConversions that did an
4417 internal implicit conversion (as the switch statement allows only
4418 one integral conversion to exist).
4420 * class.cs (PartialContainer.Create): rename `name' to
4421 `member_name' for clarity. Then replace the string calls with a
4422 call to MemberName.GetPartialName, as now using
4423 MemberName.ToString is an error (this is due to the side effects
4424 it had, that were fixed in the past).
4426 This will restore the error reporting on a number of partial class
4427 errors that were missusing this (and getting an exception as a
4428 results, which is now just a plain textual warning, because
4429 yyparse debug output would crash otherwise).
4431 2004-11-26 Raja R Harinath <rharinath@novell.com>
4433 * Makefile (PROGRAM_INSTALL_DIR): Remove.
4435 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4437 * rootcontext.cs (LookupType): Make sure to cache lookups that
4438 don't give us a negative result. This saves about 5% of corlib
4441 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4443 * report.cs (AbstractMessage.Print): messages are sent to stderr
4445 * class.cs (TypeContainer.GetClassBases): It is an error to have a
4446 non-interface in the list of interfaces (at this point, either
4447 parent was properly set, or a base class is being listed in the
4448 interfaces section).
4450 This flags error 1722, and resolves the crash from bug 69259.
4452 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4454 * statement.cs (Using.EmitExpressionFinally): make this work right
4455 for valuetypes. Fixes 69926.
4457 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4459 * const.cs (Const.ChangeType): Cope with the "0 literal can be
4460 converted to an enum" here, before we try to change the underlying
4461 type. This code exists, but it is a different code path than the
4462 one used while encoding constants.
4464 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
4465 old bug: when converting from the null literal to a pointer,
4466 return an EmptyCast, not the NullLiteral.
4468 This fixes #69921, the recent null_type changes probably made this
4471 (ImplicitReferenceConversionExists): In addition, resynchronized
4472 the code here, so it matches the same code in
4473 ImplicitReferenceConversionExists for the `from any class-type S
4474 to any interface-type T'.
4477 2004-11-25 Marek Safar <marek.safar@seznam.cz>
4479 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
4481 2004-11-24 Miguel de Icaza <miguel@ximian.com>
4483 * cs-parser.jay: Use verbosity accordingly.
4485 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4487 * expression.cs (Unary.ResolveOperator): Do not report warning;
4488 AddressOf reads from variable.
4490 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
4492 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4496 * attribute.cs (Attributable): Removed CheckTargets.
4497 (Attributes.Emit): Explicit attribute targets are tested here.
4499 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
4500 not enabled for interfaces.
4502 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
4503 (GetAssemblyName): Ouch next bug there.
4505 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4507 * expression.cs: Error 275 added.
4509 2004-11-23 Marek Safar <marek.safar@seznam.cz>
4511 Fix bug #69177 (Implemented decimal constant support)
4513 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
4514 (BinaryFold): Add DecimalConstant.
4516 * const.cs (Define): Decimal constant
4518 (ChangeType): Add decimal type handling.
4519 (LookupConstantValue): Don't set value for decimal type but
4520 emit DecimalConstantAttribute. Needed for constant optimization.
4522 * constant.cs (ToDecimal): New method.
4523 (ConvertToDecimal): New method.
4524 (IntConstant): Implemented ConvertToDecimal.
4525 (DecimalConstant.Emit): Emit optimized version for decimals in
4528 * expression.cs (ResolveOperator): Changed order of constant
4529 reduction to work correctly with native types which have
4530 overloaded operators.
4531 (ResolveMemberAccess): Extract constant value from attribute
4534 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
4536 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
4537 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
4538 (ChangeType): Decimal is special.
4539 (TypeToCoreType): Add decimal type.
4541 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4543 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
4546 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4548 * class.cs (EventField.ApplyAttributeBuilder): Fix error
4551 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4553 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
4555 * pending.cs (PendingImplementation): Grab only interfaces.
4557 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4559 * statement.cs (ForeachHelperMethods): Add location member and
4560 error 202 detection.
4562 2004-11-19 Raja R Harinath <rharinath@novell.com>
4564 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
4565 automatically handled by executable.make.
4566 (PROGRAM): Make profile-specific.
4568 2004-11-18 Marek Safar <marek.safar@seznam.cz>
4570 * expression.cs (DoResolveBase): Fixed wrong warning for out
4573 2004-11-18 Martin Baulig <martin@ximian.com>
4575 Merged latest changes into gmcs. Please keep this comment in
4576 here, it makes it easier for me to see what changed in MCS since
4577 the last time I merged.
4579 2004-11-17 Raja R Harinath <rharinath@novell.com>
4581 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
4582 (TypeHandle.GetMemberCache): New.
4583 (TypeHandle.TypeHandle): Update.
4584 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
4585 (TypeManager.LookupParentInterfacesCache):
4586 Rename from LookupInterfaceCache. Optimize slightly.
4587 (TypeManager.MemberLookup_FindMembers): Update.
4588 * decl.cs (MemberCache.MemberCache): Set Container to null in the
4590 (AddCacheContents): Rename from AddHashtable.
4591 * class.cs (TypeContainer.parent_container): Remove.
4592 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
4593 (TypeContainer.DoDefineMembers): Don't initialize it.
4594 Update to name changes.
4596 2004-11-17 Miguel de Icaza <miguel@ximian.com>
4598 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
4599 that factors the code to check access modifiers on override.
4601 (PropertyBase): Use the code here.
4603 Patch from Lluis S'anchez, fixes bug #69361.
4605 2004-11-15 Miguel de Icaza <miguel@ximian.com>
4607 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
4608 routine that is used to report the use of a captured variable
4609 whose address has been taken.
4611 There are two checks: one when variables are being captured and
4612 the other check is when the address of a variable is taken.
4614 (because an anonymous methods might be resolved before *or* after
4615 the address has been taken) and
4617 * expression.cs (Conditional.DoResolve): Remove the special
4618 casing that Martin added to trueExpr and falseExpr being both
4619 NullLiteral. We get the right behavior now just by introducing
4620 the null_type into the compiler.
4622 * convert.cs (ExplicitConversion): Change the code to use
4623 null_type instead of testing `expr is NullLiteral'.
4624 (ImplicitConversionStandard): use null_type too.
4625 (ImplicitReferenceConversionExists): use null_type too.
4626 (ImplicitReferenceConversion): use null_type too.
4628 * literal.cs: The type of `NullLiteral' is now null_type instead
4630 (Resolve): Set the type here.
4632 * typemanager.cs: Introduce null_type.
4634 2004-11-17 Martin Baulig <martin@ximian.com>
4636 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4637 direction, like FindMembers() does. Fixes #69546, testcase is in
4640 2004-11-16 Martin Baulig <martin@ximian.com>
4642 This is based on a patch from Marek Safar, see bug #69082.
4643 Fixes bugs #63705 and #67130.
4645 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4646 method; create a MemberCache for an interface type and cache the
4649 * decl.cs (IMemberContainer.ParentContainer): Removed.
4650 (IMemberContainer.ParentCache): New property.
4651 (MemberCache.SetupCacheForInterface): Removed.
4652 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4653 to create a cache for an interface's "parent".
4655 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4658 2004-11-16 Martin Baulig <martin@ximian.com>
4660 Merged back from gmcs; these changes already went into gmcs a
4661 couple of weeks ago.
4664 (TypeManager.AddUserType): Removed the `ifaces' argument.
4665 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
4667 (TypeManager.AddUserInterface): Removed.
4668 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
4670 (TypeManager.GetInterfaces): Likewise.
4671 (TypeManager.GetExplicitInterfaces): Likewise.
4673 * ecore.cs (TypeExpr.GetInterfaces): Removed.
4675 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
4676 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
4678 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4680 * statement.cs: Avoid adding bools to a hashtable.
4682 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4684 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4685 calling an unsafe method from a safe location.
4687 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4690 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4692 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4694 * namespace.cs (VerifyUsing): use GetPartialName instead of
4697 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4699 * statement.cs (Return.Resolve): Fix regression in typo: if
4700 `in_exc', we have to request a NeedReturnLabel, this was a typo
4701 introduced in the anonymous method check-in. Fixes #69131.
4703 * Indexers were using the ShortName when defining themselves,
4704 causing a regression in the compiler bootstrap when applying the
4705 patch from 2004-11-02 (first part), now they use their full name
4706 and the bug is gone.
4708 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4710 * driver.cs: Strip the path from the names of embedded resources. Fixes
4713 2004-11-04 Raja R Harinath <rharinath@novell.com>
4715 Fix error message regression: cs0104-2.cs.
4716 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4717 (AliasEntry.Resolve): Update.
4718 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4720 (RootContext.LookupType): Update.
4722 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4724 * cs-parser.jay: Add support for handling accessor modifiers
4725 * class: Add support port accessor modifiers and error checking,
4726 define PropertyMethod.Define as virtual (not abstract anymore)
4727 * ecore.cs: Add checking for proeprties access with access modifiers
4728 * iterators.cs: Modify Accessor constructor call based in the modified
4730 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4732 * expression.cs (StringConcat): Handle being called twice,
4733 as when we have a concat in a field init with more than two
4736 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4738 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4739 special case explicit implementations, we should always produce
4740 the .property or .event declaration.
4742 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4743 since it will not return correct data if people use this
4744 unresolved in the presence of using statements (see test-313).
4746 * class.cs (MethodData.Define): If we are an explicit interface
4747 implementation, set the method name to the full name of the
4748 interface plus the name of the method.
4750 Notice that using the method.MethodName.GetFullName() does not
4751 work, as it will only contain the name as declared on the source
4752 file (it can be a shorthand in the presence of using statements)
4753 and not the fully qualifed type name, for example:
4757 class D : ICloneable {
4758 object ICloneable.Clone () {
4762 Would produce a method called `ICloneable.Clone' instead of
4763 `System.ICloneable.Clone'.
4765 * namespace.cs (Alias.Resolve): Use GetPartialName.
4767 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4769 * cs-parser.jay: Add error 1055 report.
4771 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4773 * assign.cs (Assign.DoResolve): Only do the transform of
4774 assignment into a New if the types are compatible, if not, fall
4775 through and let the implicit code deal with the errors and with
4776 the necessary conversions.
4778 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4780 * cs-parser.jay: Add error 1031 report.
4782 * cs-tokenizer.cs: Add location for error 1038.
4784 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4786 * cs-parser.jay: Add error 1016 report.
4788 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4790 * cs-parser.jay: Add errors 1575,1611 report.
4792 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4794 * cs-parser.jay: Add error 1001 report.
4796 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4799 * attribute.cs (GetMarshal): Add method argument for
4800 caller identification.
4802 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4803 agument for GetMarshal and RuntimeMissingSupport.
4805 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4807 * attribute.cs (ExtractSecurityPermissionSet): Removed
4808 TypeManager.code_access_permission_type.
4810 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4812 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4814 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4815 for obsolete use of a variable here. Fixes regression on errors
4816 cs0619-25 and cs0619-26.
4818 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4820 Fix #62358, implemented security attribute encoding.
4822 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4823 Tests permitted SecurityAction for assembly or other types.
4824 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4825 data from SecurityPermissionAttribute to PermisionSet class.
4827 * class.cs (ApplyAttributeBuilder): Added special handling
4828 for System.Security.Permissions.SecurityAttribute based types.
4830 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4831 special handling for System.Security.Permissions.SecurityAttribute
4834 * enum.cs (ApplyAttributeBuilder): Added special handling
4835 for System.Security.Permissions.SecurityAttribute based types.
4837 * parameter.cs (ApplyAttributeBuilder): Added special handling
4838 for System.Security.Permissions.SecurityAttribute based types.
4840 * rootcontext.cs: Next 2 core types.
4842 * typemanager.cs (TypeManager.security_permission_attr_type):
4843 Built in type for the SecurityPermission Attribute.
4844 (code_access_permission_type): Build in type.
4846 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4848 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4849 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4850 all of this information into
4851 EmitContext.EmitCapturedVariableInstance.
4853 * codegen.cs (EmitCapturedVariableInstance): move here the
4854 funcionality of emitting an ldarg.0 in the presence of a
4855 remapping. This centralizes the instance emit code.
4857 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4858 then emit a load of this: it means that we have reached the
4859 topmost ScopeInfo: the one that contains the pointer to the
4860 instance of the class hosting the anonymous method.
4862 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4863 captures to the topmost CaptureContext.
4865 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4867 * expression.cs (LocalVariableReference): Move the knowledge about
4868 the iterators into codegen's EmitCapturedVariableInstance.
4870 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4872 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4873 all code paths return a value from an anonymous method (it is the
4874 same as the 161 error, but for anonymous methods).
4876 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4878 The introduction of anonymous methods in the compiler changed
4879 various ways of doing things in the compiler. The most
4880 significant one is the hard split between the resolution phase
4881 and the emission phases of the compiler.
4883 For instance, routines that referenced local variables no
4884 longer can safely create temporary variables during the
4885 resolution phase: they must do so from the emission phase,
4886 since the variable might have been "captured", hence access to
4887 it can not be done with the local-variable operations from the runtime.
4891 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4892 is a toplevel block.
4894 (ToplevelBlock): A new kind of Block, these are the blocks that
4895 are created by the parser for all toplevel method bodies. These
4896 include methods, accessors and anonymous methods.
4898 These contain some extra information not found in regular blocks:
4899 A pointer to an optional CaptureContext (for tracking captured
4900 local variables and parameters). A pointer to the parent
4903 (Return.Resolve): Catch missmatches when returning a value from an
4904 anonymous method (error 1662).
4905 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4908 (Break.Resolve): ditto.
4910 (SwitchLabel): instead of defining the labels during the
4911 resolution phase, we now turned the public ILLabel and ILLabelCode
4912 labels into methods called GetILLabelCode() and GetILLabel() that
4913 only define the label during the Emit phase.
4915 (GotoCase): Track the SwitchLabel instead of the computed label
4916 (its contained therein). Emit the code by using
4917 SwitchLabel.GetILLabelCode ().
4919 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4920 whether the Local has been captured or not.
4922 (LocalInfo.IsCaptured): New property, used to tell whether the
4923 local has been captured.
4925 * anonymous.cs: Vastly updated to contain the anonymous method
4928 The main classes here are: CaptureContext which tracks any
4929 captured information for a toplevel block and ScopeInfo used to
4930 track the activation frames for various local variables.
4932 Each toplevel block has an optional capture context associated
4933 with it. When a method contains an anonymous method both the
4934 toplevel method and the anonymous method will create a capture
4935 context. When variables or parameters are captured, they are
4936 recorded on the CaptureContext that owns them, for example:
4940 MyDelegate d = delegate {
4945 Here `a' will be recorded as captured on the toplevel
4946 CapturedContext, the inner captured context will not have anything
4947 (it will only have data if local variables or parameters from it
4948 are captured in a nested anonymous method.
4950 The ScopeInfo is used to track the activation frames for local
4951 variables, for example:
4953 for (int i = 0; i < 10; i++)
4954 for (int j = 0; j < 10; j++){
4955 MyDelegate d = delegate {
4960 At runtime this captures a single captured variable `i', but it
4961 captures 10 different versions of the variable `j'. The variable
4962 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4963 recorded on a child.
4965 The toplevel ScopeInfo will also track information like the `this'
4966 pointer if instance variables were referenced (this is necessary
4967 as the anonymous method lives inside a nested class in the host
4968 type of the method).
4970 (AnonymousMethod): Expanded to track the Toplevel, implement
4971 `AnonymousMethod.Compatible' to tell whether an anonymous method
4972 can be converted to a target delegate type.
4974 The routine now also produces the anonymous method content
4976 (AnonymousDelegate): A helper class that derives from
4977 DelegateCreation, this is used to generate the code necessary to
4978 produce the delegate for the anonymous method that was created.
4980 * assign.cs: API adjustments for new changes in
4981 Convert.ImplicitStandardConversionExists.
4983 * class.cs: Adjustments to cope with the fact that now toplevel
4984 blocks are of type `ToplevelBlock'.
4986 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
4987 insteda of standard blocks.
4989 Flag errors if params arguments are passed to anonymous methods.
4991 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
4992 `CurrentAnonymousMethod' which points to the current Anonymous
4993 Method. The variable points to the AnonymousMethod class that
4994 holds the code being compiled. It is set in the new EmitContext
4995 created for the anonymous method.
4997 (EmitContext.Phase): Introduce a variable and an enumeration to
4998 assist in enforcing some rules about when and where we are allowed
4999 to invoke certain methods (EmitContext.NeedsReturnLabel is the
5000 only one that enfonces this right now).
5002 (EmitContext.HaveCaptureInfo): new helper method that returns
5003 whether we have a CapturedContext initialized.
5005 (EmitContext.CaptureVariable): New method used to register that a
5006 LocalInfo must be flagged for capturing.
5008 (EmitContext.CapturedParameter): New method used to register that a
5009 parameters must be flagged for capturing.
5011 (EmitContext.CapturedField): New method used to register that a
5012 field must be flagged for capturing.
5014 (EmitContext.HaveCapturedVariables,
5015 EmitContext.HaveCapturedFields): Return whether there are captured
5016 variables or fields.
5018 (EmitContext.EmitMethodHostInstance): This is used to emit the
5019 instance for the anonymous method. The instance might be null
5020 (static methods), this (for anonymous methods that capture nothing
5021 and happen to live side-by-side with the current method body) or a
5022 more complicated expression if the method has a CaptureContext.
5024 (EmitContext.EmitTopBlock): Routine that drives the emission of
5025 code: it will first resolve the top block, then emit any metadata
5026 and then emit the code. The split is done so that we can extract
5027 any anonymous methods and flag any captured variables/parameters.
5029 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
5030 during this phase, the ILGenerator should not be used as labels
5031 and local variables declared here might not be accessible to any
5032 code that is part of an anonymous method.
5034 Exceptions to this include the temporary variables that are
5035 created by some statements internally for holding temporary
5038 (EmitContext.EmitMeta): New routine, in charge of emitting all the
5041 (EmitContext.TemporaryReturn): This method is typically called
5042 from the Emit phase, and its the only place where we allow the
5043 ReturnLabel to be defined other than the EmitMeta. The reason is
5044 that otherwise we would have to duplicate a lot of logic in the
5045 Resolve phases of various methods that today is on the Emit
5048 (EmitContext.NeedReturnLabel): This no longer creates the label,
5049 as the ILGenerator is not valid during the resolve phase.
5051 (EmitContext.EmitThis): Extended the knowledge in this class to
5052 work in anonymous methods in addition to iterators.
5054 (EmitContext.EmitCapturedVariableInstance): This emits whatever
5055 code is necessary on the stack to access the instance to a local
5056 variable (the variable will be accessed as a field).
5058 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
5059 EmitContext.EmitAddressOfParameter): Routines to support
5060 parameters (not completed at this point).
5062 Removals: Removed RemapLocal and RemapLocalLValue. We probably
5063 will also remove the parameters.
5065 * convert.cs (Convert): Define a `ConstantEC' which points to a
5066 null. This is just to prefity some code that uses
5067 ImplicitStandardConversion code and do not have an EmitContext
5070 The idea is to flag explicitly that at that point in time, it is
5071 known that the conversion will not trigger the delegate checking
5072 code in implicit conversions (which requires a valid
5075 Everywhere: pass new EmitContext parameter since
5076 ImplicitStandardConversionExists now requires it to check for
5077 anonymous method conversions.
5079 (Convert.ImplicitStandardConversionExists): If the type of an
5080 expression is the anonymous_method_type, and the type is a
5081 delegate, we invoke the AnonymousMethod.Compatible method to check
5082 whether an implicit conversion is possible.
5084 (Convert.ImplicitConversionStandard): Only do implicit method
5085 group conversions if the language level is not ISO_1.
5087 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
5088 MethodInfo for the Invoke method. used by Delegate and
5091 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
5092 method conversions if the target type is a delegate.
5094 Removed extra debugging nops.
5096 (LocalVariableReference): Turn the `local_info' into a public
5099 Add `prepared' field, the same hack used for FieldExprs to cope
5100 with composed assignments, as Local variables do not necessarily
5101 operate purely on the stack as they used to: they can be captured
5104 Add `temp' for a temporary result, like fields.
5106 Refactor DoResolve and DoResolveLValue into DoResolveBase.
5108 It now copes with Local variables that are captured and emits the
5109 proper instance variable to load it from a field in the captured
5112 (ParameterReference.DoResolveBase): During the resolve phase,
5113 capture parameters if we are in an anonymous method.
5115 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
5116 anonymous method, use the EmitContext helper routines to emit the
5117 parameter reference.
5119 * iterators.cs: Set RemapToProxy to true/false during the
5122 * parameters.cs (GetParameterByName): New helper method.
5124 * typemanager.cs (anonymous_method_type) a new type that
5125 represents an anonyous method. This is always an internal type,
5126 used as a fencepost to test against the anonymous-methodness of an
5129 2004-10-20 Marek Safar <marek.safar@seznam.cz>
5131 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
5133 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
5135 2004-10-18 Martin Baulig <martin@ximian.com>
5137 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
5138 `Type' directly, but call ResolveType() on it.
5139 (Catch.Resolve): Likewise.
5140 (Foreach.Resolve): Likewise.
5142 2004-10-18 Martin Baulig <martin@ximian.com>
5144 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
5145 `Type' directly, but call ResolveType() on it.
5146 (Probe.DoResolve): Likewise.
5147 (ArrayCreation.LookupType): Likewise.
5148 (TypeOf.DoResolve): Likewise.
5149 (SizeOf.DoResolve): Likewise.
5151 2004-10-18 Martin Baulig <martin@ximian.com>
5153 * expression.cs (Invocation.BetterFunction): Put back
5154 TypeManager.TypeToCoreType().
5156 2004-10-18 Raja R Harinath <rharinath@novell.com>
5158 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
5161 2004-10-18 Martin Baulig <martin@ximian.com>
5163 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
5164 `Type' directly, but call ResolveType() on it.
5166 2004-10-18 Martin Baulig <martin@ximian.com>
5168 * class.cs (FieldMember.Define): Don't access the TypeExpr's
5169 `Type' directly, but call ResolveType() on it.
5170 (MemberBase.DoDefine): Likewise.
5172 * expression.cs (New.DoResolve): Don't access the TypeExpr's
5173 `Type' directly, but call ResolveType() on it.
5174 (ComposedCast.DoResolveAsTypeStep): Likewise.
5176 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
5177 `Type' directly, but call ResolveType() on it.
5179 2004-10-17 John Luke <john.luke@gmail.com>
5181 * class.cs (Operator.GetSignatureForError): use CSharpName
5183 * parameter.cs (Parameter.GetSignatureForError): Returns
5184 correct name even if was not defined.
5186 2004-10-13 Raja R Harinath <rharinath@novell.com>
5189 * class.cs (TypeContainer.EmitContext): New property.
5190 (DefineNestedTypes): Create an emitcontext for each part.
5191 (MethodCore.DoDefineParameters): Use container's emitcontext.
5192 Pass type array to InternalParameters.
5193 (MemberBase.DoDefine): Use container's emitcontext.
5194 (FieldMember.Define): Likewise.
5195 (Event.Define): Likewise.
5196 (SetMethod.GetParameterInfo): Change argument to EmitContext.
5197 Pass type array to InternalParameters.
5198 (SetIndexerMethod.GetParameterInfo): Likewise.
5199 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
5200 * delegate.cs (Define): Pass emitcontext to
5201 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
5202 array to InternalParameters.
5203 * expression.cs (ParameterReference.DoResolveBase): Pass
5204 emitcontext to GetParameterInfo.
5205 (ComposedCast.DoResolveAsTypeStep): Remove check on
5206 ec.ResolvingTypeTree.
5207 * parameter.cs (Parameter.Resolve): Change argument to
5208 EmitContext. Use ResolveAsTypeTerminal.
5209 (Parameter.GetSignature): Change argument to EmitContext.
5210 (Parameters.ComputeSignature): Likewise.
5211 (Parameters.ComputeParameterTypes): Likewise.
5212 (Parameters.GetParameterInfo): Likewise.
5213 (Parameters.ComputeAndDefineParameterTypes): Likewise.
5214 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
5215 * support.cs (InternalParameters..ctor): Remove variant that takes
5217 * typemanager.cs (system_intptr_expr): New.
5218 (InitExpressionTypes): Initialize it.
5220 2004-10-12 Chris Toshok <toshok@ximian.com>
5222 * cs-parser.jay: fix location for try_statement and catch_clause.
5224 2004-10-11 Martin Baulig <martin@ximian.com>
5226 * report.cs: Don't make --fatal abort on warnings, we have
5227 -warnaserror for that.
5229 2004-10-07 Raja R Harinath <rharinath@novell.com>
5231 More DeclSpace.ResolveType avoidance.
5232 * decl.cs (MemberCore.InUnsafe): New property.
5233 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
5234 with newly created EmitContext.
5235 (FieldMember.Define): Likewise.
5236 * delegate.cs (Delegate.Define): Likewise.
5237 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
5238 only if normal name-lookup fails.
5239 (TypeExpr.DoResolve): Enable error-checking.
5240 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
5241 (SizeOf.DoResolve): Likewise.
5242 (ComposedCast.DoResolveAsTypeStep): Likewise.
5243 (StackAlloc.DoResolve): Likewise.
5244 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
5245 (Block.Unsafe): New property.
5246 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
5247 (Unsafe): Set 'unsafe' flag of contained block.
5248 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
5249 (Fixed.Resolve): Likewise.
5250 (Catch.Resolve): Likewise.
5251 (Using.ResolveLocalVariableDecls): Likewise.
5252 (Foreach.Resolve): Likewise.
5254 2004-10-05 John Luke <john.luke@gmail.com>
5256 * cs-parser.jay: add location to error CS0175
5258 2004-10-04 Miguel de Icaza <miguel@ximian.com>
5260 * ecore.cs (Expression.Constantity): Add support for turning null
5263 * const.cs (Const.Define): Allow constants to be reference types
5264 as long as the value is Null.
5266 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
5268 * namespace.cs (NamespaceEntry.Using): No matter which warning
5269 level is set, check if this namespace name has already been added.
5271 2004-10-03 Ben Maurer <bmaurer@ximian.com>
5273 * expression.cs: reftype [!=]= null should always use br[true,false].
5276 2004-10-03 Marek Safar <marek.safar@seznam.cz>
5279 * attribute.cs: Enum conversion moved to
5280 GetAttributeArgumentExpression to be applied to the all
5283 2004-10-01 Raja R Harinath <rharinath@novell.com>
5285 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
5286 * class.c (TypeContainer.DefineType): Flag error if
5287 base types aren't accessible due to access permissions.
5288 * decl.cs (DeclSpace.ResolveType): Move logic to
5289 Expression.ResolveAsTypeTerminal.
5290 (DeclSpace.ResolveTypeExpr): Thin layer over
5291 Expression.ResolveAsTypeTerminal.
5292 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
5293 Refactor code into NestedAccess. Use it.
5294 (DeclSpace.NestedAccess): New.
5295 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
5296 argument to silence errors. Check access permissions.
5297 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
5298 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
5299 (Cast.DoResolve): Likewise.
5300 (New.DoResolve): Likewise.
5301 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
5302 (TypeOf.DoResolve): Likewise.
5304 * expression.cs (Invocation.BetterConversion): Return the Type of
5305 the better conversion. Implement section 14.4.2.3 more faithfully.
5306 (Invocation.BetterFunction): Make boolean. Make correspondence to
5307 section 14.4.2.2 explicit.
5308 (Invocation.OverloadResolve): Update.
5309 (Invocation): Remove is_base field.
5310 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
5311 (Invocation.Emit): Likewise.
5313 2004-09-27 Raja R Harinath <rharinath@novell.com>
5315 * README: Update to changes.
5317 2004-09-24 Marek Safar <marek.safar@seznam.cz>
5319 * cs-parser.jay: Reverted 642 warning fix.
5321 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5324 * decl.cs (FindMemberWithSameName): Indexer can have more than
5327 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5329 * expression.cs (LocalVariableReference.DoResolveLValue):
5330 Do not report warning 219 for out values.
5331 (EmptyExpression.Null): New member to avoid extra allocations.
5333 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5335 * cs-parser.jay: Fix wrong warning 642 report.
5337 * cs-tokenizer.cs (CheckNextToken): New helper;
5338 Inspect next character if is same as expected.
5340 2004-09-23 Martin Baulig <martin@ximian.com>
5342 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
5343 (Convert.ImplicitReferenceConversionExists): Likewise.
5345 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5347 * class.cs (Operator.Define): Add error 448 and 559 report.
5349 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5351 * class.cs (MemberBase.IsTypePermitted): New protected
5352 method for checking error CS0610.
5354 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5356 * class.cs (TypeContainer.HasExplicitLayout): New property
5357 Returns whether container has StructLayout attribute set Explicit.
5358 (FieldMember): New abstract class for consts and fields.
5359 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
5360 (Field): Reuse FieldMember.
5362 * const.cs (Const): Reuse FieldMember.
5364 * rootcontext.cs: EmitConstants call moved to class.
5366 2004-09-22 Martin Baulig <martin@ximian.com>
5368 Thanks to Peter Sestoft for this bug report.
5370 * expression.cs (Conditional): If both the `trueExpr' and the
5371 `falseExpr' is a NullLiteral, return a NullLiteral.
5373 2004-09-22 Martin Baulig <martin@ximian.com>
5375 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
5376 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
5377 for the "get_Current" call.
5379 2004-09-22 Martin Baulig <martin@ximian.com>
5381 Marek and me just fixed one of our oldest bugs: #28562 :-)
5383 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
5385 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
5386 we're an EnumConstant, just return that.
5387 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
5388 an EnumConstant. In this case, we need to use GetValueAsEnumType()
5389 to get the value which'll actually be written into the attribute.
5390 However, we have to use GetValue() to access the attribute's value
5393 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5395 * constant.cs (Constant.IsNegative): New abstract property
5398 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
5399 (StackAlloc.DoResolve): Reused IsNegative.
5401 2004-09-21 Martin Baulig <martin@ximian.com>
5403 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
5404 if we're used in an iterator, we may be called from different
5407 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
5408 we actually have an exception block.
5410 2004-09-20 John Luke <jluke@cfl.rr.com>
5412 * class.cs, cs-parser.jay: Improve the error report for 1520:
5413 report the actual line where the error happens, not where the
5416 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
5417 Pass location information that was available elsewhere.
5419 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
5421 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
5422 runtime to delay sign assemblies.
5424 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5426 * cs-parser.jay: Do not report the stack trace, this is barely
5429 2004-08-22 John Luke <john.luke@gmail.com>
5431 * driver.cs : check that a resource id is not already used
5432 before adding it, report CS1508 if it is, bug #63637
5434 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5436 * ecore.cs: Removed dead code.
5438 2004-09-18 Marek Safar <marek.safar@seznam.cz>
5440 * class.cs: Do not report warning CS0067 on the interfaces.
5442 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5444 * cs-parser.jay: Add error 504 report.
5446 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5448 * rootcontext.cs: WarningLevel is 4 by default now.
5450 * statement.cs (Fixed.Resolve): Do not null
5453 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5456 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
5457 deep search when property is not virtual.
5458 (PropertyExpr.ResolveAccessors): Make one call for both
5461 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5464 * statement.cs: Error 152 report constains also location.
5466 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5469 * const.cs: Explicitly set constant as static.
5471 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5474 * cs-parser.jay: Add error 1017 report.
5476 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5478 Fixed bug #59980, #64224
5479 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
5481 * typemanager.cs (IsSpecialMethod): Simplified
5483 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5485 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
5486 condition with better params.
5488 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5491 * attribute.cs (Resolve): Property has to have both
5494 2004-09-14 Martin Baulig <martin@ximian.com>
5496 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
5498 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5501 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
5502 called and is obsolete then this member suppress message
5503 when call is inside next [Obsolete] method or type.
5505 * expression.cs: Use TestObsoleteMethodUsage member.
5507 2004-09-14 Martin Baulig <martin@ximian.com>
5509 * cs-parser.jay: Sync a bit with the GMCS version.
5511 2004-09-14 Martin Baulig <martin@ximian.com>
5513 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
5514 (CSharpParser.yacc_verbose_flag): New public field.
5516 * genericparser.cs: Removed.
5518 2004-09-14 Raja R Harinath <rharinath@novell.com>
5520 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
5522 2004-09-13 Marek Safar <marek.safar@seznam.cz>
5524 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5526 2004-09-10 Martin Baulig <martin@ximian.com>
5528 Backported my MemberName changes from GMCS into MCS.
5530 - we are now using a special `MemberName' class instead of using
5531 strings; in GMCS, the `MemberName' also contains the type
5534 - changed the grammar rules a bit:
5535 * the old `member_name' is now a `namespace_or_type_name':
5536 The rule is that we use `namespace_or_type_name' everywhere
5537 where we expect either a "member name" (GetEnumerator) or a
5538 "member name" with an explicit interface name
5539 (IEnumerable.GetEnumerator).
5540 In GMCS, the explicit interface name may include type arguments
5541 (IEnumerable<T>.GetEnumerator).
5542 * we use `member_name' instead of just `IDENTIFIER' for
5544 The rule is that we use `member_name' wherever a member may
5545 have type parameters in GMCS.
5547 * decl.cs (MemberName): New public class.
5548 (MemberCore.MemberName): New public readonly field.
5549 (MemberCore.ctor): Take a `MemberName' argument, not a string.
5550 (DeclSpace): Likewise.
5552 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
5553 * enum.cs (Enum.ctor): Likewise.
5555 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
5557 (AliasEntry.ctor): Take a MemberName, not an Expression.
5558 (AliasEntry.UsingAlias): Likewise.
5560 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
5561 (IMethodData.MemberName): Changed type from string to MemberName.
5562 (MemberBase.ExplicitInterfaceName): Likewise.
5563 (AbstractPropertyEventMethod.SetupName): Make this private.
5564 (AbstractPropertyEventMethod.ctor): Added `string prefix'
5565 argument; compute the member name here.
5566 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
5567 on the `member.MemberName' and the `prefix'.
5569 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
5571 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
5572 thus, we get a `MemberName' instead of a `string'. These
5573 declarations may have type parameters in GMCS.
5574 (interface_method_declaration, delegate_declaration): Likewise.
5575 (class_declaration, interface_declaration): Likewise.
5576 (method_header): Use `namespace_or_type_name' instead of
5577 `member_name'. We may be an explicit interface implementation.
5578 (property_declaration, event_declaration): Likewise.
5579 (member_name): This is now just an `IDENTIFIER', not a
5580 `namespace_or_type_name'.
5581 (type_name, interface_type): Removed.
5582 (namespace_or_type_name): Return a MemberName, not an Expression.
5583 (primary_expression): Use `member_name' instead of `IDENTIFIER';
5584 call GetTypeExpression() on the MemberName to get an expression.
5585 (IndexerDeclaration.interface_type): Changed type from string to
5587 (MakeName): Operate on MemberName's instead of string's.
5589 2004-09-13 Raja R Harinath <rharinath@novell.com>
5592 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
5593 (NamespaceEntry.Lookup): Add new argument to flag if we want the
5594 lookup to avoid symbols introduced by 'using'.
5595 * rootcontext.cs (NamespaceLookup): Update.
5597 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5599 * class.cs (TypeContainer.DoDefineMembers): Do not call
5600 DefineDefaultConstructor for static classes.
5602 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5604 * attribute.cs (Attribute.Resolve): Add error 653 report.
5606 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5608 (Method.ApplyAttributeBuilder): Add error 685 report.
5609 (Operator.Define): Add error 564 report.
5611 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5613 * expression.cs (Invocation.DoResolve): Add error
5616 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5619 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5621 * class.cs (ConstructorInitializer.Resolve):
5622 Wrong error number (515->516).
5624 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5626 * class.cs (Indexer.Define): Add error 631 report.
5628 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5630 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5632 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5634 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5636 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5638 * cs-parser.jay: Added error CS0241 report.
5640 2004-09-10 Raja R Harinath <rharinath@novell.com>
5642 * cs-parser.jay (fixed_statement): Introduce a scope for the
5643 declaration in the 'fixed' statement.
5645 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5647 * cs-parser.jay: Added CS0230 error report.
5649 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5651 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5653 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5655 * expression.cs (Argument.Resolve): Added error CS0192 and
5658 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5660 C# 2.0 #pragma warning feature
5662 * cs-tokenizer.cs (PreProcessPragma): New method;
5663 Handles #pragma directive.
5665 * report.cs (WarningRegions): New class; Support
5666 class for #pragma warning directive. It tests whether
5667 warning is enabled for a given line.
5669 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5671 * const.cs: Add more descriptive error report, tahnks to
5674 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5676 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5678 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5680 * expression.cs: Apply patch from Ben: Remove dead code from
5681 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5682 as that code just threw an exception anwyays.
5684 * const.cs: Remove the call to the turnintoconstant, for details
5687 * literal.cs: The type of the null-literal is the null type; So
5688 we use a placeholder type (literal.cs:System.Null, defined here)
5691 * expression.cs (Conditional.DoResolve): Remove some old code that
5692 is no longer needed, conversions have been fixed.
5694 (ArrayCreationExpression.DoResolve): Return false if we fail to
5695 resolve the inner expression.
5697 2004-09-07 Raja R Harinath <rharinath@novell.com>
5700 * cs-parser.jay (delegate_declaration): Record a delegate
5701 declaration as a type declaration.
5702 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5704 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5706 * parameter.cs: Do not crash if the type can not be resolved.
5708 * expression.cs: Report errors with unsafe pointers, fixes #64896
5710 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5712 * expression.cs: Pointer arith always needs to do a conv.i
5713 if the operand is a long. fix 65320
5715 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5717 Fixed cs0619-37.cs, cs0619-38.cs
5719 * enum.cs (GetObsoleteAttribute): Removed.
5721 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5722 on Enum member is double staged. The first is tested member
5725 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5727 Fixed #56986, #63631, #65231
5729 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5730 adds member to name container.
5731 (TypeContainer.AddToTypeContainer): New method, adds type to
5733 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5734 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5735 AddOperator): Simplified by reusing AddToMemberContainer.
5736 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5738 (Method.CheckForDuplications): Fixed implementation to test all
5740 (MemberBase): Detection whether member is explicit interface
5741 implementation is now in constructor.
5742 (MemberBase.UpdateMemberName): Handles IndexerName.
5743 (Accessor): Changed to keep also location information.
5744 (AbstractPropertyEventMethod): Is derived from MemberCore.
5745 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5746 will be emited or not.
5747 (PropertyBase.AreAccessorsDuplicateImplementation):
5748 Tests whether accessors are not in collision with some method.
5749 (Operator): Is derived from MethodCore to simplify common
5752 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5754 (DeclSpace.AddToContainer): Adds the member to defined_names
5755 table. It tests for duplications and enclosing name conflicts.
5757 * enum.cs (EnumMember): Clean up to reuse the base structures
5759 2004-09-03 Martin Baulig <martin@ximian.com>
5761 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5762 into TypeContainer, to make partial classes work again.
5764 2004-09-03 Martin Baulig <martin@ximian.com>
5766 * rootcontext.cs (RootContext.V2): Removed.
5768 2004-03-23 Martin Baulig <martin@ximian.com>
5770 * expression.cs (Invocation.OverloadResolve): Added `bool
5771 may_fail' argument and use it instead of the Location.IsNull() hack.
5773 2004-09-03 Martin Baulig <martin@ximian.com>
5775 Merged latest changes into gmcs. Please keep this comment in
5776 here, it makes it easier for me to see what changed in MCS since
5777 the last time I merged.
5779 2004-09-03 Raja R Harinath <rharinath@novell.com>
5782 * expression.cs (BetterConversion): Don't allow either conversion
5783 to be null. Remove redundant implicit conversion test when 'q ==
5784 null' -- when this function is invoked, we already know that the
5785 implicit conversion exists.
5786 (BetterFunction): Assume that 'best' is non-null. Remove
5787 redundant reimplementation of IsApplicable when 'best' is null.
5788 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5789 number of arguments.
5790 (IsAncestralType): Extract from OverloadResolve.
5791 (OverloadResolve): Make robust to the MethodGroupExpr being
5792 unsorted. Implement all the logic of Section 14.5.5.1, and
5793 support overloading of methods from multiple applicable types.
5794 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5796 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5797 (RealError, Warning): Append type of report to related symbol.
5799 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5801 * enum.cs: Fixed CLS-Compliance checks for enum members.
5802 Error tests cs3008-8.cs, cs3014-8.cs
5804 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5806 Fixed bug #62342, #63102
5807 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5808 like ImplementMethod.
5810 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5812 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5815 2004-09-02 Martin Baulig <martin@ximian.com>
5817 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5818 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5821 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5823 C# 2.0 Static classes implemented
5825 * class.cs (TypeContainer): instance_constructors,
5826 initialized_fields, initialized_static_fields,
5827 default_constructor, base_inteface_types are protected to be
5828 accessible from StaticClass.
5829 (TypeContainer.DefineDefaultConstructor): New virtual method
5830 for custom default constructor generating
5831 (StaticClass): New class to handle "Static classes" feature.
5833 * cs-parser.jay: Handle static keyword on class like instance
5836 * driver.cs: Added "/langversion" command line switch with two
5837 options (iso-1, default).
5839 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5841 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5843 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5845 * delegate.cs: Style.
5847 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5849 * delegate.cs: Add seperate instance expr field for miguel.
5851 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5853 * PointerArithmetic (Resolve): make sure we are not doing
5854 pointer arith on void*. Also, make sure we are resolved
5855 by not setting eclass until resolve.
5857 All callers: Make sure that PointerArithmetic gets resolved.
5859 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5861 * ArrayCreation (LookupType): If the type does not resolve
5862 to an array, give an error.
5864 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5866 * statement.cs (Try.Resolve): Fixed bug #64222
5868 2004-08-27 Martin Baulig <martin@ximian.com>
5871 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5874 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5876 * ecore.cs (Constantify): Get underlying type via
5877 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5878 Windows in special cases.
5880 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5882 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5883 for obtaining also private methods.
5884 (GetRemoveMethod): Used GetRemoveMethod (true)
5885 for obtaining also private methods.
5887 2004-08-24 Martin Baulig <martin@ximian.com>
5889 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5890 MethodAttributes.HideBySig for operators.
5892 2004-08-23 Martin Baulig <martin@ximian.com>
5894 Back to the old error reporting system :-)
5896 * report.cs (Message): Removed.
5897 (Report.MessageData, ErrorData, WarningData): Removed.
5898 (Report.Error, Warning): Back to the old system.
5900 2004-08-23 Martin Baulig <martin@ximian.com>
5902 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5904 * class.cs (TypeContainer.ParentContainer): New public virtual
5905 method; replaces the explicit interface implementation.
5906 (ClassPart.ParentContainer): Override.
5908 2004-08-23 Martin Baulig <martin@ximian.com>
5910 * statement.cs (Switch): Added support for constant switches; see
5911 #59428 or test-285.cs.
5913 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5916 * statement.cs (GetEnumeratorFilter): Removed useless
5917 logic because C# specs is strict. GetEnumerator must be
5920 2004-08-22 Martin Baulig <martin@ximian.com>
5922 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5923 a switch and may break, reset the barrier. Fixes #59867.
5925 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5927 CLS-Compliance speed up (~5% for corlib)
5929 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5930 New method. Tests container for CLS-Compliant names
5932 * class.cs (TypeContainer.VerifyClsName): New method.
5933 Checks whether container name is CLS Compliant.
5934 (Constructor): Implements IMethodData.
5936 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5937 low-case table for CLS Compliance test.
5938 (MemberCache.VerifyClsParameterConflict): New method.
5939 Checks method parameters for CS3006 error.
5941 * enum.cs (EnumMember): Is derived from MemberCore.
5942 (Enum.VerifyClsName): Optimized for better performance.
5944 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5946 * report.cs: Renamed Error_T to Error and changed all
5949 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5951 * class.cs (TypeContainer.IndexerArrayList): New inner class
5952 container for indexers.
5953 (TypeContainer.DefaultIndexerName): New constant for default
5954 indexer name. Replaced all "Item" with this constant.
5955 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5957 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5958 DefaultMemberAttribute constructor.
5960 2004-08-05 Martin Baulig <martin@ximian.com>
5962 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5965 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5967 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5968 multi platforms problem.
5970 * compiler.csproj: Included shared files.
5972 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5974 Fix bug 60333, 55971 in the more general way
5975 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5976 Added arg_type argument for constant conversion.
5977 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
5979 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5982 * class.cs (TypeContainer ): New inner classes MethodArrayList,
5983 OperatorArrayList, MethodCoreArrayList for typecontainer
5984 containers. Changed class member types to these new types.
5985 (MethodArrayList.DefineMembers): Added test for CS0659.
5987 2004-08-04 Miguel de Icaza <miguel@ximian.com>
5989 * cfold.cs: Synchronize the folding with the code in expression.cs
5990 Binary.DoNumericPromotions for uint operands.
5992 * attribute.cs: Revert patch from Raja, it introduced a regression
5993 while building Blam-1.2.1 (hard to isolate a test case).
5995 2004-08-04 Marek Safar <marek.safar@seznam.cz>
5999 (TypeContainer.Define): Renamed to DefineContainerMembers because of
6001 (MethodCore.parent_method): New member. The method we're overriding
6002 if this is an override method.
6003 (MethodCore.CheckBase): Moved from Method class and made common.
6004 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
6006 (MethodCore.CheckForDuplications): New abstract method. For custom
6007 member duplication search in a container
6008 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
6009 method and its return type.
6010 (Event.conflict_symbol): New member. Symbol with same name in the
6014 (MemberCache.FindMemberWithSameName): New method. The method
6015 is looking for conflict with inherited symbols.
6017 2004-08-04 Martin Baulig <martin@ximian.com>
6019 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
6021 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
6023 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6025 * report.cs (Message): New enum for better error, warning reference in
6027 (MessageData): New inner abstract class. It generally handles printing of
6028 error and warning messages.
6029 Removed unused Error, Warning, Message methods.
6031 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6033 Fix for cs0592-8.cs test
6035 (Attributable.ValidAttributeTargets): Made public.
6036 (Attribute.ExplicitTarget): New member for explicit target value.
6037 (Attribute.CheckTargets): Now we translate explicit attribute
6038 target to Target here.
6040 2004-08-03 Ben Maurer <bmaurer@ximian.com>
6042 * ecore.cs (MethodGroupExpr): new IsBase property.
6044 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
6046 * delegate.cs (DelegateCreation): store a MethodGroupExpr
6047 rather than an instance expr.
6049 (DelegateCreation.Emit): Use the method group rather than
6050 the instance expression. Also, if you have base.Foo as the
6051 method for a delegate, make sure to emit ldftn, not ldftnvirt.
6053 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
6055 (NewDelegate.DoResolve): Only check for the existance of Invoke
6056 if the method is going to be needed. Use MethodGroupExpr.
6058 (NewDelegate.Emit): Remove, DelegateCreation implements this.
6060 * expression.cs: For pointer arith., make sure to use
6061 the size of the type, not the size of the pointer to
6064 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6067 * class.cs (Class): Added error CS0502 test.
6069 2004-08-03 John Luke <jluke@cfl.rr.com>
6070 Raja R Harinath <rharinath@novell.com>
6073 * attribute.cs (Attribute.complained_before): New flag.
6074 (Attribute.ResolveType, Attribute.Resolve),
6075 (Attribute.DefinePInvokeMethod): Set it.
6076 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
6078 2004-08-03 Martin Baulig <martin@ximian.com>
6080 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
6081 use a user-defined operator; we still need to do numeric
6082 promotions in case one argument is a builtin type and the other
6083 one has an implicit conversion to that type. Fixes #62322.
6085 2004-08-02 Martin Baulig <martin@ximian.com>
6087 * statement.cs (LocalInfo.Flags): Added `IsThis'.
6088 (LocalInfo.IsThis): New public property.
6089 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
6091 2004-08-01 Martin Baulig <martin@ximian.com>
6093 * class.cs (TypeContainer.GetClassBases): Don't set the default
6094 here since we may get called from GetPartialBases().
6095 (TypeContainer.DefineType): If GetClassBases() didn't return a
6096 parent, use the default one.
6098 2004-07-30 Duncan Mak <duncan@ximian.com>
6100 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
6102 2004-07-30 Martin Baulig <martin@ximian.com>
6104 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
6106 * class.cs (SourceMethod): New public class, derive from the
6107 symbol writer's ISourceMethod.
6108 (Method): Use the new symbol writer API.
6110 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
6111 as argument and use the new symbol writer.
6114 (SourceFile): Implement the symbol writer's ISourceFile.
6115 (Location.SymbolDocument): Removed.
6116 (Location.SourceFile): New public property.
6118 * symbolwriter.cs: Use the new symbol writer API.
6120 2004-07-30 Raja R Harinath <rharinath@novell.com>
6122 * Makefile (install-local): Remove. Functionality moved to
6125 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
6127 * Makefile: Install mcs.exe.config file together with mcs.exe.
6128 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
6129 correct runtime version.
6131 2004-07-25 Martin Baulig <martin@ximian.com>
6134 (TypeContainer.RegisterOrder): Removed, this was unused.
6135 (TypeContainer, interface_order): Removed.
6136 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
6137 TypeContainer as argument since we can also be called with a
6138 `PartialContainer' for a partial class/struct/interface.
6139 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
6140 of checking whether we're an `Interface' - we could be a
6142 (PartialContainer.Register): Override; call
6143 AddClass()/AddStruct()/AddInterface() on our parent.
6145 * cs-parser.jay (interface_member_declaration): Add things to the
6146 `current_container', not the `current_class'.
6148 * rootcontext.cs (RegisterOrder): The overloaded version which
6149 takes an `Interface' was unused, removed.
6151 * typemanager.cs (TypeManager.LookupInterface): Return a
6152 `TypeContainer', not an `Interface'.
6153 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
6154 contain a `PartialContainer' for an interface, so check it's
6155 `Kind' to figure out what it is.
6157 2004-07-25 Martin Baulig <martin@ximian.com>
6159 * class.cs (Class.DefaultTypeAttributes): New public constant.
6160 (Struct.DefaultTypeAttributes): Likewise.
6161 (Interface.DefaultTypeAttributes): Likewise.
6162 (PartialContainer.TypeAttr): Override this and add the
6163 DefaultTypeAttributes.
6165 2004-07-25 Martin Baulig <martin@ximian.com>
6167 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
6168 we can just use the `Parent' field instead.
6170 2004-07-25 Martin Baulig <martin@ximian.com>
6172 * class.cs (TypeContainer.Emit): Renamed to EmitType().
6174 2004-07-25 Martin Baulig <martin@ximian.com>
6176 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
6177 our parts before defining any methods.
6178 (TypeContainer.VerifyImplements): Make this virtual.
6179 (ClassPart.VerifyImplements): Override and call VerifyImplements()
6180 on our PartialContainer.
6182 2004-07-25 Martin Baulig <martin@ximian.com>
6184 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
6186 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
6187 argument, we can just use the `Parent' field instead.
6190 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
6191 (MemberBase.DoDefine): Likewise.
6193 2004-07-24 Martin Baulig <martin@ximian.com>
6195 * decl.cs (MemberCore.Parent): New public field.
6196 (DeclSpace.Parent): Moved to MemberCore.
6198 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
6199 (MemberBase.ctor): Added TypeContainer argument, pass it to our
6201 (FieldBase, Field, Operator): Likewise.
6202 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
6203 (EventField, Event): Likewise.
6205 2004-07-23 Martin Baulig <martin@ximian.com>
6207 * class.cs (PartialContainer): New public class.
6208 (ClassPart): New public class.
6209 (TypeContainer): Added support for partial classes.
6210 (TypeContainer.GetClassBases): Splitted some of the functionality
6211 out into GetNormalBases() and GetPartialBases().
6213 * cs-tokenizer.cs (Token.PARTIAL): New token.
6214 (Tokenizer.consume_identifier): Added some hacks to recognize
6215 `partial', but only if it's immediately followed by `class',
6216 `struct' or `interface'.
6218 * cs-parser.jay: Added support for partial clases.
6220 2004-07-23 Martin Baulig <martin@ximian.com>
6222 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
6223 a `DeclSpace' and also made it readonly.
6224 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
6225 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
6226 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
6228 * cs-parser.jay: Pass the `current_class', not the
6229 `current_container' (at the moment, this is still the same thing)
6230 to a new Method, Property, Event, Indexer or Constructor.
6232 2004-07-23 Martin Baulig <martin@ximian.com>
6234 * cs-parser.jay (CSharpParser): Added a new `current_class' field
6235 and removed the `current_interface' one.
6236 (struct_declaration, class_declaration, interface_declaration):
6237 Set `current_class' to the newly created class/struct/interface;
6238 set their `Bases' and call Register() before parsing their body.
6240 2004-07-23 Martin Baulig <martin@ximian.com>
6242 * class.cs (Kind): New public enum.
6243 (TypeContainer): Made this class abstract.
6244 (TypeContainer.Kind): New public readonly field.
6245 (TypeContainer.CheckDef): New public method; moved here from
6247 (TypeContainer.Register): New public abstract method.
6248 (TypeContainer.GetPendingImplementations): New public abstract
6250 (TypeContainer.GetClassBases): Removed the `is_class' and
6251 `is_iface' parameters.
6252 (TypeContainer.DefineNestedTypes): Formerly known as
6254 (ClassOrStruct): Made this class abstract.
6256 * tree.cs (RootTypes): New public type.
6258 2004-07-20 Martin Baulig <martin@ximian.com>
6260 * tree.cs (Tree.RecordNamespace): Removed.
6261 (Tree.Namespaces): Removed.
6263 * rootcontext.cs (RootContext.IsNamespace): Removed.
6265 * cs-parser.jay (namespace_declaration): Just create a new
6266 NamespaceEntry here.
6268 2004-07-20 Martin Baulig <martin@ximian.com>
6270 * statement.cs (ExceptionStatement): New abstract class. This is
6271 now used as a base class for everyone who's using `finally'.
6272 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
6273 our local variables before using them.
6275 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
6276 virtual method. This is used by Yield.Resolve() to "steal" an
6277 outer block's `finally' clauses.
6278 (FlowBranchingException): The .ctor now takes an ExceptionStatement
6281 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
6282 version which takes an ExceptionStatement. This version must be
6283 used to create exception branchings.
6286 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
6287 (Iterator.EmitMoveNext): Added exception support; protect the
6288 block with a `fault' clause, properly handle 'finally' clauses.
6289 (Iterator.EmitDispose): Run all the `finally' clauses here.
6291 2004-07-20 Martin Baulig <martin@ximian.com>
6293 * iterator.cs: This is the first of a set of changes in the
6294 iterator code. Match the spec more closely: if we're an
6295 IEnumerable, then GetEnumerator() must be called. The first time
6296 GetEnumerator() is called, it returns the current instance; all
6297 subsequent invocations (if any) must create a copy.
6299 2004-07-19 Miguel de Icaza <miguel@ximian.com>
6301 * expression.cs: Resolve the constant expression before returning
6304 2004-07-19 Martin Baulig <martin@ximian.com>
6306 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
6307 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
6308 the return type of the new EmitContext.
6310 2004-07-18 Martin Baulig <martin@ximian.com>
6312 * class.cs (Property.Define): Fix iterators.
6314 * iterators.cs (Iterator.Define): Moved the
6315 `container.AddInterator (this)' call here from the .ctor; only do
6316 it if we resolved successfully.
6318 2004-07-17 Miguel de Icaza <miguel@ximian.com>
6320 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
6321 `true' for preprocessing directives that we parse. The return
6322 value indicates whether we should return to regular tokenizing or
6323 not, not whether it was parsed successfully.
6325 In the past if we were in: #if false ... #line #endif, we would
6326 resume parsing after `#line'. See bug 61604.
6328 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
6329 building: IsEnumType should return true only for enums, not for
6330 enums or System.Enum itself. This fixes #61593.
6332 Likely what happened is that corlib was wrong: mcs depended on
6333 this bug in some places. The bug got fixed, we had to add the
6334 hack, which caused bug 61593.
6336 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
6337 that was a workaround for the older conditions.
6339 2004-07-16 Ben Maurer <bmaurer@ximian.com>
6341 * assign.cs: IAssignMethod has a new interface, as documented
6342 inline. All assignment code now uses this new api.
6344 * ecore.cs, expression.cs: All classes which implement
6345 IAssignMethod now use the new interface.
6347 * expression.cs (Invocation): add a hack to EmitCall so that
6348 IndexerAccess can be the target of a compound assignment without
6349 evaluating its arguments twice.
6351 * statement.cs: Handle changes in Invocation api.
6353 2004-07-16 Martin Baulig <martin@ximian.com>
6355 * iterators.cs: Rewrote this. We're now using one single Proxy
6356 class for both the IEnumerable and the IEnumerator interface and
6357 `Iterator' derives from Class so we can use the high-level API.
6359 * class.cs (TypeContainer.AddIterator): New method.
6360 (TypeContainer.DoDefineType): New protected virtual method, which
6361 is called from DefineType().
6362 (TypeContainer.DoDefineMembers): Call DefineType() and
6363 DefineMembers() on all our iterators.
6364 (TypeContainer.Emit): Call Emit() on all our iterators.
6365 (TypeContainer.CloseType): Call CloseType() on all our iterators.
6367 * codegen.cs (EmitContext.CurrentIterator): New public field.
6369 2004-07-15 Martin Baulig <martin@ximian.com>
6372 (TypeManager.not_supported_exception_type): New type.
6374 2004-07-14 Martin Baulig <martin@ximian.com>
6376 * iterators.cs: Use real error numbers.
6378 2004-07-14 Martin Baulig <martin@ximian.com>
6380 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
6381 requires this to be a System.Collection.IEnumerable and not a
6382 class implementing that interface.
6383 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
6385 2004-07-13 Marek Safar <marek.safar@seznam.cz>
6387 * class.cs: Fixed previous fix, it broke some error tests.
6389 2004-07-12 Martin Baulig <martin@ximian.com>
6391 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
6394 2004-07-09 Miguel de Icaza <miguel@ximian.com>
6396 * assign.cs (LocalTemporary): Add new argument: is_address,If
6397 `is_address' is true, then the value that we store is the address
6398 to the real value, and not the value itself.
6400 * ecore.cs (PropertyExpr): use the new local temporary
6401 stuff to allow us to handle X.Y += z (where X is a struct)
6403 2004-07-08 Martin Baulig <martin@ximian.com>
6405 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
6406 not always return, just like we're doing in Using.Resolve().
6408 2004-07-07 Miguel de Icaza <miguel@ximian.com>
6410 * cs-parser.jay (fixed_statement): flag this as Pinned.
6412 2004-07-06 Miguel de Icaza <miguel@ximian.com>
6414 * typemanager.cs (TypeManager): Removed MakePinned method, this
6415 mechanism is replaced with the .NET 2.x compatible mechanism of
6416 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
6418 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
6419 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
6420 `IsFixed' property which has a different meaning.
6422 2004-07-02 Raja R Harinath <rharinath@novell.com>
6424 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
6425 visible from inside a nested class, not just the names of the
6426 immediately enclosing class.
6429 2004-06-24 Raja R Harinath <rharinath@novell.com>
6431 * expression.cs (BetterConversion): Remove buggy special-case
6432 handling of "implicit constant expression conversions". At this
6433 point, we already know that the conversion is possible -- we're
6434 only checking to see which is better.
6436 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6438 * cs-parser.jay: Added error CS0210 test.
6440 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6442 * cs-parser.jay: Added error CS0134 test.
6444 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6447 * cs-parser.jay: Added error CS0145 test.
6449 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6451 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
6453 2004-06-23 Ben Maurer <bmaurer@ximian.com>
6455 * expression.cs (StackAlloc.Resolve): The argument may not
6456 be a constant; deal with this case.
6458 2004-06-23 Marek Safar <marek.safar@seznam.cz>
6460 * attribute.cs (IndexerName_GetIndexerName): Renamed to
6461 GetIndexerAttributeValue.
6462 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
6464 * class.cs (Indexer.Define): Added error tests for CS0415,
6467 2004-06-23 Miguel de Icaza <miguel@ximian.com>
6469 * attribute.cs (Attribute.Resolve): Keep field code in sync with
6472 2004-06-23 Martin Baulig <martin@ximian.com>
6474 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
6475 neither return nor throw, reset the barrier as well. Fixes #60457.
6477 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
6479 * class.cs : EventAttributes is now set to None by default.
6480 This fixes bug #60459.
6482 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6485 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6486 Don't throw exception but return null (it's sufficient now).
6488 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6490 * typemanager.cs (GetArgumentTypes): Faster implementation.
6492 2004-06-18 Martin Baulig <martin@ximian.com>
6494 * attribute.cs (Attribute.Resolve): Check whether we're an
6495 EmptyCast which a Constant child. Fixes #60333.
6497 2004-06-17 Ben Maurer <bmaurer@ximian.com>
6499 * statement.cs (EmitCollectionForeach): Account for the fact that
6500 not all valuetypes are in areas which we can take the address of.
6501 For these variables, we store to a temporary variable. Also, make
6502 sure that we dont emit a `callvirt' on a valuetype method.
6504 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6506 * expression.cs (StackAlloc.DoReSolve): Added test for
6507 negative parameter (CS0247).
6509 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6512 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
6514 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6517 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
6520 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6522 Fix bug #58254 & cs1555.cs, cs1556.cs
6523 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
6525 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6527 * cs-parser.jay: Added error CS1669 test for indexers.
6529 2004-06-11 Martin Baulig <martin@ximian.com>
6531 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
6532 call this twice: for params and varargs methods.
6534 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6537 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
6539 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6541 * attribute.cs (Attribute.GetValidTargets): Made public.
6544 (AbstractPropertyEventMethod): New class for better code sharing.
6545 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
6547 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
6549 2004-06-11 Raja R Harinath <rharinath@novell.com>
6552 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
6553 that the call to Resolve is part of a MemberAccess.
6554 (Expression.Resolve): Use it for SimpleName resolution.
6555 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
6556 Add 'intermediate' boolean argument.
6557 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
6558 error message when the SimpleName can be resolved ambiguously
6559 between an expression and a type.
6560 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
6562 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
6563 call on the left-side.
6565 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6568 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
6570 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6572 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
6574 2004-06-11 Martin Baulig <martin@ximian.com>
6576 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
6577 varargs methods if applicable.
6579 2004-06-11 Martin Baulig <martin@ximian.com>
6581 * expression.cs (Invocation.EmitCall): Don't use
6582 `method.CallingConvention == CallingConventions.VarArgs' since the
6583 method could also have `CallingConventions.HasThis'.
6585 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6587 * class.cs (Event.GetSignatureForError): Implemented.
6588 Fixed crash in error test cs3010.cs
6590 2004-06-10 Miguel de Icaza <miguel@ximian.com>
6592 * cs-tokenizer.cs: Change the way we track __arglist to be
6593 consistent with the other keywords.
6595 2004-06-09 Miguel de Icaza <miguel@ximian.com>
6597 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
6600 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
6602 * codegen.cs: Check that all referenced assemblies have a strongname
6603 before strongnaming the compiled assembly. If not report error CS1577.
6604 Fix bug #56563. Patch by Jackson Harper.
6605 * typemanager.cs: Added a method to return all referenced assemblies.
6606 Fix bug #56563. Patch by Jackson Harper.
6608 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6611 (Method.ApplyAttributeBuilder): Moved and added conditional
6612 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
6615 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
6617 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6620 * class.cs: (EventField.attribute_targets): Changed default target.
6622 2004-06-08 Martin Baulig <martin@ximian.com>
6624 * expression.cs (Invocation.EmitCall): Enable varargs methods.
6626 2004-06-08 Martin Baulig <martin@ximian.com>
6628 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
6630 2004-06-07 Martin Baulig <martin@ximian.com>
6632 Added support for varargs methods.
6634 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
6637 * cs-parser.jay: Added support for `__arglist'.
6639 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
6641 * expression.cs (Argument.AType): Added `ArgList'.
6642 (Invocation): Added support for varargs methods.
6643 (ArglistAccess): New public class.
6644 (Arglist): New public class.
6646 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
6648 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
6649 a method's top-level block if the method has varargs.
6651 * support.cs (ReflectionParameters, InternalParameters): Added
6652 support for varargs methods.
6654 2004-06-07 Miguel de Icaza <miguel@ximian.com>
6656 * class.cs: Provide location in indexer error report.
6658 * driver.cs: Use standard names.
6660 * namespace.cs: Catch the use of using after a namespace has been
6661 declared also on using aliases.
6663 2004-06-03 Raja R Harinath <rharinath@novell.com>
6666 * typemanager.cs (closure_private_ok, closure_invocation_type)
6667 (closure_qualifier_type, closure_invocation_assembly)
6668 (FilterWithClosure): Move to ...
6669 (Closure): New internal nested class.
6670 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
6671 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
6672 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
6673 (MemberLookup, MemberLookupFailed): Use it.
6674 * expression.cs (New.DoResolve): Treat the lookup for the
6675 constructor as being qualified by the 'new'ed type.
6676 (Indexers.GetIndexersForTypeOrInterface): Update.
6678 2004-06-03 Marek Safar <marek.safar@seznam.cz>
6681 (GetConditionalAttributeValue): New method. Returns
6682 condition of ConditionalAttribute.
6683 (SearchMulti): New method. Returns all attributes of type 't'.
6684 Use it when attribute is AllowMultiple = true.
6685 (IsConditionalMethodExcluded): New method.
6688 (Method.IsExcluded): Implemented. Returns true if method has conditional
6689 attribute and the conditions is not defined (method is excluded).
6690 (IMethodData): Extended interface for ConditionalAttribute support.
6691 (PropertyMethod.IsExcluded): Implemented.
6694 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
6697 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
6700 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
6702 * expression.cs (ArrayCreationExpression): Make this just an
6703 `expression'. It can't be a statement, so the code here was
6706 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6709 * typemanager.cs (GetFullNameSignature): New method for
6712 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6715 * class.cs (MemberBase.GetSignatureForError): New virtual method.
6716 Use this method when MethodBuilder is null.
6717 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
6718 Added test for error CS0626 (MONO reports error for this situation).
6719 (IMethodData.GetSignatureForError): Extended interface.
6721 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6724 (AttributeTester.GetObsoleteAttribute): Returns instance of
6725 ObsoleteAttribute when type is obsolete.
6728 (TypeContainer.VerifyObsoleteAttribute): Override.
6729 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6730 (MethodCode.VerifyObsoleteAttribute): Override.
6731 (MemberBase.VerifyObsoleteAttribute): Override.
6734 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6735 and report proper error.
6738 Delegate.VerifyObsoleteAttribute): Override.
6741 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6742 and report proper error.
6743 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6746 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6750 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6751 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6752 Added test for ObsoleteAttribute.
6755 (Catch): Derived from Statement.
6757 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6759 Fixed bug #59071 & cs0160.cs
6761 * statement.cs (Try.Resolve): Check here whether order of catch
6762 clauses matches their dependencies.
6764 2004-05-31 Miguel de Icaza <miguel@ximian.com>
6766 * Reverted patch to namespace.cs (Use lookuptypedirect). This
6767 caused a regression: #59343. Referencing nested classes from an
6768 assembly stopped working.
6770 2004-05-31 Martin Baulig <martin@ximian.com>
6772 MCS is now frozen for beta 2.
6774 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6776 * convert.cs: add a trivial cache for overload operator resolution.
6778 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6780 * decl.cs: If possible, use lookuptypedirect here. We can only do
6781 this if there is no `.' after the namespace. Avoids using
6782 LookupType, which does lots of slow processing.
6783 (FindNestedType) New method, does what it says :-).
6784 * namespace.cs: use LookupTypeDirect.
6785 * rootcontext.cs: use membercache, if possible.
6786 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6788 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6791 According to the spec,
6793 In a member access of the form E.I, if E is a single identifier,
6794 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6795 field, property, localvariable, or parameter with the same type as
6796 the meaning of E as a type-name (§3.8), then both possible
6797 meanings of E are permitted.
6799 We did not check that E as a simple-name had the same type as E as
6802 This trivial check gives us 5-7% on bootstrap time.
6804 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6806 * expression.cs (Invocation.OverloadResolve): Avoid the
6807 use of hashtables and boxing here by allocating on demand.
6809 2004-05-30 Martin Baulig <martin@ximian.com>
6811 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6812 we're doing a silent lookup. Don't try to lookup nested types in
6813 TypeManager.object_type (thanks to Ben Maurer).
6815 2004-05-30 Martin Baulig <martin@ximian.com>
6817 Committing a patch from Ben Maurer.
6819 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6821 2004-05-29 Martin Baulig <martin@ximian.com>
6823 * class.cs (IMethodData.ShouldIgnore): New method.
6825 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6826 `Location' argument, we don't need it anywhere. Use
6827 `IMethodData.ShouldIgnore ()' instead of
6828 `MethodData.GetMethodFlags ()'.
6829 (TypeManager.AddMethod): Removed.
6830 (TypeManager.AddMethod2): Renamed to AddMethod.
6832 2004-05-29 Martin Baulig <martin@ximian.com>
6834 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6836 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6837 converting from a class type S to an interface type and we already
6838 have an object on the stack, don't box it again. Fixes #52578.
6840 2004-05-29 Martin Baulig <martin@ximian.com>
6842 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6843 Added support for `params' parameters. Fixes #59267.
6845 2004-05-29 Martin Baulig <martin@ximian.com>
6847 * literal.cs (NullPointer): Provide a private .ctor which sets
6848 `type' to TypeManager.object_type. Fixes #59048.
6850 2004-05-29 Martin Baulig <martin@ximian.com>
6852 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6853 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6855 * ecore.cs (EventExpr.instance_expr): Make the field private.
6857 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6859 Fixed bug #50080 & cs0214-2.cs
6860 * expression.cs (Cast.DoResolve): Check unsafe context here.
6862 * statement.cs (Resolve.DoResolve): Likewise.
6864 2004-05-26 Martin Baulig <martin@ximian.com>
6866 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6868 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6869 (RootContext.LookupType): Pass down the `silent' flag.
6871 2004-05-25 Martin Baulig <martin@ximian.com>
6874 (MethodGroupExpr.IdenticalTypeName): New public property.
6875 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6876 expression actually refers to a type.
6878 2004-05-25 Martin Baulig <martin@ximian.com>
6880 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6881 for #56176 and made it actually work.
6883 2004-05-25 Martin Baulig <martin@ximian.com>
6885 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6886 (FieldExpr, PropertyExpr): Override and implement
6887 CacheTemporaries. Fixes #52279.
6889 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6891 * location.cs: In the new compiler listing a file twice is a
6892 warning, not an error.
6894 2004-05-24 Martin Baulig <martin@ximian.com>
6896 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6897 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6899 2004-05-24 Martin Baulig <martin@ximian.com>
6901 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6902 walking the `using' list. Fixes #53921.
6904 2004-05-24 Martin Baulig <martin@ximian.com>
6906 * const.cs (Const.LookupConstantValue): Added support for
6907 EmptyCast's; fixes #55251.
6909 2004-05-24 Martin Baulig <martin@ximian.com>
6911 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6912 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6913 which does the CS0135 check. The reason is that we first need to
6914 check whether the variable actually exists.
6916 2004-05-24 Martin Baulig <martin@ximian.com>
6918 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6919 than RootContext.LookupType() to find the explicit interface
6922 2004-05-24 Raja R Harinath <rharinath@novell.com>
6924 * Makefile: Simplify. Use executable.make.
6925 * mcs.exe.sources: New file. List of sources of mcs.exe.
6927 2004-05-24 Anders Carlsson <andersca@gnome.org>
6931 Use the invariant culture when doing String.Compare for CLS case
6934 2004-05-23 Martin Baulig <martin@ximian.com>
6936 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6937 don't have any dots. Fixes #52622, added cs0246-8.cs.
6939 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6941 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6943 * class.cs (MemberBase.Define): Reuse MemberType member for
6944 resolved type. Other methods can use it too.
6946 2004-05-23 Martin Baulig <martin@ximian.com>
6948 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6949 the variable also exists in the current block (otherwise, we need
6950 to report a CS0103). Fixes #58670.
6952 2004-05-23 Martin Baulig <martin@ximian.com>
6954 * flowanalysis.cs (Reachability.Reachable): Compute this
6955 on-the-fly rather than storing it as a field.
6957 2004-05-23 Martin Baulig <martin@ximian.com>
6959 * flowanalysis.cs (Reachability.And): Manually compute the
6960 resulting `barrier' from the reachability.
6962 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6965 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6966 instance of ObsoleteAttribute when symbol is obsolete.
6969 (IMethodData): Extended interface for ObsoleteAttribute support.
6971 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6973 * attribute.cs: Fix bug #55970
6975 2004-05-22 Marek Safar <marek.safar@seznam.cz>
6979 (GetObsoleteAttribute): New method. Creates the instance of
6981 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
6982 ObsoleteAttribute when member is obsolete.
6983 (AttributeTester.Report_ObsoleteMessage): Common method for
6984 Obsolete error/warning reporting.
6987 (TypeContainer.base_classs_type): New member for storing parent type.
6990 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
6991 for this MemberCore.
6993 2004-05-21 Marek Safar <marek.safar@seznam.cz>
6995 * attribute.cs, const.cs: Fix bug #58590
6997 2004-05-21 Martin Baulig <martin@ximian.com>
6999 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
7000 out parameters if the end of the method is unreachable. Fixes
7003 2004-05-21 Marek Safar <marek.safar@seznam.cz>
7005 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
7006 Hari was right, why extra method.
7008 2004-05-21 Marek Safar <marek.safar@seznam.cz>
7010 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
7012 2004-05-20 Martin Baulig <martin@ximian.com>
7014 Merged this back from gmcs to keep the differences to a minumum.
7016 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
7017 instead of a Declspace.
7018 (Attribute.ResolveType): Likewise.
7019 (Attributes.Search): Likewise.
7020 (Attributes.Contains): Likewise.
7021 (Attributes.GetClsCompliantAttribute): Likewise.
7023 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
7025 (MethodData.ApplyAttributes): Take an EmitContext instead of a
7028 2004-05-19 Marek Safar <marek.safar@seznam.cz>
7030 Fix bug #58688 (MCS does not report error when the same attribute
7033 * attribute.cs (Attribute.Emit): Distinction between null and default.
7035 2004-05-19 Raja R Harinath <rharinath@novell.com>
7037 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
7038 of a top-level attribute without an attribute target.
7039 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
7041 (Attribute.Conditional_GetConditionName),
7042 (Attribute.Obsolete_GetObsoleteMessage): Update.
7043 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
7044 part of ScanForIndexerName.
7045 (Attribute.CanIgnoreInvalidAttribute): New function.
7046 (Attribute.ScanForIndexerName): Move to ...
7047 (Attributes.ScanForIndexerName): ... here.
7048 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
7049 (Attributes.Search): New internal variant that can choose not to
7050 complain if types aren't resolved. The original signature now
7052 (Attributes.GetClsCompliantAttribute): Use internal variant, with
7053 complaints suppressed.
7054 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
7055 only if it not useful.
7056 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
7057 top-level for attributes that are shared between the assembly
7058 and a top-level class.
7059 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
7060 * class.cs: Update to reflect changes.
7061 (DefineIndexers): Fuse loops.
7062 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
7063 a couple more variants of attribute names.
7065 2004-05-18 Marek Safar <marek.safar@seznam.cz>
7067 Fix bug #52585 (Implemented explicit attribute declaration)
7070 (Attributable.ValidAttributeTargets): New abstract method. It gets
7071 list of valid attribute targets for explicit target declaration.
7072 (Attribute.Target): It holds target itself.
7073 (AttributeSection): Removed.
7074 (Attribute.CheckTargets): New method. It checks whether attribute
7075 target is valid for the current element.
7078 (EventProperty): New class. For events that are declared like
7079 property (with add and remove accessors).
7080 (EventField): New class. For events that are declared like field.
7083 * cs-parser.jay: Implemented explicit attribute target declaration.
7085 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
7086 Override ValidAttributeTargets.
7089 (ReturnParameter): Class for applying custom attributes on
7091 (ParameterAtribute): New class. Class for applying custom
7092 attributes on the parameter type.
7094 2004-05-17 Miguel de Icaza <miguel@ximian.com>
7096 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
7099 (Method): Allow UNSAFE here.
7101 * modifiers.cs: Support unsafe reporting.
7103 2004-05-17 Marek Safar <marek.safar@seznam.cz>
7105 * decl.cs: Fix bug #58478.
7107 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7109 * statement.cs: When checking for unreachable code on an EmptyStatement,
7110 set the location. Fixes bug #58488.
7112 2004-05-13 Miguel de Icaza <miguel@ximian.com>
7114 * driver.cs: Add -pkg handling.
7116 From Gonzalo: UseShelLExecute=false
7118 2004-05-12 Marek Safar <marek.safar@seznam.cz>
7121 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
7123 (Attribute.IsClsCompliaceRequired): Moved to base for better
7125 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
7126 when attribute is AttributeUsageAttribute.
7127 (Attribute.GetValidTargets): Simplified.
7128 (Attribute.GetAttributeUsage): New method returns AttributeUsage
7129 attribute for this type.
7130 (Attribute.ApplyAttributes): Method renamed to Emit and make
7132 (GlobalAttributeSection): New class for special handling of global
7133 attributes (assembly, module).
7134 (AttributeSection.Emit): New method.
7136 * class.cs: Implemented Attributable abstract methods.
7137 (MethodCore.LabelParameters): Moved to Parameter class.
7138 (Accessor): Is back simple class.
7139 (PropertyMethod): Implemented Attributable abstract class.
7140 (DelegateMethod): Implemented Attributable abstract class.
7141 (Event): New constructor for disctintion between normal Event
7142 and Event with accessors.
7144 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
7146 * codegen.cs, const.cs, decl.cs, delegate.cs:
7147 (CommonAssemblyModulClass): Implemented Attributable abstract class
7150 * enum.cs: Implement IAttributeSupport interface.
7151 (EnumMember): New class for emum members. Implemented Attributable
7155 (ParameterBase): Is abstract.
7156 (ReturnParameter): New class for easier [return:] attribute handling.
7158 * typemanager.cs: Removed builder_to_attr.
7160 2004-05-11 Raja R Harinath <rharinath@novell.com>
7163 * attribute.cs (Attribute.GetPositionalValue): New function.
7164 * class.cs (TypeContainer.VerifyMembers): New function.
7165 (TypeContainer.Emit): Use it.
7166 (ClassOrStruct): New base class for Class and Struct.
7167 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
7168 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
7170 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
7171 then each non-static field should have a FieldOffset attribute.
7172 Otherwise, none of the fields should have a FieldOffset attribute.
7173 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
7174 and FieldOffset attributes.
7175 * typemanager.cs (TypeManager.struct_layout_attribute_type)
7176 (TypeManager.field_offset_attribute_type): New core types.
7177 (TypeManager.InitCoreTypes): Initialize them.
7179 2004-05-11 Michal Moskal <malekith@pld-linux.org>
7181 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
7182 Return correct type.
7185 2004-05-09 Miguel de Icaza <miguel@ximian.com>
7187 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
7188 be implicitly converted to ulong.
7190 * expression.cs: The logic for allowing operator &, | and ^ worked
7191 was wrong, it worked before because we did not report an error in
7192 an else branch. Fixes 57895.
7194 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
7195 allow volatile fields to be reference types.
7197 2004-05-07 Miguel de Icaza <miguel@ximian.com>
7199 * driver.cs: Add support for /debug-
7201 2004-05-07 Raja R Harinath <rharinath@novell.com>
7203 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
7204 Add a 'complain' parameter to silence errors.
7205 (Attribute.Resolve): Update to changes. Put in sanity check to catch
7206 silently overlooked type-resolutions.
7207 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
7209 (Attributes.Search): New function.
7210 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
7211 (Attributes.GetAttributeFullName): Remove hack.
7212 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
7213 Update to reflect changes.
7214 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
7215 Use Attributes.Search instead of nested loops.
7217 2004-05-07 Marek Safar <marek.safar@seznam.cz>
7220 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
7221 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
7222 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
7224 * report.cs: (Report.Warning): Renamed to Warning_T because of
7225 parameter collision.
7227 2004-05-05 Raja R Harinath <rharinath@novell.com>
7229 * expression.cs (MemberAccess.ResolveMemberAccess):
7230 Exit with non-zero status after Report.Error.
7231 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
7233 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
7235 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7237 * support.cs: Don't hang when the file is empty.
7239 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7241 * support.cs: In SeekableStreamReader, compute the preamble size of the
7242 underlying stream. Position changes should take into account that initial
7245 2004-05-03 Todd Berman <tberman@sevenl.net>
7247 * driver.cs: remove unused GetSysVersion function.
7249 2004-05-03 Todd Berman <tberman@sevenl.net>
7251 * driver.cs: Remove the hack from saturday, as well as the hack
7252 from jackson (LoadAssemblyFromGac), also adds the CWD to the
7253 link_paths to get that bit proper.
7255 2004-05-01 Todd Berman <tberman@sevenl.net>
7257 * driver.cs: Try a LoadFrom before a Load, this checks the current
7258 path. This is currently a bug in mono that is be fixed, however, this
7259 provides a workaround for now. This will be removed when the bug
7262 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
7264 * CryptoConvert.cs: Updated to latest version. Fix issue with
7265 incomplete key pairs (#57941).
7267 2004-05-01 Todd Berman <tberman@sevenl.net>
7269 * driver.cs: Remove '.' from path_chars, now System.* loads properly
7272 2004-04-30 Jackson Harper <jackson@ximian.com>
7274 * codegen.cs: Open keys readonly.
7276 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7278 * typemanager.cs: don't report cyclic struct layout when a struct
7279 contains 2 or more fields of the same type. Failed for Pango.AttrShape
7280 which has 2 Pango.Rectangle fields.
7282 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
7284 * expression.cs: Handle IntPtr comparisons with IL code
7285 rather than a method call.
7287 2004-04-29 Martin Baulig <martin@ximian.com>
7289 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
7290 the list of PropertyInfo's in class hierarchy and find the
7291 accessor. Fixes #56013.
7293 2004-04-29 Martin Baulig <martin@ximian.com>
7295 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
7297 2004-04-29 Martin Baulig <martin@ximian.com>
7299 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7301 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
7303 2004-04-29 Martin Baulig <martin@ximian.com>
7305 * class.cs (ConstructorInitializer.Resolve): Check whether the
7306 parent .ctor is accessible. Fixes #52146.
7308 2004-04-29 Martin Baulig <martin@ximian.com>
7310 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7312 * statement.cs (Using.EmitLocalVariableDecls): Use
7313 TypeManager.idisposable_type, not typeof (IDisposable).
7314 (Foreach.EmitCollectionForeach): Added support for valuetypes.
7316 2004-04-29 Martin Baulig <martin@ximian.com>
7318 * class.cs (Event.Define): Don't emit the field and don't set
7319 RTSpecialName and SpecialName for events on interfaces. Fixes
7322 2004-04-29 Raja R Harinath <rharinath@novell.com>
7324 Refactor Attribute.ApplyAttributes.
7325 * attribute.cs (Attributable): New base class for objects that can
7326 have Attributes applied on them.
7327 (Attribute): Make AttributeUsage fields public.
7328 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
7329 (Attribute.IsInternalCall): New property.
7330 (Attribute.UsageAttr): Convert to a public read-only property.
7331 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
7332 (Attribute.ResolveType, Attribute.Resolve)
7333 (Attribute.ScanForIndexerName): Update to reflect changes.
7334 (Attribute.CheckAttributeTarget): Re-format.
7335 (Attribute.ApplyAttributes): Refactor, to various
7336 Attributable.ApplyAttributeBuilder methods.
7337 * decl.cs (MemberCore): Make Attributable.
7338 * class.cs (Accessor): Make Attributable.
7339 (MethodData.ApplyAttributes): Use proper attribute types, not
7341 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
7342 (TypeContainer.ApplyAttributeBuilder)
7343 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
7344 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
7345 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
7346 (Operator.ApplyAttributeBuilder): New factored-out methods.
7347 * const.cs (Const.ApplyAttributeBuilder): Likewise.
7348 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
7349 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
7350 * parameter.cs (ParameterBase): New Attributable base class
7351 that can also represent Return types.
7352 (Parameter): Update to the changes.
7354 2004-04-29 Jackson Harper <jackson@ximian.com>
7356 * driver.cs: Prefer the corlib system version when looking for
7357 assemblies in the GAC. This is still a hack, but its a better hack
7360 2004-04-29 Marek Safar <marek.safar@seznam.cz>
7362 * decl.cs, enum.cs: Improved error 3005 reporting.
7364 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
7365 (related_symbols): New private member for list of symbols
7366 related to reported error/warning.
7368 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
7370 2004-04-29 Martin Baulig <martin@ximian.com>
7372 * ecore.cs (Expression.Constantify): If we're an enum and
7373 TypeManager.TypeToCoreType() doesn't give us another type, use
7374 t.UnderlyingSystemType. Fixes #56178.
7376 2004-04-29 Martin Baulig <martin@ximian.com>
7378 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
7379 interfaces and for each interface, only add members directly
7380 declared in that interface. Fixes #53255.
7382 2004-04-28 Martin Baulig <martin@ximian.com>
7384 * expression.cs (ConditionalLogicalOperator): Use a temporary
7385 variable for `left' to avoid that we evaluate it more than once;
7388 2004-04-28 Martin Baulig <martin@ximian.com>
7390 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
7393 2004-04-28 Martin Baulig <martin@ximian.com>
7395 * statement.cs (LocalInfo.Resolve): Check whether the type is not
7398 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
7399 whether the type is not void (CS1547).
7401 2004-04-28 Martin Baulig <martin@ximian.com>
7403 * expression.cs (Unary.DoResolveLValue): Override this and report
7404 CS0131 for anything but Operator.Indirection.
7406 2004-04-28 Martin Baulig <martin@ximian.com>
7408 Committing a patch from Ben Maurer; see bug #50820.
7410 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7413 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7416 2004-04-28 Martin Baulig <martin@ximian.com>
7418 Committing a patch from Ben Maurer; see bug #50820.
7420 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7423 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7426 2004-04-28 Martin Baulig <martin@ximian.com>
7428 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
7429 (Block.AddLabel): Call DoLookupLabel() to only search in the
7432 2004-04-28 Martin Baulig <martin@ximian.com>
7434 * cfold.cs (ConstantFold.BinaryFold): Added special support for
7435 comparing StringConstants and NullLiterals in Equality and Inequality.
7437 2004-04-28 Jackson Harper <jackson@ximian.com>
7439 * driver.cs: Attempt to load referenced assemblies from the
7440 GAC. This is the quick and dirty version of this method that
7441 doesnt take into account versions and just takes the first
7442 canidate found. Will be good enough for now as we will not have more
7443 then one version installed into the GAC until I update this method.
7445 2004-04-28 Martin Baulig <martin@ximian.com>
7447 * typemanager.cs (TypeManager.CheckStructCycles): New public
7448 static method to check for cycles in the struct layout.
7450 * rootcontext.cs (RootContext.PopulateTypes): Call
7451 TypeManager.CheckStructCycles() for each TypeContainer.
7452 [Note: We only need to visit each type once.]
7454 2004-04-28 Martin Baulig <martin@ximian.com>
7456 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
7458 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
7459 success and added `out object value'. Use a `bool resolved' field
7460 to check whether we've already been called rather than
7461 `ConstantValue != null' since this breaks for NullLiterals.
7463 2004-04-28 Raja R Harinath <rharinath@novell.com>
7465 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
7466 setting of this flag, since the 'set' method may be non-public.
7468 2004-04-28 Raja R Harinath <rharinath@novell.com>
7470 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
7471 check on current_vector.Block.
7473 2004-04-27 Martin Baulig <martin@ximian.com>
7475 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
7476 a field initializer. Fixes #56459.
7478 2004-04-27 Martin Baulig <martin@ximian.com>
7480 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
7481 we're not attempting to use an indexer. Fixes #52154.
7483 2004-04-27 Martin Baulig <martin@ximian.com>
7485 * statement.cs (Return): Don't create a return label if we don't
7486 need it; reverts my change from January 20th. Thanks to Ben
7489 2004-04-27 Martin Baulig <martin@ximian.com>
7491 According to the spec, `goto' can only leave a nested scope, but
7494 * statement.cs (Block.LookupLabel): Only lookup in the current
7495 block, don't recurse into parent or child blocks.
7496 (Block.AddLabel): Check in parent and child blocks, report
7497 CS0140/CS0158 if we find a duplicate.
7498 (Block): Removed this indexer for label lookups.
7499 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
7500 this already does the error reporting for us.
7503 (FlowBranching.UsageVector.Block): New public variable; may be null.
7504 (FlowBranching.CreateSibling): Added `Block' argument.
7505 (FlowBranching.LookupLabel): New public virtual method. Lookup a
7506 label for the target of a `goto' and check whether we're not
7507 leaving a `finally'.
7509 2004-04-27 Martin Baulig <martin@ximian.com>
7511 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7512 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
7515 2004-04-27 Martin Baulig <martin@ximian.com>
7517 * statement.cs (Block.AddLabel): Also check for implicit blocks
7518 and added a CS0158 check.
7520 2004-04-27 Martin Baulig <martin@ximian.com>
7522 * flowanalysis.cs (FlowBranchingLoop): New class.
7523 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
7524 UsageVector's instead of an ArrayList.
7525 (FlowBranching.Label): Likewise.
7526 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
7527 (FlowBranching.AddBreakVector): New method.
7529 2004-04-27 Miguel de Icaza <miguel@ximian.com>
7531 * attribute.cs: Small regression fix: only convert the type if we
7532 the type is different, fixes System.Drawing build.
7534 2004-04-27 Martin Baulig <martin@ximian.com>
7536 * attribute.cs (Attribute.Resolve): If we have a constant value
7537 for a named field or property, implicity convert it to the correct
7540 2004-04-27 Raja R Harinath <rharinath@novell.com>
7542 * statement.cs (Block.Block): Implicit blocks share
7543 'child_variable_names' fields with parent blocks.
7544 (Block.AddChildVariableNames): Remove.
7545 (Block.AddVariable): Mark variable as "used by a child block" in
7546 every surrounding block.
7547 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
7548 been used in a child block, complain about violation of "Invariant
7549 meaning in blocks" rule.
7550 * cs-parser.jay (declare_local_variables): Don't use
7551 AddChildVariableNames.
7552 (foreach_statement): Don't create an implicit block: 'foreach'
7555 2004-04-23 Miguel de Icaza <miguel@ximian.com>
7557 * convert.cs (ImplicitNumericConversion): 0 is also positive when
7558 converting from 0L to ulong. Fixes 57522.
7560 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7562 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
7563 derived class hides via 'new' keyword field from base class (test-242.cs).
7564 TODO: Handle this in the more general way.
7566 * class.cs (CheckBase): Ditto.
7568 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7570 * decl.cs (caching_flags): New member for storing cached values
7572 (MemberCore.Flags): New enum where bit flags for caching_flags
7574 (MemberCore.cls_compliance): Moved to caching_flags.
7575 (DeclSpace.Created): Moved to caching_flags.
7577 * class.cs: Use caching_flags instead of DeclSpace.Created
7579 2004-04-21 Miguel de Icaza <miguel@ximian.com>
7581 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
7582 if we are only a derived class, not a nested class.
7584 * typemanager.cs: Same as above, but do this at the MemberLookup
7585 level (used by field and methods, properties are handled in
7586 PropertyExpr). Allow for the qualified access if we are a nested
7589 2004-04-21 Marek Safar <marek.safar@seznam.cz>
7591 * class.cs: Refactoring.
7592 (IMethodData): New inteface; Holds links to parent members
7593 to avoid member duplication (reduced memory allocation).
7594 (Method): Implemented IMethodData interface.
7595 (PropertyBase): New inner classes for get/set methods.
7596 (PropertyBase.PropertyMethod): Implemented IMethodData interface
7597 (Event): New inner classes for add/remove methods.
7598 (Event.DelegateMethod): Implemented IMethodData interface.
7600 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7601 EmitContext (related to class.cs refactoring).
7603 2004-04-21 Raja R Harinath <rharinath@novell.com>
7605 * delegate.cs (Delegate.VerifyApplicability): If the number of
7606 arguments are the same as the number of parameters, first try to
7607 verify applicability ignoring any 'params' modifier on the last
7611 2004-04-16 Raja R Harinath <rharinath@novell.com>
7613 * class.cs (TypeContainer.AddIndexer): Use
7614 'ExplicitInterfaceName' to determine if interface name was
7615 explicitly specified. 'InterfaceType' is not initialized at this time.
7616 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7617 Indexers array is already in the required order. Initialize
7618 'IndexerName' only if there are normal indexers.
7619 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7620 (TypeContainer.Emit): Emit DefaultMember attribute only if
7621 IndexerName is initialized.
7624 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7626 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7629 2004-04-15 Raja R Harinath <rharinath@novell.com>
7631 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7635 * attribute.cs (Attribute.Resolve): Check for duplicate named
7639 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7641 * iterators.cs (MarkYield): track whether we are in an exception,
7642 and generate code accordingly. Use a temporary value to store the
7643 result for our state.
7645 I had ignored a bit the interaction of try/catch with iterators
7646 since their behavior was not entirely obvious, but now it is
7647 possible to verify that our behavior is the same as MS .NET 2.0
7651 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7653 * iterators.cs: Avoid creating temporaries if there is no work to
7656 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7657 Enumerations, use TypeManager.EnumToUnderlying and call
7660 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7663 (This.Emit): Use EmitContext.EmitThis to emit our
7666 (This.EmitAssign): Ditto.
7668 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7669 codepaths, we will move all the functionality into
7672 (FieldExpr.EmitAssign): Ditto.
7674 This fixes several hidden bugs that I uncovered while doing a code
7675 review of this today.
7677 * codegen.cs (EmitThis): reworked so the semantics are more clear
7678 and also support value types "this" instances.
7680 * iterators.cs: Changed so that for iterators in value types, we
7681 do not pass the value type as a parameter.
7683 Initialization of the enumerator helpers is now done in the caller
7684 instead of passing the parameters to the constructors and having
7685 the constructor set the fields.
7687 The fields have now `assembly' visibility instead of private.
7689 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7691 * expression.cs (Argument.Resolve): Check if fields passed as ref
7692 or out are contained in a MarshalByRefObject.
7694 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7695 another compiler type.
7697 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7699 * class.cs (Indexer.Define): use the new name checking method.
7700 Also, return false on an error.
7701 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7702 (is_identifier_[start/part]_character): make static.
7704 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7706 * expression.cs (Binary.ResolveOperator): Do no append strings
7707 twice: since we can be invoked more than once (array evaluation)
7708 on the same concatenation, take care of this here. Based on a fix
7709 from Ben (bug #56454)
7711 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7713 * codegen.cs: Fix another case where CS1548 must be reported (when
7714 delay-sign isn't specified and no private is available #56564). Fix
7715 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7716 error when MCS is used on the MS runtime and we need to delay-sign
7717 (which seems unsupported by AssemblyBuilder - see #56621).
7719 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7721 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7722 (TypeManager.ComputeNamespaces): Faster implementation for
7725 * compiler.csproj: Updated AssemblyName to mcs.
7727 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7729 * rootcontext.cs: Add new types to the boot resolution.
7731 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7732 MulticastDelegate is not allowed.
7734 * typemanager.cs: Add new types to lookup: System.TypedReference
7737 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7738 check for TypedReference or ArgIterator, they are not allowed.
7740 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7741 makes us properly catch 1510 in some conditions (see bug 56016 for
7744 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7746 * CryptoConvert.cs: update from corlib version
7749 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7751 * class.cs (Indexer.Define): Check indexername declaration
7753 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7755 * attribute.cs (IsClsCompliant): Fixed problem with handling
7756 all three states (compliant, not-compliant, undetected).
7758 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7760 * attribute.cs (Attribute): Location is now public.
7761 (Resolve): Store resolved arguments (pos_values) in attribute class.
7762 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7763 (GetClsCompliantAttributeValue): New method that gets
7764 CLSCompliantAttribute value.
7765 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7766 if exists else null.
7767 (AttributeTester): New class for CLS-Compliant verification routines.
7769 * class.cs (Emit): Add CLS-Compliant verification.
7770 (Method.GetSignatureForError): Implemented.
7771 (Constructor.GetSignatureForError): Implemented
7772 (Constructor.HasCompliantArgs): Returns if constructor has
7773 CLS-Compliant arguments.
7774 (Constructor.Emit): Override.
7775 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7776 is needed to test only parameters.
7777 (FieldBase.GetSignatureForError): Implemented.
7778 (TypeContainer): New member for storing base interfaces.
7779 (TypeContainer.FindMembers): Search in base interfaces too.
7781 * codegen.cs (GetClsComplianceAttribute): New method that gets
7782 assembly or module CLSCompliantAttribute value.
7783 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7785 (ModuleClass.Emit): Add error 3012 test.
7787 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7789 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7790 state for all decl types.
7791 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7792 if CLS-Compliant tests are required.
7793 (IsClsCompliaceRequired): New method. Analyze whether code
7794 must be CLS-Compliant.
7795 (IsExposedFromAssembly): New method. Returns true when MemberCore
7796 is exposed from assembly.
7797 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7798 value or gets cached value.
7799 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7800 is explicitly marked with CLSCompliantAttribute.
7801 (IsIdentifierClsCompliant): New abstract method. This method is
7802 used to testing error 3005.
7803 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7804 for identifier and parameters CLS-Compliant testing.
7805 (VerifyClsCompliance): New method. The main virtual method for
7806 CLS-Compliant verifications.
7807 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7808 null. I don't know why is null (too many public members !).
7809 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7810 and get value of first CLSCompliantAttribute that found.
7812 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7813 (VerifyClsCompliance): Override and add extra tests.
7815 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7816 clscheck- disable CLS-Compliant verification event if assembly is has
7817 CLSCompliantAttribute(true).
7819 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7820 ApllyAttribute is now called in emit section as in the other cases.
7821 Possible future Emit integration.
7822 (IsIdentifierClsCompliant): New override.
7823 (VerifyClsCompliance): New override.
7824 (GetEnumeratorName): Returns full enum name.
7826 * parameter.cs (GetSignatureForError): Implemented.
7828 * report.cs (WarningData): New struct for Warning message information.
7829 (LocationOfPreviousError): New method.
7830 (Warning): New method. Reports warning based on the warning table.
7831 (Error_T): New method. Reports error based on the error table.
7833 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7834 verifications are done here.
7836 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7838 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7839 CLSCompliantAttribute.
7840 (all_imported_types): New member holds all imported types from other
7842 (LoadAllImportedTypes): New method fills static table with exported types
7843 from all referenced assemblies.
7844 (Modules): New property returns all assembly modules.
7846 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7848 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7849 throwing a parser error.
7851 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7852 which removes the hardcoded get_/set_ prefixes for properties, as
7853 IL allows for the properties to be named something else.
7857 * expression.cs: Do not override operand before we know if it is
7860 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7862 * typemanager.cs: support for pinned variables.
7864 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7866 * decl.cs, typemanager.cs: Avoid using an arraylist
7867 as a buffer if there is only one result set.
7869 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7871 * expression.cs: Make sure you cant call a static method
7872 with an instance expression, bug #56174.
7874 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7876 * class.cs (IsDuplicateImplementation): Improve error reporting to
7877 flag 663 (method only differs in parameter modifier).
7879 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7880 in preprocessor directives.
7882 * location.cs (LookupFile): Allow for the empty path.
7884 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7885 better approach for some of that patch, but its failing with the
7886 CharSet enumeration. For now try/catch will do.
7888 * typemanager.cs: Do not crash if a struct does not have fields.
7891 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7893 * expression.cs: cs0213, cant fix a fixed expression.
7896 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7898 * cs-parser.jay: detect invalid embeded statements gracefully.
7901 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7903 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7906 the invocation type may not be a subclass of the tye of the item/
7907 The type of the item must be a subclass of the invocation item.
7912 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7914 * attribute.cs: Added methods to get a string and a bool from an
7915 attribute. Required to information from AssemblyKeyFileAttribute,
7916 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7917 * codegen.cs: Modified AssemblyName creation to include support for
7918 strongnames. Catch additional exceptions to report them as CS1548.
7919 * compiler.csproj: Updated include CryptoConvert.cs.
7920 * compiler.csproj.user: Removed file - user specific configuration.
7921 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7922 Mono.Security assembly. The original class is maintained and tested in
7923 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7924 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7925 like CSC 8.0 (C# v2) supports.
7926 * Makefile: Added CryptoConvert.cs to mcs sources.
7927 * rootcontext.cs: Added new options for strongnames.
7929 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7931 * driver.cs: For --expect-error, report error code `2'
7932 if the program compiled with no errors, error code `1' if
7933 it compiled with an error other than the one expected.
7935 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7937 * compiler.csproj: Updated for Visual Studio .NET 2003.
7938 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7939 * compiler.sln: Updated for Visual Studio .NET 2003.
7941 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7943 * expression.cs: Fix bug #47234. We basically need to apply the
7944 rule that we prefer the conversion of null to a reference type
7945 when faced with a conversion to 'object' (csc behaviour).
7947 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7949 * statement.cs: Shorter form for foreach, eliminates
7950 a local variable. r=Martin.
7952 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7954 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7955 checks if we can use brtrue/brfalse to test for 0.
7956 * expression.cs: use the above in the test for using brtrue/brfalse.
7959 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7961 * expression.cs: Rewrite string concat stuff. Benefits:
7963 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7964 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7965 rather than a concat chain.
7967 * typemanager.cs: Add lookups for more concat overloads.
7969 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7971 * expression.cs: Emit shorter il code for array init.
7988 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
7990 * statement.cs: Before, two switch blocks would be merged if the
7991 total size of the blocks (end_item - begin_item + 1) was less than
7992 two times the combined sizes of the blocks.
7994 Now, it will only merge if after the merge at least half of the
7999 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
8001 * class.cs : csc build fix for GetMethods(). See bug #52503.
8003 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
8005 * expression.cs: Make sure fp comparisons work with NaN.
8006 This fixes bug #54303. Mig approved this patch a long
8007 time ago, but we were not able to test b/c the runtime
8010 2004-03-19 Miguel de Icaza <miguel@ximian.com>
8012 * ecore.cs (TypExpr.GetHashCode): implement this overload.
8014 2004-03-19 Martin Baulig <martin@ximian.com>
8016 * class.cs (MemberCore.IsDuplicateImplementation): Report the
8017 error here and not in our caller.
8019 2004-03-19 Martin Baulig <martin@ximian.com>
8021 * interface.cs: Completely killed this file.
8022 (Interface): We're now a TypeContainer and live in class.cs.
8024 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
8025 argument; we're now also called for interfaces.
8026 (TypeContainer.DefineMembers): Allow this method being called
8028 (TypeContainer.GetMethods): New public method; formerly known as
8029 Interface.GetMethod(). This is used by PendingImplementation.
8030 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
8031 it's now private and non-static.
8032 (Interface): Moved this here; it's now implemented similar to
8034 (Method, Property, Event, Indexer): Added `bool is_interface'
8035 argument to their .ctor's.
8036 (MemberBase.IsInterface): New public field.
8038 * cs-parser.jay: Create normal Method, Property, Event, Indexer
8039 instances instead of InterfaceMethod, InterfaceProperty, etc.
8040 (opt_interface_base): Removed; we now use `opt_class_base' instead.
8041 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
8043 2004-03-19 Martin Baulig <martin@ximian.com>
8045 * class.cs (MethodCore.IsDuplicateImplementation): New private
8046 method which does the CS0111 checking.
8047 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
8048 Use IsDuplicateImplementation().
8050 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
8052 * decl.cs (FindMemberToOverride): New method to find the correct
8053 method or property to override in the base class.
8055 - Make Method/Property use the above method to find the
8056 version in the base class.
8057 - Remove the InheritableMemberSignatureCompare as it is now
8060 This patch makes large code bases much faster to compile, as it is
8061 O(n) rather than O(n^2) to do this validation.
8063 Also, it fixes bug 52458 which is that nested classes are not
8064 taken into account when finding the base class member.
8066 Reviewed/Approved by Martin.
8068 2004-03-17 Marek Safar <marek.safar@seznam.cz>
8070 * interface.cs: In all interface classes removed redundant
8071 member initialization.
8073 2004-03-16 Martin Baulig <martin@ximian.com>
8075 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
8077 2004-03-15 Miguel de Icaza <miguel@ximian.com>
8079 * decl.cs (DefineTypeAndParents): New helper method to define a
8080 type's containers before the type itself is defined; This is a
8081 bug exposed by the recent changes to Windows.Forms when an
8082 implemented interface was defined inside a class that had not been
8085 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
8087 (Check): Loop correctly to report errors modifiers
8088 (UNSAFE was not in the loop, since it was the same as TOP).
8090 * interface.cs: Every interface member now takes a ModFlags,
8091 instead of a "is_new" bool, which we set on the base MemberCore.
8093 Every place where we called "UnsafeOk" in the interface, now we
8094 call the proper member (InterfaceMethod.UnsafeOK) instead to get
8095 the unsafe settings from the member declaration instead of the
8096 container interface.
8098 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
8100 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
8101 `set_indexer_name' to the pending bits (one per type).
8103 We fixed a bug today that was picking the wrong method to
8104 override, since for properties the existing InterfaceMethod code
8105 basically ignored the method name. Now we make sure that the
8106 method name is one of the valid indexer names.
8108 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
8110 * support.cs (SeekableStreamReader): Keep track of stream byte
8111 positions and don't mix them with character offsets to the buffer.
8113 Patch from Gustavo Giráldez
8115 2004-03-15 Marek Safar <marek.safar@seznam.cz>
8117 * interface.cs (InterfaceSetGetBase): Removed double member
8118 initialization, base class does it as well.
8120 2004-03-13 Martin Baulig <martin@ximian.com>
8122 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
8123 when compiling corlib.
8125 2004-03-13 Miguel de Icaza <miguel@ximian.com>
8127 * convert.cs (ExplicitConversion): We were reporting an error on
8128 certain conversions (object_type source to a value type, when the
8129 expression was `null') before we had a chance to pass it through
8130 the user defined conversions.
8132 * driver.cs: Replace / and \ in resource specifications to dots.
8135 * class.cs: Add check for duplicate operators. Fixes 52477
8137 2004-03-11 Miguel de Icaza <miguel@ximian.com>
8139 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
8140 that are in the middle of the statements, not only at the end.
8143 * class.cs (TypeContainer.AddField): No longer set the
8144 `HaveStaticConstructor' flag, now we call it
8145 `UserDefineStaticConstructor' to diferentiate the slightly
8146 semantic difference.
8148 The situation is that we were not adding BeforeFieldInit (from
8149 Modifiers.TypeAttr) to classes that could have it.
8150 BeforeFieldInit should be set to classes that have no static
8155 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
8157 And most importantly Zoltan's comment:
8159 http://bugzilla.ximian.com/show_bug.cgi?id=44229
8161 "I think beforefieldinit means 'it's ok to initialize the type sometime
8162 before its static fields are used', i.e. initialization does not need
8163 to be triggered by the first access to the type. Setting this flag
8164 helps the JIT to compile better code, since it can run the static
8165 constructor at JIT time, and does not need to generate code to call it
8166 (possibly lots of times) at runtime. Unfortunately, mcs does not set
8167 this flag for lots of classes like String.
8169 csc sets this flag if the type does not have an explicit static
8170 constructor. The reasoning seems to be that if there are only static
8171 initalizers for a type, and no static constructor, then the programmer
8172 does not care when this initialization happens, so beforefieldinit
8175 This bug prevents the AOT compiler from being usable, since it
8176 generates so many calls to mono_runtime_class_init that the AOT code
8177 is much slower than the JITted code. The JITted code is faster,
8178 because it does not generate these calls if the vtable is type is
8179 already initialized, which is true in the majority of cases. But the
8180 AOT compiler can't do this."
8182 2004-03-10 Miguel de Icaza <miguel@ximian.com>
8184 * class.cs (MethodData.Emit): Refactor the code so symbolic
8185 information is generated for destructors; For some reasons we
8186 were taking a code path that did not generate symbolic information
8189 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
8191 * class.cs: Create a Constructor.CheckBase method that
8192 takes care of all validation type code. The method
8193 contains some code that was moved from Define.
8195 It also includes new code that checks for duplicate ctors.
8196 This fixes bug #55148.
8198 2004-03-09 Joshua Tauberer <tauberer@for.net>
8200 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
8201 a { ... }-style array creation invokes EmitStaticInitializers
8202 which is not good for reference-type arrays. String, decimal
8203 and now null constants (NullCast) are not counted toward
8204 static initializers.
8206 2004-03-05 Martin Baulig <martin@ximian.com>
8208 * location.cs (SourceFile.HasLineDirective): New public field;
8209 specifies whether the file contains or is referenced by a "#line"
8211 (Location.DefineSymbolDocuments): Ignore source files which
8212 either contain or are referenced by a "#line" directive.
8214 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
8216 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
8217 direct access to our parent, so check the method inline there.
8219 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
8221 * expression.cs (Invocation.EmitCall): Miguel's last commit
8222 caused a regression. If you had:
8227 In Foo the implict this would be null.
8229 2004-02-27 Miguel de Icaza <miguel@ximian.com>
8231 * expression.cs (Invocation.EmitCall): If the method is not
8232 virtual, do not emit a CallVirt to it, use Call.
8234 * typemanager.cs (GetFullNameSignature): Improve the method to
8235 cope with ".ctor" and replace it with the type name.
8237 * class.cs (ConstructorInitializer.Resolve): Now the method takes
8238 as an argument the ConstructorBuilder where it is being defined,
8239 to catch the recursive constructor invocations.
8241 2004-02-26 Miguel de Icaza <miguel@ximian.com>
8243 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
8244 routines to check if a type is an enumerable/enumerator allow
8245 classes that implement the IEnumerable or IEnumerator interfaces.
8247 * class.cs (Property, Operator): Implement IIteratorContainer, and
8248 implement SetYields.
8250 (Property.Define): Do the block swapping for get_methods in the
8251 context of iterators. We need to check if Properties also
8252 include indexers or not.
8254 (Operator): Assign the Block before invoking the
8255 OperatorMethod.Define, so we can trigger the Iterator code
8258 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
8259 Property and Operator classes are not created when we parse the
8260 declarator but until we have the block completed, so we use a
8261 singleton SimpleIteratorContainer.Simple to flag whether the
8262 SetYields has been invoked.
8264 We propagate this setting then to the Property or the Operator to
8265 allow the `yield' to function.
8267 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8269 * codegen.cs: Implemented attribute support for modules.
8270 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8271 Assembly/Module functionality.
8273 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8274 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8275 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8277 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8279 * interface.cs (FindMembers): The operation is performed on all base
8280 interfaces and not only on the first. It is required for future CLS Compliance patch.
8282 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8284 * statement.cs, codegen.cs:
8285 This patch deals with patterns such as:
8287 public class List : IEnumerable {
8289 public MyEnumerator GetEnumerator () {
8290 return new MyEnumerator(this);
8293 IEnumerator IEnumerable.GetEnumerator () {
8297 public struct MyEnumerator : IEnumerator {
8302 Before, there were a few things we did wrong:
8303 1) we would emit callvirt on a struct, which is illegal
8304 2) we emited ldarg when we needed to emit ldarga
8305 3) we would mistakenly call the interface methods on an enumerator
8306 type that derived from IEnumerator and was in another assembly. For example:
8308 public class MyEnumerator : IEnumerator
8310 Would have the interface methods called, even if there were public impls of the
8311 method. In a struct, this lead to invalid IL code.
8313 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8315 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8318 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8320 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8322 * cs-parser.jay: Fix small regression: we were not testing V2
8323 compiler features correctly.
8325 * interface.cs: If the emit context is null, then create one
8327 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8329 * decl.cs (GetSignatureForError): New virtual method to get full name
8332 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8333 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8335 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8336 Duplicated members and code in these classes has been removed.
8337 Better encapsulation in these classes.
8339 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8341 * assign.cs (Assign.DoResolve): When dealing with compound
8342 assignments, there is a new rule in ECMA C# 2.4 (might have been
8343 there before, but it is documented here) that states that in:
8347 If b is of type int, and the `op' is a shift-operator, then the
8348 above is evaluated as:
8352 * expression.cs (Binary.ResolveOperator): Instead of testing for
8353 int/uint/long/ulong, try to implicitly convert to any of those
8354 types and use that in pointer arithmetic.
8356 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8357 method to print information for from the type, not from the
8358 null-method we were given.
8360 2004-02-01 Duncan Mak <duncan@ximian.com>
8362 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8363 parsing for cmd, fixes bug #53694.
8365 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8367 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8368 in the member name duplication tests. Property and operator name duplication
8369 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8371 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8373 * interface.cs (PopulateMethod): Fixed crash when interface method
8374 returns not existing type (error test cs0246-3.cs).
8376 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8378 * cs-parser.jay (interface_accessors): Re-write actions to also
8379 store attributes attached to get and set methods. Fix spelling
8382 (inteface_property_declaration): Modify accordingly.
8384 (InterfaceAccessorInfo): New helper class to store information to pass
8385 around between rules that use interface_accessors.
8387 * interface.cs (Emit): Apply attributes on the get and set
8388 accessors of properties and indexers too.
8390 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8391 right MethodBuilder when applying attributes to the get and set accessors.
8393 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8395 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8397 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8399 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8401 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8403 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8404 changes that treat `yield' specially when present before `break'
8407 * cs-tokenizer.cs: yield is no longer a keyword.
8409 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8411 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8412 setting for default constructors.
8413 For default constructors are almost every time set wrong Modifier. The
8414 generated IL code has been alright. But inside mcs this values was
8415 wrong and this was reason why several of my CLS Compliance tests
8418 2004-01-22 Martin Baulig <martin@ximian.com>
8420 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8421 not a QualifiedIdentifier. This is what `type_name_expression'
8422 was previously doing.
8423 (type_name_expression): Removed; the code is now in
8424 `namespace_or_type_name'.
8425 (qualified_identifier): Removed, use `namespace_or_type_name'
8427 (QualifiedIdentifier): Removed this class.
8429 2004-01-22 Martin Baulig <martin@ximian.com>
8431 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8432 not a string as alias name.
8434 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8436 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8437 #52730 bug, and instead compute correctly the need to use a
8438 temporary variable when requesting an address based on the
8439 static/instace modified of the field and the constructor.
8441 2004-01-21 Martin Baulig <martin@ximian.com>
8443 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8444 class and namespace before looking up aliases. Fixes #52517.
8446 2004-01-21 Martin Baulig <martin@ximian.com>
8448 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8449 assinged in a 'try'; fixes exception4.cs.
8451 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8452 * class.cs : Implemented parameter-less constructor for TypeContainer
8454 * decl.cs: Attributes are now stored here. New property OptAttributes
8456 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8458 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8460 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8462 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8463 (CSharpSignature): New method for indexer and property signature.
8465 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8467 * pending.cs (IsVirtualFilter): Faster implementation.
8469 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8471 * typemanager.cs: Avoid inclusion of same assembly more than once.
8473 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8475 * cs-parser.jay: Fixed problem where the last assembly attribute
8476 has been applied also to following declaration (class, struct, etc.)
8478 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8480 * class.cs: Added error CS0538, CS0539 reporting.
8481 Fixed crash on Microsoft runtime when field type is void.
8483 * cs-parser.jay: Added error CS0537 reporting.
8485 * pending.cs: Added error CS0535 reporting.
8486 Improved error report for errors CS0536, CS0534.
8488 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8490 Merge a few bits from the Anonymous Method MCS tree.
8492 * statement.cs (ToplevelBlock): New class for toplevel methods,
8493 will hold anonymous methods, lifted variables.
8495 * cs-parser.jay: Create toplevel blocks for delegates and for
8496 regular blocks of code.
8498 2004-01-20 Martin Baulig <martin@ximian.com>
8500 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8501 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8502 and `NeedExplicitReturn'; added `IsLastStatement'.
8503 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8504 have a `ReturnLabel' or we're not unreachable.
8506 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8507 child's reachability; don't just override ours with it. Fixes
8508 #58058 (lluis's example).
8509 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8510 InFinally(), InLoop(), InSwitch() and
8511 BreakCrossesTryCatchBoundary() methods.
8513 * statement.cs (Return): Do all error checking in Resolve().
8514 Unless we are the last statement in a top-level block, always
8515 create a return label and jump to it.
8516 (Break, Continue): Do all error checking in Resolve(); also make
8517 sure we aren't leaving a `finally'.
8518 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8519 statement in a top-level block.
8520 (Block.Flags): Added `IsDestructor'.
8521 (Block.IsDestructor): New public property.
8523 2004-01-20 Martin Baulig <martin@ximian.com>
8525 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8527 2004-01-20 Martin Baulig <martin@ximian.com>
8529 * statement.cs (Statement.ResolveUnreachable): New public method.
8530 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8531 (Block.Resolve): Resolve unreachable statements.
8533 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8535 * expression.cs: We need to fix the case where we do
8536 not have a temp variable here.
8538 * assign.cs: Only expression compound assignments need
8539 temporary variables.
8541 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8543 * flowanalysis.cs: Reduce memory allocation in a few ways:
8544 - A block with no variables should not allocate a bit
8546 - A method with no out parameters does not need any tracking
8547 for assignment of the parameters, so we need not allocate
8550 public readonly Type[] VariableTypes;
8551 public readonly string[] VariableNames;
8552 Are redundant. The data is already stored in the variable
8553 map, so we need not allocate another array for it.
8554 - We need to add alot of checks for if (params | locals) == null
8555 due to the first two changes.
8557 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8559 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8560 implement IMemoryLocation, we store a copy on a local variable and
8561 take the address of it. Patch from Benjamin Jemlich
8563 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8564 to use a special "type_name_expression" rule which reduces the
8565 number of "QualifiedIdentifier" classes created, and instead
8566 directly creates MemberAccess expressions.
8568 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8570 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8571 that fixes #52853. Null literal assignment to ValueType
8573 * class.cs (MethodData.Emit): Instead of checking the name of the
8574 method to determine if its a destructor, create a new derived
8575 class from Method called Destructor, and test for that.
8577 * cs-parser.jay: Create a Destructor object instead of a Method.
8579 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8583 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8585 * expression.cs (Binary.ResolveOperator): Perform an implicit
8586 conversion from MethodGroups to their delegate types on the
8589 * delegate.cs: Introduce a new class DelegateCreation that is the
8590 base class for `NewDelegate' and `ImplicitDelegateCreation',
8591 factor some code in here.
8593 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8594 conversion from MethodGroups to compatible delegate types.
8596 * ecore.cs (Expression.Resolve): Do not flag error 654
8597 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8598 we allow conversions from MethodGroups to delegate types now.
8600 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8601 assignments in v2 either.
8603 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8605 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8606 static read-only fields in ctors.
8608 Applied patch from Benjamin Jemlich
8610 * expression.cs (UnaryMutator): Avoid leaking local variables.
8612 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8614 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8615 here to return true, as they can be used like this:
8619 Fixed 49836 and all the other dups
8621 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8623 * driver.cs: Implement /win32res and /win32icon.
8625 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8627 * cs-parser.jay: Add a rule to improve error handling for the
8628 common mistake of placing modifiers after the type.
8630 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8632 * cs-parser.jay (interface_event_declaration): Catch
8633 initialization of events on interfaces, and report cs0068
8635 * cs-parser.jay (interface_event_declaration): Catch
8636 initialization of events.
8638 * ecore.cs: Better report missing constructors.
8640 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8641 the error reporting done in the wrong place. Fix.
8643 * expression.cs (Binary.ResolveOperator): Catch the
8644 operator + (E x, E y) error earlier, and later allow for implicit
8645 conversions in operator +/- (E e, U x) from U to the underlying
8648 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8649 52596, if the container class is abstract, the default constructor
8650 is protected otherwise its public (before, we were always public).
8652 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8655 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8656 Jemlich that fixes bug #52597, MCS was generating invalid code for
8657 idisposable structs. Thanks to Ben for following up with this
8660 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8662 * driver.cs: Allow assemblies without code to be generated, fixes
8665 2004-01-07 Nick Drochak <ndrochak@gol.com>
8667 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8669 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8671 * cs-parser.jay: Add rules to improve error reporting if fields or
8672 methods are declared at the namespace level (error 116)
8674 * Add rules to catch event add/remove
8676 2004-01-04 David Sheldon <dave-mono@earth.li>
8678 * expression.cs: Added matching ")" to error message for
8681 2004-01-03 Todd Berman <tberman@gentoo.org>
8683 * ecore.cs, attribute.cs:
8684 Applying fix from #52429.
8686 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8688 * ecore.cs, expression.cs, statement.cs:
8689 Total rewrite of how we handle branching. We
8690 now handle complex boolean expressions with fewer
8691 jumps. As well if (x == 0) no longer emits a ceq.
8693 if (x is Foo) is much faster now, because we generate
8696 Overall, we get a pretty big improvement on our benchmark
8697 tests. The code we generate is smaller and more readable.
8699 I did a full two-stage bootstrap. The patch was reviewed
8700 by Martin and Miguel.
8702 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8704 * cs-parser.jay: Make primary_expression not take a QI.
8705 we dont need this because the member_access rule covers
8706 us here. So we replace the rule with just IDENTIFIER.
8708 This has two good effects. First, we remove a s/r conflict.
8709 Second, we allocate many fewer QualifiedIdentifier objects.
8711 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8713 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8714 set the correct information via SRE. This prevents
8715 hanging on the MS runtime. Fixes #29374.
8717 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8719 * convert.cs: correctly handle conversions to value types
8720 from Enum and ValueType as unboxing conversions.
8722 Fixes bug #52569. Patch by Benjamin Jemlich.
8724 2004-01-02 Ravi Pratap <ravi@ximian.com>
8726 * expression.cs (BetterConversion): Prefer int -> uint
8727 over int -> ulong (csc's behaviour). This fixed bug #52046.
8729 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8731 * decl.cs (MemberCache.FindMembers): now returns a
8734 * typemanager.cs: In general, go with with ^^.
8735 (CopyNewMethods): take an IList.
8736 (RealMemberLookup): Only allocate an arraylist
8737 if we copy from two sets of methods.
8739 This change basically does two things:
8740 1) Fewer array lists allocated due to CopyNewMethods.
8741 2) the explicit cast in MemberList costed ALOT.
8743 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8745 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8746 a hashtable to avoid needless string allocations when an identifier is
8747 used more than once (the common case).
8749 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8751 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8752 is broken, it will not return anything. So, we
8753 have to use the information we have in mcs to
8756 * typemanager.cs: Add a cache for GetInterfaces,
8757 since this will now be used more often (due to ^^)
8759 (GetExplicitInterfaces) New method that gets the
8760 declared, not effective, interfaces on a type
8761 builder (eg, if you have interface IFoo, interface
8762 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8765 This patch makes MCS able to bootstrap itself on
8768 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8770 * expression.cs: Remove the Nop's that Miguel put
8773 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8775 * report.cs, codegen.cs: Give the real stack trace to
8776 the error when an exception is thrown.
8778 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8780 * decl.cs: only allocate hashtables for ifaces if
8783 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8785 * expression.cs: fix the error from cs0121-2.cs
8786 (a parent interface has two child interfaces that
8787 have a function with the same name and 0 params
8788 and the function is called through the parent).
8790 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8792 * class.cs, rootcontext.cs, typmanager.cs: do not
8795 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8797 * codegen.cs: remove stack for the ec flow branching.
8798 It is already a linked list, so no need.
8800 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8802 * Makefile: Allow custom profiler here.
8804 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8806 * typemanager.cs (LookupType):
8807 - Use a static char [], because split takes
8808 a param array for args, so it was allocating
8810 - Do not store true in a hashtable, it boxes.
8812 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8814 * flowanalysis.cs: bytify common enums.
8816 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8818 * modifiers.cs: Add a new set of flags for the
8819 flags allowed on explicit interface impls.
8820 * cs-parser.jay: catch the use of modifiers in
8821 interfaces correctly.
8822 * class.cs: catch private void IFoo.Blah ().
8824 All related to bug #50572.
8826 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8828 * decl.cs: Rewrite the consistant accessability checking.
8829 Accessability is not linear, it must be implemented in
8830 a tableish way. Fixes #49704.
8832 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8834 * expression.cs: Handle negation in a checked context.
8835 We must use subtraction from zero. Fixes #38674.
8837 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8839 * class.cs: Ignore static void main in DLLs.
8840 * rootcontext.cs: Handle the target type here,
8841 since we are have to access it from class.cs
8842 * driver.cs: account for the above.
8844 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8846 * report.cs: Give line numbers and files if available.
8848 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8850 * driver.cs: Implement /addmodule.
8852 * typemanager.cs: Change 'modules' field so it now contains Modules not
8855 2003-12-20 Martin Baulig <martin@ximian.com>
8857 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8858 (FieldBase.IsAssigned): Removed this field.
8859 (FieldBase.SetAssigned): New public method.
8860 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8862 2003-12-20 Martin Baulig <martin@ximian.com>
8864 * expression.cs (LocalVariableReference.DoResolve): Don't set
8865 `vi.Used' if we're called from DoResolveLValue().
8867 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8868 returns the usage vector it just merged into the current one -
8869 pass this one to UsageWarning().
8870 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8871 of the `EmitContext', don't call this recursively on our children.
8873 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8875 * driver.cs: Implement /target:module.
8877 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8879 * support.cs (CharArrayHashtable): New helper class.
8881 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8882 char arrays, not strings, so we can avoid creating a string in
8883 consume_identifier if the identifier is a keyword.
8885 2003-12-16 Martin Baulig <martin@ximian.com>
8887 * statement.cs (LocalInfo.Assigned): Removed this property.
8888 (LocalInfo.Flags): Removed `Assigned'.
8889 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8890 and uses flow analysis.
8891 (Block.UsageWarning): Made this method private.
8892 (Block.Resolve): Call UsageWarning() if appropriate.
8894 * expression.cs (LocalVariableReference.DoResolve): Always set
8895 LocalInfo.Used here.
8897 2003-12-13 Martin Baulig <martin@ximian.com>
8899 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8900 any value here; we're now using flow analysis to figure out
8901 whether a statement/block returns a value.
8903 2003-12-13 Martin Baulig <martin@ximian.com>
8905 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8907 (FlowBranching.MergeFinally): Don't call
8908 `branching.CheckOutParameters()' here, this is called in
8910 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8911 when adding the `finally' vector.
8913 2003-12-13 Martin Baulig <martin@ximian.com>
8916 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8917 actually work and also fix #48962.
8919 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8921 * decl.cs: Do not check System.Object for nested types,
8922 since we know it does not have any. Big bang for buck:
8927 corlib: 17.99 seconds
8931 corlib: 17.39 seconds
8933 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8935 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8936 time we are returning 0 members, so we save alot here.
8938 2003-12-11 Martin Baulig <martin@ximian.com>
8940 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8941 `MergeChild()', also just take the `FlowBranching' as argument;
8942 call Merge() on it and return the result.
8943 (FlowBranching.Merge): We don't need to do anything if we just
8946 2003-12-11 Martin Baulig <martin@ximian.com>
8948 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8949 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8950 Maurer for this idea.
8952 2003-12-11 Martin Baulig <martin@ximian.com>
8954 * flowanalysis.cs (MergeResult): This class is now gone; we now
8955 use the `UsageVector' for this. The reason for this is that if a
8956 branching just has one sibling, we don't need to "merge" them at
8957 all - that's the next step to do.
8958 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8961 2003-12-11 Martin Baulig <martin@ximian.com>
8963 Reworked flow analyis and made it more precise and bug-free. The
8964 most important change is that we're now using a special `Reachability'
8965 class instead of having "magic" meanings of `FlowReturns'. I'll
8966 do some more cleanups and optimizations and also add some more
8967 documentation this week.
8969 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
8970 largely reworked this class.
8971 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
8972 the new `Reachability' class instead of having "magic" values here.
8973 (FlowBranching): We're now using an instance of `Reachability'
8974 instead of having separate `Returns', `Breaks' etc. fields.
8976 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
8977 based on flow analysis; ignore the return value of block.Emit ().
8979 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
8981 * driver.cs typemanager.cs: Find the mono extensions to corlib even
8982 if they are private.
8984 2003-12-09 Martin Baulig <martin@ximian.com>
8986 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
8987 call them directly on the UsageVector.
8989 2003-12-09 Martin Baulig <martin@ximian.com>
8991 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
8992 Changed return type from `FlowReturns' to `Reachability'.
8994 2003-12-09 Martin Baulig <martin@ximian.com>
8996 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
8997 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
8998 `Reachable' fields with a single `Reachability' one.
9000 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9002 * class.cs (FindMembers): Remove foreach's.
9015 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9020 This patch does a few things:
9021 1. EmptyStatement is now a singleton, so it is never reallocated.
9022 2. All blah is EmptyStatement constructs have been changed to
9023 blah == EmptyStatement.Value, which is much faster and valid
9024 now that EmptyStatement is a singleton.
9025 3. When resolving a block, rather than allocating a new array for
9026 the non-empty statements, empty statements are replaced with
9027 EmptyStatement.Value
9028 4. Some recursive functions have been made non-recursive.
9029 Mainly the performance impact is from (3), however (1) and (2) are needed for
9030 this to work. (4) does not make a big difference in normal situations, however
9031 it makes the profile look saner.
9036 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9037 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9038 Total memory allocated: 56397 KB
9041 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
9042 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
9043 Total memory allocated: 55666 KB
9045 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9047 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
9048 than the hashtable in a hashtable version
9050 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
9051 we always end up concating a string. This results in a huge perf
9052 loss, because many strings have to be tracked by the GC. In this
9053 patch, we first use a hashtable that works with two keys, so that
9054 the strings do not need to be concat'ed.
9065 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9067 * Makefile: Add a new target `do-time' that does a quick and simple
9068 profile, leaving easy to parse output.
9070 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
9072 * codegen.cs (Init): Create the dynamic assembly with
9073 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
9075 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
9077 * support.cs: Make the PtrHashtable use only one
9078 instance of its comparer.
9080 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
9082 * typemanager.cs: Fix lookup of GetNamespaces.
9084 2003-11-29 Miguel de Icaza <miguel@ximian.com>
9086 * expression.cs: Removed redundant line.
9088 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
9089 ArrayLists, use for loops with bounds.
9091 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
9094 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
9095 arraylists, use for loop with bounds.
9097 The above three changes give us a 0.071 second performance
9098 improvement out of 3.294 seconds down to 3.223. On my machine
9099 the above changes reduced the memory usage by 1,387 KB during
9102 * cs-parser.jay (QualifiedIdentifier): New class used to represent
9103 QualifiedIdentifiers. Before we created a new string through
9104 concatenation, and mostly later on, the result would be
9105 manipulated by DecomposeQI through string manipulation.
9107 This reduced the compiler memory usage for bootstrapping from
9108 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
9109 compile times in 0.05 seconds.
9111 2003-11-28 Dick Porter <dick@ximian.com>
9113 * support.cs: Do string compares with the Invariant culture.
9121 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
9122 the comparison is done with the Invariant culture.
9124 2003-11-27 Miguel de Icaza <miguel@ximian.com>
9126 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
9127 GetEnumerator method.
9129 (ProbeCollectionType): Iterate starting at the most specific type
9130 upwards looking for a GetEnumerator
9132 * expression.cs: Shift count can be up to 31 for int/uint and 63
9135 2003-11-26 Miguel de Icaza <miguel@ximian.com>
9137 * statement.cs (Block.LookupLabel): Also look for the label on the
9138 children blocks. Use a hash table to keep track of visited
9141 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
9142 we actually did transform the other operand, otherwise fall back
9143 to the common codepath that casts to long.
9145 * cs-tokenizer.cs: Use the same code pattern as the int case.
9146 Maybe I should do the parsing myself, and avoid depending on the
9147 Parse routines to get this done.
9149 2003-11-25 Miguel de Icaza <miguel@ximian.com>
9151 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9152 which fixes bug 51347. This time test it.
9154 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
9155 attributes for example can not tell the difference between these.
9156 The difference was only a syntax feature of the language.
9158 * attribute.cs: Apply attributes to delegates.
9160 * delegate.cs: Call the apply attributes method.
9162 2003-11-24 Miguel de Icaza <miguel@ximian.com>
9164 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
9165 comparing 0 vs Byte.MinValue, not the value
9167 (ImplicitConversionRequired): When reporting a conversion error,
9168 use error 31 to print out the constant error instead of the
9171 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9172 which fixes bug 51347.
9174 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9176 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9177 which fixes the -warnaserror command line option.
9179 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9181 * cfold.cs (DoNumericPromotions): During constant folding of
9182 additions on UIntConstant, special case intconstants with
9183 IntConstants like we do on the expression binary operator.
9185 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9187 * convert.cs (ImplicitReferenceConversion): We were missing a case
9188 (System.Enum are not value types or class types, so we need to
9189 classify them separatedly).
9191 * driver.cs: We do not support error 2007.
9193 2003-11-12 Jackson Harper <jackson@ximian.com>
9195 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9196 system directory. Also use the full file name so users can
9197 libraries names mscorlib-o-tron.dll in a non system dir.
9199 2003-11-10 Martin Baulig <martin@ximian.com>
9201 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9202 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9203 calling `ResolveType()' on them, directly assign their `Type'.
9205 2003-11-08 Martin Baulig <martin@ximian.com>
9207 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9208 return value and the `out parent' parameter.
9209 (TypeContainer.DefineType): Moved the CS0644 check into
9210 GetClassBases(). Don't pass the interface types to the
9211 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9212 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9214 * ecore.cs (TypeExpr.IsAttribute): New property.
9215 (TypeExpr.GetInterfaces): New method.
9217 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9218 TypeExpr instead of a Type.
9219 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9220 (Interface.DefineType): Don't pass the interface types to the
9221 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9222 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9224 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9225 instead of a `Type[]'.
9226 (TypeManager.RegisterBuilder): Likewise.
9227 (TypeManager.AddUserInterface): Likewise.
9228 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9229 `Type[]' and also return a `TypeExpr[]'.
9230 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9232 2003-11-08 Martin Baulig <martin@ximian.com>
9234 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9237 2003-11-08 Martin Baulig <martin@ximian.com>
9239 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9240 TypeManager.ResolveExpressionTypes().
9242 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9243 instead of an Expression.
9244 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9245 (TypeExpression): New public class; formerly known as `TypeExpr'.
9247 * expression.cs (ComposedCast): Derive from TypeExpr.
9249 * typemanager.cs (TypeManager.system_*_expr): These are now
9250 TypExpr's instead of Expression's.
9251 (TypeManager.ResolveExpressionTypes): New public static function;
9252 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9255 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9257 * expression.cs (New.DoResolve): Do not dereference value that
9258 might be a null return.
9260 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9261 sure that the constant value has the right type. Fixes an
9262 unreported bug, similar to 50425.
9264 * const.cs (Const.LookupConstantValue): Call
9265 ImplicitStandardConversionExists before doing a conversion to
9266 avoid havng the TypeManager.ChangeType do conversions.
9268 Reduced the number of casts used
9270 (Const.ChangeType): New routine to enable reuse of the constant
9271 type changing code from statement.
9273 * typemanager.cs (ChangeType): Move common initialization to
9274 static global variables.
9278 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9279 every value type to go through, even if it was void. Fix that.
9281 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9282 character of the define, and the is_identifier_part_character for
9283 the rest of the string.
9285 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9287 * expression.cs (UnaryMutator.EmitCode): When I updated
9288 LocalVariableReference.DoResolve, I overdid it, and dropped an
9289 optimization done on local variable references.
9291 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9293 * ecore.cs: Convert the return from Ldlen into an int.
9295 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9297 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9298 the accessibility, this is a special case for toplevel non-public
9299 classes (internal for instance).
9301 2003-10-20 Nick Drochak <ndrochak@gol.com>
9303 * ecore.cs: Fix typo and build. Needed another right paren.
9305 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9307 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9308 `internal' case regular and protected, but not allowing protected
9309 to be evaluated later. Bug 49840
9311 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9313 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9314 to kb.Nlast, and not the kb.nFirst to isolate the switch
9317 Extract the underlying type, so enumerations of long/ulong are
9318 treated like long/ulong.
9320 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9322 * expression.cs (New): Overload the meaning of RequestedType to
9323 track the possible creation of the NewDelegate type, since
9324 DoResolve is invoked more than once for new constructors on field
9327 See bugs: #48800 and #37014
9329 * cs-parser.jay (declare_local_constants): Take an arraylist
9330 instead of a single constant.
9332 (local_constant_declaration): It should take a
9333 constant_declarators, not a constant_declarator. Fixes 49487
9335 * convert.cs: Fix error report.
9337 2003-10-13 Jackson Harper <jackson@ximian.com>
9339 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9342 2003-10-09 Martin Baulig <martin@ximian.com>
9344 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9346 (MethodCore.DoDefineParameters): Removed the TypeContainer
9347 argument; use the DeclSpace which was passed to the .ctor instead.
9348 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9349 TypeContainer; we only need a DeclSpace here.
9351 2003-10-09 Martin Baulig <martin@ximian.com>
9353 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9355 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9356 EmitContext's .ctor.
9358 2003-10-09 Martin Baulig <martin@ximian.com>
9360 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9361 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9362 AsAccessible(), moved them as well.
9364 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9366 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9368 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9370 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9372 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9373 generation for >=, as spotted by Paolo, bug 48679.
9374 Patch from David Waite.
9376 * cs-tokenizer.cs: Add handling for #pragma.
9378 * cs-parser.jay: Allow for both yield and yield return in the
9379 syntax. The anti-cobolization of C# fight will go on!
9381 * class.cs (TypeBuilder.DefineType): Catch error condition here
9382 (Parent.DefineType erroring out and returning null).
9384 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9385 coping with enumerations variables, we were mistakenly processing
9386 them as a regular value type instead of built-in types. Fixes the
9389 * typemanager.cs (IsBuiltinOrEnum): New method.
9391 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9393 * cs-parser.jay: Upgrade: yield now needs the return clause.
9395 2003-09-19 Martin Baulig <martin@ximian.com>
9397 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9398 `MemberCache parent' argument. Normally, an interface doesn't
9399 have a parent type except System.Object, but we use this in gmcs
9400 for generic type parameters.
9402 2003-09-18 Martin Baulig <martin@ximian.com>
9404 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9405 on `type.IsInterface'; don't check whether the type has a parent
9406 to determine whether it's an interface.
9408 2003-09-15 Martin Baulig <martin@ximian.com>
9410 * class.cs (TypeContainer.DefineType): Added an error flag to
9411 avoid reporting duplicate CS0146's ("class definition is
9414 * driver.cs (Driver.MainDriver): Abort if
9415 RootContext.ResolveTree() reported any errors.
9417 2003-09-07 Martin Baulig <martin@ximian.com>
9419 * report.cs (Error, Warning): Added overloaded versions which take
9420 a `params object[] args' and call String.Format().
9422 2003-09-07 Martin Baulig <martin@ximian.com>
9424 * decl.cs (DeclSpace..ctor): Don't call
9425 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9426 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9427 (DeclSpace.RecordDecl): New method.
9429 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9431 2003-09-02 Ravi Pratap <ravi@ximian.com>
9433 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9434 value attributes to be applied to ParameterBuilders.
9436 * class.cs (MethodCore.LabelParameters): Make static and more
9437 generic so that it can be used from other places - like interface
9438 methods, for instance.
9440 * interface.cs (Interface.Emit): Call LabelParameters before
9441 emitting attributes on the InterfaceMethod.
9443 2003-08-26 Martin Baulig <martin@ximian.com>
9445 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9446 resolving aliases; fixes #47927.
9448 2003-08-26 Martin Baulig <martin@ximian.com>
9450 * statement.cs (Using.DoResolve): This is internally emitting a
9451 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9452 do not always return. Fixes #47681.
9454 2003-08-26 Martin Baulig <martin@ximian.com>
9456 * decl.cs (MemberCore): Moved WarningNotHiding(),
9457 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9459 (AdditionResult): Make this nested in DeclSpace.
9460 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9461 argument; call NamespaceEntry.Define() unless we're nested in a
9464 * namespace.cs (Namespace.DefineName): New public function. This
9465 is called from DeclSpace's .ctor to add
9466 (Namespace.Lookup): Include DeclSpaces in the lookup.
9468 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9470 * const.cs (Const): Derive from MemberBase, not MemberCore.
9472 2003-08-25 Martin Baulig <martin@ximian.com>
9474 * convert.cs (Convert.ExplicitReferenceConversion): When
9475 converting from an interface type to a class, unbox if the target
9476 type is a struct type. Fixes #47822.
9478 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9480 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9483 2003-08-22 Martin Baulig <martin@ximian.com>
9485 * class.cs (TypeManager.DefineType): When defining a nested type,
9486 call DefineType() on our parent; fixes #47801.
9488 2003-08-22 Martin Baulig <martin@ximian.com>
9490 * class.cs (MethodData.Define): While checking if a method is an
9491 interface implementation, improve the test a bit more to fix #47654.
9493 2003-08-22 Martin Baulig <martin@ximian.com>
9495 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9496 correctly; fixes #47722.
9498 2003-08-22 Martin Baulig <martin@ximian.com>
9500 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9501 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9503 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9505 2003-08-22 Martin Baulig <martin@ximian.com>
9507 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9508 can only be assigned in static constructors. Fixes #47161.
9510 2003-08-22 Martin Baulig <martin@ximian.com>
9512 Rewrote and improved the flow analysis code.
9514 * flowbranching.cs (FlowBranching): Make this class abstract.
9515 (FlowBranching.CreateBranching): New static function to create a
9517 (FlowBranchingBlock, FlowBranchingException): New classes.
9518 (FlowBranching.UsageVector.Type): New public readonly field.
9519 (FlowBranching.UsageVector.Breaks): Removed the setter.
9520 (FlowBranching.UsageVector.Returns): Removed the setter.
9521 (FlowBranching.UsageVector): Added Break(), Return(),
9522 NeverReachable() and Throw() methods to modify the reachability.
9523 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9524 done by FlowBranching.Merge().
9525 (FlowBranching.UsageVector.MergeChild): New method; merges the
9526 merge result into the current vector.
9527 (FlowBranching.Merge): New abstract method to merge a branching.
9529 2003-08-12 Martin Baulig <martin@ximian.com>
9531 * expression.cs (Indirection.CacheTemporaries): Create the
9532 LocalTemporary with the pointer type, not its element type.
9534 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9536 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9537 token was a keyword or not.
9539 Add `error' options where an IDENTIFIER was expected; Provide
9540 CheckToken and CheckIdentifierToken convenience error reporting
9543 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9545 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9546 NameSpaceEntry NameSpaceEntry.
9548 (LookupInterfaceOrClass): Avoid creating a full qualified name
9549 from namespace and name: avoid doing lookups when we know the
9550 namespace is non-existant. Use new Tree.LookupByNamespace which
9551 looks up DeclSpaces based on their namespace, name pair.
9553 * driver.cs: Provide a new `parser verbose' to display the
9554 exception thrown during parsing. This is turned off by default
9555 now, so the output of a failure from mcs is more graceful.
9557 * namespace.cs: Track all the namespaces defined in a hashtable
9560 (IsNamespace): New method
9562 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9564 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9565 we know that we need to concatenate (full typename can never be
9570 * statement.cs: Use a bitfield; Do not initialize to null things
9571 which are done by the constructor by default.
9573 * cs-parser.jay: bug fix, parameter was 4, not 3.
9575 * expression.cs: Just use the property;
9577 * statement.cs: No need for GetVariableInfo method.
9579 2003-08-08 Martin Baulig <martin@ximian.com>
9581 * flowanalysis.cs (FlowReturns): This is now nested in the
9582 `FlowBranching' class.
9583 (MyBitVector): Moved this here from statement.cs.
9584 (FlowBranching.SiblingType): New enum type.
9585 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9587 2003-08-07 Martin Baulig <martin@ximian.com>
9589 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9590 `FlowBranching' class and called `BranchingType'.
9592 2003-08-07 Martin Baulig <martin@ximian.com>
9594 * flowanalysis.cs: Moved all the control flow analysis code into
9597 2003-08-07 Martin Baulig <martin@ximian.com>
9599 * assign.cs (Assign.DoResolve): `target' must either be an
9600 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9603 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9605 * expression.cs (BinaryMethod): This kind of expression is created by the
9606 Binary class if it determines that the operator has to be handled
9609 (BinaryDelegate): This kind of expression is created if we are
9610 dealing with a + or - operator on delegates.
9612 (Binary): remove method, argumetns, and DelegateOperator: when
9613 dealing with methods,
9615 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9617 * statement.cs (Block): use bitfields for the three extra booleans
9618 we had in use. Remove unused topblock parameter.
9620 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9622 * assign.cs: Drop extra unneeded tests.
9624 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9626 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9628 * statement.cs (Foreach): Use VariableStorage instead of
9631 * codegen.cs (VariableStorage): New class used by clients that
9632 require a variable stored: locals or fields for variables that
9633 need to live across yield.
9635 Maybe provide a convenience api for EmitThis+EmitLoad?
9637 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9640 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9642 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9643 RemapParameterLValue): New methods that are used to turn a
9644 precomputed FieldInfo into an expression like this:
9648 The idea is to use this instead of making LocalVariableReference
9649 have more than one meaning.
9651 * cs-parser.jay: Add error production to BASE.
9653 * ecore.cs: Deal with TypeManager.GetField returning null, which
9654 is now a valid return value.
9656 (FieldExprNoAddress): New expression for Fields whose address can
9659 * expression.cs (LocalVariableReference): During the resolve
9660 phases, create new expressions if we are in a remapping context.
9661 Remove code that dealt with remapping here.
9663 (ParameterReference): same.
9665 (ProxyInstance): New expression, like the `This' expression, but
9666 it is born fully resolved. We know what we are doing, so remove
9667 the errors that are targeted to user-provided uses of `this'.
9669 * statement.cs (Foreach): our variable is now stored as an
9670 Expression; During resolution, follow the protocol, dont just
9671 assume it will return this.
9673 2003-08-06 Martin Baulig <martin@ximian.com>
9675 * support.cs (SeekableStreamReader.cs): New public class.
9677 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9678 SeekableStreamReader instead of the normal StreamReader.
9680 2003-08-04 Martin Baulig <martin@ximian.com>
9682 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9683 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9684 deambiguate casts and delegate invocations.
9685 (parenthesized_expression): Use the new tokens to ensure this is
9686 not a cast of method invocation.
9688 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9689 when reading a `)' and Deambiguate_CloseParens () was previously
9692 * expression.cs (ParenthesizedExpression): New class. This is
9693 just used for the CS0075 test.
9694 (Binary.DoResolve): Check for CS0075.
9696 2003-07-29 Ravi Pratap <ravi@ximian.com>
9698 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9699 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9700 reference comparison.
9702 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9703 examine the ReturnType for equality - this is necessary in the
9704 cases of implicit and explicit operators whose signature also
9705 includes the return type.
9707 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9709 * namespace.cs: Cache the result of the namespace computation,
9710 instead of computing it every time.
9712 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9714 * decl.cs: Use a global arraylist that we reuse over invocations
9715 to avoid excesive memory consumption. Reduces memory usage on an
9716 mcs compile by one meg (45 average).
9718 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9719 private, work around that.
9721 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9723 * literal.cs (IntLiteral): Define Zero and One static literals.
9725 * cs-parser.jay (integer_literal): use static literals to reduce
9726 memory usage for the most used literals (0, 1 and -1). 211kb
9727 reduced in memory usage.
9729 Replace all calls to `new ArrayList' with `new
9730 ArrayList(4)' which is a good average number for most allocations,
9731 and also requires only 16 bytes of memory for its buffer by
9734 This reduced MCS memory usage in seven megabytes for the RSS after
9737 2003-07-28 Ravi Pratap <ravi@ximian.com>
9739 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9740 handle params methods the correct way by forming only one
9741 applicable set with params and normal methods in them. Earlier we
9742 were looking at params methods only if we found no normal methods
9743 which was not the correct thing to do.
9745 (Invocation.BetterFunction): Take separate arguments indicating
9746 when candidate and the best method are params methods in their
9749 This fixes bugs #43367 and #46199.
9751 * attribute.cs: Documentation updates.
9753 (CheckAttribute): Rename to CheckAttributeTarget.
9754 (GetValidPlaces): Rename to GetValidTargets.
9756 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9757 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9761 2003-07-28 Martin Baulig <martin@ximian.com>
9763 * class.cs (TypeContainer.DefineMembers): Use the base type's full
9764 name when looking up the base class of a nested class. Fixes #46977.
9766 2003-07-26 Martin Baulig <martin@ximian.com>
9768 * expression.cs (Indexers.Indexer): New nested struct; contains
9769 getter, setter and the indexer's type.
9770 (Indexers.Properties): This is now an ArrayList of
9772 (IndexerAccess.DoResolveLValue): Correctly set the type if the
9773 indexer doesn't have any getters.
9775 * assign.cs (Assign.DoResolve): Also do the implicit conversions
9776 for embedded property and indexer assignments.
9778 2003-07-26 Martin Baulig <martin@ximian.com>
9780 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9781 preprocessor directive is not the first non-whitespace character
9784 2003-07-26 Martin Baulig <martin@ximian.com>
9786 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9787 namespace parsing, follow the spec more closely.
9789 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9790 NamespaceEntry.Lookup().
9792 2003-07-25 Martin Baulig <martin@ximian.com>
9794 * MethodCore.cs (OverridesSomething): New public field; it's set
9795 from TypeContainer.DefineMembers if this method overrides
9796 something (which doesn't need to be a method). Fix #39462.
9798 2003-07-25 Ravi Pratap <ravi@ximian.com>
9800 * typemanager.cs (GetMembers): Ensure that the list of members is
9801 reversed. This keeps things in sync.
9803 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9804 find an AttributeUsage attribute.
9806 * expression.cs (Invocation.OverloadResolve): Perform the check
9807 which disallows Invoke to be directly called on a Delegate.
9809 (Error_InvokeOnDelegate): Report error cs1533.
9811 2003-07-25 Martin Baulig <martin@ximian.com>
9813 * expression.cs (Indexers.GetIndexersForType): Only look in the
9814 interface hierarchy if the requested type is already an
9815 interface. Fixes #46788 while keeping #46502 fixed.
9817 2003-07-25 Martin Baulig <martin@ximian.com>
9819 * class.cs (TypeContainer.DefineMembers): Check whether all
9820 readonly fields have been assigned and report warning CS0649 if
9823 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9826 2003-07-24 Ravi Pratap <ravi@ximian.com>
9828 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9829 returned from GetMethods to make things consistent with the
9830 assumptions MCS makes about ordering of methods.
9832 This should comprehensively fix bug #45127 and it does :-)
9834 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9835 ordering is actually reverse.
9837 * Clean up some debug messages I left lying around.
9839 * interface.cs (Populate*): Get rid of code which emits attributes
9840 since the stage in which we emit attributes is the 'Emit' stage,
9841 not the define stage.
9843 (Emit): Move attribute emission for interface members here.
9845 2003-07-22 Ravi Pratap <ravi@ximian.com>
9847 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9848 closely: we eliminate methods in base types when we have an
9849 applicable method in a top-level type.
9851 Please see section 14.5.5.1 for an exact description of what goes
9854 This fixes bug #45127 and a host of other related to corlib compilation.
9856 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9857 array is the method corresponding to the top-level type (this is
9858 because of the changes made to icall.c) so we change this
9861 (MethodGroupExpr.Name): This too.
9863 * typemanager.cs (GetElementType): New method which does the right
9864 thing when compiling corlib.
9866 * everywhere: Make use of the above in the relevant places.
9868 2003-07-22 Martin Baulig <martin@ximian.com>
9870 * cs-parser.jay (invocation_expression): Moved
9871 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9872 `cast_expression', but create a InvocationOrCast which later
9873 resolves to either an Invocation or a Cast.
9875 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9876 method; call this before EmitStatement() to make sure that this
9877 expression can be used as a statement.
9879 * expression.cs (InvocationOrCast): New class; resolves to either
9880 an Invocation or a Cast.
9882 * statement.cs (StatementExpression): Call ResolveStatement() on
9883 the ExpressionStatement before emitting it.
9885 2003-07-21 Martin Baulig <martin@ximian.com>
9887 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9888 `ref' and `out' attributes match; fixes #46220.
9889 (MemberAccess.ResolveMemberAccess): You can't reference a type
9890 through an expression; fixes #33180.
9891 (Indexers.GetIndexersForType): Don't return the indexers from
9892 interfaces the class implements; fixes #46502.
9894 2003-07-21 Martin Baulig <martin@ximian.com>
9896 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9897 CS0661 checks; fixes bug #30442.
9899 2003-07-21 Martin Baulig <martin@ximian.com>
9901 * decl.cs (AdditionResult): Added `Error'.
9903 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9905 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9906 makes cs0031.cs actually work.
9908 2003-07-20 Martin Baulig <martin@ximian.com>
9910 * namespace.cs: Fixed that bug which caused a crash when compiling
9913 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9915 * typemanager.cs (LookupTypeReflection): Never expose types which
9916 are NotPublic, NestedPrivate, NestedAssembly, or
9917 NestedFamANDAssem. We used to return these, and later do a check
9918 that would report a meaningful error, but the problem is that we
9919 would not get the real match, if there was a name override.
9921 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9923 * namespace.cs (Namespace, Name): Do not compute the namespace
9924 name dynamically, compute it in the constructor. This reduced
9925 memory usage by 1697 KB.
9927 * driver.cs: Use --pause to pause at the end.
9929 2003-07-17 Peter Williams <peter@newton.cx>
9931 * Makefile: Change the name of the test target so that it doesn't
9932 conflict with the recursive test target.
9934 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9936 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9937 AddressOf): Do not use EmitThis, that was wrong, use the actual
9940 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9942 * class.cs (MethodData.Define): While checking if a method is an
9943 interface implementation, improve the test: If we are not public
9944 (use new test here: use the computed MethodAttributes directly,
9945 instead of the parsed modifier flags) check if the `implementing'
9946 method comes from an interface or not.
9948 * pending.cs (VerifyPendingMethods): Slightly better error
9951 * makefile: add test target that does the mcs bootstrap.
9953 2003-07-16 Ravi Pratap <ravi@ximian.com>
9955 * interface.cs (Define): Do nothing here since there are no
9956 members to populate etc. Move the attribute emission out of here
9957 since this was just totally the wrong place to put it. Attribute
9958 application happens during the 'Emit' phase, not in the 'Define'
9961 (Emit): Add this method and move the attribute emission here
9963 * rootcontext.cs (EmitCode): Call the Emit method on interface
9966 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9968 * expression.cs (OverloadResolve): Report error only if Location
9969 is not 'Null' which means that there was a probe going on.
9971 2003-07-14 Martin Baulig <martin@ximian.com>
9973 * expression.cs (ConditionalLogicalOperator): New public class to
9974 implement user defined conditional logical operators.
9975 This is section 14.11.2 in the spec and bug #40505.
9977 2003-07-14 Martin Baulig <martin@ximian.com>
9979 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
9981 2003-07-14 Martin Baulig <martin@ximian.com>
9983 * codegen.cs (EmitContext.InFixedInitializer): New public field.
9985 * ecore.cs (IVariable.VerifyFixed): New interface method.
9987 * expression.cs (Unary.ResolveOperator): When resolving the `&'
9988 operator, check whether the variable is actually fixed. Fixes bug
9989 #36055. Set a variable definitely assigned when taking its
9990 address as required by the spec.
9992 * statement.cs (LocalInfo.IsFixed): New field.
9993 (LocalInfo.MakePinned): Set `IsFixed' to true.
9995 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9997 * attribute.cs (Attribute.Resolve): While doing a Member lookup
9998 for .ctors, ensure that we only ask for members declared in the
9999 attribute type (BindingFlags.DeclaredOnly).
10003 * expression.cs (Error_WrongNumArguments): Report error 1501
10004 correctly the way CSC does.
10006 2003-07-13 Martin Baulig <martin@ximian.com>
10008 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
10009 lookup on the fully qualified name, to make things like "X.X" work
10010 where "X.X" is a fully qualified type name, but we also have a
10011 namespace "X" in the using list. Fixes #41975.
10013 2003-07-13 Martin Baulig <martin@ximian.com>
10015 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
10016 function. If we're a CompoundAssign, we need to create an embedded
10017 CompoundAssign, not an embedded Assign.
10018 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
10021 2003-07-13 Martin Baulig <martin@ximian.com>
10023 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
10024 work to fix bug #46088.
10026 2003-07-13 Ravi Pratap <ravi@ximian.com>
10028 * class.cs (Operator.Emit): Do not emit attributes here - it is
10029 taken care of by the Method class that we delegate too. This takes
10030 care of bug #45876.
10032 2003-07-10 Martin Baulig <martin@ximian.com>
10034 * expression.cs (TypeOfVoid): New class.
10035 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
10037 2003-07-10 Martin Baulig <martin@ximian.com>
10039 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
10042 2003-07-10 Martin Baulig <martin@ximian.com>
10044 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
10045 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
10047 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
10049 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
10051 2003-07-10 Martin Baulig <martin@ximian.com>
10053 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
10054 of decimal. Fixes #42850.
10056 NOTE: I also fixed the created byte blob, but this doesn't work on
10057 the MS runtime and csc never produces any byte blobs for decimal
10060 2003-07-10 Martin Baulig <martin@ximian.com>
10062 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
10063 structs; fixes #32068.
10064 (Block.AddChildVariableNames): Fixed #44302.
10066 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10068 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
10070 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10072 * attribute.cs: And this test is onger needed.
10074 2003-07-08 Martin Baulig <martin@ximian.com>
10076 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
10077 inaccessible types. Fixes #36313.
10079 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
10081 * namespace.cs (NamespaceEntry): Create implicit entries for all
10082 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
10083 implicit entries for N1.N2 and N1.
10085 2003-07-08 Martin Baulig <martin@ximian.com>
10087 Rewrote the handling of namespaces to fix a lot of the issues
10088 wrt. `using' aliases etc.
10090 * namespace.cs (Namespace): Splitted this class into a
10091 per-assembly `Namespace' and a per-file `NamespaceEntry'.
10093 * typemanager.cs (TypeManager.IsNamespace): Removed.
10094 (TypeManager.ComputeNamespaces): Only compute namespaces from
10095 loaded assemblies here, not the namespaces from the assembly we're
10096 currently compiling.
10098 2003-07-08 Martin Baulig <martin@ximian.com>
10100 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
10102 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10104 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
10107 I thought about the memory savings here, but LookupTypeReflection
10108 is used under already very constrained scenarios. Compiling
10109 corlib or mcs only exposes one hit, so it would not really reduce
10110 any memory consumption.
10112 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10114 * typemanager.cs: fixes bug #45889 by only adding public types from
10115 other assemblies to the list of known types.
10117 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10119 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10120 on the type we resolved.
10122 2003-07-05 Martin Baulig <martin@ximian.com>
10124 * pending.cs (PendingImplementation.ParentImplements): Don't
10125 create the proxy if the parent is abstract.
10127 * class.cs (TypeContainer.DefineIndexers): Process explicit
10128 interface implementations first. Fixes #37714.
10130 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10132 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10133 defined recursively; but since we modify the input parameters
10134 (left is set to `this' temporarily), we reset this value if the
10135 left_is_explicit is false, which gives the original semantics to
10138 * literal.cs (NullPointer): new class used to represent a null
10139 literal in a pointer context.
10141 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10142 type is a pointer, use a NullPointer object instead of a
10143 NullLiteral. Closes 43687
10145 (ExplicitConversion): Convert pointer values using
10146 the conv opcode to the proper type.
10148 * ecore.cs (New): change ValueTypeVariable property into a method,
10149 that returns whether the valuetype is suitable for being used.
10151 * expression.cs (Binary.DoNumericPromotions): Only return if we
10152 the int constant was a valid uint, and we can return both left and
10153 right as uints. If not, we continue processing, to trigger the
10154 type conversion. This fixes 39018.
10156 * statement.cs (Block.EmitMeta): During constant resolution, set
10157 the CurrentBlock property on the emitcontext, so that we resolve
10158 constants propertly.
10160 2003-07-02 Martin Baulig <martin@ximian.com>
10162 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10163 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10165 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10166 than emitting it here.
10168 * statement.cs: Fixed some more flow analysis bugs.
10170 2003-07-02 Martin Baulig <martin@ximian.com>
10172 * class.cs (MethodData.Define): When implementing interface
10173 methods, set Final unless we're Virtual.
10175 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10176 check work for interface methods.
10178 2003-07-01 Martin Baulig <martin@ximian.com>
10180 * ecore.cs (EmitContext.This): Replaced this property with a
10181 GetThis() method which takes a Location argument. This ensures
10182 that we get the correct error location for a CS0188.
10184 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10186 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10187 ImplicitStandardConversion.
10189 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10191 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10193 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10196 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10198 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10201 (MethodData.Define): Turn off initlocals for unsafe methods.
10203 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10205 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10206 complete; Fixes #37521.
10208 * delegate.cs: Use Modifiers.TypeAttr to compute the
10209 TypeAttributes, instead of rolling our own. This makes the flags
10210 correct for the delegates.
10212 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10214 * class.cs (Constructor.Define): Set the private flag for static
10215 constructors as well.
10217 * cs-parser.jay (statement_expression): Set the return value to
10218 null, to avoid a crash when we catch an error.
10220 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10222 * cs-parser.jay: Applied patch from Jackson that adds support for
10223 extern and unsafe modifiers to destructor declarations.
10225 * expression.cs: Report error 21 if the user is trying to index a
10228 * driver.cs: Add an error message, suggested by the bug report.
10230 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10231 if we do not have a ": this ()" constructor initializer. Fixes 45149
10233 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10235 * namespace.cs: Add some information to reduce FAQs.
10237 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10239 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10240 underlying enumeration types. Fixes #43915.
10242 * expression.cs: Treat ushort/short as legal values to be used in
10243 bitwise operations.
10245 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10247 * delegate.cs: transfer custom attributes for paramenters from
10248 the delegate declaration to Invoke and BeginInvoke.
10250 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10252 * attribute.cs: handle custom marshalers and emit marshal info
10255 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10257 * makefile.gnu: Added anonymous.cs to the compiler sources.
10259 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10261 * iterators.cs: Change the name of the proxy class to include two
10264 * cs-parser.jay: Update grammar to include anonymous methods.
10266 * anonymous.cs: new file.
10268 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10270 * class.cs (Field.Define): Add missing test for pointers and
10273 2003-05-27 Ravi Pratap <ravi@ximian.com>
10275 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10276 we use the stobj opcode.
10278 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10279 since it wasn't the correct fix.
10281 It still is puzzling that we are required to use stobj for IntPtr
10282 which seems to be a ValueType.
10284 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10286 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10287 during regular simple name resolution. Now, the trick is that
10288 instead of returning for processing the simplename, we do a
10289 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10290 contextual lookup type). If a match is found, return that, if
10291 not, return for further composition.
10293 This fixes long-standing 30485.
10295 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10296 using the address to initialize an object, do an Stobj instead of
10297 using the regular Stelem.
10299 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10300 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10301 Because if we are a BaseIndexerAccess that value will be true.
10304 * statement.cs (GotoCase.Resolve): Return after reporting an
10305 error, do not attempt to continue.
10307 * expression.cs (PointerArithmetic.Emit): If our operand is a
10308 long, convert our constants to match the operand before
10309 multiplying. Convert to I type before adding. Fixes 43670.
10311 2003-05-14 Ravi Pratap <ravi@ximian.com>
10313 * enum.cs (ImplicitConversionExists) : Rename to
10314 ImplicitEnumConversionExists to remove ambiguity.
10316 * ecore.cs (NullCast): New type of cast expression class which
10317 basically is very similar to EmptyCast with the difference being
10318 it still is a constant since it is used only to cast a null to
10320 (eg. (string) null)
10322 * convert.cs (ImplicitReferenceConversion): When casting a null
10323 literal, we return a NullCast.
10325 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10326 should be around anymore.
10328 The renaming (reported was slightly wrong). Corrections:
10330 ConvertImplicitStandard -> ImplicitConversionStandard
10331 ConvertExplicitStandard -> ExplicitConversionStandard
10333 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10334 before passing them in !
10336 * convert.cs (ImplicitConversionStandard): When comparing for
10337 equal expr and target types, ensure that expr is not a
10340 In general, we must not be checking (expr_type ==
10341 target_type) in the top level conversion methods
10342 (ImplicitConversion, ExplicitConversion etc). This checking is
10343 done in the methods that they delegate to.
10345 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10347 * convert.cs: Move Error_CannotConvertType,
10348 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10349 ImplicitNumericConversion, ImplicitConversionExists,
10350 ImplicitUserConversionExists, StandardConversionExists,
10351 FindMostEncompassedType, FindMostSpecificSource,
10352 FindMostSpecificTarget, ImplicitUserConversion,
10353 ExplicitUserConversion, GetConversionOperators,
10354 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10355 TryImplicitIntConversion, Error_CannotConvertImplicit,
10356 ConvertImplicitRequired, ConvertNumericExplicit,
10357 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10358 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10361 Perform the following renames:
10363 StandardConversionExists -> ImplicitStandardConversionExists
10364 ConvertImplicit -> ImplicitConversion
10365 ConvertImplicitStandard -> ImplicitStandardConversion
10366 TryImplicitIntConversion -> ImplicitIntConversion
10367 ConvertImplicitRequired -> ImplicitConversionRequired
10368 ConvertNumericExplicit -> ExplicitNumericConversion
10369 ConvertReferenceExplicit -> ExplicitReferenceConversion
10370 ConvertExplicit -> ExplicitConversion
10371 ConvertExplicitStandard -> ExplicitStandardConversion
10373 2003-05-19 Martin Baulig <martin@ximian.com>
10375 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10376 (TypeInfo): Added support for structs having structs as fields.
10378 * ecore.cs (FieldExpr): Implement IVariable.
10379 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10380 VariableInfo for the field.
10382 2003-05-18 Martin Baulig <martin@ximian.com>
10384 * expression.cs (This.DoResolve): Report a CS0027 if we're
10385 emitting a field initializer.
10387 2003-05-18 Martin Baulig <martin@ximian.com>
10389 * expression.cs (This.ResolveBase): New public function.
10390 (This.DoResolve): Check for CS0188.
10392 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10395 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10396 `instance_expression' to null if we don't have any non-static
10399 2003-05-18 Martin Baulig <martin@ximian.com>
10401 Reworked the way how local variables and parameters are handled by
10402 the flow analysis code.
10404 * statement.cs (TypeInfo, VariableMap): New public classes.
10405 (VariableInfo): New public class. This is now responsible for
10406 checking whether a variable has been assigned. It is used for
10407 parameters and local variables.
10408 (Block.EmitMeta): Take the InternalParameters as argument; compute
10409 the layout of the flow vectors here.
10410 (Block.LocalMap, Block.ParameterMap): New public properties.
10411 (FlowBranching): The .ctor doesn't get the InternalParameters
10412 anymore since Block.EmitMeta() now computes the layout of the flow
10414 (MyStructInfo): This class is now known as `StructInfo' and nested
10415 in `TypeInfo'; we don't access this directly anymore.
10417 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10418 property and removed IsAssigned(), IsFieldAssigned(),
10419 SetAssigned() and SetFieldAssigned(); we now call them on the
10420 VariableInfo so we don't need to duplicate this code everywhere.
10422 * expression.cs (ParameterReference): Added `Block block' argument
10424 (LocalVariableReference, ParameterReference, This): The new
10425 VariableInfo class is now responsible for all the definite
10428 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10429 IsParameterAssigned, SetParameterAssigned): Removed.
10431 2003-05-18 Martin Baulig <martin@ximian.com>
10433 * typemanager.cs (InitCoreTypes): Try calling
10434 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10435 the 3-args-version. Corlib now also needs our `void_type'.
10436 (GetMethod): Added overloaded version which takes an optional
10437 `bool report_errors' to allow lookups of optional methods.
10439 2003-05-12 Martin Baulig <martin@ximian.com>
10441 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10442 only used for locals and not for parameters.
10444 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10446 * support.cs (InternalParameters.ParameterType): Return the
10447 ExternalType of the parameter.
10449 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10452 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10454 * class.cs (MethodData.Define): Do not set the `newslot' on
10455 interface members, if they are also flagged as "override".
10457 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10458 better code for ++i and i++. This only works for static fields
10459 and local variables.
10461 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10462 want to pull the DeclSpace out of the builder_to_declspace instead
10463 of the TypeBuilder (like in TypeContainer.FindMembers).
10465 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10466 instead of LookupTypeContainer. Fixes the crash on .NET for
10467 looking up interface members.
10469 * const.cs: Create our own emit context during the Definition
10470 stage, so that constants are evaluated in the proper context, when
10471 a recursive definition happens.
10473 2003-05-11 Martin Baulig <martin@ximian.com>
10475 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10476 new block for a switch section.
10477 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10478 the adding/lookup in the switch block. Fixes #39828.
10480 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10482 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10483 functionality: I needed to convert the data after I had performed
10484 the add/sub operation into the operands type size.
10486 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10487 pass the type for the box operation, otherwise the resulting
10488 object would have been of type object.
10490 (BoxedCast): Add constructor to specify the type to box as.
10492 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10494 * iterators.cs: I was reusing the `count' variable inadvertently,
10495 take steps to not allow this to happen.
10497 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10499 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10500 by creating an array at the point where the params starts and
10501 putting all those arguments there, then adjusting the size of the
10504 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10506 * expression.cs (New.AddressOf): Implement interface
10507 IMemoryLocation. This is used when the `new' operator is used in
10508 the context of an invocation to a method on a value type.
10510 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10513 * namespace.cs: Also check the using aliases here.
10515 * driver.cs: Move the test for using validity after the types have
10516 been entered, so we do a single pass that also includes the using
10519 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10520 in the regular case. CreateSiblingForFinally is doing extra
10523 * attribute.cs (GetAttributeArgumentExpression): Store the result
10524 on an out value, and use the return value to indicate failure
10525 instead of using null (which is a valid return for Constant.GetValue).
10527 * statement.cs: Perform the analysis flow for the increment
10528 portion after the statement, because this will be the real flow of
10529 execution. Fixes #42385
10531 * codegen.cs (EmitContext.EmitArgument,
10532 EmitContext.EmitStoreArgument): New helper functions when the
10533 RemapToProxy flag is set.
10535 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10538 Add support for remapping parameters.
10540 * iterators.cs: Propagate parameter values; Store parameter
10541 values in the proxy classes.
10543 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10545 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10546 need a proxy reference; I do not know what I was thinking
10548 * cs-parser.jay (constructor_initializer): catch another error,
10549 and display nice message.
10551 (field_declaration): catch void field declaration
10552 to flag a better error.
10554 * class.cs (MemberBase.CheckBase): Report an error instead of a
10555 warning if a new protected member is declared in a struct.
10556 (Field.Define): catch the error of readonly/volatile.
10558 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10560 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10561 volatile variable is taken
10563 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10565 * statement.cs (Fixed.Resolve): Report an error if we are not in
10568 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10570 * typemanager.cs: reuse the code that handles type clashes for
10571 delegates and enumerations.
10573 * class.cs (Report28): Always report.
10575 * expression.cs (EncodeAsAttribute): Allow nulls here.
10577 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10579 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10580 the functionality for testing whether an expression is valid for
10581 an attribute here. Also handle the case of arrays of elements
10584 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10585 encoding a linear array into an array of objects that are suitable
10586 to be passed to an CustomAttributeBuilder.
10588 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10590 * ecore.cs: (FieldExpr): Handle field remapping here.
10592 * iteratators.cs: Pass the instance variable (if the method is an
10593 instance method) to the constructors, so we can access the field
10594 variables on the class.
10596 TODO: Test this with structs. I think the THIS variable on
10597 structs might have to be a pointer, and not a refenrece
10599 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10601 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10602 local variables to fields in a proxy class.
10604 * iterators.cs (PopulateProxy): Rename our internal fields to
10606 Create a <THIS> field if we are an instance method, so we can
10607 reference our parent container variables.
10608 (MapVariable): Called back from the EmitContext code to enter a
10609 new variable to field mapping into the proxy class (we just create
10613 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10614 for using the remapped locals to fields.
10616 I placed the code here, because that gives the same semantics to
10617 local variables, and only changes the Emit code.
10619 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10620 statements inside iterators.
10621 (VariableInfo): Add a FieldBuilder for the cases when we are
10622 remapping local variables to fields in a proxy class
10624 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10625 current_block != null.
10627 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10628 not cope with strings, as it has been moved to the
10629 TableSwitchEmit. Fixed bug in switch generation.
10631 * expression.cs (New.DoResolve): Provide more context for the user
10632 when reporting an error.
10634 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10637 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10638 check the permissions for it. Note than in a type-resolution
10639 context the check was already present in DeclSpace.ResolveType,
10640 but was missing from the MemberAccess.
10642 (ArrayCreation.CheckIndices): warn if the user has
10643 more nested levels of expressions, but there are no more
10644 dimensions specified. Avoids crash on bug 41906.
10646 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10648 * statement.cs (Block): replace Implicit bool, for a generic
10650 New flag: `Unchecked'. This is used during the EmitMeta phase
10651 (which is out-of-line with the regular Resolve/Emit process for a
10652 statement, as this is done ahead of time, but still gets a chance
10653 to call constant resolve).
10655 (Block.Flags): new enum for adding a new flag.
10657 (Block.EmitMeta): track the state of unchecked.
10659 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10660 to enable constant resolution to work there as well.
10662 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10664 * typemanager.cs (ienumerable_type): Also look up
10665 System.Collections.IEnumerable.
10667 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10669 TODO: Test more than one conditional per method.
10671 * class.cs (Indexer.Define): Report the location where the user is
10672 referencing the unsupported feature.
10674 (MethodData): Overload the use of `conditionals' to
10675 minimize the creation of needless ArrayLists. This saves roughly
10676 212kb on my machine.
10678 (Method): Implement the new IIteratorContainer interface.
10679 (Method.SetYields): Implement the method by setting the ModFlags
10680 to contain METHOD_YIELDS.
10682 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10683 which just got set to null.
10685 * iterators.cs: New file.
10687 (Yield, YieldBreak): New statements.
10689 * statement.cs (Return.Resolve): Flag an error if we are used in
10690 an iterator method.
10692 * codegen.cs (InIterator): New flag set if the code is being
10693 compiled in an iterator method.
10695 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10696 internal modifier, and we just use it to avoid adding extra
10697 fields, as this is seldom used.
10699 * cs-parser.jay: Add yield_statement (yield and yield break).
10701 * driver.cs: New flag -v2 to turn on version 2 features.
10703 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10704 hashtable when v2 is enabled.
10706 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10708 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10709 there is already a namespace defined with this name.
10711 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10712 people upgraded their corlibs.
10714 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10715 always use fully qualified types, no need to use the compiler
10718 (TypeManager.IsNamespace): Use binarysearch.
10720 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10721 AddDelegate): I did not quite use the new IsValid API properly: I
10722 have to pass the short-name and the fullname. I was passing only
10723 the basename instead of the fullname sometimes.
10725 (TypeContainer.DefineType): call NamespaceClash.
10727 * interface.cs (Interface.DefineType): use NamespaceClash before
10730 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10733 * enum.cs: (Enum.DefineType): use NamespaceClash before
10736 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10737 speed increase. First, use the negative_hits cache when we get a
10738 negative. Second, add the type with its full original name
10739 instead of the new . and + encoded name (reflection uses + to
10740 separate type from a nested type). Use LookupTypeReflection
10741 directly which bypasses the type->name hashtable (that we already
10742 know does not contain the type.
10744 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10745 location/container type.
10747 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10749 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10751 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10753 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10754 method is being referenced in the method group from a static
10755 context, and report error 120 if so.
10757 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10760 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10761 is created, we create the A namespace).
10763 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10766 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10768 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10769 invocation to ModuleBuilder.GetType with the same values will
10770 return a new type instance, so we need to cache its return
10773 * expression.cs (Binary.ResolveOperator): Only allow the compare
10774 operators on enums if they are of the same type.
10776 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10777 types of ValueType on their own case. Before we were giving them
10778 the same treatment as objects.
10780 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10781 fullname. Short name is used to compare against container name.
10782 Fullname is used to check against defined namespace names.
10784 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10785 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10787 (Method.CheckBase): Call parent.
10788 (MemberBase.CheckBase): Check for protected members on sealed
10790 (PropertyBase.CheckBase): Call parent.
10791 (Field.Define): Call parent.
10793 * report.cs: Negative error codes are now mapped to 8000 - code,
10794 so that the display is render more nicely.
10796 * typemanager.cs: Do not use try/catch, instead report a regular
10799 (GetPointerType, GetReferenceType): These methods provide
10800 mechanisms to obtain the T* and T& from a T. We had the code
10801 previously scattered around the code base, and it also used
10802 TypeManager.LookupType that would go through plenty of caches.
10803 This one goes directly to the type source.
10805 In some places we did the Type.GetType followed by
10806 ModuleBuilder.GetType, but not in others, so this unifies the
10807 processing as well.
10809 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10810 statements now that we have namespace information.
10812 * typemanager.cs (IsNamespace): New method, returns whether the
10813 string presented is a namespace or not.
10815 (ComputeNamespaces): New public entry point, computes the list of
10816 available namespaces, using the GetNamespaces API call in Mono, or
10817 the slower version in MS.NET.
10819 Now before we start the semantic analysis phase, we have a
10820 complete list of namespaces including everything that the user has
10823 Deleted old code to cache namespaces in .nsc files.
10825 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10827 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10828 class/struct location definition Location for the implicit
10829 constructor location.
10831 (Operator.Define): Use the location of the operator for the
10832 implicit Method definition.
10834 (Constructor.Emit): use the constructor location for the implicit
10835 base initializer constructor.
10837 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10838 and the Expression class now contains two new methods:
10840 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10841 isolate type lookup from the rest of the resolution process.
10843 Since we use Expressions to hold type definitions due to the way
10844 we parse the input we have historically overloaded Resolve to
10845 perform the Type lookups if a special flag is passed. Now this is
10846 eliminated and two methods take their place.
10848 The differences in the two methods between xStep and xTerminal is
10849 that xStep is involved in our current lookup system that uses
10850 SimpleNames to compose a name, while xTerminal is used just to
10851 catch the case where the simplename lookup failed.
10853 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10855 * expression.cs (ResolveMemberAccess): Remove redundant code.
10856 TypeExpr expressions are always born fully resolved.
10858 * interface.cs (PopulateMethod): Do not lookup the types twice.
10859 We were doing it once during SemanticAnalysis and once during
10862 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10863 in local variable type definitions, were being returned as a
10864 SimpleName (we decomposed everything into a string), that is
10865 because primary_expression was being used instead of a type in the
10866 grammar (reduce/reduce conflicts).
10868 The part that was wrong is that we converted the expression into a
10869 string (an oversimplification in one hand, compounded with primary
10870 expressions doing string concatenation).
10876 Would return "A.B.C[]" as a SimpleName. This stopped things like
10877 using clauses from working on this particular context. And a type
10878 was being matched directly against "A.B.C[]".
10880 We now use the correct approach, and allow for ComposedCast to be
10881 part of the unary expression. So the "A.B.C []" become a composed
10882 cast of "A.B.C" (as a nested group of MemberAccess with a
10883 SimpleName at the end) plus the rank composition "[]".
10887 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10889 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10890 for the access level checking.
10892 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10893 `TypeContainer container', because I kept getting confused when I
10894 was debugging this code.
10896 * expression.cs (Indexers): Instead of tracking getters/setters,
10897 we now track them in parallel. We create one arraylist less, but
10898 most importantly it is possible now for the LValue code to find a
10899 matching get for a set.
10901 (IndexerAccess.DoResolveLValue): Update the code.
10902 GetIndexersForType has been modified already to extract all the
10903 indexers from a type. The code assumed it did not.
10905 Also make the code set the correct return type for the indexer.
10906 This was fixed a long time ago for properties, but was missing for
10907 indexers. It used to be void_type.
10909 (Binary.Emit): Test first for doubles instead of
10910 floats, as they are more common.
10912 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10913 when dealing with floats and the <=, >= operators. This fixes bug
10916 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10917 to load the array value by emitting a load on the foreach variable
10918 type. This was incorrect.
10920 We now emit the code to load an element using the the array
10921 variable type, and then we emit the conversion operator.
10925 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10927 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10929 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10931 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10932 test for protection before we test for signatures.
10934 (MethodSignature.ToString): implement.
10936 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10937 to the case where we reduced into a LongConstant.
10939 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10940 depend on whether the information is acurrate, because the
10941 Microsoft runtime will always claim that the array type is public,
10942 regardless of the real state.
10944 If the type is a pointer, another problem happens: the type is
10945 reported as non-public in Microsoft.
10947 In both cases we have to call CheckAccessLevel recursively with
10948 the underlying type as the argument to be tested.
10950 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10952 * assign.cs (Assign.Emit): If we are dealing with a compound
10953 assignment expression, we should use the code path that stores the
10954 intermediate result in a temporary value. This fixes #40903.
10956 *expression.cs (Indirection.ToString): Provide ToString method for
10959 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10961 * class.cs: Null out fields holding references to Block objects so
10962 they can be garbage collected.
10964 * expression.cs (OverloadResolve): Remove unused local.
10966 2003-04-07 Martin Baulig <martin@ximian.com>
10968 * codegen.cs (EmitContext.CurrentFile): New public field.
10969 (EmitContext.Mark): Use the CurrentFile to check whether the
10970 location is in the correct file.
10971 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
10973 2003-04-07 Martin Baulig <martin@ximian.com>
10975 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
10977 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
10978 location. [FIXME: The location argument which gets passed to this
10979 method is sometimes wrong!]
10981 2003-04-07 Nick Drochak <ndrochak@gol.com>
10983 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
10985 2003-04-07 Miguel de Icaza <miguel@ximian.com>
10987 * expression.cs (Indirection.EmitAssign): We were using the
10988 temporary, but returning immediately instead of continuing the
10991 2003-04-06 Martin Baulig <martin@ximian.com>
10993 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
10994 if it's a nested child, but also deriving from the outer class.
10997 * typemanager.cs (IsNestedChildOf): Make this work if it's a
10998 nested child, but also deriving from the outer class. See
11000 (FilterWithClosure): We may access private members of the outer
11001 class if we're a nested child and deriving from the outer class.
11002 (RealMemberLookup): Only set `closure_private_ok' if the
11003 `original_bf' contained BindingFlags.NonPublic.
11005 2003-04-05 Martin Baulig <martin@ximian.com>
11007 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
11009 2003-04-02 Miguel de Icaza <miguel@ximian.com>
11011 * class.cs (Event.Define): Do not allow abstract events to have
11014 2003-04-01 Miguel de Icaza <miguel@ximian.com>
11016 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
11017 block in event declarations.
11019 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
11020 value type, get its address.
11022 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
11023 leaving a class on the stack instead of a boolean value (int
11024 0/1). Change the code so we compare against null, and then the
11025 result against zero.
11027 * class.cs (TypeContainer.GetClassBases): We were checking for the
11028 parent class being sealed too late.
11030 * expression.cs (Binary.Emit): For <= and >= when dealing with
11031 floating point values, use cgt.un and clt.un instead of cgt and
11034 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
11036 * statement.cs: Apply the same optimization as MS: skip the
11037 GetEnumerator returning an IEnumerator, and use the one returning a
11038 CharEnumerator instead. This allows us to avoid the try-finally block
11041 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
11043 * cs-parser.jay: Attributes cannot be applied to
11044 namespaces. Fixes #40473
11046 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11049 (Add*): check if the name is valid using the full name for constants,
11050 fields, properties and events.
11052 2003-03-28 Miguel de Icaza <miguel@ximian.com>
11054 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
11055 char constants to be part of the enumeration.
11057 * expression.cs (Conditional.DoResolve): Add support for operator
11058 true. Implements the missing functionality from 14.12
11060 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
11061 operator true/false as required by the spec.
11063 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
11064 implicit conversion to boolean.
11066 * statement.cs (Statement.ResolveBoolean): A boolean expression is
11067 also one where the type implements `operator true'.
11069 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
11070 get an expression that will invoke operator true based on an
11073 (GetConversionOperators): Removed the hack that called op_True
11076 (Expression.ResolveBoolean): Move this from Statement.
11078 2003-03-17 Miguel de Icaza <miguel@ximian.com>
11080 * ecore.cs (FieldExpr): do not allow initialization of initonly
11081 fields on derived classes
11083 2003-03-13 Martin Baulig <martin@ximian.com>
11085 * statement.cs (Block.Emit): Call ig.BeginScope() and
11086 ig.EndScope() when compiling with debugging info; call
11087 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
11089 2003-03-08 Miguel de Icaza <miguel@ximian.com>
11091 * expression.cs (Indexers): Do not construct immediately, allow
11092 for new members to be appended as we go. Fixes 38143
11094 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11096 * expression.cs: save/restore context when resolving an unchecked
11099 2003-03-05 Miguel de Icaza <miguel@ximian.com>
11101 * cfold.cs: Catch division by zero in modulus operator during
11104 2003-03-03 Miguel de Icaza <miguel@ximian.com>
11106 * interface.cs (Interface.DefineMembers): Avoid defining members
11109 2003-02-27 Miguel de Icaza <miguel@ximian.com>
11111 * driver.cs: handle the +/- options for -noconfig
11113 * statement.cs (Unckeched.Resolve): Also track the state of
11114 unchecked in the Resolve phase.
11116 2003-02-27 Martin Baulig <martin@ximian.com>
11118 * ecore.cs (Expression.MemberLookup): Don't create a
11119 MethodGroupExpr for something which is not a method. Fixes #38291.
11121 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11123 * class.cs (MemberBase.CheckParameters): Also check that the type
11124 is unmanaged if it is a pointer.
11126 * expression.cs (SizeOf.Resolve): Add location information.
11128 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11129 a managed type is declared.
11131 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11132 parameter modifiers as well. Fixes bug 38606
11134 * class.cs: Very sad. Am backing out the speed up changes
11135 introduced by the ArrayList -> Array in the TypeContainer, as they
11136 were not actually that much faster, and introduced a bug (no error
11137 reports on duplicated methods).
11139 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11140 source first, this will guarantee that we have a valid expression
11141 before calling in lower levels functions that will require a
11142 resolved object. Then use this original_source in the
11143 target.ResolveLValue instead of the original source that was
11146 Another change. Use target.Resolve instead of LValueResolve.
11147 Although we are resolving for LValues, we will let the Assign code
11148 take care of that (it will be called again from Resolve). This
11149 basically allows code like this:
11151 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11152 class Y { void A (X x) { x [0] += o; }
11154 The problem was that the indexer was trying to resolve for
11155 set_Item (idx, object o) and never finding one. The real set_Item
11156 was set_Item (idx, X). By delaying the process we get the right
11161 2003-02-23 Martin Baulig <martin@ximian.com>
11163 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11164 while calling DoEmit ().
11166 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11167 source files; if you use the #line directive inside a method, the
11168 compiler stops emitting line numbers for the debugger until it
11169 reaches the end of the method or another #line directive which
11170 restores the original file.
11172 2003-02-23 Martin Baulig <martin@ximian.com>
11174 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11176 2003-02-23 Martin Baulig <martin@ximian.com>
11178 * statement.cs (Block.AddChildVariableNames): We need to call this
11179 recursively, not just for our immediate children.
11181 2003-02-23 Martin Baulig <martin@ximian.com>
11183 * class.cs (Event.Define): Always make the field private, like csc does.
11185 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11186 actually work, fixes bug #37521.
11188 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11190 * delegate.cs: When creating the various temporary "Parameters"
11191 classes, make sure that we call the ComputeAndDefineParameterTypes
11192 on those new parameters (just like we do with the formal ones), to
11193 allow them to be resolved in the context of the DeclSpace.
11195 This fixes the bug that Dick observed in Bugzilla #38530.
11197 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11199 * expression.cs (ResolveMemberAccess): When resolving a constant,
11200 do not attempt to pull a constant if the value was not able to
11201 generate a valid constant.
11203 * const.cs (LookupConstantValue): Do not report more errors than required.
11205 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11207 * expression.cs: fixes bug #38328.
11209 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11211 * class.cs: Changed all the various members that can be part of a
11212 class from being an ArrayList to be an Array of the right type.
11213 During the DefineType type_list, interface_list, delegate_list and
11214 enum_list are turned into types, interfaces, delegates and enums
11217 And during the member population, indexer_list, event_list,
11218 constant_list, field_list, instance_constructor_list, method_list,
11219 operator_list and property_list are turned into their real arrays.
11221 Although we could probably perform this operation earlier, for
11222 good error reporting we need to keep the lists and remove the
11223 lists for longer than required.
11225 This optimization was triggered by Paolo profiling the compiler
11226 speed on the output of `gen-sample-program.pl' perl script.
11228 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11229 not crash in methods like MemberLookupFailed that use this field.
11231 This problem arises when the compiler fails to resolve a type
11232 during interface type definition for example.
11234 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11236 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11237 inherit from System.Object, so we have to stop at null, not only
11238 when reaching System.Object.
11240 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11242 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11243 DeclaredOnly because the parent indexer might have had a different
11244 name, but did not loop until the top of the hierarchy was reached.
11246 The problem this one fixes is 35492: when a class implemented an
11247 indexer from an interface, we were getting the interface method
11248 (which was abstract) and we were flagging an error (can not invoke
11251 This also keeps bug 33089 functioning, and test-148 functioning.
11253 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11254 out if a method is special is to see if it is declared in a
11255 property or event, or whether it is one of the predefined operator
11256 names. This should fix correctly #36804.
11258 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11260 The goal here is to remove the dependency on EmptyCast.Peel ().
11261 Killing it completely.
11263 The problem is that currently in a number of places where
11264 constants are expected, we have to "probe" for an EmptyCast, and
11265 Peel, which is not the correct thing to do, as this will be
11266 repetitive and will likely lead to errors.
11268 The idea is to remove any EmptyCasts that are used in casts that
11269 can be reduced to constants, so we only have to cope with
11272 This bug hunt was triggered by Bug 37363 and the desire to remove
11273 the duplicate pattern where we were "peeling" emptycasts to check
11274 whether they were constants. Now constants will always be
11277 * ecore.cs: Use an enumconstant here instead of wrapping with
11280 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11281 throwing me off. By handling this we can get rid of a few hacks.
11283 * statement.cs (Switch): Removed Peel() code.
11285 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11287 * class.cs: Location information for error 508
11289 * expression.cs (New.DoResolve): Add a guard against double
11290 resolution of an expression.
11292 The New DoResolve might be called twice when initializing field
11293 expressions (see EmitFieldInitializers, the call to
11294 GetInitializerExpression will perform a resolve on the expression,
11295 and later the assign will trigger another resolution
11297 This leads to bugs (#37014)
11299 * delegate.cs: The signature for EndInvoke should contain any ref
11300 or out parameters as well. We were not doing this in the past.
11302 * class.cs (Field.Define): Do not overwrite the type definition
11303 inside the `volatile' group. Turns out that volatile enumerations
11304 were changing the type here to perform a validity test, which
11307 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11309 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11310 and structs, we do not want to load the instance variable
11312 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11313 enum_type has to be handled like an object reference (implicit
11314 conversions exists from this to object), but the regular IsClass
11315 and IsValueType tests will never return true for this one.
11317 Also we use TypeManager.IsValueType instead of type.IsValueType,
11318 just for consistency with the rest of the code (this is only
11319 needed if we ever use the construct exposed by test-180.cs inside
11320 corlib, which we dont today).
11322 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11324 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11327 2003-02-09 Martin Baulig <martin@ximian.com>
11329 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11330 (Namespace.DefineNamespaces): New static public method; this is
11331 called when we're compiling with debugging to add all namespaces
11332 to the symbol file.
11334 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11335 pass it to the Namespace's .ctor.
11337 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11338 and MethodBase arguments; pass the namespace ID to the symwriter;
11339 pass the MethodBase instead of the token to the symwriter.
11340 (SymbolWriter.DefineNamespace): New method to add a namespace to
11343 2003-02-09 Martin Baulig <martin@ximian.com>
11345 * symbolwriter.cs: New file. This is a wrapper around
11346 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11347 methods here in near future.
11349 2003-02-09 Martin Baulig <martin@ximian.com>
11351 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11352 ILGenerator.MarkSequencePoint() which are actually used by the
11355 2003-02-09 Martin Baulig <martin@ximian.com>
11357 * location.cs (SourceFile): New public sealed class. This
11358 contains the name and an index which is used in the location's token.
11359 (Location): Reserve an appropriate number of bits in the token for
11360 the source file instead of walking over that list, this gives us a
11361 really huge performance improvement when compiling with debugging.
11363 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11364 `SourceFile' argument instead of a string.
11365 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11366 but don't parse/tokenize here, we need to generate the list of all
11367 source files before we do that.
11368 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11371 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11372 instead of a string.
11374 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11377 2003-02-09 Martin Baulig <martin@ximian.com>
11379 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11380 filename on `#line default'.
11382 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11384 * statement.cs: don't clear the pinned var when the fixed statement
11385 returns from the method (fixes bug#37752).
11387 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11389 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11392 2003-02-07 Martin Baulig <martin@ximian.com>
11394 * driver.cs: Removed the `--debug-args' command line argument.
11396 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11397 automatically by the AsssemblyBuilder.
11398 (CodeGen.InitializeSymbolWriter): We don't need to call any
11399 initialization function on the symbol writer anymore. This method
11400 doesn't take any arguments.
11402 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11404 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11405 from referenced assemblies as well.
11407 2003-02-02 Martin Baulig <martin@ximian.com>
11409 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11411 2003-02-02 Martin Baulig <martin@ximian.com>
11413 * class.cs (Constructor.Emit): Open the symbol writer before
11414 emitting the constructor initializer.
11415 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11416 single-stepping through constructor initializers.
11418 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11420 * class.cs: Handle error 549: do not allow virtual methods in
11423 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11425 * decl.cs: Check access levels when resolving types
11427 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11429 * statement.cs: Add parameters and locals set in catch blocks that might
11430 return to set vector
11432 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11434 * class.cs (Operator): Set the SpecialName flags for operators.
11436 * expression.cs (Invocation.DoResolve): Only block calls to
11437 accessors and operators on SpecialName methods.
11439 (Cast.TryReduce): Handle conversions from char constants.
11442 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11444 * statement.cs: small memory and time optimization in FlowBranching.
11446 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11448 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11449 problem that the last fix but in the other sid (Set).
11451 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11452 access when there is no indexer in the hierarchy.
11454 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11456 * class.cs: Combine some if statements.
11458 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11460 * driver.cs: fixed bug #37187.
11462 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11464 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11465 any indexer, it's needed to build a list with all the indexers in the
11466 hierarchy (AllGetters), else we have problems. Fixes #35653.
11468 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11470 * class.cs (MethodData.Define): It is wrong for an interface
11471 implementation to be static in both cases: explicit and implicit.
11472 We were only handling this in one case.
11474 Improve the if situation there to not have negations.
11476 * class.cs (Field.Define): Turns out that we do not need to check
11477 the unsafe bit on field definition, only on usage. Remove the test.
11479 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11481 * driver.cs: use assembly.Location instead of Codebase (the latest
11482 patch made mcs fail when using MS assemblies).
11484 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11486 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11487 get the path to *corlib.dll.
11489 2003-01-21 Nick Drochak <ndrochak@gol.com>
11493 * typemanager.cs: Remove compiler warnings
11495 2003-01-20 Duncan Mak <duncan@ximian.com>
11497 * AssemblyInfo.cs: Bump the version number to 0.19.
11499 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11501 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11503 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11505 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11507 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11509 * cs-parser.jay: Small fix: we were not comparing the constructor
11510 name correctly. Thanks to Zoltan for the initial pointer.
11512 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11514 * cs-tokenizer.cs: Set file name when specified with #line
11516 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11518 * cs-parser.jay: Only perform the constructor checks here if we
11519 are named like the class; This will help provider a better
11520 error. The constructor path is taken when a type definition is
11521 not found, but most likely the user forgot to add the type, so
11522 report that rather than the constructor error.
11524 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11526 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11529 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11531 * cs-parser.jay: Add cleanup call.
11533 2003-01-13 Duncan Mak <duncan@ximian.com>
11535 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11536 consistent with other methods.
11538 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11540 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11542 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11544 * attribute.cs: only set GuidAttr to true when we have a
11547 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11551 * typemanager.cs: fixes to allow mcs compile corlib with the new
11552 Type.IsSubclassOf fix.
11554 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11556 * expression.cs (LocalVariableReference.DoResolve): Classify a
11557 constant as a value, not as a variable. Also, set the type for
11560 * cs-parser.jay (fixed_statement): take a type instead of a
11561 pointer_type, so we can produce a better error message later.
11563 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11566 (For.DoEmit): Make inifinite loops have a
11567 non-conditional branch back.
11569 (Fixed.DoEmit): First populate the pinned variables, then emit the
11570 statement, then clear the variables. Before I was emitting the
11571 code once for each fixed piece.
11574 2003-01-08 Martin Baulig <martin@ximian.com>
11576 * statement.cs (FlowBranching.MergeChild): A break in a
11577 SWITCH_SECTION does not leave a loop. Fixes #36155.
11579 2003-01-08 Martin Baulig <martin@ximian.com>
11581 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11582 lives in the same number space than `param_map'. Fixes #36154.
11584 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11586 * cs-parser.jay (constructor_declaration): Set the
11587 Constructor.ModFlags before probing for it. This makes the
11588 compiler report 514, 515 and 132 (the code was there, but got
11591 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11592 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11593 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11595 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11597 * enum.cs: create the enum static fields using the enum type.
11599 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11601 * class.cs: don't try to create the ParamBuilder for the return
11602 type if it's not needed (and handle it breaking for the ms runtime
11605 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11607 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11609 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11611 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11612 the command. This showed up while compiling the JANET source
11613 code, which used \r as its only newline separator.
11615 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11617 * class.cs (Method.Define): If we are an operator (because it
11618 reuses our code), then set the SpecialName and HideBySig. #36128
11620 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11622 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11623 exception, report error 120 `object reference required'.
11625 * driver.cs: Add --pause option, used during to measure the size
11626 of the process as it goes with --timestamp.
11628 * expression.cs (Invocation.DoResolve): Do not allow methods with
11629 SpecialName to be invoked.
11631 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11633 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11634 number before adding it.
11636 2002-12-21 Ravi Pratap <ravi@ximian.com>
11638 * ecore.cs (StandardImplicitConversion): When in an unsafe
11639 context, we allow conversion between void * to any other pointer
11640 type. This fixes bug #35973.
11642 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11644 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11645 is not thrown when extensionless outputs are used
11647 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11649 * rootcontext.cs: fixed compilation of corlib.
11651 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11653 * attribute.cs (Attributes.Contains): Add new method.
11655 * class.cs (MethodCore.LabelParameters): if the parameter is an
11656 `out' parameter, check that no attribute `[In]' has been passed.
11658 * enum.cs: Handle the `value__' name in an enumeration.
11660 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11662 * decl.cs: Added special case to allow overrides on "protected
11665 2002-12-18 Ravi Pratap <ravi@ximian.com>
11667 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11668 since it makes much more sense.
11670 (Attributes.ctor): Don't require a Location parameter.
11672 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11674 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11675 since we already have that information per attribute.
11677 * everywhere : make appropriate changes.
11679 * class.cs (LabelParameters): Write the code which actually
11680 applies attributes to the return type. We can't do this on the MS
11681 .NET runtime so we flag a warning in the case an exception is
11684 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11686 * const.cs: Handle implicit null conversions here too.
11688 2002-12-17 Ravi Pratap <ravi@ximian.com>
11690 * class.cs (MethodCore.LabelParameters): Remove the extra
11691 Type [] parameter since it is completely unnecessary. Instead
11692 pass in the method's attributes so that we can extract
11693 the "return" attribute.
11695 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11697 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11698 of ignoring it and letting the compile continue.
11700 * typemanager.cs (ChangeType): use an extra argument to return an
11701 error condition instead of throwing an exception.
11703 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11705 * expression.cs (Unary.TryReduce): mimic the code for the regular
11706 code path. Perform an implicit cast in the cases where we can
11707 implicitly convert to one of the integral types, and then reduce
11708 based on that constant. This fixes bug #35483.
11710 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11712 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11714 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11716 * namespace.cs: fixed bug #35489.
11718 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11720 * class.cs: Remove some dead code.
11722 * cs-parser.jay: Estimate the number of methods needed
11723 (RootContext.MethodCount);
11725 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11726 numbers instead of StringBuilders.
11728 * support.cs (PtrHashtable): Add constructor with initial size;
11729 We can now reduce reallocations of the method table.
11731 2002-12-10 Ravi Pratap <ravi@ximian.com>
11733 * attribute.cs (ApplyAttributes): Keep track of the emitted
11734 attributes on a per-target basis. This fixes bug #35413.
11736 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11738 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11739 default to the Windows 1252 encoding.
11741 (UnixParseOption): Support version, thanks to Alp for the missing
11744 * AssemblyInfo.cs: Add nice assembly information.
11746 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11749 * cs-parser.jay: Allow a trailing comma before the close bracked
11750 in the attribute_section production.
11752 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11753 address of the instance was being taken, I will take this out,
11754 because we take the address of the object immediately here.
11756 2002-12-09 Ravi Pratap <ravi@ximian.com>
11758 * typemanager.cs (AreMultipleAllowed): Take care of the most
11759 obvious case where attribute type is not in the current assembly -
11762 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11764 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11765 definitions, instead of doing that afterwards.
11767 Also we use a nice little hack, depending on the constructor, we
11768 know if we are a "composed" name or a simple name. Hence, we
11769 avoid the IndexOf test, and we avoid
11771 * codegen.cs: Add code to assist in a bug reporter to track down
11772 the source of a compiler crash.
11774 2002-12-07 Ravi Pratap <ravi@ximian.com>
11776 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11777 types have been emitted for a given element and flag an error
11778 if something which does not have AllowMultiple set is used more
11781 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11782 attribute types and their corresponding AllowMultiple properties
11784 (AreMultipleAllowed): Check the property for a given type.
11786 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11787 property in the case we have a TypeContainer.
11789 (Attributes.AddAttribute): Detect duplicates and just skip on
11790 adding them. This trivial fix catches a pretty gross error in our
11791 attribute emission - global attributes were being emitted twice!
11793 Bugzilla bug #33187 is now fixed.
11795 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11797 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11798 instead of pp_and).
11800 * expression.cs (Binary.ResolveOperator): I can only use the
11801 Concat (string, string, string) and Concat (string, string,
11802 string, string) if the child is actually a concatenation of
11805 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11807 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11808 context where we need a 2-character lookahead.
11810 * pending.cs (PendingImplementation): Rework so we can keep track
11811 of interface types all the time, and flag those which were
11812 implemented by parents as optional.
11814 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11816 * expression.cs (Binary.ResolveOperator): Use
11817 String.Concat(string,string,string) or
11818 String.Concat(string,string,string,string) when possible.
11820 * typemanager: More helper methods.
11823 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11825 * pending.cs: remove the bogus return from GetMissingInterfaces()
11826 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11828 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11830 * namespace.cs: avoid duplicated 'using xxx' being added to
11831 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11832 when we get more than one 'using' statement for the same namespace.
11833 Report a CS0105 warning for it.
11835 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11837 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11838 of calling getChar/putback, uses internal knowledge of it.
11840 (xtoken): Reorder tokenizer so most common patterns are checked
11841 first. This reduces the compilation time in another 5% (from 8.11s
11842 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11844 The parsing time is 22% of the compilation in mcs, and from that
11845 64% is spent on the tokenization process.
11847 I tried using a binary search for keywords, but this is slower
11848 than the hashtable. Another option would be to do a couple of
11851 * Not use a StringBuilder, instead use an array of chars,
11852 with a set value. Notice that this way we could catch
11853 the 645 error without having to do it *afterwards*.
11855 * We could write a hand-parser to avoid the hashtable
11856 compares altogether.
11858 The identifier consumption process takes 37% of the tokenization
11859 time. Another 15% is spent on is_number. 56% of the time spent
11860 on is_number is spent on Int64.Parse:
11862 * We could probably choose based on the string length to
11863 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11866 Another 3% is spend on wrapping `xtoken' in the `token' function.
11868 Handle 0xa0 as whitespace (#34752)
11870 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11872 * typemanager.cs (IsCLRType): New routine to tell whether a type
11873 is one of the builtin types.
11875 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11876 typecode in more places instead of doing pointer comparissions.
11877 We could leverage some knowledge about the way the typecodes are
11880 New code to cache namespaces in assemblies, it is currently not
11881 invoked, to be used soon.
11883 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11885 * expression.cs (Binary.ResolveOperator): specially handle
11886 strings, and do not perform user-defined operator overloading for
11889 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11891 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11892 internalcall as it is a pretty simple operation; Avoid whenever
11893 possible to call Char.IsLetter.
11895 (consume_identifier): Cut by half the number of
11896 hashtable calls by merging the is_keyword and GetKeyword behavior.
11898 Do not short-circuit, because if we do, we
11899 report errors (ie, #if false && true would produce an invalid
11903 2002-11-24 Martin Baulig <martin@ximian.com>
11905 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11906 check constant ranges and report a CS0221. Fixes #33186.
11908 2002-11-24 Martin Baulig <martin@ximian.com>
11910 * cs-parser.jay: Make this work for uninitialized variable
11911 declarations in the `for' initializer. Fixes #32416.
11913 2002-11-24 Martin Baulig <martin@ximian.com>
11915 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11916 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11918 2002-11-24 Martin Baulig <martin@ximian.com>
11920 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11921 argument; if true, we also check for user-defined conversions.
11922 This is only needed if both arguments are of a user-defined type.
11923 Fixes #30443, added test-175.cs.
11924 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11926 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11928 2002-11-24 Martin Baulig <martin@ximian.com>
11930 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11931 function to get the store opcode.
11932 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11933 only emit the Ldelema if the store opcode is Stobj. You must run
11934 both test-34 and test-167 to test this. Fixes #34529.
11936 2002-11-23 Martin Baulig <martin@ximian.com>
11938 * ecore.cs (Expression.MemberLookup): Added additional
11939 `qualifier_type' argument which is used when we're being called
11940 from MemberAccess.DoResolve() and null if we're called from a
11942 (Expression.MemberLookupFailed): New method to report errors; this
11943 does the CS1540 check and reports the correct error message.
11945 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11946 argument for the CS1540 check and redone the way how we're dealing
11947 with private members. See the comment in the source code for details.
11948 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11949 `closure_start_type' to `closure_qualifier_type' and check whether
11950 it's not null. It was not this filter being broken, it was just
11951 being called with the wrong arguments.
11953 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11954 and pass it the correct `qualifier_type'; this also does the error
11957 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11959 * expression.cs (Invocation.EmitParams): If the we are dealing
11960 with a non-built-in value type, load its address as well.
11962 (ArrayCreation): Use a a pretty constant instead
11963 of the hardcoded value 2. Use 6 instead of 2 for the number of
11964 static initializers.
11966 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11967 because they are not really value types, just glorified integers.
11969 * driver.cs: Do not append .exe, the CSC compiler does not do it.
11971 * ecore.cs: Remove redundant code for enumerations, make them use
11972 the same code path as everything else, fixes the casting issue
11973 with enumerations in Windows.Forms.
11975 * attribute.cs: Do only cast to string if it is a string, the
11976 validation happens later.
11978 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
11979 people upgrade their corlibs.
11981 * ecore.cs: Oops, enumerations were not following the entire code path
11983 2002-11-21 Miguel de Icaza <miguel@ximian.com>
11985 * typemanager.cs (FilterWithClosure): Commented out the test for
11986 1540 in typemanager.cs, as it has problems when accessing
11987 protected methods from a parent class (see test-174.cs).
11989 * attribute.cs (Attribute.ValidateGuid): new method.
11990 (Attribute.Resolve): Use above.
11992 2002-11-19 Miguel de Icaza <miguel@ximian.com>
11994 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
11996 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
11997 handling for enumerations, as we only needed the TypeContainer
11998 functionality to begin with (this is required for the fix below to
11999 work for enums that reference constants in a container class for
12002 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
12004 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
12005 a valid TypeBuilder to perform lookups on.o
12007 * class.cs (InheritableMemberSignatureCompare): Use true in the
12008 call to GetGetMethod and GetSetMethod, because we are comparing
12009 the signature, and we need to get the methods *even* if they are
12012 (PropertyBase.CheckBase): ditto.
12014 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
12015 GotoCase.Resolve): Use Peel on EmpytCasts.
12017 * ecore.cs (EmptyCast): drop child, add Peel method.
12019 2002-11-17 Martin Baulig <martin@ximian.com>
12021 * ecore.cs (EmptyCast.Child): New public property.
12023 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
12024 label resolved to an EmptyCast. Fixes #34162.
12025 (GotoCase.Resolve): Likewise.
12026 (Block.EmitMeta): Likewise.
12028 2002-11-17 Martin Baulig <martin@ximian.com>
12030 * expression.cs (Invocation.BetterConversion): Prefer int over
12031 uint; short over ushort; long over ulong for integer literals.
12032 Use ImplicitConversionExists instead of StandardConversionExists
12033 since we also need to check for user-defined implicit conversions.
12034 Fixes #34165. Added test-173.cs.
12036 2002-11-16 Martin Baulig <martin@ximian.com>
12038 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
12039 with the `true' and `false' literals. Fixes #33151.
12041 2002-11-16 Martin Baulig <martin@ximian.com>
12043 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
12044 October 22nd; don't do the cs1540 check for static members.
12046 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
12047 now using our own filter here and doing the cs1540 check again.
12049 2002-11-16 Martin Baulig <martin@ximian.com>
12051 * support.cs (InternalParameters): Don't crash if we don't have
12052 any fixed parameters. Fixes #33532.
12054 2002-11-16 Martin Baulig <martin@ximian.com>
12056 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
12057 when looking up static methods to make this work on Windows.
12060 2002-11-16 Martin Baulig <martin@ximian.com>
12062 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
12063 a setter rather than using PropertyInfo.CanWrite.
12065 2002-11-15 Nick Drochak <ndrochak@gol.com>
12067 * class.cs: Allow acces to block member by subclasses. Fixes build
12070 2002-11-14 Martin Baulig <martin@ximian.com>
12072 * class.cs (Constructor.Emit): Added the extern/block check.
12075 2002-11-14 Martin Baulig <martin@ximian.com>
12077 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
12078 iteration while looking for indexers, this is needed because the
12079 indexer may have a different name in our base classes. Fixed the
12080 error reporting (no indexers at all, not get accessor, no
12081 overloaded match). Fixes bug #33089.
12082 (IndexerAccess.DoResolveLValue): Likewise.
12084 2002-11-14 Martin Baulig <martin@ximian.com>
12086 * class.cs (PropertyBase.CheckBase): Make this work for multiple
12087 indexers. Fixes the first part of bug #33089.
12088 (MethodSignature.InheritableMemberSignatureCompare): Added support
12091 2002-11-13 Ravi Pratap <ravi@ximian.com>
12093 * attribute.cs (Attribute.Resolve): Catch the
12094 NullReferenceException and report it since it isn't supposed to
12097 2002-11-12 Miguel de Icaza <miguel@ximian.com>
12099 * expression.cs (Binary.EmitBranchable): Also handle the cases for
12100 LogicalOr and LogicalAnd that can benefit from recursively
12101 handling EmitBranchable. The code now should be nice for Paolo.
12103 2002-11-08 Miguel de Icaza <miguel@ximian.com>
12105 * typemanager.cs (LookupType): Added a negative-hit hashtable for
12106 the Type lookups, as we perform quite a number of lookups on
12107 non-Types. This can be removed once we can deterministically tell
12108 whether we have a type or a namespace in advance.
12110 But this might require special hacks from our corlib.
12114 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12115 and double which avoids a conversion from an integer to a double.
12117 * expression.cs: tiny optimization, avoid calling IsConstant,
12118 because it effectively performs the lookup twice.
12120 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12122 But a bogus return here to keep the semantics of the old code
12123 until the Mono runtime is fixed.
12125 * pending.cs (GetMissingInterfaces): New method used to remove all
12126 the interfaces that are already implemented by our parent
12127 classes from the list of pending methods.
12129 * interface.cs: Add checks for calls after ResolveTypeExpr.
12131 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12133 * class.cs (Class.Emit): Report warning 67: event not used if the
12134 warning level is beyond 3.
12136 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12137 being a NullLiteral.
12139 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12142 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12143 path that might fail if a type can not be resolved.
12145 * expression.cs (Binary.Emit): Emit unsigned versions of the
12148 * driver.cs: use error 5.
12150 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12152 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12154 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12156 * cs-parser.jay (switch_section): A beautiful patch from Martin
12157 Baulig that fixed 33094.
12159 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12161 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12162 Check whether the base is abstract and report an error if so.
12164 * expression.cs (IndexerAccess.DoResolveLValue,
12165 IndexerAccess.DoResolve): ditto.
12167 (Invocation.DoResolve): ditto.
12169 (Invocation.FullMethodDesc): Improve the report string.
12171 * statement.cs (Block): Eliminate IsVariableDefined as it is
12172 basically just a wrapper for GetVariableInfo.
12174 * ecore.cs (SimpleName): Use new
12176 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12177 type, as we return the actual parameter ref/unref state on a
12180 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12182 * support.cs: Return proper flags REF/OUT fixing the previous
12185 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12186 not used to mean `ref' but `ref or out' in ParameterReference
12188 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12189 full type signature instead of calling TypeManger.CSharpName
12192 * support.cs (InternalParameters.ParameterDesc): Do not compare
12193 directly to the modflags, because REF/OUT will actually be bitsets
12196 * delegate.cs (VerifyMethod): Check also the modifiers.
12198 * cs-tokenizer.cs: Fix bug where floating point values with an
12199 exponent where a sign was missing was ignored.
12201 * driver.cs: Allow multiple assemblies to be specified in a single
12204 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12206 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12207 because identifiers after a parenthesis would end up in this kind
12208 of production, and we needed to desamiguate it for having casts
12211 (UserDefinedType *) xxx
12213 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12215 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12216 we should set on the Bindingflags.NonPublic, but not turn on
12217 private_ok. private_ok controls whether a Private member is
12218 returned (this is chekced on the filter routine), while the
12219 BindingFlags.NonPublic just controls whether private/protected
12220 will be allowed. This fixes the problem part of the problem of
12221 private properties being allowed to be used in derived classes.
12223 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12224 so we can call the children DoResolveLValue method (this will
12225 properly signal errors on lvalue assignments to base properties)
12227 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12228 getter are null, and we have a property info, we know that this
12229 happened because the lookup failed, so we report an error 122 for
12230 protection level violation.
12232 We also silently return if setter and getter are null in the
12233 resolve functions, this condition only happens if we have flagged
12234 the error before. This is the other half of the problem.
12236 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12237 not have accessibility information, that is why we were returning
12238 true in the filter function in typemanager.cs.
12240 To properly report 122 (property is inaccessible because of its
12241 protection level) correctly, we report this error in ResolveAccess
12242 by failing if both the setter and the getter are lacking (ie, the
12245 DoResolve and DoLResolve have been modified to check for both
12246 setter/getter being null and returning silently, the reason being
12247 that I did not want to put the knowledge about this error in upper
12250 int old = Report.Errors;
12251 x = new PropertyExpr (...);
12252 if (old != Report.Errors)
12257 So the property expr is returned, but it is invalid, so the error
12258 will be flagged during the resolve process.
12260 * class.cs: Remove InheritablePropertySignatureCompare from the
12261 class, as we no longer depend on the property signature to compute
12262 whether it is possible to implement a method or not.
12264 The reason is that calling PropertyInfo.GetGetMethod will return
12265 null (in .NET, in Mono it works, and we should change this), in
12266 cases where the Get Method does not exist in that particular
12271 class X { public virtual int A { get { return 1; } } }
12273 class Z : Y { public override int A { get { return 2; } } }
12275 Would fail in Z because the parent (Y) would not have the property
12276 defined. So we avoid this completely now (because the alternative
12277 fix was ugly and slow), and we now depend exclusively on the
12280 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12281 reference method, instead of using the property.
12283 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12284 routines are gone now.
12286 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12287 names, they were incorrectly named.
12289 * cs-tokenizer.cs: Return are more gentle token on failure.
12291 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12292 had an out-of-sync index variable, which caused it to remove from
12293 the list of pending methods the wrong method sometimes.
12295 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12297 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12298 CanWrite, because those refer to this particular instance of the
12299 property, and do not take into account the fact that we can
12300 override single members of a property.
12302 Constructor requires an EmitContext. The resolution process does
12303 not happen here, but we need to compute the accessors before,
12304 because the resolution does not always happen for properties.
12306 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12307 subclass, before we did not update this flag, but we did update
12310 (GetAccessors): Drop this routine, as it did not work in the
12311 presence of partially overwritten set/get methods.
12313 Notice that this broke the cs1540 detection, but that will require
12316 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12320 * driver.cs: issue a warning instead of an error if we don't support
12321 debugging for the platform. Also ignore a couple of errors that may
12322 arise when trying to write the symbols. Undo my previous patch.
12324 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12326 * driver.cs: ignore /debug switch except for Unix platforms.
12328 2002-10-23 Nick Drochak <ndrochak@gol.com>
12330 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12332 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12334 * driver.cs: Do not make mcs-debug conditional, so we do not break
12335 builds that use it.
12337 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12338 review this patch. But basically after all the children variables
12339 have been merged, the value of "Breaks" was not being set to
12340 new_breaks for Switch blocks. I think that it should be set after
12341 it has executed. Currently I set this to the value of new_breaks,
12342 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12343 conservative, but I do not understand this code very well.
12345 I did not break anything in the build, so that is good ;-)
12347 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12349 2002-10-20 Mark Crichton <crichton@gimp.org>
12351 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12353 2002-10-20 Nick Drochak <ndrochak@gol.com>
12355 * cfold.cs: Fixed compile blocker.
12357 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12359 * driver.cs: I was chekcing the key, not the file.
12361 2002-10-19 Ravi Pratap <ravi@ximian.com>
12363 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12364 message that we were generating - we just need to silently return
12367 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12369 * class.cs (Event.Define): Change my previous commit, as this
12370 breaks the debugger. This is a temporary hack, as it seems like
12371 the compiler is generating events incorrectly to begin with.
12373 * expression.cs (Binary.ResolveOperator): Added support for
12374 "U operator - (E x, E y)"
12376 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12379 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12380 init-only variables, but this path did not take into account that
12381 there might be also instance readonly variables. Correct this
12384 This fixes bug 32253
12386 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12389 * driver.cs: Change the extension for modules to `netmodule'
12391 * cs-parser.jay: Improved slightly the location tracking for
12392 the debugger symbols.
12394 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12395 modifiers that were specified instead of the hardcoded value
12396 (FamAndAssem). This was basically ignoring the static modifier,
12397 and others. Fixes 32429.
12399 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12400 fixed a bug in the process (32476)
12402 * expression.cs (ArrayAccess.EmitAssign): Patch from
12403 hwang_rob@yahoo.ca that fixes bug 31834.3
12405 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12407 * driver.cs: Make the module extension .netmodule.
12409 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12411 * driver.cs: Report an error if the resource file is not found
12412 instead of crashing.
12414 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12415 false, like Emit does.
12417 2002-10-16 Nick Drochak <ndrochak@gol.com>
12419 * typemanager.cs: Remove unused private member. Also reported mcs
12420 bug to report this as a warning like csc.
12422 2002-10-15 Martin Baulig <martin@gnome.org>
12424 * statement.cs (Statement.Emit): Made this a virtual method; emits
12425 the line number info and calls DoEmit().
12426 (Statement.DoEmit): New protected abstract method, formerly knows
12427 as Statement.Emit().
12429 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12431 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12433 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12434 have fixed a remaining problem: not every AddXXXX was adding a
12435 fully qualified name.
12437 Now everyone registers a fully qualified name in the DeclSpace as
12438 being defined instead of the partial name.
12440 Downsides: we are slower than we need to be due to the excess
12441 copies and the names being registered this way.
12443 The reason for this is that we currently depend (on the corlib
12444 bootstrap for instance) that types are fully qualified, because
12445 we dump all the types in the namespace, and we should really have
12446 types inserted into the proper namespace, so we can only store the
12447 basenames in the defined_names array.
12449 2002-10-10 Martin Baulig <martin@gnome.org>
12451 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12452 from bug #31834, see the bug report for a testcase which is
12455 2002-10-10 Martin Baulig <martin@gnome.org>
12457 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12458 flow analysis code for this.
12460 * statement.cs (Do, While, For): Tell the flow analysis code about
12462 (FlowBranching.UsageVector): Added support for infinite loops.
12463 (Block.Resolve): Moved the dead code elimination here and use flow
12466 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12468 * class.cs (Field.Define): Catch cycles on struct type
12471 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12472 fields if the fields are static. We only need to check instance
12475 * expression.cs (As.DoResolve): Test for reference type.
12477 * statement.cs (Using.ResolveExpression): Use
12478 ConvertImplicitRequired, not ConvertImplicit which reports an
12480 (Using.ResolveLocalVariableDecls): ditto.
12482 * expression.cs (Binary.ResolveOperator): Report errors in a few
12483 places where we had to.
12485 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12487 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12489 * expression.cs: Use StoreFromPtr instead of extracting the type
12490 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12492 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12493 an enumeration value to a System.Enum, but System.Enum is not a
12494 value type, but an class type, so we need to box.
12496 (Expression.ConvertExplicit): One codepath could return
12497 errors but not flag them. Fix this. Fixes #31853
12499 * parameter.cs (Resolve): Do not allow void as a parameter type.
12501 2002-10-06 Martin Baulig <martin@gnome.org>
12503 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12504 if it's a class type and not a struct. Fixes #31815.
12506 2002-10-06 Martin Baulig <martin@gnome.org>
12508 * statement.cs: Reworked the flow analysis code a bit to make it
12509 usable for dead code elimination.
12511 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12513 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12515 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12517 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12518 to fix the test 165, will investigate deeper.
12520 2002-10-04 Martin Baulig <martin@gnome.org>
12522 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12523 finally blocks actually work.
12524 (Try.Resolve): We don't need to create a sibling for `finally' if
12525 there is no finally block.
12527 2002-10-04 Martin Baulig <martin@gnome.org>
12529 * class.cs (Constructor.Define): The default accessibility for a
12530 non-default constructor is private, not public.
12532 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12534 * class.cs (Constructor): Make AllowedModifiers public, add
12537 * cs-parser.jay: Perform the modifiers test here, as the
12538 constructor for the Constructor class usually receives a zero
12539 because of the way we create it (first we create, later we
12540 customize, and we were never checking the modifiers).
12542 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12543 is a version of LookupTypeReflection that includes the type-name
12544 cache. This can be used as a fast path for functions that know
12545 the fully qualified name and are only calling into *.GetType() to
12546 obtain a composed type.
12548 This is also used by TypeManager.LookupType during its type
12551 (LookupType): We now also track the real type name, as sometimes
12552 we can get a quey for the real type name from things like
12553 ComposedCast. This fixes bug 31422.
12555 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12556 complete type fullname, it does not have to go through the type
12557 resolution system to obtain the composed version of the type (for
12558 obtaining arrays or pointers).
12560 (Conditional.Emit): Use the EmitBoolExpression to
12561 generate nicer code, as requested by Paolo.
12563 (ArrayCreation.CheckIndices): Use the patch from
12564 hwang_rob@yahoo.ca to validate the array initializers.
12566 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12568 * class.cs (ConstructorInitializer.Emit): simplify code by using
12569 Invocation.EmitCall, and at the same time, fix the bugs in calling
12570 parent constructors that took variable arguments.
12572 * ecore.cs (Expression.ConvertNumericExplicit,
12573 Expression.ImplicitNumericConversion): Remove the code that
12574 manually wrapped decimal (InternalTypeConstructor call is now gone
12577 * expression.cs (Cast.TryReduce): Also handle decimal types when
12578 trying to perform a constant fold on the type.
12580 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12582 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12583 that only turned off an error report, and did nothing else.
12585 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12587 * driver.cs: Handle and ignore /fullpaths
12589 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12591 * expression.cs (Binary.ResolveOperator): Catch the case where
12592 DoNumericPromotions returns true,
12594 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12596 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12598 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12601 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12603 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12604 conversion exists, but it is also required that the conversion be
12605 performed. This manifested in "(Type64Enum) 2".
12607 * class.cs (TypeManager.AddMethod): The fix is not to change
12608 AddEnum, because that one was using a fully qualified name (every
12609 DeclSpace derivative does), but to change the AddMethod routine
12610 that was using an un-namespaced name. This now correctly reports
12611 the duplicated name.
12613 Revert patch until I can properly fix it. The issue
12614 is that we have a shared Type space across all namespaces
12615 currently, which is wrong.
12617 Options include making the Namespace a DeclSpace, and merge
12618 current_namespace/current_container in the parser.
12620 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12622 * cs-parser.jay: Improve error reporting when we get a different
12623 kind of expression in local_variable_type and
12624 local_variable_pointer_type.
12626 Propagate this to avoid missleading errors being reported.
12628 * ecore.cs (ImplicitReferenceConversion): treat
12629 TypeManager.value_type as a target just like object_type. As
12634 Is valid, and needs to result in the int 1 being boxed before it
12635 is assigned to the value type v.
12637 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12638 to validate the enumeration name.
12640 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12641 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12642 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12644 * ecore.cs (TryImplicitIntConversion): When doing an
12645 implicit-enumeration-conversion, check if the type is 64-bits and
12646 perform a conversion before passing to EnumConstant.
12648 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12650 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12651 report ambiguous type references. Unlike the MS version, we
12652 report what the ambiguity is. Innovation at work ;-)
12654 (DeclSpace.FindType): Require a location argument to
12655 display when we display an ambiguous error.
12657 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12659 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12661 * expression.cs (EmitDynamicInitializers): Apply patch from
12662 hwang_rob@yahoo.ca that fixes the order in which we emit our
12665 2002-09-21 Martin Baulig <martin@gnome.org>
12667 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12668 delegate takes no arguments.
12670 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12672 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12675 * expression.cs: Extract the underlying type.
12677 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12679 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12681 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12683 * class.cs (TypeContainer.DefineType): We can not use the nice
12684 PackingSize with the size set to 1 DefineType method, because it
12685 will not allow us to define the interfaces that the struct
12688 This completes the fixing of bug 27287
12690 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12691 means also structs. This fixes part of the problem.
12692 (Expresion.ImplicitReferenceConversionExists): ditto.
12694 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12695 error if there were no errors reported during the type lookup
12696 process, to avoid duplicates or redundant errors. Without this
12697 you would get an ambiguous errors plus a type not found. We have
12698 beaten the user enough with the first error.
12700 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12703 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12704 during the resolution process, stop the lookup, this avoids
12705 repeated error reports (same error twice).
12707 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12709 * typemanager.cs (LookupType): Redo the type lookup code to match
12710 the needs of System.Reflection.
12712 The issue is that System.Reflection requires references to nested
12713 types to begin with a "+" sign instead of a dot. So toplevel
12714 types look like: "NameSpace.TopLevelClass", and nested ones look
12715 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12718 2002-09-19 Martin Baulig <martin@gnome.org>
12720 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12721 says that a method always returns or always throws an exception,
12722 don't report the CS0161.
12724 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12725 set `Returns = new_returns'.
12727 2002-09-19 Martin Baulig <martin@gnome.org>
12729 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12730 to an enum constant, check for a CS0176.
12732 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12734 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12735 for operators that must be in pairs and report errors.
12737 * ecore.cs (SimpleName.DoResolveType): During the initial type
12738 resolution process, when we define types recursively, we must
12739 check first for types in our current scope before we perform
12740 lookups in the enclosing scopes.
12742 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12744 (Invocation.VerifyArgumentsCompat): Call
12745 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12746 I thought we were supposed to always call this, but there are a
12747 few places in the code where we dont do it.
12749 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12751 * driver.cs: Add support in -linkres and -resource to specify the
12752 name of the identifier.
12754 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12756 * ecore.cs (StandardConversionExists): Sync with the conversion
12757 code: allow anything-* to void* conversions.
12759 (FindMostSpecificSource): Use an Expression argument
12760 instead of a Type, because we might be handed over a Literal which
12761 gets a few more implicit conversions that plain types do not. So
12762 this information was being lost.
12764 Also, we drop the temporary type-holder expression when not
12767 2002-09-17 Martin Baulig <martin@gnome.org>
12769 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12770 this is an explicit interface implementation.
12772 2002-09-17 Martin Baulig <martin@gnome.org>
12774 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12775 different `IndexerName' attributes.
12777 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12778 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12779 virtual CommonResolve().
12781 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12783 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12784 and convert that to the UnderlyingType.
12786 * statement.cs (Foreach.Resolve): Indexers are just like variables
12787 or PropertyAccesses.
12789 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12790 inside quoted strings, we were not doing this before.
12792 2002-09-16 Martin Baulig <martin@gnome.org>
12794 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12795 resolve it. This is needed for the definite assignment check of the
12796 instance expression, fixes bug #29846.
12797 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12799 2002-09-16 Nick Drochak <ndrochak@gol.com>
12801 * parameter.cs: Fix compile error. Cannot reference static member
12802 from an instance object. Is this an mcs bug?
12804 2002-09-14 Martin Baulig <martin@gnome.org>
12806 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12807 multiple times. Fixes bug #30295, added test-166.cs.
12809 2002-09-14 Martin Baulig <martin@gnome.org>
12811 * statement.cs (Block.Emit): Don't emit unreachable code.
12812 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12813 `break' statements.
12814 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12816 2002-09-14 Martin Baulig <martin@gnome.org>
12818 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12821 2002-09-14 Martin Baulig <martin@gnome.org>
12823 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12824 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12825 be false on the ms runtime.
12827 2002-09-13 Martin Baulig <martin@gnome.org>
12829 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12830 the CS0038 error message.
12832 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12834 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12835 constant inside, return it.
12837 2002-09-12 Martin Baulig <martin@gnome.org>
12839 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12840 implicit conversion can be done between enum types.
12842 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12843 check whether an implicit conversion to the current enum's UnderlyingType
12844 exists and report an error if not.
12846 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12847 without debugging support.
12849 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12850 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12852 2002-09-12 Martin Baulig <martin@gnome.org>
12854 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12856 * ecore.cs (IMemberExpr.DeclaringType): New property.
12857 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12858 nonstatic member of an outer type (CS0038).
12860 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12862 * driver.cs: Activate the using-error detector at warning level
12863 4 (at least for MS-compatible APIs).
12865 * namespace.cs (VerifyUsing): Small buglett fix.
12867 * pending.cs (PendingImplementation): pass the container pointer.
12869 * interface.cs (GetMethods): Allow for recursive definition. Long
12870 term, I would like to move every type to support recursive
12871 definitions, not the current ordering mechanism that we have right
12874 The situation is this: Attributes are handled before interfaces,
12875 so we can apply attributes to interfaces. But some attributes
12876 implement interfaces, we will now handle the simple cases
12877 (recursive definitions will just get an error).
12879 * parameter.cs: Only invalidate types at the end if we fail to
12882 2002-09-09 Martin Baulig <martin@gnome.org>
12884 * ecore.cs (PropertyExpr.Emit): Also check for
12885 TypeManager.system_int_array_get_length so this'll also work when
12886 compiling corlib. Fixes #30003.
12888 2002-09-09 Martin Baulig <martin@gnome.org>
12890 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12891 and throw an exception if we can't get the type's size. Fixed #30040,
12894 2002-09-09 Martin Baulig <martin@gnome.org>
12896 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12898 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12899 context. Fixes bug #30027.
12901 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12902 virtual functions. Fixes bug #30043, added test-164.cs.
12904 2002-09-08 Ravi Pratap <ravi@ximian.com>
12906 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12908 2002-09-08 Nick Drochak <ndrochak@gol.com>
12910 * driver.cs: Use an object to get the windows codepage since it's not a
12913 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12915 * statement.cs (For.Emit): for infinite loops (test == null)
12916 return whether there is a break inside, not always "true".
12918 * namespace.cs (UsingEntry): New struct to hold the name of the
12919 using definition, the location where it is defined, and whether it
12920 has been used in a successful type lookup.
12922 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12927 2002-09-06 Ravi Pratap <ravi@ximian.com>
12929 * attribute.cs : Fix incorrect code which relied on catching
12930 a NullReferenceException to detect a null being passed in
12931 where an object was expected.
12933 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12935 * statement.cs (Try): flag the catch variable as assigned
12937 * expression.cs (Cast): Simplified by using ResolveType instead of
12938 manually resolving.
12940 * statement.cs (Catch): Fix bug by using ResolveType.
12942 2002-09-06 Ravi Pratap <ravi@ximian.com>
12944 * expression.cs (BetterConversion): Special case for when we have
12945 a NullLiteral as the argument and we have to choose between string
12946 and object types - we choose string the way csc does.
12948 * attribute.cs (Attribute.Resolve): Catch the
12949 NullReferenceException and report error #182 since the Mono
12950 runtime no more has the bug and having this exception raised means
12951 we tried to select a constructor which takes an object and is
12954 2002-09-05 Ravi Pratap <ravi@ximian.com>
12956 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12957 message (1502, 1503) when we can't locate a method after overload
12958 resolution. This is much more informative and closes the bug
12961 * interface.cs (PopulateMethod): Return if there are no argument
12962 types. Fixes a NullReferenceException bug.
12964 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12965 expressions too. Previously we were checking only in one place for
12966 positional arguments leaving out named arguments.
12968 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12969 type to the enum type is not allowed. Remove code corresponding to
12972 (ConvertNumericExplicit): Allow explicit conversions from
12973 the underlying type to enum type. This precisely follows the spec
12974 and closes a bug filed by Gonzalo.
12976 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12979 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
12981 2002-09-03 Miguel de Icaza <miguel@ximian.com>
12983 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
12984 it was important that we stored the right value after the
12985 reduction in `converted'.
12987 2002-09-04 Martin Baulig <martin@gnome.org>
12989 * location.cs (Location.SymbolDocument): Use full pathnames for the
12992 2002-08-30 Miguel de Icaza <miguel@ximian.com>
12994 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
12995 of the expression resolve mechanism, because that will catch the
12996 SimpleName error failures.
12998 (Conditional): If we can not resolve the
12999 expression, return, do not crash.
13001 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13004 (location): display token name instead of its number.
13006 2002-08-28 Martin Baulig <martin@gnome.org>
13008 * expression.cs (Binary.ResolveOperator): Don't silently return
13009 but return an error if an operator cannot be applied between two
13012 2002-08-28 Martin Baulig <martin@gnome.org>
13014 * class.cs (Constructor.Define): Set the permission attributes
13015 correctly instead of making all constructors public.
13017 2002-08-28 Martin Baulig <martin@gnome.org>
13019 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
13020 for private members before reporting a CS0103; if we find anything,
13023 2002-08-28 Martin Baulig <martin@gnome.org>
13025 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
13026 to check whether `closure_start_type == closure_invocation_type',
13027 we also need to check whether `m.DeclaringType == closure_invocation_type'
13028 before bypassing the permission checks. We might be accessing
13029 protected/private members from the base class.
13030 (TypeManager.RealMemberLookup): Only set private_ok if private
13031 members were requested via BindingFlags.NonPublic.
13033 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
13035 * expression.cs (MemberAccess.ResolveMemberAccess): Set
13036 MethodGroupExpr.IsExplicitImpl if appropriate.
13037 (Invocation.DoResolve): Don't report the CS0120 for explicit
13038 interface implementations.
13040 2002-08-27 Martin Baulig <martin@gnome.org>
13042 * expression.cs (Invocation.DoResolve): If this is a static
13043 method and we don't have an InstanceExpression, we must report
13046 2002-08-25 Martin Baulig <martin@gnome.org>
13048 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
13049 `==' between a valuetype and an object.
13051 2002-08-25 Miguel de Icaza <miguel@ximian.com>
13053 * ecore.cs (TypeExpr): Provide a ToString method.
13055 2002-08-24 Martin Baulig <martin@gnome.org>
13057 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
13058 now called proggie.dbg and it's a binary file.
13060 2002-08-23 Martin Baulig <martin@gnome.org>
13062 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
13064 2002-08-23 Martin Baulig <martin@gnome.org>
13066 * struct.cs (MyStructInfo.ctor): Make this work with empty
13067 structs; it's not allowed to use foreach() on null.
13069 2002-08-23 Martin Baulig <martin@gnome.org>
13071 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
13072 writer the full pathname of the generated assembly.
13074 2002-08-23 Martin Baulig <martin@gnome.org>
13076 * statements.cs (FlowBranching.UsageVector.MergeChildren):
13077 A `finally' block never returns or breaks; improved handling of
13080 2002-08-23 Martin Baulig <martin@gnome.org>
13082 * statement.cs (Throw.Resolve): Allow `throw null'.
13084 2002-08-23 Martin Baulig <martin@gnome.org>
13086 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
13087 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
13088 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
13089 MemberLookup would return a wrong event if this is an explicit
13090 interface implementation and the class has an event with the same
13093 2002-08-23 Martin Baulig <martin@gnome.org>
13095 * statement.cs (Block.AddChildVariableNames): New public method.
13096 (Block.AddChildVariableName): Likewise.
13097 (Block.IsVariableNameUsedInChildBlock): Likewise.
13098 (Block.AddVariable): Check whether a variable name has already
13099 been used in a child block.
13101 * cs-parser.jay (declare_local_variables): Mark all variable names
13102 from the current block as being used in a child block in the
13105 2002-08-23 Martin Baulig <martin@gnome.org>
13107 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
13108 find the symbol writer.
13110 * driver.cs: csc also allows the arguments to /define being
13111 separated by commas, not only by semicolons.
13113 2002-08-23 Martin Baulig <martin@gnome.org>
13115 * interface.cs (Interface.GetMembers): Added static check for events.
13117 2002-08-15 Martin Baulig <martin@gnome.org>
13119 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13120 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13122 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13123 why the MethodData.EmitDestructor() change was necessary.
13125 2002-08-20 Martin Baulig <martin@gnome.org>
13127 * class.cs (TypeContainer.FindMembers): Added static check for events.
13129 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13131 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13132 use Type.GetEvents(), not Type.FindMembers().
13134 2002-08-20 Martin Baulig <martin@gnome.org>
13136 * decl.cs (MemberCache): Added a special method cache which will
13137 be used for method-only searched. This ensures that a method
13138 search will return a MethodInfo with the correct ReflectedType for
13141 2002-08-20 Martin Baulig <martin@gnome.org>
13143 * decl.cs (DeclSpace.FindMembers): Made this public.
13145 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13147 * delegate.cs: fixed build on windows.
13148 [FIXME: Filed as bug #29150: MCS must report these errors.]
13150 2002-08-19 Ravi Pratap <ravi@ximian.com>
13152 * ecore.cs (StandardConversionExists): Return a false
13153 if we are trying to convert the void type to anything else
13154 since that is not allowed.
13156 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13157 we flag error 70 in the event an event is trying to be accessed
13158 directly from outside the declaring type.
13160 2002-08-20 Martin Baulig <martin@gnome.org>
13162 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13163 MemberCache from typemanager.cs to decl.cs.
13165 2002-08-19 Martin Baulig <martin@gnome.org>
13167 * class.cs (TypeContainer): Implement IMemberContainer.
13168 (TypeContainer.DefineMembers): Create the MemberCache.
13169 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13170 return public members if BindingFlags.Public was given, check
13171 whether members are static.
13173 2002-08-16 Martin Baulig <martin@gnome.org>
13175 * decl.cs (DeclSpace.Define): Splitted this in Define and
13176 DefineMembers. DefineMembers is called first and initializes the
13179 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13180 DefineMembers() on all our DeclSpaces.
13182 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13183 but call DefineMembers() on all nested interfaces. We call their
13184 Define() in our new Define() function.
13186 * interface.cs (Interface): Implement IMemberContainer.
13187 (Interface.Define): Moved all code except the attribute stuf to
13189 (Interface.DefineMembers): Initialize the member cache.
13191 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13192 need this anymore since we can use MemberCache.FindMembers directly.
13194 2002-08-19 Martin Baulig <martin@gnome.org>
13196 * typemanager.cs (MemberCache): When creating the cache for an
13197 interface type, add all inherited members.
13198 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13199 to `out bool used_cache' and documented it.
13200 (TypeManager.MemberLookup): If we already used the cache in the first
13201 iteration, we don't need to do the interfaces check.
13203 2002-08-19 Martin Baulig <martin@gnome.org>
13205 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13206 here from IMemberFinder and don't implement this interface anymore.
13207 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13209 * typemanager.cs (IMemberFinder): This interface is now only used by
13210 classes which actually support the member cache.
13211 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13212 since we only put DeclSpaces into this Hashtable.
13213 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13214 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13216 2002-08-16 Martin Baulig <martin@gnome.org>
13218 * typemanager.cs (ICachingMemberFinder): Removed.
13219 (IMemberFinder.MemberCache): New property.
13220 (TypeManager.FindMembers): Merged this with RealFindMembers().
13221 This function will never be called from TypeManager.MemberLookup()
13222 so we can't use the cache here, just the IMemberFinder.
13223 (TypeManager.MemberLookup_FindMembers): Check whether the
13224 IMemberFinder has a MemberCache and call the cache's FindMembers
13226 (MemberCache): Rewrote larger parts of this yet another time and
13227 cleaned it up a bit.
13229 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13231 * driver.cs (LoadArgs): Support quoting.
13233 (Usage): Show the CSC-like command line arguments.
13235 Improved a few error messages.
13237 2002-08-15 Martin Baulig <martin@gnome.org>
13239 * typemanager.cs (IMemberContainer.Type): New property.
13240 (IMemberContainer.IsInterface): New property.
13242 The following changes are conditional to BROKEN_RUNTIME, which is
13243 defined at the top of the file.
13245 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13246 class'es members, but add all members from TypeHandle.ObjectType
13247 if we're an interface.
13248 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13249 is the current type.
13250 (MemberCache.CacheEntry.Container): Removed this field.
13251 (TypeHandle.GetMembers): Include inherited members.
13253 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13255 * typemanager.cs: fixed compilation and added a comment on a field that
13258 2002-08-15 Martin Baulig <martin@gnome.org>
13260 * class.cs (ConstructorInitializer.Resolve): In the
13261 Expression.MemberLookup call, use the queried_type as
13264 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13265 declared' attribute, it's always true.
13266 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13267 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13268 temporary wrapper for FindMembers which tells MemberLookup whether
13269 members from the base classes are included in the return value.
13270 This will go away soon.
13271 (TypeManager.MemberLookup): Use this temporary hack here; once the
13272 new MemberCache is completed, we don't need to do the DeclaredOnly
13273 looping here anymore since the MemberCache will take care of this.
13274 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13275 (MemberCache): When creating the MemberCache for a class, get
13276 members from the current class and all its base classes.
13277 (MemberCache.CacheEntry.Container): New field. This is a
13278 temporary hack until the Mono runtime is fixed to distinguish
13279 between ReflectedType and DeclaringType. It allows us to use MCS
13280 with both the MS runtime and the unfixed Mono runtime without
13281 problems and without accecting performance.
13282 (MemberCache.SearchMembers): The DeclaredOnly looping from
13283 TypeManager.MemberLookup is now done here.
13285 2002-08-14 Martin Baulig <martin@gnome.org>
13287 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13288 Type.GetFields on dynamic types but get the fields from the
13289 corresponding TypeContainer.
13290 (MyStructInfo.GetStructInfo): Added check for enum types.
13292 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13293 (MemberList.SyncRoot): Implemented.
13294 (TypeManager.FilterWithClosure): No need to check permissions if
13295 closure_start_type == closure_invocation_type, don't crash if
13296 closure_invocation_type is null.
13298 2002-08-13 Martin Baulig <martin@gnome.org>
13300 Rewrote TypeContainer.FindMembers to use a member cache. This
13301 gives us a speed increase of about 35% for the self-hosting MCS
13302 build and of about 15-20% for the class libs (both on GNU/Linux).
13304 * report.cs (Timer): New class to get enhanced profiling. This
13305 whole class is "TIMER" conditional since it remarkably slows down
13308 * class.cs (MemberList): New class. This is an IList wrapper
13309 which we're now using instead of passing MemberInfo[]'s around to
13310 avoid copying this array unnecessarily.
13311 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13312 (ICachingMemberFinder, IMemberContainer): New interface.
13313 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13314 has already been checked, otherwise use it for the name comparision.
13315 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13316 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13317 if possible. Returns a MemberList, not a MemberInfo [].
13318 (TypeHandle): New class, implements IMemberContainer. We create
13319 one instance of this class per type, it contains a MemberCache
13320 which is used to do the member lookups.
13321 (MemberCache): New class. Each instance of this class contains
13322 all members of a type and a name-based hash table.
13323 (MemberCache.FindMembers): This is our new member lookup
13324 function. First, it looks up all members of the requested name in
13325 the hash table. Then, it walks this list and sorts out all
13326 applicable members and returns them.
13328 2002-08-13 Martin Baulig <martin@gnome.org>
13330 In addition to a nice code cleanup, this gives us a performance
13331 increase of about 1.4% on GNU/Linux - not much, but it's already
13332 half a second for the self-hosting MCS compilation.
13334 * typemanager.cs (IMemberFinder): New interface. It is used by
13335 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13336 Enum, Delegate or Interface.
13337 (TypeManager.finder_to_member_finder): New PtrHashtable.
13338 (TypeManager.finder_to_container): Removed.
13339 (TypeManager.finder_to_delegate): Removed.
13340 (TypeManager.finder_to_interface): Removed.
13341 (TypeManager.finder_to_enum): Removed.
13343 * interface.cs (Interface): Implement IMemberFinder.
13345 * delegate.cs (Delegate): Implement IMemberFinder.
13347 * enum.cs (Enum): Implement IMemberFinder.
13349 * class.cs (TypeContainer): Implement IMemberFinder.
13351 2002-08-12 Martin Baulig <martin@gnome.org>
13353 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13355 2002-08-12 Martin Baulig <martin@gnome.org>
13357 * ecore.cs (ITypeExpression): New interface for expressions which
13359 (TypeExpression): Renamed to TypeLookupExpression.
13360 (Expression.DoResolve): If we're doing a types-only lookup, the
13361 expression must implement the ITypeExpression interface and we
13362 call DoResolveType() on it.
13363 (SimpleName): Implement the new ITypeExpression interface.
13364 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13365 hack, the situation that we're only looking up types can't happen
13366 anymore when this method is called. Moved the type lookup code to
13367 DoResolveType() and call it.
13368 (SimpleName.DoResolveType): This ITypeExpression interface method
13369 is now doing the types-only lookup.
13370 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13371 (ResolveFlags): Added MaskExprClass.
13373 * expression.cs (MemberAccess): Implement the ITypeExpression
13375 (MemberAccess.DoResolve): Added support for a types-only lookup
13376 when we're called via ITypeExpression.DoResolveType().
13377 (ComposedCast): Implement the ITypeExpression interface.
13379 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13380 Expression.Resolve() with ResolveFlags.Type instead.
13382 2002-08-12 Martin Baulig <martin@gnome.org>
13384 * interface.cs (Interface.Define): Apply attributes.
13386 * attribute.cs (Attribute.ApplyAttributes): Added support for
13387 interface attributes.
13389 2002-08-11 Martin Baulig <martin@gnome.org>
13391 * statement.cs (Block.Emit): Only check the "this" variable if we
13392 do not always throw an exception.
13394 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13395 whether the property has a set accessor.
13397 2002-08-11 Martin Baulig <martin@gnome.org>
13399 Added control flow analysis support for structs.
13401 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13402 with control flow analysis turned off.
13403 (IVariable): New interface.
13404 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13405 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13406 (FieldExpr.DoResolve): Resolve the instance expression with flow
13407 analysis turned off and do the definite assignment check after the
13408 resolving when we know what the expression will resolve to.
13410 * expression.cs (LocalVariableReference, ParameterReference):
13411 Implement the new IVariable interface, only call the flow analysis
13412 code if ec.DoFlowAnalysis is true.
13413 (This): Added constructor which takes a Block argument. Implement
13414 the new IVariable interface.
13415 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13416 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13417 This does the definite assignment checks for struct members.
13419 * class.cs (Constructor.Emit): If this is a non-static `struct'
13420 constructor which doesn't have any initializer, call
13421 Block.AddThisVariable() to tell the flow analysis code that all
13422 struct elements must be initialized before control returns from
13425 * statement.cs (MyStructInfo): New public class.
13426 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13427 argument to this indexer. If non-zero, check an individual struct
13428 member, not the whole struct.
13429 (FlowBranching.CheckOutParameters): Check struct members.
13430 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13431 overloaded versions of these methods which take an additional
13432 `int field_idx' argument to check struct members.
13433 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13434 overloaded versions of these methods which take an additional
13435 `string field_name' argument to check struct member.s
13436 (VariableInfo): Implement the IVariable interface.
13437 (VariableInfo.StructInfo): New public property. Returns the
13438 MyStructInfo instance of the variable if it's a struct or null.
13439 (Block.AddThisVariable): New public method. This is called from
13440 Constructor.Emit() for non-static `struct' constructor which do
13441 not have any initializer. It creates a special variable for the
13442 "this" instance variable which will be checked by the flow
13443 analysis code to ensure that all of the struct's fields are
13444 initialized before control returns from the constructor.
13445 (UsageVector): Added support for struct members. If a
13446 variable/parameter is a struct with N members, we reserve a slot
13447 in the usage vector for each member. A struct is considered fully
13448 initialized if either the struct itself (slot 0) or all its
13449 members are initialized.
13451 2002-08-08 Martin Baulig <martin@gnome.org>
13453 * driver.cs (Driver.MainDriver): Only report an error CS5001
13454 if there were no compilation errors.
13456 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13457 `UnsafeContext' property to determine whether the parent is in
13458 unsafe context rather than checking the parent's ModFlags:
13459 classes nested in an unsafe class are unsafe as well.
13461 2002-08-08 Martin Baulig <martin@gnome.org>
13463 * statement.cs (UsageVector.MergeChildren): Distinguish between
13464 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13465 we return. Added test17() and test18() to test-154.cs.
13467 2002-08-08 Martin Baulig <martin@gnome.org>
13469 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13470 Family access, make sure the invoking type isn't a subclass of the
13471 queried type (that'd be a CS1540).
13473 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13474 this method which takes an additional `Type invocation_type'.
13476 * expression.cs (BaseAccess.DoResolve): Use the base type as
13477 invocation and query type.
13478 (MemberAccess.DoResolve): If the lookup failed and we're about to
13479 report a CS0122, try a lookup with the ec.ContainerType - if this
13480 succeeds, we must report a CS1540.
13482 2002-08-08 Martin Baulig <martin@gnome.org>
13484 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13485 (MethodGroupExpr): Implement the IMemberExpr interface.
13487 * expression (MemberAccess.ResolveMemberAccess): No need to have
13488 any special code for MethodGroupExprs anymore, they're now
13491 2002-08-08 Martin Baulig <martin@gnome.org>
13493 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13494 Family, FamANDAssem and FamORAssem permissions.
13495 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13497 2002-08-08 Martin Baulig <martin@gnome.org>
13499 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13500 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13503 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13505 * driver.cs: implemented /resource option to embed managed resources.
13507 2002-08-07 Martin Baulig <martin@gnome.org>
13509 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13510 (FieldBase.HasFieldInitializer): New public property.
13511 (FieldBase.GetInitializerExpression): New public method. Resolves and
13512 returns the field initializer and makes sure it is only resolved once.
13513 (TypeContainer.EmitFieldInitializers): Call
13514 FieldBase.GetInitializerExpression to get the initializer, this ensures
13515 that it isn't resolved multiple times.
13517 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13518 the resolving process (SimpleName/MemberLookup) that we're currently
13519 emitting a field initializer (which must not access any instance members,
13520 this is an error CS0236).
13522 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13523 argument, if the `IsFieldInitializer' flag is set, we must report and
13524 error CS0236 and not an error CS0120.
13526 2002-08-07 Martin Baulig <martin@gnome.org>
13528 * ecore.cs (IMemberExpr): New public interface.
13529 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13530 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13531 if the expression is an IMemberExpr.
13533 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13534 to be null, implicitly default to `this' if we're non-static in
13535 this case. Simplified the code a lot by using the new IMemberExpr
13536 interface. Also fixed bug #28176 here.
13538 2002-08-06 Martin Baulig <martin@gnome.org>
13540 * cs-parser.jay (SimpleLookup): Removed. We need to create
13541 ParameterReferences during semantic analysis so that we can do a
13542 type-only search when resolving Cast, TypeOf and SizeOf.
13543 (block): Pass the `current_local_parameters' to the Block's
13546 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13547 argument to the constructor.
13548 (ConstructorInitializer.Resolve): Create a temporary implicit
13549 block with the parameters.
13551 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13552 references here if we aren't doing a type-only search.
13554 * statement.cs (Block): Added constructor which takes a
13555 `Parameters parameters' argument.
13556 (Block.Parameters): New public property.
13558 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13559 to `Parameters' and made it public readonly.
13561 2002-08-06 Martin Baulig <martin@gnome.org>
13563 * ecore.cs (Expression.Warning): Made this public as well.
13565 * report.cs (Report.Debug): Print the contents of collections.
13567 2002-08-06 Martin Baulig <martin@gnome.org>
13569 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13570 used to tell Resolve() which kinds of expressions it may return.
13571 (Expression.Resolve): Added overloaded version of this method which
13572 takes a `ResolveFlags flags' argument. This can be used to tell
13573 Resolve() which kinds of expressions it may return. Reports a
13575 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13576 ResolveFlags.SimpleName.
13577 (Expression.Error118): Added overloaded version of this method which
13578 takes a `ResolveFlags flags' argument. It uses the flags to determine
13579 which kinds of expressions are allowed.
13581 * expression.cs (Argument.ResolveMethodGroup): New public method.
13582 Resolves an argument, but allows a MethodGroup to be returned.
13583 This is used when invoking a delegate.
13585 * TODO: Updated a bit.
13587 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13589 Fixed compilation with csc.
13591 * ecore.cs: Expression.Error made public. Is this correct? Should
13592 Warning be made public too?
13594 * expression.cs: use ea.Location instead of ea.loc.
13595 [FIXME: Filed as bug #28607: MCS must report these errors.]
13597 2002-08-06 Martin Baulig <martin@gnome.org>
13599 * ecore.cs (Expression.loc): Moved the location here instead of
13600 duplicating it in all derived classes.
13601 (Expression.Location): New public property.
13602 (Expression.Error, Expression.Warning): Made them non-static and
13603 removed the location argument.
13604 (Expression.Warning): Added overloaded version which takes an
13605 `int level' argument.
13606 (Expression.Error118): Make this non-static and removed the
13607 expression and location arguments.
13608 (TypeExpr): Added location argument to the constructor.
13610 * expression.cs (StaticCallExpr): Added location argument to
13612 (Indirection, PointerArithmetic): Likewise.
13613 (CheckedExpr, UnCheckedExpr): Likewise.
13614 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13615 (StringPtr): Likewise.
13618 2002-08-05 Martin Baulig <martin@gnome.org>
13620 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13622 * assign.cs (Assign.DoResolve): Check whether the source
13623 expression is a value or variable.
13625 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13626 while resolving the corresponding blocks.
13628 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13629 an error, don't silently return null.
13631 * statement.cs (Block.AddVariable): Do the error reporting here
13632 and distinguish between CS0128 and CS0136.
13633 (Block.DoResolve): Report all unused labels (warning CS0164).
13634 (LabeledStatement): Pass the location to the constructor.
13635 (LabeledStatement.HasBeenReferenced): New property.
13636 (LabeledStatement.Resolve): Set it to true here.
13638 * statement.cs (Return.Emit): Return success even after reporting
13639 a type mismatch error (CS0126 or CS0127), this is what csc does and
13640 it avoids confusing the users with any consecutive errors.
13642 2002-08-05 Martin Baulig <martin@gnome.org>
13644 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13646 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13648 * expression.cs (MemberAccess.DoResolve): Silently return if an
13649 error has already been reported.
13651 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13652 error has already been reported.
13654 2002-08-05 Martin Baulig <martin@gnome.org>
13656 * statement.cs (UsageVector): Only initialize the `parameters'
13657 vector if we actually have any "out" parameters.
13659 2002-08-05 Martin Baulig <martin@gnome.org>
13661 * expression.cs (Binary.ResolveOperator): When combining delegates,
13662 they must have the same type.
13664 2002-08-05 Martin Baulig <martin@gnome.org>
13666 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13667 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13668 work with the ms runtime and we also don't need it: if we're a
13669 PropertyBuilder and not in the `indexer_arguments' hash, then we
13670 are a property and not an indexer.
13672 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13673 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13674 since the latter one doesn't work with the ms runtime.
13676 2002-08-03 Martin Baulig <martin@gnome.org>
13678 Fixed bugs #27998 and #22735.
13680 * class.cs (Method.IsOperator): New public field.
13681 (Method.CheckBase): Report CS0111 if there's already a method
13682 with the same parameters in the current class. Report CS0508 when
13683 attempting to change the return type of an inherited method.
13684 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13685 and it's not marked abstract or extern.
13686 (PropertyBase): New abstract base class for Property and Indexer.
13687 (PropertyBase.CheckBase): Moved here from Property and made it work
13689 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13690 the same so we can reuse it there.
13691 (Property, Indexer): Derive from PropertyBase.
13692 (MethodSignature.inheritable_property_signature_filter): New delegate
13693 to find properties and indexers.
13695 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13696 argument and improved error reporting.
13698 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13699 EmptyReadOnlyParameters and made it a property.
13701 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13702 version of this method which takes a `PropertyInfo indexer'.
13703 (TypeManager.RegisterIndexer): New method.
13705 * class.cs: Added myself as author of this file :-)
13707 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13709 * class.cs: fixed compilation on windoze.
13711 2002-08-03 Martin Baulig <martin@gnome.org>
13713 * interface.cs (Interface.GetInterfaceBases): Check whether all
13714 base interfaces are at least as accessible than the current one.
13716 * class.cs (TypeContainer.GetClassBases): Check whether base types
13717 are at least as accessible than the current type.
13718 (TypeContainer.AsAccessible): Implemented and made non-static.
13719 (MemberBase.CheckParameters): Report errors if the accessibility
13722 * delegate.cs (Delegate.Delegate): The default visibility is
13723 internal for top-level types and private for nested types.
13724 (Delegate.Define): Report errors if the accessibility checks fail.
13726 * enum.cs (Enum.Enum): The default visibility is internal for
13727 top-level types and private for nested types.
13728 (Enum.DefineType): Compute the correct visibility.
13730 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13731 function which takes a `bool is_toplevel' instead of a TypeContainer.
13733 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13736 2002-08-02 Martin Baulig <martin@gnome.org>
13738 * expression.cs (LocalVariableReferenc): Added constructor which
13739 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13740 (LocalVariableReference.IsReadOnly): New property.
13741 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13742 variable is readonly, use our own readonly flag to do this; you can
13743 use the new constructor to get a writable reference to a read-only
13746 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13747 reference to the local variable.
13749 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13751 * rootcontext.cs (ResolveCore): Also include System.Exception
13753 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13754 we reach an EmptyStatement.
13756 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13759 * expression.cs (Binary.ResolveOperator): Check error result in
13762 use brtrue/brfalse directly and avoid compares to null.
13764 2002-08-02 Martin Baulig <martin@gnome.org>
13766 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13767 Fixes bug #28407, added test-155.cs.
13769 2002-08-01 Martin Baulig <martin@gnome.org>
13771 * class.cs (Event.EmitDefaultMethod): Make this work with static
13772 events. Fixes #28311, added verify-3.cs.
13774 2002-08-01 Martin Baulig <martin@gnome.org>
13776 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13777 `is_disposable' fields.
13778 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13779 `hm.is_disposable' if we're using the collection pattern.
13780 (Foreach.EmitCollectionForeach): Use the correct type for the
13781 enumerator's local variable, only emit the try/finally block if
13782 necessary (fixes #27713).
13784 2002-08-01 Martin Baulig <martin@gnome.org>
13786 * ecore.cs (Expression.report118): Renamed to Error118 and made
13789 * statement.cs (Throw.Resolve): Check whether the expression is of
13790 the correct type (CS0118) and whether the type derives from
13791 System.Exception (CS0155).
13792 (Catch.Resolve): New method. Do the type lookup here and check
13793 whether it derives from System.Exception (CS0155).
13794 (Catch.CatchType, Catch.IsGeneral): New public properties.
13796 * typemanager.cs (TypeManager.exception_type): Added.
13798 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13800 * driver.cs: Updated About function.
13802 2002-07-31 Martin Baulig <martin@gnome.org>
13804 Implemented Control Flow Analysis.
13806 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13807 (EmitContext.CurrentBranching): Added.
13808 (EmitContext.StartFlowBranching): Added.
13809 (EmitContext.EndFlowBranching): Added.
13810 (EmitContext.KillFlowBranching): Added.
13811 (EmitContext.IsVariableAssigned): Added.
13812 (EmitContext.SetVariableAssigned): Added.
13813 (EmitContext.IsParameterAssigned): Added.
13814 (EmitContext.SetParameterAssigned): Added.
13815 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13816 Added control flow analysis stuff here.
13818 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13819 resolve the expression as lvalue.
13820 (LocalVariableReference.DoResolve): Check whether the variable has
13821 already been assigned.
13822 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13823 the parameter as assigned here.
13824 (ParameterReference.DoResolve): Check whether the parameter has already
13826 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13827 expression as lvalue.
13829 * statement.cs (FlowBranching): New class for the flow analysis code.
13830 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13831 (LabeledStatement.IsDefined): New public property.
13832 (LabeledStatement.AddUsageVector): New public method to tell flow
13833 analyis that the label may be reached via a forward jump.
13834 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13836 (VariableInfo.Number): New public field. This is used by flow analysis
13837 to number all locals of a block.
13838 (Block.CountVariables): New public property. This is the number of
13839 local variables in this block (including the locals from all parent
13841 (Block.EmitMeta): Number all the variables.
13843 * statement.cs: Added flow analysis support to all classes.
13845 2002-07-31 Martin Baulig <martin@gnome.org>
13847 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13848 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13849 then use this argument.
13851 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13853 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13854 use this to specify /define options.
13856 2002-07-29 Martin Baulig <martin@gnome.org>
13858 * statement.cs (Fixed): Moved all code that does variable lookups
13859 and resolvings from Emit to Resolve.
13861 * statement.cs (For): Moved all code that does variable lookups
13862 and resolvings from Emit to Resolve.
13864 * statement.cs (Using): Moved all code that does variable lookups
13865 and resolvings from Emit to Resolve.
13867 2002-07-29 Martin Baulig <martin@gnome.org>
13869 * attribute.cs (Attribute.Resolve): Explicitly catch a
13870 System.NullReferenceException when creating the
13871 CustromAttributeBuilder and report a different warning message.
13873 2002-07-29 Martin Baulig <martin@gnome.org>
13875 * support.cs (ParameterData.ParameterName): Added method to
13876 get the name of a parameter.
13878 * typemanager.cs (TypeManager.IsValueType): New public method.
13880 2002-07-29 Martin Baulig <martin@gnome.org>
13882 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13883 is a flag which specifies that it's either ref or out.
13884 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13885 the out parameter to `out Parameter.Modifier mod', also set the
13886 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13888 * support.cs (InternalParameters.ParameterModifier): Distinguish
13889 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13890 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13892 * expression.cs (Argument.GetParameterModifier): Distinguish
13893 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13894 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13896 2002-07-29 Martin Baulig <martin@gnome.org>
13898 * expression.cs (ParameterReference.ParameterReference): Added
13899 `Location loc' argument to the constructor.
13901 * cs-parser.jay: Pass location to ParameterReference.
13903 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13905 * statement.cs (Try): Initialize the location.
13907 * cs-parser.jay: pass location to Try.
13909 * expression.cs (Unary.Reduce): Change the prototype to return
13910 whether a constant fold could be performed or not. The result is
13911 returned in an out parameters. In the case of Indirection and
13912 AddressOf, we want to perform the full tests.
13914 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13916 * statement.cs (Statement.Emit): Flag dead code.
13918 2002-07-27 Andrew Birkett <andy@nobugs.org>
13920 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13922 2002-07-27 Martin Baulig <martin@gnome.org>
13924 * class.cs (MethodData.Define): Put back call to
13925 TypeManager.AddMethod(), accidentally commented this out.
13927 * report.cs (Debug): New public method to print debugging information,
13928 this is `[Conditional ("DEBUG")]'.
13930 2002-07-26 Martin Baulig <martin@gnome.org>
13932 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13933 (switch_statement): Push the current_block to the switch_stack and
13934 pop it again when we're done with the switch.
13935 (switch_section): The new block is a child of the current_block.
13936 Fixes bug #24007, added test-152.cs.
13938 2002-07-27 Martin Baulig <martin@gnome.org>
13940 * expression.cs (Invocation.EmitArguments): When calling a varargs
13941 function with only its fixed arguments, we need to pass an empty
13944 2002-07-27 Martin Baulig <martin@gnome.org>
13946 Mono 0.13 has been released.
13948 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13950 * driver.cs: Rename --resource to --linkres, because that is what
13951 we do currently, we dont support --resource yet.
13953 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13955 2002-07-25 Martin Baulig <martin@gnome.org>
13957 * class.cs (MethodData): New public class. This is a `method builder'
13958 class for a method or one accessor of a Property/Indexer/Event.
13959 (MethodData.GetMethodFlags): Moved here from MemberBase.
13960 (MethodData.ApplyAttributes): Likewise.
13961 (MethodData.ApplyObsoleteAttribute): Likewise.
13962 (MethodData.ApplyConditionalAttribute): Likewise.
13963 (MethodData.ApplyDllImportAttribute): Likewise.
13964 (MethodData.CheckAbstractAndExternal): Likewise.
13965 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13966 (MethodData.Emit): Formerly known as Method.Emit().
13967 (MemberBase): Moved everything which was specific to a single
13968 accessor/method to MethodData.
13969 (Method): Create a new MethodData and call Define() and Emit() on it.
13970 (Property, Indexer, Event): Create a new MethodData objects for each
13971 accessor and call Define() and Emit() on them.
13973 2002-07-25 Martin Baulig <martin@gnome.org>
13975 Made MethodCore derive from MemberBase to reuse the code from there.
13976 MemberBase now also checks for attributes.
13978 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
13979 (MemberBase.GetMethodFlags): Moved here from class Method and marked
13981 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
13982 `CallingConventions cc' and `Attributes opt_attrs' arguments.
13983 (MemberBase.ApplyAttributes): New virtual method; applies the
13984 attributes to a method or accessor.
13985 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
13986 (MemberBase.ApplyConditionalAttribute): Likewise.
13987 (MemberBase.ApplyDllImportAttribute): Likewise.
13988 (MemberBase.CheckAbstractAndExternal): Likewise.
13989 (MethodCore.ParameterTypes): This is now a property instead of a
13990 method, it's initialized from DoDefineParameters().
13991 (MethodCore.ParameterInfo): Removed the set accessor.
13992 (MethodCore.DoDefineParameters): New protected virtual method to
13993 initialize ParameterTypes and ParameterInfo.
13994 (Method.GetReturnType): We can now simply return the MemberType.
13995 (Method.GetMethodFlags): Override the MemberBase version and add
13996 the conditional flags.
13997 (Method.CheckBase): Moved some code from Define() here, call
13998 DoDefineParameters() here.
13999 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
14000 here to avoid some larger code duplication.
14001 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
14002 ensure that abstract and external accessors don't declare a body.
14004 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
14005 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
14006 lookup in the attribute's parent classes, so we need to abort as soon
14007 as we found the first match.
14008 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
14009 the attribute has no arguments.
14011 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
14014 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14016 * cs-parser.jay: reverted previous patch.
14018 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14020 * cs-parser.jay: fixed bug #22119.
14022 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14024 * attribute.cs: fixed compilation. The error was:
14025 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
14026 be assigned to before control leaves the current method."
14027 [FIXME: Filed as bug #28186: MCS must report this error.]
14029 2002-07-25 Martin Baulig <martin@gnome.org>
14031 * attribute.cs (Attribute.Conditional_GetConditionName): New static
14032 method to pull the condition name ouf of a Conditional attribute.
14033 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
14034 the obsolete message and error flag out of an Obsolete attribute.
14036 * class.cs (Method.GetMethodFlags): New public method to get the
14037 TypeManager.MethodFlags for this method.
14038 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
14040 (Method.Define): Get and apply the Obsolete and Conditional attributes;
14041 if we're overriding a virtual function, set the new private variable
14042 `parent_method'; call the new TypeManager.AddMethod().
14044 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
14045 the MethodBuilder and the Method in a PtrHashtable.
14046 (TypeManager.builder_to_method): Added for this purpose.
14047 (TypeManager.MethodFlags): Added IsObsoleteError.
14048 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
14049 Obsolete and Conditional arguments in MethodBuilders. If we discover
14050 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
14051 the message from the attribute.
14053 2002-07-24 Martin Baulig <martin@gnome.org>
14055 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
14056 preprocessor directives, ensure that the argument to #define/#undef is
14057 exactly one identifier and that it's actually an identifier.
14059 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
14062 2002-07-24 Martin Baulig <martin@gnome.org>
14064 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
14065 initialize it to TypeManager.object_type in the constructor.
14066 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
14067 of the `hm.get_current' method if we're using the collection pattern.
14068 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
14069 for the explicit conversion to make it work when we're using the collection
14070 pattern and the `Current' property has a different return type than `object'.
14073 2002-07-24 Martin Baulig <martin@gnome.org>
14075 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
14076 does not match, but don't report any errors. This method is called in
14077 order for all methods in a MethodGroupExpr until a matching method is
14078 found, so we don't want to bail out if the first method doesn't match.
14079 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
14080 matches, report the 123. Fixes #28070.
14082 2002-07-24 Martin Baulig <martin@gnome.org>
14084 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
14085 TypeManager.TypeToCoreType() to the top of the method so the
14086 following equality checks will work. Fixes #28107.
14088 2002-07-24 Martin Baulig <martin@gnome.org>
14090 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
14091 operand is of type uint, and the other operand is of type sbyte,
14092 short or int, the operands are converted to type long." -
14093 Actually do what this comment already told us. Fixes bug #28106,
14096 2002-07-24 Martin Baulig <martin@gnome.org>
14098 * class.cs (MethodBase): New abstract class. This is now a base
14099 class for Property, Indexer and Event to avoid some code duplication
14100 in their Define() and DefineMethods() methods.
14101 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
14102 generic methods for Define() and DefineMethods().
14103 (FieldBase): Derive from MemberBase, not MemberCore.
14104 (Property): Derive from MemberBase, not MemberCore.
14105 (Property.DefineMethod): Moved all the code from this method to the
14106 new MethodBase.DefineAccessor(), just call it with appropriate
14108 (Property.Define): Call the new Property.DoDefine(), this does some
14109 sanity checks and we don't need to duplicate the code everywhere.
14110 (Event): Derive from MemberBase, not MemberCore.
14111 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
14112 accessors, this will also make them work with interface events.
14113 (Indexer): Derive from MemberBase, not MemberCore.
14114 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14115 (Indexer.Define): Use the new MethodBase functions.
14117 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14118 argument to the constructor.
14119 (Interface.FindMembers): Added support for interface events.
14120 (Interface.PopluateEvent): Implemented.
14122 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14124 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14126 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14127 but this is required to check for a method name being the same as
14128 the containing class.
14132 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14134 * interface.cs: initialize variable.
14136 2002-07-23 Martin Baulig <martin@gnome.org>
14138 Implemented the IndexerName attribute in interfaces.
14140 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14141 name if this is an explicit interface implementation.
14142 (Indexer.InterfaceIndexerName): New public variable. If we're
14143 implementing an interface indexer, this is the IndexerName in that
14144 interface. Otherwise, it's the IndexerName.
14145 (Indexer.DefineMethod): If we're implementing interface indexer,
14146 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14147 and Pending.ImplementIndexer methods.
14148 (Indexer.Define): Also define the PropertyBuilder if we're
14149 implementing an interface indexer and this is neither an explicit
14150 interface implementation nor do the IndexerName match the one in
14153 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14154 If a method is defined here, then we always need to create a proxy
14155 for it. This is used when implementing interface indexers.
14156 (Pending.IsInterfaceIndexer): New public method.
14157 (Pending.ImplementIndexer): New public method.
14158 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14159 This is used when implementing interface indexers to define a proxy
14161 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14162 define a proxy if necessary.
14164 * interface.cs (Interface.IndexerName): New public variable.
14165 (Interface.PopulateIndexer): Set the IndexerName.
14166 (Interface.DefineIndexers): New private method. Populate all the
14167 indexers and make sure their IndexerNames match.
14169 * typemanager.cs (IndexerPropertyName): Added support for interface
14172 2002-07-22 Martin Baulig <martin@gnome.org>
14174 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14175 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14176 ret if HasReturnLabel.
14177 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14180 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14181 and set the ec.LoopBeginTryCatchLevel.
14182 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14183 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14184 the current ec.TryCatchLevel, the branch goes out of an exception
14185 block. In this case, we need to use Leave and not Br.
14187 2002-07-22 Martin Baulig <martin@gnome.org>
14189 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14190 block unless the block does not always return or it is contained in
14191 another try { ... } catch { ... } block. Fixes bug #26506.
14192 Added verify-1.cs to the test suite.
14194 2002-07-22 Martin Baulig <martin@gnome.org>
14196 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14197 then we do not always return. Fixes bug #24985.
14199 2002-07-22 Martin Baulig <martin@gnome.org>
14201 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14202 lookup on a per-class level; ie. walk up the class hierarchy until we
14203 found at least one applicable method, then choose the best among them.
14204 Fixes bug #24463 and test-29.cs.
14206 2002-07-22 Martin Baulig <martin@gnome.org>
14208 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14209 return types of the methods. The return type is not part of the
14210 signature and we must not check it to make the `new' modifier work.
14211 Fixes bug #27999, also added test-147.cs.
14212 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14214 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14215 on the method's return type.
14217 2002-07-21 Martin Baulig <martin@gnome.org>
14219 * assign.cs: Make this work if the rightmost source is a constant and
14220 we need to do an implicit type conversion. Also adding a few more tests
14221 to test-38.cs which should have caught this.
14223 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14224 target in the makefile for this. The makefile.gnu is primarily intended
14225 for end-users who don't want to debug the compiler.
14227 2002-07-21 Martin Baulig <martin@gnome.org>
14229 * assign.cs: Improved the Assign class so it can now handle embedded
14230 assignments (X = Y = Z = something). As a side-effect this'll now also
14231 consume less local variables. test-38.cs now passes with MCS, added
14232 a few new test cases to that test.
14234 2002-07-20 Martin Baulig <martin@gnome.org>
14236 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14237 instructions. Fixes bug #27977, also added test-146.cs.
14239 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14241 * cs-tokenizer.cs: fixed getHex ().
14243 2002-07-19 Martin Baulig <martin@gnome.org>
14245 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14246 not Type.GetType() to lookup the array type. This is needed when
14247 we're constructing an array of a user-defined type.
14248 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14249 single-dimensional arrays, but also for single-dimensial arrays of
14252 2002-07-19 Martin Baulig <martin@gnome.org>
14254 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14255 this function is called, it's not allowed to share LocalBuilders
14256 among ILGenerators.
14258 2002-07-19 Martin Baulig <martin@gnome.org>
14260 * expression.cs (Argument.Resolve): Report an error 118 when trying
14261 to pass a type as argument.
14263 2002-07-18 Martin Baulig <martin@gnome.org>
14265 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14266 Conv_R_Un for the signed `long' type.
14268 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14270 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14271 `expr' for the temporary result, as that will fail if we do
14272 multiple resolves on the same expression.
14274 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14276 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14277 ec.TypeContainer for looking up aliases.
14279 * class.cs (TypeContainer): Remove LookupAlias from here.
14281 * decl.cs (DeclSpace); Move here.
14283 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14285 * class.cs (FindMembers): Only call filter if the constructor
14286 bulider is not null.
14288 Also handle delegates in `NestedTypes' now. Now we will perform
14289 type lookups using the standard resolution process. This also
14292 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14293 This uses Expressions (the limited kind that can be parsed by the
14294 tree) instead of strings.
14296 * expression.cs (ComposedCast.ToString): Implement, used to flag
14297 errors since now we have to render expressions.
14299 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14302 * ecore.cs (SimpleName.ToString): ditto.
14304 * cs-parser.jay: Instead of using strings to assemble types, use
14305 Expressions to assemble the type (using SimpleName, ComposedCast,
14306 MemberAccess). This should fix the type lookups in declarations,
14307 because we were using a different code path for this.
14309 * statement.cs (Block.Resolve): Continue processing statements
14310 even when there is an error.
14312 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14314 * class.cs (Event.Define): Also remove the `remove' method from
14315 the list of pending items.
14317 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14318 generate more compact code.
14320 2002-07-17 Martin Baulig <martin@gnome.org>
14322 * const.cs (Const.LookupConstantValue): Add support for constant
14323 `unchecked' and `checked' expressions.
14324 Also adding test case test-140.cs for this.
14326 2002-07-17 Martin Baulig <martin@gnome.org>
14328 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14329 check whether mi.ReturnType implements the IEnumerator interface; the
14330 `==' and the IsAssignableFrom() will fail in this situation.
14332 2002-07-16 Ravi Pratap <ravi@ximian.com>
14334 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14337 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14339 * expression.cs: fixed bug #27811.
14341 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14343 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14344 Molaro: when we are a ref, the value already contains a pointer
14345 value, do not take the address of it.
14347 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14348 * removed mb-parser.jay and mb-tokenizer.cs
14350 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14352 * expression.cs: check against the building corlib void type.
14354 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14356 * ecore.cs: fix for valuetype static readonly fields: when
14357 initializing them, we need their address, not the address of a copy.
14359 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14361 * typemanager.cs: register also enum_type in corlib.
14363 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14365 * class.cs: allow calling this (but not base) initializers in structs.
14367 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14369 * ecore.cs: make sure we compare against the building base types
14372 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14374 * typemanager.cs: fix TypeToCoreType() to handle void and object
14375 (corlib gets no more typerefs after this change).
14377 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14379 * expression.cs (ArrayCreation.EmitArrayArguments): use
14380 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14382 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14383 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14384 array indexes, the runtime actually forbids them.
14386 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14387 for array arguments here.
14389 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14390 instead of the default for ValueTypes.
14392 (New.DoEmit): Use IsValueType instead of
14393 IsSubclassOf (value_type)
14394 (New.DoResolve): ditto.
14395 (Invocation.EmitCall): ditto.
14397 * assign.cs (Assign): ditto.
14399 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14400 Statements *are* currently doing part of their resolution during
14403 Expressions do always resolve during resolve, but statements are
14404 only required to propagate resolution to their children.
14406 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14408 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14410 (LoadAssembly): Do not add the dll if it is already specified
14412 (MainDriver): Add the System directory to the link path at the end,
14413 after all the other -L arguments.
14415 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14416 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14417 ldelem.u1) and using the opposite for sbytes.
14419 This fixes Digger, and we can finally run it.
14421 * driver.cs (UnixParseOption): Move the option parsing here.
14422 (CSCParseOption): Implement CSC-like parsing of options.
14424 We now support both modes of operation, the old Unix way, and the
14425 new CSC-like way. This should help those who wanted to make cross
14426 platform makefiles.
14428 The only thing broken is that /r:, /reference: and /lib: are not
14429 implemented, because I want to make those have the same semantics
14430 as the CSC compiler has, and kill once and for all the confussion
14431 around this. Will be doing this tomorrow.
14433 * statement.cs (Unsafe.Resolve): The state is checked during
14434 resolve, not emit, so we have to set the flags for IsUnsfe here.
14436 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14438 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14439 not catch the Error_ObjectRefRequired in SimpleName (as it is
14440 possible to have a class/instance variable name that later gets
14441 deambiguated), we have to check this here.
14443 2002-07-10 Ravi Pratap <ravi@ximian.com>
14445 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14446 make static and put into Expression.
14448 (Event.Define): Register the private field of the event with the
14449 TypeManager so that GetFieldFromEvent can get at it.
14451 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14452 keep track of the private field associated with an event which
14455 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14458 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14460 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14462 * expression.cs (Binary.EmitBranchable): this routine emits the
14463 Binary expression in a branchable context. This basically means:
14464 we need to branch somewhere, not just get the value on the stack.
14466 This works together with Statement.EmitBoolExpression.
14468 * statement.cs (Statement.EmitBoolExpression): Use
14471 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14473 * statement.cs (For): Reduce the number of jumps in loops.
14475 (For): Implement loop inversion for the For statement.
14477 (Break): We can be breaking out of a Try/Catch controlled section
14478 (foreach might have an implicit try/catch clause), so we need to
14479 use Leave instead of Br.
14481 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14482 now). If the instace expression supports IMemoryLocation, we use
14483 the AddressOf method from the IMemoryLocation to extract the
14484 address instead of emitting the instance.
14486 This showed up with `This', as we were emitting the instance
14487 always (Emit) instead of the Address of This. Particularly
14488 interesting when This is a value type, as we dont want the Emit
14489 effect (which was to load the object).
14491 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14493 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14495 * statement.cs (Checked): Set the CheckedState during the resolve
14496 process too, as the ConvCast operations track the checked state on
14497 the resolve process, and not emit.
14499 * cs-parser.jay (namespace_member_declaration): Flag that we have
14500 found a declaration when we do. This is used to flag error 1529
14502 * driver.cs: Report ok when we display the help only.
14504 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14506 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14508 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14510 * cs-tokenizer.cs (define): We also have to track locally the
14511 defines. AllDefines is just used for the Conditional Attribute,
14512 but we also need the local defines for the current source code.
14514 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14516 * statement.cs (While, For, Do): These loops can exit through a
14517 Break statement, use this information to tell whether the
14518 statement is the last piece of code.
14520 (Break): Flag that we break.
14522 * codegen.cs (EmitContexts): New `Breaks' state variable.
14524 2002-07-03 Martin Baulig <martin@gnome.org>
14526 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14527 modifiers in method declarations in structs. Otherwise, you won't
14528 be able to override things like Object.Equals().
14530 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14532 * class.cs (Method, Property, Indexer): Do not allow the public
14533 modifier to be used in explicit interface implementations.
14535 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14536 override modifiers in method declarations in structs
14538 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14540 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14541 integer or real overflow, report an error
14543 2002-07-02 Martin Baulig <martin@gnome.org>
14545 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14546 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14547 to tell the runtime about our newly created System.Object and
14548 System.ValueType types.
14550 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14552 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14553 struct instead of Ldarg/Starg.
14555 2002-07-02 Martin Baulig <martin@gnome.org>
14557 * expression.cs (Indirection.Indirection): Call
14558 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14560 2002-07-02 Martin Baulig <martin@gnome.org>
14562 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14563 ValueType, call TypeManager.TypeToCoreType() on it.
14564 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14565 the OpCodes.Newarr argument.
14567 2002-07-02 Martin Baulig <martin@gnome.org>
14569 * expression.cs (Invocation.EmitCall): When compiling corlib,
14570 replace all calls to the system's System.Array type to calls to
14571 the newly created one.
14573 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14574 System.Array methods.
14575 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14576 from the system's System.Array type which must be replaced.
14578 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14580 * typemanager.cs: load unverifiable_code_ctor so we can build
14581 corlib using the correct type. Avoid using GetTypeCode() with
14583 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14584 TypeManager.object_type to allow building corlib.
14586 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14588 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14590 2002-07-01 Martin Baulig <martin@gnome.org>
14592 * class.cs: Make the last change actually work, we need to check
14593 whether `ifaces != null' to avoid a crash.
14595 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14597 * class.cs: when we build structs without fields that implement
14598 interfaces, we need to add the interfaces separately, since there is
14599 no API to both set the size and add the interfaces at type creation
14602 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14604 * expression.cs: the dimension arguments to the array constructors
14605 need to be converted if they are a long.
14607 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14609 * class.cs: don't emit ldarg.0 if there is no parent constructor
14610 (fixes showstopper for corlib).
14612 2002-06-29 Martin Baulig <martin@gnome.org>
14614 MCS now compiles corlib on GNU/Linux :-)
14616 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14617 ie. check for MethodImplOptions.InternalCall.
14619 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14620 and TypeManager.attribute_type are null, so we must explicitly check
14621 whether parent is not null to find out whether it's an attribute type.
14622 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14623 and SetBuilder, not only if the property is neither abstract nor external.
14624 This is necessary to set the MethodImplOptions on the accessor methods.
14625 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14626 SetBuilder, see Property.Emit().
14628 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14629 populate "System.Object", "System.ValueType" and "System.Attribute" since
14630 they've already been populated from BootCorlib_PopulateCoreTypes().
14632 2002-06-29 Martin Baulig <martin@gnome.org>
14634 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14635 is the NullLiteral, we also need to make sure that target_type is not
14638 2002-06-29 Martin Baulig <martin@gnome.org>
14640 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14641 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14642 before calling BootstrapCorlib_ResolveDelegate ().
14644 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14646 * statement.cs: fixed build-breaker. All tests passed ok.
14648 2002-06-27 Martin Baulig <martin@gnome.org>
14650 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14651 for System.Decimal when compiling corlib.
14653 2002-06-27 Martin Baulig <martin@gnome.org>
14655 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14656 switch blocks which contain nothing but a default clause.
14658 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14660 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14662 2002-06-27 Martin Baulig <martin@gnome.org>
14664 * ecore.cs (PropertyExpr.PropertyExpr): Call
14665 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14667 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14668 is already a TypeBuilder.
14670 2002-06-27 Martin Baulig <martin@gnome.org>
14672 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14673 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14674 the "from an array-type to System.Array" case. This makes it work
14675 when compiling corlib.
14677 2002-06-27 Martin Baulig <martin@gnome.org>
14679 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14680 non-static PropertyExpr, set its InstanceExpression. This makes
14681 the `ICollection.Count' property work in System/Array.cs.
14683 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14685 * driver.cs: Made error handling more consistent. Errors now
14686 tracked by Report class, so many methods which used to return int
14687 now return void. Main() now prints success/failure and
14688 errors/warnings message.
14690 Renamed '--probe' compiler argument to '--expect-error'. Removed
14691 the magic number return values (123 and 124). Now, if the
14692 expected error occurs, the compiler exits with success (exit value
14693 0). If the compilation completes without seeing that particular
14694 error, the compiler exits with failure (exit value 1). The
14695 makefile in mcs/errors has been changed to handle the new behaviour.
14697 * report.cs: Made 'expected error' number a property and renamed
14698 it from 'Probe' to 'ExpectedError'.
14700 * genericparser.cs: Removed error handling support, since it is
14701 now all done by Report class.
14703 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14704 class, so parse() no longer returns an int.
14706 * namespace.cs: Use Report.Error instead of GenericParser.error
14708 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14710 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14711 TypeContainer.AddOperator): At the front of the list put the
14712 explicit implementations, so they get resolved/defined first.
14714 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14716 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14717 interface type is implemented by this TypeContainer. Used during
14718 explicit interface implementation.
14720 (Property.Define, Indexer.Define, Method.Define): Validate that
14721 the given interface in the explicit implementation is one of the
14722 base classes for the containing type.
14724 Also if we are explicitly implementing an interface, but there is
14725 no match in the pending implementation table, report an error.
14727 (Property.Define): Only define the property if we are
14728 not explicitly implementing a property from an interface. Use the
14729 correct name also for those properties (the same CSC uses,
14730 although that is really not needed).
14732 (Property.Emit): Do not emit attributes for explicitly implemented
14733 properties, as there is no TypeBuilder.
14735 (Indexer.Emit): ditto.
14737 Hiding then means that we do not really *implement* a pending
14738 implementation, which makes code fail.
14740 2002-06-22 Martin Baulig <martin@gnome.org>
14742 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14743 the return value of Object.GetType(). [FIXME: we need to do this whenever
14744 we get a type back from the reflection library].
14746 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14748 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14750 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14752 * attribute.cs: Return null if we can not look up the type.
14754 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14755 the interface types found.
14757 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14758 interface types found.
14760 * typemanager.cs (GetInterfaces): Make this routine returns alll
14761 the interfaces and work around the lame differences between
14762 System.Type and System.Reflection.Emit.TypeBuilder in the results
14763 result for GetInterfaces.
14765 (ExpandInterfaces): Given an array of interface types, expand and
14766 eliminate repeated ocurrences of an interface. This expands in
14767 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14770 2002-06-21 Martin Baulig <martin@gnome.org>
14772 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14775 2002-06-21 Martin Baulig <martin@gnome.org>
14777 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14778 and called with one of the core types, return the corresponding typebuilder for
14781 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14784 2002-06-21 Martin Baulig <martin@gnome.org>
14786 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14787 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14788 (Expression.ConvertReferenceExplicit): Likewise.
14790 * expression.cs (ElementAccess.DoResolve): Likewise.
14791 (ElementAccess.DoResolveLValue): Likewise.
14793 2002-06-10 Martin Baulig <martin@gnome.org>
14795 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14796 add the "value" parameter to the parameter list.
14798 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14801 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14803 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14804 the argument to an int, uint, long or ulong, per the spec. Also
14805 catch negative constants in array creation.
14807 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14809 * class.cs: do not allow the same interface to appear twice in
14810 the definition list.
14812 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14814 * ecore.cs: don't use ldlen with System.Array.
14816 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14818 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14820 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14822 * modifiers.cs: produce correct field attributes for protected
14823 internal. Easy fix so miguel can work on ther harder stuff:-)
14825 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14827 * pending.cs: New file. Move the code from class.cs here.
14828 Support clearning the pending flag for all methods (when not doing
14829 explicit interface implementation).
14831 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14833 * rootcontext.cs: added a couple more types needed to bootstrap.
14835 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14837 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14838 constructor in the type, instead of any constructor in the type
14839 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14840 a bug in the Mono runtime when applying the params attribute).
14842 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14843 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14845 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14847 * expression.cs (Unary.ResolveOperator): Use TypeManager
14848 to resolve the type.
14850 2002-06-13 Ravi Pratap <ravi@ximian.com>
14852 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14855 * enum.cs (AddEnumMember): Add support to store the attributes associated
14856 with each member too.
14858 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14859 field builders too - this takes care of the enum member case.
14861 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14863 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14864 address-of operator on both value types and pointers.
14866 2002-06-10 Martin Baulig <martin@gnome.org>
14868 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14869 PropertyBuilder to the `property_builders' list.
14871 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14872 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14873 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14874 find any indexers which are inherited from an interface.
14876 2002-06-09 Martin Baulig <martin@gnome.org>
14878 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14879 the same type as the constant if necessary. There's also a test-130.cs
14882 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14884 * typemanager.cs (TypeManager.ChangeType): Previously known as
14885 Enum.ChangeEnumType().
14887 2002-06-09 Martin Baulig <martin@gnome.org>
14889 * expression.cs (Cast.TryReduce): Added support for consts.
14891 2002-06-08 Ravi Pratap <ravi@ximian.com>
14893 * class.cs (Accessor): Hold attributes information so we can pass
14896 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14897 Modify to pass in attributes attached to the methods.
14899 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14901 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14902 to handle the Accessor kind :-)
14904 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14906 2002-06-08 Martin Baulig <martin@gnome.org>
14908 * expression.cs (Unary.TryReduceNegative): Added support for
14911 2002-06-08 Martin Baulig <martin@gnome.org>
14913 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14914 name can't be found in the `defined_names' - the caller will do a
14915 MemberLookup in this case and thus find methods in System.Enum
14916 such as Enum.IsDefined().
14918 2002-06-08 Martin Baulig <martin@gnome.org>
14920 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14921 Convert.ChangeType() which works with TypeBuilder created types.
14922 (Enum.LookupEnumValue, Enum.Define): Use it here.
14924 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14925 `TypeBuilder.BaseType != null' check.
14926 (TypeContainer.FindMembers): Only lookup parent members if we
14927 actually have a parent.
14928 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14929 (ConstructorInitializer.Resolve): Likewise.
14931 * interface.cs (Interface.FindMembers): Added
14932 `TypeBuilder.BaseType != null' check.
14934 * rootcontext.cs (RootContext.ResolveCore): Added
14935 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14936 classes_second_stage.
14938 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14939 debug_type and trace_type when compiling with --nostdlib.
14941 2002-06-07 Martin Baulig <martin@gnome.org>
14943 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14944 (AddField): Set it to true when adding a non-static field.
14945 (DefineType): Use `have_nonstatic_fields' to find out whether we
14946 have non-static fields, not `Fields != null'.
14948 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14950 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14951 dereferencing a null on the static-field code path)
14953 2002-05-30 Martin Baulig <martin@gnome.org>
14955 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14956 to take command line arguments. Use reflection to call the new
14957 custom `Initialize' function on the symbol writer and pass it the
14958 command line arguments.
14960 * driver.cs (--debug-args): New command line argument to pass command
14961 line arguments to the symbol writer.
14963 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14965 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14966 the target type for indexers and properties. Thanks to Joe for
14969 2002-05-27 Miguel de Icaza <miguel@ximian.com>
14971 * typemanager.cs (MethodFlags): returns the method flags
14972 (Obsolete/ShouldIgnore) that control warning emission and whether
14973 the invocation should be made, or ignored.
14975 * expression.cs (Invocation.Emit): Remove previous hack, we should
14976 not do this on matching a base type, we should do this based on an attribute
14978 Only emit calls to System.Diagnostics.Debug and
14979 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
14980 on the command line.
14982 * rootcontext.cs: Global settings for tracing and debugging.
14984 * cs-tokenizer.cs (define): New utility function to track
14985 defines. Set the global settings for TRACE and DEBUG if found.
14987 2002-05-25 Ravi Pratap <ravi@ximian.com>
14989 * interface.cs (Populate*): Pass in the TypeContainer as well as
14990 the DeclSpace as parameters so that we can create EmitContexts and
14991 then use that to apply attributes etc.
14993 (PopulateMethod, PopulateEvent, PopulateProperty)
14994 (PopulateIndexer): Apply attributes everywhere.
14996 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
14999 (ApplyAttributes): Update accordingly.
15001 We now apply interface attributes for all members too.
15003 2002-05-26 Miguel de Icaza <miguel@ximian.com>
15005 * class.cs (Indexer.Define); Correctly check if we are explicit
15006 implementation (instead of checking the Name for a ".", we
15007 directly look up if the InterfaceType was specified).
15009 Delay the creation of the PropertyBuilder.
15011 Only create the PropertyBuilder if we are not an explicit
15012 interface implementation. This means that explicit interface
15013 implementation members do not participate in regular function
15014 lookups, and hence fixes another major ambiguity problem in
15015 overload resolution (that was the visible effect).
15017 (DefineMethod): Return whether we are doing an interface
15020 * typemanager.cs: Temporary hack until we get attributes in
15021 interfaces (Ravi is working on that) and we get IndexerName
15022 support in interfaces.
15024 * interface.cs: Register the indexers as properties.
15026 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
15027 warning, I have verified that this is a bug in the .NET runtime
15028 (JavaScript suffers of the same problem).
15030 * typemanager.cs (MemberLookup): When looking up members for
15031 interfaces, the parent of an interface is the implicit
15032 System.Object (so we succeed in searches of Object methods in an
15033 interface method invocation. Example: IEnumerable x; x.ToString
15036 2002-05-25 Miguel de Icaza <miguel@ximian.com>
15038 * class.cs (Event): Events should also register if they do
15039 implement the methods that an interface requires.
15041 * typemanager.cs (MemberLookup); use the new GetInterfaces
15044 (GetInterfaces): The code used to lookup interfaces for a type is
15045 used in more than one place, factor it here.
15047 * driver.cs: Track the errors at the bottom of the file, we kept
15050 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
15051 instance if the method we are calling is static!
15053 2002-05-24 Miguel de Icaza <miguel@ximian.com>
15055 * attribute.cs (ApplyAttributes): Make this function filter out
15056 the IndexerName attribute (as that attribute in reality is never
15057 applied) and return the string constant for the IndexerName
15060 * class.cs (TypeContainer.Emit): Validate that all the indexers
15061 have the same IndexerName attribute, and if so, set the
15062 DefaultName attribute on the class.
15064 * typemanager.cs: The return value might contain other stuff (not
15065 only methods). For instance, consider a method with an "Item"
15066 property and an Item method.
15068 * class.cs: If there is a problem with the parameter types,
15071 2002-05-24 Ravi Pratap <ravi@ximian.com>
15073 * ecore.cs (ImplicitConversionExists): Wrapper function which also
15074 looks at user defined conversion after making a call to
15075 StandardConversionExists - we need this for overload resolution.
15077 * expression.cs : Update accordingly the various method calls.
15079 This fixes 2 bugs filed against implicit user defined conversions
15081 2002-05-22 Miguel de Icaza <miguel@ximian.com>
15083 * statement.cs: Track the result of the assignment.
15085 2002-05-21 Miguel de Icaza <miguel@ximian.com>
15087 * expression.cs (MemberAccess): Improved error reporting for
15088 inaccessible members.
15090 2002-05-22 Martin Baulig <martin@gnome.org>
15092 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
15093 itself with debugging support.
15095 2002-05-22 Martin Baulig <martin@gnome.org>
15097 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
15098 Removed, this isn't needed anymore.
15100 2002-05-20 Martin Baulig <martin@gnome.org>
15102 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
15103 be underlying type for an enum.
15105 2002-05-20 Miguel de Icaza <miguel@ximian.com>
15107 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
15108 that splits out the loading of just the core types.
15110 * rootcontext.cs (ResolveCore): Split the struct resolution in
15111 two, so we can load the enumeration underlying types before any
15114 * expression.cs (Is): Bandaid until we fix properly Switch (see
15115 bug #24985 for details).
15117 * typemanager.cs (ImplementsInterface): The hashtable will contain
15118 a null if there are no interfaces implemented.
15120 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15122 * cs-parser.jay (indexer_declarator): It is fine to have array
15125 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15127 * typemanager.cs: (RegisterBuilder): New function used to register
15128 TypeBuilders that implement interfaces. Since
15129 TypeBuilder.GetInterfaces (as usual) does not work with lame
15131 (AddUserType): register interfaces.
15133 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15134 dealing with TypeBuilder. Also, arrays are showing up as
15135 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15136 methods can not be invoked on them!
15138 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15139 (ImplicitReferenceConversionExists): Split out from
15140 StandardConversionExists.
15142 * expression.cs (As): We were only implementing one of the three
15143 cases for the as operator. We now implement them all.
15144 (Is): Implement the various other cases for Is as well.
15146 * typemanager.cs (CACHE): New define used to control if we want or
15147 not the FindMembers cache. Seems to have a negative impact on
15148 performance currently
15150 (MemberLookup): Nested types have full acess to
15151 enclosing type members
15153 Remove code that coped with instance/static returns for events, we
15154 now catch this in RealFindMembers.
15156 (RealFindMembers): only perform static lookup if the instance
15157 lookup did not return a type or an event.
15159 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15161 * assign.cs (CompoundAssign): We pass more semantic information
15162 now to Compound Assignments than we did before: now we have all
15163 the information at hand, and now we resolve the target *before* we
15164 do the expression expansion, which allows the "CacheValue" method
15165 to have the effect we intended (before, a [x] += 1 would generate
15166 two differen ArrayAccess expressions from the ElementAccess,
15167 during the resolution process).
15169 (CompoundAssign.DoResolve): Resolve target and original_source here.
15171 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15173 * expression.cs (ArrayAccess): dropped debugging information.
15175 * typemanager.cs: Small bug fix: I was always returning i_members,
15176 instead of one of i_members or s_members (depending on which had
15179 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15180 method is invoked before any code generation takes place, and it
15181 is a mechanism to inform that the expression will be invoked more
15182 than once, and that the method should use temporary values to
15183 avoid having side effects
15185 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15187 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15190 * expression.cs (Indirection, ArrayAccess): Add support for
15191 CacheTemporaries in these two bad boys.
15193 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15194 ldobj or ldind_ref.
15195 (StoreFromPtr): Handle stobj as well.
15197 * expression.cs (UnaryMutator): Share more code.
15199 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15200 down: I was not tracking the Filter function as well, which
15201 was affecting the results of the cache.
15203 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15205 * attribute.cs: Remove the hack to handle the CharSet property on
15208 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15210 * attribute.cs (DoResolve): More uglyness, we now only try to
15211 resolve the attribute partially, to extract the CharSet
15212 information (only if we are a StructLayout attribute). Otherwise
15214 (GetExtraTypeInfo): Add some code to conditionally kill in the
15215 future this. I am more and more convinced that the .NET
15216 framework has special code to handle the attribute setting on
15219 * expression.cs (IsParamsMethodApplicable): Revert my previous
15220 foreach change here, it was wrong.
15222 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15224 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15225 (pp_expr): do not abort on unknown input, just return.
15226 (eval): abort if there are pending chars.
15228 * attribute.cs (Attribute.Resolve): Positional parameters are
15229 optional. Deal with that case.
15231 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15232 the Ansi/Unicode/Auto information for the type.
15234 (TypeContainer.DefineType): instantiate the EmitContext here, as
15235 we will be using it during the type definition (to resolve
15236 attributes) and during the emit phase.
15238 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15239 to pull type information out of the attributes
15241 (Attribute.Resolve): track the constructor builder, and allow for
15242 multiple invocations (structs and classes will use this).
15244 * ecore.cs (MemberLookupFinal): new version with all the
15245 parameters customizable.
15247 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15248 constructors. Return if the result value is null (as the error
15249 would have been flagged already by MemberLookupFinal)
15251 Do not allow instances of abstract classes or interfaces to be
15254 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15255 We have to compare the assembly property here when dealing with
15256 FamANDAssem and Assembly access modifiers, because we might be
15257 creating an assembly from *modules* (that means that we are not
15258 getting TypeBuilders for types defined in other modules that are
15259 part of this assembly).
15261 (Method.Emit): If the method is marked abstract and has a body,
15264 (TypeContainer.DefineMembers): If both the defined member and the
15265 parent name match are methods, then do not emit any warnings: let
15266 the Method.Define routine take care of flagging warnings. But if
15267 there is a mismatch (method overrides something else, or method is
15268 overriwritten by something, then emit warning).
15270 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15271 set to null, this means `do not check for the return type on the
15274 (Method.Define): set the return type for the method signature to
15275 null, so that we get methods with the same name and parameters and
15276 different return types. This is used to flag warning 114 (you are
15277 hiding a method, and you probably want to use the new/override
15280 * typemanager.cs (MemberLookup): Implemented proper access
15281 control, closing a long standing set of bug reports. The problem
15282 was that the Framework only has two bits: Public and NonPublic,
15283 and NonPublic includes private and protected methods, but we need
15284 to enforce the FamANDAssem, FamOrAssem and Family.
15286 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15288 * statement.cs (GotoCase): Return true: Ammounts to giving up
15289 knowledge on whether we return or not, and letting the other case
15290 be responsible for it.
15292 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15294 * driver.cs: Do not load directories for each file processed, only
15295 do it if there is a pattern.
15297 * ecore.cs: Report readonly assigns here as well, as we might have
15298 been resolved only by MemberAccess.
15300 (SimpleName.SimpleNameResolve): Also be useful for LValue
15301 resolution. We need this to propagate assign to local readonly variables
15303 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15304 do not want to reuse potential criteria memory.
15306 * class.cs (MyEventBuilder): Set reflected_type;
15308 * ecore.cs (Constantify): Added support for constifying bools.
15310 (RootContext.LookupType): Added a cache for values looked up in
15311 the declaration space.
15313 * typemanager.cs (FindMembers): Now is a front-end to
15314 RealFindMembers, and provides a two-level hashtable-based cache to
15317 15% performance improvement: from 22.5 to 19.2 seconds.
15319 * expression.cs (IsParamsMethodApplicable): use foreach.
15320 (Invocation.DoResolve): ditto.
15321 (New.DoResolve): ditto.
15322 (ArrayCreation.DoResolve): ditto.
15324 * ecore.cs (FindMostEncompassingType): use foreach.
15326 * delegate.cs (NewDelegate.DoResolve): Use foreach
15328 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15329 (RemoveMethods): use foreach.
15331 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15332 nested foreach statements instead of for, and also break out of
15333 the inner loop once a match is found.
15335 (Invocation.OverloadResolve): Use foreach, simplify the code.
15337 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15339 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15340 we actually unwrap the expression to allow for extra information
15343 * expression.cs: Use Shr_Un on unsigned operations.
15345 2002-05-08 Ravi Pratap <ravi@ximian.com>
15347 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15348 applicable operators was not being considered correctly. This closes
15349 the bug Miguel reported.
15351 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15353 * attribute.cs: check that the type derives from System.Attribute
15354 and report the correct error in that case (moved the duplicate code to
15355 its own method, too).
15357 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15359 * attribute.cs: lookup attribute type name as the spec says: first the
15360 bare attribute name and then name + "Attribute" (nant compiles with
15361 mcs after this fix).
15363 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15365 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15366 Because of the way we parse things, we should try to see if a
15367 UIntConstant can fit in an integer.
15369 2002-05-07 Ravi Pratap <ravi@ximian.com>
15371 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15372 when we are in an explicit context.
15374 (ConvertReferenceExplicit): When converting from Iface type S to Class
15375 T make sure the rules are implemented as an OR.
15377 * parameter.cs (ParameterType): Make it a property for now although the
15378 purpose really isn't anything immediate.
15380 * expression.cs (Is*Applicable): Do better checking on the parameter type
15381 of a ref/out parameter. The ones from the system assemblies are already
15382 marked with the correct type so we don't need to do any correction.
15384 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15385 the object type is standard too so include that.
15387 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15389 * ecore.cs (StandardConversionExists): Augment with missing code:
15390 deal with IntConstant, LongConstants and Enumerations.
15392 * assign.cs: Report the error, instead of failing silently
15394 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15395 typecontainer that they are declared, because the
15396 typecontainer/namespace will have the list of using clauses that
15397 need to be applied.
15399 Assembly Attributes were escaping the normal registration
15402 (EmitCode): Apply attributes within an EmitContext that represents
15403 the container they were declared on.
15405 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15407 2002-05-06 Ravi Pratap <ravi@ximian.com>
15409 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15410 Revamp completely - make much cleaner as we now operate only
15413 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15414 to implement the logic detailed in the spec more correctly.
15416 (UserDefinedConversion): Update accordingly.
15418 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15420 * statement.cs: Return flow analysis information up.
15422 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15425 (token): Do not consume an extra character before calling
15428 2002-05-06 Piers Haken <piersh@friskit.com>
15430 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15432 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15434 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15435 EmitContext during the instance constructor initializer
15436 resolution, to stop access to instance variables.
15438 This is mandated by the spec, last paragraph of the `constructor
15439 initializers' section.
15441 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15443 * cs-parser.jay, class.cs (Accessor): new class used to represent
15444 an accessor (get or set). In the past we used `null' to represent
15445 a missing accessor. But this is ambiguous because there was no
15446 way to tell in abstract indexers/properties if one of them was
15449 Now there is a way of addressing that.
15451 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15452 instead of FindMembers.
15454 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15455 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15457 * attribute.cs: Treat indexers and properties as the same in terms
15458 of applying attributes
15460 * ecore.cs (FindMostEncompassedType): Use statically initialized
15461 EmptyExpressions()s like we do elsewhere to avoid creating useless
15462 objects (and we take this out of the tight loop).
15464 (GetConversionOperators): Move the code to extract the actual
15465 operators to a separate routine to clean things up.
15467 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15469 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15470 events are always registered FieldBuilders.
15472 * class.cs (FieldBase): New class shared by Fields
15474 * delegate.cs: If we are a toplevel delegate, use our full name.
15475 If we are a nested delegate, then only use our tail name.
15477 2002-05-02 Ravi Pratap <ravi@ximian.com>
15479 * expression.cs (IsApplicable): Ensure that we add the "&" to
15480 ref/out types before comparing it with the type of the argument.
15482 (IsParamsMethodApplicable): Ditto.
15484 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15487 * delegate.cs : Handle the case when we have more than one applicable
15488 method. Flag an error only when we finish checking all.
15490 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15492 * expression.cs: Add support for boolean static initializers.
15494 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15496 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15498 * parameter.cs (ComputeParameterTypes,
15499 ComputeAndDefineParameterTypes): Better error handling: now we
15500 clear the `types' cache if we fail during any of the type lookups.
15501 We also return the status code correctly to our caller
15503 * delegate.cs: If we fail to define a delegate, abort the extra
15506 * expression.cs (Binary.ResolveOperator): for
15507 operator==(object,object) and operator !=(object, object) we also
15508 have to verify that there is an implicit conversion from one to
15511 (ArrayAccess.DoResolve): Array Access can operate on
15514 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15516 * assign.cs (CompoundAssign): A new class used as a "flag" that
15517 the assignment actually is happening as part of a compound
15518 assignment operator.
15520 During compound assignment, a few new rules exist to enable things
15527 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15528 to the type of x) if y is implicitly convertible to the type of x,
15529 and the operator is a builtin operator and the return type of the
15530 operator is explicitly convertible to the type of x.
15532 * rootcontext.cs: Reset warning level to 2. 4 catches various
15533 "interesting" features in mcs, we must clean this up at some
15534 point, but currently am trying to kill other bugs ;-)
15536 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15537 in container classes as well.
15539 * expression.cs (Binary.ResolveOperator): Handle string case
15540 before anything else (as operator overloading does emit an error
15541 before doing anything else).
15543 This code could go away when we move to a table driven model, but
15544 i could not come up with a good plan last night.
15546 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15548 * typemanager.cs (CSharpName): reimplementation using regex.
15549 * class.cs: added null check for fields in Emit
15550 * rootcontext.cs: set warninglevel to 4
15552 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15554 * typemanager.cs (CSharpName): reimplemented with Lupus
15557 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15559 * statement.cs (If): correclty implement Resolve, because we were
15560 not catching sem errors in there. The same process is needed
15562 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15565 (Statement.Warning_DeadCodeFound): Factorize code.
15566 (While): Report dead code here too.
15568 (Statement): Added Resolve virtual method to allow
15569 for resolution split from the emit code.
15571 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15573 * statement.cs (EmitBoolExpression): No longer try to resolve the
15575 (MakeBoolean): New utility function that resolve, implicitly
15576 converts to boolean and tags the expression.
15579 (If, Do): Implement dead code elimination.
15580 (While): Implement loop inversion
15582 (Do, While, For, If): Resolve the expression prior to calling our
15585 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15588 - added method Report28 (warning: program has more than one entry point)
15589 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15590 - modified method Method.Define, the part at the end of the method
15592 * rootcontext.cs: added static public Location EntryPointLocation;
15594 * ../errors/cs0028.cs : Add test case for the above warning.
15597 - modified method CSharpName to allow arrays of primitive type to
15598 be printed nicely (e.g. instead of System.Int32[][] it now prints
15600 - added method CSharpSignature: returns the signature of a method
15601 in string format to be used in reporting errors, warnings, etc.
15603 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15606 2002-04-26 Ravi Pratap <ravi@ximian.com>
15608 * delegate.cs (Define): Fix extremely silly bug where I was
15609 setting the type of the 'object' parameter of the BeginInvoke
15610 method to System.IAsyncResult instead of System.Object ;-)
15612 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15614 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15617 (Constructor.Emit): return if we fail to initialize the
15618 constructor. Another door closed!
15620 * expression.cs (New.DoResolve): Improve error message (from -6 to
15621 1501). Use DeclaredOnly lookup to find the exact constructor.
15623 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15624 loop. This is useful.
15626 * cs-parser.jay: Adjust the default parameters so that destructors
15627 have the proper signature.
15629 2002-04-26 Martin Baulig <martin@gnome.org>
15631 * driver.cs (LoadAssembly): If `assembly' contains any characters
15632 which are only valid in path names and not in assembly names
15633 (currently slash, backslash and point), use Assembly.LoadFrom ()
15634 instead of Assembly.Load () on the `assembly' (before iteration
15635 over the link_paths).
15637 2002-04-26 Martin Baulig <martin@gnome.org>
15639 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15641 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15643 * class.cs (Property): use the new typemanager.MemberLookup
15645 (TypeContainer.MemberLookup): Implement using the
15646 TypeManager.MemberLookup now.
15648 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15649 and return MemberInfos, so that these can be used without an
15650 EmitContext (what we had before).
15652 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15654 * expression.cs: Fix the case where the argument to params if the
15655 type of the params. I omitted handling this before. Fixed
15657 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15659 * driver.cs: Call BootCorlib_PopulateCoreType
15661 * class.cs (Property.CheckBase): Check for properties only, not
15664 * interface.cs: Temporary hack: try/catch around the
15665 CustomAttributeBuilder, because I am getting an exception that I
15668 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15669 types whose definitions are required to be there (attributes are
15670 defined before standard types).
15672 Compute definitions as we boot the various types, as they are used
15673 immediately (value_type class will need object_type, but if we do
15674 not initialize object_type, we will pass a null, which will let
15675 the runtime pick the System.Object from the existing corlib, which
15676 is not what we want).
15678 2002-04-22 Patrik Torstensson <totte@labs2.com>
15680 * cs-tokenizer.cs: fixed a number of trim() issues.
15682 2002-04-22 Ravi Pratap <ravi@ximian.com>
15684 * expression.cs (Argument.Type): Ensure that we return the correct
15685 type when we have out or ref parameters [in which case we
15688 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15690 * class.cs (Property, Indexer): Allow extern modifier in there.
15692 * typemanager.cs (InitBaseTypes): Initializes object_type and
15693 value_type, since those will be used early on during the bootstrap
15694 process to compile corlib.
15696 (InitCoreTypes): Move code from here to InitBaseTypes.
15698 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15700 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15701 single-dimension arrays as using the ldlen opcode.
15703 Daniel Lewis discovered this optimization.
15705 * typemanager.cs: Add signature for System.Array::get_Length
15707 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15709 * statement.cs: report the error when the foreach does not apply to an
15710 array nor a collection.
15712 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15714 * expression.cs: Add implicit conversions to the operator ~.
15716 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15718 * typemanager.cs: Locate the decimal constructor.
15720 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15722 * attribute.cs: use the new property of TypeOf.
15723 * expression.cs: added 'get' property around typearg.
15725 These changes fix a build breaker reported by NickD. Is this the
15726 correct way to fix? If not, please, revert my changes and make it
15729 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15731 * attribute.cs: Add support for typeof in attribute invocations.
15732 I am not sure that this is right though.
15734 2002-04-14 Duncan Mak <duncan@ximian.com>
15736 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15737 Binary.Operator.Division case.
15739 2002-04-13 Ravi Pratap <ravi@ximian.com>
15741 * class.cs (DefineType): Ensure that we do a proper check on
15742 attribute types and also register it with the TypeManager.
15744 (TypeContainer.Targets): The default for attribute types is
15745 AttributeTargets.All.
15747 * attribute.cs (ApplyAttributes): Registering the attribute type
15748 is done elsewhere, not when we discover we have a Usage attribute.
15750 2002-04-12 Ravi Pratap <ravi@ximian.com>
15752 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15753 and get rid of is_delegate parameter.
15755 * everywhere : update.
15757 2002-04-12 Ravi Pratap <ravi@ximian.com>
15759 * cs-parser.jay (compilation_unit): Revamp completely to use
15760 some new ideas that I got from Rhys' grammar to solve the problems
15761 with assembly level attributes.
15763 (outer_declaration): New grammar production.
15765 (attribute_sections): Add.
15767 (opt_attributes): Base on attribute_sections
15769 (namespace_declaration): Allow opt_attributes to tackle the case
15770 when we have assembly level attributes - we are clever in this
15773 * attribute.cs (ApplyAttributes): Do not worry about assembly
15774 attributes in the non-global context.
15776 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15777 instead of SetGlobalAttributes.
15779 * class.cs, rootcontext.cs : Ensure we define and generate
15780 attribute types before anything else.
15782 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15783 and flag the new error -20 for the case when the attribute type
15784 does not have valid targets specified. csc does not catch this.
15786 * ../errors/errors.txt : update for error # -20
15788 2002-04-11 Ravi Pratap <ravi@ximian.com>
15790 * support.cs (InternalParameters.ParameterModifier): Do some null
15791 checking and return sane values.
15793 * class.cs (Method.Define): If we are a PInvoke method, ensure
15794 that we are static and extern. Report error # 601
15796 * ../errors/cs0601.cs : Add test case for the above error.
15798 2002-04-07 Ravi Pratap <ravi@ximian.com>
15800 * rootcontext.cs (attribute_types): We need to keep type of
15801 all attribute types separately and emit code for them first.
15803 (RegisterAttribute) : Implement.
15805 * class.cs (DefineType): Check if the current Type is a custom
15806 attribute type and register it accordingly.
15808 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15809 adding the first attribute twice and rename to
15811 (SetGlobalAttributes): this.
15813 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15816 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15817 if we are processing global arguments. Hmm, I am unsure of this.
15819 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15821 * expression.cs: added static array of strings to avoid calling
15822 Enum.ToString () for Operator in Binary. Significant recover of
15825 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15827 * class.cs (FindMembers): Allow the Builders of the various
15828 members to be null. If they are skip them. This only happens
15829 during the PInvoke declaration.
15831 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15833 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15834 failure, so we do not keep going afterwards.
15836 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15837 wanted to pass `false' as the `is_delegate' argument. If this is
15838 the case, why not use delegate_type == null to mean `is_delegate =
15839 false' and anything else as is_delegate = true.
15841 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15843 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15844 code for the section, not the beginning of the tests.
15846 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15848 * cfold.cs: Handle operator + (Enum x, Underlying x)
15850 * expression.cs (Binary): same. Warn about errors where we have
15851 Enum/Enum in operator + as well.
15853 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15856 - added support for switch(bool)
15857 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15858 - add TableSwitchEmit() to handle table-based switch statements
15860 2002-04-05 Ravi Pratap <ravi@ximian.com>
15862 * expression.cs (Invocation.OverloadResolve): Factor out code which
15863 does parameter compatibility checking with arguments so that we can
15864 re-use the code even from Delegate.VerifyApplicability
15866 (VerifyArgumentsCompat): Move above code here.
15868 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15869 and instead make a call to the above method.
15871 2002-03-31 Ravi Pratap <ravi@ximian.com>
15873 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15874 We use it to keep track of classes which are attribute types.
15876 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15878 * delegate.cs (Delegate.Define): Correctly define the types in the
15879 presence of fixed and array parameters.
15881 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15884 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15885 include NonPublic after the first iteration.
15887 * class.cs (Indexer.CheckBase): Only check if both parents are
15890 * cs-parser.jay (accessor_body): If empty, set to null.
15892 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15893 same code path here to resolve constants names that we did have in
15894 MemberAccess.DoResolve. There is too much code duplicated here.
15896 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15898 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15900 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15903 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15904 tokens, numbers and strings.
15906 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15909 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15910 asyncronous parameters and the regular parameters.
15912 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15913 specify the target directory.
15915 * expression.cs: (This.DoResolve): Simplify
15916 (As.Emit): Optimize, do not generate IsInst if the expression is
15917 always of the given type.
15919 (Is.DoResolve): Bug fix, we were reporting both always/never for
15922 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15923 creating too many unnecessary arrays.
15925 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15927 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15928 fields instead of rolling our own initializer. Takes care of all
15929 implicit conversions, and drops unnecessary static checks/argument.
15931 2002-03-31 Dick Porter <dick@ximian.com>
15933 * driver.cs: use the GetDirectories() return values properly, and
15934 use "/" as path separator.
15936 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15938 * expression.cs (Unary): Optimize - - expr into expr.
15939 (Binary): Optimize a + (-b) into a -b.
15941 * codegen.cs (CodeGen): Made all methods static.
15943 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15947 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15948 TypeBuilder property.
15950 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15953 * tree.cs: Removed the various RecordXXXX, and replaced with a
15954 single RecordDecl. Removed all the accessor methods, and just
15955 left a single access point Type
15957 * enum.cs: Rename DefineEnum to DefineType.
15959 * decl.cs: New abstract method `DefineType' used to unify the
15960 Defines for Enumerations, Interfaces, TypeContainers and
15963 (FindType): Moved LookupInterfaceOrClass here. Moved the
15964 LookupBaseClasses method that used to live in class.cs and
15965 interface.cs here, and renamed to FindType.
15967 * delegate.cs: Implement DefineType. Take advantage of the
15968 refactored pattern for locating the parent builder without taking
15969 the parent_builder argument (which we know does not work if we are
15970 nested, and triggering a toplevel definition).
15972 2002-03-28 Miguel de Icaza <miguel@ximian.com>
15974 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
15975 accessibility of a member has changed during override and report
15978 * class.cs (Method.Define, Property.Define): Only complain on
15979 overrides if the method is private, any other accessibility is
15980 fine (and since we just checked the permission is the same, we are
15983 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
15984 and elif are processed always. The other pre-processing
15985 directives are only processed if we are "taking" the path
15987 2002-03-29 Martin Baulig <martin@gnome.org>
15989 * class.cs (Method.Emit): Only emit symbolic debugging info if the
15990 current location is not Null.
15992 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
15993 a separate method so we can profile it.
15995 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
15996 `span.Seconds' are just seconds, but no minutes or hours.
15997 (MainDriver): Profile the CodeGen.SaveSymbols calls.
15999 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16001 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
16002 Remove the gratuitous set of Final:
16004 // If an interface implementation, then we can set Final.
16005 if (((flags & MethodAttributes.Abstract) == 0) &&
16006 implementing.DeclaringType.IsInterface)
16007 flags |= MethodAttributes.Final;
16009 I do not know what I was smoking when I used that.
16012 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
16013 step into fixing the name resolution issues for delegates and
16014 unifying the toplevel name resolution.
16016 2002-03-28 Martin Baulig <martin@gnome.org>
16018 * class.cs (Method.Emit): If we have a symbol writer, call its
16019 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
16020 tell it about the current method.
16022 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
16023 writer that we're going to emit the first byte of IL code for a new
16024 statement (a new source line).
16025 (EmitContext.EmitTopBlock): If we have a symbol writer, call
16026 EmitContext.Mark() before emitting any code.
16028 * location.cs (SymbolDocument): Return null when we're Null.
16030 * statement.cs (Statement): Moved the `Location loc' variable here.
16031 (Statement.EmitBoolExpression): If we have a symbol writer, call
16032 ec.Mark() before emitting any code to tell it that we're at the
16033 beginning of a new statement.
16034 (StatementExpression): Added `Location' argument to the constructor.
16035 (Block): Added public readonly variable `StartLocation' and public
16036 variable `EndLocation'. The latter is to be set using SetEndLocation().
16037 (Block): Added constructor which takes a start and end location.
16038 (Block.SetEndLocation): New method. This sets the end location.
16039 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
16040 local variables we create.
16041 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
16042 each statement and do also mark the begin and end of the block.
16044 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
16045 tell it the current lexer.Location, use Location.Null for the end of the
16047 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
16048 current block, set its end location using SetEndLocation().
16049 (statement_expression): StatementExpression constructor now takes the
16050 lexer.Location as additional argument.
16051 (for_statement, declare_local_variables): Likewise.
16052 (declare_local_variables): When creating a new implicit block, use the
16053 new Block constructor and pass it the lexer.Location.
16055 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16057 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
16058 members also on the parent interfaces recursively.
16060 2002-03-27 Miguel de Icaza <miguel@ximian.com>
16062 * report.cs: Use new formats, since Gonzalo finished the missing
16065 * expression.cs (Binary.ResolveOperator): added missing operator|
16066 operator& and operator^ for bool/bool.
16068 * cs-parser.jay: CheckDef now takes a Location argument that is
16069 used to report errors more precisly (instead of reporting the end
16070 of a definition, we try to track something which is a lot closer
16071 to the source of the problem).
16073 * cs-tokenizer.cs: Track global token use, so we can properly flag
16074 the use of #define/#undef after the first token has been seen.
16076 Also, rename the reportXXXX to Error_DescriptiveName
16078 * decl.cs (DeclSpace.IsTopLevel): Move property here from
16079 TypeContainer, so that Enum and Interface can use this too.
16081 * class.cs (TypeContainer.LookupInterfaceOrClass,
16082 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
16083 `builder' argument. Typically this was used to pass the parent
16084 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
16087 The problem is that a nested class could trigger the definition of
16088 a toplevel class, and the builder would be obviously wrong in that
16091 So we drop this argument, and we compute dynamically the
16092 TypeBuilder/ModuleBuilder (the correct information was available
16093 to us anyways from DeclSpace.Parent)
16095 * interface.cs (Interface.DefineInterface): Drop builder
16096 parameter cleanup like class.cs
16098 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
16101 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
16104 (Try.Emit): Propagate the returns value from the statement.
16106 (Return.Emit): Even if we are leavning
16108 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
16110 * modifiers.cs: Fix the computation of MethodAttributes flags.
16112 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16114 * driver.cs: allow compilation of files that start with '/'.
16115 Add a default case when checking the argument of --target.
16117 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16119 * interface.cs: Implement the same search algorithm for types in
16120 the interface code.
16122 * delegate.cs: Do not allow multiple definition.
16124 * Recovered ChangeLog that got accidentally amputated
16126 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16128 * rootcontext.cs: Load manually enum to allow core classes to
16129 contain enumerations.
16131 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16132 Update to new static methods in TypeManager.
16134 * typemanager.cs (GetMethod, GetConstructor): Use our
16135 implementation of FindMembers to find the members, since during
16136 corlib compilation, the types are TypeBuilders and GetMethod and
16137 GetConstructor do not work.
16139 Make all methods in TypeManager static.
16141 (InitCodeHelpers): Split the functionality from
16142 the InitCodeTypes function.
16144 * driver.cs: Call InitCodeHelpers after we have populated the
16147 * cs-parser.jay (delegate_declaration): we did not used to compute
16148 the delegate name correctly for void delegates.
16150 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16152 * rootcontext.cs (RootContext): Init the interface_resolve_order
16153 and type_container_resolve_order always.
16155 (ResolveCore, BootstrapCorlib_ResolveClass,
16156 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16157 compiler when compiling with --nostdlib
16159 * class.cs (TypeContainer.DefineType): Check that our parent is
16160 not null. This test is most important when we are bootstraping
16163 * codegen.cs: Split out the symbol writing code.
16165 2002-03-25 Martin Baulig <martin@gnome.org>
16167 * driver.cs (-g): Made -g an alias for --debug.
16169 2002-03-24 Martin Baulig <martin@gnome.org>
16171 * codegen.cs (SymbolWriter): New public variable. Returns the
16172 current symbol writer.
16173 (CodeGen): Added `bool want_debugging_support' argument to the
16174 constructor. If true, tell the ModuleBuild that we want debugging
16175 support and ask it for the ISymbolWriter.
16176 (Save): If we have a symbol writer, call it's Close() method after
16177 saving the assembly.
16179 * driver.c (--debug): New command line argument to create a
16180 debugger information file.
16182 * location.cs (SymbolDocument): New public property. Returns an
16183 ISymbolDocumentWriter object for the current source file or null
16184 if we don't have a symbol writer.
16186 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16188 * driver.cs (LoadAssembly): Correctly return when all the paths
16189 have been tried and not before.
16191 * statement.cs (Switch.Emit): return the actual coverage for this
16192 statement (returns/not-returns)
16194 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16195 switch of the statement if we are the last switch section. That
16196 kills two problems: try/catch problems (we used to emit an empty
16197 nop at the end) and switch statements where all branches would
16200 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16202 * driver.cs: Add default assemblies (the equivalent to the
16203 Microsoft CSC.RSP file)
16205 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16206 also update tokens_seen and set it to false.
16208 * driver.cs: Implement --recurse for Mike.
16210 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16211 correctly splitting out the paths.
16213 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16215 * interface.cs (Interface.PopulateProperty): Instead of using
16216 `parent' as the declaration space for the set parameters, use
16219 * support.cs (InternalParameters): InternalParameters constructor
16220 takes a DeclSpace instead of a TypeContainer.
16222 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16223 types are being initialized, load the address of it before calling
16226 (New): Provide a mechanism to disable the generation of local
16227 value type temporaries when the caller will be providing us with
16228 an address to store it.
16230 (ArrayCreation.EmitDynamicInitializers): Use it.
16232 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16234 * expression.cs (Invocation.EmitArguments): Only probe for array
16235 property if there is more than one argument. Sorry about that.
16237 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16238 empty param arrays.
16240 * class.cs (Method.LabelParameters): Fix incorrect code path that
16241 prevented the `ParamArrayAttribute' from being applied to the
16244 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16246 * support.cs (ReflectionParameters): Correctly compute whether the
16247 last argument is a params array. Fixes the problem with
16250 * typemanager.cs: Make the assemblies array always be non-null
16251 (empty, but non-null)
16253 * tree.cs (RecordDecl): New function that abstracts the recording
16254 of names. This reports error 101, and provides a pointer to the
16255 previous declaration. Fixes a crash in the compiler.
16257 * cs-parser.jay (constructor_declaration): Update to new grammar,
16258 and provide a constructor_body that can be empty.
16260 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16262 * driver.cs: Add support for --resources.
16264 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16265 Make all types for the various array helper methods be integer.
16267 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16268 CheckState to ConvCast.
16270 (ConvCast): Now it takes a `checked' state argument, to avoid
16271 depending on the emit context for the conversion, and just using
16272 the resolve time setting.
16274 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16275 instead of Invocation.EmitArguments. We do not emit the original
16276 arguments, instead we emit those which have been converted to
16277 unsigned int expressions.
16279 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16281 * codegen.cs: ditto.
16283 * expression.cs (LocalVariableReference): Drop the use of the
16284 Store function that depended on the variable index.
16286 * statement.cs (VariableInfo): Drop the `Idx' property from this
16287 class, as this is not taking into account the indexes for
16288 temporaries tat we generate during the execution, getting the
16291 * class.cs: First emit class initializers, then call the parent
16294 * expression.cs (Binary): Fix opcode emision.
16295 (UnaryMutator.EmitCode): Support checked code generation
16297 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16298 matches for events for both the Static and Instance scans,
16299 pointing to the same element. Fix that.
16301 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16303 * rootcontext.cs (ResolveTree): Always set the
16304 interface_resolve_order, because nested interfaces will be calling
16307 * class.cs (GetInterfaceOrClass): Track the same resolution
16308 process used by TypeManager.LookupType. This fixes the nested
16309 type lookups in class declarations (separate path from
16312 (TypeContainer.DefineType): Also define nested interfaces.
16313 (TypeContainer.RegisterOrder): New public function used to
16314 register the order in which child interfaces need to be closed.
16316 Nested interfaces need to be closed after their parents have been
16319 * interface.cs (InterfaceAttr): Put all the logic for computing
16320 the interface attribute here.
16322 (DefineInterface): Register our interface order with the
16323 RootContext or with the TypeContainer depending on the case.
16325 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16327 * cs-parser.jay: rework foreach statement to work with the new
16328 changes to the policy on SimpleNames.
16330 * report.cs: support Stacktrace on warnings as well.
16332 * makefile: drop --unsafe and /unsafe from the compile.
16334 2002-03-13 Ravi Pratap <ravi@ximian.com>
16336 * ecore.cs (StandardConversionExists): Modify to take an Expression
16337 as the first parameter. Ensure we do null -> reference type conversion
16340 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16341 temporary Expression objects.
16343 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16345 * interface.cs: workaround bug in method overloading resolution
16346 (there is already a bugzilla bug for it).
16348 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16350 We could also solve this problem by having a separate path for
16351 performing type lookups, instead of DoResolve, we could have a
16352 ResolveType entry point, and only participating pieces of the
16353 production (simplename, deref, array) would implement this.
16355 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16356 signal SimpleName to only resolve type names and not attempt to
16357 resolve anything else.
16359 * expression.cs (Cast): Set the flag.
16361 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16363 * class.cs: Only report 108 if there is no `new' modifier.
16365 * cs-parser.jay: rework foreach statement to work with the new
16366 changes to the policy on SimpleNames.
16368 * report.cs: support Stacktrace on warnings as well.
16370 * makefile: drop --unsafe and /unsafe from the compile.
16372 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16374 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16375 lookups here, instead of doing that at parse time. This means
16376 that our grammar will not introduce `LocalVariableReferences' as
16377 expressions at this point. That solves the problem of code like
16381 static void Main ()
16385 This is only half the fix. The full fix requires parameters to
16386 also be handled in this way.
16388 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16389 makes the use more obvious of the DeclSpace. The
16390 ec.TypeContainer.TypeBuilder is now only used to pull the
16391 TypeBuilder for it.
16393 My theory is that I can get rid of the TypeBuilder completely from
16394 the EmitContext, and have typecasts where it is used (from
16395 DeclSpace to where it matters).
16397 The only pending problem is that the code that implements Aliases
16398 is on TypeContainer, and probably should go in DeclSpace.
16400 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16401 lookups here, instead of doing that at parse time. This means
16402 that our grammar will not introduce `LocalVariableReferences' as
16403 expressions at this point. That solves the problem of code like
16407 static void Main ()
16411 This is only half the fix. The full fix requires parameters to
16412 also be handled in this way.
16414 * class.cs (Property.DefineMethod): When implementing an interface
16415 method, set newslot, when implementing an abstract method, do not
16416 set the flag (before we tried never setting it, or always setting
16417 it, which is the difference).
16418 (Indexer.DefineMethod): same.
16419 (Method.DefineMethod): same.
16421 * ecore.cs: Only set the status used flag if we get back a Field.
16423 * attribute.cs: Temporary hack, so Paolo can keep working.
16425 2002-03-08 Ravi Pratap <ravi@ximian.com>
16427 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16428 the unmanaged type in the case we have a MarshalAs attribute.
16430 (Resolve): Handle the case when we are parsing the special MarshalAs
16431 attribute [we need to store the unmanaged type to use later]
16433 * typemanager.cs (marshal_as_attr_type): Built in type for the
16434 MarshalAs Attribute.
16436 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16437 on parameters and accordingly set the marshalling info.
16439 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16441 * class.cs: Optimizing slightly by removing redundant code after
16442 we switched to the `NoTypes' return value.
16443 (Property.DefineMethod): use NoTypes here too.
16445 This fixes the bug I introduced in my last batch of changes.
16447 2002-03-05 Ravi Pratap <ravi@ximian.com>
16449 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16451 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16452 Enums since those are types too.
16454 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16456 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16457 thanks to a call during the lookup process.
16459 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16461 * statement.cs (Foreach): Lots of work to accomodate a particular
16462 kind of foreach statement that I had not kept in mind. It is
16463 possible to have foreachs on classes that provide a GetEnumerator
16464 method that return objects that implement the "pattern" for using
16465 a foreach, there is no need to support GetEnumerator
16468 This is needed to compile nant.
16470 * decl.cs: Only report 114 if the member is not `Finalize' and if
16471 the warning level is at least 2.
16473 * class.cs: Moved the compare function from Method to
16476 (MethodSignature.InheritableMemberSignatureCompare): Add new
16477 filter function that is used to extract inheritable methods from a
16480 (Method.Define): Use the new `inheritable_method_signature_filter'
16483 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16486 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16488 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16490 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16492 * expression.cs: Pass location information to
16493 ConvertImplicitStandard.
16495 * class.cs: Added debugging code to track return values from
16498 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16500 * expression.cs (Is.DoResolve): If either side of the `is' is an
16501 interface, do not flag the warning.
16503 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16506 * report.cs: Allow for --fatal to be used with --probe.
16508 * typemanager.cs (NoTypes): Move the definition for the empty Type
16511 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16513 (TypeContainer.DefineProxy): New function used to proxy to parent
16514 implementations when implementing interfaces.
16515 (TypeContainer.ParentImplements): used to lookup if our parent
16516 implements a public function that is required by an interface.
16517 (TypeContainer.VerifyPendingMethods): Hook this up.
16519 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16520 `modules' and `assemblies' arraylists into arrays. We only grow
16521 these are the very early start up of the program, so this improves
16522 the speedof LookupType (nicely measured).
16524 * expression.cs (MakeByteBlob): Replaced unsafe code with
16525 BitConverter, as suggested by Paolo.
16527 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16528 folding of string concatenation, but if either side is a string,
16529 and the other is not, then return null, and let the runtime use
16530 the concatenation on the string plus the object (using
16531 `Object.ToString').
16533 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16535 Constant Folding has been implemented now.
16537 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16538 the error instead on types that are not supported in one's
16541 * constant.cs (Constant and all children): New set of functions to
16542 perform implict and explicit conversions.
16544 * ecore.cs (EnumConstant): Implement the new functions to perform
16545 conversion by proxying to the child expression.
16547 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16548 own separate setting that can not be turned off from the command
16549 line using --unchecked or --checked and is only controlled using
16550 the checked/unchecked statements and expressions. This setting is
16551 used by the constant folder to flag errors.
16553 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16554 ConstantCheckState as well.
16556 During Resolve, they also have to flag the state, because the
16557 constant folder runs completely in the Resolve phase.
16559 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16562 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16564 * cfold.cs: New file, this file contains the constant folder.
16566 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16567 argument to track whether we are using the resulting address to
16568 load or store a value and provide better error messages.
16570 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16571 new AddressOf arguments.
16573 * statement.cs (Foreach.EmitCollectionForeach): Update
16575 * expression.cs (Argument.Emit): Call AddressOf with proper
16576 arguments to track usage.
16578 (New.DoEmit): Call AddressOf with new arguments.
16580 (Unary.Emit): Adjust AddressOf call.
16582 2002-03-01 Ravi Pratap <ravi@ximian.com>
16584 * cs-parser.jay (member_access): Change the case for pre-defined types
16585 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16588 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16591 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16592 essentially like methods and apply attributes like MethodImplOptions to them too.
16594 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16597 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16598 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16601 * Update code everywhere accordingly.
16603 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16605 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16607 2002-02-28 Ravi Pratap <ravi@ximian.com>
16609 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16610 try performing lookups against those instead of jumping straight into using
16611 the 'using' clauses.
16613 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16615 (LookupType): Perform lookups in implicit parents too.
16617 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16618 sequence as RootContext.LookupType.
16620 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16621 the various cases of namespace lookups into this method.
16623 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16625 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16626 in positional arguments)
16628 * class.cs (Operator): Update the AllowedModifiers to contain
16631 * cs-parser.jay: Update operator declaration to allow for the
16632 operator body to be empty.
16634 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16637 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16639 * class.cs (Method.Emit): Label parameters.
16641 * driver.cs: Return 1 or 0 as the program exit code.
16643 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16645 * expression.cs: Special case the `null' object when trying to
16646 auto-compute the type, as anything can be explicitly converted to
16649 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16650 spotting this Paolo.
16652 (Expression.ImplicitNumericConversion): Perform comparissions of
16653 the type using the underlying type in the case of an enumeration
16654 rather than using the enumeration type for the compare.
16656 Cope with the underlying == type case, which is not possible to
16659 (Expression.ConvertNumericExplicit): Perform comparissions of
16660 the type using the underlying type in the case of an enumeration
16661 rather than using the enumeration type for the compare.
16663 * driver.cs: If the user does not supply an extension, assume .exe
16665 * cs-parser.jay (if_statement): Rewrote so that we can track the
16666 location for the if statement.
16668 * expression.cs (Binary.ConstantFold): Only concat strings when
16669 the operation is "+", not everything ;-)
16671 * statement.cs (Statement.EmitBoolExpression): Take a location
16673 (If, While, Do): Track location.
16675 * expression.cs (Binary.ResolveOperator): In the object + string
16676 case, I was missing a call to ConvertImplicit
16678 2002-02-25 Ravi Pratap <ravi@ximian.com>
16680 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16681 Location arguments. Ensure we use RootContext.LookupType to do our work
16682 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16684 * interface.cs (PopulateMethod): Handle the type of the parameter being
16687 * expression.cs (Invocation.BetterFunction): Handle the case when we
16688 have a params method with no fixed arguments and a call is made with no
16691 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16693 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16694 the verbatim-string-literal
16696 * support.cs (InternalParameters.ParameterModifier): handle null
16698 (InternalParameters.ParameterType): ditto.
16700 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16701 duplicating the name of the variable parameter.
16702 (GetParameterByName): Fix bug where we were not looking up array
16703 paramters if they were the only present (thanks Paolo!).
16704 (GetParameterInfo): We only have an empty set of types if both
16705 fixed and array are set to null.
16706 (GetParameterInfo-idx): Handle FixedParameter == null
16708 * cs-parser.jay: Handle the case where there is no catch
16709 statements (missing null test).
16711 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16713 * driver.cs (MainDriver): Be conservative on our command line
16716 Catch DirectoryNotFoundException when calling GetFiles.
16718 (SplitPathAndPattern): Used to split the input specification into
16719 a path and a pattern that we can feed to Directory.GetFiles.
16721 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16723 * statement.cs (Fixed): Implement the last case of the Fixed
16724 statement (string handling).
16726 * expression.cs (StringPtr): New class used to return a char * to
16727 a string; Used by the Fixed statement.
16729 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16731 * expression.cs (Binary.ResolveOperator): Remove redundant
16732 MemberLookup pn parent type.
16733 Optimize union call, we do not need a union if the types are the same.
16734 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16737 Specialize the use of MemberLookup everywhere, instead of using
16738 the default settings.
16740 (StackAlloc): Implement stackalloc keyword.
16742 * cs-parser.jay: Add rule to parse stackalloc.
16744 * driver.cs: Handle /h, /help, /?
16746 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16747 before we supported unsafe code.
16749 * makefile: add --unsafe to the self compilation of mcs.
16751 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16753 * expression.cs (PointerArithmetic): New class that is used to
16754 perform pointer arithmetic.
16755 (Binary.Resolve): Handle pointer arithmetic
16756 Handle pointer comparission.
16757 (ArrayPtr): Utility expression class that is used to take the
16758 address of an array.
16760 (ElementAccess): Implement array access for pointers
16762 * statement.cs (Fixed): Implement fixed statement for arrays, we
16763 are missing one more case before we are done.
16765 * expression.cs (Indirection): Implement EmitAssign and set the
16766 ExprClass to Variable. This allows pointer dereferences to be
16767 treated as variables, and to have values assigned to them.
16769 * ecore.cs (Expression.StoreFromPtr): New utility function to
16770 store values dereferencing.
16772 2002-02-20 Ravi Pratap <ravi@ximian.com>
16774 * expression.cs (Binary.ResolveOperator): Ensure that we are
16775 not trying to operate on a void type - this fixes the reported
16778 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16779 the parent implementation is sealed.
16781 * ../errors/cs0239.cs : Add.
16783 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16785 * typemanager.cs (unverifiable_code_type): Corresponds to
16786 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16787 which have unsafe code in them.
16789 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16792 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16794 * cs-tokenizer.cs: Add support for @"litreal strings"
16796 Make tokenizer accept pre-processor directives
16797 on any column (remove the old C-like limitation).
16799 * rootcontext.cs (EmitCode): Emit any global attributes.
16800 (AddGlobalAttributes): Used to keep track of assembly attributes.
16802 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16804 * cs-parser.jay: Add support for global attributes.
16806 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16808 * expression.cs (Indirection): New helper class. Unary will
16809 create Indirection classes to be able to implement the
16810 IMemoryLocation interface on it.
16812 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16814 * cs-parser.jay (fixed_statement): reference the right statement.
16816 * statement.cs (Fixed.Emit): Finish implementing the fixed
16817 statement for the &x case.
16819 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16821 * class.cs (Property.Define, Method.Define): Remove newslot when
16824 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16825 wrong. NewSlot should only be used if the `new' keyword is present.
16827 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16828 locating our system dir. Sorry about this.
16830 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16832 * driver.cs (GetSystemDir): Compute correctly the location of our
16833 system assemblies. I was using the compiler directory instead of
16834 the library directory.
16836 2002-02-13 Ravi Pratap <ravi@ximian.com>
16838 * expression.cs (BetterFunction): Put back in what Miguel commented out
16839 since it is the correct fix. The problem is elsewhere ;-)
16841 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16842 parameters of the parms method are themselves compatible or not !
16844 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16845 to check that a class implements an interface before saying that an implicit
16846 conversion was allowed. Use ImplementsInterface to do the checking.
16848 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16850 * class.cs (Method.Define): Track whether we are an explicit
16851 implementation or not. And only call DefineMethodOverride if we
16852 are an explicit implementation.
16854 (Property.DefineMethod): Ditto.
16856 2002-02-11 Ravi Pratap <ravi@ximian.com>
16858 * expression.cs (BetterFunction): Catch hideous bug which was
16859 preventing us from detecting ambiguous calls due to implicit casts i.e
16862 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16864 * support.cs (Pair): Remove un-needed method. I figured why I was
16865 getting the error in cs-parser.jay, the variable in a foreach loop
16866 is readonly, and the compiler does not really treat this as a variable.
16868 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16869 instead of EQUALS in grammar.
16871 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16873 * expression.cs (Unary.DoResolve): Check whether the argument is
16876 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16878 * support.cs: Api for Pair to set a value. Despite the fact that
16879 the variables are public the MS C# compiler refuses to compile
16880 code that accesses the field if the variable is part of a foreach
16883 * statement.cs (Fixed): Begin implementation of the fixed
16886 (Block.AddVariable): Return the VariableInfo on success and null
16887 on failure instead of true/false.
16889 * cs-parser.jay (foreach): Catch errors on variables already
16890 defined (we were ignoring this value before) and properly unwind
16891 the block hierarchy
16893 (fixed_statement): grammar for the fixed statement.
16895 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16897 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16898 pointer types to be incretemented.
16900 (SizeOf): Implement.
16902 * cs-parser.jay (pointer_member_access): Implement
16903 expr->IDENTIFIER production.
16905 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16906 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16909 (Unary): Implement indirection.
16911 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16912 use in non-unsafe context).
16914 (SimpleName.DoResolve): Check for pointers in field access on safe
16917 (Expression.LoadFromPtr): Factor the load-indirect code in this
16918 function. This was duplicated in UnboxCast and ParameterReference
16920 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16922 * expression.cs (ComposedCast): report an error if a pointer cast
16923 is used in a safe region.
16925 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16926 pointer type casts in unsafe context.
16928 * codegen.cs (EmitContext): Set up IsUnsafe.
16930 * cs-parser.jay (non_expression_type): Add productions for pointer
16933 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16934 code. We should not use force into static mode if the method is
16935 not virtual. Fixes bug in MIS
16937 * statement.cs (Do.Emit, While.Emit, For.Emit,
16938 Statement.EmitBoolExpression): Add support to Do and While to
16939 propagate infinite loop as `I do return' semantics.
16941 Improve the For case to also test for boolean constants.
16943 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16944 to the list of attributes we can add.
16946 Remove `EmitContext' argument.
16948 * class.cs (Method.Define): Apply parameter attributes.
16949 (Constructor.Define): Apply parameter attributes.
16950 (MethodCore.LabelParameters): Move here the core of labeling
16953 * support.cs (ReflectionParameters.ParameterModifier,
16954 InternalParameters.ParameterModifier): Use IsByRef on the type and
16955 only return the OUT bit for these parameters instead of in/out/ref
16958 This is because I miss-understood things. The ParameterInfo.IsIn
16959 and IsOut represent whether the parameter has the [In] and [Out]
16962 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16964 * ecore.cs (FieldExpr.Emit): Release temporaries.
16966 * assign.cs (LocalTemporary.Release): new function.
16968 * codegen.cs (EmitContext.GetTemporaryStorage,
16969 EmitContext.FreeTemporaryStorage): Rework the way we deal with
16970 temporary storage. Now we can "put back" localbuilders when we
16973 2002-01-21 Miguel de Icaza <miguel@ximian.com>
16975 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
16976 need to make a copy of the variable to generate verifiable code.
16978 2002-01-19 Miguel de Icaza <miguel@ximian.com>
16980 * driver.cs: Compute dynamically the system directory.
16982 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
16983 Slower, but more generally useful. Used by the abstract
16984 registering implementation.
16986 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
16987 the rules for the special rule on Type/instances. First check if
16988 we have the same name, and if so, try that special static path
16989 rather than the instance path.
16991 2002-01-18 Miguel de Icaza <miguel@ximian.com>
16993 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
16996 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
16997 Enum, ValueType, Delegate or Array for non-corlib compiles.
16999 * cs-tokenizer.cs: Catch long identifiers (645)
17001 * typemanager.cs (IndexerPropetyName): Ravi never tested this
17004 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
17005 fix, we were returning too early, so we were not registering
17006 pending methods from abstract classes.
17008 Do not register pending methods if the class is abstract.
17010 * expression.cs (Conditional.DoResolve): Report circular implicit
17011 conversions when we neecd to compute it for conditional
17014 (Is.DoResolve): If the expression is always of the provided type,
17015 flag warning 183. If the expression can not ever be of the
17016 provided type flag warning 184.
17018 * class.cs: Catch 169 as well.
17020 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
17023 2002-01-18 Nick Drochak <ndrochak@gol.com>
17025 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
17027 2002-01-17 Miguel de Icaza <miguel@ximian.com>
17029 * interface.cs: (PopulateMethod): Check for pointers being defined
17030 only if the unsafe context is active.
17031 (PopulateProperty): ditto.
17032 (PopulateIndexer): ditto.
17034 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
17035 specified. If pointers are present, make sure that they are
17036 present in an unsafe context.
17037 (Constructor, Constructor.Define): ditto.
17038 (Field, Field.Define): ditto.
17039 (Property, Property.Define): ditto.
17040 (Event, Event.Define): ditto.
17042 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
17043 hashtable if there are classes or structs defined.
17045 * expression.cs (LocalVariableReference.DoResolve): Simplify this
17046 code, as the constant resolution moved.
17048 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
17049 the metadata, so we can flag error 133.
17051 * decl.cs (MemberCore.UnsafeOK): New function to test that a
17052 pointer is being declared in an unsafe context.
17054 2002-01-16 Miguel de Icaza <miguel@ximian.com>
17056 * modifiers.cs (Modifiers.Check): Require a Location argument.
17057 Report error 227 for Unsafe use.
17059 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
17061 * statement.cs (For.Emit): If the test is null, then report that
17062 we do `return', as we wont reach anything afterwards.
17064 (Switch.SwitchGoverningType): Track the expression that matched
17067 * driver.cs: Allow negative numbers as an error code to flag.
17069 * cs-parser.jay: Handle 1551.
17071 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
17073 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17075 * cs-parser.jay: Report 1518 (type declaration can only contain
17076 class, struct, interface, enum or delegate)
17078 (switch_label): Report 1523 (keywords `case' or `default' must
17081 (opt_switch_sections): Report 1522 (empty switch)
17083 * driver.cs: Report 1515 (response file specified multiple times)
17084 Report 1516 (Source file specified multiple times).
17086 * expression.cs (Argument.Resolve): Signal 1510
17088 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
17089 access not allowed in static code)
17091 2002-01-11 Ravi Pratap <ravi@ximian.com>
17093 * typemanager.cs (IsPointerType): Utility method which we are going
17096 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
17097 the object type, so we take care of that.
17099 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
17101 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
17102 added to non-params parameters :-)
17104 * typemanager.cs (CSharpName): Include 'void' type too.
17106 (void_ptr_type): Include in the set of core types.
17108 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
17111 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17114 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17115 completely forgotten about it.
17117 2002-01-10 Ravi Pratap <ravi@ximian.com>
17119 * cs-parser.jay (pointer_type): Add. This begins our implementation
17120 of parsing rules for unsafe code.
17122 (unsafe_statement): Implement.
17124 (embedded_statement): Modify to include the above.
17126 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17128 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17129 if the current context is an unsafe one.
17131 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17132 are handled differently, we need separate rules for them.
17134 (local_variable_declaration): Update to use local_variable_pointer_type
17135 to allow variable declarations of unmanaged pointer types.
17137 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17138 in unsafe contexts.
17140 * ../errors/cs0214.cs : Add.
17142 2002-01-16 Nick Drochak <ndrochak@gol.com>
17144 * makefile: remove 'response' file when cleaning.
17146 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17148 * cs-parser.jay: Report 1524.
17150 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17152 * typemanager.cs (RegisterMethod): drop checking if we have
17153 registered this from here
17155 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17157 * class.cs (Method.EmitDestructor): Implement calling our base
17160 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17161 value of InFinally.
17163 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17164 this routine and will wrap the call in a try/catch block. Deal
17167 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17169 * ecore.cs (Expression.MemberLookup): instead of taking a
17170 parameter `same_type' that was used to tell whether we could
17171 access private members we compute our containing type from the
17174 (FieldExpr): Added partial support for volatile fields. This does
17175 not work for volatile fields exposed from assemblies, as I can not
17176 figure out how to extract the modreq from it.
17178 Updated all the source files to use this.
17180 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17181 because it is referenced by MemberLookup very often.
17183 2002-01-09 Ravi Pratap <ravi@ximian.com>
17185 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17186 TypeBuilder.GetCustomAttributes to retrieve what we need.
17188 Get rid of redundant default_member_attr_type as this is the same as
17189 default_member_type which already exists.
17191 * interface.cs, attribute.cs : Update accordingly.
17193 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17195 * typemanager.cs: Enable IndexerPropertyName again. It does not
17196 work for TYpeBuilders though. Ravi, can you please fix this?
17198 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17200 * expression.cs (Argument.Emit): Handle the case of ref objects
17201 being passed to ref functions;
17203 (ParameterReference.EmitLoad): Loads the content of the pointer
17204 without dereferencing.
17206 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17208 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17210 2002-01-08 Ravi Pratap <ravi@ximian.com>
17212 * class.cs (Indexer.DefineMethod): Incorporate the interface
17213 type in the name of the method if we are doing explicit interface
17216 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17218 (BetterConversion): Fix extremely trivial bug where we were referring to
17219 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17222 * ../errors/bug16.cs : Add although we have fixed it.
17224 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17226 * expression.cs (BaseIndexer): Begin implementation.
17228 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17230 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17231 production directly to remove a shift/reduce, and implement
17232 explicit interface implementation.
17234 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17235 after a floating point suffix.
17237 * expression.cs (DoNumericPromotions): Improved the conversion for
17238 uint/uint. If we have a constant, we avoid doing a typecast to a
17241 * class.cs (Indexer): Implement explicit interface implementation
17244 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17246 * class.cs: make the default instance constructor public and hidebysig.
17248 2001-01-03 Ravi Pratap <ravi@ximian.com>
17250 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17251 so we can call it from elsewhere.
17253 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17254 we emit it internally if the class has a defined indexer; otherwise the user
17255 emits it by decorating the class definition with the DefaultMemberAttribute.
17257 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17258 attribute is not used on a type which defines an indexer.
17260 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17261 character when we skip whitespace.
17263 * ../errors/cs0646.cs : Add.
17265 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17267 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17270 * makefile: Add practical target `mcs3.exe' which builds the third
17271 generation compiler.
17273 * expression.cs (New): Fix structures constructor calling.
17275 * class.cs (Property, Method, Indexer): Emit Final flag on the
17276 method if we are an interface implementation and we are not
17279 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17280 whether this property is referencing a `base' method.
17282 * expression.cs (Invocation.EmitCall): take an extra argument:
17283 is_base, this is used to determine whether the `call' or
17284 `callvirt' opcode should be used.
17287 * delegate.cs: update EmitCall.
17289 * class.cs (Method.Define): Set NewSlot for the cases where we are
17290 not implementing an interface method.
17292 (Property.Define): ditto.
17294 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17296 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17297 'r'. Allows mcs to parse itself fully.
17299 2002-01-02 Ravi Pratap <ravi@ximian.com>
17301 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17302 of the number of initializers that require the InitializeArray method.
17304 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17305 update the above field where necessary.
17307 (MakeByteBlob): Update accordingly.
17309 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17312 (EmitDynamicInitializers): Update in accordance with the new optimization.
17314 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17315 same OpCode applies.
17317 * cs-parser.jay : Fix some glaring errors I introduced.
17319 2002-01-01 Ravi Pratap <ravi@ximian.com>
17321 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17322 so that we can check for name clashes there too.
17324 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17325 for interface indexers.
17327 * interfaces.cs (Define): Emit the default member attribute.
17329 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17330 variable was being referred to while setting the value ;-)
17332 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17334 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17335 byte-by-byte information when we know the data is zero.
17337 Make the block always a multiple of 4, because
17338 DefineInitializedData has a bug.
17340 * assign.cs: Fix, we should assign from the temporary, not from
17343 * expression.cs (MakeByteBlob): Fix my incorrect code.
17345 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17347 * typemanager.cs (EnumToUnderlying): This function is used to get
17348 the underlying type from an enumeration, because it does not
17351 * constant.cs: Use the I4_S form for values between -128 and 127.
17353 * statement.cs (Block.LookupLabel): Looks up a label.
17354 (Block): Drop support for labeled blocks.
17356 (LabeledStatement): New kind of statement that represents a label
17359 (Goto): Finally implement this bad boy.
17361 * cs-parser.jay: Update to reflect new mechanism to implement
17364 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17366 * codegen.cs (EmitContext.This): a codegen property that keeps the
17367 a single instance of this instead of creating many different this
17370 * delegate.cs (Delegate.DoResolve): Update to use the property;
17372 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17374 * expression.cs (BaseAccess.DoResolve): Ditto.
17376 2001-12-29 Ravi Pratap <ravi@ximian.com>
17378 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17379 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17381 (InitCoreTypes): Update accordingly.
17383 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17384 so we can quickly store the state.
17386 (ApplyAttributes): Set the correct implementation flags
17387 for InternalCall methods.
17389 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17391 * expression.cs (EmitCall): if a method is not virtual, then do
17392 not use callvirt on it.
17394 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17395 user defined stuff) requires the use of stobj, which takes an
17396 address on the stack instead of an array and an index. So emit
17397 the Ldelema operation for it.
17399 (EmitStoreOpcode): Use stobj for valuetypes.
17401 (UnaryMutator.EmitCode): Use the right 1 value depending on
17402 whether we are dealing with int64/uint64, float or doubles.
17404 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17405 constructors that I implemented last night.
17407 (Constructor.IsDefault): Fix to work properly for static
17410 * cs-parser.jay (CheckDef): report method signature errors.
17411 Update error number 103 to be 132.
17413 * decl.cs: New AdditionResult enumeration value: MethodExists.
17414 Although we do this check for methods later on in the semantic
17415 analysis, catching repeated default constructors is so easy that
17416 we catch these here.
17418 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17421 (ParameterReference.EmitAssign, Emit): handle
17424 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17425 (ArrayAccess.EmitStoreOpcode): ditto.
17427 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17429 * expression.cs (MakeByteBlob): Complete all the missing types
17430 (uint, short, ushort, byte, sbyte)
17432 * class.cs: Only init instance field initializers on instance
17435 Rename `constructors' to instance_constructors.
17437 (TypeContainer.AddConstructor): Only add constructors to the list
17438 if it is not static.
17440 Make sure that we handle default_static_constructor independently
17441 everywhere where we handle instance_constructors
17443 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17445 * class.cs: Do not lookup or create a base initializer for a
17446 static constructor.
17448 (ConstructorInitializer.Resolve): use the proper type to lookup
17451 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17453 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17456 * decl.cs: CloseType is now an virtual method, the default
17457 implementation just closes this type.
17459 2001-12-28 Ravi Pratap <ravi@ximian.com>
17461 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17462 to PreserveSig by default. Also emit HideBySig on such methods.
17464 Basically, set the defaults to standard values.
17466 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17467 argument, if candidate is better, it can't be worse than the best !
17469 (Invocation): Re-write bits to differentiate between methods being
17470 applicable in their expanded form and their normal form - for params
17473 Get rid of use_standard everywhere as only standard conversions are allowed
17474 in overload resolution.
17476 More spec conformance.
17478 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17480 * driver.cs: Add --timestamp, to see where the compiler spends
17483 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17484 `this' in static code.
17486 (SimpleName.DoResolve): Implement in terms of a helper function
17487 that allows static-references to be passed upstream to
17490 (Expression.ResolveWithSimpleName): Resolve specially simple
17491 names when called by MemberAccess to implement the special
17494 (Expression.ImplicitReferenceConversion): Handle conversions from
17495 Null to reference types before others, as Null's type is
17498 * expression.cs (Invocation.EmitCall): Handle the special case of
17499 calling methods declared on a reference type from a ValueType
17500 (Base classes System.Object and System.Enum)
17502 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17503 the left hand side is a TypeExpr, not on every enumeration.
17505 (Binary.Resolve): If types are reference types, then do a cast to
17506 object on operators != and == of both arguments.
17508 * typemanager.cs (FindMembers): Extract instance and static
17509 members if requested.
17511 * interface.cs (PopulateProperty): Use void_type instead of null
17512 as the return type for the setter method.
17514 (PopulateIndexer): ditto.
17516 2001-12-27 Ravi Pratap <ravi@ximian.com>
17518 * support.cs (ReflectionParameters): Fix minor bug where we
17519 were examining the wrong parameter for the ParamArray attribute.
17521 Cope with requests for the type of the parameter at position
17522 greater than the params parameter's. We now return the element
17523 type of the params array as that makes more sense.
17525 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17526 accordingly as we no longer have to extract the element type
17529 (Invocation.OverloadResolve): Update.
17531 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17533 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17534 against IEnumerator, test whether the return value is a descendant
17535 of the IEnumerator interface.
17537 * class.cs (Indexer.Define): Use an auxiliary method to implement
17538 the other bits of the method definition. Begin support for
17539 explicit interface implementation.
17541 (Property.DefineMethod): Use TypeManager.void_type instead of null
17542 for an empty return value.
17544 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17546 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17547 dealing with a FieldExpr which is composed of a FieldBuilder, in
17548 the code path we did extract the constant, but we should have
17549 obtained the underlying value to be able to cast it (otherwise we
17550 end up in an infinite loop, this is what Ravi was running into).
17552 (ArrayCreation.UpdateIndices): Arrays might be empty.
17554 (MemberAccess.ResolveMemberAccess): Add support for section
17555 14.5.4.1 that deals with the special case of E.I when E is a type
17556 and something else, that I can be a reference to a static member.
17558 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17559 handle a particular array type to create byte blobs, it is just
17560 something we dont generate byteblobs for.
17562 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17565 * location.cs (Push): remove the key from the hashtable that we
17566 are about to add. This happens for empty files.
17568 * driver.cs: Dispose files after we have parsed them.
17570 (tokenize): new function that only runs the tokenizer on its
17571 input, for speed testing.
17573 2001-12-26 Ravi Pratap <ravi@ximian.com>
17575 * class.cs (Event.Define): Define the private field only if there
17576 are no accessors defined.
17578 * expression.cs (ResolveMemberAccess): If there is no associated
17579 field with the event, that means we have an event defined with its
17580 own accessors and we should flag error cs0070 since transforming
17581 ourselves into a field is not valid in that case.
17583 * ecore.cs (SimpleName.DoResolve): Same as above.
17585 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17586 and charset to sane values.
17588 2001-12-25 Ravi Pratap <ravi@ximian.com>
17590 * assign.cs (DoResolve): Perform check on events only if they
17591 are being accessed outside the declaring type.
17593 * cs-parser.jay (event_declarations): Update rules to correctly
17594 set the type of the implicit parameter etc.
17596 (add_accessor, remove_accessor): Set current local parameters.
17598 * expression.cs (Binary): For delegate addition and subtraction,
17599 cast the return value from the method into the appropriate delegate
17602 2001-12-24 Ravi Pratap <ravi@ximian.com>
17604 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17605 of these as the workaround is unnecessary.
17607 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17608 delegate data - none of that is needed at all.
17610 Re-write bits to extract the instance expression and the delegate method
17613 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17616 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17617 of attaching attributes instead of duplicating code everywhere.
17619 * everywhere : Update code to do attribute emission using the above method.
17621 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17623 * expression.cs (IsParamsMethodApplicable): if there are not
17624 parameters, return immediately.
17626 * ecore.cs: The 0 literal can be implicity converted to an enum
17629 (SimpleName.DoResolve): First lookup the type, then lookup the
17632 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17633 want to get its address. If the InstanceExpression is not
17634 addressable, store the result in a temporary variable, then get
17637 * codegen.cs: Only display 219 errors on warning level or above.
17639 * expression.cs (ArrayAccess): Make it implement the
17640 IMemoryLocation interface.
17642 (Binary.DoResolve): handle the operator == (object a, object b)
17643 and operator != (object a, object b) without incurring into a
17644 BoxedCast (because 5 != o should never be performed).
17646 Handle binary enumerator operators.
17648 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17649 value type, otherwise use Ldelem_ref.
17651 Use precomputed names;
17653 (AddressOf): Implement address of
17655 * cs-parser.jay (labeled_statement): Fix recursive block
17656 addition by reworking the production.
17658 * expression.cs (New.DoEmit): New has a special case:
17660 If we are dealing with a ValueType, we have a few
17661 situations to deal with:
17663 * The target of New is a ValueType variable, that is
17664 easy, we just pass this as the variable reference
17666 * The target of New is being passed as an argument,
17667 to a boxing operation or a function that takes a
17670 In this case, we need to create a temporary variable
17671 that is the argument of New.
17674 2001-12-23 Ravi Pratap <ravi@ximian.com>
17676 * rootcontext.cs (LookupType): Check that current_type is not null before
17677 going about looking at nested types.
17679 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17680 not implement the IAssignMethod interface any more.
17682 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17683 where we tranform them into FieldExprs if they are being resolved from within
17684 the declaring type.
17686 * ecore.cs (SimpleName.DoResolve): Do the same here.
17688 * assign.cs (DoResolve, Emit): Clean up code considerably.
17690 * ../errors/bug10.cs : Add.
17692 * ../errors/cs0070.cs : Add.
17694 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17696 * assign.cs : Get rid of EventIsLocal everywhere.
17698 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17700 * ecore.cs (ConvertIntLiteral): finished the implementation.
17702 * statement.cs (SwitchLabel): Convert the value we are using as a
17703 key before looking up the table.
17705 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17707 * codegen.cs (EmitTopBlock): Require a Location argument now.
17709 * cs-parser.jay (constructor_declarator): We need to setup
17710 current_local_parameters before we parse the
17711 opt_constructor_initializer, to allow the variables to be bound
17712 to the constructor arguments.
17714 * rootcontext.cs (LookupType): First lookup nested classes in our
17715 class and our parents before we go looking outside our class.
17717 * expression.cs (ConstantFold): Extract/debox the values at the
17720 * rootcontext.cs (EmitCode): Resolve the constants first before we
17721 resolve the types. This is not really needed, but it helps debugging.
17723 * statement.cs: report location.
17725 * cs-parser.jay: pass location to throw statement.
17727 * driver.cs: Small bug fix.
17729 * report.cs: Updated format to be 4-zero filled digits.
17731 2001-12-22 Ravi Pratap <ravi@ximian.com>
17733 * expression.cs (CheckIndices): Fix minor bug where the wrong
17734 variable was being referred to ;-)
17736 (DoEmit): Do not call EmitStaticInitializers when the
17737 underlying type is System.Object.
17739 2001-12-21 Ravi Pratap <ravi@ximian.com>
17741 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17742 and do the usual workaround for SRE.
17744 * class.cs (MyEventBuilder.EventType): New member to get at the type
17745 of the event, quickly.
17747 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17749 * assign.cs (Assign.DoResolve): Handle the case when the target
17750 is an EventExpr and perform the necessary checks.
17752 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17755 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17757 (EventExpr): Set the type in the constructor itself since we
17758 are meant to be born fully resolved.
17760 (EventExpr.Define): Revert code I wrote earlier.
17762 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17763 instance expression is null. The instance expression is a This in that case
17764 or a null, depending on whether it is a static method or not.
17766 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17767 refers to more than one method.
17769 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17770 and accordingly flag errors.
17772 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17774 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17776 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17778 * location.cs (ToString): Provide useful rutine.
17780 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17782 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17783 objects, return the actual integral boxed.
17785 * statement.cs (SwitchLabel): define an ILLabel for each
17788 (Switch.CheckSwitch): If the value is a Literal, extract
17789 the underlying literal.
17791 Also in the unused hashtable we had, add the SwitchLabel so we can
17792 quickly look this value up.
17794 * constant.cs: Implement a bunch of new constants. Rewrite
17795 Literal based on this. Made changes everywhere to adapt to this.
17797 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17798 dereferencing array only once, and also copes with enumrations.
17800 bytes are two bytes wide, not one.
17802 (Cast): Perform constant conversions.
17804 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17805 wrappers to the literals here.
17807 * expression.cs (DoNumericPromotions): long literals can converted
17808 to ulong implicity (this is taken care of elsewhere, but I was
17809 missing this spot).
17811 * ecore.cs (Expression.Literalize): Make the return type Literal,
17812 to improve type checking.
17814 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17816 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17818 * literal.cs: Revert code from ravi that checked the bounds. The
17819 bounds are sane by the definition of the type itself.
17821 * typemanager.cs: Fix implementation of ImplementsInterface. We
17822 need to actually look up in our parent hierarchy for interfaces
17825 * const.cs: Use the underlying type for enumerations
17827 * delegate.cs: Compute the basename for the delegate creation,
17828 that should fix the delegate test case, and restore the correct
17829 Type Lookup semantics in rootcontext
17831 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17832 referencing a nested type with the Reflection API is using the "+"
17835 * cs-parser.jay: Do not require EOF token at the end.
17837 2001-12-20 Ravi Pratap <ravi@ximian.com>
17839 * rootcontext.cs (LookupType): Concatenate type names with
17840 a '.' instead of a '+' The test suite passes again.
17842 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17843 field of the enumeration.
17845 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17846 the case when the member is an EventExpr.
17848 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17849 static has an associated instance expression.
17851 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17853 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17855 * class.cs (Event.Define): Register event and perform appropriate checks
17858 We define the Add and Remove methods even if the use provides none because
17859 in that case, we provide default implementations ourselves.
17861 Define a private field of the type of the event. This is done by the CSC compiler
17862 and we should be doing it too ;-)
17864 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17865 More methods we use in code we generate.
17867 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17870 (InitCoreTypes): Update accordingly for the above.
17872 * class.cs (Event.Emit): Generate code for default accessors that we provide
17874 (EmitDefaultMethod): Do the job in the above.
17876 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17879 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17881 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17882 builders even if we were missing one.
17884 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17885 pass the Basename as our class name instead of the Name. The
17886 basename will be correctly composed for us.
17888 * parameter.cs (Paramters): Now takes a Location argument.
17890 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17891 make all the code call directly LookupType in RootContext and take
17892 this chance to pass the Location information everywhere.
17894 * Everywhere: pass Location information.
17896 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17898 * class.cs (Constructor.Define): Updated way of detecting the
17899 length of the parameters.
17901 (TypeContainer.DefineType): Use basename as the type name for
17904 (TypeContainer.Define): Do not recursively define types here, as
17905 definition is taken care in order by the RootContext.
17907 * tree.cs: Keep track of namespaces in a per-file basis.
17909 * parameter.cs (Parameter.ComputeSignature): Update to use
17912 (Parameters.GetSignature): ditto.
17914 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17915 instead of a TypeContainer.
17917 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17918 resolve names. Because we need to be resolve in our context, not
17921 * driver.cs: Implement response files.
17923 * class.cs (TypeContainer.DefineType): If we are defined, do not
17924 redefine ourselves.
17926 (Event.Emit): Emit the code for add/remove handlers.
17927 (Event.Define): Save the MethodBuilders for add/remove.
17929 * typemanager.cs: Use pair here too.
17931 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17932 DictionaryEntry requires the first argument to be non-null.
17934 (enum_declaration): Compute full name for registering the
17937 (delegate_declaration): Instead of using
17938 formal_parameter_list, use opt_formal_parameter_list as the list
17941 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17942 (EventParsing): New property that controls whether `add' and
17943 `remove' are returned as tokens or identifiers (for events);
17945 2001-12-19 Ravi Pratap <ravi@ximian.com>
17947 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17948 use MyEventBuilder only and let it wrap the real builder for us.
17950 (MyEventBuilder): Revamp constructor etc.
17952 Implement all operations that we perform on EventBuilder in precisely the same
17955 (FindMembers): Update to use the EventBuilder member.
17957 (Event.Emit): Update accordingly.
17959 2001-12-18 Ravi Pratap <ravi@ximian.com>
17961 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17962 by calling the appropriate methods.
17964 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17967 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17969 2001-12-17 Ravi Pratap <ravi@ximian.com>
17971 * delegate.cs (Delegate.Populate): Check that the return type
17972 and various parameters types are indeed accessible.
17974 * class.cs (Constructor.Define): Same here.
17976 (Field.Define): Ditto.
17978 (Event.Define): Ditto.
17980 (Operator.Define): Check that the underlying Method defined itself
17981 correctly - so it's MethodBuilder should not be null.
17983 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
17984 expression happens to be null.
17986 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
17987 members but as of now we don't seem to be able to do anything really useful with it.
17989 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
17990 not the EventBuilder.
17992 2001-12-18 Miguel de Icaza <miguel@ximian.com>
17994 * cs-tokenizer.cs: Add support for defines.
17995 Add support for #if, #elif, #else, #endif
17997 (eval_var): evaluates a variable.
17998 (eval): stubbed for evaluating functions.
18000 * cs-parser.jay: Pass the defines information
18002 * driver.cs: Add --define command line option.
18004 * decl.cs: Move MemberCore here.
18006 Make it the base class for DeclSpace. This allows us to catch and
18007 report 108 and 109 for everything now.
18009 * class.cs (TypeContainer.Define): Extract all the members
18010 before populating and emit the warning 108 (new keyword required
18011 to override) instead of having each member implement this.
18013 (MemberCore.Define): New abstract method, we will be using this in
18014 the warning reporting engine in Populate.
18016 (Operator.Define): Adjust to new MemberCore protocol.
18018 * const.cs (Const): This does not derive from Expression, it is a
18019 temporary object we use to create fields, it is a MemberCore.
18021 * class.cs (Method.Define): Allow the entry point to be in a
18024 * driver.cs: Rewrite the argument handler to clean it up a bit.
18026 * rootcontext.cs: Made it just an auxiliary namespace feature by
18027 making everything static.
18029 * driver.cs: Adapt code to use RootContext type name instead of
18032 * delegate.cs: Remove RootContext argument.
18034 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
18037 * class.cs (Event.Define): The lookup can fail.
18039 * cs-tokenizer.cs: Begin implementation of pre-procesor.
18041 * expression.cs: Resolve the this instance before invoking the code.
18043 2001-12-17 Miguel de Icaza <miguel@ximian.com>
18045 * cs-parser.jay: Add a production in element_access that allows
18046 the thing to become a "type" reference. This way we can parse
18047 things like "(string [])" as a type.
18049 Note that this still does not handle the more complex rules of
18053 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
18055 * ecore.cs: (CopyNewMethods): new utility function used to
18056 assemble the list of methods from running FindMembers.
18058 (MemberLookup): Rework FindMembers so that
18060 2001-12-16 Miguel de Icaza <miguel@ximian.com>
18062 * class.cs (TypeContainer): Remove Delegates who fail to be
18065 * delegate.cs (Populate): Verify that we dont get null return
18066 values. TODO: Check for AsAccessible.
18068 * cs-parser.jay: Use basename to emit error 574 (destructor should
18069 have the same name as container class), not the full name.
18071 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
18072 possible representation.
18074 Also implements integer type suffixes U and L.
18076 2001-12-15 Miguel de Icaza <miguel@ximian.com>
18078 * expression.cs (ArrayCreation.DoResolve): We need to do the
18079 argument resolution *always*.
18081 * decl.cs: Make this hold the namespace. Hold the root context as
18083 (LookupType): Move here.
18085 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
18087 * location.cs (Row, Name): Fixed the code, it was always returning
18088 references to the first file.
18090 * interface.cs: Register properties defined through interfaces.
18092 * driver.cs: Add support for globbing on the command line
18094 * class.cs (Field): Make it derive from MemberCore as well.
18097 2001-12-15 Ravi Pratap <ravi@ximian.com>
18099 * class.cs (Event::Define): Check that the type of the event is a delegate
18100 type else flag error #66.
18102 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
18105 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
18106 values of EntryPoint, CharSet etc etc.
18108 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
18110 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
18111 be null and we should ignore this. I am not sure if this is really clean. Apparently,
18112 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18113 which needs this to do its work.
18115 * ../errors/cs0066.cs : Add.
18117 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18119 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18122 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18123 clears out the parameters field.
18124 (MemberSignatureCompare): Cleanup
18126 (MemberCore): New base class used to share code between MethodCore
18129 (RegisterRequiredImplementations) BindingFlags.Public requires
18130 either BindingFlags.Instace or Static. Use instance here.
18132 (Property): Refactored code to cope better with the full spec.
18134 * parameter.cs (GetParameterInfo): Return an empty array instead
18137 * class.cs (Property): Abstract or extern properties have no bodies.
18139 * parameter.cs (GetParameterInfo): return a zero-sized array.
18141 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18142 method modifier validation to the typecontainer so we can reuse
18143 this on properties.
18145 (MethodCore.ParameterTypes): return an empty sized array of types.
18147 (Property.Define): Test property modifier validity.
18149 Add tests for sealed/override too.
18151 (Method.Emit): abstract or extern methods have no bodies.
18153 2001-12-14 Ravi Pratap <ravi@ximian.com>
18155 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18158 (Method::Define, ::Emit): Modify accordingly.
18160 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18162 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18164 * makefile: Pass in /unsafe.
18166 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18168 * class.cs (MakeKey): Kill routine.
18170 * class.cs (TypeContainer.Define): Correctly define explicit
18171 method implementations (they require the full interface name plus
18174 * typemanager.cs: Deply the PtrHashtable here and stop using the
18175 lame keys. Things work so much better.
18177 This of course broke everyone who depended on `RegisterMethod' to
18178 do the `test for existance' test. This has to be done elsewhere.
18180 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18181 the object stupid Equals method (because, that like fails all over
18182 the place). We still do not use it.
18184 * class.cs (TypeContainer.SetRequiredInterface,
18185 TypeContainer.RequireMethods): Killed these two routines and moved
18186 all the functionality to RegisterRequiredImplementations.
18188 (TypeContainer.RegisterRequiredImplementations): This routine now
18189 registers all the implementations required in an array for the
18190 interfaces and abstract methods. We use an array of structures
18191 which can be computed ahead of time to reduce memory usage and we
18192 also assume that lookups are cheap as most classes will not
18193 implement too many interfaces.
18195 We also avoid creating too many MethodSignatures.
18197 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18198 clear the "pending" bit if we find that there are problems with
18201 (TypeContainer.VerifyPendingMethods): Update to report errors of
18202 methods that look like implementations but are not.
18204 (TypeContainer.Define): Add support for explicit interface method
18207 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18209 * typemanager.cs: Keep track of the parameters here instead of
18210 being a feature of the TypeContainer.
18212 * class.cs: Drop the registration of parameters here, as
18213 InterfaceMethods are also interface declarations.
18215 * delegate.cs: Register methods with the TypeManager not only with
18216 the TypeContainer. This code was buggy.
18218 * interface.cs: Full registation here.
18220 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18222 * expression.cs: Remove reducer for binary expressions, it can not
18225 * const.cs: Put here the code that used to go into constant.cs
18227 * constant.cs: Put here the code for constants, this is a new base
18228 class for Literals.
18230 * literal.cs: Make Literal derive from Constant.
18232 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18234 * statement.cs (Return.Emit): Report error 157 if the user
18235 attempts to return from a finally block.
18237 (Return.Emit): Instead of emitting a return, jump to the end of
18240 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18241 LocalBuilder to store the result of the function. ReturnLabel is
18242 the target where we jump.
18245 2001-12-09 Radek Doulik <rodo@ximian.com>
18247 * cs-parser.jay: remember alias in current namespace
18249 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18252 * class.cs (LookupAlias): lookup alias in my_namespace
18254 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18256 (LookupAlias): lookup alias in this and if needed in parent
18259 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18263 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18264 making things static. I need this to avoid passing the
18265 TypeContainer when calling ParameterType.
18267 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18268 that did string manipulation to compute the type and then call
18269 GetType. Use Parameter.ParameterType instead.
18271 * cs-tokenizer.cs: Consume the suffix for floating values.
18273 * expression.cs (ParameterReference): figure out whether this is a
18274 reference parameter or not. Kill an extra variable by computing
18275 the arg_idx during emission.
18277 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18278 function that returns whether a parameter is an out/ref value or not.
18280 (Parameter.ParameterType): The type of the parameter (base,
18281 without ref/out applied).
18283 (Parameter.Resolve): Perform resolution here.
18284 (Parameter.ExternalType): The full type (with ref/out applied).
18286 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18287 support for expressions on the using statement.
18289 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18291 * statement.cs (Using.EmitLocalVariableDecls): Split the
18292 localvariable handling of the using statement.
18294 (Block.EmitMeta): Keep track of variable count across blocks. We
18295 were reusing slots on separate branches of blocks.
18297 (Try.Emit): Emit the general code block, we were not emitting it.
18299 Check the type of the declaration to be an IDisposable or
18300 something that can be implicity converted to it.
18302 Emit conversions if required.
18304 * ecore.cs (EmptyExpression): New utility class.
18305 (Expression.ImplicitConversionExists): New utility function.
18307 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18309 * statement.cs (Using): Implement.
18311 * expression.cs (LocalVariableReference): Support read only variables.
18313 * statement.cs: Remove the explicit emit for the Leave opcode.
18314 (VariableInfo): Add a readonly field.
18316 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18318 * ecore.cs (ConvCast): new class used to encapsulate the various
18319 explicit integer conversions that works in both checked and
18320 unchecked contexts.
18322 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18323 properly generate the overflow opcodes.
18325 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18327 * statement.cs: The correct type for the EmptyExpression is the
18328 element_type, not the variable type. Ravi pointed this out.
18330 2001-12-04 Ravi Pratap <ravi@ximian.com>
18332 * class.cs (Method::Define): Handle PInvoke methods specially
18333 by using DefinePInvokeMethod instead of the usual one.
18335 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18336 above to do the task of extracting information and defining the method.
18338 2001-12-04 Ravi Pratap <ravi@ximian.com>
18340 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18341 of the condition for string type.
18343 (Emit): Move that here.
18345 (ArrayCreation::CheckIndices): Keep string literals in their expression
18348 (EmitDynamicInitializers): Handle strings appropriately.
18350 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18352 * codegen.cs (EmitContext): Replace multiple variables with a
18353 single pointer to the current Switch statement.
18355 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18358 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18362 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18365 (Foreach.Emit): Foreach on arrays was not setting
18366 up the loop variables (for break/continue).
18368 (GotoCase): Semi-implented.
18370 2001-12-03 Ravi Pratap <ravi@ximian.com>
18372 * attribute.cs (CheckAttribute): Handle system attributes by using
18373 Attribute.GetAttributes to examine information we need.
18375 (GetValidPlaces): Same here.
18377 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18379 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18381 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18383 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18385 (Method::Emit): Handle the case when we are a PInvoke method.
18387 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18389 * expression.cs: Use ResolveWithSimpleName on compound names.
18391 2001-12-02 Ravi Pratap <ravi@ximian.com>
18393 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18394 before trying to reduce it.
18396 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18398 * constant.cs (LookupConstantValue): Implement.
18400 (EmitConstant): Use the above in emitting the constant.
18402 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18403 that are user-defined by doing a LookupConstantValue on them.
18405 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18408 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18410 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18412 (BaseAccess.DoResolve): Implement.
18414 (MemberAccess.DoResolve): Split this routine into a
18415 ResolveMemberAccess routine that can be used independently
18417 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18419 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18420 As that share bits of the implementation. Is returns a boolean,
18421 while As returns the Type that is being probed.
18423 2001-12-01 Ravi Pratap <ravi@ximian.com>
18425 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18426 instead of a Literal - much easier.
18428 (EnumInTransit): Remove - utterly useless :-)
18430 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18432 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18434 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18435 chain when we have no associated expression.
18437 2001-11-30 Ravi Pratap <ravi@ximian.com>
18439 * constant.cs (Define): Use Location while reporting the errror.
18441 Also emit a warning when 'new' is used and there is no inherited
18444 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18447 (LookupEnumValue): Implement to lookup an enum member's value and define it
18450 (Populate): Re-write accordingly to use the above routine.
18452 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18454 * expression.cs (This): Fix prototype for DoResolveLValue to
18455 override the base class DoResolveLValue.
18457 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18460 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18461 (we need to load the address of the field here). This fixes
18464 (FieldExpr.DoResolveLValue): Call the DoResolve
18465 function to initialize the Instance expression.
18467 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18468 correctly the GetEnumerator operation on a value type.
18470 * cs-parser.jay: Add more simple parsing error catches.
18472 * statement.cs (Switch): Add support for string switches.
18473 Handle null specially.
18475 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18477 2001-11-28 Ravi Pratap <ravi@ximian.com>
18479 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18481 (declare_local_constant): New helper function.
18483 * statement.cs (AddConstant): Keep a separate record of constants
18485 (IsConstant): Implement to determine if a variable is a constant.
18487 (GetConstantExpression): Implement.
18489 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18491 * statement.cs (IsVariableDefined): Re-write.
18493 2001-11-27 Ravi Pratap <ravi@ximian.com>
18495 * class.cs (TypeContainer::FindMembers): Look for constants
18496 in the case when we are looking for MemberTypes.Field
18498 * expression.cs (MemberAccess::DoResolve): Check that in the
18499 case we are a FieldExpr and a Literal, we are not being accessed
18500 by an instance reference.
18502 * cs-parser.jay (local_constant_declaration): Implement.
18504 (declaration_statement): Implement for constant declarations.
18506 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18508 * statement.cs (Switch): Catch double defaults.
18510 (Switch): More work on the switch() statement
18511 implementation. It works for integral values now, need to finish
18515 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18517 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18518 integer literals into other integer literals. To be used by
18521 2001-11-24 Ravi Pratap <ravi@ximian.com>
18523 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18526 (EmitDynamicInitializers): Cope with the above since we extract data
18527 directly from ArrayData now.
18529 (ExpectInitializers): Keep track of whether initializers are mandatory
18532 (Bounds): Make it a hashtable to prevent the same dimension being
18533 recorded for every element in that dimension.
18535 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18538 Also fix bug which was causing the indices to be emitted in the reverse
18541 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18543 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18544 unfinished. They do not work, because the underlying code is
18547 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18549 * cs-parser.jay: Remove bogus fixme.
18551 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18552 on Switch statement.
18554 2001-11-23 Ravi Pratap <ravi@ximian.com>
18556 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18559 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18560 parameter. Apparently, any expression is allowed.
18562 (ValidateInitializers): Update accordingly.
18564 (CheckIndices): Fix some tricky bugs thanks to recursion.
18566 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18567 I was being completely brain-dead.
18569 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18570 and re-write acordingly.
18572 (DelegateInvocation): Re-write accordingly.
18574 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18576 (MakeByteBlob): Handle types more correctly.
18578 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18579 initialization from expressions but it is incomplete because I am a complete
18582 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18584 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18585 on If. Basically, we have to return `true' (ie, we do return to
18586 our caller) only if both branches of the if return.
18588 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18589 short-circuit operators, handle them as short circuit operators.
18591 (Cast.DoResolve): Resolve type.
18592 (Cast.Cast): Take an expression as the target type.
18594 * cs-parser.jay (cast_expression): Remove old hack that only
18595 allowed a limited set of types to be handled. Now we take a
18596 unary_expression and we resolve to a type during semantic
18599 Use the grammar productions from Rhys to handle casts (this is
18600 not complete like Rhys syntax yet, we fail to handle that corner
18601 case that C# has regarding (-x), but we will get there.
18603 2001-11-22 Ravi Pratap <ravi@ximian.com>
18605 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18606 field which is an array type.
18608 * cs-parser.jay (declare_local_variables): Support array initialization too.
18610 * typemanager.cs (MakeKey): Implement.
18612 (everywhere): Use the above appropriately.
18614 * cs-parser.jay (for_statement): Update for array initialization while
18615 declaring variables.
18617 * ecore.cs : The error message was correct, it's the variable's names that
18618 were misleading ;-) Make the code more readable.
18620 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18621 the correct type etc.
18623 (ConvertExplicit): Handle Enum types by examining the underlying type.
18625 2001-11-21 Ravi Pratap <ravi@ximian.com>
18627 * parameter.cs (GetCallingConvention): Always return
18628 CallingConventions.Standard for now.
18630 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18632 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18633 and `r' after calling DoNumericPromotions.
18635 * ecore.cs: Fix error message (the types were in the wrong order).
18637 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18638 BindingFlags.Instance as well
18640 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18641 implicit int literal conversion in an empty cast so that we
18642 propagate the right type upstream.
18644 (UnboxCast): new class used to unbox value types.
18645 (Expression.ConvertExplicit): Add explicit type conversions done
18648 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18649 the target type before applying the implicit LongLiterals to ULong
18652 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18654 * cs-parser.jay (for_statement): Reworked the way For works: now
18655 we declare manually any variables that are introduced in
18656 for_initializer to solve the problem of having out-of-band code
18657 emition (that is what got for broken).
18659 (declaration_statement): Perform the actual variable declaration
18660 that used to be done in local_variable_declaration here.
18662 (local_variable_declaration): Do not declare anything, just pass
18663 the information on a DictionaryEntry
18665 2001-11-20 Ravi Pratap <ravi@ximian.com>
18667 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18668 re-write of the logic to now make it recursive.
18670 (UpdateIndices): Re-write accordingly.
18672 Store element data in a separate ArrayData list in the above methods.
18674 (MakeByteBlob): Implement to dump the array data into a byte array.
18676 2001-11-19 Ravi Pratap <ravi@ximian.com>
18678 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18681 * constant.cs (Define): Implement.
18683 (EmitConstant): Re-write fully.
18685 Pass in location info.
18687 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18690 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18691 DictionaryEntry since we need location info too.
18693 (constant_declaration): Update accordingly.
18695 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18696 code into another method : UpdateIndices.
18698 2001-11-18 Ravi Pratap <ravi@ximian.com>
18700 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18701 some type checking etc.
18703 2001-11-17 Ravi Pratap <ravi@ximian.com>
18705 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18706 bits to provide dimension info if the user skips doing that.
18708 Update second constructor to store the rank correctly.
18710 2001-11-16 Ravi Pratap <ravi@ximian.com>
18712 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18713 and try to implement.
18715 * ../errors/cs0150.cs : Add.
18717 * ../errors/cs0178.cs : Add.
18719 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18721 * statement.cs: Implement foreach on multi-dimensional arrays.
18723 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18724 name of the params argument.
18726 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18727 initializing the array.
18729 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18730 we can use this elsewhere.
18732 * statement.cs: Finish implementation of foreach for single
18735 * cs-parser.jay: Use an out-of-band stack to pass information
18736 around, I wonder why I need this.
18738 foreach_block: Make the new foreach_block the current_block.
18740 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18741 function used to return a static Parameters structure. Used for
18742 empty parameters, as those are created very frequently.
18744 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18746 2001-11-15 Ravi Pratap <ravi@ximian.com>
18748 * interface.cs : Default modifier is private, not public. The
18749 make verify test passes again.
18751 2001-11-15 Ravi Pratap <ravi@ximian.com>
18753 * support.cs (ReflectionParameters): Fix logic to determine
18754 whether the last parameter is a params one. Test 9 passes again.
18756 * delegate.cs (Populate): Register the builders we define with
18757 RegisterParameterForBuilder. Test 19 passes again.
18759 * cs-parser.jay (property_declaration): Reference $6 instead
18760 of $$ to get at the location.
18762 (indexer_declaration): Similar stuff.
18764 (attribute): Ditto.
18766 * class.cs (Property): Register parameters for the Get and Set methods
18767 if they exist. Test 23 passes again.
18769 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18770 call to EmitArguments as we are sure there aren't any params arguments.
18771 Test 32 passes again.
18773 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18774 IndexOutOfRangeException.
18776 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18777 Test 33 now passes again.
18779 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18781 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18782 broke a bunch of things. Will have to come up with a better way
18783 of tracking locations.
18785 * statement.cs: Implemented foreach for single dimension arrays.
18787 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18789 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18790 an error. This removes the lookup from the critical path.
18792 * cs-parser.jay: Removed use of temporary_loc, which is completely
18795 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18797 * support.cs (ReflectionParameters.ParameterModifier): Report
18798 whether the argument is a PARAMS argument or not.
18800 * class.cs: Set the attribute `ParamArrayAttribute' on the
18801 parameter argument.
18803 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18804 and cons_param_array_attribute (ConstructorInfo for
18805 ParamArrayAttribute).,
18807 * codegen.cs: Emit the return using the `Return' statement, that
18808 way we can report the error correctly for missing return values.
18810 * class.cs (Method.Emit): Clean up.
18812 * expression.cs (Argument.Resolve): Take another argument: the
18813 location where this argument is used. Notice that this is not
18814 part of the "Argument" class as to reduce the size of the
18815 structure (we know the approximate location anyways).
18817 Test if the argument is a variable-reference, if not, then
18818 complain with a 206.
18820 (Argument.Emit): Emit addresses of variables.
18822 (Argument.FullDesc): Simplify.
18824 (Invocation.DoResolve): Update for Argument.Resolve.
18826 (ElementAccess.DoResolve): ditto.
18828 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18829 method should be virtual, as this method is always virtual.
18831 (NewDelegate.DoResolve): Update for Argument.Resolve.
18833 * class.cs (ConstructorInitializer.DoResolve): ditto.
18835 * attribute.cs (Attribute.Resolve): ditto.
18837 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18839 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18841 * expression.cs (ParameterReference): Drop IStackStorage and implement
18842 IAssignMethod instead.
18844 (LocalVariableReference): ditto.
18846 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18847 IAssignMethod instead.
18849 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18851 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18852 enumerations that are used in heavily used structures derive from
18853 byte in a laughable and pathetic attempt to reduce memory usage.
18854 This is the kind of pre-optimzations that you should not do at
18855 home without adult supervision.
18857 * expression.cs (UnaryMutator): New class, used to handle ++ and
18858 -- separatedly from the other unary operators. Cleans up the
18859 code, and kills the ExpressionStatement dependency in Unary.
18861 (Unary): Removed `method' and `Arguments' from this class, making
18862 it smaller, and moving it all to SimpleCall, so I can reuse this
18863 code in other locations and avoid creating a lot of transient data
18864 strucutres when not required.
18866 * cs-parser.jay: Adjust for new changes.
18868 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18870 * enum.cs (Enum.Populate): If there is a failure during
18873 * cs-parser.jay (opt_enum_base): we used to catch type errors
18874 here, but this is really incorrect. The type error should be
18875 catched during semantic analysis.
18877 2001-12-11 Ravi Pratap <ravi@ximian.com>
18879 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18880 current_local_parameters as expected since I, in my stupidity, had forgotten
18883 * attribute.cs (GetValidPlaces): Fix stupid bug.
18885 * class.cs (Method::Emit): Perform check on applicability of attributes.
18887 (Constructor::Emit): Ditto.
18889 (Field::Emit): Ditto.
18891 (Field.Location): Store location information.
18893 (Property, Event, Indexer, Operator): Ditto.
18895 * cs-parser.jay (field_declaration): Pass in location for each field.
18897 * ../errors/cs0592.cs : Add.
18899 2001-11-12 Ravi Pratap <ravi@ximian.com>
18901 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18903 (InitCoreTypes): Update accordingly.
18905 (RegisterAttrType, LookupAttr): Implement.
18907 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18908 info about the same.
18910 (Resolve): Update to populate the above as necessary.
18912 (Error592): Helper.
18914 (GetValidPlaces): Helper to the above.
18916 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18918 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18920 2001-11-12 Ravi Pratap <ravi@ximian.com>
18922 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18924 * ../errors/cs0617.cs : Add.
18926 2001-11-11 Ravi Pratap <ravi@ximian.com>
18928 * enum.cs (Emit): Rename to Populate to be more consistent with what
18929 we expect it to do and when exactly it is called.
18931 * class.cs, rootcontext.cs : Update accordingly.
18933 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18934 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18936 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18938 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18939 of a fieldinfo using the above, when dealing with a FieldBuilder.
18941 2001-11-10 Ravi Pratap <ravi@ximian.com>
18943 * ../errors/cs0031.cs : Add.
18945 * ../errors/cs1008.cs : Add.
18947 * ../errrors/cs0543.cs : Add.
18949 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18952 (FindMembers): Implement.
18954 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18955 enums and delegates too.
18957 (enum_types): Rename to builder_to_enum.
18959 (delegate_types): Rename to builder_to_delegate.
18961 * delegate.cs (FindMembers): Implement.
18963 2001-11-09 Ravi Pratap <ravi@ximian.com>
18965 * typemanager.cs (IsEnumType): Implement.
18967 * enum.cs (Emit): Re-write parts to account for the underlying type
18968 better and perform checking etc.
18970 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
18971 of the underlying type.
18973 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
18976 * enum.cs (error31): Helper to report error #31.
18978 * cs-parser.jay (enum_declaration): Store location of each member too.
18980 * enum.cs (member_to_location): New hashtable.
18982 (AddEnumMember): Update location hashtable.
18984 (Emit): Use the location of each member while reporting errors.
18986 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18988 * cs-parser.jay: A for_initializer if is a
18989 local_variable_declaration really ammount to have an implicit
18990 block with the variable declaration and no initializer for for.
18992 * statement.cs (For.Emit): Cope with null initializers.
18994 This fixes the infinite loop on for initializers.
18996 2001-11-08 Miguel de Icaza <miguel@ximian.com>
18998 * enum.cs: More cleanup.
19000 * ecore.cs: Remove dead code.
19002 * class.cs (Property.Emit): More simplification.
19003 (Event.Emit): ditto.
19005 Reworked to have less levels of indentation.
19007 2001-11-08 Ravi Pratap <ravi@ximian.com>
19009 * class.cs (Property): Emit attributes.
19019 * enum.cs (Emit): Ditto.
19021 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
19024 * class.cs (Field, Event, etc.): Move attribute generation into the
19025 Emit method everywhere.
19027 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
19028 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
19029 as we had no way of defining nested enums !
19031 * rootcontext.cs : Adjust code accordingly.
19033 * typemanager.cs (AddEnumType): To keep track of enum types separately.
19035 2001-11-07 Ravi Pratap <ravi@ximian.com>
19037 * expression.cs (EvalConstantExpression): Move into ecore.cs
19039 * enum.cs (Enum): Rename some members and make them public and readonly
19040 according to our convention.
19042 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
19045 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
19047 (Enum::Emit): Write a simple version for now which doesn't try to compute
19048 expressions. I shall modify this to be more robust in just a while.
19050 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
19052 (TypeContainer::CloseType): Create the Enum types too.
19054 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
19056 * expression.cs (EvalConstantExpression): Get rid of completely.
19058 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
19059 user-defined values and other cases.
19061 (IsValidEnumLiteral): Helper function.
19063 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
19064 out there in the case we had a literal FieldExpr.
19066 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
19068 (Literalize): Revamp a bit to take two arguments.
19070 (EnumLiteral): New class which derives from Literal to wrap enum literals.
19072 2001-11-06 Ravi Pratap <ravi@ximian.com>
19074 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
19076 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
19078 (Resolve): Use the above to ensure we have proper initializers.
19080 2001-11-05 Ravi Pratap <ravi@ximian.com>
19082 * expression.cs (Expression::EvalConstantExpression): New method to
19083 evaluate constant expressions.
19085 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
19087 2001-11-07 Miguel de Icaza <miguel@ximian.com>
19089 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
19092 (Binary.ResolveOperator): Handle operator != (object a, object b)
19093 and operator == (object a, object b);
19095 (Binary.DoNumericPromotions): Indicate whether the numeric
19096 promotion was possible.
19098 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
19101 Made the ArrayAccess implement interface IAssignMethod instead of
19102 IStackStore as the order in which arguments are passed reflects
19105 * assign.cs: Instead of using expr.ExprClass to select the way of
19106 assinging, probe for the IStackStore/IAssignMethod interfaces.
19108 * typemanager.cs: Load InitializeArray definition.
19110 * rootcontext.cs (RootContext.MakeStaticData): Used to define
19111 static data that can be used to initialize arrays.
19113 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19115 * expression.cs: Handle operator== and operator!= for booleans.
19117 (Conditioal.Reduce): Implement reducer for the ?: operator.
19119 (Conditional.Resolve): Implement dead code elimination.
19121 (Binary.Resolve): Catch string literals and return a new
19122 concatenated string.
19124 (Unary.Reduce): Implement reduction of unary expressions.
19126 * ecore.cs: Split out the expression core handling here.
19128 (Expression.Reduce): New method used to perform constant folding
19129 and CSE. This is needed to support constant-expressions.
19131 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19132 targets, and optimize for !x.
19134 2001-11-04 Ravi Pratap <ravi@ximian.com>
19136 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19137 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19138 set custom atttributes.
19140 * literal.cs (Literal::GetValue): New abstract method to return the actual
19141 value of the literal, cast as an object.
19143 (*Literal): Implement GetValue method.
19145 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19146 expressions to the arraylist but objects of type Argument.
19148 * class.cs (TypeContainer::Emit): Emit our attributes too.
19150 (Method::Emit, Constructor::Emit): Ditto.
19152 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19153 to be ignoring earlier.
19155 2001-11-03 Ravi Pratap <ravi@ximian.com>
19157 * attribute.cs (AttributeSection::Define): Implement to do the business
19158 of constructing a CustomAttributeBuilder.
19160 (Attribute): New trivial class. Increases readability of code.
19162 * cs-parser.jay : Update accordingly.
19164 (positional_argument_list, named_argument_list, named_argument): New rules
19166 (attribute_arguments): Use the above so that we are more correct.
19168 2001-11-02 Ravi Pratap <ravi@ximian.com>
19170 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19171 to perform all checks for a method with a params parameter.
19173 (Invocation::OverloadResolve): Update to use the above method and therefore
19174 cope correctly with params method invocations.
19176 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19179 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19180 constructors in our parent too because we can't afford to miss out on
19183 * attribute.cs (AttributeSection): New name for the class Attribute
19185 Other trivial changes to improve readability.
19187 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19188 use the new class names.
19190 2001-11-01 Ravi Pratap <ravi@ximian.com>
19192 * class.cs (Method::Define): Complete definition for params types too
19194 (Indexer::Define): Ditto.
19196 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19197 Cope everywhere with a request for info about the array parameter.
19199 2001-11-01 Ravi Pratap <ravi@ximian.com>
19201 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19203 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19204 local_variable_type to extract the string corresponding to the type.
19206 (local_variable_type): Fixup the action to use the new helper method.
19208 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19211 * expression.cs : Clean out code which uses the above.
19213 2001-10-31 Ravi Pratap <ravi@ximian.com>
19215 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19216 and bale out if necessary by returning a false.
19218 (RegisterProperty): Ditto.
19220 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19221 and print out appropriate error messages.
19223 * interface.cs (everywhere): Ditto.
19225 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19226 location to constructor.
19228 * class.cs (Property, Event, Indexer): Update accordingly.
19230 * ../errors/cs111.cs : Added.
19232 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19233 of a method, as laid down by the spec.
19235 (Invocation::OverloadResolve): Use the above method.
19237 2001-10-31 Ravi Pratap <ravi@ximian.com>
19239 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19240 now take a TypeContainer and a Parameters object.
19242 (ParameterData): Modify return type of ParameterModifier method to be
19243 Parameter.Modifier and not a string.
19245 (ReflectionParameters, InternalParameters): Update accordingly.
19247 * expression.cs (Argument::GetParameterModifier): Same here.
19249 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19250 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19251 symbol in it at all so maybe this is only for now.
19253 2001-10-30 Ravi Pratap <ravi@ximian.com>
19255 * support.cs (InternalParameters): Constructor now takes an extra argument
19256 which is the actual Parameters class.
19258 (ParameterDesc): Update to provide info on ref/out modifiers.
19260 * class.cs (everywhere): Update call to InternalParameters to pass in
19261 the second argument too.
19263 * support.cs (ParameterData): Add ParameterModifier, which is a method
19264 to return the modifier info [ref/out etc]
19266 (InternalParameters, ReflectionParameters): Implement the above.
19268 * expression.cs (Argument::ParameterModifier): Similar function to return
19269 info about the argument's modifiers.
19271 (Invocation::OverloadResolve): Update to take into account matching modifiers
19274 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19275 a new SetFormalParameters object which we pass to InternalParameters.
19277 2001-10-30 Ravi Pratap <ravi@ximian.com>
19279 * expression.cs (NewArray): Merge into the ArrayCreation class.
19281 2001-10-29 Ravi Pratap <ravi@ximian.com>
19283 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19284 NewUserdefinedArray into one as there wasn't much of a use in having
19287 * expression.cs (Argument): Change field's name to ArgType from Type.
19289 (Type): New readonly property which returns the proper type, taking into
19290 account ref/out modifiers.
19292 (everywhere): Adjust code accordingly for the above.
19294 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19295 whether we are emitting for a ref or out parameter.
19297 * expression.cs (Argument::Emit): Use the above field to set the state.
19299 (LocalVariableReference::Emit): Update to honour the flag and emit the
19302 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19304 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19306 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19308 (ReflectionParameters, InternalParameters): Implement the above method.
19310 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19313 (Invocation::FullMethodDesc): Ditto.
19315 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19317 * cs-parser.jay: Add extra production for the second form of array
19320 * expression.cs (ArrayCreation): Update to reflect the above
19323 * Small changes to prepare for Array initialization.
19325 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19327 * typemanager.cs (ImplementsInterface): interface might be null;
19328 Deal with this problem;
19330 Also, we do store negative hits on the cache (null values), so use
19331 this instead of calling t.GetInterfaces on the type everytime.
19333 2001-10-28 Ravi Pratap <ravi@ximian.com>
19335 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19337 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19338 split functionality out into different classes.
19340 (New::FormArrayType): Move into NewBuiltinArray.
19342 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19345 (NewBuiltinArray): New class to handle creation of built-in arrays.
19347 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19348 account creation of one-dimensional arrays.
19350 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19352 (NewUserdefinedArray::DoResolve): Implement.
19354 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19356 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19357 we maintain inside the TypeManager. This is necessary to perform lookups on the
19360 (LookupType): Update to perform GetType on the module builders too.
19362 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19364 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19366 2001-10-23 Ravi Pratap <ravi@ximian.com>
19368 * expression.cs (New::DoResolve): Implement guts of array creation.
19370 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19372 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19374 * expression.cs: Fix bug I introduced lsat night that broke
19377 (Expression.Resolve): Report a 246 error (can not resolve name)
19378 if we find a SimpleName in the stream.
19380 (Expression.ResolveLValue): Ditto.
19382 (Expression.ResolveWithSimpleName): This function is a variant of
19383 ResolveName, this one allows SimpleNames to be returned without a
19384 warning. The only consumer of SimpleNames is MemberAccess
19386 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19388 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19389 might arrive here. I have my doubts that this is correct.
19391 * statement.cs (Lock): Implement lock statement.
19393 * cs-parser.jay: Small fixes to support `lock' and `using'
19395 * cs-tokenizer.cs: Remove extra space
19397 * driver.cs: New flag --checked, allows to turn on integer math
19400 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19401 Threading.Monitor.Exit
19403 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19405 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19406 Expression Class to be IndexerAccess.
19408 Notice that Indexer::DoResolve sets the eclass to Value.
19410 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19412 * class.cs (TypeContainer::Emit): Emit code for indexers.
19414 * assign.cs (IAssignMethod): New interface implemented by Indexers
19415 and Properties for handling assignment.
19417 (Assign::Emit): Simplify and reuse code.
19419 * expression.cs (IndexerAccess, PropertyExpr): Implement
19420 IAssignMethod, clean up old code.
19422 2001-10-22 Ravi Pratap <ravi@ximian.com>
19424 * typemanager.cs (ImplementsInterface): New method to determine if a type
19425 implements a given interface. Provides a nice cache too.
19427 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19430 (ConvertReferenceExplicit): Ditto.
19432 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19433 various methods, with correct names etc.
19435 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19436 Operator.UnaryNegation.
19438 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19439 we have a unary plus or minus operator.
19441 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19444 * everywhere : update accordingly.
19446 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19449 * class.cs (Method::Define): For the case where we are implementing a method
19450 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19451 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19453 2001-10-21 Ravi Pratap <ravi@ximian.com>
19455 * interface.cs (FindMembers): Implement to work around S.R.E
19458 * typemanager.cs (IsInterfaceType): Implement.
19460 (FindMembers): Update to handle interface types too.
19462 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19463 use IsAssignableFrom as that is not correct - it doesn't work.
19465 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19466 and accordingly override EmitStatement.
19468 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19469 using the correct logic :-)
19471 2001-10-19 Ravi Pratap <ravi@ximian.com>
19473 * ../errors/cs-11.cs : Add to demonstrate error -11
19475 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19477 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19478 then pass this as a hint to ResolveLValue.
19480 * expression.cs (FieldExpr): Add Location information
19482 (FieldExpr::LValueResolve): Report assignment to readonly
19485 (Expression::ExprClassFromMemberInfo): Pass location information.
19487 (Expression::ResolveLValue): Add new method that resolves an
19490 (Expression::DoResolveLValue): Default invocation calls
19493 (Indexers): New class used to keep track of indexers in a given
19496 (IStackStore): Renamed from LValue, as it did not really describe
19497 what this did. Also ResolveLValue is gone from this interface and
19498 now is part of Expression.
19500 (ElementAccess): Depending on the element access type
19502 * typemanager.cs: Add `indexer_name_type' as a Core type
19503 (System.Runtime.CompilerServices.IndexerNameAttribute)
19505 * statement.cs (Goto): Take a location.
19507 2001-10-18 Ravi Pratap <ravi@ximian.com>
19509 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19510 if two delegates are compatible.
19512 (NewDelegate::DoResolve): Update to take care of the case when
19513 we instantiate a delegate from another delegate.
19515 * typemanager.cs (FindMembers): Don't even try to look up members
19516 of Delegate types for now.
19518 2001-10-18 Ravi Pratap <ravi@ximian.com>
19520 * delegate.cs (NewDelegate): New class to take care of delegate
19523 * expression.cs (New): Split the delegate related code out into
19524 the NewDelegate class.
19526 * delegate.cs (DelegateInvocation): New class to handle delegate
19529 * expression.cs (Invocation): Split out delegate related code into
19530 the DelegateInvocation class.
19532 2001-10-17 Ravi Pratap <ravi@ximian.com>
19534 * expression.cs (New::DoResolve): Implement delegate creation fully
19535 and according to the spec.
19537 (New::DoEmit): Update to handle delegates differently.
19539 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19540 because of which we were printing out arguments in reverse order !
19542 * delegate.cs (VerifyMethod): Implement to check if the given method
19543 matches the delegate.
19545 (FullDelegateDesc): Implement.
19547 (VerifyApplicability): Implement.
19549 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19550 delegate invocations too.
19552 (Invocation::Emit): Ditto.
19554 * ../errors/cs1593.cs : Added.
19556 * ../errors/cs1594.cs : Added.
19558 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19560 2001-10-16 Ravi Pratap <ravi@ximian.com>
19562 * typemanager.cs (intptr_type): Core type for System.IntPtr
19564 (InitCoreTypes): Update for the same.
19566 (iasyncresult_type, asynccallback_type): Ditto.
19568 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19571 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19574 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19575 the builders for the 4 members of a delegate type :-)
19577 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19580 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19582 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19584 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19586 * statement.cs (Break::Emit): Implement.
19587 (Continue::Emit): Implement.
19589 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19590 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19591 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19592 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19595 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19596 properties that track the label for the current loop (begin of the
19597 loop and end of the loop).
19599 2001-10-15 Ravi Pratap <ravi@ximian.com>
19601 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19602 use of emitting anything at all.
19604 * class.cs, rootcontext.cs : Get rid of calls to the same.
19606 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19608 (Populate): Define the constructor correctly and set the implementation
19611 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19614 (AddDelegateType): Implement.
19616 (IsDelegateType): Implement helper method.
19618 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19620 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19621 and accordingly handle it.
19623 * delegate.cs (Populate): Take TypeContainer argument.
19624 Implement bits to define the Invoke method. However, I still haven't figured out
19625 how to take care of the native int bit :-(
19627 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19628 Qualify the name of the delegate, not its return type !
19630 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19633 (StandardConversionExists): Checking for array types turns out to be recursive.
19635 (ConvertReferenceExplicit): Implement array conversion.
19637 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19639 2001-10-12 Ravi Pratap <ravi@ximian.com>
19641 * cs-parser.jay (delegate_declaration): Store the fully qualified
19642 name as it is a type declaration.
19644 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19647 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19648 as TypeContainer::DefineType.
19650 (Populate): Method in which all the definition of the various methods (Invoke)
19653 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19656 (CloseDelegate): Finally creates the delegate.
19658 * class.cs (TypeContainer::DefineType): Update to define delegates.
19659 (Populate, Emit and CloseType): Do the same thing here too.
19661 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19662 delegates in all these operations.
19664 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19666 * expression.cs: LocalTemporary: a new expression used to
19667 reference a temporary that has been created.
19669 * assign.cs: Handle PropertyAccess back here, so that we can
19670 provide the proper semantic access to properties.
19672 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19673 a few more explicit conversions.
19675 * modifiers.cs: `NEW' modifier maps to HideBySig.
19677 * expression.cs (PropertyExpr): Make this into an
19678 ExpressionStatement, and support the EmitStatement code path.
19680 Perform get/set error checking, clean up the interface.
19682 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19683 them into toplevel access objects.
19685 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19687 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19690 * typemanager.cs: Keep track here of our PropertyBuilders again to
19691 work around lameness in SRE.
19693 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19695 * expression.cs (LValue::LValueResolve): New method in the
19696 interface, used to perform a second resolution pass for LValues.
19698 (This::DoResolve): Catch the use of this in static methods.
19700 (This::LValueResolve): Implement.
19702 (This::Store): Remove warning, assigning to `this' in structures
19705 (Invocation::Emit): Deal with invocation of
19706 methods on value types. We need to pass the address to structure
19707 methods rather than the object itself. (The equivalent code to
19708 emit "this" for structures leaves the entire structure on the
19709 stack instead of a pointer to it).
19711 (ParameterReference::DoResolve): Compute the real index for the
19712 argument based on whether the method takes or not a `this' pointer
19713 (ie, the method is static).
19715 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19716 value types returned from functions when we need to invoke a
19717 method on the sturcture.
19720 2001-10-11 Ravi Pratap <ravi@ximian.com>
19722 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19723 defining the type in the Modulebuilder or Typebuilder. This is to take
19724 care of nested types which need to be defined on the TypeBuilder using
19725 DefineNestedMethod.
19727 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19728 methods in RootContext, only ported to be part of TypeContainer.
19730 (TypeContainer::GetInterfaceOrClass): Ditto.
19732 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19734 * interface.cs (Interface::DefineInterface): New method. Does exactly
19735 what RootContext.CreateInterface did earlier, only it takes care of nested types
19738 (Interface::GetInterfaces): Move from RootContext here and port.
19740 (Interface::GetInterfaceByName): Same here.
19742 * rootcontext.cs (ResolveTree): Re-write.
19744 (PopulateTypes): Re-write.
19746 * class.cs (TypeContainer::Populate): Populate nested types too.
19747 (TypeContainer::Emit): Emit nested members too.
19749 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19750 instead just use the name argument passed in as it is already fully
19753 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19754 to TypeContainer mapping to see if a type is user-defined.
19756 * class.cs (TypeContainer::CloseType): Implement.
19758 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19759 the default constructor.
19761 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19764 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19766 * interface.cs (CloseType): Create the type here.
19768 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19771 Remove all the methods which are now in TypeContainer.
19773 2001-10-10 Ravi Pratap <ravi@ximian.com>
19775 * delegate.cs (Define): Re-write bits to define the delegate
19778 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19780 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19782 * expression.cs (ImplicitReferenceConversion): handle null as well
19783 as a source to convert to any reference type.
19785 * statement.cs (Return): Perform any implicit conversions to
19786 expected return type.
19788 Validate use of return statement.
19790 * codegen.cs (EmitContext): Pass the expected return type here.
19792 * class.cs (Method, Constructor, Property): Pass expected return
19793 type to EmitContext.
19795 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19797 * expression.cs: Make DoResolve take an EmitContext instead of a
19800 Replaced `l' and `location' for `loc', for consistency.
19802 (Error, Warning): Remove unneeded Tc argument.
19804 * assign.cs, literal.cs, constant.cs: Update to new calling
19807 * codegen.cs: EmitContext now contains a flag indicating whether
19808 code is being generated in a static method or not.
19810 * cs-parser.jay: DecomposeQI, new function that replaces the old
19811 QualifiedIdentifier. Now we always decompose the assembled
19812 strings from qualified_identifier productions into a group of
19815 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19817 * rootcontext.cs: Deal with field-less struct types correctly now
19818 by passing the size option to Define Type.
19820 * class.cs: Removed hack that created one static field.
19822 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19824 * statement.cs: Moved most of the code generation here.
19826 2001-10-09 Ravi Pratap <ravi@ximian.com>
19828 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19831 (ElementAccess): Remove useless bits for now - keep checks as the spec
19834 2001-10-08 Ravi Pratap <ravi@ximian.com>
19836 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19837 and start performing checks according to the spec.
19839 2001-10-07 Ravi Pratap <ravi@ximian.com>
19841 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19842 rank_specifiers instead.
19844 (rank_specifiers): Change the order in which the rank specifiers are stored
19846 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19848 * expression.cs (ElementAccess): Implement the LValue interface too.
19850 2001-10-06 Ravi Pratap <ravi@ximian.com>
19852 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19853 except that user defined conversions are not included.
19855 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19856 perform the conversion of the return type, if necessary.
19858 (New::DoResolve): Check whether we are creating an array or an object
19859 and accordingly do the needful.
19861 (New::Emit): Same here.
19863 (New::DoResolve): Implement guts of array creation.
19865 (New::FormLookupType): Helper function.
19867 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19869 * codegen.cs: Removed most of the code generation here, and move the
19870 corresponding code generation bits to the statement classes.
19872 Added support for try/catch/finalize and throw.
19874 * cs-parser.jay: Added support for try/catch/finalize.
19876 * class.cs: Catch static methods having the flags override,
19877 virtual or abstract.
19879 * expression.cs (UserCast): This user cast was not really doing
19880 what it was supposed to do. Which is to be born in fully resolved
19881 state. Parts of the resolution were being performed at Emit time!
19885 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19887 * expression.cs: Implicity convert the result from UserCast.
19889 2001-10-05 Ravi Pratap <ravi@ximian.com>
19891 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19892 prevented it from working correctly.
19894 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19895 merely ConvertImplicit.
19897 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19899 * typemanager.cs: Make the LookupTypeContainer function static,
19900 and not per-instance.
19902 * class.cs: Make static FindMembers (the one that takes a Type
19905 * codegen.cs: Add EmitForeach here.
19907 * cs-parser.jay: Make foreach a toplevel object instead of the
19908 inline expansion, as we need to perform semantic analysis on it.
19910 2001-10-05 Ravi Pratap <ravi@ximian.com>
19912 * expression.cs (Expression::ImplicitUserConversion): Rename to
19913 UserDefinedConversion.
19915 (Expression::UserDefinedConversion): Take an extra argument specifying
19916 whether we look for explicit user conversions too.
19918 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19920 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19922 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19923 with the appropriate arguments.
19925 * cs-parser.jay (cast_expression): Record location too.
19927 * expression.cs (Cast): Record location info.
19929 (Expression::ConvertExplicit): Take location argument.
19931 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19932 to determine if we are doing explicit conversions.
19934 (UserCast::Emit): Update accordingly.
19936 (Expression::ConvertExplicit): Report an error if everything fails.
19938 * ../errors/cs0030.cs : Add.
19940 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19942 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19943 virtual and newslot bits.
19945 * class.cs (TypeContainer::RegisterRequiredImplementations):
19946 Record methods we need.
19948 (TypeContainer::MakeKey): Helper function to make keys for
19949 MethodBases, since the Methodbase key is useless.
19951 (TypeContainer::Populate): Call RegisterRequiredImplementations
19952 before defining the methods.
19954 Create a mapping for method_builders_to_methods ahead of time
19955 instead of inside a tight loop.
19957 (::RequireMethods): Accept an object as the data to set into the
19958 hashtable so we can report interface vs abstract method mismatch.
19960 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19962 * report.cs: Make all of it static.
19964 * rootcontext.cs: Drop object_type and value_type computations, as
19965 we have those in the TypeManager anyways.
19967 Drop report instance variable too, now it is a global.
19969 * driver.cs: Use try/catch on command line handling.
19971 Add --probe option to debug the error reporting system with a test
19974 * report.cs: Add support for exiting program when a probe
19975 condition is reached.
19977 2001-10-03 Ravi Pratap <ravi@ximian.com>
19979 * expression.cs (Binary::DoNumericPromotions): Fix the case when
19980 we do a forcible conversion regardless of type, to check if
19981 ForceConversion returns a null.
19983 (Binary::error19): Use location to report error.
19985 (Unary::error23): Use location here too.
19987 * ../errors/cs0019.cs : Check in.
19989 * ../errors/cs0023.cs : Check in.
19991 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
19992 case of a non-null MethodInfo object with a length of 0 !
19994 (Binary::ResolveOperator): Flag error if overload resolution fails to find
19995 an applicable member - according to the spec :-)
19996 Also fix logic to find members in base types.
19998 (Unary::ResolveOperator): Same here.
20000 (Unary::report23): Change name to error23 and make first argument a TypeContainer
20001 as I was getting thoroughly confused between this and error19 :-)
20003 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
20004 (::FindMostEncompassedType): Implement.
20005 (::FindMostEncompassingType): Implement.
20006 (::StandardConversionExists): Implement.
20008 (UserImplicitCast): Re-vamp. We now need info about most specific
20009 source and target types so that we can do the necessary conversions.
20011 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
20012 mathematical union with no duplicates.
20014 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20016 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
20017 in order from base classes to child classes, so that we can in
20018 child classes look up in our parent for method names and
20019 attributes (required for handling abstract, virtual, new, override
20020 constructs: we need to instrospect our base class, and if we dont
20021 populate the classes in order, the introspection might be
20022 incorrect. For example, a method could query its parent before
20023 the parent has any methods and would determine that the parent has
20024 no abstract methods (while it could have had them)).
20026 (RootContext::CreateType): Record the order in which we define the
20029 2001-10-02 Miguel de Icaza <miguel@ximian.com>
20031 * class.cs (TypeContainer::Populate): Also method definitions can
20032 fail now, keep track of this.
20034 (TypeContainer::FindMembers): Implement support for
20035 DeclaredOnly/noDeclaredOnly flag.
20037 (Constructor::Emit) Return the ConstructorBuilder.
20039 (Method::Emit) Return the MethodBuilder.
20040 Check for abstract or virtual methods to be public.
20042 * rootcontext.cs (RootContext::CreateType): Register all the
20043 abstract methods required for the class to be complete and the
20044 interface methods that must be implemented.
20046 * cs-parser.jay: Report error 501 (method requires body if it is
20047 not marked abstract or extern).
20049 * expression.cs (TypeOf::Emit): Implement.
20051 * typemanager.cs: runtime_handle_type, new global type.
20053 * class.cs (Property::Emit): Generate code for properties.
20055 2001-10-02 Ravi Pratap <ravi@ximian.com>
20057 * expression.cs (Unary::ResolveOperator): Find operators on base type
20058 too - we now conform exactly to the spec.
20060 (Binary::ResolveOperator): Same here.
20062 * class.cs (Operator::Define): Fix minor quirk in the tests.
20064 * ../errors/cs0215.cs : Added.
20066 * ../errors/cs0556.cs : Added.
20068 * ../errors/cs0555.cs : Added.
20070 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20072 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
20073 single integer which is really efficient
20075 2001-10-01 Ravi Pratap <ravi@ximian.com>
20077 * expression.cs (Expression::ImplicitUserConversion): Use location
20078 even in the case when we are examining True operators.
20080 * class.cs (Operator::Define): Perform extensive checks to conform
20081 with the rules for operator overloading in the spec.
20083 * expression.cs (Expression::ImplicitReferenceConversion): Implement
20084 some of the other conversions mentioned in the spec.
20086 * typemanager.cs (array_type): New static member for the System.Array built-in
20089 (cloneable_interface): For System.ICloneable interface.
20091 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
20092 we start resolving the tree and populating types.
20094 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
20096 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20098 * expression.cs (Expression::ExprClassFromMemberInfo,
20099 Expression::Literalize): Create literal expressions from
20100 FieldInfos which are literals.
20102 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
20103 type casts, because they were wrong. The test suite in tests
20106 (ImplicitNumericConversion): ushort to ulong requires a widening
20109 Int32 constant to long requires widening cast as well.
20111 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
20112 for integers because the type on the stack is not i4.
20114 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20116 * expression.cs (report118): require location argument.
20118 * parameter.cs: Do not dereference potential null value.
20120 * class.cs: Catch methods that lack the `new' keyword when
20121 overriding a name. Report warnings when `new' is used without
20122 anything being there to override.
20124 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20126 * class.cs: Only add constructor to hashtable if it is non-null
20127 (as now constructors can fail on define).
20129 (TypeManager, Class, Struct): Take location arguments.
20131 Catch field instance initialization in structs as errors.
20133 accepting_filter: a new filter for FindMembers that is static so
20134 that we dont create an instance per invocation.
20136 (Constructor::Define): Catch errors where a struct constructor is
20139 * cs-parser.jay: Pass location information for various new
20142 * delegate.cs (Delegate): take a location argument.
20144 * driver.cs: Do not call EmitCode if there were problesm in the
20145 Definition of the types, as many Builders wont be there.
20147 * decl.cs (Decl::Decl): Require a location argument.
20149 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20150 into integers, and find the most appropiate integer for it.
20152 * literal.cs: Implement ULongLiteral.
20154 * rootcontext.cs: Provide better information about the location of
20155 failure when CreateType fails.
20157 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20159 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20162 * expression.cs (Binary::CheckShiftArguments): Add missing type
20164 (Binary::ResolveOperator): Add type to the logical and and logical
20165 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20168 (Binary::DoNumericPromotions): In the case where either argument
20169 is ulong (and most signed types combined with ulong cause an
20170 error) perform implicit integer constant conversions as well.
20172 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20174 * expression.cs (UserImplicitCast): Method should always be
20176 (Invocation::BetterConversion): Simplified test for IntLiteral.
20178 (Expression::ImplicitNumericConversion): Split this routine out.
20179 Put the code that performs implicit constant integer conversions
20182 (Expression::Resolve): Become a wrapper around DoResolve so we can
20183 check eclass and type being set after resolve.
20185 (Invocation::Badness): Remove this dead function
20187 (Binary::ResolveOperator): Do not compute the expensive argumnets
20188 unless we have a union for it.
20190 (Probe::Emit): Is needs to do an isinst and then
20191 compare against null.
20193 (::CanConvert): Added Location argument. If the Location argument
20194 is null (Location.Null), then we do not report errors. This is
20195 used by the `probe' mechanism of the Explicit conversion. We do
20196 not want to generate an error for something that the user
20197 explicitly requested to be casted. But the pipeline for an
20198 explicit cast first tests for potential implicit casts.
20200 So for now, if the Location is null, it means `Probe only' to
20201 avoid adding another argument. Might have to revise this
20204 (ClassCast): New class used to type cast objects into arbitrary
20205 classes (used in Explicit Reference Conversions).
20207 Implement `as' as well.
20209 Reverted all the patches from Ravi below: they were broken:
20211 * The use of `level' as a mechanism to stop recursive
20212 invocations is wrong. That was there just to catch the
20213 bug with a strack trace but not as a way of addressing
20216 To fix the problem we have to *understand* what is going
20217 on and the interactions and come up with a plan, not
20218 just get things going.
20220 * The use of the type conversion cache that I proposed
20221 last night had an open topic: How does this work across
20222 protection domains. A user defined conversion might not
20223 be public in the location where we are applying the
20224 conversion, a different conversion might be selected
20225 (ie, private A->B (better) but public B->A (worse),
20226 inside A, A->B applies, but outside it, B->A will
20229 * On top of that (ie, even if the above is solved),
20230 conversions in a cache need to be abstract. Ie, `To
20231 convert from an Int to a Short use an OpcodeCast', not
20232 `To convert from an Int to a Short use the OpcodeCast on
20233 the variable 5' (which is what this patch was doing).
20235 2001-09-28 Ravi Pratap <ravi@ximian.com>
20237 * expression.cs (Invocation::ConversionExists): Re-write to use
20238 the conversion cache
20240 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20241 cache all conversions done, not just user-defined ones.
20243 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20244 to determine if a conversion exists instead of acutually trying to
20245 perform the conversion. It's faster too.
20247 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20248 and only then attempt the implicit conversion.
20250 2001-09-28 Ravi Pratap <ravi@ximian.com>
20252 * expression.cs (ConvertImplicit): Use a cache for conversions
20253 already found. Check level of recursion and bail out if necessary.
20255 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20257 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20258 Export standard methods that we expect for string operations.
20260 * statement.cs (Block::UsageWarning): Track usage of variables and
20261 report the errors for not used variables.
20263 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20266 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20268 * codegen.cs: remove unnneded code
20270 * expression.cs: Removed BuiltinTypeAccess class
20272 Fix the order in which implicit conversions are
20275 The previous fixed dropped support for boxed conversions (adding a
20276 test to the test suite now)
20278 (UserImplicitCast::CanConvert): Remove test for source being null,
20279 that code is broken. We should not feed a null to begin with, if
20280 we do, then we should track the bug where the problem originates
20281 and not try to cover it up here.
20283 Return a resolved expression of type UserImplicitCast on success
20284 rather than true/false. Ravi: this is what I was talking about,
20285 the pattern is to use a static method as a "constructor" for
20288 Also, do not create arguments until the very last minute,
20289 otherwise we always create the arguments even for lookups that
20290 will never be performed.
20292 (UserImplicitCast::Resolve): Eliminate, objects of type
20293 UserImplicitCast are born in a fully resolved state.
20295 * typemanager.cs (InitCoreTypes): Init also value_type
20296 (System.ValueType).
20298 * expression.cs (Cast::Resolve): First resolve the child expression.
20300 (LValue): Add new method AddressOf to be used by
20303 Change the argument of Store to take an EmitContext instead of an
20304 ILGenerator, because things like FieldExpr need to be able to call
20305 their children expression to generate the instance code.
20307 (Expression::Error, Expression::Warning): Sugar functions for
20310 (Expression::MemberLookup): Accept a TypeContainer instead of a
20311 Report as the first argument.
20313 (Expression::ResolvePrimary): Killed. I still want to improve
20314 this as currently the code is just not right.
20316 (Expression::ResolveMemberAccess): Simplify, but it is still
20319 (Unary::Resolve): Catch errors in AddressOf operators.
20321 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20322 index to a byte for the short-version, or the compiler will choose
20323 the wrong Emit call, which generates the wrong data.
20325 (ParameterReference::Emit, ::Store): same.
20327 (FieldExpr::AddressOf): Implement.
20329 * typemanager.cs: TypeManager: made public variable instead of
20332 * driver.cs: document --fatal.
20334 * report.cs (ErrorMessage, WarningMessage): new names for the old
20335 Error and Warning classes.
20337 * cs-parser.jay (member_access): Turn built-in access to types
20338 into a normal simplename
20340 2001-09-27 Ravi Pratap <ravi@ximian.com>
20342 * expression.cs (Invocation::BetterConversion): Fix to cope
20343 with q being null, since this was introducing a bug.
20345 * expression.cs (ConvertImplicit): Do built-in conversions first.
20347 2001-09-27 Ravi Pratap <ravi@ximian.com>
20349 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20351 2001-09-27 Ravi Pratap <ravi@ximian.com>
20353 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20354 I had introduced long ago (what's new ?).
20356 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20357 the work of all the checking.
20358 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20359 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20361 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20362 that is the right way.
20364 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20365 overloading resolution. Use everywhere instead of cutting and pasting code.
20367 (Binary::ResolveOperator): Use MakeUnionSet.
20369 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20370 we have to convert to bool types. Not complete yet.
20372 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20374 * typemanager.cs (TypeManager::CSharpName): support ushort.
20376 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20377 to provide an expression that performsn an implicit constant int
20378 conversion (section 6.1.6).
20379 (Expression::ConvertImplicitRequired): Reworked to include
20380 implicit constant expression conversions.
20382 (Expression::ConvertNumericExplicit): Finished.
20384 (Invocation::Emit): If InstanceExpression is null, then it means
20385 that we perform a call on this.
20387 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20389 * expression.cs (Unary::Emit): Remove some dead code.
20390 (Probe): Implement Resolve and Emit for `is'.
20391 (Expression::ConvertImplicitRequired): Attempt to do constant
20392 expression conversions here. Maybe should be moved to
20393 ConvertImplicit, but I am not sure.
20394 (Expression::ImplicitLongConstantConversionPossible,
20395 Expression::ImplicitIntConstantConversionPossible): New functions
20396 that tell whether is it possible to apply an implicit constant
20397 expression conversion.
20399 (ConvertNumericExplicit): Started work on explicit numeric
20402 * cs-parser.jay: Update operator constants.
20404 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20405 (Parameters::GetSignature): Hook up VerifyArgs here.
20406 (Parameters::VerifyArgs): Verifies that no two arguments have the
20409 * class.cs (Operator): Update the operator names to reflect the
20410 ones that the spec expects (as we are just stringizing the
20413 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20414 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20415 previous usage did only work for our methods.
20416 (Expression::ConvertImplicit): Handle decimal implicit numeric
20417 conversions as well.
20418 (Expression::InternalTypeConstructor): Used to invoke constructors
20419 on internal types for default promotions.
20421 (Unary::Emit): Implement special handling for the pre/post
20422 increment/decrement for overloaded operators, as they need to have
20423 the same semantics as the other operators.
20425 (Binary::ResolveOperator): ditto.
20426 (Invocation::ConversionExists): ditto.
20427 (UserImplicitCast::Resolve): ditto.
20429 2001-09-26 Ravi Pratap <ravi@ximian.com>
20431 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20432 operator, return after emitting body. Regression tests pass again !
20434 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20435 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20436 (Invocation::OverloadResolve): Ditto.
20437 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20439 * everywhere : update calls to the above methods accordingly.
20441 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20443 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20445 * expression.cs (ExpressionStatement): New base class used for
20446 expressions that can appear in statements, so that we can provide
20447 an alternate path to generate expression that do not leave a value
20450 (Expression::Emit, and all the derivatives): We no longer return
20451 whether a value is left on the stack or not. Every expression
20452 after being emitted leaves a single value on the stack.
20454 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20455 facilties of ExpressionStatement if possible.
20457 * cs-parser.jay: Update statement_expression.
20459 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20461 * driver.cs: Change the wording of message
20463 2001-09-25 Ravi Pratap <ravi@ximian.com>
20465 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20466 the type of the expression to the return type of the method if
20467 we have an overloaded operator match ! The regression tests pass again !
20468 (Unary::ResolveOperator): Ditto.
20470 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20471 to find "op_Implicit", not "implicit" ;-)
20472 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20473 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20475 * everywhere : Correct calls to the above accordingly.
20477 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20478 (ConvertImplicit): Do user-defined conversion if it exists.
20480 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20482 * assign.cs: track location.
20483 (Resolve): Use implicit conversions on assignment.
20485 * literal.cs: Oops. Not good, Emit of short access values should
20486 pass (Bytes) or the wrong argument will be selected.
20488 * expression.cs (Unary::Emit): Emit code for -expr.
20490 (Unary::ResolveOperator): Handle `Substract' for non-constants
20491 (substract from zero from the non-constants).
20492 Deal with Doubles as well.
20494 (Expression::ConvertImplicitRequired): New routine that reports an
20495 error if no implicit conversion exists.
20497 (Invocation::OverloadResolve): Store the converted implicit
20498 expressions if we make them
20500 2001-09-24 Ravi Pratap <ravi@ximian.com>
20502 * class.cs (ConstructorInitializer): Take a Location argument.
20503 (ConstructorBaseInitializer): Same here.
20504 (ConstructorThisInitializer): Same here.
20506 * cs-parser.jay : Update all calls accordingly.
20508 * expression.cs (Unary, Binary, New): Take location argument.
20509 Update accordingly everywhere.
20511 * cs-parser.jay : Update all calls to the above to take a location
20514 * class.cs : Ditto.
20516 2001-09-24 Ravi Pratap <ravi@ximian.com>
20518 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20519 (Invocation::BetterConversion): Same here
20520 (Invocation::ConversionExists): Ditto.
20522 (Invocation::ConversionExists): Implement.
20524 2001-09-22 Ravi Pratap <ravi@ximian.com>
20526 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20527 Also take an additional TypeContainer argument.
20529 * All over : Pass in TypeContainer as argument to OverloadResolve.
20531 * typemanager.cs (CSharpName): Update to check for the string type and return
20534 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20537 2001-09-21 Ravi Pratap <ravi@ximian.com>
20539 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20540 (Invocation::BetterFunction): Implement.
20541 (Invocation::BetterConversion): Implement.
20542 (Invocation::ConversionExists): Skeleton, no implementation yet.
20544 Okay, things work fine !
20546 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20548 * typemanager.cs: declare and load enum_type, delegate_type and
20551 * expression.cs (Expression::Emit): Now emit returns a value that
20552 tells whether a value is left on the stack or not. This strategy
20553 might be reveted tomorrow with a mechanism that would address
20554 multiple assignments.
20555 (Expression::report118): Utility routine to report mismatches on
20558 (Unary::Report23): Report impossible type/operator combination
20561 (Unary::IsIncrementableNumber): Whether the type can be
20562 incremented or decremented with add.
20563 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20565 (Unary::ResolveOperator): Implement ++, !, ~,
20567 (Invocation::Emit): Deal with new Emit convetion.
20569 * All Expression derivatives: Updated their Emit method to return
20570 whether they leave values on the stack or not.
20572 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20573 stack for expressions that are statements.
20575 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20577 * expression.cs (LValue): New interface. Must be implemented by
20579 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20582 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20583 interface for generating code, simplifies the code.
20585 2001-09-20 Ravi Pratap <ravi@ximian.com>
20587 * expression.cs (everywhere): Comment out return statements in ::Resolve
20588 methods to avoid the warnings.
20590 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20592 * driver.cs (parse): Report error 2001 if we can not open the
20595 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20598 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20601 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20602 otherwise nested blocks end up with the same index.
20604 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20606 * expression.cs: Instead of having FIXMEs in the Resolve
20607 functions, throw exceptions so it is obvious that we are facing a
20610 * cs-parser.jay (invocation_expression): Pass Location information.
20612 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20613 Use a basename for those routines because .NET does not like paths
20616 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20619 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20621 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20622 are loading the correct data types (throws an exception if not).
20623 (TypeManager::InitCoreTypes): Use CoreLookupType
20625 * expression.cs (Unary::ResolveOperator): return the child
20626 expression for expressions which are just +expr.
20627 (Unary::ResolveOperator): Return negative literals for -LITERAL
20628 expressions (otherwise they are Unary {Literal}).
20629 (Invocation::Badness): Take into account `Implicit constant
20630 expression conversions'.
20632 * literal.cs (LongLiteral): Implement long literal class.
20633 (IntLiteral): export the `Value' of the intliteral.
20635 2001-09-19 Ravi Pratap <ravi@ximian.com>
20637 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20639 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20640 instead of 'Operator'
20642 * expression.cs (Binary::ResolveOperator): Update accordingly.
20643 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20646 * cs-parser.jay (unary_expression): Update to use the new names.
20648 * gen-treedump.cs (GetUnary): Same here.
20650 * expression.cs (Unary::Resolve): Implement.
20651 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20652 operators are found instead of making noise ;-)
20653 (Unary::ResolveOperator): New method to do precisely the same thing which
20654 Binary::ResolveOperator does for Binary expressions.
20655 (Unary.method, .Arguments): Add.
20656 (Unary::OperName): Implement.
20657 (Unary::ForceConversion): Copy and Paste !
20659 * class.cs (Operator::Define): Fix a small bug for the case when we have
20662 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20663 for the inbuilt operators. Only overloading works for now ;-)
20665 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20667 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20668 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20670 * expression.cs (This::Emit): Implement.
20671 (This::Resolve): Implement.
20672 (TypeOf:Resolve): Implement.
20673 (Expression::ResolveSimpleName): Add an implicit this to instance
20675 (MemberAccess::Resolve): Deal with Parameters and Fields.
20676 Bind instance variable to Field expressions.
20677 (FieldExpr::Instance): New field used to track the expression that
20678 represents the object instance.
20679 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20681 (FieldExpr::Emit): Implement.
20683 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20684 the last instruction contains a return opcode to avoid generating
20685 the last `ret' instruction (this generates correct code, and it is
20686 nice to pass the peverify output).
20688 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20689 initializer for static and instance variables.
20690 (Constructor::Emit): Allow initializer to be null in the case of
20691 static constructors. Only emit initializer for instance
20694 (TypeContainer::FindMembers): Return a null array if there are no
20697 Also fix the code for the MemberTypes.Method branch, as it was not
20698 scanning that for operators (or tried to access null variables before).
20700 * assign.cs (Assign::Emit): Handle instance and static fields.
20704 * driver.cs: Stop compilation if there are parse errors.
20706 * cs-parser.jay (constructor_declaration): Provide default base
20707 initializer for non-static constructors.
20708 (constructor_declarator): Do not provide a default base
20709 initializers if none was specified.
20710 Catch the fact that constructors should not have parameters.
20712 * class.cs: Do not emit parent class initializers for static
20713 constructors, that should be flagged as an error.
20715 2001-09-18 Ravi Pratap <ravi@ximian.com>
20717 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20718 Move back code into TypeContainer::Populate.
20720 2001-09-18 Ravi Pratap <ravi@ximian.com>
20722 * class.cs (TypeContainer::AddConstructor): Fix the check to
20723 compare against Name, not Basename.
20724 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20726 * cs-parser.jay : Update accordingly.
20728 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20729 for methods, don't forget to look into the operators too.
20730 (RegisterMethodBuilder): Helper method to take care of this for
20731 methods, constructors and operators.
20732 (Operator::Define): Completely revamp.
20733 (Operator.OperatorMethod, MethodName): New fields.
20734 (TypeContainer::Populate): Move the registering of builders into
20735 RegisterMethodBuilder.
20736 (Operator::Emit): Re-write.
20738 * expression.cs (Binary::Emit): Comment out code path to emit method
20739 invocation stuff for the case when we have a user defined operator. I am
20740 just not able to get it right !
20742 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20744 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20747 (Expression::MemberLookup): Provide a version that allows to
20748 specify the MemberTypes and BindingFlags.
20750 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20751 so it was not fetching variable information from outer blocks.
20753 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20754 Beforefieldinit as it was buggy.
20756 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20757 that Ravi put here.
20759 * class.cs (Constructor::Emit): Only emit if block is not null.
20760 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20761 deal with this by semantically definining it as if the user had
20764 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20765 constructors as we now "emit" them at a higher level.
20767 (TypeContainer::DefineDefaultConstructor): Used to define the
20768 default constructors if none was provided.
20770 (ConstructorInitializer): Add methods Resolve and Emit.
20772 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20774 2001-09-17 Ravi Pratap <ravi@ximian.com>
20776 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20777 the default constructor builder with our hashtable for methodbuilders
20780 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20781 and argument_count is 0 in which case we have a match.
20782 (Binary::ResolveOperator): More null checking and miscellaneous coding
20785 2001-09-17 Ravi Pratap <ravi@ximian.com>
20787 * rootcontext.cs (IsNameSpace): Compare against null.
20789 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20791 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20792 and Unary::Operator.
20794 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20797 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20798 we have overloaded operators.
20799 (Binary::ResolveOperator): Implement the part which does the operator overload
20802 * class.cs (Operator::Emit): Implement.
20803 (TypeContainer::Emit): Emit the operators we have too.
20805 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20806 the case when we have a user-defined operator.
20808 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20810 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20812 2001-09-16 Ravi Pratap <ravi@ximian.com>
20814 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20815 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20816 (Constructor::Emit): Implement.
20817 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20818 if we have no work to do.
20819 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20822 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20823 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20825 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20828 2001-09-15 Ravi Pratap <ravi@ximian.com>
20830 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20832 (Tree::RecordNamespace): Method to do what the name says ;-)
20833 (Tree::Namespaces): Property to get at the namespaces hashtable.
20835 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20838 * rootcontext.cs (IsNamespace): Fixed it :-)
20840 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20842 * class.cs (TypeContainer::FindMembers): Add support for
20844 (MethodCore): New class that encapsulates both the shared aspects
20845 of a Constructor and a Method.
20846 (Method, Constructor): Factored pieces into MethodCore.
20848 * driver.cs: Added --fatal which makes errors throw exceptions.
20849 Load System assembly as well as part of the standard library.
20851 * report.cs: Allow throwing exceptions on errors for debugging.
20853 * modifiers.cs: Do not use `parent', instead use the real type
20854 container to evaluate permission settings.
20856 * class.cs: Put Ravi's patch back in. He is right, and we will
20857 have to cope with the
20859 2001-09-14 Ravi Pratap <ravi@ximian.com>
20861 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20862 FamORAssem, not FamANDAssem.
20864 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20866 * driver.cs: Added --parse option that only parses its input files
20869 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20870 incorrect. IsTopLevel is not used to tell whether an object is
20871 root_types or not (that can be achieved by testing this ==
20872 root_types). But to see if this is a top-level *class* (not
20873 necessarly our "toplevel" container).
20875 2001-09-14 Ravi Pratap <ravi@ximian.com>
20877 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20878 parent instead of a direct call to GetType.
20880 2001-09-14 Ravi Pratap <ravi@ximian.com>
20882 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20883 Modifiers.TypeAttr. This should just be a call to that method.
20885 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20886 object so that we can determine if we are top-level or not.
20888 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20891 * enum.cs (Enum::Define): Ditto.
20893 * modifiers.cs (FieldAttr): Re-write.
20895 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20896 (TypeContainer::HaveStaticConstructor): New property to provide access
20897 to precisely that info.
20899 * modifiers.cs (MethodAttr): Re-write.
20900 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20902 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20903 of top-level types as claimed.
20905 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20907 * expression.cs (MemberLookup): Fruitless attempt to lookup
20908 constructors. Maybe I need to emit default constructors? That
20909 might be it (currently .NET emits this for me automatically).
20910 (Invocation::OverloadResolve): Cope with Arguments == null.
20911 (Invocation::EmitArguments): new function, shared by the new
20912 constructor and us.
20913 (Invocation::Emit): Handle static and instance methods. Emit
20914 proper call instruction for virtual or non-virtual invocations.
20915 (New::Emit): Implement.
20916 (New::Resolve): Implement.
20917 (MemberAccess:Resolve): Implement.
20918 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20919 to track instances.
20920 (FieldExpr::Resolve): Set type.
20922 * support.cs: Handle empty arguments.
20924 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20925 SimpleLookup): Auxiliary routines to help parse a qualifier
20928 Update qualifier_identifier rule.
20930 * codegen.cs: Removed debugging messages.
20932 * class.cs: Make this a global thing, this acts just as a "key" to
20933 objects that we might have around.
20935 (Populate): Only initialize method_builders_to_methods once.
20937 * expression.cs (PropertyExpr): Initialize type from the
20940 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20941 Resolve pattern. Attempt to implicitly convert value to boolean.
20944 * expression.cs: Set the type for the int32/int32 argument case.
20945 (Binary::ResolveOperator): Set the return type to boolean for
20946 comparission operators
20948 * typemanager.cs: Remove debugging print code.
20950 (Invocation::Resolve): resolve type.
20952 * class.cs: Allocate a MemberInfo of the correct size, as the code
20953 elsewhere depends on the test to reflect the correct contents.
20955 (Method::) Keep track of parameters, due to System.Reflection holes
20957 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20960 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20961 of the exact size and return that.
20963 (Class::LookupMethodByBuilder): New function that maps
20964 MethodBuilders to its methods. Required to locate the information
20965 on methods because System.Reflection bit us again.
20967 * support.cs: New file, contains an interface ParameterData and
20968 two implementations: ReflectionParameters and InternalParameters
20969 used to access Parameter information. We will need to grow this
20972 * expression.cs (Invocation::GetParameterData): implement a cache
20973 and a wrapper around the ParameterData creation for methods.
20974 (Invocation::OverloadResolve): Use new code.
20976 2001-09-13 Ravi Pratap <ravi@ximian.com>
20978 * class.cs (TypeContainer::EmitField): Remove and move into
20979 (Field::Define): here and modify accordingly.
20980 (Field.FieldBuilder): New member.
20981 (TypeContainer::Populate): Update accordingly.
20982 (TypeContainer::FindMembers): Implement.
20984 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20986 * statement.cs: (VariableInfo::VariableType): New field to be
20987 initialized with the full type once it is resolved.
20989 2001-09-12 Miguel de Icaza <miguel@ximian.com>
20991 * parameter.cs (GetParameterInfo): Use a type cache to compute
20992 things only once, and to reuse this information
20994 * expression.cs (LocalVariableReference::Emit): Implement.
20995 (OpcodeCast::Emit): fix.
20997 (ParameterReference::Resolve): Implement.
20998 (ParameterReference::Emit): Implement.
21000 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
21001 that are expressions need to stay as Expressions.
21003 * typemanager.cs (CSharpName): Returns the C# name of a type if
21006 * expression.cs (Expression::ConvertImplicit): New function that
21007 implements implicit type conversions.
21009 (Expression::ImplicitReferenceConversion): Implements implicit
21010 reference conversions.
21012 (EmptyCast): New type for transparent casts.
21014 (OpcodeCast): New type for casts of types that are performed with
21015 a sequence of bytecodes.
21017 (BoxedCast): New type used for casting value types into reference
21018 types. Emits a box opcode.
21020 (Binary::DoNumericPromotions): Implements numeric promotions of
21021 and computation of the Binary::Type.
21023 (Binary::EmitBranchable): Optimization.
21025 (Binary::Emit): Implement code emission for expressions.
21027 * typemanager.cs (TypeManager): Added two new core types: sbyte
21030 2001-09-12 Ravi Pratap <ravi@ximian.com>
21032 * class.cs (TypeContainer::FindMembers): Method which does exactly
21033 what Type.FindMembers does, only we don't have to use reflection. No
21034 implementation yet.
21036 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
21037 typecontainer objects as we need to get at them.
21038 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
21040 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
21041 typecontainer object.
21043 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
21044 of just a Report object.
21046 2001-09-11 Ravi Pratap <ravi@ximian.com>
21048 * class.cs (Event::Define): Go back to using the prefixes "add_" and
21050 (TypeContainer::Populate): Now define the delegates of the type too.
21051 (TypeContainer.Delegates): Property to access the list of delegates defined
21054 * delegates.cs (Delegate::Define): Implement partially.
21056 * modifiers.cs (TypeAttr): Handle more flags.
21058 2001-09-11 Ravi Pratap <ravi@ximian.com>
21060 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
21062 (Operator::Define): Re-write logic to get types by using the LookupType method
21063 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
21064 (Indexer::Define): Ditto.
21065 (Event::Define): Ditto.
21066 (Property::Define): Ditto.
21068 2001-09-10 Ravi Pratap <ravi@ximian.com>
21070 * class.cs (TypeContainer::Populate): Now define operators too.
21071 (TypeContainer.Operators): New property to access the list of operators
21073 (Operator.OperatorMethodBuilder): New member to hold the method builder
21074 for the operator we are defining.
21075 (Operator::Define): Implement.
21077 2001-09-10 Ravi Pratap <ravi@ximian.com>
21079 * class.cs (Event::Define): Make the prefixes of the accessor methods
21080 addOn_ and removeOn_
21082 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
21083 of the location being passed in too. Ideally, this should go later since all
21084 error reporting should be done through the Report object.
21086 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
21087 (Populate): Iterate thru the indexers we have and define them too.
21088 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
21089 for the get and set accessors.
21090 (Indexer::Define): Implement.
21092 2001-09-09 Miguel de Icaza <miguel@ximian.com>
21094 * expression.cs (Binary::Resolve): Beginning of it. I scratched
21095 my previous implementation, did not work.
21097 * typemanager.cs: Add a couple of missing types (the longs).
21099 * literal.cs: Use TypeManager.bool_type instead of getting it.
21101 * expression.cs (EventExpr): New kind of expressions.
21102 (Expressio::ExprClassFromMemberInfo): finish
21104 2001-09-08 Miguel de Icaza <miguel@ximian.com>
21106 * assign.cs: Emit stores to static fields differently.
21108 2001-09-08 Ravi Pratap <ravi@ximian.com>
21110 * Merge in changes and adjust code to tackle conflicts. Backed out my
21111 code in Assign::Resolve ;-)
21113 2001-09-08 Ravi Pratap <ravi@ximian.com>
21115 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21116 instead Report.Error and also pass in the location.
21117 (CSharpParser::Lexer): New readonly property to return the reference
21118 to the Tokenizer object.
21119 (declare_local_variables): Use Report.Error with location instead of plain
21123 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21124 (Operator.CheckBinaryOperator): Ditto.
21126 * cs-parser.jay (operator_declarator): Update accordingly.
21128 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21129 (CheckBinaryOperator): Same here.
21131 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21132 on the name without any prefixes of namespace names etc. This is because we
21133 already might have something already fully qualified like
21134 'System.Console.WriteLine'
21136 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21138 2001-09-07 Ravi Pratap <ravi@ximian.com>
21140 * cs-tokenizer.cs (location): Return a string which also contains
21143 * expression.cs (ElementAccess): New class for expressions of the
21144 type 'element access.'
21145 (BaseAccess): New class for expressions of the type 'base access.'
21146 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21149 * cs-parser.jay (element_access): Implement action.
21150 (base_access): Implement actions.
21151 (checked_expression, unchecked_expression): Implement.
21153 * cs-parser.jay (local_variable_type): Correct and implement.
21154 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21156 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21158 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21159 name and the specifiers.
21161 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21163 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21164 making them all public ;-)
21166 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21169 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21171 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21173 (FieldExpr, PropertyExprs): New resolved expressions.
21174 (SimpleName::MemberStaticCheck): Perform static checks for access
21175 to non-static fields on static methods. Maybe this should be
21176 generalized for MemberAccesses.
21177 (SimpleName::ResolveSimpleName): More work on simple name
21180 * cs-parser.jay (primary_expression/qualified_identifier): track
21181 the parameter index.
21183 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21184 (EmitContext::EmitBoolExpression): Chain to expression generation
21185 instead of temporary hack.
21186 (::EmitStatementExpression): Put generic expression code generation.
21188 * assign.cs (Assign::Emit): Implement variable assignments to
21189 local variables, parameters and fields.
21191 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21193 * statement.cs (Block::GetVariableInfo): New method, returns the
21194 VariableInfo for a variable name in a block.
21195 (Block::GetVariableType): Implement in terms of GetVariableInfo
21197 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21198 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21200 2001-09-06 Ravi Pratap <ravi@ximian.com>
21202 * cs-parser.jay (operator_declaration): Continue on my quest : update
21203 to take attributes argument.
21204 (event_declaration): Ditto.
21205 (enum_declaration): Ditto.
21206 (indexer_declaration): Ditto.
21208 * class.cs (Operator::Operator): Update constructor accordingly.
21209 (Event::Event): Ditto.
21211 * delegate.cs (Delegate::Delegate): Same here.
21213 * enum.cs (Enum::Enum): Same here.
21215 2001-09-05 Ravi Pratap <ravi@ximian.com>
21217 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21219 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21221 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21222 being passed around as an arraylist.
21223 (Attributes::AddAttribute): Method to add attribute sections.
21225 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21226 (struct_declaration): Update accordingly.
21227 (constant_declaration): Update.
21228 (field_declaration): Update.
21229 (method_header): Update.
21230 (fixed_parameter): Update.
21231 (parameter_array): Ditto.
21232 (property_declaration): Ditto.
21233 (destructor_declaration): Ditto.
21235 * class.cs (Struct::Struct): Update constructors accordingly.
21236 (Class::Class): Ditto.
21237 (Field::Field): Ditto.
21238 (Method::Method): Ditto.
21239 (Property::Property): Ditto.
21240 (TypeContainer::OptAttribute): update property's return type.
21242 * interface.cs (Interface.opt_attributes): New member.
21243 (Interface::Interface): Update to take the extra Attributes argument.
21245 * parameter.cs (Parameter::Parameter): Ditto.
21247 * constant.cs (Constant::Constant): Ditto.
21249 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21250 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21251 the attributes as a parameter.
21252 (InterfaceProperty): Update constructor call.
21253 (InterfaceEvent): Ditto.
21254 (InterfaceMethod): Ditto.
21255 (InterfaceIndexer): Ditto.
21257 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21258 pass the attributes too.
21259 (interface_event_declaration): Ditto.
21260 (interface_property_declaration): Ditto.
21261 (interface_method_declaration): Ditto.
21262 (interface_declaration): Ditto.
21264 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21266 * class.cs (Method::Define): Track the "static Main" definition to
21267 create an entry point.
21269 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21270 EntryPoint if we find it.
21272 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21273 (EmitContext::ig): Make this variable public.
21275 * driver.cs: Make the default output file be the first file name
21276 with the .exe extension.
21278 Detect empty compilations
21280 Handle various kinds of output targets. Handle --target and
21281 rename -t to --dumper.
21283 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21284 methods inherited from Expression return now an Expression. This
21285 will is used during the tree rewriting as we resolve them during
21288 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21289 the spec. Missing entirely is the information about
21290 accessability of elements of it.
21292 (Expression::ExprClassFromMemberInfo): New constructor for
21293 Expressions that creates a fully initialized Expression based on
21294 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21297 (Invocation::Resolve): Begin implementing resolution of invocations.
21299 * literal.cs (StringLiteral): Implement Emit.
21301 2001-09-05 Ravi Pratap <ravi@ximian.com>
21303 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21306 2001-09-04 Ravi Pratap <ravi@ximian.com>
21308 * cs-parser.jay (attribute_arguments): Implement actions.
21309 (attribute): Fix bug in production. Implement action.
21310 (attribute_list): Implement.
21311 (attribute_target): Implement.
21312 (attribute_target_specifier, opt_target_specifier): Implement
21313 (CheckAttributeTarget): New method to check if the attribute target
21315 (attribute_section): Implement.
21316 (opt_attributes): Implement.
21318 * attribute.cs : New file to handle attributes.
21319 (Attribute): Class to hold attribute info.
21321 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21322 (attribute_section): Modify production to use 2 different rules to
21323 achieve the same thing. 1 s/r conflict down !
21324 Clean out commented, useless, non-reducing dimension_separator rules.
21326 * class.cs (TypeContainer.attributes): New member to hold list
21327 of attributes for a type.
21328 (Struct::Struct): Modify to take one more argument, the attribute list.
21329 (Class::Class): Ditto.
21330 (Field::Field): Ditto.
21331 (Method::Method): Ditto.
21332 (Property::Property): Ditto.
21334 * cs-parser.jay (struct_declaration): Update constructor call to
21335 pass in the attributes too.
21336 (class_declaration): Ditto.
21337 (constant_declaration): Ditto.
21338 (field_declaration): Ditto.
21339 (method_header): Ditto.
21340 (fixed_parameter): Ditto.
21341 (parameter_array): Ditto.
21342 (property_declaration): Ditto.
21344 * constant.cs (Constant::Constant): Update constructor similarly.
21345 Use System.Collections.
21347 * parameter.cs (Parameter::Parameter): Update as above.
21349 2001-09-02 Ravi Pratap <ravi@ximian.com>
21351 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21352 (TypeContainer.delegates): New member to hold list of delegates.
21354 * cs-parser.jay (delegate_declaration): Implement the action correctly
21355 this time as I seem to be on crack ;-)
21357 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21359 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21360 tell whether an identifier represents a namespace.
21362 * expression.cs (NamespaceExpr): A namespace expression, used only
21363 temporarly during expression resolution.
21364 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21365 utility functions to resolve names on expressions.
21367 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21369 * codegen.cs: Add hook for StatementExpressions.
21371 * class.cs: Fix inverted test for static flag in methods.
21373 2001-09-02 Ravi Pratap <ravi@ximian.com>
21375 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21376 to make it coincide with MS' number.
21377 (Operator::CheckBinaryOperator): Ditto.
21379 * ../errors/errors.txt : Remove error numbers added earlier.
21381 * ../errors/cs1019.cs : Test case for error # 1019
21383 * ../errros/cs1020.cs : Test case for error # 1020
21385 * cs-parser.jay : Clean out commented cruft.
21386 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21387 used anywhere - non-reducing rule.
21388 (namespace_declarations): Non-reducing rule - comment out.
21390 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21391 with TypeContainer::AddEnum.
21393 * delegate.cs : New file for delegate handling classes.
21394 (Delegate): Class for declaring delegates.
21396 * makefile : Update.
21398 * cs-parser.jay (delegate_declaration): Implement.
21400 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21402 * class.cs (Event::Define): Implement.
21403 (Event.EventBuilder): New member.
21405 * class.cs (TypeContainer::Populate): Update to define all enums and events
21407 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21408 readonly fields for all these cases ?
21410 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21412 * class.cs (Property): Revamp to use the convention of making fields readonly.
21413 Accordingly modify code elsewhere.
21415 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21416 the Define method of the Property class.
21418 * class.cs : Clean up applied patch and update references to variables etc. Fix
21420 (TypeContainer::Populate): Update to define all the properties we have. Also
21421 define all enumerations.
21423 * enum.cs (Define): Implement.
21425 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21427 * cs-parser.jay (overloadable_operator): The semantic value is an
21428 enum of the Operator class.
21429 (operator_declarator): Implement actions.
21430 (operator_declaration): Implement.
21432 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21433 validity of definitions.
21434 (Operator::CheckBinaryOperator): Static method to check for binary operators
21435 (TypeContainer::AddOperator): New method to add an operator to a type.
21437 * cs-parser.jay (indexer_declaration): Added line to actually call the
21438 AddIndexer method so it gets added ;-)
21440 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21441 already taken care of by the MS compiler ?
21443 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21445 * class.cs (Operator): New class for operator declarations.
21446 (Operator::OpType): Enum for the various operators.
21448 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21450 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21451 ostensibly handle this in semantic analysis.
21453 * cs-parser.jay (general_catch_clause): Comment out
21454 (specific_catch_clauses, specific_catch_clause): Ditto.
21455 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21456 (catch_args, opt_catch_args): New productions.
21457 (catch_clause): Rewrite to use the new productions above
21458 (catch_clauses): Modify accordingly.
21459 (opt_catch_clauses): New production to use in try_statement
21460 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21461 and re-write the code in the actions to extract the specific and
21462 general catch clauses by being a little smart ;-)
21464 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21465 Hooray, try and catch statements parse fine !
21467 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21469 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21470 string from the hashtable of variables.
21472 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21473 I end up making that mistake ;-)
21474 (catch_clauses): Fixed gross error which made Key and Value of the
21475 DictionaryEntry the same : $1 !!
21477 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21479 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21481 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21482 when the add and remove accessors are specified.
21484 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21486 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21487 information about indexer_declarator.
21488 (indexer_declarator): Implement actions.
21489 (parsing_indexer): New local boolean used to keep track of whether
21490 we are parsing indexers or properties. This is necessary because
21491 implicit_parameters come into picture even for the get accessor in the
21492 case of an indexer.
21493 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21495 * class.cs (Indexer): New class for indexer declarations.
21496 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21497 (TypeContainer::indexers): New member to hold list of indexers for the
21500 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21502 * cs-parser.jay (add_accessor_declaration): Implement action.
21503 (remove_accessor_declaration): Implement action.
21504 (event_accessors_declaration): Implement
21505 (variable_declarators): swap statements for first rule - trivial.
21507 * class.cs (Event): New class to hold information about event
21509 (TypeContainer::AddEvent): New method to add an event to a type
21510 (TypeContainer::events): New member to hold list of events.
21512 * cs-parser.jay (event_declaration): Implement actions.
21514 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21516 * cs-parser.jay (dim_separators): Implement. Make it a string
21517 concatenating all the commas together, just as they appear.
21518 (opt_dim_separators): Modify accordingly
21519 (rank_specifiers): Update accordingly. Basically do the same
21520 thing - instead, collect the brackets here.
21521 (opt_rank_sepcifiers): Modify accordingly.
21522 (array_type): Modify to actually return the complete type string
21523 instead of ignoring the rank_specifiers.
21524 (expression_list): Implement to collect the expressions
21525 (variable_initializer): Implement. We make it a list of expressions
21526 essentially so that we can handle the array_initializer case neatly too.
21527 (variable_initializer_list): Implement.
21528 (array_initializer): Make it a list of variable_initializers
21529 (opt_array_initializer): Modify accordingly.
21531 * expression.cs (New::NType): Add enumeration to help us
21532 keep track of whether we have an object/delegate creation
21533 or an array creation.
21534 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21535 members to hold data about array creation.
21536 (New:New): Modify to update NewType
21537 (New:New): New Overloaded contructor for the array creation
21540 * cs-parser.jay (array_creation_expression): Implement to call
21541 the overloaded New constructor.
21543 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21545 * class.cs (TypeContainer::Constructors): Return member
21546 constructors instead of returning null.
21548 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21550 * typemanager.cs (InitCoreTypes): Initialize the various core
21551 types after we have populated the type manager with the user
21552 defined types (this distinction will be important later while
21553 compiling corlib.dll)
21555 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21556 on Expression Classification. Now all expressions have a method
21557 `Resolve' and a method `Emit'.
21559 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21560 generation from working. Also add some temporary debugging
21563 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21565 * codegen.cs: Lots of code generation pieces. This is only the
21566 beginning, will continue tomorrow with more touches of polish. We
21567 handle the fundamentals of if, while, do, for, return. Others are
21568 trickier and I need to start working on invocations soon.
21570 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21573 * codegen.cs (EmitContext): New struct, used during code
21574 emission to keep a context. Most of the code generation will be
21577 * cs-parser.jay: Add embedded blocks to the list of statements of
21578 this block. So code generation proceeds in a top down fashion.
21580 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21582 * statement.cs: Add support for multiple child blocks.
21584 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21586 * codegen.cs (EmitCode): New function, will emit the code for a
21587 Block of code given a TypeContainer and its ILGenerator.
21589 * statement.cs (Block): Standard public readonly optimization.
21590 (Block::Block constructors): Link children.
21591 (Block::Child): Child Linker.
21592 (Block::EmitVariables): Emits IL variable declarations.
21594 * class.cs: Drop support for MethodGroups here, delay until
21596 (Method::): Applied the same simplification that I did before, and
21597 move from Properties to public readonly fields.
21598 (Method::ParameterTypes): Returns the parameter types for the
21599 function, and implements a cache that will be useful later when I
21600 do error checking and the semantic analysis on the methods is
21602 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21603 and made a method, optional argument tells whether this is a class
21604 or a structure to apply the `has-this' bit.
21605 (Method::GetCallingConvention): Implement, returns the calling
21607 (Method::Define): Defines the type, a second pass is performed
21608 later to populate the methods.
21610 (Constructor::ParameterTypes): implement a cache similar to the
21611 one on Method::ParameterTypes, useful later when we do semantic
21614 (TypeContainer::EmitMethod): New method. Emits methods.
21616 * expression.cs: Removed MethodGroup class from here.
21618 * parameter.cs (Parameters::GetCallingConvention): new method.
21620 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21622 * class.cs (TypeContainer::Populate): Drop RootContext from the
21625 (Constructor::CallingConvention): Returns the calling convention.
21626 (Constructor::ParameterTypes): Returns the constructor parameter
21629 (TypeContainer::AddConstructor): Keep track of default constructor
21630 and the default static constructor.
21632 (Constructor::) Another class that starts using `public readonly'
21633 instead of properties.
21635 (Constructor::IsDefault): Whether this is a default constructor.
21637 (Field::) use readonly public fields instead of properties also.
21639 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21640 track of static constructors; If none is used, turn on
21641 BeforeFieldInit in the TypeAttributes.
21643 * cs-parser.jay (opt_argument_list): now the return can be null
21644 for the cases where there are no arguments.
21646 (constructor_declarator): If there is no implicit `base' or
21647 `this', then invoke the default parent constructor.
21649 * modifiers.cs (MethodAttr): New static function maps a set of
21650 modifiers flags into a MethodAttributes enum
21651 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21652 MethodAttr, TypeAttr to represent the various mappings where the
21653 modifiers are used.
21654 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21656 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21658 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21661 * interface.cs (PopulateIndexer): Implemented the code generator
21662 for interface indexers.
21664 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21666 * interface.cs (InterfaceMemberBase): Now we track the new status
21669 (PopulateProperty): Implement property population. Woohoo! Got
21670 Methods and Properties going today.
21672 Removed all the properties for interfaces, and replaced them with
21673 `public readonly' fields.
21675 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21677 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21678 initialize their hashtables/arraylists only when they are needed
21679 instead of doing this always.
21681 * parameter.cs: Handle refs and out parameters.
21683 * cs-parser.jay: Use an ArrayList to construct the arguments
21684 instead of the ParameterCollection, and then cast that to a
21687 * parameter.cs: Drop the use of ParameterCollection and use
21688 instead arrays of Parameters.
21690 (GetParameterInfo): Use the Type, not the Name when resolving
21693 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21695 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21696 and instead use public readonly fields.
21698 * class.cs: Put back walking code for type containers.
21700 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21702 * class.cs (MakeConstant): Code to define constants.
21704 * rootcontext.cs (LookupType): New function. Used to locate types
21707 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21709 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21710 this System.Reflection code is. Kudos to Microsoft
21712 * typemanager.cs: Implement a type cache and avoid loading all
21713 types at boot time. Wrap in LookupType the internals. This made
21714 the compiler so much faster. Wow. I rule!
21716 * driver.cs: Make sure we always load mscorlib first (for
21717 debugging purposes, nothing really important).
21719 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21720 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21722 * rootcontext.cs: Lookup types on their namespace; Lookup types
21723 on namespaces that have been imported using the `using' keyword.
21725 * class.cs (TypeContainer::TypeAttr): Virtualize.
21726 (Class::TypeAttr): Return attributes suitable for this bad boy.
21727 (Struct::TypeAttr): ditto.
21728 Handle nested classes.
21729 (TypeContainer::) Remove all the type visiting code, it is now
21730 replaced with the rootcontext.cs code
21732 * rootcontext.cs (GetClassBases): Added support for structs.
21734 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21736 * interface.cs, statement.cs, class.cs, parameter.cs,
21737 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21738 Drop use of TypeRefs, and use strings instead.
21740 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21744 * class.cs (Struct::Struct): set the SEALED flags after
21745 checking the modifiers.
21746 (TypeContainer::TypeAttr): new property, returns the
21747 TypeAttributes for a class.
21749 * cs-parser.jay (type_list): Oops, list production was creating a
21750 new list of base types.
21752 * rootcontext.cs (StdLib): New property.
21753 (GetInterfaceTypeByName): returns an interface by type name, and
21754 encapsulates error handling here.
21755 (GetInterfaces): simplified.
21756 (ResolveTree): Encapsulated all the tree resolution here.
21757 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21760 * driver.cs: Add support for --nostdlib, to avoid loading the
21761 default assemblies.
21762 (Main): Do not put tree resolution here.
21764 * rootcontext.cs: Beginning of the class resolution.
21766 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21768 * rootcontext.cs: Provide better error reporting.
21770 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21772 * rootcontext.cs (CreateInterface): Handle the case where there
21773 are no parent interfaces.
21775 (CloseTypes): Routine to flush types at the end.
21776 (CreateInterface): Track types.
21777 (GetInterfaces): Returns an array of Types from the list of
21778 defined interfaces.
21780 * typemanager.c (AddUserType): Mechanism to track user types (puts
21781 the type on the global type hash, and allows us to close it at the
21784 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21786 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21787 RecordInterface instead.
21789 * cs-parser.jay: Updated to reflect changes above.
21791 * decl.cs (Definition): Keep track of the TypeBuilder type that
21792 represents this type here. Not sure we will use it in the long
21793 run, but wont hurt for now.
21795 * driver.cs: Smaller changes to accomodate the new code.
21797 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21800 * rootcontext.cs (CreateInterface): New method, used to create
21801 the System.TypeBuilder type for interfaces.
21802 (ResolveInterfaces): new entry point to resolve the interface
21804 (CodeGen): Property, used to keep track of the code generator.
21806 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21808 * cs-parser.jay: Add a second production for delegate_declaration
21811 (enum_body): Put an opt_comma here instead of putting it on
21812 enum_body or enum_member_declarations so we can handle trailing
21813 commas on enumeration members. Gets rid of a shift/reduce.
21815 (type_list): Need a COMMA in the middle.
21817 (indexer_declaration): Tell tokenizer to recognize get/set
21819 * Remove old targets.
21821 * Re-add the parser target.
21823 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21825 * cs-parser.jay: Add precendence rules for a number of operators
21826 ot reduce the number of shift/reduce conflicts in the grammar.
21828 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21830 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21833 Get rid of old crufty code.
21835 * rootcontext.cs: Use this to keep track of the parsed
21836 representation and the defined types available to the program.
21838 * gen-treedump.cs: adjust for new convention.
21840 * type.cs: Split out the type manager, and the assembly builder
21843 * typemanager.cs: the type manager will live here now.
21845 * cil-codegen.cs: And the code generator here.
21847 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21849 * makefile: Fixed up for easy making.
21851 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21853 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21856 (unary_expression): Expand pre_increment_expression and
21857 post_decrement_expression to reduce a shift/reduce.
21859 2001-07-11 Simon Cozens
21861 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21863 Improve allow_keyword_as_indent name.
21865 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21867 * Adjustments for Beta2.
21869 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21871 * decl.cs: Added `Define' abstract method.
21872 (InTransit): new property, used to catch recursive definitions.
21874 * interface.cs: Implement `Define'.
21876 * modifiers.cs: Map Modifiers.constants to
21877 System.Reflection.TypeAttribute flags.
21879 * class.cs: Keep track of types and user-defined types.
21880 (BuilderInit): New method for creating an assembly
21881 (ResolveType): New function to launch the resolution process, only
21882 used by interfaces for now.
21884 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21885 that are inserted into the name space.
21887 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21889 * ARGH. I have screwed up my tree so many times due to the use of
21890 rsync rather than using CVS. Going to fix this at once.
21892 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21895 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21897 * Experiment successful: Use System.Type rather that our own
21900 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21902 * cs-parser.jay: Removed nsAliases from here.
21904 Use new namespaces, handle `using XXX;'
21906 * namespace.cs: Reimplemented namespace handling, use a recursive
21907 definition of the class. Now we can keep track of using clauses
21908 and catch invalid using clauses.
21910 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21912 * gen-treedump.cs: Adapted for all the renaming.
21914 * expression.cs (Expression): this class now has a Type property
21915 which returns an expression Type.
21917 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21918 `Type', as this has a different meaning now in the base
21920 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21922 * interface.cs, class.cs: Removed from all the sources the
21923 references to signature computation, as we can not do method
21924 signature computation during the parsing time, as we are not
21925 trying to solve at that point distinguishing:
21929 void a (NS.Blah x) {}
21932 Which depending on the context might be valid or not, as we do not
21933 know if Blah is the same thing as NS.Blah at that point.
21935 * Redid everything so the code uses TypeRefs now instead of
21936 Types. TypeRefs are just temporary type placeholders, that need
21937 to be resolved. They initially have a pointer to a string and the
21938 current scope in which they are used. This is used later by the
21939 compiler to resolve the reference to an actual Type.
21941 * DeclSpace is no longer a CIR.Type, and neither are
21942 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21943 are all DeclSpaces, but no Types.
21945 * type.cs (TypeRefManager): This implements the TypeRef manager,
21946 which keeps track of all the types that need to be resolved after
21947 the parsing has finished.
21949 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21951 * ARGH. We are going to have to store `foreach' as a class rather
21952 than resolving it, as we need to verify error 1579 after name
21953 resolution. *OR* we could keep a flag that says `This request to
21954 IEnumerator comes from a foreach statement' which we can then use
21955 to generate the error.
21957 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21959 * class.cs (TypeContainer.AddMethod): we now add methods to the
21960 MethodGroup instead of the method hashtable.
21962 * expression.cs: Add MethodGroup abstraction, which gets us one
21963 step closer to the specification in the way we handle method
21966 * cs-parser.jay (primary_expression): qualified_identifier now
21967 tried to match up an identifier to a local variable reference or
21968 to a parameter reference.
21970 current_local_parameters is now a parser global variable that
21971 points to the current parameters for the block, used during name
21974 (property_declaration): Now creates an implicit `value' argument to
21977 2001-05-09 Miguel de Icaza <miguel@ximian.com>
21979 * parameter.cs: Do not use `param' arguments as part of the
21980 signature, per the spec.
21982 2001-05-08 Miguel de Icaza <miguel@ximian.com>
21984 * decl.cs: Base class for classes, structs and interfaces. This
21985 is the "Declaration Space"
21987 * cs-parser.jay: Use CheckDef for checking declaration errors
21988 instead of having one on each function.
21990 * class.cs: Factor out some code for handling error handling in
21991 accordance to the "Declarations" section in the "Basic Concepts"
21992 chapter in the ECMA C# spec.
21994 * interface.cs: Make all interface member classes derive from
21995 InterfaceMemberBase.
21997 2001-05-07 Miguel de Icaza <miguel@ximian.com>
21999 * Many things: all interfaces are parsed and generated in
22000 gen-treedump. Support for member variables, constructors,
22001 destructors, properties, constants is there.
22003 Beginning of the IL backend, but very little done, just there for
22006 2001-04-29 Miguel de Icaza <miguel@ximian.com>
22008 * cs-parser.jay: Fix labeled statement.
22010 * cs-tokenizer.cs (escape): Escape " and ' always.
22011 ref_line, ref_name: keep track of the line/filename as instructed
22012 by #line by the compiler.
22015 2001-04-27 Miguel de Icaza <miguel@ximian.com>
22017 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
22018 to match the values in System.CodeDOM.
22020 Divid renamed to Divide.
22022 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
22024 (Statements.set): remove.
22026 * System.CodeDOM/CodeCatchClause.cs: always have a valid
22029 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
22030 falseStatements always have valid values.
22032 * cs-parser.jay: Use System.CodeDOM now.