1 2005-12-21 Miguel de Icaza <miguel@novell.com>
3 * driver.cs: Report the case of no source files and no -out:
6 2005-12-20 Raja R Harinath <rharinath@novell.com>
9 * expression.cs (ComposedCast.GetSignatureForError): Define.
11 2005-12-18 Carlos Alberto Cortez <calberto.cortez@gmail.com>
15 * namespace.cs (NamespaceEntry): Add extern_aliases as a
16 ListDictionary, to contain the ExternAliasEntry entries (in
17 addition to the NamespaceEntry.aliases hashtable). This field is
18 shared between the original entry and its doppelganger (bodyless
20 (NamespaceEntry.UsingExternalAlias): Add the extern alias entry to
22 (NamespaceEntry.Lookup): Move the IsImplicit check after the
23 lookup in extern_aliases.
25 2005-12-16 Raja R Harinath <rharinath@novell.com>
28 * class.cs (TypeContainer.Mark_HasEquals): New.
29 (TypeContainer.Mark_HasGetHashCode): New.
30 (ClassPart): Override them.
31 (MethodCore.CheckBase): Use them instead of referring to Parent.Methods.
34 * enum.cs (EnumMember.EnumMember): Pass the parent_enum as the
35 'parent' argument to the base constructor.
37 Remove all mention of TypeContainer from decl.cs.
38 * decl.cs (MemberCore.Parent): Change into a DeclSpace.
39 (MemberCore.MemberCore): Change type of 'parent' argument to DeclSpace.
40 (DeclSpace.DeclSpace): Likewise.
41 (DeclSpace.DefineMembers): Remove unused argument.
42 * cs-parser.jay (pop_current_class): Update to changes. Simplify
43 debugging check -- we don't care if the debug code throws an
44 InvalidCastException instead of an InternalErrorException.
45 * class.cs (TypeContainer.DefineMembers): Update to changes.
46 (TypeContainer.DoDefineMembers): Likewise.
47 (TypeContainer.GetMethods): Likewise.
48 (PropertyMember.Define): Likewise.
49 (MemberBase.Parent): New property that forwards to
50 MemberCore.Parent, but ensures that we get a TypeContainer.
51 * rootcontext.cs (RootContext.PopulateCoreType): Update to changes.
52 (RootContext.PopulateTypes): Likewise. Remove special case code
53 for !RootContext.StdLib: DefineMembers is idempotent.
55 2005-12-14 Miguel de Icaza <miguel@novell.com>
57 * convert.cs (ExplicitConversionCore): Check the return value from
58 ExplicitConversionCore which can return null on failure. Fixes #76914
60 2005-12-13 Marek Safar <marek.safar@seznam.cz>
62 * class.cs (Method.ApplyAttributeBuilder): Test out modifier properly.
64 2005-12-11 Atsushi Enomoto <atsushi@ximian.com>
66 * doc.cs : The search for referenced namespace was insufficient to
67 get global one as it used to do. Fixed bug #76965.
69 2005-12-10 Atsushi Enomoto <atsushi@ximian.com>
71 * doc.cs : check name in cref in the last phase that whether it is
74 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
76 * cs-tokenizer.cs : reverted the latest change: it somehow broke
79 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
81 * doc.cs : so it turned out that we cannot skip override check for
82 interface members. Fixed bug #76954.
84 2005-12-09 Atsushi Enomoto <atsushi@ximian.com>
86 * cs-tokenizer.cs : fixed bug #75984:
87 - #warning and #error should not be handled when the source line
89 - #line is not checked strictly when the source line is disabled.
90 - #define and #undef is on the other hand checked strictly at any
93 2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
95 * cs-tokenizer.cs : missing Location (actually, filename) in one of
98 2005-12-05 Marek Safar <marek.safar@seznam.cz>
100 * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only.
102 * class.cs (EmitFieldInitializers): Simplified and fixed to work with
104 (FieldBase.EmitInitializer): Moved from TypeContainer and simplified.
105 (FieldBase.Initializer): Initializer is now optional.
106 (EventField.Define): Only event field can have initializer.
108 * codegen.cs (EmitContext): DeclSpace is not readonly (small hack).
110 * const.cs (Const): Reuse initializer.
112 * cs-parser.jay: Updated after FieldBase changes.
113 Added current_array_type to simplify array initializers.
115 * ecore.cs (NullCast.IsDefaultValue): Implemented.
117 * expression.cs, iterators.cs: Updated.
119 * namespace.cs (NamespaceEntry): Made UsingFound private.
121 2005-12-05 Marek Safar <marek.safar@seznam.cz>
123 * parameterCollection.cs: Obsolete, removed.
124 * parser.cs: Obsolete, removed.
126 2005-12-05 Marek Safar <marek.safar@seznam.cz>
129 * class.cs (Constructor.Emit): Set obsolete checking for whole context.
131 * enum.cs (Enum.Define): Set obsolete context here.
133 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
136 - FindDocumentedMember() now expects 1) paramList as null
137 when "we don't have to check the number of parameters" and
138 2) Type.EmptyTypes when "there is no arguments".
139 - Introduced FoundMember struct to hold the exact type which was
140 used to find the documented member (the above change broke
141 test-xml-044; it might be better just to use DeclaringType than
142 what MS does, like this change does, but it depends on usage.)
144 2005-12-05 Atsushi Enomoto <atsushi@ximian.com>
146 * doc.cs : documented member might be from DeclaringType for nested
147 types. Fixed bug #76782.
149 2005-12-03 Ben Maurer <bmaurer@ximian.com>
151 * anonymous.cs: Have the param code handle leaving copies on the
152 stack etc. Allows anonymous params to take part in the assignment
153 code (++, +=, etc). Fixes bug #76550
155 * expression.cs: Handle the prepare_for_load/leave_copy by passing
156 it down to the anon code.
158 * iterators.cs: Use dummy var here
160 * codegen.cs: Handle new vars
162 2005-12-01 Marek Safar <marek.safar@seznam.cz>
165 * class.cs (MethodData.Define): Set proper Obsolete context.
167 * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in
169 (FieldExpr.DoResolve): Ditto.
171 2005-12-01 Marek Safar <marek.safar@seznam.cz>
174 * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when
175 parent is not obsolete.
177 2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
179 * doc.cs : (FindDocumentedMember) find parameterless members first
180 and get CS0419 in the early stage. Fixed first case of bug #76727.
182 2005-11-30 Marek Safar <marek.safar@seznam.cz>
185 * ecore.cs (Expression.ResolveAsConstant): Report constant error only when
186 no error was reported.
188 *expression.cs (Binary.DoResolve): left can be null.
190 2005-11-22 Marek Safar <marek.safar@seznam.cz>
193 * class.cs (MethodData.Emit): Parameters should be labeled first.
195 2005-11-21 Marek Safar <marek.safar@seznam.cz>
198 * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection.
200 2005-11-18 Marek Safar <marek.safar@seznam.cz>
202 * attribute.cs (AreParametersCompliant): Moved to Parameter.
204 * class.cs (MethodCore): Parameter clean up.
205 (IMethodData): Added ParameterInfo.
206 (MethodData): Parameter clean up.
207 (Indexer.Define): Parameter clean up.
219 * typemanager.cs: Parameter clean up.
221 * delegate.cs (Define): Get rid of duplicated code.
223 * expression.cs (ParameterReference): Removed useless parameters
227 * parameter.cs (ParamsParameter): New class, params specialization.
228 (ArglistParameter): Attemp to separate arglist.
229 (Parameter): Refactored to be reusable and faster.
230 (Parameter.Modifier): Made understandable.
231 (Parameters): Changed to be used as a class for `this' assembly
232 parameters. Refactored to use new specialized classes.
234 * support.cs (ParameterData): Added Types property.
235 (InternalParameters): Deleted.
237 2005-08-20 Martin Baulig <martin@ximian.com>
239 Merging this patch from GMCS to fix #75867.
241 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
242 scope if we don't already have it.
244 2005-11-17 Martin Baulig <martin@ximian.com>
247 (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we
248 inherit the scope from our parent. Fixes #76653.
250 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
252 * doc.cs : the previous patch does not actually fix the bug.
253 PropertyInfo override check is now implemented and really fixed it.
254 * expression.cs : Invocation.IsAncestralType() is used from doc.cs.
256 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
258 * doc.cs : apply "override filter" also to properties.
261 2005-11-16 Atsushi Enomoto <atsushi@ximian.com>
263 * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces,
264 no need to check overrides. For classes, omit those results from
265 interfaces since they must exist in the class. Fixed bug #76726.
267 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
269 * typemanager.cs : (GetFullNameSignature) differentiate indexers
270 with different parameters. Fixed the second problem in #76685.
272 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
274 * doc.cs : (FindDocumentedMember) pass invocation_type as well (to
275 get expected 'protected' access in CheckValidFamilyAccess()).
278 2005-11-15 Atsushi Enomoto <atsushi@ximian.com>
280 * doc.cs : (GenerateTypeDocComment) Fields could be FixedField.
281 Fixed bug #76705. CS1569 was incorrectly commented out.
283 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
285 * doc.cs : use Invocation.IsOverride() to do real override check.
286 * expression.cs : made Invocation.IsOverride() internal.
288 2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
290 * doc.cs : use TypeManager.FindMembers() instead of (possible)
291 TypeBuilder.FindMembers() and filter overriden base members out.
294 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
296 * doc.cs : ref/out parameters are represented as '@' (instead of
297 '&' in type FullName). Fixed bug #76630 (additionally crefs).
299 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
301 * doc.cs : when there was no '.' in cref to methods in doc comment,
302 then parameters were missing in the output. Fixed bug #76691.
304 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
306 * driver.cs : don't output docs when there is an error.
309 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
312 Now it should detect indexers. Fixed primary concern in bug #76685.
313 Fixed CS0419 message to not show the identical member signature in
316 2005-11-13 Atsushi Enomoto <atsushi@ximian.com>
318 * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup()
319 instead of Type.FindMembers() since it does not handle events.
322 2005-11-12 Gert Driesen <drieseng@users.sourceforge.net>
324 * codegen.cs: Fixed typo (speficied -> specified).
326 2005-11-11 Marek Safar <marek.safar@seznam.cz>
329 * doc.cs (FindDocumentedTypeNonArray): Don't resolve again.
331 2005-11-11 Marek Safar <marek.safar@seznam.cz>
333 * attribute.cs: Changed error message.
335 * cs-tokenizer.cs: One more check.
337 2005-11-10 Marek Safar <marek.safar@seznam.cz>
339 * statement.cs (Block.Resolve): Ignore empty statement.
341 2005-11-10 Marek Safar <marek.safar@seznam.cz>
343 * report.cs: Made error/warning methods more strict to avoid
346 * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs,
347 convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs,
348 doc.cs, driver.cs, ecore.cs, expression.cs, location.cs,
349 namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated.
351 2005-11-08 Marek Safar <marek.safar@seznam.cz>
353 * attribute.cs (Attribute.GetCoClassAttributeValue): New method.
354 (AttributeTester.GetCoClassAttribute): Get CoClassAttribute.
356 * class.cs (TypeContainer.IsComImport): New property.
357 (Constructor.Define): Create proper ctor for ComImport types.
359 * expression.cs (New.CheckComImport): Fixed.
361 2005-11-07 Miguel de Icaza <miguel@novell.com>
363 * anonymous.cs (CaptureContext.AddParameterToContext): The fact
364 that a parameter has been captured does not mean that we do not
365 have to do the rest of the processing. This fixes the second part
366 of #76592. If there was another anonymous method capturing
367 values in the past, the Scope would never be set for the second
368 method that captured the same parameter.
370 (CaptureContext.EmitAssignParameter): When `leave_copy' is passed,
371 properly manipulate the stack. Second part of fix for #76592.
373 * expression.cs (New): Add support for invoking "new" on
374 interfaces that have been flagged with the ComImport attribute and
375 the CoClass. Fixes #76637
377 * statement.cs (Try.DoEmit): When a variable is captured, do not
378 try to emit the vi.LocalBuilder variable as it has been captured.
379 Create a temporary variable and store the results on the
380 FieldBuilder. Fixes #76642
382 2005-11-07 Marek Safar <marek.safar@seznam.cz>
384 * class.cs (CheckPairedOperators): Made compilable with csc 2.0.
386 * ecore.cs (InstanceResolve): Fixed CS1540 detection.
388 * expression.cs (Binary.DoResolve): Added && optimalization.
390 * typemanager.cs (AddUserType): Removed useless argument.
392 2005-11-04 Marek Safar <marek.safar@seznam.cz>
394 * statement.cs (Block.variables): Uses ListDictionary.
396 2005-11-03 Marek Safar <marek.safar@seznam.cz>
399 * class.cs (PartialContainer.EmitType): Customized to emit
401 (ClassPart.ApplyAttributeBuilder): Transform security attribute
404 2005-11-03 Marek Safar <marek.safar@seznam.cz>
407 * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer
408 access has to be fixed.
410 * typemanager.cs (IsUnmanagedType): Wrong common field type.
412 2005-11-01 Marek Safar <marek.safar@seznam.cz>
415 * ecore.cs (NullCast.Reduce): Implemented.
417 * expression.cs (ArrayCreation.CheckIndices): Correcly check
420 * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
422 (Foreach.Resolve): Catch null properly.
424 2005-10-29 Marek Safar <marek.safar@seznam.cz>
426 * cs-tokenizer.cs: Warning text fix.
428 * driver.cs: AllWarningNumbers exposed on public interface.
430 * report.cs (): Reviewed warning numbers.
431 (IsValidWarning): Use binary search.
433 2005-10-29 Marek Safar <marek.safar@seznam.cz>
435 * driver.cs: Implemeted resource visibility.
436 (Resources): New class for code sharing between /res: and
439 2005-10-28 Marek Safar <marek.safar@seznam.cz>
442 * cfold.cs (ConstantFold.BinaryFold): Implemented null cast
445 * convert (Convert.ImplicitReferenceConversion): NullCast holds
448 * ecore.cs (NullCast): Child is contant only.
450 * literal.cs (NullLiteral.Reduce): null can be converted to any
453 2005-10-28 Kornél Pál <kornelpal@hotmail.com>
455 * driver.cs: Use Encoding.Default as default code page instead
458 2005-10-27 Raja R Harinath <rharinath@novell.com>
461 * expression.cs (Invocation.Error_InvalidArguments): Handle
462 __arglist parameters.
463 (Invocation.VerifyArgumentsCompat): Likewise.
464 * support.cs (ReflectionParameters.GetSignatureForError): Print
465 __arglist parameters.
466 (InternalParamters.GetSignatureForError): Likewise.
467 * parameter.cs (Parameters.GetSignatureForError): Likewise.
469 2005-10-26 Marek Safar <marek.safar@seznam.cz>
471 * attribute.cs (GetPropertyValue): Made public.
473 * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
475 Add new property WrapNonExceptionThrows to handle 2.0 assembly
477 (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
480 * driver.cs: Reflect method name change.
482 * statement.cs (Try.Resolve): Warn when try has both general
485 * typemanager.cs: runtime_compatibility_attr_type new predefined
488 2005-10-26 Raja R Harinath <harinath@gmail.com>
491 * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
492 treat it as an empty parameter list.
494 2005-10-26 Raja R Harinath <rharinath@novell.com>
497 * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
498 ResolveAsTypeStep silent.
499 * statement.cs (Block.AddConstant): Mark block as used.
500 (Block.ResolveMeta): Avoid piling on error messages
501 if a constant initializer resolution fails.
503 2005-10-25 Raja R Harinath <rharinath@novell.com>
505 * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
507 (NamespaceEntry.VerifyAllUsing): New.
508 (NamespaceEntry.AliasEntry.Resolve): New. Handles common error
509 behaviour. Delegates actual resolution of alias to ...
510 (NamespaceEntry.DoResolve): ... this. Renamed from Resolve.
511 (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry):
513 * driver.cs (Driver.MainDriver): Update.
515 * namespace.cs (NamespaceEntry.DefineNamespace): Remove.
516 (NamespaceEntry.SymbolFileID): Make into a on-demand computed
518 (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll):
520 * symbolwriter.cs (SymbolWriter.Initialize): Don't call
521 RootNamespace.DefineNamespacesForAll.
523 2005-10-24 Raja R Harinath <harinath@gmail.com>
525 * typemanager.cs (assemblies, external_aliases, modules)
526 (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules)
527 (ComputeNamespaces, GetRootNamespace): Remove extra staging
528 overhead. Move resposibility ...
529 * namespace.cs (GlobalRootNamespace): ... here. Update to changes.
530 * driver.cs, attribute.cs, codegen.cs: Update to changes.
532 2005-10-23 Raja R Harinath <harinath@gmail.com>
534 * namespace.cs (RootNamespace.all_namespaces): Renamed from
535 cached_namespaces. Improve usage.
536 (RootNamespace.Reset, RootNamespace.RegisterNamespace)
537 (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll):
538 Move from GlobalRootNamespace and simplify.
539 (RootNamespace.Global): Make instance variable.
540 (RootNamespace.RootNamespace): Add "alias name" parameter.
541 (GlobalRootNamespace): Simplify drastically.
542 (Namespace.Lookup): Don't use GetNamespace.
543 * typemanager.cs (GetRootNamespace): Rename from
544 ComputeNamespaceForAlias.
545 (NamespaceClash): Use Global.IsNamespace instead of GetNamespace.
547 2005-10-23 Marek Safar <marek.safar@seznam.cz>
549 * anonymous.cs (AnonymousContainer): Don't crash when container
552 2005-10-23 Marek Safar <marek.safar@seznam.cz>
554 * expression.cs (Binary.DoResolve): Warn when comparing same
557 2005-10-23 Marek Safar <marek.safar@seznam.cz>
560 * expression.cs (Binary.DoResolve): It looks like there are no
561 convetsion rules in enum context.
563 2005-10-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
565 Add support for extern alias qualifiers.
566 * typemanager.cs: Move some LookupTypeReflection code
567 to namespace.cs, to have cleaner code. Added some methods
568 to help us keep track of the extern aliased references.
569 * driver.cs: Add suport for extern alias assemblies on command
570 line and check for their warnings/errors. Also keep track of the
571 extern aliased assemblies.
572 * namespace.cs: Move the global functionality of Namespace
573 to GlobalRootNamespace/RootNamespace. Now the global namespace
574 is GlobalRootNamespace.Globa. Also the code moved from
575 typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs.
576 Finally added LocalAliasEntry (AliasEntry before) and
577 ExternAliasEntry, to handle alias statements.
578 * cs-parser.jay: Add support in the grammar for extern alias
580 * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs:
581 Update callings to Namespace (now in GlobalRootNamespace).
583 2005-10-18 Raja R Harinath <rharinath@novell.com>
586 * class.cs (TypeContainer.DefineType): Move updating of
587 topological sort earlier in the code.
588 * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder.
590 2005-10-18 Marek Safar <marek.safar@seznam.cz>
593 * cfold.cs (BinaryFold): Reduce constant in enum conversion.
595 * constant.cs (Constant.TryReduce): Moved from Cast class.
596 (Reduce): Made little bit more OO and fixed missing conversions.
598 * ecore.cs (Reduce): Implemented.
599 (Binary.EnumLiftUp): New method to upgrade values to enum values.
601 * literal.cs (Reduce): Implemented.
603 * class.cs: Reverted Miguel's wrong commit.
605 2005-10-14 Miguel de Icaza <miguel@novell.com>
607 * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore
609 2005-10-14 Atsushi Enomoto <atsushi@ximian.com>
611 * cs-parser.jay, expression.cs : CS0214 was missing error location
612 for constants. Fixed bug #76404.
614 2005-10-11 Marek Safar <marek.safar@seznam.cz>
617 * convert.cs (ExplicitConversionCore): Fixed object->enum
620 2005-10-10 Raja R Harinath <rharinath@novell.com>
622 * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
624 (PropertyExpr.EmitCall): Likewise.
625 * expression.cs (Invocation.EmitArguments): Handle case where
627 (Invocation.EmitCall): Avoid allocating temporary variable if
628 there are no arguments.
630 2005-10-07 Raja R Harinath <rharinath@novell.com>
633 * convert.cs (ImplicitConversionStandard): Move conversion of
634 void* to arbitrary pointer types ...
635 (ExplicitConversionStandard): .. here.
636 * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266
637 error to always print typenames.
639 2005-10-07 Raja R Harinath <rharinath@novell.com>
641 * convert.cs (GetConversionOperator): Rename from
642 GetConversionOperators. Move operator selection code from ...
643 (UserDefinedConversion): ... here.
645 2005-10-06 Marek Safar <marek.safar@seznam.cz>
647 * convert.cs (ExplicitConversionCore): Removed duplicate enum
650 2005-10-05 Marek Safar <marek.safar@seznam.cz>
652 * assign.cs (Assign.DoResolve): Error method changed.
654 * cfold.cs (DoConstantNumericPromotions): Error method changed.
656 * const.cs (ResolveValue): Reset in_transit immediately.
658 * constant.cs: Error method changed.
660 * convert.cs: Removed useless location parameter.
661 (ExplicitNumericConversion): Don't do double enum check.
662 (ExplicitConversionCore): Renamed from ExplicitConversion.
663 (ExplicitUnsafe): Extracted from ExplicitConversion.
664 (ExplicitConversion): Uses for error reporting.
666 * ecore.cs (Error_ValueCannotBeConverted): More logic for more
668 (ResolveBoolean): Uses common error method.
669 (CastToDecimal): Get rid of ec.
670 (CastFromDecimal): Optimized.
671 (ConvCast): Get rid of ec.
673 * enum.cs (ResolveValue): Reset in_transit immediately.
674 (Emit): Return after first error.
676 * expression.cs: Convert changes.
678 * literal.cs: Error method changed.
680 * statement.cs: Error method changed.
682 2005-10-03 Raja R Harinath <rharinath@novell.com>
684 * support.cs (SeekableStreamReader.Position): Don't error out when
685 the requested position is just beyond the end of the current
688 2005-09-28 Raja R Harinath <rharinath@novell.com>
690 * support.cs (SeekableStreamReader): Simplify drastically. Don't
691 try to keep in sync with the byte count of the underlying Stream.
692 However, this limits us to a window size of 2048 characters: i.e.,
693 the maximum lookahead of our lexer/parser can be 2048 characters.
695 2005-09-28 Marek Safar <marek.safar@seznam.cz>
698 * driver.cs: Fix compilation files with full root path.
700 2005-09-25 Miguel de Icaza <miguel@novell.com>
702 * report.cs (SymbolRelatedToPreviousError): Format the output so
703 it does not use an open parenthesis that is never closed.
705 * driver.cs: Follow coding guidelines
707 2005-09-27 Marek Safar <marek.safar@seznam.cz>
710 * const.cs (Const.ResolveValue): Check for assigning non-null
711 value to reference type.
713 2005-09-27 Marek Safar <marek.safar@seznam.cz>
715 * anonymous.cs: Implemented ExprClassName.
717 * assign.cs (Assign.DoResolve): Don't chrash when type is not
720 * attribute.cs (ResolveArguments): Enabled MethodImplOptions
723 * class.cs (StaticClass.DefineContainerMembers): Report protected
726 * codegen.cs: if(ed) PRODUCTION.
728 * convert.cs (Error_CannotImplicitConversion): Better error
731 * cs-parser.jay: More error checks.
733 * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert.
735 * driver.cs (CSCParseOption): Enabled wrong option check.
737 * ecore.cs (Expression.ExprClassName): Turned to property.
738 (MemberExpr.CheckIntermediateModification): For checking boxed
739 value types modification.
741 * statement.cs (Fixed.Resolve): Expression type must be
742 convertible to fixed type.
743 (CollectionForeach.GetEnumeratorFilter,TryType):
744 Small refactoring for easier error checking.
746 2005-09-26 Marek Safar <marek.safar@seznam.cz>
748 * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
751 * class.cs (GeneratedBaseInitializer): New class for customization
752 compiler generated initializers.
753 (MemberBase.DoDefine): Check Obsolete attribute here.
754 (FieldMember.DoDefine): Ditto.
756 * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
759 * decl.cs (MemberCore.EmitContext): Returns valid current ec.
760 (MemberCore.GetObsoleteAttribute): Removed argument.
761 (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
762 (MemberCore.CheckObsoleteType): New helper.
766 * statement.cs: Updates after MemberCore changes.
768 * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
769 (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
771 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
772 obsolete attribute for compiler construct.
773 (As.DoResolve): Cache result.
775 * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
777 2005-09-26 Raja R Harinath <rharinath@novell.com>
780 * expression.cs (This.VerifyFixed): In a value type T, the type of
781 'this' is T&, iow, 'this' is either an out or ref parameter. In a
782 value type R, 'this' is treated as a value parameter.
784 2005-09-22 Miguel de Icaza <miguel@novell.com>
786 * statement.cs (Lock): Use the TemporaryVariable class instead of
787 manually using local variables as those do not work when variables
790 * ecore.cs: Moved the TemporaryVariable class from being a nested
791 class inside Foreach to be a public class that can be employed in
794 2005-09-19 Marek Safar <marek.safar@seznam.cz>
796 * cs-parser.jay: interface_accessors replaced by
797 accessor_declarations.
799 * ecore.cs, literal.cs, statement.cs: NullLiteral holds null
802 * statement.cs (GotoCase.Resolve): Convert null constant to
804 (SwitchLabel.ResolveAndReduce): Ditto.
805 (SwitchLabel.NullStringCase): Custom null stamp.
806 (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase.
808 typemanager.cs (CSharpSignature): Don't skip first argument
811 2005-09-18 Miguel de Icaza <miguel@novell.com>
813 * driver.cs: Set InEmacs based on the environment variable EMACS.
815 * location.cs (InEmacs): in this mode, do not report column
816 location as it confuses Emacs.
818 2005-09-16 Marek Safar <marek.safar@seznam.cz>
820 * cfold.cs, constant.cs, convert.cs, ecore.cs,
821 expression.cs, iterators.cs, literal.cs: Store constants and
824 * class.cs (MemberBase.ShortName): Pass location.
826 * cs-parser.jay: Some location fixes.
828 * ecore.cs (Expression.Location): Made virtual.
830 2005-09-05 Miguel de Icaza <miguel@novell.com>
832 * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant
833 if the underlying types are the same, otherwise we need to produce
834 code that will do the proper cast.
836 This was exposed by Marek's constant rewrite which produced
837 invalid code for the call site:
844 This fixes test-49.cs
846 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
848 * attribute.cs : (Attribute.IsValidArgumentType): array of string/
849 Type/Object should be allowed as well. Fixed bug #75968.
851 2005-09-05 Atsushi Enomoto <atsushi@ximian.com>
853 * expression.cs : (Binary.DoResolve): when one is enum constant and
854 another is constant 0, then return enum one *as enum type*.
857 2005-09-02 Raja R Harinath <rharinath@novell.com>
859 * attribute.cs (GetMarshal): Work even if "DefineCustom" is
863 * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable
864 flow-branching for LocalVariableReferences in case we were invoked
866 * expression.cs (LocalVariableReference.VerifyAssigned): New.
868 (LocalVariableReference.DoResolveBase): ... this.
869 (MemberAccess.Resolve): Do the check that was disabled during
872 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
875 (PartialContainer.Create): check abstract/sealed/static strictly
876 but abstract/sealed can exist only at one side. Fixed bug #75883.
878 2005-09-01 Kornél Pál <kornelpal@hotmail.com>
881 * attribute.cs (Attribute.GetMarshal): If ArraySubType is not
882 specified, don't default to UnmanagedType.I4.
884 2005-09-01 Atsushi Enomoto <atsushi@ximian.com>
886 * expression.cs : conditional operator should check possibly
887 incorrect assign expression. Fixed bug #75946.
889 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
891 * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs :
892 Reverting the change. gmcs is much complex than mcs on this matter.
894 2005-08-31 Atsushi Enomoto <atsushi@ximian.com>
896 * cs-tokenizer.cs : To read another token ahead of the actual
897 consumption, use new SavedToken and cache token instead of moving
898 back the stream with SeekableStreamReader (it seemed problematic).
900 driver.cs : Thus use StreamReader directly.
901 * support.cs : Thus removed SeekableStreamReader.
903 2005-08-30 Raja R Harinath <rharinath@novell.com>
906 * anonymous.cs (ScopeInfo.MakeFieldName): New helper.
907 (ScopeInfo.EmitScopeType): Use it to construct field names from
908 names of captured locals.
911 * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove.
912 * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion):
913 Pass 'target_type' to BoxedCast. Don't default to 'object'.
914 (ExplicitConversion): Remove enum cases already handled by
915 implicit conversion. Move implicit conversion check to the beginning.
916 * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update.
917 * expression.cs (ArrayCreation.EmitDynamicInitializers):
918 Don't treat System.Enum as a struct.
920 2005-08-30 Jb Evain <jbevain@gmail.com>
922 * attribute.cs: handles as expression in parameters.
924 2005-08-30 Raja R Harinath <rharinath@novell.com>
927 * class.cs (TypeContainer.VerifyClsName): Don't use a
928 PartialContainer when verifying CLS compliance.
929 (AbstractPropertyEventMethod): Set Parent here, ...
930 (PropertyMethod): ... not here.
932 2005-08-30 Atsushi Enomoto <atsushi@ximian.com>
934 * attribute.cs : escaped attribute name should not be allowed to be
935 resolved (e.g. @class as classAttribute). Fixed bug #75930.
937 2005-08-29 Raja R Harinath <rharinath@novell.com>
940 * convert.cs (ImplicitStandardConversionExists): Allow zero also
941 when converting a long constant to unsigned long.
942 * expression.cs (Invocation.OverloadResolve): Add sanity check to
943 detect where IsApplicable and VerifyArgumentsCompat disagree.
945 2005-08-29 Raja R Harinath <rharinath@novell.com>
946 and Carlos Alberto Cortez <carlos@unixmexico.org>
949 * class.cs (TypeContainer.CanElideInitializer): New helper.
950 (TypeContainer.EmitFieldInitializers): Use it to determine if we
951 can safely emitting the initializer of a field.
953 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
955 * statement.cs : (Continue.Resolve()) Unlike break, continue is not
956 allowed inside a switch (without loop). Fixed bug #75433.
958 2005-08-26 Kornél Pál <kornelpal@hotmail.com>
960 * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs.
961 * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs.
963 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
965 * driver.cs : kinda reverting the default encoding changes (not exact
966 revert since I noticed that "codepage:reset" might not work fine).
968 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
970 * class.cs : (AbstractPropertyEventMethod) SetupName() now takes
971 Location. Now getter and setter store location correctly.
972 (errors/cs0111-12.cs now reports the expected location.)
974 2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
976 * driver.cs : Use default encoding on the environment.
977 Removed (now that) extra parameter for SeekableStreamReader.
978 * support.cs : (SeekableStreamReader) third .ctor() argument for
979 StreamReader is not required (always true). preamble size could
980 be acquired in simpler and safe way.
982 2005-08-24 Atsushi Enomoto <atsushi@ximian.com>
984 * cs-parser.jay: report CS0642 at warning level 3
985 and report CS0642 for an if else statement also
986 fixes bug #74745. Patch by John Luke (and a bit
988 Removed extra CS0642 warning check for "while",
990 * statement.cs: In Block.Resolve(), CS0642 check
991 is reimplemented to check a sequence of an empty
992 statement and a block.
996 2005-08-24 Marek Safar <marek.safar@seznam.cz>
998 * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties
999 detection until I fix it.
1001 * cs-tokenizer.cs: Changed error message.
1003 * cs-parser.jay: Fixed 2 error locations.
1005 * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message.
1006 (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C#
1009 * enum.cs (GetSignatureForError): Fixed.
1011 * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special
1015 * typemanager.cs (RegisterProperty): Removed.
1017 * statement.cs (CheckInvariantMeaningInBlock): Changed error message.
1019 2005-08-24 Raja R Harinath <rharinath@novell.com>
1022 * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers.
1023 (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers.
1025 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1027 * expression.cs : tiny fix is required for not warning positive ulong.
1030 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1032 * expression.cs : add CS0652 check for constant and integral
1033 expression. Fixed bug #53974.
1035 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1037 * expression.cs : in DoNumericPromotions(), check if there is implicit
1038 conversion overload for string (to check CS0034). Fixed bug #52492.
1040 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1042 * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245.
1044 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1046 * ecore.cs : report location when it is *not* Null.
1048 2005-08-23 Atsushi Enomoto <atsushi@ximian.com>
1054 Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check
1055 correctly. Fixed bug #75721.
1057 2005-08-23 Raja R Harinath <rharinath@novell.com>
1059 * support.cs (SeekableStreamReader.Position): Avoid an expensive
1060 loop that performs 'min (pos, char_count)'.
1063 * expression.cs (Unary.ResolveOperator): Don't discard implicit
1064 converted value in Operator.OnesComplement.
1066 2005-08-22 Ben Maurer <bmaurer@ximian.com>
1068 * anonymous.cs: If the anon method is pulled into a helper class,
1069 it needs to be `internal' not `private'. Fixes runtime behavior on
1072 2005-08-20 Martin Baulig <martin@ximian.com>
1074 * anonymous.cs (CaptureContext.CaptureThis): Create the topmost
1075 scope if we don't already have it.
1077 * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather
1078 than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators;
1081 2005-08-17 Marek Safar <marek.safar@seznam.cz>
1084 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object
1087 2005-08-16 Marek Safar <marek.safar@seznam.cz>
1089 The big constants rewrite
1090 Fix #75746, #75685 and more
1091 As a side effect saved 1MB for MWF ;-)
1093 * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue.
1094 (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not
1095 enum based for corlib compilation.
1097 * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum
1100 * class.cs (FixedField.Define): Use ResolveAsConstant.
1102 * const.cs (IConstant): Interface constants and enums.
1103 (Const.ResolveValue): New method for constant resolvning.
1104 (ExternalConstant): Constants from imported assemblies.
1106 * constant.cs (Constant.GetTypedValue): Used to get constant with forced
1107 conversion; like enums.
1108 (Constant.ToType): Converts this constant to different type.
1109 (Constant.Increment): Adds 1.
1111 * convert.cs (ImplicitConversionRequired): Simplified.
1113 * cs-parser.jay: Create EnumMember directly.
1115 * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence.
1117 * doc.cs (GenerateEnumDocComment): Removed.
1119 * ecore.cs (Expression.ResolveAsConstant): New constant specific method.
1120 (ConvertIntLiteral): Removed.
1121 (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s).
1123 * enum.cs (EnumMember): Implement IConstant.
1124 (Enum.IsValidEnumConstant): Removed.
1125 (Enum.GetNextDefaultValue): Removed.
1126 (Enum.FindMembers): Updated.
1127 (Enum.GenerateDocComment): Iterate enum members.
1129 * expression.cs (Cast.TryReduce): Handle enums correctly.
1130 (New.Constantify): Made public.
1131 (MemberAccess.DoResolve): Removed contant specific if(s).
1133 * literal.cs (NullLiteral): Implement new abstract methods.
1135 * statement.cs (GotoCase.Resolve): Use new constant methods.
1136 (SwitchLabel.ResolveAndReduce): Use new constant methods.
1138 * typemanager.cs (LookupEnum): Removed.
1139 (IsEnumType): Fixed to work with corlib.
1140 (RegisterConstant): Removed.
1141 (LookupConstant): Removed.
1142 (GetConstant): Changed to work with IConstant.
1144 2005-08-04 Atsushi Enomoto <atsushi@ximian.com>
1146 * location.cs : Fixed overflown (>255) column number.
1148 2005-08-03 Raja R Harinath <rharinath@novell.com>
1150 First cut of the qualified-alias-member feature.
1151 * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon
1153 * cs-parser.jay (DOUBLE_COLON): New token.
1154 (namespace_or_type_name): Add rule for recognizing
1155 qualified-alias-members.
1156 (primary_expression): Likewise.
1157 (element_access): Allow QualifiedAliasMember as a possible
1158 type-bearing expression.
1159 (local_variable_type, local_variable_pointer_type): Likewise.
1160 * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up
1161 aliases in the current and enclosing namespace declarations.
1162 (NamespaceEntry.UsingAlias): Add CS0440 warning.
1163 * decl.cs (MemberName.is_double_colon): New.
1164 (MemberName.MemberName): Add new constructor for alias-member.
1165 (MemberName.GetTypeExpression): Generate QualifiedAliasMember too.
1166 * expression.cs (QualifiedAliasMember): New expression type.
1168 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1170 * location.cs : it borked when no argument was specified.
1172 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1174 * location.cs : tiny ToString() format fix.
1176 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1178 * statement.cs : oops, it was missing.
1180 2005-08-02 Atsushi Enomoto <atsushi@ximian.com>
1182 A set of fixes for precise line/column location.
1185 "token" field now holds a file/line "delta", a line number offset
1186 from the segment, and a column number. See also:
1187 http://lists.ximian.com/pipermail/mono-devel-list/2004-
1188 December/009508.html
1189 Removed static IsNull. Use instance IsNull property instead.
1191 For some tokens it stores Location. For Identifier it stores
1192 LocatedToken which is a pair of string name and location.
1193 Column numbers are adjusted only at getChar().
1195 Use Location.ToString() for reporting (it now contains column).
1197 Largely modified to use LocatedToken instead of
1198 string (IDENTIFIER), and to acquire Location from some tokens.
1199 * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs,
1200 iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs,
1202 Now MemberName holds Location. DeclSpace.ctor() receives Location
1203 as a parameter. Removed extra parameters to all derived classes.
1204 Replaced Location.IsNull() with instance property.
1205 * assign.cs, expression.cs :
1206 Added .ctor() overload that omits Location.
1208 Added "nameEscaped" flag that indicates the identifier was escaped
1209 in the source file. This fixes bug #57047.
1211 2005-08-02 Marek Safar <marek.safar@seznam.cz>
1213 * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType):
1214 New method, looking for lo-case imported cls type.
1216 * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types
1219 * driver.cs: Removed VerifyTopLevelNameClsCompliance usage.
1221 * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types.
1223 * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from
1225 (TypeManager.LoadAllImportedTypes): Lo-case imported types.
1227 Optimized to save 3.5 MB for SWF compilation.
1229 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1231 * class.cs (AddToTypeContainer): Use inheritance insted of if(s).
1232 (PartialContainer.Create): Moved logic AddToContainer.
1233 (PartialContainer.MarkForDuplicationCheck): Shares name.
1235 * decl.cs (DeclSpace.AddToContainer): Check name collisions at one
1238 * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces
1240 (Namespace.GetSignatureForError): New method.
1242 * tree.cs (Tree.RecordDecl): Moved to AddToContainer.
1243 (RootTypes.AddToTypeContainer): se inheritance insted of if(s).
1245 2005-08-01 Raja R Harinath <rharinath@novell.com>
1248 * ecore.cs (Expression.MemberLookupFailed): Use queried_type for
1249 member lookup rather than qualifier_type, since qualifier_type can
1252 2005-08-01 Marek Safar <marek.safar@seznam.cz>
1254 * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant
1257 2005-07-31 Miguel de Icaza <miguel@novell.com>
1259 * statement.cs: Copy the local exception into the exception
1260 captured local. Fixes 75674
1262 2005-07-31 Raja R Harinath <harinath@gmail.com>
1265 * expression.cs (Invocation.OverloadResolve): Don't report error
1266 CS1501 if error CS1502 has been reported.
1267 (New.DoResolve): Delegate CS1501 reporting to
1268 Invocation.OverloadResolve.
1271 * statement.cs (Block.CheckInvariantMeaningInBlock): Verify
1272 invariant-meaning-in-block property in an enclosing block if
1275 2005-07-29 Marek Safar <marek.safar@seznam.cz>
1277 * statement.cs (SwitchLabel.ResolveAndReduce): Refactored.
1278 (SwitchLabel.Erorr_AlreadyOccurs): Share error message.
1279 (Switch.CheckSwitch): Just save 50kb for SWF.
1281 2005-07-27 Martin Baulig <martin@ximian.com>
1283 * anonymous.cs (CaptureContext.AddField): Added
1284 `AnonymousContainer am' argument; compute its toplevel scope if
1285 it's not already computed. Fixes #75649.
1287 2005-07-26 Raja R Harinath <rharinath@novell.com>
1290 * class.cs (Constructor.Emit): Reset block to null if the block
1293 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1295 * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
1297 2005-07-25 Marek Safar <marek.safar@seznam.cz>
1299 * class.cs (MethodData.Define): Check whether accessor implementing
1300 interface is public.
1302 * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
1304 2005-07-22 Marek Safar <marek.safar@seznam.cz>
1307 * namespace.cs (LookupType): Moved same type check to...
1309 * typemanager.cs (LookupTypeReflection): Don't allow to import more types
1312 2005-07-21 Raja R Harinath <rharinath@novell.com>
1314 * namespace.cs (NamespaceLookupType): Avoid a string allocation when we
1315 already found a typebuilder.
1316 * class.cs (MethodCore.IsDuplicateImplementation): Compare
1317 MemberNames, not strings.
1319 * const.cs (Error_ExpressionMustBeConst):
1320 Rename from Error_EpressionMustBeConst.
1321 * const.cs, class.cs, statement.cd: Update.
1323 2005-07-21 Marek Safar <marek.safar@seznam.cz>
1327 * const.cs (Const.LookupConstantValue): Report missing contant expression
1329 (Error_EpressionMustBeConstant): Only one error method.
1331 * class.cs, statement.c: Updated.
1333 2005-07-20 Raja R Harinath <rharinath@novell.com>
1335 * statement.cs (Block.Flags): Add back HasVarargs.
1336 (Block.flags): Make protected.
1337 (ToplevelBlock.HasVarargs): Convert to a property that updates flags.
1339 * typemanager.cs (types, typecontainers, user_types): Remove.
1340 (UserTypes, TypeContainers): Likewise.
1341 (HandleDuplicate, AddDelegateType, AddEnumType): Likewise.
1342 (CleanUp, Reset): Update.
1343 (AddUserType): Combine variants. Now, only updates builder_to_declspace.
1344 (GetNestedType): Use Type.GetNestedType.
1345 (CoreLookupType): Take two arguments, the namespace and the
1346 basename of the type. Update to use the Namespace.Lookup
1348 (InitEnumUnderlyingTypes, InitCoreTypes): Update.
1349 (RealMemberLookup): Use IsNestedChildOf instead of playing with
1350 string concatenation and substring matches.
1351 * class.cs, enum.cs, delegate.cs: Update to changes.
1353 2005-07-20 Marek Safar <marek.safar@seznam.cz>
1355 * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from
1356 Expression and made virtual.
1358 * convert.cs (ImplicitReferenceConversionExists): Skip for value types.
1359 (ImplicitStandardConversionExists): Fixed `byte' typo ?
1361 * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved.
1363 * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize
1366 * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted
1369 2005-07-18 Marek Safar <marek.safar@seznam.cz>
1372 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether
1373 AssemblyCultureAttribute is not used on executable.
1376 * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute.
1378 2005-07-16 Raja R Harinath <rharinath@novell.com>
1381 * expression.cs (Binary.Warning_UnintendeReferenceComparison):
1382 New. Reports CS0252/CS0253.
1383 Mostly taken from preliminary patch by Duncak Mak.
1384 (Binary.DoResolveOperator): Store results of operator lookup.
1385 Use them to detect if we need to warn about unintended reference
1388 2005-07-15 Raja R Harinath <rharinath@novell.com>
1391 * namespace.cs (Namespace.Lookup): Add back location parameter.
1392 (Namespace.LookupType): Add CS0436 report. Add location parameter.
1393 * delegate.cs, ecore.cs, expression.cs: Update to changes.
1395 * codegen.cs (EmitContext.DeclSpace): Make readonly.
1396 * namespace.cs (Namespace.Lookup): Carve out type lookup into ...
1397 (Namespace.LookupType): ... this.
1398 (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array
1400 * typemanager.cs (LookupTypeReflection): Remove buggy code that
1401 purported to handle pointers.
1402 (char_ptr_type, void_ptr_type): Use GetPointerType rather than
1405 2005-07-15 Marek Safar <marek.safar@seznam.cz>
1407 * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested
1410 2005-07-15 Raja R Harinath <rharinath@novell.com>
1412 * namespace.cs (Namespace.Lookup): Drop location parameter.
1413 (NamespaceEntry.LookupAlias): Remove. Merge into ...
1414 (NamespaceEntry.Lookup): ... this.
1415 (NamespaceEntry.Error_AmbiguousTypeReference):
1416 Move here from DeclSpace.
1417 (NamespaceEntry.LookupNamespaceOrType): Move support for dotted
1419 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here.
1420 * decl.cs (DeclSpace.ErrorAmbiguousTypeReference):
1421 Move to NamespaceEntry.
1422 * delegate.cs, expression.cs: Update to changes.
1424 2005-07-14 Marek Safar <marek.safar@seznam.cz>
1426 * attribute.cs (Attribute.ResolveAttributeType): Renamed from
1427 CheckAttributeType and refactored.
1428 (Attribute.ResolvePossibleAttributeType): Changed to reuse
1429 ResolveAsTypeTerminal error handling.
1430 (ResolveAsTypeTerminal): Introduced because of global attributes extra
1432 (GetSignatureForError): Print errors in same way.
1435 * codegen.cs: Reflect attribute GetSignatureForError change.
1438 * expression.cs: Add silent parameter to ResolveAsTypeStep.
1440 * namespace.cs (UsingEntry): Refactored to make fields private.
1443 statement.cs: Error_UnexpectedKind has extra parameter.
1445 2005-07-14 Raja R Harinath <rharinath@novell.com>
1447 * ecore.cs (IAlias): Remove.
1448 * decl.cs (DeclSpace): Don't derive from IAlias. Remove members
1449 that implement the interface.
1450 * namespace.cs (Namespace): Likewise.
1451 (Namespace.declspaces): Renamed from 'defined_names'.
1452 (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a
1453 DeclSpace instead of an IAlias.
1454 * tree.cs (Tree.AddDecl): Update.
1456 2005-07-12 Raja R Harinath <rharinath@novell.com>
1458 * statement.cs (Block.Flags); Remove HasVarargs.
1459 (Block.HasVarargs): Move to ToplevelBlock.
1460 (Block.ThisVariable, Block.AddThisVariable): Likewise.
1461 (Block.Variables): Make protected. Initialize variable hashtable
1463 (Block.AddVariable): Update.
1464 (Block.Resolve): Update to changes.
1465 (ToplevelBlock.HasVarargs): New boolean.
1466 (ToplevelBlock.ThisVariable): Move here from Block.
1467 (ToplevelBlock.AddThisVariable): Likewise.
1468 (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable.
1469 * expression.cs (This.ResolveBase): Update to changes.
1470 (ArglistAccess.DoResolve): Likewise.
1472 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1475 * ecore.cs, class.cs: Use SetAssigned instead of direct access.
1477 * class.cs (TypeContainer.VerifyMembers): Distinguish between
1478 not used and not used & assigned.
1479 (FieldBase.ASSIGNED): Moved to MemberCore.Flags.
1481 2005-07-11 Marek Safar <marek.safar@seznam.cz>
1484 * expression.cs (Is.DoResolve): null is never provided type.
1486 2005-07-08 Marek Safar <marek.safar@seznam.cz>
1489 * cs-parser.jay: Less strict event error rule to catch more errors.
1491 2005-07-08 Martin Baulig <martin@ximian.com>
1493 Fix test-iter-10.cs - distinguish whether we `yield' in a property
1494 gettter (allowed) or setter (not allowed).
1496 * class.cs (Accessor): Implement IIteratorContainer.
1497 (Accessor.Yields): New public field.
1498 (PropertyBase.PropertyMethod.Define): Handle iterators on a
1502 (get_accessor_declaration, set_accessor_declaration): Set the
1503 `yields' flag on the accessor, not the property.
1504 (property_declaration): Do the iterators check on a per-accessor
1505 basis and not for the whole property.
1507 2005-07-08 Martin Baulig <martin@ximian.com>
1509 * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly
1510 handle parameters in nested scopes; fixes #74808; see gtest-188.cs.
1512 2005-07-07 Marek Safar <marek.safar@seznam.cz>
1515 * attribute.cs (orig_sec_assembly): Holds original version of assembly.
1516 (ExtractSecurityPermissionSet): Cope with self referencing security
1517 attributes properly.
1519 * driver.cs (SetOutputFile): Made public property OutputFile.
1521 2005-07-07 Raja R Harinath <rharinath@novell.com>
1524 * class.cs (TypeContainer.first_nonstatic_field): Rename from
1525 has_nonstatic_fields. Make into a FieldBase pointer.
1526 (TypeContainer.AddField): Add CS0282 check.
1527 (TypeContainer.EmitType): Update.
1529 2005-07-06 Miguel de Icaza <miguel@novell.com>
1531 * cs-tokenizer.cs (consume_identifier): Do not create strings to
1532 compare if they start with __.
1534 2005-07-06 Raja R Harinath <rharinath@novell.com>
1536 * statement.cs (Switch.SwitchGoverningType): Only look at
1537 UserCasts that don't need implicit standard conversions to one of
1538 the allowed switch types (Fixes test-322.cs).
1539 (LocalInfo.Resolve): Re-enable sanity-test.
1541 2005-07-06 Marek Safar <marek.safar@seznam.cz>
1543 * cs-tokenizer.cs (consume_identifier): Detect double undescores
1545 * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning.
1547 * expression.cs (Invocation.DoResolve): Report error CS0245 here.
1549 2005-07-06 Raja R Harinath <rharinath@novell.com>
1552 * ecore.cs (SimpleName.GetSignatureForError): Add.
1553 * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
1554 (MemberAccess.GetSignatureForError): Add.
1556 2005-07-05 Marek Safar <marek.safar@seznam.cz>
1558 The big error and warning messages review.
1588 * typemanager.cs: Updated.
1590 * class.cs: (MethodCore.SetYields): Moved here to share.
1591 (PropertyMethod.Define): Moved iterator setup here.
1593 * iterators.cs: Add orig_method to have full access to parent
1596 2005-07-05 Raja R Harinath <rharinath@novell.com>
1598 Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
1599 * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
1600 (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
1601 variable of struct type.
1602 * expression.cs (Unary.ResolveOperator): Update to change.
1603 (Indirection.VerifyFixed): Likewise.
1604 (LocalVariableReference.VerifyFixed): A local variable is always fixed.
1605 (ParameterReference.VerifyFixed): Value parameters are fixed.
1606 (This.VerifyFixed): Treat 'this' as a value parameter.
1607 * statement.cs (LocalInfo.IsFixed): Remove.
1609 2005-07-01 Martin Baulig <martin@ximian.com>
1611 * iterators.cs (Iterator.CapturedThisReference.Emit): Use
1612 `ec.EmitThis ()' to get the correct scope.
1614 2005-07-01 Martin Baulig <martin@ximian.com>
1616 * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
1617 instance is a ParameterReference; fixes #75299.
1619 2005-07-01 Martin Baulig <martin@ximian.com>
1621 Reverted Marek's latest patch (r46725):
1622 - it contains structural changes which are neither mentioned in
1623 the ChangeLog nor explained anywhere; for example the additional
1624 argument of EmitContext's and Iterator's .ctor's and the
1625 TypeContainer.DefineMembers() change.
1626 - structural changes like this should go in in seperate patches
1627 and not be hidden in a huge patch which just seems to affect
1628 warnings and errors.
1629 a big and hard to understand patch.
1630 - it breaks iterators and causes regressions, for instance in
1633 2005-06-30 Raja R Harinath <rharinath@novell.com>
1636 * expression.cs (Indexers.map): Remove.
1637 (Indexers.Append): Filter out inaccessible setters and getters.
1638 (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update.
1641 * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check.
1643 (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these.
1644 (FieldExpr.Emit, PropertyExpr.Emit): Update.
1645 (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update.
1646 * expression.cs (Invocation.EmitCall): Add CS0120 check.
1648 2005-06-30 Marek Safar <marek.safar@seznam.cz>
1651 * class.cs (FieldBase.GetInitializerExpression): One more field
1654 2005-06-28 Miguel de Icaza <miguel@novell.com>
1656 * pending.cs: Do not define a proxy if the base method is virtual,
1657 it will be picked up by the runtime (bug 75270).
1659 2005-06-08 Martin Baulig <martin@ximian.com>
1661 The big Iterators rewrite :-)
1663 * iterators.cs: Rewrite this to use the anonymous methods framework.
1665 * rootcontext.cs (RootContext.DefineTypes): Define Delegates
1666 before the TypeContainers; see 2test-21.cs.
1669 (TypeContainer.DefineType): Don't create a new EmitContext if we
1670 already have one (this only happens if we're an Iterator).
1671 (TypeContainer.Define): Also call Define() on all our iterators.
1672 (Method.CreateEmitContext): Added support for iterators.
1675 (AnonymousContainer): New abstract base class for `AnonymousMethod'.
1676 (AnonymousContainer.CreateMethodHost): Moved here from
1677 AnonymousMethod and made abstract.
1678 (AnonymousContainer.CreateScopeType): New abstract method.
1679 (AnonymousContainer.IsIterator): New public property.
1680 (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to
1681 get the ScopeTypeBuilder rather than manually defining it here.
1682 (ScopeInfo.EmitScopeInstance): New public method; correctly handle
1685 * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers()
1686 before RootContext.DefineTypes().
1688 * codegen.cs (EmitContext.RemapToProxy): Removed.
1689 (EmitContext.CurrentAnonymousMethod): Changed type from
1690 AnonymousMethod -> AnonymousContainer.
1691 (EmitContext.ResolveTopBlock): Protect from being called twice.
1692 (EmitContext.MapVariable, RemapParameter(LValue)): Removed.
1693 (EmitContext.EmitThis): Removed the iterators hacks; use the
1694 anonymous methods framework for that.
1697 (ToplevelBlock.Container): Make this a property, not a field.
1698 (ToplevelBlock.ReParent): New public method; move the
1699 ToplevelBlock into a new container.
1700 (Foreach.TemporaryVariable): Simplify.
1702 2005-06-05 Martin Baulig <martin@ximian.com>
1704 * statement.cs (LocalInfo.CompilerGenerated): New flag.
1705 (Block.AddTemporaryVariable): New public method; creates a new
1706 `LocalInfo' for a temporary variable.
1707 (Block.EmitMeta): Create the LocalBuilders for all the temporary
1709 (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for
1710 non-iterator variables.
1712 2005-06-05 Martin Baulig <martin@ximian.com>
1714 * statement.cs (Foreach.TemporaryVariable): Create the
1715 LocalBuilder in the Emit phase and not in Resolve since in some
1716 situations, we don't have an ILGenerator during Resolve; see
1717 2test-19.cs for an example.
1719 2005-06-04 Martin Baulig <martin@ximian.com>
1721 **** Merged r45395 from GCS ****
1723 The big Foreach rewrite - Part II.
1725 * typemanager.cs (TypeManager.object_getcurrent_void): Replaced
1726 with `PropertyInfo ienumerator_getcurrent'.
1728 * codegen.cs (VariableStorage): Removed.
1731 (Foreach): Derive from Statement, not ExceptionStatement.
1732 (Foreach.CollectionForeach): New nested class. Moved all the code
1733 dealing with collection foreach here.
1734 (Foreach.ForeachHelperMethods): Removed.
1735 (Foreach.TemporaryVariable): Implement IMemoryLocation.
1737 2005-05-23 Martin Baulig <martin@ximian.com>
1739 * statement.cs (Try.DoResolve): Don't create a `finally' if we
1740 don't need to. Fix #75014.
1742 2005-05-20 Martin Baulig <martin@ximian.com>
1744 Merged r44808 from GMCS.
1746 * class.cs (TypeContainer.CircularDepException): Removed.
1747 (TypeContainer.DefineType): Removed the `InTransit' stuff.
1748 (TypeContainer.CheckRecursiveDefinition): Check for circular class
1749 (CS0146) and interface (CS0529) dependencies here.
1751 2005-06-21 Raja R Harinath <rharinath@novell.com>
1753 * expression.cs (Invocation.EmitCall): Fix initialization
1754 'this_call' to reflect current behaviour. Fix indentation.
1756 * convert.cs (FindMostEncompassedType): Add two trivial special
1757 cases (number_of_types == 0 || number_of_types == 1).
1758 (FindMostEncompasingType): Likewise.
1760 2005-06-17 Raja R Harinath <rharinath@novell.com>
1762 Some cleanups preparing for the fix of #75283.
1763 * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for
1765 (EventExpr.InstanceResolve): Likewise.
1766 (EventExpr.DoResolve): Remove redundant checks.
1768 2005-06-10 Duncan Mak <duncan@novell.com>
1770 * cs-tokenizer.cs (process_directives): New flag for controlling
1771 the processing of preprocessor directives.
1772 (x_token): After seeing a '#', return Token.NONE instead of going
1773 to handle_preprocessing_directive() when not processing
1774 directives. This avoids unnecessary processing during the token peek in
1779 * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use
1780 the existing error reporting methods instead of Report.Error.
1782 * convert.cs (priv_fmt_expr): Remove. It's not needed anymore
1783 after Raja's rewrite.
1785 2005-06-08 Miguel de Icaza <miguel@novell.com>
1787 * class.cs: Small fix.
1789 2005-06-08 Raja R Harinath <rharinath@novell.com>
1792 * class.cs (GetPartialBases): Fix return value check of
1795 2005-06-07 Raja R Harinath <rharinath@novell.com>
1797 Ensure that partial classes are registered in their enclosing
1798 namespace. Initial part of fix of #75160.
1799 * tree.cs (Tree.RecordDecl): Add new namespace argument.
1800 Register declspace with namespace here, not in
1801 DeclSpace.RecordDecl.
1802 * cs-parser.jay: Pass namespace to RecordDecl.
1803 * class.cs (PartialContainer.Create): Likewise.
1804 (ClassPart.DefineType): New sanity-check. Throws an exception if
1806 * decl.cs (Declspace.RecordDecl): Remove.
1807 * namespace.cs (NamespaceEntry.DefineName): Remove.
1809 2005-06-06 Marek Safar <marek.safar@seznam.cz>
1811 * rootcontext.cs: Reset TargetExt as well.
1813 2005-06-03 Raja R Harinath <rharinath@novell.com>
1815 * ecore.cs (Expression.Resolve): Emit CS0654 error when
1818 2005-06-02 Raja R Harinath <rharinath@novell.com>
1820 Fix #75080, cs0119.cs.
1821 * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out
1823 (Expression.Resolve): ... this. Use it. Remove bogus code
1824 allowing ExprClass.Type and ExprClass.Namespace for
1825 ResolveFlags.VariableOrValue.
1826 (Expression.Resolve) [1-argument variant]: Change default resolve
1827 flags based on language version.
1828 (Expression.Error_UnexpectedKind): Use a simple string array
1829 rather than an ArrayList.
1830 * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value,
1832 (TypeOfVoid.DoResolve): Likewise.
1833 (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop
1834 flags argument -- it always has the same value.
1836 2005-05-31 Raja R Harinath <rharinath@novell.com>
1839 * ecore.cs (Expression.ResolveLValue): Add a Location parameter.
1840 Use it in the error message.
1841 * assign.cs, expression.cs, statement.cs: Update.
1843 2005-05-30 Raja R Harinath <rharinath@novell.com>
1846 * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in
1847 the "almostMatchedMember" case too.
1848 * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything
1849 that failed the accessibility checks to 'almost_match'.
1851 2005-05-27 Vladimir Vukicevic <vladimir@pobox.com>
1853 * attribute.cs: Use internal MethodBuilder methods to set
1854 ExactSpelling and SetLastError on PInvoke methods, instead
1855 of passing them via charset. Fixes #75060.
1857 2005-05-27 Raja R Harinath <rharinath@novell.com>
1859 * parameter.cs (Parameter): Remove TODO comment.
1860 (Parameter.DefineParameter): Remove Location parameter.
1861 (Parameters.LabelParameters): Likewise.
1862 * class.cs (Constructor.Emit): Update to change.
1863 (MethodData.Emit): Likewise.
1864 * anonymous.cs (AnonymousMethod.EmitMethod): Likewise.
1865 * delegate.cs (Delegate.Define, Delegate.Emit): Likewise.
1867 2005-05-27 Atsushi Enomoto <atsushi@ximian.com>
1870 Removed Parameters.Location and added Parameter.Location instead.
1871 Removed Location parameter from Emit() and GetSignature().
1878 Modified all related calls.
1880 2005-05-26 Raja R Harinath <rharinath@novell.com>
1882 Improve user-defined conversion handling.
1883 * convert.cs (GetConversionOperators): Rewrite. Return only the
1884 applicable operators.
1885 (AddConversionOperators): New. Helper for GetConversionOperators.
1886 (FindMostEncompassedType, FindMostEncompassingType): Verify that
1887 there is only one most encompassed/encompassing type.
1888 (FindMostSpecificSource, FindMostSpecificTarget): Remove
1889 "applicable operator" handling.
1890 (UserConversion): Move cache here from GetConversionOperators.
1891 Directly cache the chosen operator, rather than the whole
1893 (ExplicitNumericConversion): Fix buggy implementation of Decimal
1894 case. Allow conversion of decimal to sbyte and byte too.
1895 * expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
1896 New static methods. Used to avoid allocating EmptyExpressions in
1899 2005-05-24 Duncan Mak <duncan@novell.com>
1901 * ecore.cs (CastFromDecimal): New class for casting a decimal to
1902 another class, used in Convert.ExplicitNumericConversion.
1903 (CastToDecimal): New class, similar to above, but casts to
1904 System.Decimal, used in Convert.ImplicitNumericConversion and also
1905 in explicit convesion from double/float to decimal.
1907 * convert.cs (ImplicitNumericConversion): Handle implicit
1908 conversions to System.Decimal.
1909 (ExplicitNumericConversion): handle explicit conversions to
1914 2005-05-20 Miguel de Icaza <miguel@novell.com>
1916 * typemanager.cs (EnumToUnderlying): Do not throw if we do not
1917 know the type at this stage, just break through. Fixes #75008
1919 2005-05-19 Martin Baulig <martin@ximian.com>
1922 (ImplicitDelegateCreation.Check): Added `bool check_only' argument
1923 to disable error reporting.
1925 * convert.cs (Convert.ImplicitStandardConversionExists): Use it
1926 here since we don't want to report an error; see the new test-336.cs.
1928 2005-05-19 Raja R Harinath <rharinath@novell.com>
1930 * statement.cs (ToplevelBlock.GetParameterReference)
1931 (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter):
1932 Move here from class Block.
1933 * ecore.cs (SimpleName.SimpleNameResolve): Update to changes.
1934 * expression.cs (ParameterReference.DoResolveBase): Likewise.
1936 2005-05-18 Martin Baulig <martin@ximian.com>
1941 (FlowBranching.Reachability): Add non-static public And() and Or()
1943 (FlowBranchingSwitch): New class; do the `break_origins' thing
1944 like in FlowBranchingLoop.
1945 (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the
1946 reachability, not just locals and parameters.
1947 (FlowBranching.MergeChild): Remove some of the hacks for loop and
1948 switch; MergeBreakOrigins() now takes care of that.
1950 2005-05-18 Martin Baulig <martin@ximian.com>
1952 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1953 a loop and may leave it, reset the barrier; fixes #74974.
1955 2005-05-17 Marek Safar <marek.safar@seznam.cz>
1957 * attribute.cs (Attribute.ResolveArguments): GuidAttribute check
1960 * cs-parser.jay: Catch more lexical errors.
1962 * report.cs: Add one more Error method.
1965 * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute
1967 2005-05-17 Martin Baulig <martin@ximian.com>
1969 * expression.cs (Argument.Resolve): Turn on flow analysis; fix
1972 2005-05-16 Raja R Harinath <rharinath@novell.com>
1974 Fix test-382.cs. Emit values of decimal constants.
1975 * class.cs (TypeContainer.RegisterFieldForInitialization): New.
1977 (TypeContainer.AddField): ... this.
1978 (TypeContainer.EmitFieldInitializers): Allow the list of fields
1979 with initializers to include 'Const's.
1980 (ClassPart.RegisterFieldForInitialization): Forward to
1982 * const.cs (Const.Const): Pass initializer to base class.
1983 (Const.Define): In case of decimal constants, register them for
1984 initialization in a static constructor.
1986 2005-05-14 Martin Baulig <martin@ximian.com>
1988 * statement.cs (Block.Resolve): Correctly handle unreachable code;
1989 do not call ResolveUnreachable() on unreachable statements in
1990 here, see the comment in the source code.
1992 2005-05-13 Raja R Harinath <rharinath@novell.com>
1995 * expression.cs (BinaryResolveOperator): If one of the operands of
1996 an equality comparison is 'null' and the other is a pointer type,
1997 convert the null to a NullPointer.
1998 * convert.cs (ImplicitReferenceConversion): If the expression is a
1999 NullLiteral and the target type is a pointer type, return a
2000 NullPointer instead.
2001 (ImplicitConversionStandard): Likewise.
2003 2005-05-13 Marek Safar <marek.safar@seznam.cz>
2005 * cs-parser.jay: Set readonly context based on special constructs.
2007 * expression.cs (LocalVariableReference.DoResolveBase): Improved
2008 readonly variable error handling.
2010 * rootcontext.cs (EmitCode): Don't verify members when error
2013 * statement.cs (LocalInfo): Add reaodnly context information.
2014 (SetReadOnlyContext, GetReadOnlyContext): New methods.
2016 2005-05-13 Raja R Harinath <rharinath@novell.com>
2018 * statement.cs (Block.Resolve): Revert change below. Modify fix
2019 for #74041 to initialize 'resolved' to false only for explicit
2020 blocks. Fixes #74873.
2022 2005-05-12 Raja R Harinath <harinath@gmail.com>
2025 * typemanager.cs (unmanaged_enclosing_types): New.
2026 (IsUnmanagedType): Avoid infloops by using
2027 'unmanaged_enclosing_types' to talk with recursive invocations.
2029 2005-05-13 Martin Baulig <martin@ximian.com>
2031 * statement.cs (Block.Resolve): Make the `bool unresolved' flag an
2032 instance variable, not a local. Fix #74873.
2033 (Block.ResolveUnreachable): Set it to true here.
2035 2005-05-11 Duncan Mak <duncan@novell.com>
2037 * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
2038 continuing to process for 'arg'.
2039 (handle_preprocessing_directive): Check the argument of the #endif
2040 directive and report error CS1025 if there are any trailing
2043 According to the C# spec, having even whitespace after the #endif
2044 directive is illegal; however, because we call arg.TrimEnd ()
2045 beforehand, we have the same behavior as csc, allowing whitespace
2046 after the directive.
2050 2005-05-11 Marek Safar <marek.safar@seznam.cz>
2054 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
2055 (Constructor.GetObsoleteAttribute): Implemented correctly.
2057 2005-05-10 Martin Baulig <martin@ximian.com>
2059 * support.cs (ReflectionParameters.ParameterModifier): Use
2060 `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out'
2061 and `ParameterAttributes.In'. Fixes #74884.
2063 2005-05-10 Marek Safar <marek.safar@seznam.cz>
2065 * class.cs (Method.Define): Catch attempt for Finalizer declaration.
2067 * expression.cs (Argument.GetParameterModifier): Turned to property.
2068 (Invocation.Error_InvalidArguments): Add more descriptive errors.
2070 * parameter.cs (Parameter.GetModifierSignature): Translates modifier to
2073 2005-05-09 Raja R Harinath <rharinath@novell.com>
2076 * decl.cs (MemberCache.AddMethods): Register override methods,
2077 rather than non-override methods.
2078 * typemanager.cs (RegisterOverride): New.
2079 (IsOverride): Update.
2081 2005-05-09 Marek Safar <marek.safar@seznam.cz>
2085 * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch
2086 recursive declaration.
2088 * statement.cs (Block.ResolveMeta): Report any error in resolving.
2090 2005-05-06 Marek Safar <marek.safar@seznam.cz>
2092 * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum.
2094 * expression.cs (Binary.DoResolve): (x && 0) is always 0.
2096 2005-05-05 Raja R Harinath <rharinath@novell.com>
2099 * decl.cs (DeclSpace.FamilyAccessible):
2100 Use TypeManager.IsNestedFamilyAccessible.
2102 Fix reopened #64812.
2103 * typemanager.cs (Closure.Filter): Introduce checks for 'protected
2106 2005-05-04 Raja R Harinath <rharinath@novell.com>
2107 Abin Thomas <projectmonokochi@rediffmail.com>
2108 Anoob V E <projectmonokochi@rediffmail.com>
2109 Harilal P R <projectmonokochi@rediffmail.com>
2112 * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly
2113 allow access to all static members.
2115 2005-05-04 Martin Baulig <martin@ximian.com>
2117 * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned().
2119 2005-05-04 Martin Baulig <martin@ximian.com>
2123 * statement.cs (Switch.SimpleSwitchEmit): Always emit the default
2124 section at the end; make things work if `default' is not the last
2127 2005-05-04 Martin Baulig <martin@ximian.com>
2131 * statement.cs (Switch): Replaced the `got_default' field with a
2132 `default_section' one.
2133 (Switch.CheckSwitch): Set `default_section' here.
2134 (Switch.Resolve): If we're a constant switch and the constant is
2135 not found, use the default section.
2137 2005-05-03 Martin Baulig <martin@ximian.com>
2139 * expression.cs (ArrayAccess.EmitGetLength): New public method.
2141 * statement.cs (Foreach.ArrayForeach): New nested class.
2142 (Foreach.TemporaryVariable): New nested class.
2143 (Foreach.EmitArrayForeach): Removed; this is now in the new
2146 2005-05-03 Raja R Harinath <rharinath@novell.com>
2148 * pending.cs (BaseImplements): Move the #74773 fix here. This is
2150 (VerifyPendingMethods): Revert change below.
2152 * typemanager.cs (IsOverride, RegisterNonOverride): New.
2153 * decl.cs (MemberCache.AddMethod): Register "non-override" methods
2154 that used to trigger warning -28. Remove warning -28.
2155 * expression.cs (Invocation.OverloadResolve): Use
2156 TypeManager.IsOverride to distinguish override methods.
2159 * pending.cs (VerifyPendingMethods): If a base type implements the
2160 requested interface, don't bother checking individual methods of
2161 the base type. As a side-effect, this prevents the creation of
2162 unnecessary proxies.
2164 2005-05-02 Martin Baulig <martin@ximian.com>
2168 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2169 Also `And' the locals if the old vector is null.
2170 (FlowBranching.UsageVector.BitVector.And): Allow `vector' being
2171 null; in this case we basically reset all the variables.
2173 2005-05-02 Martin Baulig <martin@ximian.com>
2177 * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins):
2178 Added `FlowBranching branching' argument; always `and' the
2179 variables instead of `or'ing them unless we're an infinite loop.
2181 * statement.cs (While.Resolve): Create a new sibling unless we're
2184 2005-05-02 Martin Baulig <martin@ximian.com>
2188 * class.cs (ConstructorInitializer.Resolve): Added `Block block'
2189 arguments; use it instead of creating a new TopLevelBlock.
2190 (Constructor.Emit): Call `block.ResolveMeta ()' before resolving
2191 our ConstructorInitializer.
2194 (TopLevelBlock.TopLevelBranching): New public property.
2195 (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta()
2196 and create our `TopLevelBranching'.
2198 * codegen.cs (EmitContext.ResolveTopBlock): If we're not an
2199 anonymous method host, use `block.TopLevelBranching' rather than
2200 creating a new branching.
2202 2005-04-20 Miguel de Icaza <miguel@novell.com>
2204 * anonymous.cs (ScopeInfo.AddChild): when adding a new child to
2205 a ScopeInfo, if any of the current children is a child of the new
2206 entry, move those children there.
2208 2005-04-30 Martin Baulig <martin@ximian.com>
2210 * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end'
2211 at the beginning of a SwitchSection. Fix #73335.
2213 2005-04-27 Marek Safar <marek.safar@seznam.cz>
2216 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
2218 * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
2219 (FieldExpr.DoResolve): Obsolete members are ignored for field
2222 2005-04-26 Marek Safar <marek.safar@seznam.cz>
2224 * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array
2225 of arrays detection.
2227 * class.cs (Interface.VerifyClsCompliance): Add base interfaces
2229 (Field.VerifyClsCompliance): Volatile fields are not compliant.
2231 * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of
2234 2005-04-25 Ben Maurer <bmaurer@ximian.com>
2236 * cs-parser.jay: Use the prefered version of -unsafe in error
2239 2005-04-22 Marek Safar <marek.safar@seznam.cz>
2241 * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any
2244 2005-04-20 John Luke <john.luke@gmail.com>
2246 * driver.cs: fix typo in error message, --outout to --output
2248 2005-04-20 Marek Safar <marek.safar@seznam.cz>
2250 * codegen.cs (InRefOutArgumentResolving): New field.
2252 * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly
2253 fields outside contructor.
2255 * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving.
2257 2005-04-19 Miguel de Icaza <miguel@novell.com>
2259 * anonymous.cs (CaptureContext.EmitParameterInstance): The
2260 parameter code was not completed ever, so it was not as up-to-date
2261 as local variables. Must finish it.
2263 The bug fix was to compare the Toplevel of the block, not the
2264 current block. Thanks for Ben for pointing this out.
2266 2005-04-19 Raja R Harinath <rharinath@novell.com>
2268 * decl.cs (AddMethods): Use the declaring type of the problem
2269 method to determine if we want to squash a warning.
2271 2005-04-19 Marek Safar <marek.safar@seznam.cz>
2273 * attribute.cs: Removed debug output.
2275 * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring.
2277 * driver.cs (Driver.parse): Synchronize parser ErrorOutput with
2280 2005-04-18 Raja R Harinath <rharinath@novell.com>
2283 * expression.cs (Binary.EqualsNullIsReferenceEquals): New.
2284 (Binary.DoResolveOperator): Use it to avoid blindly optimizing out
2285 all null comparisons against reference types.
2287 2005-04-18 Marek Safar <marek.safar@seznam.cz>
2290 * class.cs (TypeContainer.CircularDepException) New nested
2292 (GetPartialBases, GetNormalBases, GetClassBases): Removed error.
2293 (TypeContainer.DefineType): Removed error, reset InTransit before
2295 (Class.DefineType): Throw exception when is in Transit.
2296 Catch exception and report error.
2297 (Struct.DefineType): Throw exception when is in Transit.
2298 Catch exception and report error.
2299 (Interface.DefineType): Throw exception when is in Transit.
2300 Catch exception and report error.
2302 * codegen.cs: Add InCatch,InFinally to EmitContext to easily
2303 handle nested exception handlers.
2305 * flowanalysis.cs (InTryWithCatch): New method, search for try with
2308 * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated
2309 InFinally and InCatch storage.
2311 * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec.
2312 (Catch.Resolve): Set and Restore ec.InCatch.
2313 (Try.Resolve): Set and Restore ec.InFinally.
2314 (Try.HasCatch): True when try has catch.
2316 2005-04-17 Atsushi Enomoto <atsushi@ximian.com>
2318 * doc.cs : In some cases FilterName returns MonoEvent and MonoField
2319 for the same event member, so exclude such cases from warning 419.
2322 2005-04-16 Miguel de Icaza <miguel@novell.com>
2324 * expression.cs (Binary.ResolveOperator): Apply patch from John
2325 Luke to fix bug 59864: operators &, | and ^ on enumerations
2326 require that the same enum type on both sides.
2328 * driver.cs: Add warnings to old flag usage, this is to assist
2329 people who produce Makefiles and hope that the Makefiles will be
2332 * class.cs (TypeContainer.EmitType): Moved the definition of the
2333 special $PRIVATE$ field from the resolve phase to the Emit phase.
2334 During resolve we do not know if we are a struct with
2335 HasExplicitLayout, we know this only after the attributes for the
2338 Set the FieldOffset to zero on the dummy field that we create for
2339 the class. Fixes 74590.
2341 2005-04-16 Raja R Harinath <rharinath@novell.com>
2344 * ecore.cs (PropertyExpr.resolved): New.
2345 (DoResolve): Use it to handle a case of double resolution here.
2346 Handle a case of identical-name-and-type-name.
2347 * expression.cs (ArrayCreation.CheckIndices): Avoid double
2348 resolution by storing the results of expression resolution back
2349 into the "probes" array.
2351 2005-04-15 Raja R Harinath <rharinath@novell.com>
2353 Fix cs0208-7.cs and cs0208-8.cs.
2354 * typemanager.cs (IsUnmanagedType): Arrays are not allowed
2355 (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
2356 error reporting to point out the reason a struct is not unmanaged.
2358 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2360 * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
2361 just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs.
2363 2005-04-13 Raja R Harinath <rharinath@novell.com>
2366 * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of
2367 IdenticalNameAndTypeName here.
2368 (EventExpr.InstanceResolve): Likewise.
2370 2005-04-13 Marek Safar <marek.safar@seznam.cz>
2372 C# 2.0 DefaultCharSetAttribute implementation
2374 * attribute.cs (Attribute.ResolveAsTypeStep): New protected method
2375 which allows us to set GlobalNamespace for every resolve.
2376 (Attribute.ResolveArguments): Cut from Resolve.
2377 (Attribute.GetCharSetValue): Returns CharSet named argument.
2378 (Attribute.DefinePInvokeMethod): Gets default charset from
2380 (GlobalAttribute.ResolveAsTypeStep): Override.
2381 (GlobalAttribute.ResolveArguments): Override.
2383 * class.cs (TypeAttr): Is protected.
2385 * codegen.cs (ModuleClass.DefaultCharSet): New member.
2386 (ModuleClass.DefaultCharSetType): New memeber.
2387 (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute.
2389 * decl.cs (Decl.TypeAttr): New protected virtual. Returns default
2390 charset from module.
2392 * delegate.cs (TypeAttr): Override.
2393 (Delegate.DefineType): Use this TypeAttr.
2395 * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes
2396 at very early stage (before types are defined) to resolve model
2397 module attributes. It will probably not work with corlib but it
2400 * enum.cs (Enum.TypeAttr): New protected virtual. Returns default
2401 charset from module.
2403 * typemanager.cs (default_charset_type): New type.
2405 2005-04-13 Raja R Harinath <rharinath@novell.com>
2407 * decl.cs (MemberCache.AddMethods): Don't warn if
2408 System.Object.Finalize has buggy MethodAttributes.
2410 * typemanager.cs (IsUnmanagedType): Restore !IsValueType check
2413 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2415 * doc.cs : detect ambiguous reference to overloaded members.
2416 Fixed bug #71603. MS 1.1 csc does not detect it.
2418 2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
2420 * doc.cs : delegates must not be referenced with parameters.
2423 2005-04-12 Miguel de Icaza <miguel@novell.com>
2425 * typemanager.cs (IsUnmanagedType): Arrays are allowed.
2427 2005-04-10 Miguel de Icaza <miguel@novell.com>
2429 * driver.cs (MainDriver): Stop processing if the CLS stage found
2432 (CompilerCallableEntryPoint.InvokeCompiler): Always
2433 reset after execution; Take a TextWriter argument for the
2436 * report.cs: Use the error stream instead of hardcoding stderr.
2438 2005-04-09 Miguel de Icaza <miguel@novell.com>
2440 * class.cs: Reduce code paths to test, too small of an
2441 optimization to make it worth the extra testing. Always perform
2444 2005-04-08 Raja R Harinath <rharinath@novell.com>
2447 * class.cs (OperatorArrayList.CheckPairedOperators): Skip
2448 operators that had errors reported on them.
2450 2005-04-08 Marek Safar <marek.safar@seznam.cz>
2452 * attribute.cs (Attribute.IsValidArgumentType): Test valid named
2454 (Attribute.Resolve): Add named argument type checking.
2456 * class.cs (FixedField.Define): Use IsPrimitiveType
2458 * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming.
2460 * iterators.cs (Iterator.DefineIterator): Add check for arglist and
2461 unsafe parameter types.
2463 * statement.cs (Using.ResolveExpression): Add better error description.
2465 * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType.
2467 2005-04-08 Raja R Harinath <rharinath@novell.com>
2470 * attribute.cs (Attribute.GetAttributeUsage): Resolve
2471 AttributeUsageAttribute in the emitcontext of the attribute class,
2472 not in the emitcontext of the attributable entity it was attached to.
2473 * cs-parser.jay: Use 'current_class', not 'current_container',
2474 when creating a GlobalAttribute.
2476 2005-04-08 Alp Toker <alp@atoker.com>
2478 * pending.cs: The fix to #58413 failed to compile methods implementing
2479 interfaces with/without params modifiers and vice versa, even though
2480 params modifiers aren't part of the signature. Make the modifier check
2481 less strict as in csc.
2483 2005-04-07 Abin Thomas <projectmonokochi@rediffmail.com>
2484 Anoob V E <projectmonokochi@rediffmail.com>
2485 Harilal P R <projectmonokochi@rediffmail.com>
2488 * pending.cs (TypeAndMethods.mods): New. Store the parameter
2489 modifiers of pending methods.
2490 (PendingImplementation.PendingImplementation): Initialize it.
2491 Add Parameter.Modifier [][] mods and initialize it with ParameterData.
2492 (PendingImplementation.InterFaceMethod): Repalce Type[] argument
2493 with ParameterData. Add check for modifiers.
2494 * class.cs (MethodData.Define): Update to changes.
2496 2005-04-07 Raja R Harinath <rharinath@novell.com>
2498 * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
2500 2005-04-07 Marek Safar <marek.safar@seznam.cz>
2502 * class.cs (PropertyMethod.Define): Check private accessor in abstract
2505 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute
2508 * typemanager.cs: Registered RequiredAttributeAttribute.
2510 2005-04-06 Marek Safar <marek.safar@seznam.cz>
2512 * class.cs (VerifyMembers): Doesn't need EmitContext argument.
2513 Warning CS0169 is back at level 3.
2514 (IMethodData.SetMemberIsUsed): New method.
2516 * decl.cs (IsUsed): New value; moved from FieldBase.Status
2517 (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed.
2519 * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed.
2521 * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for
2523 (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate
2526 * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method
2529 * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run
2530 to avoid the problems with nested types.
2532 2005-04-05 Abin Thomas <projectmonokochi@rediffmail.com>
2533 Anoob V.E <projectmonokochi@rediffmail.com>
2534 Harilal P.R <projectmonokochi@rediffmail.com>
2535 Raja R Harinath <rharinath@novell.com>
2538 * delegate.cs (Define): Emit ParamArrayAttribute for 'params'
2540 * typemanager (GetConstructor): Make public.
2542 2005-04-05 John Luke <john.luke@gmail.com>
2543 Raja R Harinath <rharinath@novell.com>
2546 * typemanager.cs (IsUnmanagedType): Check non-public fields of a
2547 struct too. Return false quicker in a few cases.
2548 (VerifyUnManaged): Use it.
2550 2005-04-05 Raja R Harinath <rharinath@novell.com>
2553 * statement.cs (Block.Resolve): Initialize 'unreachable' to false,
2554 not 'unreachable_seen'.
2556 2005-04-04 Marek Safar <marek.safar@seznam.cz>
2558 * attribute.cs (Attribute.GetValue): Removed unused.
2560 * codegen.cs (CodeGen.TrimExt): Removed unused.
2562 * cs-parser.jay (output): Removed unused.
2564 * cs-tokenizer.cs (hex_digits): Removed unused.
2566 * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused.
2568 * expression.cs (Indirection.LoadExprValue): Removed unused.
2569 (ArrayCreation.ExpressionToArrayArgument): Removed unused.
2571 * iterators.cs (Iterator.param_types): Removed unused.
2573 * statement.cs (Goto.block): Removed unused.
2574 (ToplevelBlock.did): Removed unused.
2575 (Switch.ResolveConstantSwitch): Removed unused.
2577 2005-04-01 Ben Maurer <bmaurer@ximian.com>
2579 * rootcontext.cs: Allow mcs to bootstrap with the compilation
2582 2005-04-01 Raja R Harinath <rharinath@novell.com>
2584 Fix #74232 and cs0208-3.cs.
2585 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check.
2586 * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an
2587 unmanaged type. Don't use FieldBuilders when 't' is a
2588 TypeBuilder. Use ModFlags and MemberType fields.
2589 * class.cs (MemberBase.member_type): Rename from MemberType.
2590 (MemberBase.MemberType): New property. Determines member_type on
2592 (MemberBase.DoDefine): Don't initialize MemberType here.
2593 (FieldMember.Define): Likewise.
2595 2005-04-01 Marek Safar <marek.safar@seznam.cz>
2598 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces.
2599 Attributes are emitted there.
2601 2005-04-01 Raja R Harinath <rharinath@novell.com>
2603 * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
2604 keyword in 'partial enum' too.
2605 * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
2607 Report from Kamil Skalski <nazgul@omega.pl>.
2610 * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
2611 have partial containers too.
2613 * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
2614 in block' checks to Block.CheckInvariantMeaningInBlock.
2615 * statement.cs (Block.GetKnownVariableInfo): Make private.
2616 (Block.IsVariableUsedInChildBlock): Remove.
2617 (Block.IsVariableUsedInBlock): Likewise.
2618 (Block.CheckInvariantMeaningInBlock): New. Show location of
2619 conflicting declaration.
2620 (Block.AddVariable): Make error messages less long-winded and more
2621 specific. Show location of conflicting declaration.
2622 * parameter.cs (Parameters.Location): New readonly property.
2624 2005-03-31 Raja R Harinath <rharinath@novell.com>
2626 Clean up semantics of invoking ResolveMemberAccess.
2627 * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression
2628 can have an instance, ensure that we pass in a non-TypeExpression
2629 to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks.
2630 (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred
2631 argument. Update to changes and simplify.
2632 (FieldExpr.Emitinstance): Remove CS0120 check.
2633 (PropertyExpr.EmitInstance): Likewise.
2634 * expression.cs (Argument.Resolve): Likewise.
2635 (Invocation.DoResolve): Update to changes in semantics of
2638 2005-03-31 Marek Safar <marek.safar@seznam.cz>
2641 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method
2644 * decl.cs (MemberCache.AddMethods): Fix infinite loop.
2646 2005-03-31 Raja R Harinath <rharinath@novell.com>
2648 Fix difference in behaviour with commandline invocation.
2649 * driver.cs (Driver.Reset): New.
2650 (CompilerCallableEntryPoint): Call it.
2652 * statement.cs (If.Resolve): Avoid spurious "uninitialized
2653 variable" warnings if the boolean expression failed to resolve.
2655 2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
2657 * attribute.cs: Fix the union of several permissions when some of them
2658 are unrestricted (so the result isn't an unrestricted permission set).
2661 2005-03-30 Raja R Harinath <rharinath@novell.com>
2663 * ecore.cs (MemberExpr): New class. Convert from interface
2665 (MemberExpr.ResolveMemberAccess): Refactor and move here from
2666 MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and
2668 (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update.
2669 (MethodGroupExpr.IsExplicitImpl): Remove.
2670 (Expression.GetFieldFromEvent): Remove.
2671 (SimpleName.MemberStaticCheck): Remove.
2672 (SimpleName.DoSimpleNameResolve): Update to changes.
2673 * expression.cs (MemberAccess.ResolveMemberAccess): Refactor.
2674 (MemberAccess.IdenticalNameAndTypeName): Remove.
2675 (MemberAccess.error176): Move to MemberExpr.
2676 (MemberAccess.DoResolve): Update to changes.
2677 (BaseAccess.DoResolve): Likewise.
2679 2005-03-30 Marek Safar <marek.safar@seznam.cz>
2681 C# 2.0 Conditional attribute class implementation
2683 * attribute.cs (AttributeTester.IsAttributeExcluded): New method.
2684 Analyzes class whether it has attribute which has ConditionalAttribute
2685 and its condition is not defined.
2687 * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check.
2688 (Class.IsExcluded): New method. Search for at least one defined
2689 condition in ConditionalAttribute of attribute class.
2691 2005-03-30 Raja R Harinath <rharinath@novell.com>
2693 * ecore.cs (PropertyExpr): Derive from Expression, not
2694 ExpressionStatement.
2695 (PropertyExpr.EmitStatement): Remove.
2697 2005-03-29 Raja R Harinath <rharinath@novell.com>
2700 * expression.cs (MemberAccess.ResolveMemberAccess): Allow the
2701 internal field "value__" of an enum be private. The examples for
2702 "value__" that I found on MSDN all used FieldAttributes.Private.
2704 * decl.cs (MemberCache.AddMethods): Use C# terminology in warning.
2705 Don't mention IL method attribute names.
2707 Fix #47991. Remove a TODO.
2708 * statement.cs (Block.Toplevel): Make into a field.
2709 (Block.Parameters): Move into ToplevelBlock.
2710 (Block.known_variables): Rename from child_variable_names.
2711 (Block.Block): Remove variants that take Parameters. Initialize
2712 'Toplevel' with the immediately surrounding toplevel block.
2713 (Block.AddKnownVariable): Rename from AddChildVariableName. Add a
2714 LocalInfo parameter.
2715 (Block.GetKnownVariableInfo): New.
2716 (Block.IsVariableNameUsedInChildBlock): Update.
2717 (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in
2718 the block, even though it may not be in scope.
2719 (Block.AddVariable): Remove Parameters parameter. Use
2720 Toplevel.Parameters instead.
2721 (Block.AddConstant): Remove Parameters parameter.
2722 (Block.GetParameterReference): Update to use Toplevel.Parameters.
2723 (Block.IsParamaterReference): Likewise.
2724 (Block.IsLocalParameter): Likewise. Simplify a lot.
2725 (ToplevelBlock.Parameters): New. Moved from Block.
2726 (ToplevelBlock.ToplevelBlock): Update to changes. Always
2727 initialize Parameters to a non-null value.
2728 * cs-parser.jay: Update to changes.
2729 * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for
2730 simple names that mean different things in the same block. Use
2731 Block.IsVariableNameUsedInBlock.
2733 2005-03-28 Raja R Harinath <rharinath@novell.com>
2735 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
2736 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
2737 GetTypeHandle. It is possible for a reflected type to derive from
2738 a TypeBuilder (e.g., int[] derives from the TypeBuilder
2739 System.Array during mscorlib compilation).
2740 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
2741 contain a method_hash, don't create one either. Don't create a
2742 deep copy of the base cache's method_hash.
2743 (MemberCache.SetupCache): Rename back from DeepCopy.
2744 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
2745 already initialized. If we see an override function, add its
2746 underlying base virtual function to the member_hash too.
2748 * enum.cs (Enum.LookupEnumValue): Remove debugging code.
2750 2005-03-26 Raja R Harinath <harinath@acm.org>
2753 * assign.cs (Assign.DoResolve): When the RHS of an assignment
2754 fails to resolve, ensure that the LHS is still resolved as an
2757 2005-03-25 Raja R Harinath <harinath@acm.org>
2759 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
2761 (Enum.current_ec): Remove.
2762 (Enum.LookupEnumValue): Remove EmitContext argument.
2763 Just uses the one created during DefineType.
2764 (Enum.FindMembers): Update.
2765 * expression.cs (MemberAccess.DoResolve): Update.
2767 2005-03-22 Marek Safar <marek.safar@seznam.cz>
2769 * assign.cs (Assign.DoResolve): Check for CS1717 when
2770 source and target are same (uses Equals).
2772 * expression.cs (LocalVariableReference, ParameterReference,
2773 This): Implemented Equals, GetHashCode.
2775 * statement.cs (Block.GetParameterReference): Removed useless
2778 2005-03-22 Raja R Harinath <rharinath@novell.com>
2781 * statement.cs (Block.AddVariable): Ensure that we skip implicit
2782 blocks before deciding whether the error is cs0136 or cs0128.
2784 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
2785 (using_alias_directive, using_namespace_directive): Pass
2786 MemberName, not an expression to Namespace.UsingAlias and
2788 (MakeName): Use the MemberName of the namespace.
2789 * namespace.cs (Namespace.MemberName): New.
2790 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
2791 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
2793 * decl.cs (MemberName.Name): Make readonly.
2794 (MemberName.FromDotted): New "constructor".
2795 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
2796 (MemberCore.Name): Compute from MemberName on demand.
2797 (MemberCore.SetMemberName): Provide a way to change the
2799 (MemberCore.AddToContainer): Don't take a fullname parameter.
2800 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
2801 fully qualified name of the container to the member name.
2802 (TypeContainer.AddToTypeContainer): Use a fully qualified name
2803 only if the type is a member of the root container.
2804 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
2805 MemberName.Left rather than searching for an embedded ".".
2806 (PartialContainer.CreatePart): Update to changes in RootContext.
2807 (MemberBase.ShortName): Turn into a property. Use
2808 MemberCore.SetMemberName.
2809 (MemberBase.ExplicitInterfaceName): Remove.
2810 (MemberBase.UpdateMemberName): Remove.
2811 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
2812 (PropertyBase.SetMemberName): New override.
2813 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
2814 (Tree.GetDecl): New.
2815 (Tree.AllDecls): Rename from Decls.
2816 * attribute.cs, enum.cs, report.cs: Update to changes.
2817 * driver.cs (MainDriver): Use MemberName.FromDotted on
2818 RootContext.MainClass.
2820 2005-03-21 Marek Safar <marek.safar@seznam.cz>
2822 * class.cs (FixedField.Define): Check for CS1664 and more sanity
2825 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
2827 2005-03-18 Marek Safar <marek.safar@seznam.cz>
2829 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
2830 property accessor modifiers.
2832 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
2833 fixed buffer attribute (CS1716).
2834 (PropertyMethod.HasCustomAccessModifier): When property accessor
2835 has custom modifier.
2837 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
2839 (PropertyExpr.DoResolveLValue): Add CS0272.
2841 2005-03-17 Miguel de Icaza <miguel@novell.com>
2843 * convert.cs: When converting to a pointer, use the proper Conv.U
2844 or Conv.I depending on the source data type.
2846 * cs-tokenizer.cs: Make the size for large decimal constants,
2849 2005-03-17 Martin Baulig <martin@ximian.com>
2851 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
2852 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
2854 2005-03-17 Martin Baulig <martin@ximian.com>
2856 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
2857 to bool so we can return an error condition.
2858 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
2861 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
2863 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
2866 2005-03-16 Raja R Harinath <rharinath@novell.com>
2868 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
2869 Refactor to avoid traversing the list of assemblies, and to avoid
2870 string concatenation.
2871 * typemanager.cs (guid_attr_type): Remove.
2872 (negative_hits, pointers, references): Remove hashes.
2874 (GetConstructedType): New. Uses type_hash to handle constructed
2875 types (arrays, references, pointers).
2876 (GetReferenceType, GetPointerType): Use it.
2877 (GetNestedType): New. Uses type_hash to handle nested types of
2879 (LookupType, LookupTypeDirect): Remove.
2880 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
2881 'types' hash and LookupTypeReflection directly.
2882 (params_string, params_object): Use GetConstructedType.
2883 * namespace.cs (Namespace.cached_types): New. Cache of reflected
2885 (Namespace.Lookup): Use cached_types.
2886 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
2887 provided by old TypeManager.LookupType.
2888 * rootcontext.cs (MakeFQN): Remove.
2889 * decl.cs (DeclSpace.MakeFQN): Likewise.
2890 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
2891 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
2892 TypeManager.GetConstructedType.
2893 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
2895 2005-03-15 Marek Safar <marek.safar@seznam.cz>
2897 * class.cs (MethodCore.CheckBase): Report CS1715 for properties and
2900 * cs-parser.jay: Reports CS1527 for any namespace element.
2902 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
2905 * expression.cs (ParameterReference.IsAssigned): Changed error to
2907 (Error_WrongNumArguments): Moved CS0245 detection here.
2909 * statement.cs (Return.Resolve): Add CS1622 report.
2911 2005-03-11 Marek Safar <marek.safar@seznam.cz>
2913 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
2915 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
2917 * attribute.cs expression.cs: Get rid of some allocations.
2919 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
2921 * doc.cs : just eliminate the latest change.
2923 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2925 * doc.cs : commented out the latest change. It breaks xml-030.cs
2927 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2929 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
2930 fail. So invoke CreateType() in FindDocumentedType().
2932 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
2934 * cs-tokenizer.cs : added IsKeyword().
2935 * doc.cs : Detect keyword incorrectly used as identifier.
2936 Allow identifiers prefixed by @.
2938 2005-03-10 Marek Safar <marek.safar@seznam.cz>
2940 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
2941 It caused exception in namespace resolving (again!).
2943 * class.cs (Class.ctor): Removed exit.
2944 (PropertyMethod.ctor): ditto.
2946 * codegen.cs (Codegen.Reset): Reset static data.
2947 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
2949 * cs-tokenizer.cs (Cleanup): Removed.
2951 * driver.cs (GetSystemDir): Rewrote to one line command.
2952 It caused problem with unloaded dynamic modules.
2953 (UnixParseOption): Removed Exit.
2954 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
2955 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
2956 Now can be mcs used as library.
2958 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
2961 * location.cs (Reset): Reset static data.
2963 * namespace.cs (Reset): Reset static data.
2965 * report.cs (Report.Reset): Reset static data.
2967 * rootcontext.cs (RootContext.Reset): Reset static data.
2969 * tree.cs (RootTypes.ctor): Use Location.Null
2971 * typemanager.cs (TypeManager.Reset): Reset static data.
2972 (CoreLookupType): Removed Exit.
2973 (TypeHandle.Reset): Reset static data.
2975 2005-03-10 Raja R Harinath <rharinath@novell.com>
2978 * typemanager.cs (ComputeNamespaces): Import namespaces from
2979 referenced modules too.
2981 2005-03-09 Raja R Harinath <rharinath@novell.com>
2983 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
2986 2005-03-09 Raja R Harinath <rharinath@novell.com>
2988 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
2989 enclosing DeclSpace. This ensures that a name-lookup populates
2990 more caches and there are fewer 'TypeExpression's. Carve out
2991 nested type lookup into ...
2992 (LookupNestedTypeInHierarchy): ... this.
2994 2005-03-09 Raja R Harinath <rharinath@novell.com>
2996 Clean up a few partial-class semantics.
2997 Fixes test-357.cs and cs1618-2.cs.
2998 * cs-parser.jay (struct_declaration): Use 'current_class' as
2999 parent of newly-created struct. Remove call to Register ().
3000 Use 'pop_current_class' to complete handing the current struct.
3001 (interface_declaration): Likewise.
3002 (class_declaration): Likewise.
3003 (enum_declaration): Use 'current_class' as parent of newly created
3005 (delegate_declaration): Likewise.
3006 (pop_current_class): New function. This is used to handle closing
3007 up the 'current_class' and 'current_container', and pointing them
3008 to the enclosing class/container.
3009 (CSharpParser): Initialize 'current_class' too.
3010 * decl.cs (MemberCore): Add check for invariant: a partial
3011 container is not a parsed entity, and thus does not enclose any
3013 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
3014 (DeclSpace.BaseTypeExpr): Use it.
3015 (DeclSpace.LookupType): Add check for invariant.
3016 * class.cs (TypeContainer): Add check for invariant: a nested
3017 class should have the same NamespaceEntry as its enclosing class.
3018 (TypeContainer.EmitFieldInitializers): Make virtual.
3019 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
3021 (TypeContainer.Register): Remove.
3022 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
3023 null. Use TypeResolveEmitContext for resolving base types and
3024 interfaces. Move initialization of Parts.TypeBuilder here from
3026 (TypeContainer.DefineNestedTypes): ... here.
3027 (PartialContainer): Take a Namespace not a NamespaceEntry.
3028 (PartialContainer.Create): Don't use Register. Call the
3029 appropriate Add... function directly.
3030 (ClassPart): Take both the PartialContainer and the enclosing
3031 class as constructor arguments.
3032 (ClassPart.EmitFieldInitializers): Override.
3033 (ClassPart.PartFindNestedTypes): Remove.
3034 (FieldBase.GetInitializerExpression): Resolve the initializer
3035 expression in the emit context of the enclosing class.
3036 * tree.cs (RootTypes): Remove Register ().
3038 2005-03-08 Marek Safar <marek.safar@seznam.cz>
3040 * cs-parser.jay: Removed CS0134.
3042 * driver.cs: Removed CS1901.
3044 * expression.cs (SizeOf.DoResolve): Don't report CS0233
3045 for predefined types.
3047 2005-03-07 Duncan Mak <duncan@novell.com>
3049 * codegen.cs (Save): Catch UnauthorizedAccessException as
3050 well. Fixes bug #73454.
3052 2005-03-07 Marek Safar <marek.safar@seznam.cz>
3054 * cs-tokenizer.cs (xtoken): Add CS1035.
3056 * class.cs (MethodData.Define): Add CS0683.
3057 (FieldMember.ctor): Add CS0681.
3059 2005-03-07 Raja R Harinath <rharinath@novell.com>
3061 * ecore.cs (SimpleName.DoResolve): Rename from
3062 SimpleName.DoResolveAllowStatic.
3063 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
3064 Pass 'intermediate' flag to MemberStaticCheck.
3065 (SimpleName.MemberStaticCheck): Skip "static check" only in case
3066 of "intermediate" lookups via MemberAccess.
3067 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
3068 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
3070 2005-03-07 Raja R Harinath <rharinath@novell.com>
3073 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
3074 slipped in because of variable names that are identical to a
3075 builtin type's BCL equivalent ('string String;', 'int Int32;').
3076 (PropertyExpr.EmitInstance): Likewise.
3078 2005-03-04 Marek Safar <marek.safar@seznam.cz>
3080 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
3082 * report.cs (warning_ignore_table): Made public.
3084 2005-03-04 Raja R Harinath <rharinath@novell.com>
3087 * class.cs (MethodData.Emit): Pass 'container' to
3088 container.GetObsoleteAttribute instead of 'container.Parent'.
3090 2005-03-03 Marek Safar <marek.safar@seznam.cz>
3092 * cs-parser.jay: Add 1534 error test.
3094 * iterators.cs (Yield.CheckContext): Add error 1629.
3095 (Iterator.ctor): Save unsafe modifier.
3096 (MoveNextMethod.DoEmit): Restore unsafe context.
3098 * namespace.cs (UsingAlias): Better error message.
3100 2005-03-03 Dan Winship <danw@novell.com>
3102 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
3103 the warning message [#73219]
3105 2005-03-03 Raja R Harinath <rharinath@novell.com>
3107 Fix compile with MCS 1.0.0.0.
3108 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
3109 w_restore to not depend on string constant folding.
3111 2005-03-03 Raja R Harinath <rharinath@novell.com>
3113 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
3114 CS0246 check to users who passed 'silent = false'.
3115 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
3117 (SimpleName.SimpleNameResolve): Update.
3118 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
3119 (MemberAccess.IdenticalNameAndTypeName): Update.
3120 * doc.cs (FindDocumentedTypeNonArray): Update.
3122 2005-03-03 Raja R Harinath <rharinath@novell.com>
3124 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
3125 * parameters.cs (ComputeAndDefineParameters): Remove.
3126 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
3127 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
3128 Use GetParameterInfo.
3130 2005-03-02 Marek Safar <marek.safar@seznam.cz>
3132 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
3134 2005-03-02 Raja R Harinath <rharinath@novell.com>
3136 Unify DeclSpace.LookupType and DeclSpace.FindType.
3137 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
3138 is in charge of defining nested types on demand.
3139 (DeclSpace.LookupType): Use it when the current_type is a
3140 TypeBuilder. Use LookupTypeDirect for reflected types.
3141 (DeclSpace.FindType): Remove.
3142 (DeclSpace.LookupInterfaceOrClass): Likewise.
3143 (DeclSpace.DefineTypeAndParents): Likewise.
3144 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
3145 DeclSpace.LookupType.
3146 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
3147 * typemanager.cs (LookupType): Simplify.
3148 (AddUserType): Remove type from negative_hits.
3149 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
3150 * class.cs (TypeContainer.FindMembers): Move handling of nested
3152 (TypeContainer.FindMembers_NestedTypes): ... here.
3153 (TypeContainer.FindNestedType): Implement override.
3154 (ClassPart.FindNestedType): Delegate to PartialContainer.
3155 (ClassPart.PartFindNestedType): Looks up the nested types of the
3158 2005-03-02 Martin Baulig <martin@ximian.com>
3160 * class.cs (TypeContainer.DoDefineMembers): We also need a default
3161 static constructor in static classes.
3163 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
3165 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
3166 sizeParamIndex is not specified.
3168 2005-03-01 Marek Safar <marek.safar@seznam.cz>
3171 * report.cs (WarningMessage.IsEnabled): Missing null check.
3173 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3175 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
3176 in the fields and not in the properties.
3178 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
3180 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
3183 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3185 * attribute.cs: Small refactoring (improved robustness).
3186 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
3187 (ValidateGuid): Removed.
3188 (Resolve): Removed referenced to above mentioned.
3189 (GetAttributeUsage): Made private and changed to work without
3191 (GetIndexerAttributeValue): Don't crash.
3192 (GetConditionalAttributeValue): Ditto.
3193 (GetClsCompliantAttributeValue): Ditto.
3194 (ExtractSecurityPermissionSet): All attributes exceptions are
3196 (GetPropertyValue): New helper.
3197 (GetMethodImplOptions): New method.
3198 (DefinePInvokeMethod): Reuse common code. Implemented handling of
3199 some missing properties.
3201 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
3202 (Method.ApplyAttributeBuilder): Updated.
3204 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
3207 2005-02-28 Raja R Harinath <rharinath@novell.com>
3210 * report.cs (Report.SymbolRelatedToPreviousError): Handle
3211 non-simple types (array, pointer, reference).
3213 2005-02-28 Marek Safar <marek.safar@seznam.cz>
3215 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
3217 * class.cs (MethodCore.IsDuplicateImplementation): Special error
3219 (Method.CheckBase): Catch wrong destructor here.
3220 (MethodData.Define): Add errors 550, 668.
3222 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
3224 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
3226 * pending.cs (VerifyPendingMethods): Add error 551.
3228 * typemanager.cs (CSharpName): Next error report helper.
3230 2005-02-25 Marek Safar <marek.safar@seznam.cz>
3232 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
3233 attributes. Removed useless attribute double check.
3234 It saves almost 2MBs for corlib.
3236 2005-02-25 Raja R Harinath <rharinath@novell.com>
3239 * statement.cs (ExpressionStatement.Resolve): Make robust to being
3240 called twice in case of error.
3242 2005-02-23 Chris Toshok <toshok@ximian.com>
3244 Fix compiler portions of #72827.
3245 * statement.cs (Block.Emit): call Begin/EndScope on the
3246 EmitContext instead of the ILGenerator.
3248 * codegen.cs (EmitContext.BeginScope): new method, call
3249 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
3251 (EmitContext.BeginScope): same, but EndScope and CloseScope
3253 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
3254 offset and call the superclass's OpenScope(int) with it.
3255 (SymbolWriter.CloseScope): get the current il
3256 offset and call superclass's CloseScope(int) with it.
3258 2005-02-23 Marek Safar <marek.safar@seznam.cz>
3260 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
3261 CS1677 for out and ref as well.
3263 * class.cs (Method.Define): Add error CS1599 detection.
3265 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
3267 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
3269 * delegate.cs (Delegate.Define): Add error CS1599 detection.
3271 * support.cs.cs (ModifierDesc): New helper method.
3273 2005-02-23 Raja R Harinath <rharinath@novell.com>
3274 Abin Thomas <projectmonokochi@rediffmail.com>
3275 Anoob V E <projectmonokochi@rediffmail.com>
3276 Harilal P R <projectmonokochi@rediffmail.com>
3279 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
3280 MemberLookup (used for error reporting) actually returns a result.
3281 Fix error report number (122, not 112).
3283 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
3284 Anoob V E <projectmonokochi@rediffmail.com>
3285 Harilal P R <projectmonokochi@rediffmail.com>
3288 * pending.cs (PendingImplementation.GetAbstractMethods):
3289 Find NonPublic members too.
3291 2005-02-22 Marek Safar <marek.safar@seznam.cz>
3293 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
3296 * class.cs (MethodCore.CheckMethodAgainstBase):
3297 Add error 239 report.
3299 2005-02-21 Raja R Harinath <rharinath@novell.com>
3302 * expression.cs (Invocation.IsApplicable): Make public.
3303 (Invocation.IsParamsMethodApplicable): Likewise.
3304 * delegate.cs (Delegate.VerifyApplicability): Don't use
3305 Invocation.VerifyArgumentCompat for parameter applicability
3306 testing. Use Invocation.IsApplicable and
3307 Invocation.IsParamsMethodApplicable.
3309 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3311 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
3313 * class.cs (Operator.Define): Add error 217 report.
3315 2005-02-21 Raja R Harinath <rharinath@novell.com>
3317 * namespace.cs (UsingEntry.Resolve): Undo change below.
3319 2005-02-21 Raja R Harinath <rharinath@novell.com>
3322 * ecore.cs (Expression.MemberLookupFailed): Add argument to
3323 disable the error message when the extended MemberLookup also
3325 (Expression.MemberLookupFinal): Update.
3326 (SimpleName.DoSimpleNameResolve): Update.
3327 * expression.cs (MemberAccess.ResolveNamespaceOrType):
3328 Don't use MemberLookupFinal.
3329 (New.DoResolve): Update.
3330 (BaseAccess.CommonResolve): Update.
3332 2005-02-21 Raja R Harinath <rharinath@novell.com>
3335 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
3336 occured previously, don't resolve again.
3338 2005-02-21 Marek Safar <marek.safar@seznam.cz>
3341 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
3342 argument. Call ResolveAttributeUsage for unresolved.
3343 when types doesn't match ctor arguments.
3345 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
3346 for nested attribute classes.
3347 (Class.attribute_usage): Removed.
3348 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
3349 for attribute class.
3351 * ecore.cs (IsAttribute): Removed.
3353 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
3355 * rootcontext.cs (RegisterAttribute): Removed, attributes are
3357 (attribute_types): Removed.
3358 (EmitCode): Global attributes are emited as the latest.
3360 2005-02-18 Marek Safar <marek.safar@seznam.cz>
3362 * class.cs (EmitFieldInitializers): Don't emit field initializer
3363 for default values when optimilization is on.
3365 * constant.cs (Constant.IsDefaultValue): New property.
3367 * driver.cs: Add /optimize handling.
3371 * literal.cs: Implement new IsDefaultValue property.
3373 * rootcontext.cs (Optimize): New field, holds /optimize option.
3375 2005-02-18 Raja R Harinath <rharinath@novell.com>
3377 Fix crasher in re-opened #72347.
3378 * namespace.cs (Namespace.Lookup): Return null if
3379 DeclSpace.DefineType returns null.
3382 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
3384 2005-02-18 Raja R Harinath <rharinath@novell.com>
3386 Fix remainder of #63202. Change semantics of DoResolveLValue: it
3387 now returns null if it cannot resolve to an lvalue.
3388 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
3389 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
3390 returned null. Remove check for SimpleName.
3391 (EventExpr.DoResolveLValue): New.
3392 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
3393 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
3395 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
3397 (Unary.ResolveOperator): Move CS0211 check ...
3398 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
3400 (Unary.DoResolveLValue): Simplify.
3401 (AddressOf.DoResolveLValue): New.
3402 (ArrayAccess.DoResolveLValue): New.
3404 2005-02-16 Marek Safar <marek.safar@seznam.cz>
3406 * attribute.cs (Attribute.Resolve): Add arguments casting for
3407 when types doesn't match ctor arguments.
3409 2005-02-16 Raja R Harinath <rharinath@novell.com>
3411 Fix parts of #63202.
3412 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
3413 lookup of operator in base type. Ensure that all checks happen
3414 when the operator resolves to an "op_..." method.
3416 2005-02-15 Raja R Harinath <rharinath@novell.com>
3419 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
3420 'ignore_cs0104' parameter. Pass it to ...
3421 (NamespaceEntry.Lookup): ... this.
3422 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
3423 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
3424 (TypeLookupExpression.DoResolveAsTypeStep): Update.
3425 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
3426 Update. Request that cs0104 errors be ignored.
3427 (ComposedCast.ResolveAsTypeStep): Update.
3429 2005-02-14 Raja R Harinath <rharinath@novell.com>
3432 * expression.cs (Invocation.BetterFunction): Remove support for
3433 comparing virtual functions and their overrides.
3434 (Invocation.IsOverride): New.
3435 (Invocation.OverloadResolve): Don't consider 'override' functions
3436 during candidate selection. Store them in a lookaside list.
3437 If the selected method is a 'virtual' function, use the list to
3438 find any overrides that are closer to the LHS type.
3440 2005-02-14 Marek Safar <marek.safar@seznam.cz>
3442 * expression.cs (New.DoResolve): Add complex core type reduction.
3443 (New.Constantify): Converts complex core type syntax like 'new int ()'
3446 2005-02-14 Raja R Harinath <rharinath@novell.com>
3448 * decl.cs (EntryType.EntryType): New constructor to create an
3449 updated copy of a cache entry.
3450 (MemberCache.AddMethods): Use it.
3451 (MemberCache.ClearDeclaredOnly): Remove.
3452 (MemberCache.MemberCache): Update.
3454 2005-02-11 Miguel de Icaza <miguel@novell.com>
3456 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
3457 variable. This one is represents the actual low-level declaration
3458 of the method, as opposed to the semantic level `IsStatic'.
3460 An anonymous method which is hosted into a static method might be
3461 actually an instance method. IsStatic would reflect the
3462 container, while MethodIsStatic represents the actual code
3465 * expression.cs (ParameterReference): Use the new MethodIsStatic
3466 instead of IsStatic.
3468 * anonymous.cs (AnonymousMethod.Compatible): Pass the
3469 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
3470 set on the current EmitContext.
3472 * expression.cs (Cast): Overload DoResolveLValue so we can pass
3473 resolve our casted expression as an LValue. This triggers the
3474 proper LValue processing that is later required by Assign.
3478 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
3480 2005-02-11 Marek Safar <marek.safar@seznam.cz>
3482 C# 2.0 Fixed buffer implementation
3484 * anonymous.cs: Update after RegisterHelperClass renaming.
3486 * attribute.cs (AttributeTester.fixed_buffer_cache):
3487 Cache of external fixed buffers.
3488 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
3489 implementation if field is fixed buffer else null.
3492 (TypeContainer.AddField): Accept FieldMember instead of Field.
3493 (FieldBase.IsFieldClsCompliant): Extracted code from
3494 VerifyClsCompliance descendant customization.
3495 (FixedField): New class handles fixed buffer fields.
3496 (FixedFieldExternal): Keeps information about imported fixed
3498 (IFixedField): Make access to internal or external fixed buffer
3501 * cs-parser.jay: Add fixed buffer parsing.
3503 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
3506 * expression.cs (Indirection): Extended implementation to accept
3508 (PointerArithmetic.Emit): Get element from fixed buffer as well.
3509 (ElementAccess.MakePointerAccess): Get type as parameter.
3510 (DoResolve): Add fixed buffer field expression conversion.
3511 (DoResolveLValue): Ditto.
3512 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
3513 (ArrayPtr): Derives from FixedBufferPtr.
3514 (ArrayPtr.Emit): Add extra emit for array elements.
3516 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
3518 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
3519 for compiler generated types.
3520 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
3522 * statement.cs (Fixed): Refactored to be easier add fixed buffer
3523 and consume less memory.
3524 (Fixed.Resolve): Add fixed buffer case.
3526 * typemanager.cs (compiler_generated_attr_ctor,
3527 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
3528 (HasElementType): Add our own implementation to work on every
3531 2005-02-11 Miguel de Icaza <miguel@novell.com>
3533 * anonymous.cs (CaptureContext): Track whether `this' has been
3536 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
3537 only captured `this' if it was implicitly done (instance
3538 methods/variables were used).
3540 * codegen.cs (EmitContext.CaptureThis): New method to flag that
3541 `this' must be captured.
3543 2005-01-30 Miguel de Icaza <miguel@novell.com>
3545 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
3546 is null it means that there has been no need to capture anything,
3547 so we just create a sibling.
3549 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
3551 Just a partial fix. The other half is fairly elusive.
3553 2005-02-10 Raja R Harinath <rharinath@novell.com>
3555 Fix #52586, cs0121-4.cs.
3556 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
3557 and return a hashtable.
3558 (MemberCache.ClearDeclaredOnly): New.
3559 (MemberCache.MemberCache): Update to change. Make a deep copy of
3560 the method_hash of a base type too.
3561 (MemberCache.AddMethods): Adapt to having a deep copy of the base
3562 type methods. Overwrite entries with the same MethodHandle so
3563 that the ReflectedType is correct. The process leaves in base
3564 virtual functions and their overrides as distinct entries.
3565 (CacheEntry): Now a class instead of a struct. It shouldn't alter
3566 matters since it was boxed in a ArrayList before.
3567 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
3569 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
3570 case of a virtual function and its override (choose the overload
3572 (Invocation.OverloadResolve): Avoid 'override' members during
3573 'applicable_type' calculation.
3575 2005-02-09 Raja R Harinath <rharinath@novell.com>
3577 Combine two near-redundant caches.
3578 * typemanager.cs (method_params): Rename from method_internal_params.
3579 (TypeManager.GetParameterData): New. Replace
3580 Invocation.GetParameterData.
3581 (TypeManager.LookupParametersByBuilder): Remove.
3582 * expression.cs (Invocation.method_parameter_cache): Remove.
3583 (Invocation.GetParameterData): Remove.
3585 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
3588 2005-02-08 Raja R Harinath <rharinath@novell.com>
3591 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
3592 TypeManager.multicast_delegate_type is null, resolve it by looking
3593 up "System.MulticastDelegate".
3594 * rootcontext.cs (RootContext.ResolveCore): Simplify.
3596 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
3597 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
3598 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
3601 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
3602 (LabeledStatement.AddReference): New. Set 'referenced'.
3603 (Goto.Resolve): Use it.
3605 2005-02-05 John Luke <john.luke@gmail.com>
3607 * driver.cs: remove duplicate -doc line in Usage ()
3609 2005-02-04 Raja R Harinath <rharinath@novell.com>
3611 * location.cs (Location.AddFile): Fix CS2002 error report.
3613 2005-02-02 Martin Baulig <martin@ximian.com>
3615 * delegate.cs (Delegate.DefineType): Report an internal error if
3616 TypeManager.multicast_delegate_type is null. See bug #72015 for
3619 2005-02-02 Raja R Harinath <rharinath@novell.com>
3621 Fix a crasher in a variant of #31984.
3622 * const.cs (Constant.CheckBase): New override that defers the
3623 new-or-override check in case the base type hasn't been populated
3625 (Constant.Define): Ensure the new-or-override check is performed.
3627 2005-02-01 Duncan Mak <duncan@ximian.com>
3629 * const.cs (LookupConstantValue): Check that `ce' is not null
3630 before calling GetValue ().
3632 2005-02-01 Raja R Harinath <rharinath@novell.com>
3634 Fix test-334.cs (#69519).
3635 * cs-parser.jay (using_alias_directive): Pass in an expression to
3636 NamespaceEntry.UsingAlias.
3637 (using_namespace_directive): Pass in an expression to
3638 NamespaceEntry.Using.
3639 (namespace_name): Don't flatten to a string.
3640 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
3641 (NamespaceEntry.AliasEntry.Resolve): Lookup using
3643 (NamespaceEntry.UsingEntry): Likewise.
3644 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
3646 (NamespaceEntry.LookupForUsing): Remove.
3647 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
3649 (NamespaceEntry.Lookup): Remove support for dotted names.
3651 2005-02-01 Raja R Harinath <rharinath@novell.com>
3653 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
3655 (NamespaceEntry.ImplicitParent): Compute on demand.
3656 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
3657 parallels the current.
3658 (NamespaceEntry.LookupForUsing): Use it.
3659 (NamespaceEntry.Lookup): If the current namespace-entry is
3660 implicit, don't search aliases and using tables.
3662 2005-02-01 Raja R Harinath <rharinath@novell.com>
3665 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
3667 (TypeContainer.BaseCache): Compute on demand.
3668 (TypeContainer.FindMembers): Define constants and types if they're
3669 not already created.
3670 (FieldMember.Define): Move resetting of ec.InUnsafe before error
3672 * const.cs (Constant.Define): Make idempotent.
3674 2005-01-29 Miguel de Icaza <miguel@novell.com>
3676 * pending.cs: Produce better code (no nops produced by using Ldarg
3679 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
3680 i - 1' it should be arg + 1.
3684 2005-01-28 Raja R Harinath <rharinath@novell.com>
3686 * attribute.cs (Attribute.CheckAttributeType): Make private
3688 (Attribute.ResolveType): Make virtual.
3689 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
3690 handling of RootContext.Tree.Types.
3692 2005-01-27 Raja R Harinath <rharinath@novell.com>
3694 Update attribute-handling to use the SimpleName/MemberAccess
3696 * cs-parser.jay (attribute): Pass in an expression to the
3697 constructors of Attribute and GlobalAttribute.
3698 * attribute.cs (Attribute): Take an expression for the name.
3699 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
3700 passed in attribute name expression.
3701 (Attribute.CheckAttributeType): Use it.
3702 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
3703 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
3704 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
3705 argument to prevent error messages if the lookup fails.
3707 2005-01-27 Marek Safar <marek.safar@seznam.cz>
3709 * expression.cs (Indirection): Implemented IVariable interface
3710 to support indirection in AddressOf operator.
3711 (PointerArithmetic.Emit): Add optimalization for case where
3712 result can be precomputed.
3714 2005-01-26 Martin Baulig <martin@ximian.com>
3716 * class.cs (TypeContainer.AttributeTargets): Return the correct
3717 AttributeTargets depending on our `Kind' instead of throwing an
3718 exception; fixes #71632.
3720 2005-01-26 Marek Safar <marek.safar@seznam.cz>
3723 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
3726 2005-01-25 Raja R Harinath <rharinath@novell.com>
3729 * expression.cs (MemberAccess.DoResolve): Don't complain with
3730 cs0572 when the LHS of a member access has identical name and type
3733 2005-01-25 Marek Safar <marek.safar@seznam.cz>
3736 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
3738 Create custom PermissionSet only for PermissionSetAttribute.
3740 2005-01-24 Marek Safar <marek.safar@seznam.cz>
3743 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
3744 delegates in static class.
3746 2005-01-24 Martin Baulig <martin@ximian.com>
3748 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3749 merging an implicit block, just use its reachability.
3751 * statement.cs (Block.Resolve): Make the unreachable code check
3752 work wrt. implicit blocks; see test-337 from #63842.
3754 2005-01-21 Alp Toker <alp@atoker.com>
3756 * cs-parser.jay: destructor_declaration's container is PartialContainer
3757 not Class when partial types are used, so use Kind prop instead of
3760 2005-01-22 Miguel de Icaza <miguel@ximian.com>
3762 * cs-parser.jay: Improve error reporting when an interface
3765 2005-01-20 Dick Porter <dick@ximian.com>
3767 * support.cs: SeekableStreamReader fix from Sandor Dobos
3768 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
3769 chars are read. Fixes bug 70369.
3771 2005-01-20 Raja R Harinath <rharinath@novell.com>
3773 * cs-parser.jay (catch_clause): Simplify current_block handling
3776 2005-01-17 Miguel de Icaza <miguel@ximian.com>
3778 * convert.cs (ImplicitStandardConversionExists): Synchronize the
3779 code with ImplicitStandardConversion to handle the implicit
3780 conversion of method groups into valid delegate invocations.
3782 The problem is that in parameter handling we were using this code
3783 path. Fixes bug #64698
3785 2005-01-19 Raja R Harinath <rharinath@novell.com>
3787 * cs-parser.jay: Fix several infelicities.
3788 - Avoid assigning to the parser value stack. Code like
3789 '$3 = null' is unclean. Synthesize a value for the code block
3791 - Avoid using oob_stack for storing location information. Use ...
3792 (_mark_): ... this. New (empty) rule. Saves the current location
3794 (foreach_statement): Avoid using oob_stack for current_block
3795 handling. Use technique used in for_statement and
3796 using_statement. Synthesize a value for the code block to store
3797 additional intermediate information.
3799 2005-01-13 Miguel de Icaza <miguel@ximian.com>
3801 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
3802 of a different type is only allowed to private fields of a
3803 containing type, not on fields of a base class.
3805 See test-174.cs and error cs0122-9.cs
3807 2005-01-13 Raja R Harinath <rharinath@novell.com>
3809 Fix test-335.cs (bug #58126).
3810 * cs-parser.jay (argument): Split out non-expression parts of the
3811 rule into 'non_simple_argument'.
3812 (invocation_expression): Support parenthesized invocations with
3813 multiple arguments, and with single non-simple arguments.
3815 2005-01-13 Raja R Harinath <rharinath@novell.com>
3817 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
3820 2005-01-12 Raja R Harinath <rharinath@novell.com>
3822 Fix cs0038-1.cs, cs1640-6.cs.
3823 * ecore.cs (Expression.Resolve): Remove special-case for
3824 SimpleName in error-handling.
3825 (Expression.almostMatchedMembers): Relax access permission to
3827 (Expression.MemberLookupFailed): Handle duplicates in
3828 almostMatchedMembers list.
3829 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
3830 * expression.cs (New.DoResolve): Report CS1540 for more cases.
3831 * typemanager.cs (GetFullNameSignature): Use the MethodBase
3832 overload if the passed in MemberInfo is a MethodBase.
3834 2005-01-12 Marek Safar <marek.safar@seznam.cz>
3837 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
3838 for non-CAS & merge permission sets properly.
3840 2005-01-11 Raja R Harinath <rharinath@novell.com>
3842 Improve standard-compliance of simple name and member access
3843 resolution. Fixes bugs #52697, #57200, #67520, #69519.
3844 * ecore.cs (FullNamedExpression): New abstract base class
3845 for Namespaces and TypeExpressions.
3846 (ResolveFlags.SimpleName): Remove.
3847 (SimpleName): Remove support for dotted names.
3848 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
3849 DeclSpace.FindType and DeclSpace.LookupType.
3850 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
3851 (Expression.ExprClassName): Make member function.
3852 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
3853 a namespace. Remove creation of dotted "SimpleName"s.
3854 (MemberAccess.DoResolve): Likewise.
3855 * decl.cs (DeclSpace.Cache): Make private.
3856 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
3857 (DeclSpace.FindType): Update.
3858 (DeclSpace.LookupType): Move here from RootContext. Return a
3859 FullNamedExpression.
3860 * namespace.cs (Namespace): Derive from FullNamedExpression
3861 so that it can be part of expression resolution.
3862 (Namespace.Lookup): Return an FullNamedExpression.
3863 (NamespaceEntry.LookupAlias): Lookup aliases only in current
3865 * rootcontext.cs (NamespaceLookup): Remove.
3866 (LookupType): Move to DeclSpace.
3867 * attribute.cs (CheckAttributeType): Update.
3868 * doc.cs (FindDocumentedType): Remove allowAlias argument.
3869 (FindDocumentedTypeNonArray): Likewise.
3871 2005-01-11 Raja R Harinath <rharinath@novell.com>
3873 Fix cs0509.cs, cs1632.cs.
3874 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
3875 is the same as IsInterface.
3876 (TypeContainer.GetClassBases): Likewise.
3877 * statement.cs (LabeledStatement.ig): New field.
3878 (LabeledStatement.LabelTarget): Save ILGenerator which created the
3880 (LabeledStatement.DoEmit): Check that the label was created with
3881 the same ILGenerator.
3883 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3886 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
3887 accessors to its properties.
3889 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
3890 from accessors to property.
3892 2005-01-10 Marek Safar <marek.safar@seznam.cz>
3895 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
3898 2005-01-08 Miguel de Icaza <miguel@ximian.com>
3900 * attribute.cs: Check for null and empty strings.
3902 I have lost another battle to Paolo.
3904 2005-01-07 Marek Safar <marek.safar@seznam.cz>
3907 * class.cs (PropertyMethod): Set Parent field in ctors.
3908 (SetMethod.InternalParameters): Add unsafe switch hack.
3909 Override MarkForDuplicationCheck where it is appropriate.
3911 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
3912 It says whether container allows members with the same name.
3914 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
3915 Removed is_method parameter.
3917 2005-01-06 Duncan Mak <duncan@ximian.com>
3919 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
3920 because the previous change led to incorrect reporting of CS1032
3921 ("Cannot define/undefine preprocessor symbols after first token in
3922 file"). Instead of using `tokens_seen' as the only flag that
3923 triggers CS1040, introduce `comments_seen'. This new flag is used
3924 to signify having seen comments on the current line, so it is
3925 unset after a newline.
3927 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3929 * doc.cs : When searching for a type, find nested type too.
3930 This fixes bug #71040.
3932 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
3935 - Warn missing member comment on those classes which also does not
3936 have doc comments. Fixed bug #71041.
3937 - Don't warn missing doc comment on default constructor.
3940 2005-01-06 Duncan Mak <duncan@ximian.com>
3942 * cs-tokenizer.cs (xtoken): After handling traditional C-style
3943 comments, set `tokens_seen' to true. This allows us to detect
3944 misplaced preprocessor directives (i.e. not at the beginning of
3945 the a line, nor after whitespaces). In that case, report error
3946 CS1040. This fixes bug #56460.
3948 * cs-parser.jay (interface_member_declaration): Add checks for
3949 IsExplicitImpl, and report CS0541 error if an interface member is
3950 defined as an explicit interface declaration.
3952 2005-01-06 Marek Safar <marek.safar@seznam.cz>
3955 * class.cs (PropertyMethod): Set Parent field in ctors.
3956 (SetMethod.InternalParameters): Add unsafe switch hack.
3958 * decl.cs (MemberCore.Parent): Cannot be readonly.
3960 2005-01-06 Raja R Harinath <rharinath@novell.com>
3962 * decl.cs (DeclSpace.ResolveType): Remove.
3963 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
3964 Merge in code from ...
3965 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
3966 * class.cs, enum.cs: Update to changes.
3968 2005-01-06 Miguel de Icaza <miguel@ximian.com>
3970 * anonymous.cs: Ensure that we init the scope of our parent if it
3971 has not been initialized yet.
3973 2004-12-30 Duncan Mak <duncan@ximian.com>
3975 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
3976 if field.FieldBuilder is null. Fixes #70758.
3978 * convert.cs: Fixed some typos and updated some of the comments.
3979 (ImplicitStandardConversionExists):
3980 (TryImplicitIntConversion): If `target_type' is an interface and
3981 the type of `ic' implements this interface, return true or a new
3982 BoxedCast instead of null. This fixes #70468.
3984 2004-12-29 Duncan Mak <duncan@ximian.com>
3986 * expression.cs (Argument.Emit): Check that Expr is
3987 IMemoryLocation before casting to it, and report CS1510 otherwise.
3991 2004-12-21 Ben Maurer <bmaurer@ximian.com>
3993 * statement.cs (Block.ThisVariable): remove the recursion here, to
3994 make the --profile more sane.
3996 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
3998 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
3999 assembly, by JB Evain.
4001 2004-12-17 Raja R Harinath <rharinath@novell.com>
4003 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
4004 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
4005 "parent" refers to enclosing type/class. "base" refers to superclass.
4007 2004-12-17 Raja R Harinath <rharinath@novell.com>
4009 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4010 Ensure that we only have GlobalAttributes.
4011 * attribute.cs (Attribute.Emit): Make non-virtual.
4012 (GlobalAttribute.Emit): Remove.
4013 (Attribute.Resolve): Make virtual.
4014 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
4015 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
4016 the argument. Don't create one.
4017 (Attribute.GetObsoleteAttribute): Likewise.
4018 (Attribute.GetClsCompliantAttributeValue): Likewise.
4019 * class.cs, decl.cs: Update to changes.
4021 2004-12-17 Marek Safar <marek.safar@seznam.cz>
4023 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
4025 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
4027 * statement.cs (Foreach.Resolve): Add error 186 report.
4029 2004-12-16 Marek Safar <marek.safar@seznam.cz>
4031 * expression.cs (Conditional.DoResolve): Add warning 429.
4033 * statement.cs (If.Resolve): Add warning 665.
4035 2004-12-16 Raja R Harinath <rharinath@novell.com>
4037 New invariant: RootContext.Tree.Types.NamespaceEntry == null
4038 except when in the parser, and in GlobalAttribute.
4039 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
4040 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
4041 RootContext.Tree.Types.NamespaceEntry once work is done.
4042 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
4043 and resets RootContext.Tree.Types.NamespaceEntry.
4045 2004-12-15 Marek Safar <marek.safar@seznam.cz>
4047 * cs-parser.jay: Don't create a block for every variable.
4049 2004-12-14 Miguel de Icaza <miguel@ximian.com>
4051 * location.cs: Provide extra information.
4053 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
4054 variables from the captured environment, it is the ldarg_0.
4056 2004-12-14 Marek Safar <marek.safar@seznam.cz>
4058 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
4061 * class.cs: Changed warning level for 169 to avoid developer
4062 displeasure from warning flooding. It will be changed back when they
4063 fix most of current BCL warnings.
4065 * RootContext.cs: Pushed default WarningLevel to 3.
4067 * statement.cs: Removed unused variable.
4069 2004-12-14 Marek Safar <marek.safar@seznam.cz>
4071 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
4072 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
4073 Add error 502 report.
4074 (StaticClass.DefineType): Add error 441 report.
4075 (Class.AllowedModifiersProp): New virtual property as temporary
4076 extension to AllowedModifiers.
4077 (Class.DefineType): Add error 418 report. Moved ModFlags check here
4078 to share implementation with StaticClass and don't call virtual
4081 * driver.cs (MainDriver): Add error 1558 test.
4083 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
4084 report. Moved error 36 test here.
4086 * statement.cs (Throw.Resolve): Add error 724 report.
4088 * typemanager.cs: Add out_attribute_type core type.
4090 2004-12-13 Marek Safar <marek.safar@seznam.cz>
4092 * class.cs (TypeContainer.VerifyClsCompliance): Add error
4094 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
4096 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
4099 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
4101 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
4102 Add error 3023 report.
4103 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
4105 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
4108 2004-12-12 John Luke <john.luke@gmail.com>
4110 * driver.cs (AddArgs): take -- into account when
4111 adding arguments, fixes bug 65710
4113 2004-12-12 Martin Baulig <martin@ximian.com>
4115 * expression.cs (Unary.TryReduceNegative): Added support for
4116 SByteConstant and ByteConstant.
4117 (Unary.Reduce): Check error values from TryReduceNegative().
4119 2004-12-10 Marek Safar <marek.safar@seznam.cz>
4121 * attributes.cs (Attribute.Resolve): Avoid multiple error report
4122 and report exception as error 182.
4124 2004-12-10 Raja R Harinath <rharinath@novell.com>
4126 * driver.cs (Main): Fix message when there are warnings.
4128 2004-12-09 Miguel de Icaza <miguel@ximian.com>
4130 * delegate.cs: Fixed my fix from yesterday, sorry about that.
4132 2004-12-09 Marek Safar <marek.safar@seznam.cz>
4134 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
4135 Reduced number of warnings.
4137 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
4139 2004-12-08 Miguel de Icaza <miguel@ximian.com>
4141 * driver.cs: Removed message.
4143 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
4145 2004-12-08 <vargaz@freemail.hu>
4147 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
4149 2004-12-08 Martin Baulig <martin@ximian.com>
4151 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
4152 instead of a CS3002 for properties and indexer.
4154 2004-12-08 Martin Baulig <martin@ximian.com>
4156 * decl.cs (MemberName.ToString): Make this work again.
4158 2004-12-08 Marek Safar <marek.safar@seznam.cz>
4160 * attribute.cs (Resolve): Add error 591 detection.
4162 * class.cs (FieldMember.Define): Add error 1547 detection.
4163 (Indexer.Define): Add error 620 detection.
4164 (Operator.Define): Add error 590 detection.
4166 * ecore.cs: Missing argument for error 79.
4168 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
4171 2004-12-07 Marek Safar <marek.safar@seznam.cz>
4174 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
4177 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
4179 * cs-parser.jay : handle doc comments on implicit/explicit operators.
4180 Some operator comments were suppressed.
4181 * doc.cs : Implicit/explicit operator name in doc comments are like
4182 "op_Explicit(type)~returnType", so added suffix handling.
4184 2004-12-07 Martin Baulig <martin@ximian.com>
4187 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
4188 (MemberCore.GetClsCompliantAttributeValue): Likewise.
4189 (DeclSpace.ec): New protected field; store the EmitContext here.
4190 (DeclSpace.EmitContext): New public property; moved here from
4192 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
4195 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
4196 (Enum.Emit): Don't create a new EmitContext.
4198 * delegate.cs (Delegate.DefineType): Always create the
4201 * iterators.cs (Iterators.DefineIterator): Create a new
4202 EmitContext and store it in `ec'.
4204 2004-08-24 Martin Baulig <martin@ximian.com>
4207 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
4208 this for accessibility checks.
4209 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
4210 IsNestedFamilyAccessible.
4211 (TypeManager.IsSubclassOf): New method, do what the name actually
4214 2004-12-06 Raja R Harinath <rharinath@novell.com>
4216 Fix crash on cs0657-17.cs.
4217 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4218 Use RootContext.Tree.Types, not 'new RootTypes ()'.
4219 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
4220 the case where the NamespaceEntry gets overwritten.
4222 2004-12-06 Marek Safar <marek.safar@seznam.cz>
4224 Fixed #69195, #56821
4225 * ecore.cs (ResolveBoolean): Tiny refactoring.
4227 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
4228 of right expression resolving when left is false constant and
4229 operator is LogicalAnd OR true constant and operator is LogicalOr.
4231 * statement.cs (ResolveUnreachable): Always reports warning.
4233 2004-12-05 Miguel de Icaza <miguel@ximian.com>
4235 * class.cs: Distinguish between 1721 and 1722 (just a little help
4236 for the programmer).
4238 2004-12-03 Miguel de Icaza <miguel@ximian.com>
4240 * delegate.cs: Only allow this on new versions of the language.
4242 2004-12-02 Duncan Mak <duncan@ximian.com>
4244 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
4246 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
4247 here as a static method. Take an additional bool out parameter
4248 `must_do_cs1540_check' for signaling to InstanceResolve.
4249 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
4250 member field from PropertyExpr class and made it an argument of
4252 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
4253 check for MarshalByRefObject, and report CS0122 instead of CS1540.
4254 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
4255 and `remove_accessor' as well as InstanceResolve: report CS0122
4260 2004-12-03 Raja R Harinath <rharinath@novell.com>
4262 Fix test-327.cs, test-328.cs, and put in early infrastructure
4263 for eventually fixing #52697.
4264 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
4265 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
4267 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
4268 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
4269 (VerifyUsing, error246): Update.
4270 * rootcontext.cs (RootContext.NamespaceLookup): Just use
4271 'NamespaceEntry.LookupNamespaceOrType'.
4273 2004-12-03 Martin Baulig <martin@ximian.com>
4275 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4276 method as our child, call AnonymousMethod.Compatible() on it.
4278 2004-12-03 Raja R Harinath <rharinath@novell.com>
4280 Disable XML documentation support in 'basic' profile.
4281 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
4282 Redirect XmlElement to System.Object.
4283 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
4284 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
4285 * mcs.exe.sources: Add doc-bootstrap.cs.
4286 * doc-bootstrap.cs: New file. Contains empty stub implementation
4289 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
4291 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
4292 comments are allowed.
4294 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4296 * delegate.cs: Add checks for subtypes in paramaters and return values
4297 in VerifyMethod () to add support for Covariance/Contravariance
4300 2004-12-02 Miguel de Icaza <miguel@ximian.com>
4302 * report.cs: Remove extra closing parenthesis.
4304 * convert.cs (Error_CannotImplicitConversion): If the name of the
4305 types are the same, provide some extra information.
4307 * class.cs (FieldBase): Use an unused bit field from the field to
4308 encode the `has_offset' property from the FieldMember. This saves
4309 a couple of Ks on bootstrap compilation.
4311 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
4312 method as our child, return the AnonymousMethod resolved
4315 * expression.cs (New.DoResolve): Allow return values from
4316 NewDelegate to also include AnonymousMethods.
4320 2004-12-02 Marek Safar <marek.safar@seznam.cz>
4323 * attribute.cs (Resolve): Improved implementation of params
4324 attribute arguments.
4326 * support.cs (ParameterData): Add HasParams to be faster.
4328 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
4330 all things are for /doc support:
4332 * doc.cs: new file that supports XML documentation generation.
4333 * mcs.exe.sources: added doc.cs.
4335 Handle /doc command line option.
4336 Report error 2006 instead of 5 for missing file name for /doc.
4337 Generate XML documentation when required, after type resolution.
4339 Added support for picking up documentation (/// and /** ... */),
4340 including a new XmlCommentState enumeration.
4342 Added lines to fill Documentation element for field, constant,
4343 property, indexer, method, constructor, destructor, operator, event
4344 and class, struct, interface, delegate, enum.
4345 Added lines to warn incorrect comment.
4347 Added Documentation field (passed only when /doc was specified).
4349 Added DocComment, DocCommentHeader, GenerateDocComment() and
4350 OnGenerateDocComment() and some supporting private members for
4351 /doc feature to MemberCore.
4353 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
4355 Added overriden DocCommentHeader.
4357 Added overriden DocCommentHeader and GenerateDocComment().
4359 2004-12-01 Miguel de Icaza <miguel@ximian.com>
4361 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
4362 unwrapping the enumeration values, chain to
4363 DoConstantNumericPromotions again, so we can promote things to the
4364 fundamental types (takes care of enums that are bytes, sbytes).
4368 2004-12-01 Raja R Harinath <rharinath@novell.com>
4370 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
4371 Fix long-standing bug in type-lookup. Use FindType instead of
4372 LookupType when ec.ResolvingTypeTree.
4373 (Attribute.ResolveType, Attribute.Resolve)
4374 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
4376 (Attributes.Search): Remove internal version. Update.
4377 (Attributes.SearchMulti): Update.
4378 (Attributes.GetClsCompliantAttribute): Remove.
4379 (Attributes.GetIndexerNameAttribute): Remove.
4380 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
4381 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
4382 * class.cs (Indexer.Define): Likewise.
4384 2004-12-01 Marek Safar <marek.safar@seznam.cz>
4387 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
4388 MarshallByReference members access.
4390 * expression.cs: Use CheckMarshallByRefAccess;
4391 Better error CS0197 message.
4393 * report.cs: Print whole related error message.
4395 2004-11-30 Raja R Harinath <rharinath@novell.com>
4397 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
4398 the current directory to help debugging.
4400 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4402 * class (GetClassBases): Better error 60 report.
4403 (EventProperty): Disabled warning 67 detection.
4405 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4408 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
4410 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
4413 2004-11-29 Marek Safar <marek.safar@seznam.cz>
4416 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
4418 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
4420 2004-11-26 Miguel de Icaza <miguel@ximian.com>
4422 * attribute.cs (Attribute.Resolve): Refine error reporting and
4423 report a cs0117 if the identifier does not exist, to distinguish
4424 from 0617 which is a miss-use of the actual identifier.
4426 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
4427 between cs0070 and cs0079.
4429 * class.cs (MemberBase.DoDefine): When reporting a wrong
4430 accessibility level, we use MethodCore to compare instead of
4431 Method (this was a regression in some refactoring effort).
4433 So now we correctly report cs0056 again.
4435 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
4436 testing the target_type (which was known to be object_type) and
4437 not the source type (which is anonymous_method).
4439 Fixed reporting of error cs1660.
4441 * expression.cs (UserCast.Source): Expose the underlying cast.
4443 * statement.cs (Switch.SwitchGoverningType): Sort the list of
4444 allowed types to find a match to int32 first (most common).
4446 In addition, it ignores any ImplicitUserConversions that did an
4447 internal implicit conversion (as the switch statement allows only
4448 one integral conversion to exist).
4450 * class.cs (PartialContainer.Create): rename `name' to
4451 `member_name' for clarity. Then replace the string calls with a
4452 call to MemberName.GetPartialName, as now using
4453 MemberName.ToString is an error (this is due to the side effects
4454 it had, that were fixed in the past).
4456 This will restore the error reporting on a number of partial class
4457 errors that were missusing this (and getting an exception as a
4458 results, which is now just a plain textual warning, because
4459 yyparse debug output would crash otherwise).
4461 2004-11-26 Raja R Harinath <rharinath@novell.com>
4463 * Makefile (PROGRAM_INSTALL_DIR): Remove.
4465 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4467 * rootcontext.cs (LookupType): Make sure to cache lookups that
4468 don't give us a negative result. This saves about 5% of corlib
4471 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4473 * report.cs (AbstractMessage.Print): messages are sent to stderr
4475 * class.cs (TypeContainer.GetClassBases): It is an error to have a
4476 non-interface in the list of interfaces (at this point, either
4477 parent was properly set, or a base class is being listed in the
4478 interfaces section).
4480 This flags error 1722, and resolves the crash from bug 69259.
4482 2004-11-25 Ben Maurer <bmaurer@ximian.com>
4484 * statement.cs (Using.EmitExpressionFinally): make this work right
4485 for valuetypes. Fixes 69926.
4487 2004-11-25 Miguel de Icaza <miguel@ximian.com>
4489 * const.cs (Const.ChangeType): Cope with the "0 literal can be
4490 converted to an enum" here, before we try to change the underlying
4491 type. This code exists, but it is a different code path than the
4492 one used while encoding constants.
4494 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
4495 old bug: when converting from the null literal to a pointer,
4496 return an EmptyCast, not the NullLiteral.
4498 This fixes #69921, the recent null_type changes probably made this
4501 (ImplicitReferenceConversionExists): In addition, resynchronized
4502 the code here, so it matches the same code in
4503 ImplicitReferenceConversionExists for the `from any class-type S
4504 to any interface-type T'.
4507 2004-11-25 Marek Safar <marek.safar@seznam.cz>
4509 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
4511 2004-11-24 Miguel de Icaza <miguel@ximian.com>
4513 * cs-parser.jay: Use verbosity accordingly.
4515 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4517 * expression.cs (Unary.ResolveOperator): Do not report warning;
4518 AddressOf reads from variable.
4520 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
4522 2004-11-24 Marek Safar <marek.safar@seznam.cz>
4526 * attribute.cs (Attributable): Removed CheckTargets.
4527 (Attributes.Emit): Explicit attribute targets are tested here.
4529 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
4530 not enabled for interfaces.
4532 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
4533 (GetAssemblyName): Ouch next bug there.
4535 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4537 * expression.cs: Error 275 added.
4539 2004-11-23 Marek Safar <marek.safar@seznam.cz>
4541 Fix bug #69177 (Implemented decimal constant support)
4543 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
4544 (BinaryFold): Add DecimalConstant.
4546 * const.cs (Define): Decimal constant
4548 (ChangeType): Add decimal type handling.
4549 (LookupConstantValue): Don't set value for decimal type but
4550 emit DecimalConstantAttribute. Needed for constant optimization.
4552 * constant.cs (ToDecimal): New method.
4553 (ConvertToDecimal): New method.
4554 (IntConstant): Implemented ConvertToDecimal.
4555 (DecimalConstant.Emit): Emit optimized version for decimals in
4558 * expression.cs (ResolveOperator): Changed order of constant
4559 reduction to work correctly with native types which have
4560 overloaded operators.
4561 (ResolveMemberAccess): Extract constant value from attribute
4564 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
4566 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
4567 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
4568 (ChangeType): Decimal is special.
4569 (TypeToCoreType): Add decimal type.
4571 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4573 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
4576 2004-11-22 Marek Safar <marek.safar@seznam.cz>
4578 * class.cs (EventField.ApplyAttributeBuilder): Fix error
4581 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4583 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
4585 * pending.cs (PendingImplementation): Grab only interfaces.
4587 2004-11-19 Marek Safar <marek.safar@seznam.cz>
4589 * statement.cs (ForeachHelperMethods): Add location member and
4590 error 202 detection.
4592 2004-11-19 Raja R Harinath <rharinath@novell.com>
4594 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
4595 automatically handled by executable.make.
4596 (PROGRAM): Make profile-specific.
4598 2004-11-18 Marek Safar <marek.safar@seznam.cz>
4600 * expression.cs (DoResolveBase): Fixed wrong warning for out
4603 2004-11-18 Martin Baulig <martin@ximian.com>
4605 Merged latest changes into gmcs. Please keep this comment in
4606 here, it makes it easier for me to see what changed in MCS since
4607 the last time I merged.
4609 2004-11-17 Raja R Harinath <rharinath@novell.com>
4611 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
4612 (TypeHandle.GetMemberCache): New.
4613 (TypeHandle.TypeHandle): Update.
4614 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
4615 (TypeManager.LookupParentInterfacesCache):
4616 Rename from LookupInterfaceCache. Optimize slightly.
4617 (TypeManager.MemberLookup_FindMembers): Update.
4618 * decl.cs (MemberCache.MemberCache): Set Container to null in the
4620 (AddCacheContents): Rename from AddHashtable.
4621 * class.cs (TypeContainer.parent_container): Remove.
4622 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
4623 (TypeContainer.DoDefineMembers): Don't initialize it.
4624 Update to name changes.
4626 2004-11-17 Miguel de Icaza <miguel@ximian.com>
4628 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
4629 that factors the code to check access modifiers on override.
4631 (PropertyBase): Use the code here.
4633 Patch from Lluis S'anchez, fixes bug #69361.
4635 2004-11-15 Miguel de Icaza <miguel@ximian.com>
4637 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
4638 routine that is used to report the use of a captured variable
4639 whose address has been taken.
4641 There are two checks: one when variables are being captured and
4642 the other check is when the address of a variable is taken.
4644 (because an anonymous methods might be resolved before *or* after
4645 the address has been taken) and
4647 * expression.cs (Conditional.DoResolve): Remove the special
4648 casing that Martin added to trueExpr and falseExpr being both
4649 NullLiteral. We get the right behavior now just by introducing
4650 the null_type into the compiler.
4652 * convert.cs (ExplicitConversion): Change the code to use
4653 null_type instead of testing `expr is NullLiteral'.
4654 (ImplicitConversionStandard): use null_type too.
4655 (ImplicitReferenceConversionExists): use null_type too.
4656 (ImplicitReferenceConversion): use null_type too.
4658 * literal.cs: The type of `NullLiteral' is now null_type instead
4660 (Resolve): Set the type here.
4662 * typemanager.cs: Introduce null_type.
4664 2004-11-17 Martin Baulig <martin@ximian.com>
4666 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
4667 direction, like FindMembers() does. Fixes #69546, testcase is in
4670 2004-11-16 Martin Baulig <martin@ximian.com>
4672 This is based on a patch from Marek Safar, see bug #69082.
4673 Fixes bugs #63705 and #67130.
4675 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
4676 method; create a MemberCache for an interface type and cache the
4679 * decl.cs (IMemberContainer.ParentContainer): Removed.
4680 (IMemberContainer.ParentCache): New property.
4681 (MemberCache.SetupCacheForInterface): Removed.
4682 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
4683 to create a cache for an interface's "parent".
4685 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
4688 2004-11-16 Martin Baulig <martin@ximian.com>
4690 Merged back from gmcs; these changes already went into gmcs a
4691 couple of weeks ago.
4694 (TypeManager.AddUserType): Removed the `ifaces' argument.
4695 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
4697 (TypeManager.AddUserInterface): Removed.
4698 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
4700 (TypeManager.GetInterfaces): Likewise.
4701 (TypeManager.GetExplicitInterfaces): Likewise.
4703 * ecore.cs (TypeExpr.GetInterfaces): Removed.
4705 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
4706 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
4708 2004-11-14 Ben Maurer <bmaurer@ximian.com>
4710 * statement.cs: Avoid adding bools to a hashtable.
4712 2004-11-07 Miguel de Icaza <miguel@ximian.com>
4714 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4715 calling an unsafe method from a safe location.
4717 2004-11-06 Marek Safar <marek.safar@seznam.cz>
4720 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
4722 2004-11-06 Miguel de Icaza <miguel@ximian.com>
4724 * namespace.cs (VerifyUsing): use GetPartialName instead of
4727 2004-11-05 Miguel de Icaza <miguel@ximian.com>
4729 * statement.cs (Return.Resolve): Fix regression in typo: if
4730 `in_exc', we have to request a NeedReturnLabel, this was a typo
4731 introduced in the anonymous method check-in. Fixes #69131.
4733 * Indexers were using the ShortName when defining themselves,
4734 causing a regression in the compiler bootstrap when applying the
4735 patch from 2004-11-02 (first part), now they use their full name
4736 and the bug is gone.
4738 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
4740 * driver.cs: Strip the path from the names of embedded resources. Fixes
4743 2004-11-04 Raja R Harinath <rharinath@novell.com>
4745 Fix error message regression: cs0104-2.cs.
4746 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
4747 (AliasEntry.Resolve): Update.
4748 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
4750 (RootContext.LookupType): Update.
4752 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
4754 * cs-parser.jay: Add support for handling accessor modifiers
4755 * class: Add support port accessor modifiers and error checking,
4756 define PropertyMethod.Define as virtual (not abstract anymore)
4757 * ecore.cs: Add checking for proeprties access with access modifiers
4758 * iterators.cs: Modify Accessor constructor call based in the modified
4760 2004-11-02 Ben Maurer <bmaurer@ximian.com>
4762 * expression.cs (StringConcat): Handle being called twice,
4763 as when we have a concat in a field init with more than two
4766 2004-11-02 Miguel de Icaza <miguel@ximian.com>
4768 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
4769 special case explicit implementations, we should always produce
4770 the .property or .event declaration.
4772 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
4773 since it will not return correct data if people use this
4774 unresolved in the presence of using statements (see test-313).
4776 * class.cs (MethodData.Define): If we are an explicit interface
4777 implementation, set the method name to the full name of the
4778 interface plus the name of the method.
4780 Notice that using the method.MethodName.GetFullName() does not
4781 work, as it will only contain the name as declared on the source
4782 file (it can be a shorthand in the presence of using statements)
4783 and not the fully qualifed type name, for example:
4787 class D : ICloneable {
4788 object ICloneable.Clone () {
4792 Would produce a method called `ICloneable.Clone' instead of
4793 `System.ICloneable.Clone'.
4795 * namespace.cs (Alias.Resolve): Use GetPartialName.
4797 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4799 * cs-parser.jay: Add error 1055 report.
4801 2004-11-01 Miguel de Icaza <miguel@ximian.com>
4803 * assign.cs (Assign.DoResolve): Only do the transform of
4804 assignment into a New if the types are compatible, if not, fall
4805 through and let the implicit code deal with the errors and with
4806 the necessary conversions.
4808 2004-11-01 Marek Safar <marek.safar@seznam.cz>
4810 * cs-parser.jay: Add error 1031 report.
4812 * cs-tokenizer.cs: Add location for error 1038.
4814 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4816 * cs-parser.jay: Add error 1016 report.
4818 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4820 * cs-parser.jay: Add errors 1575,1611 report.
4822 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4824 * cs-parser.jay: Add error 1001 report.
4826 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4829 * attribute.cs (GetMarshal): Add method argument for
4830 caller identification.
4832 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
4833 agument for GetMarshal and RuntimeMissingSupport.
4835 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4837 * attribute.cs (ExtractSecurityPermissionSet): Removed
4838 TypeManager.code_access_permission_type.
4840 * typemanager.cs: Removed TypeManager.code_access_permission_type.
4842 2004-10-27 Miguel de Icaza <miguel@ximian.com>
4844 * expression.cs (LocalVariableReference.DoResolveLValue): Check
4845 for obsolete use of a variable here. Fixes regression on errors
4846 cs0619-25 and cs0619-26.
4848 2004-10-27 Marek Safar <marek.safar@seznam.cz>
4850 Fix #62358, implemented security attribute encoding.
4852 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
4853 Tests permitted SecurityAction for assembly or other types.
4854 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
4855 data from SecurityPermissionAttribute to PermisionSet class.
4857 * class.cs (ApplyAttributeBuilder): Added special handling
4858 for System.Security.Permissions.SecurityAttribute based types.
4860 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
4861 special handling for System.Security.Permissions.SecurityAttribute
4864 * enum.cs (ApplyAttributeBuilder): Added special handling
4865 for System.Security.Permissions.SecurityAttribute based types.
4867 * parameter.cs (ApplyAttributeBuilder): Added special handling
4868 for System.Security.Permissions.SecurityAttribute based types.
4870 * rootcontext.cs: Next 2 core types.
4872 * typemanager.cs (TypeManager.security_permission_attr_type):
4873 Built in type for the SecurityPermission Attribute.
4874 (code_access_permission_type): Build in type.
4876 2004-10-17 Miguel de Icaza <miguel@ximian.com>
4878 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
4879 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
4880 all of this information into
4881 EmitContext.EmitCapturedVariableInstance.
4883 * codegen.cs (EmitCapturedVariableInstance): move here the
4884 funcionality of emitting an ldarg.0 in the presence of a
4885 remapping. This centralizes the instance emit code.
4887 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
4888 then emit a load of this: it means that we have reached the
4889 topmost ScopeInfo: the one that contains the pointer to the
4890 instance of the class hosting the anonymous method.
4892 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
4893 captures to the topmost CaptureContext.
4895 2004-10-12 Miguel de Icaza <miguel@ximian.com>
4897 * expression.cs (LocalVariableReference): Move the knowledge about
4898 the iterators into codegen's EmitCapturedVariableInstance.
4900 2004-10-11 Miguel de Icaza <miguel@ximian.com>
4902 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
4903 all code paths return a value from an anonymous method (it is the
4904 same as the 161 error, but for anonymous methods).
4906 2004-10-08 Miguel de Icaza <miguel@ximian.com>
4908 The introduction of anonymous methods in the compiler changed
4909 various ways of doing things in the compiler. The most
4910 significant one is the hard split between the resolution phase
4911 and the emission phases of the compiler.
4913 For instance, routines that referenced local variables no
4914 longer can safely create temporary variables during the
4915 resolution phase: they must do so from the emission phase,
4916 since the variable might have been "captured", hence access to
4917 it can not be done with the local-variable operations from the runtime.
4921 (Block.Flags): New flag `IsTopLevel' to indicate that this block
4922 is a toplevel block.
4924 (ToplevelBlock): A new kind of Block, these are the blocks that
4925 are created by the parser for all toplevel method bodies. These
4926 include methods, accessors and anonymous methods.
4928 These contain some extra information not found in regular blocks:
4929 A pointer to an optional CaptureContext (for tracking captured
4930 local variables and parameters). A pointer to the parent
4933 (Return.Resolve): Catch missmatches when returning a value from an
4934 anonymous method (error 1662).
4935 Invoke NeedReturnLabel from the Resolve phase instead of the emit
4938 (Break.Resolve): ditto.
4940 (SwitchLabel): instead of defining the labels during the
4941 resolution phase, we now turned the public ILLabel and ILLabelCode
4942 labels into methods called GetILLabelCode() and GetILLabel() that
4943 only define the label during the Emit phase.
4945 (GotoCase): Track the SwitchLabel instead of the computed label
4946 (its contained therein). Emit the code by using
4947 SwitchLabel.GetILLabelCode ().
4949 (LocalInfo.Flags.Captured): A new flag has been introduce to track
4950 whether the Local has been captured or not.
4952 (LocalInfo.IsCaptured): New property, used to tell whether the
4953 local has been captured.
4955 * anonymous.cs: Vastly updated to contain the anonymous method
4958 The main classes here are: CaptureContext which tracks any
4959 captured information for a toplevel block and ScopeInfo used to
4960 track the activation frames for various local variables.
4962 Each toplevel block has an optional capture context associated
4963 with it. When a method contains an anonymous method both the
4964 toplevel method and the anonymous method will create a capture
4965 context. When variables or parameters are captured, they are
4966 recorded on the CaptureContext that owns them, for example:
4970 MyDelegate d = delegate {
4975 Here `a' will be recorded as captured on the toplevel
4976 CapturedContext, the inner captured context will not have anything
4977 (it will only have data if local variables or parameters from it
4978 are captured in a nested anonymous method.
4980 The ScopeInfo is used to track the activation frames for local
4981 variables, for example:
4983 for (int i = 0; i < 10; i++)
4984 for (int j = 0; j < 10; j++){
4985 MyDelegate d = delegate {
4990 At runtime this captures a single captured variable `i', but it
4991 captures 10 different versions of the variable `j'. The variable
4992 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
4993 recorded on a child.
4995 The toplevel ScopeInfo will also track information like the `this'
4996 pointer if instance variables were referenced (this is necessary
4997 as the anonymous method lives inside a nested class in the host
4998 type of the method).
5000 (AnonymousMethod): Expanded to track the Toplevel, implement
5001 `AnonymousMethod.Compatible' to tell whether an anonymous method
5002 can be converted to a target delegate type.
5004 The routine now also produces the anonymous method content
5006 (AnonymousDelegate): A helper class that derives from
5007 DelegateCreation, this is used to generate the code necessary to
5008 produce the delegate for the anonymous method that was created.
5010 * assign.cs: API adjustments for new changes in
5011 Convert.ImplicitStandardConversionExists.
5013 * class.cs: Adjustments to cope with the fact that now toplevel
5014 blocks are of type `ToplevelBlock'.
5016 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
5017 insteda of standard blocks.
5019 Flag errors if params arguments are passed to anonymous methods.
5021 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
5022 `CurrentAnonymousMethod' which points to the current Anonymous
5023 Method. The variable points to the AnonymousMethod class that
5024 holds the code being compiled. It is set in the new EmitContext
5025 created for the anonymous method.
5027 (EmitContext.Phase): Introduce a variable and an enumeration to
5028 assist in enforcing some rules about when and where we are allowed
5029 to invoke certain methods (EmitContext.NeedsReturnLabel is the
5030 only one that enfonces this right now).
5032 (EmitContext.HaveCaptureInfo): new helper method that returns
5033 whether we have a CapturedContext initialized.
5035 (EmitContext.CaptureVariable): New method used to register that a
5036 LocalInfo must be flagged for capturing.
5038 (EmitContext.CapturedParameter): New method used to register that a
5039 parameters must be flagged for capturing.
5041 (EmitContext.CapturedField): New method used to register that a
5042 field must be flagged for capturing.
5044 (EmitContext.HaveCapturedVariables,
5045 EmitContext.HaveCapturedFields): Return whether there are captured
5046 variables or fields.
5048 (EmitContext.EmitMethodHostInstance): This is used to emit the
5049 instance for the anonymous method. The instance might be null
5050 (static methods), this (for anonymous methods that capture nothing
5051 and happen to live side-by-side with the current method body) or a
5052 more complicated expression if the method has a CaptureContext.
5054 (EmitContext.EmitTopBlock): Routine that drives the emission of
5055 code: it will first resolve the top block, then emit any metadata
5056 and then emit the code. The split is done so that we can extract
5057 any anonymous methods and flag any captured variables/parameters.
5059 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
5060 during this phase, the ILGenerator should not be used as labels
5061 and local variables declared here might not be accessible to any
5062 code that is part of an anonymous method.
5064 Exceptions to this include the temporary variables that are
5065 created by some statements internally for holding temporary
5068 (EmitContext.EmitMeta): New routine, in charge of emitting all the
5071 (EmitContext.TemporaryReturn): This method is typically called
5072 from the Emit phase, and its the only place where we allow the
5073 ReturnLabel to be defined other than the EmitMeta. The reason is
5074 that otherwise we would have to duplicate a lot of logic in the
5075 Resolve phases of various methods that today is on the Emit
5078 (EmitContext.NeedReturnLabel): This no longer creates the label,
5079 as the ILGenerator is not valid during the resolve phase.
5081 (EmitContext.EmitThis): Extended the knowledge in this class to
5082 work in anonymous methods in addition to iterators.
5084 (EmitContext.EmitCapturedVariableInstance): This emits whatever
5085 code is necessary on the stack to access the instance to a local
5086 variable (the variable will be accessed as a field).
5088 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
5089 EmitContext.EmitAddressOfParameter): Routines to support
5090 parameters (not completed at this point).
5092 Removals: Removed RemapLocal and RemapLocalLValue. We probably
5093 will also remove the parameters.
5095 * convert.cs (Convert): Define a `ConstantEC' which points to a
5096 null. This is just to prefity some code that uses
5097 ImplicitStandardConversion code and do not have an EmitContext
5100 The idea is to flag explicitly that at that point in time, it is
5101 known that the conversion will not trigger the delegate checking
5102 code in implicit conversions (which requires a valid
5105 Everywhere: pass new EmitContext parameter since
5106 ImplicitStandardConversionExists now requires it to check for
5107 anonymous method conversions.
5109 (Convert.ImplicitStandardConversionExists): If the type of an
5110 expression is the anonymous_method_type, and the type is a
5111 delegate, we invoke the AnonymousMethod.Compatible method to check
5112 whether an implicit conversion is possible.
5114 (Convert.ImplicitConversionStandard): Only do implicit method
5115 group conversions if the language level is not ISO_1.
5117 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
5118 MethodInfo for the Invoke method. used by Delegate and
5121 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
5122 method conversions if the target type is a delegate.
5124 Removed extra debugging nops.
5126 (LocalVariableReference): Turn the `local_info' into a public
5129 Add `prepared' field, the same hack used for FieldExprs to cope
5130 with composed assignments, as Local variables do not necessarily
5131 operate purely on the stack as they used to: they can be captured
5134 Add `temp' for a temporary result, like fields.
5136 Refactor DoResolve and DoResolveLValue into DoResolveBase.
5138 It now copes with Local variables that are captured and emits the
5139 proper instance variable to load it from a field in the captured
5142 (ParameterReference.DoResolveBase): During the resolve phase,
5143 capture parameters if we are in an anonymous method.
5145 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
5146 anonymous method, use the EmitContext helper routines to emit the
5147 parameter reference.
5149 * iterators.cs: Set RemapToProxy to true/false during the
5152 * parameters.cs (GetParameterByName): New helper method.
5154 * typemanager.cs (anonymous_method_type) a new type that
5155 represents an anonyous method. This is always an internal type,
5156 used as a fencepost to test against the anonymous-methodness of an
5159 2004-10-20 Marek Safar <marek.safar@seznam.cz>
5161 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
5163 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
5165 2004-10-18 Martin Baulig <martin@ximian.com>
5167 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
5168 `Type' directly, but call ResolveType() on it.
5169 (Catch.Resolve): Likewise.
5170 (Foreach.Resolve): Likewise.
5172 2004-10-18 Martin Baulig <martin@ximian.com>
5174 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
5175 `Type' directly, but call ResolveType() on it.
5176 (Probe.DoResolve): Likewise.
5177 (ArrayCreation.LookupType): Likewise.
5178 (TypeOf.DoResolve): Likewise.
5179 (SizeOf.DoResolve): Likewise.
5181 2004-10-18 Martin Baulig <martin@ximian.com>
5183 * expression.cs (Invocation.BetterFunction): Put back
5184 TypeManager.TypeToCoreType().
5186 2004-10-18 Raja R Harinath <rharinath@novell.com>
5188 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
5191 2004-10-18 Martin Baulig <martin@ximian.com>
5193 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
5194 `Type' directly, but call ResolveType() on it.
5196 2004-10-18 Martin Baulig <martin@ximian.com>
5198 * class.cs (FieldMember.Define): Don't access the TypeExpr's
5199 `Type' directly, but call ResolveType() on it.
5200 (MemberBase.DoDefine): Likewise.
5202 * expression.cs (New.DoResolve): Don't access the TypeExpr's
5203 `Type' directly, but call ResolveType() on it.
5204 (ComposedCast.DoResolveAsTypeStep): Likewise.
5206 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
5207 `Type' directly, but call ResolveType() on it.
5209 2004-10-17 John Luke <john.luke@gmail.com>
5211 * class.cs (Operator.GetSignatureForError): use CSharpName
5213 * parameter.cs (Parameter.GetSignatureForError): Returns
5214 correct name even if was not defined.
5216 2004-10-13 Raja R Harinath <rharinath@novell.com>
5219 * class.cs (TypeContainer.EmitContext): New property.
5220 (DefineNestedTypes): Create an emitcontext for each part.
5221 (MethodCore.DoDefineParameters): Use container's emitcontext.
5222 Pass type array to InternalParameters.
5223 (MemberBase.DoDefine): Use container's emitcontext.
5224 (FieldMember.Define): Likewise.
5225 (Event.Define): Likewise.
5226 (SetMethod.GetParameterInfo): Change argument to EmitContext.
5227 Pass type array to InternalParameters.
5228 (SetIndexerMethod.GetParameterInfo): Likewise.
5229 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
5230 * delegate.cs (Define): Pass emitcontext to
5231 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
5232 array to InternalParameters.
5233 * expression.cs (ParameterReference.DoResolveBase): Pass
5234 emitcontext to GetParameterInfo.
5235 (ComposedCast.DoResolveAsTypeStep): Remove check on
5236 ec.ResolvingTypeTree.
5237 * parameter.cs (Parameter.Resolve): Change argument to
5238 EmitContext. Use ResolveAsTypeTerminal.
5239 (Parameter.GetSignature): Change argument to EmitContext.
5240 (Parameters.ComputeSignature): Likewise.
5241 (Parameters.ComputeParameterTypes): Likewise.
5242 (Parameters.GetParameterInfo): Likewise.
5243 (Parameters.ComputeAndDefineParameterTypes): Likewise.
5244 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
5245 * support.cs (InternalParameters..ctor): Remove variant that takes
5247 * typemanager.cs (system_intptr_expr): New.
5248 (InitExpressionTypes): Initialize it.
5250 2004-10-12 Chris Toshok <toshok@ximian.com>
5252 * cs-parser.jay: fix location for try_statement and catch_clause.
5254 2004-10-11 Martin Baulig <martin@ximian.com>
5256 * report.cs: Don't make --fatal abort on warnings, we have
5257 -warnaserror for that.
5259 2004-10-07 Raja R Harinath <rharinath@novell.com>
5261 More DeclSpace.ResolveType avoidance.
5262 * decl.cs (MemberCore.InUnsafe): New property.
5263 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
5264 with newly created EmitContext.
5265 (FieldMember.Define): Likewise.
5266 * delegate.cs (Delegate.Define): Likewise.
5267 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
5268 only if normal name-lookup fails.
5269 (TypeExpr.DoResolve): Enable error-checking.
5270 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
5271 (SizeOf.DoResolve): Likewise.
5272 (ComposedCast.DoResolveAsTypeStep): Likewise.
5273 (StackAlloc.DoResolve): Likewise.
5274 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
5275 (Block.Unsafe): New property.
5276 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
5277 (Unsafe): Set 'unsafe' flag of contained block.
5278 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
5279 (Fixed.Resolve): Likewise.
5280 (Catch.Resolve): Likewise.
5281 (Using.ResolveLocalVariableDecls): Likewise.
5282 (Foreach.Resolve): Likewise.
5284 2004-10-05 John Luke <john.luke@gmail.com>
5286 * cs-parser.jay: add location to error CS0175
5288 2004-10-04 Miguel de Icaza <miguel@ximian.com>
5290 * ecore.cs (Expression.Constantity): Add support for turning null
5293 * const.cs (Const.Define): Allow constants to be reference types
5294 as long as the value is Null.
5296 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
5298 * namespace.cs (NamespaceEntry.Using): No matter which warning
5299 level is set, check if this namespace name has already been added.
5301 2004-10-03 Ben Maurer <bmaurer@ximian.com>
5303 * expression.cs: reftype [!=]= null should always use br[true,false].
5306 2004-10-03 Marek Safar <marek.safar@seznam.cz>
5309 * attribute.cs: Enum conversion moved to
5310 GetAttributeArgumentExpression to be applied to the all
5313 2004-10-01 Raja R Harinath <rharinath@novell.com>
5315 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
5316 * class.c (TypeContainer.DefineType): Flag error if
5317 base types aren't accessible due to access permissions.
5318 * decl.cs (DeclSpace.ResolveType): Move logic to
5319 Expression.ResolveAsTypeTerminal.
5320 (DeclSpace.ResolveTypeExpr): Thin layer over
5321 Expression.ResolveAsTypeTerminal.
5322 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
5323 Refactor code into NestedAccess. Use it.
5324 (DeclSpace.NestedAccess): New.
5325 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
5326 argument to silence errors. Check access permissions.
5327 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
5328 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
5329 (Cast.DoResolve): Likewise.
5330 (New.DoResolve): Likewise.
5331 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
5332 (TypeOf.DoResolve): Likewise.
5334 * expression.cs (Invocation.BetterConversion): Return the Type of
5335 the better conversion. Implement section 14.4.2.3 more faithfully.
5336 (Invocation.BetterFunction): Make boolean. Make correspondence to
5337 section 14.4.2.2 explicit.
5338 (Invocation.OverloadResolve): Update.
5339 (Invocation): Remove is_base field.
5340 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
5341 (Invocation.Emit): Likewise.
5343 2004-09-27 Raja R Harinath <rharinath@novell.com>
5345 * README: Update to changes.
5347 2004-09-24 Marek Safar <marek.safar@seznam.cz>
5349 * cs-parser.jay: Reverted 642 warning fix.
5351 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5354 * decl.cs (FindMemberWithSameName): Indexer can have more than
5357 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5359 * expression.cs (LocalVariableReference.DoResolveLValue):
5360 Do not report warning 219 for out values.
5361 (EmptyExpression.Null): New member to avoid extra allocations.
5363 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5365 * cs-parser.jay: Fix wrong warning 642 report.
5367 * cs-tokenizer.cs (CheckNextToken): New helper;
5368 Inspect next character if is same as expected.
5370 2004-09-23 Martin Baulig <martin@ximian.com>
5372 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
5373 (Convert.ImplicitReferenceConversionExists): Likewise.
5375 2004-09-23 Marek Safar <marek.safar@seznam.cz>
5377 * class.cs (Operator.Define): Add error 448 and 559 report.
5379 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5381 * class.cs (MemberBase.IsTypePermitted): New protected
5382 method for checking error CS0610.
5384 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5386 * class.cs (TypeContainer.HasExplicitLayout): New property
5387 Returns whether container has StructLayout attribute set Explicit.
5388 (FieldMember): New abstract class for consts and fields.
5389 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
5390 (Field): Reuse FieldMember.
5392 * const.cs (Const): Reuse FieldMember.
5394 * rootcontext.cs: EmitConstants call moved to class.
5396 2004-09-22 Martin Baulig <martin@ximian.com>
5398 Thanks to Peter Sestoft for this bug report.
5400 * expression.cs (Conditional): If both the `trueExpr' and the
5401 `falseExpr' is a NullLiteral, return a NullLiteral.
5403 2004-09-22 Martin Baulig <martin@ximian.com>
5405 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
5406 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
5407 for the "get_Current" call.
5409 2004-09-22 Martin Baulig <martin@ximian.com>
5411 Marek and me just fixed one of our oldest bugs: #28562 :-)
5413 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
5415 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
5416 we're an EnumConstant, just return that.
5417 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
5418 an EnumConstant. In this case, we need to use GetValueAsEnumType()
5419 to get the value which'll actually be written into the attribute.
5420 However, we have to use GetValue() to access the attribute's value
5423 2004-09-22 Marek Safar <marek.safar@seznam.cz>
5425 * constant.cs (Constant.IsNegative): New abstract property
5428 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
5429 (StackAlloc.DoResolve): Reused IsNegative.
5431 2004-09-21 Martin Baulig <martin@ximian.com>
5433 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
5434 if we're used in an iterator, we may be called from different
5437 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
5438 we actually have an exception block.
5440 2004-09-20 John Luke <jluke@cfl.rr.com>
5442 * class.cs, cs-parser.jay: Improve the error report for 1520:
5443 report the actual line where the error happens, not where the
5446 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
5447 Pass location information that was available elsewhere.
5449 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
5451 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
5452 runtime to delay sign assemblies.
5454 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5456 * cs-parser.jay: Do not report the stack trace, this is barely
5459 2004-08-22 John Luke <john.luke@gmail.com>
5461 * driver.cs : check that a resource id is not already used
5462 before adding it, report CS1508 if it is, bug #63637
5464 2004-09-19 Miguel de Icaza <miguel@ximian.com>
5466 * ecore.cs: Removed dead code.
5468 2004-09-18 Marek Safar <marek.safar@seznam.cz>
5470 * class.cs: Do not report warning CS0067 on the interfaces.
5472 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5474 * cs-parser.jay: Add error 504 report.
5476 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5478 * rootcontext.cs: WarningLevel is 4 by default now.
5480 * statement.cs (Fixed.Resolve): Do not null
5483 2004-09-16 Marek Safar <marek.safar@seznam.cz>
5486 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
5487 deep search when property is not virtual.
5488 (PropertyExpr.ResolveAccessors): Make one call for both
5491 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5494 * statement.cs: Error 152 report constains also location.
5496 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5499 * const.cs: Explicitly set constant as static.
5501 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5504 * cs-parser.jay: Add error 1017 report.
5506 2004-09-15 Marek Safar <marek.safar@seznam.cz>
5508 Fixed bug #59980, #64224
5509 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
5511 * typemanager.cs (IsSpecialMethod): Simplified
5513 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5515 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
5516 condition with better params.
5518 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5521 * attribute.cs (Resolve): Property has to have both
5524 2004-09-14 Martin Baulig <martin@ximian.com>
5526 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
5528 2004-09-14 Marek Safar <marek.safar@seznam.cz>
5531 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
5532 called and is obsolete then this member suppress message
5533 when call is inside next [Obsolete] method or type.
5535 * expression.cs: Use TestObsoleteMethodUsage member.
5537 2004-09-14 Martin Baulig <martin@ximian.com>
5539 * cs-parser.jay: Sync a bit with the GMCS version.
5541 2004-09-14 Martin Baulig <martin@ximian.com>
5543 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
5544 (CSharpParser.yacc_verbose_flag): New public field.
5546 * genericparser.cs: Removed.
5548 2004-09-14 Raja R Harinath <rharinath@novell.com>
5550 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
5552 2004-09-13 Marek Safar <marek.safar@seznam.cz>
5554 * class.cs (MethodCore.CheckBase): Fix bug #65757.
5556 2004-09-10 Martin Baulig <martin@ximian.com>
5558 Backported my MemberName changes from GMCS into MCS.
5560 - we are now using a special `MemberName' class instead of using
5561 strings; in GMCS, the `MemberName' also contains the type
5564 - changed the grammar rules a bit:
5565 * the old `member_name' is now a `namespace_or_type_name':
5566 The rule is that we use `namespace_or_type_name' everywhere
5567 where we expect either a "member name" (GetEnumerator) or a
5568 "member name" with an explicit interface name
5569 (IEnumerable.GetEnumerator).
5570 In GMCS, the explicit interface name may include type arguments
5571 (IEnumerable<T>.GetEnumerator).
5572 * we use `member_name' instead of just `IDENTIFIER' for
5574 The rule is that we use `member_name' wherever a member may
5575 have type parameters in GMCS.
5577 * decl.cs (MemberName): New public class.
5578 (MemberCore.MemberName): New public readonly field.
5579 (MemberCore.ctor): Take a `MemberName' argument, not a string.
5580 (DeclSpace): Likewise.
5582 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
5583 * enum.cs (Enum.ctor): Likewise.
5585 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
5587 (AliasEntry.ctor): Take a MemberName, not an Expression.
5588 (AliasEntry.UsingAlias): Likewise.
5590 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
5591 (IMethodData.MemberName): Changed type from string to MemberName.
5592 (MemberBase.ExplicitInterfaceName): Likewise.
5593 (AbstractPropertyEventMethod.SetupName): Make this private.
5594 (AbstractPropertyEventMethod.ctor): Added `string prefix'
5595 argument; compute the member name here.
5596 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
5597 on the `member.MemberName' and the `prefix'.
5599 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
5601 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
5602 thus, we get a `MemberName' instead of a `string'. These
5603 declarations may have type parameters in GMCS.
5604 (interface_method_declaration, delegate_declaration): Likewise.
5605 (class_declaration, interface_declaration): Likewise.
5606 (method_header): Use `namespace_or_type_name' instead of
5607 `member_name'. We may be an explicit interface implementation.
5608 (property_declaration, event_declaration): Likewise.
5609 (member_name): This is now just an `IDENTIFIER', not a
5610 `namespace_or_type_name'.
5611 (type_name, interface_type): Removed.
5612 (namespace_or_type_name): Return a MemberName, not an Expression.
5613 (primary_expression): Use `member_name' instead of `IDENTIFIER';
5614 call GetTypeExpression() on the MemberName to get an expression.
5615 (IndexerDeclaration.interface_type): Changed type from string to
5617 (MakeName): Operate on MemberName's instead of string's.
5619 2004-09-13 Raja R Harinath <rharinath@novell.com>
5622 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
5623 (NamespaceEntry.Lookup): Add new argument to flag if we want the
5624 lookup to avoid symbols introduced by 'using'.
5625 * rootcontext.cs (NamespaceLookup): Update.
5627 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5629 * class.cs (TypeContainer.DoDefineMembers): Do not call
5630 DefineDefaultConstructor for static classes.
5632 2004-09-12 Marek Safar <marek.safar@seznam.cz>
5634 * attribute.cs (Attribute.Resolve): Add error 653 report.
5636 * class.cs (Class.ApplyAttributeBuilder): Add error 641
5638 (Method.ApplyAttributeBuilder): Add error 685 report.
5639 (Operator.Define): Add error 564 report.
5641 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
5643 * expression.cs (Invocation.DoResolve): Add error
5646 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
5649 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5651 * class.cs (ConstructorInitializer.Resolve):
5652 Wrong error number (515->516).
5654 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5656 * class.cs (Indexer.Define): Add error 631 report.
5658 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5660 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
5662 2004-09-11 Marek Safar <marek.safar@seznam.cz>
5664 * expression.cs (Probe.DoResolve): Add error CS0241 report.
5666 2004-09-10 Marek Safar <marek.safar@seznam.cz>
5668 * cs-parser.jay: Added error CS0241 report.
5670 2004-09-10 Raja R Harinath <rharinath@novell.com>
5672 * cs-parser.jay (fixed_statement): Introduce a scope for the
5673 declaration in the 'fixed' statement.
5675 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5677 * cs-parser.jay: Added CS0230 error report.
5679 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5681 * cs-parser.jay: Added errors CS0231 and CS0257 report.
5683 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5685 * expression.cs (Argument.Resolve): Added error CS0192 and
5688 2004-09-09 Marek Safar <marek.safar@seznam.cz>
5690 C# 2.0 #pragma warning feature
5692 * cs-tokenizer.cs (PreProcessPragma): New method;
5693 Handles #pragma directive.
5695 * report.cs (WarningRegions): New class; Support
5696 class for #pragma warning directive. It tests whether
5697 warning is enabled for a given line.
5699 2004-09-08 Miguel de Icaza <miguel@ximian.com>
5701 * const.cs: Add more descriptive error report, tahnks to
5704 2004-09-08 Marek Safar <marek.safar@seznam.cz>
5706 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
5708 2004-09-07 Miguel de Icaza <miguel@ximian.com>
5710 * expression.cs: Apply patch from Ben: Remove dead code from
5711 ArrayCreation, and remove the TurnintoConstant call in const.cs,
5712 as that code just threw an exception anwyays.
5714 * const.cs: Remove the call to the turnintoconstant, for details
5717 * literal.cs: The type of the null-literal is the null type; So
5718 we use a placeholder type (literal.cs:System.Null, defined here)
5721 * expression.cs (Conditional.DoResolve): Remove some old code that
5722 is no longer needed, conversions have been fixed.
5724 (ArrayCreationExpression.DoResolve): Return false if we fail to
5725 resolve the inner expression.
5727 2004-09-07 Raja R Harinath <rharinath@novell.com>
5730 * cs-parser.jay (delegate_declaration): Record a delegate
5731 declaration as a type declaration.
5732 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
5734 2004-09-06 Miguel de Icaza <miguel@ximian.com>
5736 * parameter.cs: Do not crash if the type can not be resolved.
5738 * expression.cs: Report errors with unsafe pointers, fixes #64896
5740 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
5742 * expression.cs: Pointer arith always needs to do a conv.i
5743 if the operand is a long. fix 65320
5745 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5747 Fixed cs0619-37.cs, cs0619-38.cs
5749 * enum.cs (GetObsoleteAttribute): Removed.
5751 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
5752 on Enum member is double staged. The first is tested member
5755 2004-09-04 Marek Safar <marek.safar@seznam.cz>
5757 Fixed #56986, #63631, #65231
5759 * class.cs: (TypeContainer.AddToMemberContainer): New method,
5760 adds member to name container.
5761 (TypeContainer.AddToTypeContainer): New method, adds type to
5763 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
5764 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
5765 AddOperator): Simplified by reusing AddToMemberContainer.
5766 (TypeContainer.UserDefinedStaticConstructor): Changed to property
5768 (Method.CheckForDuplications): Fixed implementation to test all
5770 (MemberBase): Detection whether member is explicit interface
5771 implementation is now in constructor.
5772 (MemberBase.UpdateMemberName): Handles IndexerName.
5773 (Accessor): Changed to keep also location information.
5774 (AbstractPropertyEventMethod): Is derived from MemberCore.
5775 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
5776 will be emited or not.
5777 (PropertyBase.AreAccessorsDuplicateImplementation):
5778 Tests whether accessors are not in collision with some method.
5779 (Operator): Is derived from MethodCore to simplify common
5782 * decl.cs (Flags.TestMethodDuplication): Test for duplication
5784 (DeclSpace.AddToContainer): Adds the member to defined_names
5785 table. It tests for duplications and enclosing name conflicts.
5787 * enum.cs (EnumMember): Clean up to reuse the base structures
5789 2004-09-03 Martin Baulig <martin@ximian.com>
5791 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
5792 into TypeContainer, to make partial classes work again.
5794 2004-09-03 Martin Baulig <martin@ximian.com>
5796 * rootcontext.cs (RootContext.V2): Removed.
5798 2004-03-23 Martin Baulig <martin@ximian.com>
5800 * expression.cs (Invocation.OverloadResolve): Added `bool
5801 may_fail' argument and use it instead of the Location.IsNull() hack.
5803 2004-09-03 Martin Baulig <martin@ximian.com>
5805 Merged latest changes into gmcs. Please keep this comment in
5806 here, it makes it easier for me to see what changed in MCS since
5807 the last time I merged.
5809 2004-09-03 Raja R Harinath <rharinath@novell.com>
5812 * expression.cs (BetterConversion): Don't allow either conversion
5813 to be null. Remove redundant implicit conversion test when 'q ==
5814 null' -- when this function is invoked, we already know that the
5815 implicit conversion exists.
5816 (BetterFunction): Assume that 'best' is non-null. Remove
5817 redundant reimplementation of IsApplicable when 'best' is null.
5818 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
5819 number of arguments.
5820 (IsAncestralType): Extract from OverloadResolve.
5821 (OverloadResolve): Make robust to the MethodGroupExpr being
5822 unsorted. Implement all the logic of Section 14.5.5.1, and
5823 support overloading of methods from multiple applicable types.
5824 Clean up logic somewhat. Don't pass null methods to BetterFunction.
5826 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
5827 (RealError, Warning): Append type of report to related symbol.
5829 2004-09-03 Marek Safar <marek.safar@seznam.cz>
5831 * enum.cs: Fixed CLS-Compliance checks for enum members.
5832 Error tests cs3008-8.cs, cs3014-8.cs
5834 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5836 Fixed bug #62342, #63102
5837 * class.cs: ImplementIndexer uses member.IsExplicitImpl
5838 like ImplementMethod.
5840 2004-09-02 Marek Safar <marek.safar@seznam.cz>
5842 * attribute.cs (Attribute.GetAttributeArgumentExpression):
5845 2004-09-02 Martin Baulig <martin@ximian.com>
5847 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
5848 TypeManager.GetArgumentTypes() rather than calling GetParameters()
5851 2004-09-01 Marek Safar <marek.safar@seznam.cz>
5853 C# 2.0 Static classes implemented
5855 * class.cs (TypeContainer): instance_constructors,
5856 initialized_fields, initialized_static_fields,
5857 default_constructor, base_inteface_types are protected to be
5858 accessible from StaticClass.
5859 (TypeContainer.DefineDefaultConstructor): New virtual method
5860 for custom default constructor generating
5861 (StaticClass): New class to handle "Static classes" feature.
5863 * cs-parser.jay: Handle static keyword on class like instance
5866 * driver.cs: Added "/langversion" command line switch with two
5867 options (iso-1, default).
5869 2004-08-31 Marek Safar <marek.safar@seznam.cz>
5871 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
5873 2004-08-31 Miguel de Icaza <miguel@ximian.com>
5875 * delegate.cs: Style.
5877 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
5879 * delegate.cs: Add seperate instance expr field for miguel.
5881 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5883 * PointerArithmetic (Resolve): make sure we are not doing
5884 pointer arith on void*. Also, make sure we are resolved
5885 by not setting eclass until resolve.
5887 All callers: Make sure that PointerArithmetic gets resolved.
5889 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
5891 * ArrayCreation (LookupType): If the type does not resolve
5892 to an array, give an error.
5894 2004-08-27 Marek Safar <marek.safar@seznam.cz>
5896 * statement.cs (Try.Resolve): Fixed bug #64222
5898 2004-08-27 Martin Baulig <martin@ximian.com>
5901 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
5904 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5906 * ecore.cs (Constantify): Get underlying type via
5907 System.Enum.GetUnderlyingType to avoid StackOverflow on the
5908 Windows in special cases.
5910 2004-08-26 Marek Safar <marek.safar@seznam.cz>
5912 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
5913 for obtaining also private methods.
5914 (GetRemoveMethod): Used GetRemoveMethod (true)
5915 for obtaining also private methods.
5917 2004-08-24 Martin Baulig <martin@ximian.com>
5919 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
5920 MethodAttributes.HideBySig for operators.
5922 2004-08-23 Martin Baulig <martin@ximian.com>
5924 Back to the old error reporting system :-)
5926 * report.cs (Message): Removed.
5927 (Report.MessageData, ErrorData, WarningData): Removed.
5928 (Report.Error, Warning): Back to the old system.
5930 2004-08-23 Martin Baulig <martin@ximian.com>
5932 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
5934 * class.cs (TypeContainer.ParentContainer): New public virtual
5935 method; replaces the explicit interface implementation.
5936 (ClassPart.ParentContainer): Override.
5938 2004-08-23 Martin Baulig <martin@ximian.com>
5940 * statement.cs (Switch): Added support for constant switches; see
5941 #59428 or test-285.cs.
5943 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5946 * statement.cs (GetEnumeratorFilter): Removed useless
5947 logic because C# specs is strict. GetEnumerator must be
5950 2004-08-22 Martin Baulig <martin@ximian.com>
5952 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
5953 a switch and may break, reset the barrier. Fixes #59867.
5955 2004-08-22 Marek Safar <marek.safar@seznam.cz>
5957 CLS-Compliance speed up (~5% for corlib)
5959 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
5960 New method. Tests container for CLS-Compliant names
5962 * class.cs (TypeContainer.VerifyClsName): New method.
5963 Checks whether container name is CLS Compliant.
5964 (Constructor): Implements IMethodData.
5966 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
5967 low-case table for CLS Compliance test.
5968 (MemberCache.VerifyClsParameterConflict): New method.
5969 Checks method parameters for CS3006 error.
5971 * enum.cs (EnumMember): Is derived from MemberCore.
5972 (Enum.VerifyClsName): Optimized for better performance.
5974 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5976 * report.cs: Renamed Error_T to Error and changed all
5979 2004-08-06 Marek Safar <marek.safar@seznam.cz>
5981 * class.cs (TypeContainer.IndexerArrayList): New inner class
5982 container for indexers.
5983 (TypeContainer.DefaultIndexerName): New constant for default
5984 indexer name. Replaced all "Item" with this constant.
5985 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
5987 * typemanager.cs (TypeManager.default_member_ctor): Cache here
5988 DefaultMemberAttribute constructor.
5990 2004-08-05 Martin Baulig <martin@ximian.com>
5992 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
5995 2004-08-05 Marek Safar <marek.safar@seznam.cz>
5997 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
5998 multi platforms problem.
6000 * compiler.csproj: Included shared files.
6002 2004-08-04 Marek Safar <marek.safar@seznam.cz>
6004 Fix bug 60333, 55971 in the more general way
6005 * attribute.cs (Attribute.GetAttributeArgumentExpression):
6006 Added arg_type argument for constant conversion.
6007 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
6009 2004-08-04 Marek Safar <marek.safar@seznam.cz>
6012 * class.cs (TypeContainer ): New inner classes MethodArrayList,
6013 OperatorArrayList, MethodCoreArrayList for typecontainer
6014 containers. Changed class member types to these new types.
6015 (MethodArrayList.DefineMembers): Added test for CS0659.
6017 2004-08-04 Miguel de Icaza <miguel@ximian.com>
6019 * cfold.cs: Synchronize the folding with the code in expression.cs
6020 Binary.DoNumericPromotions for uint operands.
6022 * attribute.cs: Revert patch from Raja, it introduced a regression
6023 while building Blam-1.2.1 (hard to isolate a test case).
6025 2004-08-04 Marek Safar <marek.safar@seznam.cz>
6029 (TypeContainer.Define): Renamed to DefineContainerMembers because of
6031 (MethodCore.parent_method): New member. The method we're overriding
6032 if this is an override method.
6033 (MethodCore.CheckBase): Moved from Method class and made common.
6034 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
6036 (MethodCore.CheckForDuplications): New abstract method. For custom
6037 member duplication search in a container
6038 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
6039 method and its return type.
6040 (Event.conflict_symbol): New member. Symbol with same name in the
6044 (MemberCache.FindMemberWithSameName): New method. The method
6045 is looking for conflict with inherited symbols.
6047 2004-08-04 Martin Baulig <martin@ximian.com>
6049 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
6051 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
6053 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6055 * report.cs (Message): New enum for better error, warning reference in
6057 (MessageData): New inner abstract class. It generally handles printing of
6058 error and warning messages.
6059 Removed unused Error, Warning, Message methods.
6061 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6063 Fix for cs0592-8.cs test
6065 (Attributable.ValidAttributeTargets): Made public.
6066 (Attribute.ExplicitTarget): New member for explicit target value.
6067 (Attribute.CheckTargets): Now we translate explicit attribute
6068 target to Target here.
6070 2004-08-03 Ben Maurer <bmaurer@ximian.com>
6072 * ecore.cs (MethodGroupExpr): new IsBase property.
6074 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
6076 * delegate.cs (DelegateCreation): store a MethodGroupExpr
6077 rather than an instance expr.
6079 (DelegateCreation.Emit): Use the method group rather than
6080 the instance expression. Also, if you have base.Foo as the
6081 method for a delegate, make sure to emit ldftn, not ldftnvirt.
6083 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
6085 (NewDelegate.DoResolve): Only check for the existance of Invoke
6086 if the method is going to be needed. Use MethodGroupExpr.
6088 (NewDelegate.Emit): Remove, DelegateCreation implements this.
6090 * expression.cs: For pointer arith., make sure to use
6091 the size of the type, not the size of the pointer to
6094 2004-08-03 Marek Safar <marek.safar@seznam.cz>
6097 * class.cs (Class): Added error CS0502 test.
6099 2004-08-03 John Luke <jluke@cfl.rr.com>
6100 Raja R Harinath <rharinath@novell.com>
6103 * attribute.cs (Attribute.complained_before): New flag.
6104 (Attribute.ResolveType, Attribute.Resolve),
6105 (Attribute.DefinePInvokeMethod): Set it.
6106 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
6108 2004-08-03 Martin Baulig <martin@ximian.com>
6110 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
6111 use a user-defined operator; we still need to do numeric
6112 promotions in case one argument is a builtin type and the other
6113 one has an implicit conversion to that type. Fixes #62322.
6115 2004-08-02 Martin Baulig <martin@ximian.com>
6117 * statement.cs (LocalInfo.Flags): Added `IsThis'.
6118 (LocalInfo.IsThis): New public property.
6119 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
6121 2004-08-01 Martin Baulig <martin@ximian.com>
6123 * class.cs (TypeContainer.GetClassBases): Don't set the default
6124 here since we may get called from GetPartialBases().
6125 (TypeContainer.DefineType): If GetClassBases() didn't return a
6126 parent, use the default one.
6128 2004-07-30 Duncan Mak <duncan@ximian.com>
6130 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
6132 2004-07-30 Martin Baulig <martin@ximian.com>
6134 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
6136 * class.cs (SourceMethod): New public class, derive from the
6137 symbol writer's ISourceMethod.
6138 (Method): Use the new symbol writer API.
6140 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
6141 as argument and use the new symbol writer.
6144 (SourceFile): Implement the symbol writer's ISourceFile.
6145 (Location.SymbolDocument): Removed.
6146 (Location.SourceFile): New public property.
6148 * symbolwriter.cs: Use the new symbol writer API.
6150 2004-07-30 Raja R Harinath <rharinath@novell.com>
6152 * Makefile (install-local): Remove. Functionality moved to
6155 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
6157 * Makefile: Install mcs.exe.config file together with mcs.exe.
6158 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
6159 correct runtime version.
6161 2004-07-25 Martin Baulig <martin@ximian.com>
6164 (TypeContainer.RegisterOrder): Removed, this was unused.
6165 (TypeContainer, interface_order): Removed.
6166 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
6167 TypeContainer as argument since we can also be called with a
6168 `PartialContainer' for a partial class/struct/interface.
6169 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
6170 of checking whether we're an `Interface' - we could be a
6172 (PartialContainer.Register): Override; call
6173 AddClass()/AddStruct()/AddInterface() on our parent.
6175 * cs-parser.jay (interface_member_declaration): Add things to the
6176 `current_container', not the `current_class'.
6178 * rootcontext.cs (RegisterOrder): The overloaded version which
6179 takes an `Interface' was unused, removed.
6181 * typemanager.cs (TypeManager.LookupInterface): Return a
6182 `TypeContainer', not an `Interface'.
6183 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
6184 contain a `PartialContainer' for an interface, so check it's
6185 `Kind' to figure out what it is.
6187 2004-07-25 Martin Baulig <martin@ximian.com>
6189 * class.cs (Class.DefaultTypeAttributes): New public constant.
6190 (Struct.DefaultTypeAttributes): Likewise.
6191 (Interface.DefaultTypeAttributes): Likewise.
6192 (PartialContainer.TypeAttr): Override this and add the
6193 DefaultTypeAttributes.
6195 2004-07-25 Martin Baulig <martin@ximian.com>
6197 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
6198 we can just use the `Parent' field instead.
6200 2004-07-25 Martin Baulig <martin@ximian.com>
6202 * class.cs (TypeContainer.Emit): Renamed to EmitType().
6204 2004-07-25 Martin Baulig <martin@ximian.com>
6206 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
6207 our parts before defining any methods.
6208 (TypeContainer.VerifyImplements): Make this virtual.
6209 (ClassPart.VerifyImplements): Override and call VerifyImplements()
6210 on our PartialContainer.
6212 2004-07-25 Martin Baulig <martin@ximian.com>
6214 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
6216 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
6217 argument, we can just use the `Parent' field instead.
6220 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
6221 (MemberBase.DoDefine): Likewise.
6223 2004-07-24 Martin Baulig <martin@ximian.com>
6225 * decl.cs (MemberCore.Parent): New public field.
6226 (DeclSpace.Parent): Moved to MemberCore.
6228 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
6229 (MemberBase.ctor): Added TypeContainer argument, pass it to our
6231 (FieldBase, Field, Operator): Likewise.
6232 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
6233 (EventField, Event): Likewise.
6235 2004-07-23 Martin Baulig <martin@ximian.com>
6237 * class.cs (PartialContainer): New public class.
6238 (ClassPart): New public class.
6239 (TypeContainer): Added support for partial classes.
6240 (TypeContainer.GetClassBases): Splitted some of the functionality
6241 out into GetNormalBases() and GetPartialBases().
6243 * cs-tokenizer.cs (Token.PARTIAL): New token.
6244 (Tokenizer.consume_identifier): Added some hacks to recognize
6245 `partial', but only if it's immediately followed by `class',
6246 `struct' or `interface'.
6248 * cs-parser.jay: Added support for partial clases.
6250 2004-07-23 Martin Baulig <martin@ximian.com>
6252 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
6253 a `DeclSpace' and also made it readonly.
6254 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
6255 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
6256 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
6258 * cs-parser.jay: Pass the `current_class', not the
6259 `current_container' (at the moment, this is still the same thing)
6260 to a new Method, Property, Event, Indexer or Constructor.
6262 2004-07-23 Martin Baulig <martin@ximian.com>
6264 * cs-parser.jay (CSharpParser): Added a new `current_class' field
6265 and removed the `current_interface' one.
6266 (struct_declaration, class_declaration, interface_declaration):
6267 Set `current_class' to the newly created class/struct/interface;
6268 set their `Bases' and call Register() before parsing their body.
6270 2004-07-23 Martin Baulig <martin@ximian.com>
6272 * class.cs (Kind): New public enum.
6273 (TypeContainer): Made this class abstract.
6274 (TypeContainer.Kind): New public readonly field.
6275 (TypeContainer.CheckDef): New public method; moved here from
6277 (TypeContainer.Register): New public abstract method.
6278 (TypeContainer.GetPendingImplementations): New public abstract
6280 (TypeContainer.GetClassBases): Removed the `is_class' and
6281 `is_iface' parameters.
6282 (TypeContainer.DefineNestedTypes): Formerly known as
6284 (ClassOrStruct): Made this class abstract.
6286 * tree.cs (RootTypes): New public type.
6288 2004-07-20 Martin Baulig <martin@ximian.com>
6290 * tree.cs (Tree.RecordNamespace): Removed.
6291 (Tree.Namespaces): Removed.
6293 * rootcontext.cs (RootContext.IsNamespace): Removed.
6295 * cs-parser.jay (namespace_declaration): Just create a new
6296 NamespaceEntry here.
6298 2004-07-20 Martin Baulig <martin@ximian.com>
6300 * statement.cs (ExceptionStatement): New abstract class. This is
6301 now used as a base class for everyone who's using `finally'.
6302 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
6303 our local variables before using them.
6305 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
6306 virtual method. This is used by Yield.Resolve() to "steal" an
6307 outer block's `finally' clauses.
6308 (FlowBranchingException): The .ctor now takes an ExceptionStatement
6311 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
6312 version which takes an ExceptionStatement. This version must be
6313 used to create exception branchings.
6316 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
6317 (Iterator.EmitMoveNext): Added exception support; protect the
6318 block with a `fault' clause, properly handle 'finally' clauses.
6319 (Iterator.EmitDispose): Run all the `finally' clauses here.
6321 2004-07-20 Martin Baulig <martin@ximian.com>
6323 * iterator.cs: This is the first of a set of changes in the
6324 iterator code. Match the spec more closely: if we're an
6325 IEnumerable, then GetEnumerator() must be called. The first time
6326 GetEnumerator() is called, it returns the current instance; all
6327 subsequent invocations (if any) must create a copy.
6329 2004-07-19 Miguel de Icaza <miguel@ximian.com>
6331 * expression.cs: Resolve the constant expression before returning
6334 2004-07-19 Martin Baulig <martin@ximian.com>
6336 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
6337 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
6338 the return type of the new EmitContext.
6340 2004-07-18 Martin Baulig <martin@ximian.com>
6342 * class.cs (Property.Define): Fix iterators.
6344 * iterators.cs (Iterator.Define): Moved the
6345 `container.AddInterator (this)' call here from the .ctor; only do
6346 it if we resolved successfully.
6348 2004-07-17 Miguel de Icaza <miguel@ximian.com>
6350 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
6351 `true' for preprocessing directives that we parse. The return
6352 value indicates whether we should return to regular tokenizing or
6353 not, not whether it was parsed successfully.
6355 In the past if we were in: #if false ... #line #endif, we would
6356 resume parsing after `#line'. See bug 61604.
6358 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
6359 building: IsEnumType should return true only for enums, not for
6360 enums or System.Enum itself. This fixes #61593.
6362 Likely what happened is that corlib was wrong: mcs depended on
6363 this bug in some places. The bug got fixed, we had to add the
6364 hack, which caused bug 61593.
6366 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
6367 that was a workaround for the older conditions.
6369 2004-07-16 Ben Maurer <bmaurer@ximian.com>
6371 * assign.cs: IAssignMethod has a new interface, as documented
6372 inline. All assignment code now uses this new api.
6374 * ecore.cs, expression.cs: All classes which implement
6375 IAssignMethod now use the new interface.
6377 * expression.cs (Invocation): add a hack to EmitCall so that
6378 IndexerAccess can be the target of a compound assignment without
6379 evaluating its arguments twice.
6381 * statement.cs: Handle changes in Invocation api.
6383 2004-07-16 Martin Baulig <martin@ximian.com>
6385 * iterators.cs: Rewrote this. We're now using one single Proxy
6386 class for both the IEnumerable and the IEnumerator interface and
6387 `Iterator' derives from Class so we can use the high-level API.
6389 * class.cs (TypeContainer.AddIterator): New method.
6390 (TypeContainer.DoDefineType): New protected virtual method, which
6391 is called from DefineType().
6392 (TypeContainer.DoDefineMembers): Call DefineType() and
6393 DefineMembers() on all our iterators.
6394 (TypeContainer.Emit): Call Emit() on all our iterators.
6395 (TypeContainer.CloseType): Call CloseType() on all our iterators.
6397 * codegen.cs (EmitContext.CurrentIterator): New public field.
6399 2004-07-15 Martin Baulig <martin@ximian.com>
6402 (TypeManager.not_supported_exception_type): New type.
6404 2004-07-14 Martin Baulig <martin@ximian.com>
6406 * iterators.cs: Use real error numbers.
6408 2004-07-14 Martin Baulig <martin@ximian.com>
6410 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
6411 requires this to be a System.Collection.IEnumerable and not a
6412 class implementing that interface.
6413 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
6415 2004-07-13 Marek Safar <marek.safar@seznam.cz>
6417 * class.cs: Fixed previous fix, it broke some error tests.
6419 2004-07-12 Martin Baulig <martin@ximian.com>
6421 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
6424 2004-07-09 Miguel de Icaza <miguel@ximian.com>
6426 * assign.cs (LocalTemporary): Add new argument: is_address,If
6427 `is_address' is true, then the value that we store is the address
6428 to the real value, and not the value itself.
6430 * ecore.cs (PropertyExpr): use the new local temporary
6431 stuff to allow us to handle X.Y += z (where X is a struct)
6433 2004-07-08 Martin Baulig <martin@ximian.com>
6435 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
6436 not always return, just like we're doing in Using.Resolve().
6438 2004-07-07 Miguel de Icaza <miguel@ximian.com>
6440 * cs-parser.jay (fixed_statement): flag this as Pinned.
6442 2004-07-06 Miguel de Icaza <miguel@ximian.com>
6444 * typemanager.cs (TypeManager): Removed MakePinned method, this
6445 mechanism is replaced with the .NET 2.x compatible mechanism of
6446 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
6448 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
6449 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
6450 `IsFixed' property which has a different meaning.
6452 2004-07-02 Raja R Harinath <rharinath@novell.com>
6454 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
6455 visible from inside a nested class, not just the names of the
6456 immediately enclosing class.
6459 2004-06-24 Raja R Harinath <rharinath@novell.com>
6461 * expression.cs (BetterConversion): Remove buggy special-case
6462 handling of "implicit constant expression conversions". At this
6463 point, we already know that the conversion is possible -- we're
6464 only checking to see which is better.
6466 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6468 * cs-parser.jay: Added error CS0210 test.
6470 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6472 * cs-parser.jay: Added error CS0134 test.
6474 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6477 * cs-parser.jay: Added error CS0145 test.
6479 2004-06-24 Marek Safar <marek.safar@seznam.cz>
6481 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
6483 2004-06-23 Ben Maurer <bmaurer@ximian.com>
6485 * expression.cs (StackAlloc.Resolve): The argument may not
6486 be a constant; deal with this case.
6488 2004-06-23 Marek Safar <marek.safar@seznam.cz>
6490 * attribute.cs (IndexerName_GetIndexerName): Renamed to
6491 GetIndexerAttributeValue.
6492 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
6494 * class.cs (Indexer.Define): Added error tests for CS0415,
6497 2004-06-23 Miguel de Icaza <miguel@ximian.com>
6499 * attribute.cs (Attribute.Resolve): Keep field code in sync with
6502 2004-06-23 Martin Baulig <martin@ximian.com>
6504 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
6505 neither return nor throw, reset the barrier as well. Fixes #60457.
6507 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
6509 * class.cs : EventAttributes is now set to None by default.
6510 This fixes bug #60459.
6512 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6515 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6516 Don't throw exception but return null (it's sufficient now).
6518 2004-06-18 Marek Safar <marek.safar@seznam.cz>
6520 * typemanager.cs (GetArgumentTypes): Faster implementation.
6522 2004-06-18 Martin Baulig <martin@ximian.com>
6524 * attribute.cs (Attribute.Resolve): Check whether we're an
6525 EmptyCast which a Constant child. Fixes #60333.
6527 2004-06-17 Ben Maurer <bmaurer@ximian.com>
6529 * statement.cs (EmitCollectionForeach): Account for the fact that
6530 not all valuetypes are in areas which we can take the address of.
6531 For these variables, we store to a temporary variable. Also, make
6532 sure that we dont emit a `callvirt' on a valuetype method.
6534 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6536 * expression.cs (StackAlloc.DoReSolve): Added test for
6537 negative parameter (CS0247).
6539 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6542 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
6544 2004-06-15 Marek Safar <marek.safar@seznam.cz>
6547 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
6550 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6552 Fix bug #58254 & cs1555.cs, cs1556.cs
6553 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
6555 2004-06-14 Marek Safar <marek.safar@seznam.cz>
6557 * cs-parser.jay: Added error CS1669 test for indexers.
6559 2004-06-11 Martin Baulig <martin@ximian.com>
6561 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
6562 call this twice: for params and varargs methods.
6564 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6567 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
6569 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6571 * attribute.cs (Attribute.GetValidTargets): Made public.
6574 (AbstractPropertyEventMethod): New class for better code sharing.
6575 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
6577 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
6579 2004-06-11 Raja R Harinath <rharinath@novell.com>
6582 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
6583 that the call to Resolve is part of a MemberAccess.
6584 (Expression.Resolve): Use it for SimpleName resolution.
6585 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
6586 Add 'intermediate' boolean argument.
6587 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
6588 error message when the SimpleName can be resolved ambiguously
6589 between an expression and a type.
6590 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
6592 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
6593 call on the left-side.
6595 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6598 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
6600 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6602 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
6604 2004-06-11 Martin Baulig <martin@ximian.com>
6606 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
6607 varargs methods if applicable.
6609 2004-06-11 Martin Baulig <martin@ximian.com>
6611 * expression.cs (Invocation.EmitCall): Don't use
6612 `method.CallingConvention == CallingConventions.VarArgs' since the
6613 method could also have `CallingConventions.HasThis'.
6615 2004-06-11 Marek Safar <marek.safar@seznam.cz>
6617 * class.cs (Event.GetSignatureForError): Implemented.
6618 Fixed crash in error test cs3010.cs
6620 2004-06-10 Miguel de Icaza <miguel@ximian.com>
6622 * cs-tokenizer.cs: Change the way we track __arglist to be
6623 consistent with the other keywords.
6625 2004-06-09 Miguel de Icaza <miguel@ximian.com>
6627 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
6630 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
6632 * codegen.cs: Check that all referenced assemblies have a strongname
6633 before strongnaming the compiled assembly. If not report error CS1577.
6634 Fix bug #56563. Patch by Jackson Harper.
6635 * typemanager.cs: Added a method to return all referenced assemblies.
6636 Fix bug #56563. Patch by Jackson Harper.
6638 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6641 (Method.ApplyAttributeBuilder): Moved and added conditional
6642 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
6645 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
6647 2004-06-08 Marek Safar <marek.safar@seznam.cz>
6650 * class.cs: (EventField.attribute_targets): Changed default target.
6652 2004-06-08 Martin Baulig <martin@ximian.com>
6654 * expression.cs (Invocation.EmitCall): Enable varargs methods.
6656 2004-06-08 Martin Baulig <martin@ximian.com>
6658 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
6660 2004-06-07 Martin Baulig <martin@ximian.com>
6662 Added support for varargs methods.
6664 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
6667 * cs-parser.jay: Added support for `__arglist'.
6669 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
6671 * expression.cs (Argument.AType): Added `ArgList'.
6672 (Invocation): Added support for varargs methods.
6673 (ArglistAccess): New public class.
6674 (Arglist): New public class.
6676 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
6678 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
6679 a method's top-level block if the method has varargs.
6681 * support.cs (ReflectionParameters, InternalParameters): Added
6682 support for varargs methods.
6684 2004-06-07 Miguel de Icaza <miguel@ximian.com>
6686 * class.cs: Provide location in indexer error report.
6688 * driver.cs: Use standard names.
6690 * namespace.cs: Catch the use of using after a namespace has been
6691 declared also on using aliases.
6693 2004-06-03 Raja R Harinath <rharinath@novell.com>
6696 * typemanager.cs (closure_private_ok, closure_invocation_type)
6697 (closure_qualifier_type, closure_invocation_assembly)
6698 (FilterWithClosure): Move to ...
6699 (Closure): New internal nested class.
6700 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
6701 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
6702 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
6703 (MemberLookup, MemberLookupFailed): Use it.
6704 * expression.cs (New.DoResolve): Treat the lookup for the
6705 constructor as being qualified by the 'new'ed type.
6706 (Indexers.GetIndexersForTypeOrInterface): Update.
6708 2004-06-03 Marek Safar <marek.safar@seznam.cz>
6711 (GetConditionalAttributeValue): New method. Returns
6712 condition of ConditionalAttribute.
6713 (SearchMulti): New method. Returns all attributes of type 't'.
6714 Use it when attribute is AllowMultiple = true.
6715 (IsConditionalMethodExcluded): New method.
6718 (Method.IsExcluded): Implemented. Returns true if method has conditional
6719 attribute and the conditions is not defined (method is excluded).
6720 (IMethodData): Extended interface for ConditionalAttribute support.
6721 (PropertyMethod.IsExcluded): Implemented.
6724 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
6727 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
6730 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
6732 * expression.cs (ArrayCreationExpression): Make this just an
6733 `expression'. It can't be a statement, so the code here was
6736 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6739 * typemanager.cs (GetFullNameSignature): New method for
6742 2004-06-02 Marek Safar <marek.safar@seznam.cz>
6745 * class.cs (MemberBase.GetSignatureForError): New virtual method.
6746 Use this method when MethodBuilder is null.
6747 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
6748 Added test for error CS0626 (MONO reports error for this situation).
6749 (IMethodData.GetSignatureForError): Extended interface.
6751 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6754 (AttributeTester.GetObsoleteAttribute): Returns instance of
6755 ObsoleteAttribute when type is obsolete.
6758 (TypeContainer.VerifyObsoleteAttribute): Override.
6759 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
6760 (MethodCode.VerifyObsoleteAttribute): Override.
6761 (MemberBase.VerifyObsoleteAttribute): Override.
6764 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
6765 and report proper error.
6768 Delegate.VerifyObsoleteAttribute): Override.
6771 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
6772 and report proper error.
6773 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
6776 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
6780 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
6781 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
6782 Added test for ObsoleteAttribute.
6785 (Catch): Derived from Statement.
6787 2004-06-01 Marek Safar <marek.safar@seznam.cz>
6789 Fixed bug #59071 & cs0160.cs
6791 * statement.cs (Try.Resolve): Check here whether order of catch
6792 clauses matches their dependencies.
6794 2004-05-31 Miguel de Icaza <miguel@ximian.com>
6796 * Reverted patch to namespace.cs (Use lookuptypedirect). This
6797 caused a regression: #59343. Referencing nested classes from an
6798 assembly stopped working.
6800 2004-05-31 Martin Baulig <martin@ximian.com>
6802 MCS is now frozen for beta 2.
6804 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6806 * convert.cs: add a trivial cache for overload operator resolution.
6808 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6810 * decl.cs: If possible, use lookuptypedirect here. We can only do
6811 this if there is no `.' after the namespace. Avoids using
6812 LookupType, which does lots of slow processing.
6813 (FindNestedType) New method, does what it says :-).
6814 * namespace.cs: use LookupTypeDirect.
6815 * rootcontext.cs: use membercache, if possible.
6816 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
6818 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6821 According to the spec,
6823 In a member access of the form E.I, if E is a single identifier,
6824 and if the meaning of E as a simple-name (§7.5.2) is a constant,
6825 field, property, localvariable, or parameter with the same type as
6826 the meaning of E as a type-name (§3.8), then both possible
6827 meanings of E are permitted.
6829 We did not check that E as a simple-name had the same type as E as
6832 This trivial check gives us 5-7% on bootstrap time.
6834 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
6836 * expression.cs (Invocation.OverloadResolve): Avoid the
6837 use of hashtables and boxing here by allocating on demand.
6839 2004-05-30 Martin Baulig <martin@ximian.com>
6841 * rootcontext.cs (RootContext.LookupType): Don't cache things if
6842 we're doing a silent lookup. Don't try to lookup nested types in
6843 TypeManager.object_type (thanks to Ben Maurer).
6845 2004-05-30 Martin Baulig <martin@ximian.com>
6847 Committing a patch from Ben Maurer.
6849 * rootcontext.cs (RootContext.LookupType): Cache negative results.
6851 2004-05-29 Martin Baulig <martin@ximian.com>
6853 * class.cs (IMethodData.ShouldIgnore): New method.
6855 * typemanager.cs (TypeManager.MethodFlags): Don't take a
6856 `Location' argument, we don't need it anywhere. Use
6857 `IMethodData.ShouldIgnore ()' instead of
6858 `MethodData.GetMethodFlags ()'.
6859 (TypeManager.AddMethod): Removed.
6860 (TypeManager.AddMethod2): Renamed to AddMethod.
6862 2004-05-29 Martin Baulig <martin@ximian.com>
6864 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
6866 * convert.cs (Convert.ImplicitReferenceConversion): If we're
6867 converting from a class type S to an interface type and we already
6868 have an object on the stack, don't box it again. Fixes #52578.
6870 2004-05-29 Martin Baulig <martin@ximian.com>
6872 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
6873 Added support for `params' parameters. Fixes #59267.
6875 2004-05-29 Martin Baulig <martin@ximian.com>
6877 * literal.cs (NullPointer): Provide a private .ctor which sets
6878 `type' to TypeManager.object_type. Fixes #59048.
6880 2004-05-29 Martin Baulig <martin@ximian.com>
6882 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
6883 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
6885 * ecore.cs (EventExpr.instance_expr): Make the field private.
6887 2004-05-26 Marek Safar <marek.safar@seznam.cz>
6889 Fixed bug #50080 & cs0214-2.cs
6890 * expression.cs (Cast.DoResolve): Check unsafe context here.
6892 * statement.cs (Resolve.DoResolve): Likewise.
6894 2004-05-26 Martin Baulig <martin@ximian.com>
6896 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
6898 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
6899 (RootContext.LookupType): Pass down the `silent' flag.
6901 2004-05-25 Martin Baulig <martin@ximian.com>
6904 (MethodGroupExpr.IdenticalTypeName): New public property.
6905 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
6906 expression actually refers to a type.
6908 2004-05-25 Martin Baulig <martin@ximian.com>
6910 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
6911 for #56176 and made it actually work.
6913 2004-05-25 Martin Baulig <martin@ximian.com>
6915 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
6916 (FieldExpr, PropertyExpr): Override and implement
6917 CacheTemporaries. Fixes #52279.
6919 2004-05-25 Miguel de Icaza <miguel@ximian.com>
6921 * location.cs: In the new compiler listing a file twice is a
6922 warning, not an error.
6924 2004-05-24 Martin Baulig <martin@ximian.com>
6926 * enum.cs (Enum.DefineType): For the `BaseType' to be a
6927 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
6929 2004-05-24 Martin Baulig <martin@ximian.com>
6931 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
6932 walking the `using' list. Fixes #53921.
6934 2004-05-24 Martin Baulig <martin@ximian.com>
6936 * const.cs (Const.LookupConstantValue): Added support for
6937 EmptyCast's; fixes #55251.
6939 2004-05-24 Martin Baulig <martin@ximian.com>
6941 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
6942 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
6943 which does the CS0135 check. The reason is that we first need to
6944 check whether the variable actually exists.
6946 2004-05-24 Martin Baulig <martin@ximian.com>
6948 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
6949 than RootContext.LookupType() to find the explicit interface
6952 2004-05-24 Raja R Harinath <rharinath@novell.com>
6954 * Makefile: Simplify. Use executable.make.
6955 * mcs.exe.sources: New file. List of sources of mcs.exe.
6957 2004-05-24 Anders Carlsson <andersca@gnome.org>
6961 Use the invariant culture when doing String.Compare for CLS case
6964 2004-05-23 Martin Baulig <martin@ximian.com>
6966 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
6967 don't have any dots. Fixes #52622, added cs0246-8.cs.
6969 * namespace.cs (NamespaceEntry.Lookup): Likewise.
6971 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6973 * class.cs (MemberBase.Define): Reuse MemberType member for
6974 resolved type. Other methods can use it too.
6976 2004-05-23 Martin Baulig <martin@ximian.com>
6978 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
6979 the variable also exists in the current block (otherwise, we need
6980 to report a CS0103). Fixes #58670.
6982 2004-05-23 Martin Baulig <martin@ximian.com>
6984 * flowanalysis.cs (Reachability.Reachable): Compute this
6985 on-the-fly rather than storing it as a field.
6987 2004-05-23 Martin Baulig <martin@ximian.com>
6989 * flowanalysis.cs (Reachability.And): Manually compute the
6990 resulting `barrier' from the reachability.
6992 2004-05-23 Marek Safar <marek.safar@seznam.cz>
6995 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
6996 instance of ObsoleteAttribute when symbol is obsolete.
6999 (IMethodData): Extended interface for ObsoleteAttribute support.
7001 2004-05-22 Marek Safar <marek.safar@seznam.cz>
7003 * attribute.cs: Fix bug #55970
7005 2004-05-22 Marek Safar <marek.safar@seznam.cz>
7009 (GetObsoleteAttribute): New method. Creates the instance of
7011 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
7012 ObsoleteAttribute when member is obsolete.
7013 (AttributeTester.Report_ObsoleteMessage): Common method for
7014 Obsolete error/warning reporting.
7017 (TypeContainer.base_classs_type): New member for storing parent type.
7020 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
7021 for this MemberCore.
7023 2004-05-21 Marek Safar <marek.safar@seznam.cz>
7025 * attribute.cs, const.cs: Fix bug #58590
7027 2004-05-21 Martin Baulig <martin@ximian.com>
7029 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
7030 out parameters if the end of the method is unreachable. Fixes
7033 2004-05-21 Marek Safar <marek.safar@seznam.cz>
7035 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
7036 Hari was right, why extra method.
7038 2004-05-21 Marek Safar <marek.safar@seznam.cz>
7040 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
7042 2004-05-20 Martin Baulig <martin@ximian.com>
7044 Merged this back from gmcs to keep the differences to a minumum.
7046 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
7047 instead of a Declspace.
7048 (Attribute.ResolveType): Likewise.
7049 (Attributes.Search): Likewise.
7050 (Attributes.Contains): Likewise.
7051 (Attributes.GetClsCompliantAttribute): Likewise.
7053 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
7055 (MethodData.ApplyAttributes): Take an EmitContext instead of a
7058 2004-05-19 Marek Safar <marek.safar@seznam.cz>
7060 Fix bug #58688 (MCS does not report error when the same attribute
7063 * attribute.cs (Attribute.Emit): Distinction between null and default.
7065 2004-05-19 Raja R Harinath <rharinath@novell.com>
7067 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
7068 of a top-level attribute without an attribute target.
7069 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
7071 (Attribute.Conditional_GetConditionName),
7072 (Attribute.Obsolete_GetObsoleteMessage): Update.
7073 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
7074 part of ScanForIndexerName.
7075 (Attribute.CanIgnoreInvalidAttribute): New function.
7076 (Attribute.ScanForIndexerName): Move to ...
7077 (Attributes.ScanForIndexerName): ... here.
7078 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
7079 (Attributes.Search): New internal variant that can choose not to
7080 complain if types aren't resolved. The original signature now
7082 (Attributes.GetClsCompliantAttribute): Use internal variant, with
7083 complaints suppressed.
7084 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
7085 only if it not useful.
7086 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
7087 top-level for attributes that are shared between the assembly
7088 and a top-level class.
7089 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
7090 * class.cs: Update to reflect changes.
7091 (DefineIndexers): Fuse loops.
7092 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
7093 a couple more variants of attribute names.
7095 2004-05-18 Marek Safar <marek.safar@seznam.cz>
7097 Fix bug #52585 (Implemented explicit attribute declaration)
7100 (Attributable.ValidAttributeTargets): New abstract method. It gets
7101 list of valid attribute targets for explicit target declaration.
7102 (Attribute.Target): It holds target itself.
7103 (AttributeSection): Removed.
7104 (Attribute.CheckTargets): New method. It checks whether attribute
7105 target is valid for the current element.
7108 (EventProperty): New class. For events that are declared like
7109 property (with add and remove accessors).
7110 (EventField): New class. For events that are declared like field.
7113 * cs-parser.jay: Implemented explicit attribute target declaration.
7115 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
7116 Override ValidAttributeTargets.
7119 (ReturnParameter): Class for applying custom attributes on
7121 (ParameterAtribute): New class. Class for applying custom
7122 attributes on the parameter type.
7124 2004-05-17 Miguel de Icaza <miguel@ximian.com>
7126 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
7129 (Method): Allow UNSAFE here.
7131 * modifiers.cs: Support unsafe reporting.
7133 2004-05-17 Marek Safar <marek.safar@seznam.cz>
7135 * decl.cs: Fix bug #58478.
7137 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7139 * statement.cs: When checking for unreachable code on an EmptyStatement,
7140 set the location. Fixes bug #58488.
7142 2004-05-13 Miguel de Icaza <miguel@ximian.com>
7144 * driver.cs: Add -pkg handling.
7146 From Gonzalo: UseShelLExecute=false
7148 2004-05-12 Marek Safar <marek.safar@seznam.cz>
7151 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
7153 (Attribute.IsClsCompliaceRequired): Moved to base for better
7155 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
7156 when attribute is AttributeUsageAttribute.
7157 (Attribute.GetValidTargets): Simplified.
7158 (Attribute.GetAttributeUsage): New method returns AttributeUsage
7159 attribute for this type.
7160 (Attribute.ApplyAttributes): Method renamed to Emit and make
7162 (GlobalAttributeSection): New class for special handling of global
7163 attributes (assembly, module).
7164 (AttributeSection.Emit): New method.
7166 * class.cs: Implemented Attributable abstract methods.
7167 (MethodCore.LabelParameters): Moved to Parameter class.
7168 (Accessor): Is back simple class.
7169 (PropertyMethod): Implemented Attributable abstract class.
7170 (DelegateMethod): Implemented Attributable abstract class.
7171 (Event): New constructor for disctintion between normal Event
7172 and Event with accessors.
7174 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
7176 * codegen.cs, const.cs, decl.cs, delegate.cs:
7177 (CommonAssemblyModulClass): Implemented Attributable abstract class
7180 * enum.cs: Implement IAttributeSupport interface.
7181 (EnumMember): New class for emum members. Implemented Attributable
7185 (ParameterBase): Is abstract.
7186 (ReturnParameter): New class for easier [return:] attribute handling.
7188 * typemanager.cs: Removed builder_to_attr.
7190 2004-05-11 Raja R Harinath <rharinath@novell.com>
7193 * attribute.cs (Attribute.GetPositionalValue): New function.
7194 * class.cs (TypeContainer.VerifyMembers): New function.
7195 (TypeContainer.Emit): Use it.
7196 (ClassOrStruct): New base class for Class and Struct.
7197 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
7198 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
7200 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
7201 then each non-static field should have a FieldOffset attribute.
7202 Otherwise, none of the fields should have a FieldOffset attribute.
7203 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
7204 and FieldOffset attributes.
7205 * typemanager.cs (TypeManager.struct_layout_attribute_type)
7206 (TypeManager.field_offset_attribute_type): New core types.
7207 (TypeManager.InitCoreTypes): Initialize them.
7209 2004-05-11 Michal Moskal <malekith@pld-linux.org>
7211 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
7212 Return correct type.
7215 2004-05-09 Miguel de Icaza <miguel@ximian.com>
7217 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
7218 be implicitly converted to ulong.
7220 * expression.cs: The logic for allowing operator &, | and ^ worked
7221 was wrong, it worked before because we did not report an error in
7222 an else branch. Fixes 57895.
7224 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
7225 allow volatile fields to be reference types.
7227 2004-05-07 Miguel de Icaza <miguel@ximian.com>
7229 * driver.cs: Add support for /debug-
7231 2004-05-07 Raja R Harinath <rharinath@novell.com>
7233 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
7234 Add a 'complain' parameter to silence errors.
7235 (Attribute.Resolve): Update to changes. Put in sanity check to catch
7236 silently overlooked type-resolutions.
7237 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
7239 (Attributes.Search): New function.
7240 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
7241 (Attributes.GetAttributeFullName): Remove hack.
7242 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
7243 Update to reflect changes.
7244 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
7245 Use Attributes.Search instead of nested loops.
7247 2004-05-07 Marek Safar <marek.safar@seznam.cz>
7250 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
7251 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
7252 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
7254 * report.cs: (Report.Warning): Renamed to Warning_T because of
7255 parameter collision.
7257 2004-05-05 Raja R Harinath <rharinath@novell.com>
7259 * expression.cs (MemberAccess.ResolveMemberAccess):
7260 Exit with non-zero status after Report.Error.
7261 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
7263 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
7265 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7267 * support.cs: Don't hang when the file is empty.
7269 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
7271 * support.cs: In SeekableStreamReader, compute the preamble size of the
7272 underlying stream. Position changes should take into account that initial
7275 2004-05-03 Todd Berman <tberman@sevenl.net>
7277 * driver.cs: remove unused GetSysVersion function.
7279 2004-05-03 Todd Berman <tberman@sevenl.net>
7281 * driver.cs: Remove the hack from saturday, as well as the hack
7282 from jackson (LoadAssemblyFromGac), also adds the CWD to the
7283 link_paths to get that bit proper.
7285 2004-05-01 Todd Berman <tberman@sevenl.net>
7287 * driver.cs: Try a LoadFrom before a Load, this checks the current
7288 path. This is currently a bug in mono that is be fixed, however, this
7289 provides a workaround for now. This will be removed when the bug
7292 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
7294 * CryptoConvert.cs: Updated to latest version. Fix issue with
7295 incomplete key pairs (#57941).
7297 2004-05-01 Todd Berman <tberman@sevenl.net>
7299 * driver.cs: Remove '.' from path_chars, now System.* loads properly
7302 2004-04-30 Jackson Harper <jackson@ximian.com>
7304 * codegen.cs: Open keys readonly.
7306 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7308 * typemanager.cs: don't report cyclic struct layout when a struct
7309 contains 2 or more fields of the same type. Failed for Pango.AttrShape
7310 which has 2 Pango.Rectangle fields.
7312 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
7314 * expression.cs: Handle IntPtr comparisons with IL code
7315 rather than a method call.
7317 2004-04-29 Martin Baulig <martin@ximian.com>
7319 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
7320 the list of PropertyInfo's in class hierarchy and find the
7321 accessor. Fixes #56013.
7323 2004-04-29 Martin Baulig <martin@ximian.com>
7325 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
7327 2004-04-29 Martin Baulig <martin@ximian.com>
7329 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7331 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
7333 2004-04-29 Martin Baulig <martin@ximian.com>
7335 * class.cs (ConstructorInitializer.Resolve): Check whether the
7336 parent .ctor is accessible. Fixes #52146.
7338 2004-04-29 Martin Baulig <martin@ximian.com>
7340 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
7342 * statement.cs (Using.EmitLocalVariableDecls): Use
7343 TypeManager.idisposable_type, not typeof (IDisposable).
7344 (Foreach.EmitCollectionForeach): Added support for valuetypes.
7346 2004-04-29 Martin Baulig <martin@ximian.com>
7348 * class.cs (Event.Define): Don't emit the field and don't set
7349 RTSpecialName and SpecialName for events on interfaces. Fixes
7352 2004-04-29 Raja R Harinath <rharinath@novell.com>
7354 Refactor Attribute.ApplyAttributes.
7355 * attribute.cs (Attributable): New base class for objects that can
7356 have Attributes applied on them.
7357 (Attribute): Make AttributeUsage fields public.
7358 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
7359 (Attribute.IsInternalCall): New property.
7360 (Attribute.UsageAttr): Convert to a public read-only property.
7361 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
7362 (Attribute.ResolveType, Attribute.Resolve)
7363 (Attribute.ScanForIndexerName): Update to reflect changes.
7364 (Attribute.CheckAttributeTarget): Re-format.
7365 (Attribute.ApplyAttributes): Refactor, to various
7366 Attributable.ApplyAttributeBuilder methods.
7367 * decl.cs (MemberCore): Make Attributable.
7368 * class.cs (Accessor): Make Attributable.
7369 (MethodData.ApplyAttributes): Use proper attribute types, not
7371 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
7372 (TypeContainer.ApplyAttributeBuilder)
7373 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
7374 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
7375 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
7376 (Operator.ApplyAttributeBuilder): New factored-out methods.
7377 * const.cs (Const.ApplyAttributeBuilder): Likewise.
7378 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
7379 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
7380 * parameter.cs (ParameterBase): New Attributable base class
7381 that can also represent Return types.
7382 (Parameter): Update to the changes.
7384 2004-04-29 Jackson Harper <jackson@ximian.com>
7386 * driver.cs: Prefer the corlib system version when looking for
7387 assemblies in the GAC. This is still a hack, but its a better hack
7390 2004-04-29 Marek Safar <marek.safar@seznam.cz>
7392 * decl.cs, enum.cs: Improved error 3005 reporting.
7394 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
7395 (related_symbols): New private member for list of symbols
7396 related to reported error/warning.
7398 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
7400 2004-04-29 Martin Baulig <martin@ximian.com>
7402 * ecore.cs (Expression.Constantify): If we're an enum and
7403 TypeManager.TypeToCoreType() doesn't give us another type, use
7404 t.UnderlyingSystemType. Fixes #56178.
7406 2004-04-29 Martin Baulig <martin@ximian.com>
7408 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
7409 interfaces and for each interface, only add members directly
7410 declared in that interface. Fixes #53255.
7412 2004-04-28 Martin Baulig <martin@ximian.com>
7414 * expression.cs (ConditionalLogicalOperator): Use a temporary
7415 variable for `left' to avoid that we evaluate it more than once;
7418 2004-04-28 Martin Baulig <martin@ximian.com>
7420 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
7423 2004-04-28 Martin Baulig <martin@ximian.com>
7425 * statement.cs (LocalInfo.Resolve): Check whether the type is not
7428 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
7429 whether the type is not void (CS1547).
7431 2004-04-28 Martin Baulig <martin@ximian.com>
7433 * expression.cs (Unary.DoResolveLValue): Override this and report
7434 CS0131 for anything but Operator.Indirection.
7436 2004-04-28 Martin Baulig <martin@ximian.com>
7438 Committing a patch from Ben Maurer; see bug #50820.
7440 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7443 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7446 2004-04-28 Martin Baulig <martin@ximian.com>
7448 Committing a patch from Ben Maurer; see bug #50820.
7450 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
7453 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
7456 2004-04-28 Martin Baulig <martin@ximian.com>
7458 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
7459 (Block.AddLabel): Call DoLookupLabel() to only search in the
7462 2004-04-28 Martin Baulig <martin@ximian.com>
7464 * cfold.cs (ConstantFold.BinaryFold): Added special support for
7465 comparing StringConstants and NullLiterals in Equality and Inequality.
7467 2004-04-28 Jackson Harper <jackson@ximian.com>
7469 * driver.cs: Attempt to load referenced assemblies from the
7470 GAC. This is the quick and dirty version of this method that
7471 doesnt take into account versions and just takes the first
7472 canidate found. Will be good enough for now as we will not have more
7473 then one version installed into the GAC until I update this method.
7475 2004-04-28 Martin Baulig <martin@ximian.com>
7477 * typemanager.cs (TypeManager.CheckStructCycles): New public
7478 static method to check for cycles in the struct layout.
7480 * rootcontext.cs (RootContext.PopulateTypes): Call
7481 TypeManager.CheckStructCycles() for each TypeContainer.
7482 [Note: We only need to visit each type once.]
7484 2004-04-28 Martin Baulig <martin@ximian.com>
7486 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
7488 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
7489 success and added `out object value'. Use a `bool resolved' field
7490 to check whether we've already been called rather than
7491 `ConstantValue != null' since this breaks for NullLiterals.
7493 2004-04-28 Raja R Harinath <rharinath@novell.com>
7495 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
7496 setting of this flag, since the 'set' method may be non-public.
7498 2004-04-28 Raja R Harinath <rharinath@novell.com>
7500 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
7501 check on current_vector.Block.
7503 2004-04-27 Martin Baulig <martin@ximian.com>
7505 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
7506 a field initializer. Fixes #56459.
7508 2004-04-27 Martin Baulig <martin@ximian.com>
7510 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
7511 we're not attempting to use an indexer. Fixes #52154.
7513 2004-04-27 Martin Baulig <martin@ximian.com>
7515 * statement.cs (Return): Don't create a return label if we don't
7516 need it; reverts my change from January 20th. Thanks to Ben
7519 2004-04-27 Martin Baulig <martin@ximian.com>
7521 According to the spec, `goto' can only leave a nested scope, but
7524 * statement.cs (Block.LookupLabel): Only lookup in the current
7525 block, don't recurse into parent or child blocks.
7526 (Block.AddLabel): Check in parent and child blocks, report
7527 CS0140/CS0158 if we find a duplicate.
7528 (Block): Removed this indexer for label lookups.
7529 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
7530 this already does the error reporting for us.
7533 (FlowBranching.UsageVector.Block): New public variable; may be null.
7534 (FlowBranching.CreateSibling): Added `Block' argument.
7535 (FlowBranching.LookupLabel): New public virtual method. Lookup a
7536 label for the target of a `goto' and check whether we're not
7537 leaving a `finally'.
7539 2004-04-27 Martin Baulig <martin@ximian.com>
7541 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
7542 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
7545 2004-04-27 Martin Baulig <martin@ximian.com>
7547 * statement.cs (Block.AddLabel): Also check for implicit blocks
7548 and added a CS0158 check.
7550 2004-04-27 Martin Baulig <martin@ximian.com>
7552 * flowanalysis.cs (FlowBranchingLoop): New class.
7553 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
7554 UsageVector's instead of an ArrayList.
7555 (FlowBranching.Label): Likewise.
7556 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
7557 (FlowBranching.AddBreakVector): New method.
7559 2004-04-27 Miguel de Icaza <miguel@ximian.com>
7561 * attribute.cs: Small regression fix: only convert the type if we
7562 the type is different, fixes System.Drawing build.
7564 2004-04-27 Martin Baulig <martin@ximian.com>
7566 * attribute.cs (Attribute.Resolve): If we have a constant value
7567 for a named field or property, implicity convert it to the correct
7570 2004-04-27 Raja R Harinath <rharinath@novell.com>
7572 * statement.cs (Block.Block): Implicit blocks share
7573 'child_variable_names' fields with parent blocks.
7574 (Block.AddChildVariableNames): Remove.
7575 (Block.AddVariable): Mark variable as "used by a child block" in
7576 every surrounding block.
7577 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
7578 been used in a child block, complain about violation of "Invariant
7579 meaning in blocks" rule.
7580 * cs-parser.jay (declare_local_variables): Don't use
7581 AddChildVariableNames.
7582 (foreach_statement): Don't create an implicit block: 'foreach'
7585 2004-04-23 Miguel de Icaza <miguel@ximian.com>
7587 * convert.cs (ImplicitNumericConversion): 0 is also positive when
7588 converting from 0L to ulong. Fixes 57522.
7590 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7592 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
7593 derived class hides via 'new' keyword field from base class (test-242.cs).
7594 TODO: Handle this in the more general way.
7596 * class.cs (CheckBase): Ditto.
7598 2004-04-22 Marek Safar <marek.safar@seznam.cz>
7600 * decl.cs (caching_flags): New member for storing cached values
7602 (MemberCore.Flags): New enum where bit flags for caching_flags
7604 (MemberCore.cls_compliance): Moved to caching_flags.
7605 (DeclSpace.Created): Moved to caching_flags.
7607 * class.cs: Use caching_flags instead of DeclSpace.Created
7609 2004-04-21 Miguel de Icaza <miguel@ximian.com>
7611 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
7612 if we are only a derived class, not a nested class.
7614 * typemanager.cs: Same as above, but do this at the MemberLookup
7615 level (used by field and methods, properties are handled in
7616 PropertyExpr). Allow for the qualified access if we are a nested
7619 2004-04-21 Marek Safar <marek.safar@seznam.cz>
7621 * class.cs: Refactoring.
7622 (IMethodData): New inteface; Holds links to parent members
7623 to avoid member duplication (reduced memory allocation).
7624 (Method): Implemented IMethodData interface.
7625 (PropertyBase): New inner classes for get/set methods.
7626 (PropertyBase.PropertyMethod): Implemented IMethodData interface
7627 (Event): New inner classes for add/remove methods.
7628 (Event.DelegateMethod): Implemented IMethodData interface.
7630 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
7631 EmitContext (related to class.cs refactoring).
7633 2004-04-21 Raja R Harinath <rharinath@novell.com>
7635 * delegate.cs (Delegate.VerifyApplicability): If the number of
7636 arguments are the same as the number of parameters, first try to
7637 verify applicability ignoring any 'params' modifier on the last
7641 2004-04-16 Raja R Harinath <rharinath@novell.com>
7643 * class.cs (TypeContainer.AddIndexer): Use
7644 'ExplicitInterfaceName' to determine if interface name was
7645 explicitly specified. 'InterfaceType' is not initialized at this time.
7646 (TypeContainer.DefineIndexers): Remove use of temporary list. The
7647 Indexers array is already in the required order. Initialize
7648 'IndexerName' only if there are normal indexers.
7649 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
7650 (TypeContainer.Emit): Emit DefaultMember attribute only if
7651 IndexerName is initialized.
7654 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
7656 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
7659 2004-04-15 Raja R Harinath <rharinath@novell.com>
7661 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
7665 * attribute.cs (Attribute.Resolve): Check for duplicate named
7669 2004-04-15 Miguel de Icaza <miguel@ximian.com>
7671 * iterators.cs (MarkYield): track whether we are in an exception,
7672 and generate code accordingly. Use a temporary value to store the
7673 result for our state.
7675 I had ignored a bit the interaction of try/catch with iterators
7676 since their behavior was not entirely obvious, but now it is
7677 possible to verify that our behavior is the same as MS .NET 2.0
7681 2004-04-14 Miguel de Icaza <miguel@ximian.com>
7683 * iterators.cs: Avoid creating temporaries if there is no work to
7686 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
7687 Enumerations, use TypeManager.EnumToUnderlying and call
7690 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
7693 (This.Emit): Use EmitContext.EmitThis to emit our
7696 (This.EmitAssign): Ditto.
7698 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
7699 codepaths, we will move all the functionality into
7702 (FieldExpr.EmitAssign): Ditto.
7704 This fixes several hidden bugs that I uncovered while doing a code
7705 review of this today.
7707 * codegen.cs (EmitThis): reworked so the semantics are more clear
7708 and also support value types "this" instances.
7710 * iterators.cs: Changed so that for iterators in value types, we
7711 do not pass the value type as a parameter.
7713 Initialization of the enumerator helpers is now done in the caller
7714 instead of passing the parameters to the constructors and having
7715 the constructor set the fields.
7717 The fields have now `assembly' visibility instead of private.
7719 2004-04-11 Miguel de Icaza <miguel@ximian.com>
7721 * expression.cs (Argument.Resolve): Check if fields passed as ref
7722 or out are contained in a MarshalByRefObject.
7724 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
7725 another compiler type.
7727 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
7729 * class.cs (Indexer.Define): use the new name checking method.
7730 Also, return false on an error.
7731 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
7732 (is_identifier_[start/part]_character): make static.
7734 2004-04-10 Miguel de Icaza <miguel@ximian.com>
7736 * expression.cs (Binary.ResolveOperator): Do no append strings
7737 twice: since we can be invoked more than once (array evaluation)
7738 on the same concatenation, take care of this here. Based on a fix
7739 from Ben (bug #56454)
7741 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
7743 * codegen.cs: Fix another case where CS1548 must be reported (when
7744 delay-sign isn't specified and no private is available #56564). Fix
7745 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
7746 error when MCS is used on the MS runtime and we need to delay-sign
7747 (which seems unsupported by AssemblyBuilder - see #56621).
7749 2004-04-08 Marek Safar <marek.safar@seznam.cz>
7751 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
7752 (TypeManager.ComputeNamespaces): Faster implementation for
7755 * compiler.csproj: Updated AssemblyName to mcs.
7757 2004-04-07 Miguel de Icaza <miguel@ximian.com>
7759 * rootcontext.cs: Add new types to the boot resolution.
7761 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
7762 MulticastDelegate is not allowed.
7764 * typemanager.cs: Add new types to lookup: System.TypedReference
7767 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
7768 check for TypedReference or ArgIterator, they are not allowed.
7770 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
7771 makes us properly catch 1510 in some conditions (see bug 56016 for
7774 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
7776 * CryptoConvert.cs: update from corlib version
7779 2004-04-05 Miguel de Icaza <miguel@ximian.com>
7781 * class.cs (Indexer.Define): Check indexername declaration
7783 2004-04-05 Marek Safar <marek.safar@seznam.cz>
7785 * attribute.cs (IsClsCompliant): Fixed problem with handling
7786 all three states (compliant, not-compliant, undetected).
7788 2004-03-30 Marek Safar <marek.safar@seznam.cz>
7790 * attribute.cs (Attribute): Location is now public.
7791 (Resolve): Store resolved arguments (pos_values) in attribute class.
7792 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
7793 (GetClsCompliantAttributeValue): New method that gets
7794 CLSCompliantAttribute value.
7795 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
7796 if exists else null.
7797 (AttributeTester): New class for CLS-Compliant verification routines.
7799 * class.cs (Emit): Add CLS-Compliant verification.
7800 (Method.GetSignatureForError): Implemented.
7801 (Constructor.GetSignatureForError): Implemented
7802 (Constructor.HasCompliantArgs): Returns if constructor has
7803 CLS-Compliant arguments.
7804 (Constructor.Emit): Override.
7805 (Construcor.IsIdentifierClsCompliant): New method; For constructors
7806 is needed to test only parameters.
7807 (FieldBase.GetSignatureForError): Implemented.
7808 (TypeContainer): New member for storing base interfaces.
7809 (TypeContainer.FindMembers): Search in base interfaces too.
7811 * codegen.cs (GetClsComplianceAttribute): New method that gets
7812 assembly or module CLSCompliantAttribute value.
7813 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
7815 (ModuleClass.Emit): Add error 3012 test.
7817 * const.cs (Emit): Override and call base for CLS-Compliant tests.
7819 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
7820 state for all decl types.
7821 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
7822 if CLS-Compliant tests are required.
7823 (IsClsCompliaceRequired): New method. Analyze whether code
7824 must be CLS-Compliant.
7825 (IsExposedFromAssembly): New method. Returns true when MemberCore
7826 is exposed from assembly.
7827 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
7828 value or gets cached value.
7829 (HasClsCompliantAttribute): New method. Returns true if MemberCore
7830 is explicitly marked with CLSCompliantAttribute.
7831 (IsIdentifierClsCompliant): New abstract method. This method is
7832 used to testing error 3005.
7833 (IsIdentifierAndParamClsCompliant): New method. Common helper method
7834 for identifier and parameters CLS-Compliant testing.
7835 (VerifyClsCompliance): New method. The main virtual method for
7836 CLS-Compliant verifications.
7837 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
7838 null. I don't know why is null (too many public members !).
7839 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
7840 and get value of first CLSCompliantAttribute that found.
7842 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
7843 (VerifyClsCompliance): Override and add extra tests.
7845 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
7846 clscheck- disable CLS-Compliant verification event if assembly is has
7847 CLSCompliantAttribute(true).
7849 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
7850 ApllyAttribute is now called in emit section as in the other cases.
7851 Possible future Emit integration.
7852 (IsIdentifierClsCompliant): New override.
7853 (VerifyClsCompliance): New override.
7854 (GetEnumeratorName): Returns full enum name.
7856 * parameter.cs (GetSignatureForError): Implemented.
7858 * report.cs (WarningData): New struct for Warning message information.
7859 (LocationOfPreviousError): New method.
7860 (Warning): New method. Reports warning based on the warning table.
7861 (Error_T): New method. Reports error based on the error table.
7863 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
7864 verifications are done here.
7866 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
7868 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
7869 CLSCompliantAttribute.
7870 (all_imported_types): New member holds all imported types from other
7872 (LoadAllImportedTypes): New method fills static table with exported types
7873 from all referenced assemblies.
7874 (Modules): New property returns all assembly modules.
7876 2004-03-30 Miguel de Icaza <miguel@ximian.com>
7878 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
7879 throwing a parser error.
7881 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
7882 which removes the hardcoded get_/set_ prefixes for properties, as
7883 IL allows for the properties to be named something else.
7887 * expression.cs: Do not override operand before we know if it is
7890 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7892 * typemanager.cs: support for pinned variables.
7894 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7896 * decl.cs, typemanager.cs: Avoid using an arraylist
7897 as a buffer if there is only one result set.
7899 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
7901 * expression.cs: Make sure you cant call a static method
7902 with an instance expression, bug #56174.
7904 2004-03-29 Miguel de Icaza <miguel@ximian.com>
7906 * class.cs (IsDuplicateImplementation): Improve error reporting to
7907 flag 663 (method only differs in parameter modifier).
7909 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
7910 in preprocessor directives.
7912 * location.cs (LookupFile): Allow for the empty path.
7914 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
7915 better approach for some of that patch, but its failing with the
7916 CharSet enumeration. For now try/catch will do.
7918 * typemanager.cs: Do not crash if a struct does not have fields.
7921 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7923 * expression.cs: cs0213, cant fix a fixed expression.
7926 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7928 * cs-parser.jay: detect invalid embeded statements gracefully.
7931 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
7933 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
7936 the invocation type may not be a subclass of the tye of the item/
7937 The type of the item must be a subclass of the invocation item.
7942 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
7944 * attribute.cs: Added methods to get a string and a bool from an
7945 attribute. Required to information from AssemblyKeyFileAttribute,
7946 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
7947 * codegen.cs: Modified AssemblyName creation to include support for
7948 strongnames. Catch additional exceptions to report them as CS1548.
7949 * compiler.csproj: Updated include CryptoConvert.cs.
7950 * compiler.csproj.user: Removed file - user specific configuration.
7951 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
7952 Mono.Security assembly. The original class is maintained and tested in
7953 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
7954 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
7955 like CSC 8.0 (C# v2) supports.
7956 * Makefile: Added CryptoConvert.cs to mcs sources.
7957 * rootcontext.cs: Added new options for strongnames.
7959 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
7961 * driver.cs: For --expect-error, report error code `2'
7962 if the program compiled with no errors, error code `1' if
7963 it compiled with an error other than the one expected.
7965 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
7967 * compiler.csproj: Updated for Visual Studio .NET 2003.
7968 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
7969 * compiler.sln: Updated for Visual Studio .NET 2003.
7971 2004-03-24 Ravi Pratap M <ravi@ximian.com>
7973 * expression.cs: Fix bug #47234. We basically need to apply the
7974 rule that we prefer the conversion of null to a reference type
7975 when faced with a conversion to 'object' (csc behaviour).
7977 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7979 * statement.cs: Shorter form for foreach, eliminates
7980 a local variable. r=Martin.
7982 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7984 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
7985 checks if we can use brtrue/brfalse to test for 0.
7986 * expression.cs: use the above in the test for using brtrue/brfalse.
7989 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
7991 * expression.cs: Rewrite string concat stuff. Benefits:
7993 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
7994 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
7995 rather than a concat chain.
7997 * typemanager.cs: Add lookups for more concat overloads.
7999 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
8001 * expression.cs: Emit shorter il code for array init.
8018 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
8020 * statement.cs: Before, two switch blocks would be merged if the
8021 total size of the blocks (end_item - begin_item + 1) was less than
8022 two times the combined sizes of the blocks.
8024 Now, it will only merge if after the merge at least half of the
8029 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
8031 * class.cs : csc build fix for GetMethods(). See bug #52503.
8033 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
8035 * expression.cs: Make sure fp comparisons work with NaN.
8036 This fixes bug #54303. Mig approved this patch a long
8037 time ago, but we were not able to test b/c the runtime
8040 2004-03-19 Miguel de Icaza <miguel@ximian.com>
8042 * ecore.cs (TypExpr.GetHashCode): implement this overload.
8044 2004-03-19 Martin Baulig <martin@ximian.com>
8046 * class.cs (MemberCore.IsDuplicateImplementation): Report the
8047 error here and not in our caller.
8049 2004-03-19 Martin Baulig <martin@ximian.com>
8051 * interface.cs: Completely killed this file.
8052 (Interface): We're now a TypeContainer and live in class.cs.
8054 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
8055 argument; we're now also called for interfaces.
8056 (TypeContainer.DefineMembers): Allow this method being called
8058 (TypeContainer.GetMethods): New public method; formerly known as
8059 Interface.GetMethod(). This is used by PendingImplementation.
8060 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
8061 it's now private and non-static.
8062 (Interface): Moved this here; it's now implemented similar to
8064 (Method, Property, Event, Indexer): Added `bool is_interface'
8065 argument to their .ctor's.
8066 (MemberBase.IsInterface): New public field.
8068 * cs-parser.jay: Create normal Method, Property, Event, Indexer
8069 instances instead of InterfaceMethod, InterfaceProperty, etc.
8070 (opt_interface_base): Removed; we now use `opt_class_base' instead.
8071 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
8073 2004-03-19 Martin Baulig <martin@ximian.com>
8075 * class.cs (MethodCore.IsDuplicateImplementation): New private
8076 method which does the CS0111 checking.
8077 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
8078 Use IsDuplicateImplementation().
8080 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
8082 * decl.cs (FindMemberToOverride): New method to find the correct
8083 method or property to override in the base class.
8085 - Make Method/Property use the above method to find the
8086 version in the base class.
8087 - Remove the InheritableMemberSignatureCompare as it is now
8090 This patch makes large code bases much faster to compile, as it is
8091 O(n) rather than O(n^2) to do this validation.
8093 Also, it fixes bug 52458 which is that nested classes are not
8094 taken into account when finding the base class member.
8096 Reviewed/Approved by Martin.
8098 2004-03-17 Marek Safar <marek.safar@seznam.cz>
8100 * interface.cs: In all interface classes removed redundant
8101 member initialization.
8103 2004-03-16 Martin Baulig <martin@ximian.com>
8105 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
8107 2004-03-15 Miguel de Icaza <miguel@ximian.com>
8109 * decl.cs (DefineTypeAndParents): New helper method to define a
8110 type's containers before the type itself is defined; This is a
8111 bug exposed by the recent changes to Windows.Forms when an
8112 implemented interface was defined inside a class that had not been
8115 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
8117 (Check): Loop correctly to report errors modifiers
8118 (UNSAFE was not in the loop, since it was the same as TOP).
8120 * interface.cs: Every interface member now takes a ModFlags,
8121 instead of a "is_new" bool, which we set on the base MemberCore.
8123 Every place where we called "UnsafeOk" in the interface, now we
8124 call the proper member (InterfaceMethod.UnsafeOK) instead to get
8125 the unsafe settings from the member declaration instead of the
8126 container interface.
8128 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
8130 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
8131 `set_indexer_name' to the pending bits (one per type).
8133 We fixed a bug today that was picking the wrong method to
8134 override, since for properties the existing InterfaceMethod code
8135 basically ignored the method name. Now we make sure that the
8136 method name is one of the valid indexer names.
8138 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
8140 * support.cs (SeekableStreamReader): Keep track of stream byte
8141 positions and don't mix them with character offsets to the buffer.
8143 Patch from Gustavo Giráldez
8145 2004-03-15 Marek Safar <marek.safar@seznam.cz>
8147 * interface.cs (InterfaceSetGetBase): Removed double member
8148 initialization, base class does it as well.
8150 2004-03-13 Martin Baulig <martin@ximian.com>
8152 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
8153 when compiling corlib.
8155 2004-03-13 Miguel de Icaza <miguel@ximian.com>
8157 * convert.cs (ExplicitConversion): We were reporting an error on
8158 certain conversions (object_type source to a value type, when the
8159 expression was `null') before we had a chance to pass it through
8160 the user defined conversions.
8162 * driver.cs: Replace / and \ in resource specifications to dots.
8165 * class.cs: Add check for duplicate operators. Fixes 52477
8167 2004-03-11 Miguel de Icaza <miguel@ximian.com>
8169 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
8170 that are in the middle of the statements, not only at the end.
8173 * class.cs (TypeContainer.AddField): No longer set the
8174 `HaveStaticConstructor' flag, now we call it
8175 `UserDefineStaticConstructor' to diferentiate the slightly
8176 semantic difference.
8178 The situation is that we were not adding BeforeFieldInit (from
8179 Modifiers.TypeAttr) to classes that could have it.
8180 BeforeFieldInit should be set to classes that have no static
8185 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
8187 And most importantly Zoltan's comment:
8189 http://bugzilla.ximian.com/show_bug.cgi?id=44229
8191 "I think beforefieldinit means 'it's ok to initialize the type sometime
8192 before its static fields are used', i.e. initialization does not need
8193 to be triggered by the first access to the type. Setting this flag
8194 helps the JIT to compile better code, since it can run the static
8195 constructor at JIT time, and does not need to generate code to call it
8196 (possibly lots of times) at runtime. Unfortunately, mcs does not set
8197 this flag for lots of classes like String.
8199 csc sets this flag if the type does not have an explicit static
8200 constructor. The reasoning seems to be that if there are only static
8201 initalizers for a type, and no static constructor, then the programmer
8202 does not care when this initialization happens, so beforefieldinit
8205 This bug prevents the AOT compiler from being usable, since it
8206 generates so many calls to mono_runtime_class_init that the AOT code
8207 is much slower than the JITted code. The JITted code is faster,
8208 because it does not generate these calls if the vtable is type is
8209 already initialized, which is true in the majority of cases. But the
8210 AOT compiler can't do this."
8212 2004-03-10 Miguel de Icaza <miguel@ximian.com>
8214 * class.cs (MethodData.Emit): Refactor the code so symbolic
8215 information is generated for destructors; For some reasons we
8216 were taking a code path that did not generate symbolic information
8219 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
8221 * class.cs: Create a Constructor.CheckBase method that
8222 takes care of all validation type code. The method
8223 contains some code that was moved from Define.
8225 It also includes new code that checks for duplicate ctors.
8226 This fixes bug #55148.
8228 2004-03-09 Joshua Tauberer <tauberer@for.net>
8230 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
8231 a { ... }-style array creation invokes EmitStaticInitializers
8232 which is not good for reference-type arrays. String, decimal
8233 and now null constants (NullCast) are not counted toward
8234 static initializers.
8236 2004-03-05 Martin Baulig <martin@ximian.com>
8238 * location.cs (SourceFile.HasLineDirective): New public field;
8239 specifies whether the file contains or is referenced by a "#line"
8241 (Location.DefineSymbolDocuments): Ignore source files which
8242 either contain or are referenced by a "#line" directive.
8244 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
8246 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
8247 direct access to our parent, so check the method inline there.
8249 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
8251 * expression.cs (Invocation.EmitCall): Miguel's last commit
8252 caused a regression. If you had:
8257 In Foo the implict this would be null.
8259 2004-02-27 Miguel de Icaza <miguel@ximian.com>
8261 * expression.cs (Invocation.EmitCall): If the method is not
8262 virtual, do not emit a CallVirt to it, use Call.
8264 * typemanager.cs (GetFullNameSignature): Improve the method to
8265 cope with ".ctor" and replace it with the type name.
8267 * class.cs (ConstructorInitializer.Resolve): Now the method takes
8268 as an argument the ConstructorBuilder where it is being defined,
8269 to catch the recursive constructor invocations.
8271 2004-02-26 Miguel de Icaza <miguel@ximian.com>
8273 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
8274 routines to check if a type is an enumerable/enumerator allow
8275 classes that implement the IEnumerable or IEnumerator interfaces.
8277 * class.cs (Property, Operator): Implement IIteratorContainer, and
8278 implement SetYields.
8280 (Property.Define): Do the block swapping for get_methods in the
8281 context of iterators. We need to check if Properties also
8282 include indexers or not.
8284 (Operator): Assign the Block before invoking the
8285 OperatorMethod.Define, so we can trigger the Iterator code
8288 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
8289 Property and Operator classes are not created when we parse the
8290 declarator but until we have the block completed, so we use a
8291 singleton SimpleIteratorContainer.Simple to flag whether the
8292 SetYields has been invoked.
8294 We propagate this setting then to the Property or the Operator to
8295 allow the `yield' to function.
8297 2004-02-25 Marek Safar <marek.safar@seznam.cz>
8299 * codegen.cs: Implemented attribute support for modules.
8300 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
8301 Assembly/Module functionality.
8303 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
8304 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
8305 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
8307 2004-02-16 Marek Safar <marek.safar@seznam.cz>
8309 * interface.cs (FindMembers): The operation is performed on all base
8310 interfaces and not only on the first. It is required for future CLS Compliance patch.
8312 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
8314 * statement.cs, codegen.cs:
8315 This patch deals with patterns such as:
8317 public class List : IEnumerable {
8319 public MyEnumerator GetEnumerator () {
8320 return new MyEnumerator(this);
8323 IEnumerator IEnumerable.GetEnumerator () {
8327 public struct MyEnumerator : IEnumerator {
8332 Before, there were a few things we did wrong:
8333 1) we would emit callvirt on a struct, which is illegal
8334 2) we emited ldarg when we needed to emit ldarga
8335 3) we would mistakenly call the interface methods on an enumerator
8336 type that derived from IEnumerator and was in another assembly. For example:
8338 public class MyEnumerator : IEnumerator
8340 Would have the interface methods called, even if there were public impls of the
8341 method. In a struct, this lead to invalid IL code.
8343 2004-02-11 Marek Safar <marek.safar@seznam.cz>
8345 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
8348 * delegate.cs (Define): Fixed crash when delegate type is undefined.
8350 2004-02-11 Miguel de Icaza <miguel@ximian.com>
8352 * cs-parser.jay: Fix small regression: we were not testing V2
8353 compiler features correctly.
8355 * interface.cs: If the emit context is null, then create one
8357 2004-02-09 Marek Safar <marek.safar@seznam.cz>
8359 * decl.cs (GetSignatureForError): New virtual method to get full name
8362 * attribute.cs (IAttributeSupport): New interface for attribute setting.
8363 Now it is possible to rewrite ApplyAttributes method to be less if/else.
8365 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
8366 Duplicated members and code in these classes has been removed.
8367 Better encapsulation in these classes.
8369 2004-02-07 Miguel de Icaza <miguel@ximian.com>
8371 * assign.cs (Assign.DoResolve): When dealing with compound
8372 assignments, there is a new rule in ECMA C# 2.4 (might have been
8373 there before, but it is documented here) that states that in:
8377 If b is of type int, and the `op' is a shift-operator, then the
8378 above is evaluated as:
8382 * expression.cs (Binary.ResolveOperator): Instead of testing for
8383 int/uint/long/ulong, try to implicitly convert to any of those
8384 types and use that in pointer arithmetic.
8386 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
8387 method to print information for from the type, not from the
8388 null-method we were given.
8390 2004-02-01 Duncan Mak <duncan@ximian.com>
8392 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
8393 parsing for cmd, fixes bug #53694.
8395 2004-02-04 Marek Safar <marek.safar@seznam.cz>
8397 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
8398 in the member name duplication tests. Property and operator name duplication
8399 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
8401 2004-02-03 Marek Safar <marek.safar@seznam.cz>
8403 * interface.cs (PopulateMethod): Fixed crash when interface method
8404 returns not existing type (error test cs0246-3.cs).
8406 2004-02-02 Ravi Pratap M <ravi@ximian.com>
8408 * cs-parser.jay (interface_accessors): Re-write actions to also
8409 store attributes attached to get and set methods. Fix spelling
8412 (inteface_property_declaration): Modify accordingly.
8414 (InterfaceAccessorInfo): New helper class to store information to pass
8415 around between rules that use interface_accessors.
8417 * interface.cs (Emit): Apply attributes on the get and set
8418 accessors of properties and indexers too.
8420 * attribute.cs (ApplyAttributes): Modify accordingly to use the
8421 right MethodBuilder when applying attributes to the get and set accessors.
8423 2004-01-31 Miguel de Icaza <miguel@ximian.com>
8425 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
8427 2004-01-26 Miguel de Icaza <miguel@ximian.com>
8429 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
8431 2004-01-25 Miguel de Icaza <miguel@ximian.com>
8433 * cs-parser.jay: Remove YIELD token, instead use the new grammar
8434 changes that treat `yield' specially when present before `break'
8437 * cs-tokenizer.cs: yield is no longer a keyword.
8439 2004-01-23 Marek Safar <marek.safar@seznam.cz>
8441 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
8442 setting for default constructors.
8443 For default constructors are almost every time set wrong Modifier. The
8444 generated IL code has been alright. But inside mcs this values was
8445 wrong and this was reason why several of my CLS Compliance tests
8448 2004-01-22 Martin Baulig <martin@ximian.com>
8450 * cs-parser.jay (namespace_or_type_name): Return an Expression,
8451 not a QualifiedIdentifier. This is what `type_name_expression'
8452 was previously doing.
8453 (type_name_expression): Removed; the code is now in
8454 `namespace_or_type_name'.
8455 (qualified_identifier): Removed, use `namespace_or_type_name'
8457 (QualifiedIdentifier): Removed this class.
8459 2004-01-22 Martin Baulig <martin@ximian.com>
8461 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
8462 not a string as alias name.
8464 2004-01-21 Miguel de Icaza <miguel@ximian.com>
8466 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
8467 #52730 bug, and instead compute correctly the need to use a
8468 temporary variable when requesting an address based on the
8469 static/instace modified of the field and the constructor.
8471 2004-01-21 Martin Baulig <martin@ximian.com>
8473 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
8474 class and namespace before looking up aliases. Fixes #52517.
8476 2004-01-21 Martin Baulig <martin@ximian.com>
8478 * flowanalysis.cs (UsageVector.Merge): Allow variables being
8479 assinged in a 'try'; fixes exception4.cs.
8481 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8482 * class.cs : Implemented parameter-less constructor for TypeContainer
8484 * decl.cs: Attributes are now stored here. New property OptAttributes
8486 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
8488 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
8490 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8492 * typemanager.cs (CSharpSignature): Now reports also inner class name.
8493 (CSharpSignature): New method for indexer and property signature.
8495 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8497 * pending.cs (IsVirtualFilter): Faster implementation.
8499 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8501 * typemanager.cs: Avoid inclusion of same assembly more than once.
8503 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8505 * cs-parser.jay: Fixed problem where the last assembly attribute
8506 has been applied also to following declaration (class, struct, etc.)
8508 2004-01-21 Marek Safar <marek.safar@seznam.cz>
8510 * class.cs: Added error CS0538, CS0539 reporting.
8511 Fixed crash on Microsoft runtime when field type is void.
8513 * cs-parser.jay: Added error CS0537 reporting.
8515 * pending.cs: Added error CS0535 reporting.
8516 Improved error report for errors CS0536, CS0534.
8518 2004-01-20 Miguel de Icaza <miguel@ximian.com>
8520 Merge a few bits from the Anonymous Method MCS tree.
8522 * statement.cs (ToplevelBlock): New class for toplevel methods,
8523 will hold anonymous methods, lifted variables.
8525 * cs-parser.jay: Create toplevel blocks for delegates and for
8526 regular blocks of code.
8528 2004-01-20 Martin Baulig <martin@ximian.com>
8530 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
8531 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
8532 and `NeedExplicitReturn'; added `IsLastStatement'.
8533 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
8534 have a `ReturnLabel' or we're not unreachable.
8536 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
8537 child's reachability; don't just override ours with it. Fixes
8538 #58058 (lluis's example).
8539 (FlowBranching): Added public InTryOrCatch(), InCatch(),
8540 InFinally(), InLoop(), InSwitch() and
8541 BreakCrossesTryCatchBoundary() methods.
8543 * statement.cs (Return): Do all error checking in Resolve().
8544 Unless we are the last statement in a top-level block, always
8545 create a return label and jump to it.
8546 (Break, Continue): Do all error checking in Resolve(); also make
8547 sure we aren't leaving a `finally'.
8548 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
8549 statement in a top-level block.
8550 (Block.Flags): Added `IsDestructor'.
8551 (Block.IsDestructor): New public property.
8553 2004-01-20 Martin Baulig <martin@ximian.com>
8555 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
8557 2004-01-20 Martin Baulig <martin@ximian.com>
8559 * statement.cs (Statement.ResolveUnreachable): New public method.
8560 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
8561 (Block.Resolve): Resolve unreachable statements.
8563 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8565 * expression.cs: We need to fix the case where we do
8566 not have a temp variable here.
8568 * assign.cs: Only expression compound assignments need
8569 temporary variables.
8571 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
8573 * flowanalysis.cs: Reduce memory allocation in a few ways:
8574 - A block with no variables should not allocate a bit
8576 - A method with no out parameters does not need any tracking
8577 for assignment of the parameters, so we need not allocate
8580 public readonly Type[] VariableTypes;
8581 public readonly string[] VariableNames;
8582 Are redundant. The data is already stored in the variable
8583 map, so we need not allocate another array for it.
8584 - We need to add alot of checks for if (params | locals) == null
8585 due to the first two changes.
8587 2004-01-18 Miguel de Icaza <miguel@ximian.com>
8589 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
8590 implement IMemoryLocation, we store a copy on a local variable and
8591 take the address of it. Patch from Benjamin Jemlich
8593 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
8594 to use a special "type_name_expression" rule which reduces the
8595 number of "QualifiedIdentifier" classes created, and instead
8596 directly creates MemberAccess expressions.
8598 2004-01-17 Miguel de Icaza <miguel@ximian.com>
8600 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
8601 that fixes #52853. Null literal assignment to ValueType
8603 * class.cs (MethodData.Emit): Instead of checking the name of the
8604 method to determine if its a destructor, create a new derived
8605 class from Method called Destructor, and test for that.
8607 * cs-parser.jay: Create a Destructor object instead of a Method.
8609 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
8613 2004-01-16 Miguel de Icaza <miguel@ximian.com>
8615 * expression.cs (Binary.ResolveOperator): Perform an implicit
8616 conversion from MethodGroups to their delegate types on the
8619 * delegate.cs: Introduce a new class DelegateCreation that is the
8620 base class for `NewDelegate' and `ImplicitDelegateCreation',
8621 factor some code in here.
8623 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
8624 conversion from MethodGroups to compatible delegate types.
8626 * ecore.cs (Expression.Resolve): Do not flag error 654
8627 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
8628 we allow conversions from MethodGroups to delegate types now.
8630 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
8631 assignments in v2 either.
8633 2004-01-10 Miguel de Icaza <miguel@ximian.com>
8635 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
8636 static read-only fields in ctors.
8638 Applied patch from Benjamin Jemlich
8640 * expression.cs (UnaryMutator): Avoid leaking local variables.
8642 2004-01-09 Miguel de Icaza <miguel@ximian.com>
8644 * cs-tokenizer.cs (IsCastToken): Allow the various native types
8645 here to return true, as they can be used like this:
8649 Fixed 49836 and all the other dups
8651 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
8653 * driver.cs: Implement /win32res and /win32icon.
8655 2004-01-08 Miguel de Icaza <miguel@ximian.com>
8657 * cs-parser.jay: Add a rule to improve error handling for the
8658 common mistake of placing modifiers after the type.
8660 2004-01-07 Miguel de Icaza <miguel@ximian.com>
8662 * cs-parser.jay (interface_event_declaration): Catch
8663 initialization of events on interfaces, and report cs0068
8665 * cs-parser.jay (interface_event_declaration): Catch
8666 initialization of events.
8668 * ecore.cs: Better report missing constructors.
8670 * expression.cs (Binary.ResolveOperator): My previous bug fix had
8671 the error reporting done in the wrong place. Fix.
8673 * expression.cs (Binary.ResolveOperator): Catch the
8674 operator + (E x, E y) error earlier, and later allow for implicit
8675 conversions in operator +/- (E e, U x) from U to the underlying
8678 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
8679 52596, if the container class is abstract, the default constructor
8680 is protected otherwise its public (before, we were always public).
8682 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
8685 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
8686 Jemlich that fixes bug #52597, MCS was generating invalid code for
8687 idisposable structs. Thanks to Ben for following up with this
8690 2004-01-06 Miguel de Icaza <miguel@ximian.com>
8692 * driver.cs: Allow assemblies without code to be generated, fixes
8695 2004-01-07 Nick Drochak <ndrochak@gol.com>
8697 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
8699 2004-01-05 Miguel de Icaza <miguel@ximian.com>
8701 * cs-parser.jay: Add rules to improve error reporting if fields or
8702 methods are declared at the namespace level (error 116)
8704 * Add rules to catch event add/remove
8706 2004-01-04 David Sheldon <dave-mono@earth.li>
8708 * expression.cs: Added matching ")" to error message for
8711 2004-01-03 Todd Berman <tberman@gentoo.org>
8713 * ecore.cs, attribute.cs:
8714 Applying fix from #52429.
8716 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8718 * ecore.cs, expression.cs, statement.cs:
8719 Total rewrite of how we handle branching. We
8720 now handle complex boolean expressions with fewer
8721 jumps. As well if (x == 0) no longer emits a ceq.
8723 if (x is Foo) is much faster now, because we generate
8726 Overall, we get a pretty big improvement on our benchmark
8727 tests. The code we generate is smaller and more readable.
8729 I did a full two-stage bootstrap. The patch was reviewed
8730 by Martin and Miguel.
8732 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8734 * cs-parser.jay: Make primary_expression not take a QI.
8735 we dont need this because the member_access rule covers
8736 us here. So we replace the rule with just IDENTIFIER.
8738 This has two good effects. First, we remove a s/r conflict.
8739 Second, we allocate many fewer QualifiedIdentifier objects.
8741 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8743 * attribute.cs: Handle MarshalAs attributes as pseudo, and
8744 set the correct information via SRE. This prevents
8745 hanging on the MS runtime. Fixes #29374.
8747 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
8749 * convert.cs: correctly handle conversions to value types
8750 from Enum and ValueType as unboxing conversions.
8752 Fixes bug #52569. Patch by Benjamin Jemlich.
8754 2004-01-02 Ravi Pratap <ravi@ximian.com>
8756 * expression.cs (BetterConversion): Prefer int -> uint
8757 over int -> ulong (csc's behaviour). This fixed bug #52046.
8759 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
8761 * decl.cs (MemberCache.FindMembers): now returns a
8764 * typemanager.cs: In general, go with with ^^.
8765 (CopyNewMethods): take an IList.
8766 (RealMemberLookup): Only allocate an arraylist
8767 if we copy from two sets of methods.
8769 This change basically does two things:
8770 1) Fewer array lists allocated due to CopyNewMethods.
8771 2) the explicit cast in MemberList costed ALOT.
8773 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
8775 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
8776 a hashtable to avoid needless string allocations when an identifier is
8777 used more than once (the common case).
8779 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8781 * pending.cs: MS's TypeBuilder.GetInterfaces ()
8782 is broken, it will not return anything. So, we
8783 have to use the information we have in mcs to
8786 * typemanager.cs: Add a cache for GetInterfaces,
8787 since this will now be used more often (due to ^^)
8789 (GetExplicitInterfaces) New method that gets the
8790 declared, not effective, interfaces on a type
8791 builder (eg, if you have interface IFoo, interface
8792 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
8795 This patch makes MCS able to bootstrap itself on
8798 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
8800 * expression.cs: Remove the Nop's that Miguel put
8803 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8805 * report.cs, codegen.cs: Give the real stack trace to
8806 the error when an exception is thrown.
8808 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8810 * decl.cs: only allocate hashtables for ifaces if
8813 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
8815 * expression.cs: fix the error from cs0121-2.cs
8816 (a parent interface has two child interfaces that
8817 have a function with the same name and 0 params
8818 and the function is called through the parent).
8820 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
8822 * class.cs, rootcontext.cs, typmanager.cs: do not
8825 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
8827 * codegen.cs: remove stack for the ec flow branching.
8828 It is already a linked list, so no need.
8830 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
8832 * Makefile: Allow custom profiler here.
8834 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8836 * typemanager.cs (LookupType):
8837 - Use a static char [], because split takes
8838 a param array for args, so it was allocating
8840 - Do not store true in a hashtable, it boxes.
8842 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
8844 * flowanalysis.cs: bytify common enums.
8846 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8848 * modifiers.cs: Add a new set of flags for the
8849 flags allowed on explicit interface impls.
8850 * cs-parser.jay: catch the use of modifiers in
8851 interfaces correctly.
8852 * class.cs: catch private void IFoo.Blah ().
8854 All related to bug #50572.
8856 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8858 * decl.cs: Rewrite the consistant accessability checking.
8859 Accessability is not linear, it must be implemented in
8860 a tableish way. Fixes #49704.
8862 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
8864 * expression.cs: Handle negation in a checked context.
8865 We must use subtraction from zero. Fixes #38674.
8867 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8869 * class.cs: Ignore static void main in DLLs.
8870 * rootcontext.cs: Handle the target type here,
8871 since we are have to access it from class.cs
8872 * driver.cs: account for the above.
8874 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
8876 * report.cs: Give line numbers and files if available.
8878 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
8880 * driver.cs: Implement /addmodule.
8882 * typemanager.cs: Change 'modules' field so it now contains Modules not
8885 2003-12-20 Martin Baulig <martin@ximian.com>
8887 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
8888 (FieldBase.IsAssigned): Removed this field.
8889 (FieldBase.SetAssigned): New public method.
8890 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
8892 2003-12-20 Martin Baulig <martin@ximian.com>
8894 * expression.cs (LocalVariableReference.DoResolve): Don't set
8895 `vi.Used' if we're called from DoResolveLValue().
8897 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
8898 returns the usage vector it just merged into the current one -
8899 pass this one to UsageWarning().
8900 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
8901 of the `EmitContext', don't call this recursively on our children.
8903 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
8905 * driver.cs: Implement /target:module.
8907 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
8909 * support.cs (CharArrayHashtable): New helper class.
8911 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
8912 char arrays, not strings, so we can avoid creating a string in
8913 consume_identifier if the identifier is a keyword.
8915 2003-12-16 Martin Baulig <martin@ximian.com>
8917 * statement.cs (LocalInfo.Assigned): Removed this property.
8918 (LocalInfo.Flags): Removed `Assigned'.
8919 (LocalInfo.IsAssigned): New public method; takes the EmitContext
8920 and uses flow analysis.
8921 (Block.UsageWarning): Made this method private.
8922 (Block.Resolve): Call UsageWarning() if appropriate.
8924 * expression.cs (LocalVariableReference.DoResolve): Always set
8925 LocalInfo.Used here.
8927 2003-12-13 Martin Baulig <martin@ximian.com>
8929 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
8930 any value here; we're now using flow analysis to figure out
8931 whether a statement/block returns a value.
8933 2003-12-13 Martin Baulig <martin@ximian.com>
8935 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
8937 (FlowBranching.MergeFinally): Don't call
8938 `branching.CheckOutParameters()' here, this is called in
8940 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
8941 when adding the `finally' vector.
8943 2003-12-13 Martin Baulig <martin@ximian.com>
8946 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
8947 actually work and also fix #48962.
8949 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
8951 * decl.cs: Do not check System.Object for nested types,
8952 since we know it does not have any. Big bang for buck:
8957 corlib: 17.99 seconds
8961 corlib: 17.39 seconds
8963 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
8965 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
8966 time we are returning 0 members, so we save alot here.
8968 2003-12-11 Martin Baulig <martin@ximian.com>
8970 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
8971 `MergeChild()', also just take the `FlowBranching' as argument;
8972 call Merge() on it and return the result.
8973 (FlowBranching.Merge): We don't need to do anything if we just
8976 2003-12-11 Martin Baulig <martin@ximian.com>
8978 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
8979 them in an `ArrayList' to reduce memory usage. Thanks to Ben
8980 Maurer for this idea.
8982 2003-12-11 Martin Baulig <martin@ximian.com>
8984 * flowanalysis.cs (MergeResult): This class is now gone; we now
8985 use the `UsageVector' for this. The reason for this is that if a
8986 branching just has one sibling, we don't need to "merge" them at
8987 all - that's the next step to do.
8988 (FlowBranching.Merge): We now return a `UsageVector' instead of a
8991 2003-12-11 Martin Baulig <martin@ximian.com>
8993 Reworked flow analyis and made it more precise and bug-free. The
8994 most important change is that we're now using a special `Reachability'
8995 class instead of having "magic" meanings of `FlowReturns'. I'll
8996 do some more cleanups and optimizations and also add some more
8997 documentation this week.
8999 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
9000 largely reworked this class.
9001 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
9002 the new `Reachability' class instead of having "magic" values here.
9003 (FlowBranching): We're now using an instance of `Reachability'
9004 instead of having separate `Returns', `Breaks' etc. fields.
9006 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
9007 based on flow analysis; ignore the return value of block.Emit ().
9009 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
9011 * driver.cs typemanager.cs: Find the mono extensions to corlib even
9012 if they are private.
9014 2003-12-09 Martin Baulig <martin@ximian.com>
9016 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
9017 call them directly on the UsageVector.
9019 2003-12-09 Martin Baulig <martin@ximian.com>
9021 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
9022 Changed return type from `FlowReturns' to `Reachability'.
9024 2003-12-09 Martin Baulig <martin@ximian.com>
9026 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
9027 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
9028 `Reachable' fields with a single `Reachability' one.
9030 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9032 * class.cs (FindMembers): Remove foreach's.
9045 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9050 This patch does a few things:
9051 1. EmptyStatement is now a singleton, so it is never reallocated.
9052 2. All blah is EmptyStatement constructs have been changed to
9053 blah == EmptyStatement.Value, which is much faster and valid
9054 now that EmptyStatement is a singleton.
9055 3. When resolving a block, rather than allocating a new array for
9056 the non-empty statements, empty statements are replaced with
9057 EmptyStatement.Value
9058 4. Some recursive functions have been made non-recursive.
9059 Mainly the performance impact is from (3), however (1) and (2) are needed for
9060 this to work. (4) does not make a big difference in normal situations, however
9061 it makes the profile look saner.
9066 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9067 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
9068 Total memory allocated: 56397 KB
9071 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
9072 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
9073 Total memory allocated: 55666 KB
9075 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9077 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
9078 than the hashtable in a hashtable version
9080 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
9081 we always end up concating a string. This results in a huge perf
9082 loss, because many strings have to be tracked by the GC. In this
9083 patch, we first use a hashtable that works with two keys, so that
9084 the strings do not need to be concat'ed.
9095 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
9097 * Makefile: Add a new target `do-time' that does a quick and simple
9098 profile, leaving easy to parse output.
9100 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
9102 * codegen.cs (Init): Create the dynamic assembly with
9103 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
9105 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
9107 * support.cs: Make the PtrHashtable use only one
9108 instance of its comparer.
9110 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
9112 * typemanager.cs: Fix lookup of GetNamespaces.
9114 2003-11-29 Miguel de Icaza <miguel@ximian.com>
9116 * expression.cs: Removed redundant line.
9118 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
9119 ArrayLists, use for loops with bounds.
9121 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
9124 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
9125 arraylists, use for loop with bounds.
9127 The above three changes give us a 0.071 second performance
9128 improvement out of 3.294 seconds down to 3.223. On my machine
9129 the above changes reduced the memory usage by 1,387 KB during
9132 * cs-parser.jay (QualifiedIdentifier): New class used to represent
9133 QualifiedIdentifiers. Before we created a new string through
9134 concatenation, and mostly later on, the result would be
9135 manipulated by DecomposeQI through string manipulation.
9137 This reduced the compiler memory usage for bootstrapping from
9138 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
9139 compile times in 0.05 seconds.
9141 2003-11-28 Dick Porter <dick@ximian.com>
9143 * support.cs: Do string compares with the Invariant culture.
9151 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
9152 the comparison is done with the Invariant culture.
9154 2003-11-27 Miguel de Icaza <miguel@ximian.com>
9156 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
9157 GetEnumerator method.
9159 (ProbeCollectionType): Iterate starting at the most specific type
9160 upwards looking for a GetEnumerator
9162 * expression.cs: Shift count can be up to 31 for int/uint and 63
9165 2003-11-26 Miguel de Icaza <miguel@ximian.com>
9167 * statement.cs (Block.LookupLabel): Also look for the label on the
9168 children blocks. Use a hash table to keep track of visited
9171 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
9172 we actually did transform the other operand, otherwise fall back
9173 to the common codepath that casts to long.
9175 * cs-tokenizer.cs: Use the same code pattern as the int case.
9176 Maybe I should do the parsing myself, and avoid depending on the
9177 Parse routines to get this done.
9179 2003-11-25 Miguel de Icaza <miguel@ximian.com>
9181 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9182 which fixes bug 51347. This time test it.
9184 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
9185 attributes for example can not tell the difference between these.
9186 The difference was only a syntax feature of the language.
9188 * attribute.cs: Apply attributes to delegates.
9190 * delegate.cs: Call the apply attributes method.
9192 2003-11-24 Miguel de Icaza <miguel@ximian.com>
9194 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
9195 comparing 0 vs Byte.MinValue, not the value
9197 (ImplicitConversionRequired): When reporting a conversion error,
9198 use error 31 to print out the constant error instead of the
9201 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
9202 which fixes bug 51347.
9204 2003-11-22 Miguel de Icaza <miguel@ximian.com>
9206 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
9207 which fixes the -warnaserror command line option.
9209 2003-11-21 Miguel de Icaza <miguel@ximian.com>
9211 * cfold.cs (DoNumericPromotions): During constant folding of
9212 additions on UIntConstant, special case intconstants with
9213 IntConstants like we do on the expression binary operator.
9215 2003-11-12 Miguel de Icaza <miguel@ximian.com>
9217 * convert.cs (ImplicitReferenceConversion): We were missing a case
9218 (System.Enum are not value types or class types, so we need to
9219 classify them separatedly).
9221 * driver.cs: We do not support error 2007.
9223 2003-11-12 Jackson Harper <jackson@ximian.com>
9225 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
9226 system directory. Also use the full file name so users can
9227 libraries names mscorlib-o-tron.dll in a non system dir.
9229 2003-11-10 Martin Baulig <martin@ximian.com>
9231 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
9232 (TypeManager.InitCoreTypes): Initialize them here, but instead of
9233 calling `ResolveType()' on them, directly assign their `Type'.
9235 2003-11-08 Martin Baulig <martin@ximian.com>
9237 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
9238 return value and the `out parent' parameter.
9239 (TypeContainer.DefineType): Moved the CS0644 check into
9240 GetClassBases(). Don't pass the interface types to the
9241 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
9242 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
9244 * ecore.cs (TypeExpr.IsAttribute): New property.
9245 (TypeExpr.GetInterfaces): New method.
9247 * interface.cs (Interface.GetInterfaceTypeByName): Return a
9248 TypeExpr instead of a Type.
9249 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
9250 (Interface.DefineType): Don't pass the interface types to the
9251 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
9252 them later and then call `TypeBulider.AddInterfaceImplementation()'.
9254 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
9255 instead of a `Type[]'.
9256 (TypeManager.RegisterBuilder): Likewise.
9257 (TypeManager.AddUserInterface): Likewise.
9258 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
9259 `Type[]' and also return a `TypeExpr[]'.
9260 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
9262 2003-11-08 Martin Baulig <martin@ximian.com>
9264 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
9267 2003-11-08 Martin Baulig <martin@ximian.com>
9269 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
9270 TypeManager.ResolveExpressionTypes().
9272 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
9273 instead of an Expression.
9274 (TypeExpr): This is now an abstract base class for `TypeExpression'.
9275 (TypeExpression): New public class; formerly known as `TypeExpr'.
9277 * expression.cs (ComposedCast): Derive from TypeExpr.
9279 * typemanager.cs (TypeManager.system_*_expr): These are now
9280 TypExpr's instead of Expression's.
9281 (TypeManager.ResolveExpressionTypes): New public static function;
9282 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
9285 2003-11-06 Miguel de Icaza <miguel@ximian.com>
9287 * expression.cs (New.DoResolve): Do not dereference value that
9288 might be a null return.
9290 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
9291 sure that the constant value has the right type. Fixes an
9292 unreported bug, similar to 50425.
9294 * const.cs (Const.LookupConstantValue): Call
9295 ImplicitStandardConversionExists before doing a conversion to
9296 avoid havng the TypeManager.ChangeType do conversions.
9298 Reduced the number of casts used
9300 (Const.ChangeType): New routine to enable reuse of the constant
9301 type changing code from statement.
9303 * typemanager.cs (ChangeType): Move common initialization to
9304 static global variables.
9308 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
9309 every value type to go through, even if it was void. Fix that.
9311 * cs-tokenizer.cs: Use is_identifier_start_character on the start
9312 character of the define, and the is_identifier_part_character for
9313 the rest of the string.
9315 2003-11-05 Miguel de Icaza <miguel@ximian.com>
9317 * expression.cs (UnaryMutator.EmitCode): When I updated
9318 LocalVariableReference.DoResolve, I overdid it, and dropped an
9319 optimization done on local variable references.
9321 2003-11-04 Miguel de Icaza <miguel@ximian.com>
9323 * ecore.cs: Convert the return from Ldlen into an int.
9325 2003-10-20 Miguel de Icaza <miguel@ximian.com>
9327 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
9328 the accessibility, this is a special case for toplevel non-public
9329 classes (internal for instance).
9331 2003-10-20 Nick Drochak <ndrochak@gol.com>
9333 * ecore.cs: Fix typo and build. Needed another right paren.
9335 2003-10-19 Miguel de Icaza <miguel@ximian.com>
9337 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
9338 `internal' case regular and protected, but not allowing protected
9339 to be evaluated later. Bug 49840
9341 2003-10-15 Miguel de Icaza <miguel@ximian.com>
9343 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
9344 to kb.Nlast, and not the kb.nFirst to isolate the switch
9347 Extract the underlying type, so enumerations of long/ulong are
9348 treated like long/ulong.
9350 2003-10-14 Miguel de Icaza <miguel@ximian.com>
9352 * expression.cs (New): Overload the meaning of RequestedType to
9353 track the possible creation of the NewDelegate type, since
9354 DoResolve is invoked more than once for new constructors on field
9357 See bugs: #48800 and #37014
9359 * cs-parser.jay (declare_local_constants): Take an arraylist
9360 instead of a single constant.
9362 (local_constant_declaration): It should take a
9363 constant_declarators, not a constant_declarator. Fixes 49487
9365 * convert.cs: Fix error report.
9367 2003-10-13 Jackson Harper <jackson@ximian.com>
9369 * typemanager.cs (TypeToCoreType): Add float and double this fixes
9372 2003-10-09 Martin Baulig <martin@ximian.com>
9374 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
9376 (MethodCore.DoDefineParameters): Removed the TypeContainer
9377 argument; use the DeclSpace which was passed to the .ctor instead.
9378 (MethodCore.CheckParameter): Take a DeclSpace instead of a
9379 TypeContainer; we only need a DeclSpace here.
9381 2003-10-09 Martin Baulig <martin@ximian.com>
9383 * class.cs (MethodData): Added additional `DeclSpace ds' argument
9385 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
9386 EmitContext's .ctor.
9388 2003-10-09 Martin Baulig <martin@ximian.com>
9390 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
9391 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
9392 AsAccessible(), moved them as well.
9394 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
9396 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
9398 * cs-parser.jay : Renamed yyName to yyNames related to jay.
9400 2003-10-07 Miguel de Icaza <miguel@ximian.com>
9402 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
9403 generation for >=, as spotted by Paolo, bug 48679.
9404 Patch from David Waite.
9406 * cs-tokenizer.cs: Add handling for #pragma.
9408 * cs-parser.jay: Allow for both yield and yield return in the
9409 syntax. The anti-cobolization of C# fight will go on!
9411 * class.cs (TypeBuilder.DefineType): Catch error condition here
9412 (Parent.DefineType erroring out and returning null).
9414 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
9415 coping with enumerations variables, we were mistakenly processing
9416 them as a regular value type instead of built-in types. Fixes the
9419 * typemanager.cs (IsBuiltinOrEnum): New method.
9421 2003-09-30 Miguel de Icaza <miguel@ximian.com>
9423 * cs-parser.jay: Upgrade: yield now needs the return clause.
9425 2003-09-19 Martin Baulig <martin@ximian.com>
9427 * decl.cs (MemberCache.SetupCacheForInterface): Take a
9428 `MemberCache parent' argument. Normally, an interface doesn't
9429 have a parent type except System.Object, but we use this in gmcs
9430 for generic type parameters.
9432 2003-09-18 Martin Baulig <martin@ximian.com>
9434 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
9435 on `type.IsInterface'; don't check whether the type has a parent
9436 to determine whether it's an interface.
9438 2003-09-15 Martin Baulig <martin@ximian.com>
9440 * class.cs (TypeContainer.DefineType): Added an error flag to
9441 avoid reporting duplicate CS0146's ("class definition is
9444 * driver.cs (Driver.MainDriver): Abort if
9445 RootContext.ResolveTree() reported any errors.
9447 2003-09-07 Martin Baulig <martin@ximian.com>
9449 * report.cs (Error, Warning): Added overloaded versions which take
9450 a `params object[] args' and call String.Format().
9452 2003-09-07 Martin Baulig <martin@ximian.com>
9454 * decl.cs (DeclSpace..ctor): Don't call
9455 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
9456 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
9457 (DeclSpace.RecordDecl): New method.
9459 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
9461 2003-09-02 Ravi Pratap <ravi@ximian.com>
9463 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
9464 value attributes to be applied to ParameterBuilders.
9466 * class.cs (MethodCore.LabelParameters): Make static and more
9467 generic so that it can be used from other places - like interface
9468 methods, for instance.
9470 * interface.cs (Interface.Emit): Call LabelParameters before
9471 emitting attributes on the InterfaceMethod.
9473 2003-08-26 Martin Baulig <martin@ximian.com>
9475 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
9476 resolving aliases; fixes #47927.
9478 2003-08-26 Martin Baulig <martin@ximian.com>
9480 * statement.cs (Using.DoResolve): This is internally emitting a
9481 try/finally clause, so we need to set ec.NeedExplicitReturn if we
9482 do not always return. Fixes #47681.
9484 2003-08-26 Martin Baulig <martin@ximian.com>
9486 * decl.cs (MemberCore): Moved WarningNotHiding(),
9487 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
9489 (AdditionResult): Make this nested in DeclSpace.
9490 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
9491 argument; call NamespaceEntry.Define() unless we're nested in a
9494 * namespace.cs (Namespace.DefineName): New public function. This
9495 is called from DeclSpace's .ctor to add
9496 (Namespace.Lookup): Include DeclSpaces in the lookup.
9498 * class.cs (Operator): Derive from MemberBase, not MemberCore.
9500 * const.cs (Const): Derive from MemberBase, not MemberCore.
9502 2003-08-25 Martin Baulig <martin@ximian.com>
9504 * convert.cs (Convert.ExplicitReferenceConversion): When
9505 converting from an interface type to a class, unbox if the target
9506 type is a struct type. Fixes #47822.
9508 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9510 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
9513 2003-08-22 Martin Baulig <martin@ximian.com>
9515 * class.cs (TypeManager.DefineType): When defining a nested type,
9516 call DefineType() on our parent; fixes #47801.
9518 2003-08-22 Martin Baulig <martin@ximian.com>
9520 * class.cs (MethodData.Define): While checking if a method is an
9521 interface implementation, improve the test a bit more to fix #47654.
9523 2003-08-22 Martin Baulig <martin@ximian.com>
9525 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
9526 correctly; fixes #47722.
9528 2003-08-22 Martin Baulig <martin@ximian.com>
9530 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9531 LocalVariableReference, ensure it's not read-only. Fixes #47536.
9533 * statement.cs (Fixed.DoResolve): Make all variables read-only.
9535 2003-08-22 Martin Baulig <martin@ximian.com>
9537 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
9538 can only be assigned in static constructors. Fixes #47161.
9540 2003-08-22 Martin Baulig <martin@ximian.com>
9542 Rewrote and improved the flow analysis code.
9544 * flowbranching.cs (FlowBranching): Make this class abstract.
9545 (FlowBranching.CreateBranching): New static function to create a
9547 (FlowBranchingBlock, FlowBranchingException): New classes.
9548 (FlowBranching.UsageVector.Type): New public readonly field.
9549 (FlowBranching.UsageVector.Breaks): Removed the setter.
9550 (FlowBranching.UsageVector.Returns): Removed the setter.
9551 (FlowBranching.UsageVector): Added Break(), Return(),
9552 NeverReachable() and Throw() methods to modify the reachability.
9553 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
9554 done by FlowBranching.Merge().
9555 (FlowBranching.UsageVector.MergeChild): New method; merges the
9556 merge result into the current vector.
9557 (FlowBranching.Merge): New abstract method to merge a branching.
9559 2003-08-12 Martin Baulig <martin@ximian.com>
9561 * expression.cs (Indirection.CacheTemporaries): Create the
9562 LocalTemporary with the pointer type, not its element type.
9564 2003-08-10 Miguel de Icaza <miguel@ximian.com>
9566 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
9567 token was a keyword or not.
9569 Add `error' options where an IDENTIFIER was expected; Provide
9570 CheckToken and CheckIdentifierToken convenience error reporting
9573 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
9575 * decl.cs: Rename `NamespaceEntry Namespace' public field into
9576 NameSpaceEntry NameSpaceEntry.
9578 (LookupInterfaceOrClass): Avoid creating a full qualified name
9579 from namespace and name: avoid doing lookups when we know the
9580 namespace is non-existant. Use new Tree.LookupByNamespace which
9581 looks up DeclSpaces based on their namespace, name pair.
9583 * driver.cs: Provide a new `parser verbose' to display the
9584 exception thrown during parsing. This is turned off by default
9585 now, so the output of a failure from mcs is more graceful.
9587 * namespace.cs: Track all the namespaces defined in a hashtable
9590 (IsNamespace): New method
9592 2003-08-09 Miguel de Icaza <miguel@ximian.com>
9594 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
9595 we know that we need to concatenate (full typename can never be
9600 * statement.cs: Use a bitfield; Do not initialize to null things
9601 which are done by the constructor by default.
9603 * cs-parser.jay: bug fix, parameter was 4, not 3.
9605 * expression.cs: Just use the property;
9607 * statement.cs: No need for GetVariableInfo method.
9609 2003-08-08 Martin Baulig <martin@ximian.com>
9611 * flowanalysis.cs (FlowReturns): This is now nested in the
9612 `FlowBranching' class.
9613 (MyBitVector): Moved this here from statement.cs.
9614 (FlowBranching.SiblingType): New enum type.
9615 (FlowBranching.CreateSibling): Added `SiblingType' argument.
9617 2003-08-07 Martin Baulig <martin@ximian.com>
9619 * flowanalysis.cs (FlowBranchingType): This is now nested in the
9620 `FlowBranching' class and called `BranchingType'.
9622 2003-08-07 Martin Baulig <martin@ximian.com>
9624 * flowanalysis.cs: Moved all the control flow analysis code into
9627 2003-08-07 Martin Baulig <martin@ximian.com>
9629 * assign.cs (Assign.DoResolve): `target' must either be an
9630 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
9633 2003-08-07 Miguel de Icaza <miguel@ximian.com>
9635 * expression.cs (BinaryMethod): This kind of expression is created by the
9636 Binary class if it determines that the operator has to be handled
9639 (BinaryDelegate): This kind of expression is created if we are
9640 dealing with a + or - operator on delegates.
9642 (Binary): remove method, argumetns, and DelegateOperator: when
9643 dealing with methods,
9645 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
9647 * statement.cs (Block): use bitfields for the three extra booleans
9648 we had in use. Remove unused topblock parameter.
9650 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
9652 * assign.cs: Drop extra unneeded tests.
9654 2003-08-06 Miguel de Icaza <miguel@ximian.com>
9656 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
9658 * statement.cs (Foreach): Use VariableStorage instead of
9661 * codegen.cs (VariableStorage): New class used by clients that
9662 require a variable stored: locals or fields for variables that
9663 need to live across yield.
9665 Maybe provide a convenience api for EmitThis+EmitLoad?
9667 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
9670 2003-08-05 Miguel de Icaza <miguel@ximian.com>
9672 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
9673 RemapParameterLValue): New methods that are used to turn a
9674 precomputed FieldInfo into an expression like this:
9678 The idea is to use this instead of making LocalVariableReference
9679 have more than one meaning.
9681 * cs-parser.jay: Add error production to BASE.
9683 * ecore.cs: Deal with TypeManager.GetField returning null, which
9684 is now a valid return value.
9686 (FieldExprNoAddress): New expression for Fields whose address can
9689 * expression.cs (LocalVariableReference): During the resolve
9690 phases, create new expressions if we are in a remapping context.
9691 Remove code that dealt with remapping here.
9693 (ParameterReference): same.
9695 (ProxyInstance): New expression, like the `This' expression, but
9696 it is born fully resolved. We know what we are doing, so remove
9697 the errors that are targeted to user-provided uses of `this'.
9699 * statement.cs (Foreach): our variable is now stored as an
9700 Expression; During resolution, follow the protocol, dont just
9701 assume it will return this.
9703 2003-08-06 Martin Baulig <martin@ximian.com>
9705 * support.cs (SeekableStreamReader.cs): New public class.
9707 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
9708 SeekableStreamReader instead of the normal StreamReader.
9710 2003-08-04 Martin Baulig <martin@ximian.com>
9712 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
9713 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
9714 deambiguate casts and delegate invocations.
9715 (parenthesized_expression): Use the new tokens to ensure this is
9716 not a cast of method invocation.
9718 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
9719 when reading a `)' and Deambiguate_CloseParens () was previously
9722 * expression.cs (ParenthesizedExpression): New class. This is
9723 just used for the CS0075 test.
9724 (Binary.DoResolve): Check for CS0075.
9726 2003-07-29 Ravi Pratap <ravi@ximian.com>
9728 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
9729 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
9730 reference comparison.
9732 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
9733 examine the ReturnType for equality - this is necessary in the
9734 cases of implicit and explicit operators whose signature also
9735 includes the return type.
9737 2003-07-26 Miguel de Icaza <miguel@ximian.com>
9739 * namespace.cs: Cache the result of the namespace computation,
9740 instead of computing it every time.
9742 2003-07-24 Miguel de Icaza <miguel@ximian.com>
9744 * decl.cs: Use a global arraylist that we reuse over invocations
9745 to avoid excesive memory consumption. Reduces memory usage on an
9746 mcs compile by one meg (45 average).
9748 * typemanager.cs (LookupTypeReflection): In .NET pointers are
9749 private, work around that.
9751 2003-07-23 Miguel de Icaza <miguel@ximian.com>
9753 * literal.cs (IntLiteral): Define Zero and One static literals.
9755 * cs-parser.jay (integer_literal): use static literals to reduce
9756 memory usage for the most used literals (0, 1 and -1). 211kb
9757 reduced in memory usage.
9759 Replace all calls to `new ArrayList' with `new
9760 ArrayList(4)' which is a good average number for most allocations,
9761 and also requires only 16 bytes of memory for its buffer by
9764 This reduced MCS memory usage in seven megabytes for the RSS after
9767 2003-07-28 Ravi Pratap <ravi@ximian.com>
9769 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
9770 handle params methods the correct way by forming only one
9771 applicable set with params and normal methods in them. Earlier we
9772 were looking at params methods only if we found no normal methods
9773 which was not the correct thing to do.
9775 (Invocation.BetterFunction): Take separate arguments indicating
9776 when candidate and the best method are params methods in their
9779 This fixes bugs #43367 and #46199.
9781 * attribute.cs: Documentation updates.
9783 (CheckAttribute): Rename to CheckAttributeTarget.
9784 (GetValidPlaces): Rename to GetValidTargets.
9786 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
9787 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
9791 2003-07-28 Martin Baulig <martin@ximian.com>
9793 * class.cs (TypeContainer.DefineMembers): Use the base type's full
9794 name when looking up the base class of a nested class. Fixes #46977.
9796 2003-07-26 Martin Baulig <martin@ximian.com>
9798 * expression.cs (Indexers.Indexer): New nested struct; contains
9799 getter, setter and the indexer's type.
9800 (Indexers.Properties): This is now an ArrayList of
9802 (IndexerAccess.DoResolveLValue): Correctly set the type if the
9803 indexer doesn't have any getters.
9805 * assign.cs (Assign.DoResolve): Also do the implicit conversions
9806 for embedded property and indexer assignments.
9808 2003-07-26 Martin Baulig <martin@ximian.com>
9810 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
9811 preprocessor directive is not the first non-whitespace character
9814 2003-07-26 Martin Baulig <martin@ximian.com>
9816 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
9817 namespace parsing, follow the spec more closely.
9819 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
9820 NamespaceEntry.Lookup().
9822 2003-07-25 Martin Baulig <martin@ximian.com>
9824 * MethodCore.cs (OverridesSomething): New public field; it's set
9825 from TypeContainer.DefineMembers if this method overrides
9826 something (which doesn't need to be a method). Fix #39462.
9828 2003-07-25 Ravi Pratap <ravi@ximian.com>
9830 * typemanager.cs (GetMembers): Ensure that the list of members is
9831 reversed. This keeps things in sync.
9833 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
9834 find an AttributeUsage attribute.
9836 * expression.cs (Invocation.OverloadResolve): Perform the check
9837 which disallows Invoke to be directly called on a Delegate.
9839 (Error_InvokeOnDelegate): Report error cs1533.
9841 2003-07-25 Martin Baulig <martin@ximian.com>
9843 * expression.cs (Indexers.GetIndexersForType): Only look in the
9844 interface hierarchy if the requested type is already an
9845 interface. Fixes #46788 while keeping #46502 fixed.
9847 2003-07-25 Martin Baulig <martin@ximian.com>
9849 * class.cs (TypeContainer.DefineMembers): Check whether all
9850 readonly fields have been assigned and report warning CS0649 if
9853 * statement.cs (LocalInfo.IsFixed): Always return true if this is
9856 2003-07-24 Ravi Pratap <ravi@ximian.com>
9858 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
9859 returned from GetMethods to make things consistent with the
9860 assumptions MCS makes about ordering of methods.
9862 This should comprehensively fix bug #45127 and it does :-)
9864 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
9865 ordering is actually reverse.
9867 * Clean up some debug messages I left lying around.
9869 * interface.cs (Populate*): Get rid of code which emits attributes
9870 since the stage in which we emit attributes is the 'Emit' stage,
9871 not the define stage.
9873 (Emit): Move attribute emission for interface members here.
9875 2003-07-22 Ravi Pratap <ravi@ximian.com>
9877 * expression.cs (Invocation.OverloadResolve): Follow the spec more
9878 closely: we eliminate methods in base types when we have an
9879 applicable method in a top-level type.
9881 Please see section 14.5.5.1 for an exact description of what goes
9884 This fixes bug #45127 and a host of other related to corlib compilation.
9886 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
9887 array is the method corresponding to the top-level type (this is
9888 because of the changes made to icall.c) so we change this
9891 (MethodGroupExpr.Name): This too.
9893 * typemanager.cs (GetElementType): New method which does the right
9894 thing when compiling corlib.
9896 * everywhere: Make use of the above in the relevant places.
9898 2003-07-22 Martin Baulig <martin@ximian.com>
9900 * cs-parser.jay (invocation_expression): Moved
9901 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
9902 `cast_expression', but create a InvocationOrCast which later
9903 resolves to either an Invocation or a Cast.
9905 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
9906 method; call this before EmitStatement() to make sure that this
9907 expression can be used as a statement.
9909 * expression.cs (InvocationOrCast): New class; resolves to either
9910 an Invocation or a Cast.
9912 * statement.cs (StatementExpression): Call ResolveStatement() on
9913 the ExpressionStatement before emitting it.
9915 2003-07-21 Martin Baulig <martin@ximian.com>
9917 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
9918 `ref' and `out' attributes match; fixes #46220.
9919 (MemberAccess.ResolveMemberAccess): You can't reference a type
9920 through an expression; fixes #33180.
9921 (Indexers.GetIndexersForType): Don't return the indexers from
9922 interfaces the class implements; fixes #46502.
9924 2003-07-21 Martin Baulig <martin@ximian.com>
9926 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
9927 CS0661 checks; fixes bug #30442.
9929 2003-07-21 Martin Baulig <martin@ximian.com>
9931 * decl.cs (AdditionResult): Added `Error'.
9933 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
9935 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
9936 makes cs0031.cs actually work.
9938 2003-07-20 Martin Baulig <martin@ximian.com>
9940 * namespace.cs: Fixed that bug which caused a crash when compiling
9943 2003-07-20 Miguel de Icaza <miguel@ximian.com>
9945 * typemanager.cs (LookupTypeReflection): Never expose types which
9946 are NotPublic, NestedPrivate, NestedAssembly, or
9947 NestedFamANDAssem. We used to return these, and later do a check
9948 that would report a meaningful error, but the problem is that we
9949 would not get the real match, if there was a name override.
9951 2003-07-18 Miguel de Icaza <miguel@ximian.com>
9953 * namespace.cs (Namespace, Name): Do not compute the namespace
9954 name dynamically, compute it in the constructor. This reduced
9955 memory usage by 1697 KB.
9957 * driver.cs: Use --pause to pause at the end.
9959 2003-07-17 Peter Williams <peter@newton.cx>
9961 * Makefile: Change the name of the test target so that it doesn't
9962 conflict with the recursive test target.
9964 2003-07-17 Miguel de Icaza <miguel@ximian.com>
9966 * expression.cs (LocalVariableReference.Emit, EmitAssign,
9967 AddressOf): Do not use EmitThis, that was wrong, use the actual
9970 2003-07-15 Miguel de Icaza <miguel@ximian.com>
9972 * class.cs (MethodData.Define): While checking if a method is an
9973 interface implementation, improve the test: If we are not public
9974 (use new test here: use the computed MethodAttributes directly,
9975 instead of the parsed modifier flags) check if the `implementing'
9976 method comes from an interface or not.
9978 * pending.cs (VerifyPendingMethods): Slightly better error
9981 * makefile: add test target that does the mcs bootstrap.
9983 2003-07-16 Ravi Pratap <ravi@ximian.com>
9985 * interface.cs (Define): Do nothing here since there are no
9986 members to populate etc. Move the attribute emission out of here
9987 since this was just totally the wrong place to put it. Attribute
9988 application happens during the 'Emit' phase, not in the 'Define'
9991 (Emit): Add this method and move the attribute emission here
9993 * rootcontext.cs (EmitCode): Call the Emit method on interface
9996 2003-07-14 Ravi Pratap M <ravi@ximian.com>
9998 * expression.cs (OverloadResolve): Report error only if Location
9999 is not 'Null' which means that there was a probe going on.
10001 2003-07-14 Martin Baulig <martin@ximian.com>
10003 * expression.cs (ConditionalLogicalOperator): New public class to
10004 implement user defined conditional logical operators.
10005 This is section 14.11.2 in the spec and bug #40505.
10007 2003-07-14 Martin Baulig <martin@ximian.com>
10009 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
10011 2003-07-14 Martin Baulig <martin@ximian.com>
10013 * codegen.cs (EmitContext.InFixedInitializer): New public field.
10015 * ecore.cs (IVariable.VerifyFixed): New interface method.
10017 * expression.cs (Unary.ResolveOperator): When resolving the `&'
10018 operator, check whether the variable is actually fixed. Fixes bug
10019 #36055. Set a variable definitely assigned when taking its
10020 address as required by the spec.
10022 * statement.cs (LocalInfo.IsFixed): New field.
10023 (LocalInfo.MakePinned): Set `IsFixed' to true.
10025 2003-07-14 Ravi Pratap M <ravi@ximian.com>
10027 * attribute.cs (Attribute.Resolve): While doing a Member lookup
10028 for .ctors, ensure that we only ask for members declared in the
10029 attribute type (BindingFlags.DeclaredOnly).
10033 * expression.cs (Error_WrongNumArguments): Report error 1501
10034 correctly the way CSC does.
10036 2003-07-13 Martin Baulig <martin@ximian.com>
10038 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
10039 lookup on the fully qualified name, to make things like "X.X" work
10040 where "X.X" is a fully qualified type name, but we also have a
10041 namespace "X" in the using list. Fixes #41975.
10043 2003-07-13 Martin Baulig <martin@ximian.com>
10045 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
10046 function. If we're a CompoundAssign, we need to create an embedded
10047 CompoundAssign, not an embedded Assign.
10048 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
10051 2003-07-13 Martin Baulig <martin@ximian.com>
10053 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
10054 work to fix bug #46088.
10056 2003-07-13 Ravi Pratap <ravi@ximian.com>
10058 * class.cs (Operator.Emit): Do not emit attributes here - it is
10059 taken care of by the Method class that we delegate too. This takes
10060 care of bug #45876.
10062 2003-07-10 Martin Baulig <martin@ximian.com>
10064 * expression.cs (TypeOfVoid): New class.
10065 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
10067 2003-07-10 Martin Baulig <martin@ximian.com>
10069 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
10072 2003-07-10 Martin Baulig <martin@ximian.com>
10074 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
10075 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
10077 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
10079 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
10081 2003-07-10 Martin Baulig <martin@ximian.com>
10083 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
10084 of decimal. Fixes #42850.
10086 NOTE: I also fixed the created byte blob, but this doesn't work on
10087 the MS runtime and csc never produces any byte blobs for decimal
10090 2003-07-10 Martin Baulig <martin@ximian.com>
10092 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
10093 structs; fixes #32068.
10094 (Block.AddChildVariableNames): Fixed #44302.
10096 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10098 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
10100 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10102 * attribute.cs: And this test is onger needed.
10104 2003-07-08 Martin Baulig <martin@ximian.com>
10106 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
10107 inaccessible types. Fixes #36313.
10109 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
10111 * namespace.cs (NamespaceEntry): Create implicit entries for all
10112 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
10113 implicit entries for N1.N2 and N1.
10115 2003-07-08 Martin Baulig <martin@ximian.com>
10117 Rewrote the handling of namespaces to fix a lot of the issues
10118 wrt. `using' aliases etc.
10120 * namespace.cs (Namespace): Splitted this class into a
10121 per-assembly `Namespace' and a per-file `NamespaceEntry'.
10123 * typemanager.cs (TypeManager.IsNamespace): Removed.
10124 (TypeManager.ComputeNamespaces): Only compute namespaces from
10125 loaded assemblies here, not the namespaces from the assembly we're
10126 currently compiling.
10128 2003-07-08 Martin Baulig <martin@ximian.com>
10130 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
10132 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10134 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
10137 I thought about the memory savings here, but LookupTypeReflection
10138 is used under already very constrained scenarios. Compiling
10139 corlib or mcs only exposes one hit, so it would not really reduce
10140 any memory consumption.
10142 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10144 * typemanager.cs: fixes bug #45889 by only adding public types from
10145 other assemblies to the list of known types.
10147 2003-07-07 Miguel de Icaza <miguel@ximian.com>
10149 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
10150 on the type we resolved.
10152 2003-07-05 Martin Baulig <martin@ximian.com>
10154 * pending.cs (PendingImplementation.ParentImplements): Don't
10155 create the proxy if the parent is abstract.
10157 * class.cs (TypeContainer.DefineIndexers): Process explicit
10158 interface implementations first. Fixes #37714.
10160 2003-07-04 Miguel de Icaza <miguel@ximian.com>
10162 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
10163 defined recursively; but since we modify the input parameters
10164 (left is set to `this' temporarily), we reset this value if the
10165 left_is_explicit is false, which gives the original semantics to
10168 * literal.cs (NullPointer): new class used to represent a null
10169 literal in a pointer context.
10171 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
10172 type is a pointer, use a NullPointer object instead of a
10173 NullLiteral. Closes 43687
10175 (ExplicitConversion): Convert pointer values using
10176 the conv opcode to the proper type.
10178 * ecore.cs (New): change ValueTypeVariable property into a method,
10179 that returns whether the valuetype is suitable for being used.
10181 * expression.cs (Binary.DoNumericPromotions): Only return if we
10182 the int constant was a valid uint, and we can return both left and
10183 right as uints. If not, we continue processing, to trigger the
10184 type conversion. This fixes 39018.
10186 * statement.cs (Block.EmitMeta): During constant resolution, set
10187 the CurrentBlock property on the emitcontext, so that we resolve
10188 constants propertly.
10190 2003-07-02 Martin Baulig <martin@ximian.com>
10192 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
10193 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
10195 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
10196 than emitting it here.
10198 * statement.cs: Fixed some more flow analysis bugs.
10200 2003-07-02 Martin Baulig <martin@ximian.com>
10202 * class.cs (MethodData.Define): When implementing interface
10203 methods, set Final unless we're Virtual.
10205 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
10206 check work for interface methods.
10208 2003-07-01 Martin Baulig <martin@ximian.com>
10210 * ecore.cs (EmitContext.This): Replaced this property with a
10211 GetThis() method which takes a Location argument. This ensures
10212 that we get the correct error location for a CS0188.
10214 2003-07-01 Miguel de Icaza <miguel@ximian.com>
10216 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
10217 ImplicitStandardConversion.
10219 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
10221 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
10223 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
10226 2003-06-30 Miguel de Icaza <miguel@ximian.com>
10228 * class.cs (Constructor.Define): Turn off initlocals for unsafe
10231 (MethodData.Define): Turn off initlocals for unsafe methods.
10233 2003-06-29 Miguel de Icaza <miguel@ximian.com>
10235 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
10236 complete; Fixes #37521.
10238 * delegate.cs: Use Modifiers.TypeAttr to compute the
10239 TypeAttributes, instead of rolling our own. This makes the flags
10240 correct for the delegates.
10242 2003-06-28 Miguel de Icaza <miguel@ximian.com>
10244 * class.cs (Constructor.Define): Set the private flag for static
10245 constructors as well.
10247 * cs-parser.jay (statement_expression): Set the return value to
10248 null, to avoid a crash when we catch an error.
10250 2003-06-24 Miguel de Icaza <miguel@ximian.com>
10252 * cs-parser.jay: Applied patch from Jackson that adds support for
10253 extern and unsafe modifiers to destructor declarations.
10255 * expression.cs: Report error 21 if the user is trying to index a
10258 * driver.cs: Add an error message, suggested by the bug report.
10260 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
10261 if we do not have a ": this ()" constructor initializer. Fixes 45149
10263 2003-06-14 Miguel de Icaza <miguel@ximian.com>
10265 * namespace.cs: Add some information to reduce FAQs.
10267 2003-06-13 Miguel de Icaza <miguel@ximian.com>
10269 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
10270 underlying enumeration types. Fixes #43915.
10272 * expression.cs: Treat ushort/short as legal values to be used in
10273 bitwise operations.
10275 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
10277 * delegate.cs: transfer custom attributes for paramenters from
10278 the delegate declaration to Invoke and BeginInvoke.
10280 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
10282 * attribute.cs: handle custom marshalers and emit marshal info
10285 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
10287 * makefile.gnu: Added anonymous.cs to the compiler sources.
10289 2003-05-28 Miguel de Icaza <miguel@ximian.com>
10291 * iterators.cs: Change the name of the proxy class to include two
10294 * cs-parser.jay: Update grammar to include anonymous methods.
10296 * anonymous.cs: new file.
10298 2003-05-27 Miguel de Icaza <miguel@ximian.com>
10300 * class.cs (Field.Define): Add missing test for pointers and
10303 2003-05-27 Ravi Pratap <ravi@ximian.com>
10305 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
10306 we use the stobj opcode.
10308 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
10309 since it wasn't the correct fix.
10311 It still is puzzling that we are required to use stobj for IntPtr
10312 which seems to be a ValueType.
10314 2003-05-26 Miguel de Icaza <miguel@ximian.com>
10316 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
10317 during regular simple name resolution. Now, the trick is that
10318 instead of returning for processing the simplename, we do a
10319 TypeManager.LookupType (ie, a rooted lookup as opposed to a
10320 contextual lookup type). If a match is found, return that, if
10321 not, return for further composition.
10323 This fixes long-standing 30485.
10325 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
10326 using the address to initialize an object, do an Stobj instead of
10327 using the regular Stelem.
10329 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
10330 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
10331 Because if we are a BaseIndexerAccess that value will be true.
10334 * statement.cs (GotoCase.Resolve): Return after reporting an
10335 error, do not attempt to continue.
10337 * expression.cs (PointerArithmetic.Emit): If our operand is a
10338 long, convert our constants to match the operand before
10339 multiplying. Convert to I type before adding. Fixes 43670.
10341 2003-05-14 Ravi Pratap <ravi@ximian.com>
10343 * enum.cs (ImplicitConversionExists) : Rename to
10344 ImplicitEnumConversionExists to remove ambiguity.
10346 * ecore.cs (NullCast): New type of cast expression class which
10347 basically is very similar to EmptyCast with the difference being
10348 it still is a constant since it is used only to cast a null to
10350 (eg. (string) null)
10352 * convert.cs (ImplicitReferenceConversion): When casting a null
10353 literal, we return a NullCast.
10355 * literal.cs (NullLiteralTyped): Remove - I don't see why this
10356 should be around anymore.
10358 The renaming (reported was slightly wrong). Corrections:
10360 ConvertImplicitStandard -> ImplicitConversionStandard
10361 ConvertExplicitStandard -> ExplicitConversionStandard
10363 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
10364 before passing them in !
10366 * convert.cs (ImplicitConversionStandard): When comparing for
10367 equal expr and target types, ensure that expr is not a
10370 In general, we must not be checking (expr_type ==
10371 target_type) in the top level conversion methods
10372 (ImplicitConversion, ExplicitConversion etc). This checking is
10373 done in the methods that they delegate to.
10375 2003-05-20 Miguel de Icaza <miguel@ximian.com>
10377 * convert.cs: Move Error_CannotConvertType,
10378 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
10379 ImplicitNumericConversion, ImplicitConversionExists,
10380 ImplicitUserConversionExists, StandardConversionExists,
10381 FindMostEncompassedType, FindMostSpecificSource,
10382 FindMostSpecificTarget, ImplicitUserConversion,
10383 ExplicitUserConversion, GetConversionOperators,
10384 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
10385 TryImplicitIntConversion, Error_CannotConvertImplicit,
10386 ConvertImplicitRequired, ConvertNumericExplicit,
10387 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
10388 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
10391 Perform the following renames:
10393 StandardConversionExists -> ImplicitStandardConversionExists
10394 ConvertImplicit -> ImplicitConversion
10395 ConvertImplicitStandard -> ImplicitStandardConversion
10396 TryImplicitIntConversion -> ImplicitIntConversion
10397 ConvertImplicitRequired -> ImplicitConversionRequired
10398 ConvertNumericExplicit -> ExplicitNumericConversion
10399 ConvertReferenceExplicit -> ExplicitReferenceConversion
10400 ConvertExplicit -> ExplicitConversion
10401 ConvertExplicitStandard -> ExplicitStandardConversion
10403 2003-05-19 Martin Baulig <martin@ximian.com>
10405 * statement.cs (TypeInfo.StructInfo): Made this type protected.
10406 (TypeInfo): Added support for structs having structs as fields.
10408 * ecore.cs (FieldExpr): Implement IVariable.
10409 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
10410 VariableInfo for the field.
10412 2003-05-18 Martin Baulig <martin@ximian.com>
10414 * expression.cs (This.DoResolve): Report a CS0027 if we're
10415 emitting a field initializer.
10417 2003-05-18 Martin Baulig <martin@ximian.com>
10419 * expression.cs (This.ResolveBase): New public function.
10420 (This.DoResolve): Check for CS0188.
10422 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
10425 * ecore.cs (MethodGroupExpr.DoResolve): Set the
10426 `instance_expression' to null if we don't have any non-static
10429 2003-05-18 Martin Baulig <martin@ximian.com>
10431 Reworked the way how local variables and parameters are handled by
10432 the flow analysis code.
10434 * statement.cs (TypeInfo, VariableMap): New public classes.
10435 (VariableInfo): New public class. This is now responsible for
10436 checking whether a variable has been assigned. It is used for
10437 parameters and local variables.
10438 (Block.EmitMeta): Take the InternalParameters as argument; compute
10439 the layout of the flow vectors here.
10440 (Block.LocalMap, Block.ParameterMap): New public properties.
10441 (FlowBranching): The .ctor doesn't get the InternalParameters
10442 anymore since Block.EmitMeta() now computes the layout of the flow
10444 (MyStructInfo): This class is now known as `StructInfo' and nested
10445 in `TypeInfo'; we don't access this directly anymore.
10447 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
10448 property and removed IsAssigned(), IsFieldAssigned(),
10449 SetAssigned() and SetFieldAssigned(); we now call them on the
10450 VariableInfo so we don't need to duplicate this code everywhere.
10452 * expression.cs (ParameterReference): Added `Block block' argument
10454 (LocalVariableReference, ParameterReference, This): The new
10455 VariableInfo class is now responsible for all the definite
10458 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
10459 IsParameterAssigned, SetParameterAssigned): Removed.
10461 2003-05-18 Martin Baulig <martin@ximian.com>
10463 * typemanager.cs (InitCoreTypes): Try calling
10464 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
10465 the 3-args-version. Corlib now also needs our `void_type'.
10466 (GetMethod): Added overloaded version which takes an optional
10467 `bool report_errors' to allow lookups of optional methods.
10469 2003-05-12 Martin Baulig <martin@ximian.com>
10471 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
10472 only used for locals and not for parameters.
10474 2003-05-12 Miguel de Icaza <miguel@ximian.com>
10476 * support.cs (InternalParameters.ParameterType): Return the
10477 ExternalType of the parameter.
10479 * parameter.cs (Parameter.ExternalType): drop the two arguments,
10482 2003-05-11 Miguel de Icaza <miguel@ximian.com>
10484 * class.cs (MethodData.Define): Do not set the `newslot' on
10485 interface members, if they are also flagged as "override".
10487 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
10488 better code for ++i and i++. This only works for static fields
10489 and local variables.
10491 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
10492 want to pull the DeclSpace out of the builder_to_declspace instead
10493 of the TypeBuilder (like in TypeContainer.FindMembers).
10495 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
10496 instead of LookupTypeContainer. Fixes the crash on .NET for
10497 looking up interface members.
10499 * const.cs: Create our own emit context during the Definition
10500 stage, so that constants are evaluated in the proper context, when
10501 a recursive definition happens.
10503 2003-05-11 Martin Baulig <martin@ximian.com>
10505 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10506 new block for a switch section.
10507 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
10508 the adding/lookup in the switch block. Fixes #39828.
10510 2003-05-09 Miguel de Icaza <miguel@ximian.com>
10512 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
10513 functionality: I needed to convert the data after I had performed
10514 the add/sub operation into the operands type size.
10516 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
10517 pass the type for the box operation, otherwise the resulting
10518 object would have been of type object.
10520 (BoxedCast): Add constructor to specify the type to box as.
10522 2003-05-07 Miguel de Icaza <miguel@ximian.com>
10524 * iterators.cs: I was reusing the `count' variable inadvertently,
10525 take steps to not allow this to happen.
10527 2003-05-06 Miguel de Icaza <miguel@ximian.com>
10529 * attribute.cs (Attribute.Resolve): Params attributes are encoded
10530 by creating an array at the point where the params starts and
10531 putting all those arguments there, then adjusting the size of the
10534 2003-05-05 Miguel de Icaza <miguel@ximian.com>
10536 * expression.cs (New.AddressOf): Implement interface
10537 IMemoryLocation. This is used when the `new' operator is used in
10538 the context of an invocation to a method on a value type.
10540 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
10543 * namespace.cs: Also check the using aliases here.
10545 * driver.cs: Move the test for using validity after the types have
10546 been entered, so we do a single pass that also includes the using
10549 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
10550 in the regular case. CreateSiblingForFinally is doing extra
10553 * attribute.cs (GetAttributeArgumentExpression): Store the result
10554 on an out value, and use the return value to indicate failure
10555 instead of using null (which is a valid return for Constant.GetValue).
10557 * statement.cs: Perform the analysis flow for the increment
10558 portion after the statement, because this will be the real flow of
10559 execution. Fixes #42385
10561 * codegen.cs (EmitContext.EmitArgument,
10562 EmitContext.EmitStoreArgument): New helper functions when the
10563 RemapToProxy flag is set.
10565 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
10568 Add support for remapping parameters.
10570 * iterators.cs: Propagate parameter values; Store parameter
10571 values in the proxy classes.
10573 2003-05-04 Miguel de Icaza <miguel@ximian.com>
10575 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
10576 need a proxy reference; I do not know what I was thinking
10578 * cs-parser.jay (constructor_initializer): catch another error,
10579 and display nice message.
10581 (field_declaration): catch void field declaration
10582 to flag a better error.
10584 * class.cs (MemberBase.CheckBase): Report an error instead of a
10585 warning if a new protected member is declared in a struct.
10586 (Field.Define): catch the error of readonly/volatile.
10588 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
10590 (FieldExpr.AddressOf): ditto. Catch error where the address of a
10591 volatile variable is taken
10593 2003-05-02 Miguel de Icaza <miguel@ximian.com>
10595 * statement.cs (Fixed.Resolve): Report an error if we are not in
10598 2003-05-01 Miguel de Icaza <miguel@ximian.com>
10600 * typemanager.cs: reuse the code that handles type clashes for
10601 delegates and enumerations.
10603 * class.cs (Report28): Always report.
10605 * expression.cs (EncodeAsAttribute): Allow nulls here.
10607 2003-04-28 Miguel de Icaza <miguel@ximian.com>
10609 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
10610 the functionality for testing whether an expression is valid for
10611 an attribute here. Also handle the case of arrays of elements
10614 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
10615 encoding a linear array into an array of objects that are suitable
10616 to be passed to an CustomAttributeBuilder.
10618 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
10620 * ecore.cs: (FieldExpr): Handle field remapping here.
10622 * iteratators.cs: Pass the instance variable (if the method is an
10623 instance method) to the constructors, so we can access the field
10624 variables on the class.
10626 TODO: Test this with structs. I think the THIS variable on
10627 structs might have to be a pointer, and not a refenrece
10629 2003-04-27 Miguel de Icaza <miguel@ximian.com>
10631 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
10632 local variables to fields in a proxy class.
10634 * iterators.cs (PopulateProxy): Rename our internal fields to
10636 Create a <THIS> field if we are an instance method, so we can
10637 reference our parent container variables.
10638 (MapVariable): Called back from the EmitContext code to enter a
10639 new variable to field mapping into the proxy class (we just create
10643 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
10644 for using the remapped locals to fields.
10646 I placed the code here, because that gives the same semantics to
10647 local variables, and only changes the Emit code.
10649 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
10650 statements inside iterators.
10651 (VariableInfo): Add a FieldBuilder for the cases when we are
10652 remapping local variables to fields in a proxy class
10654 * ecore.cs (SimpleNameResolve): Avoid testing two times for
10655 current_block != null.
10657 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
10658 not cope with strings, as it has been moved to the
10659 TableSwitchEmit. Fixed bug in switch generation.
10661 * expression.cs (New.DoResolve): Provide more context for the user
10662 when reporting an error.
10664 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
10667 * expression.cs (MemberAccess.DoResolve): When we get a type back,
10668 check the permissions for it. Note than in a type-resolution
10669 context the check was already present in DeclSpace.ResolveType,
10670 but was missing from the MemberAccess.
10672 (ArrayCreation.CheckIndices): warn if the user has
10673 more nested levels of expressions, but there are no more
10674 dimensions specified. Avoids crash on bug 41906.
10676 2003-04-26 Miguel de Icaza <miguel@ximian.com>
10678 * statement.cs (Block): replace Implicit bool, for a generic
10680 New flag: `Unchecked'. This is used during the EmitMeta phase
10681 (which is out-of-line with the regular Resolve/Emit process for a
10682 statement, as this is done ahead of time, but still gets a chance
10683 to call constant resolve).
10685 (Block.Flags): new enum for adding a new flag.
10687 (Block.EmitMeta): track the state of unchecked.
10689 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
10690 to enable constant resolution to work there as well.
10692 2003-04-22 Miguel de Icaza <miguel@ximian.com>
10694 * typemanager.cs (ienumerable_type): Also look up
10695 System.Collections.IEnumerable.
10697 2003-04-21 Miguel de Icaza <miguel@ximian.com>
10699 TODO: Test more than one conditional per method.
10701 * class.cs (Indexer.Define): Report the location where the user is
10702 referencing the unsupported feature.
10704 (MethodData): Overload the use of `conditionals' to
10705 minimize the creation of needless ArrayLists. This saves roughly
10706 212kb on my machine.
10708 (Method): Implement the new IIteratorContainer interface.
10709 (Method.SetYields): Implement the method by setting the ModFlags
10710 to contain METHOD_YIELDS.
10712 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
10713 which just got set to null.
10715 * iterators.cs: New file.
10717 (Yield, YieldBreak): New statements.
10719 * statement.cs (Return.Resolve): Flag an error if we are used in
10720 an iterator method.
10722 * codegen.cs (InIterator): New flag set if the code is being
10723 compiled in an iterator method.
10725 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
10726 internal modifier, and we just use it to avoid adding extra
10727 fields, as this is seldom used.
10729 * cs-parser.jay: Add yield_statement (yield and yield break).
10731 * driver.cs: New flag -v2 to turn on version 2 features.
10733 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
10734 hashtable when v2 is enabled.
10736 2003-04-20 Miguel de Icaza <miguel@ximian.com>
10738 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
10739 there is already a namespace defined with this name.
10741 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
10742 people upgraded their corlibs.
10744 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
10745 always use fully qualified types, no need to use the compiler
10748 (TypeManager.IsNamespace): Use binarysearch.
10750 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
10751 AddDelegate): I did not quite use the new IsValid API properly: I
10752 have to pass the short-name and the fullname. I was passing only
10753 the basename instead of the fullname sometimes.
10755 (TypeContainer.DefineType): call NamespaceClash.
10757 * interface.cs (Interface.DefineType): use NamespaceClash before
10760 * delegate.cs (Delegate.DefineType): use NamespaceClash before
10763 * enum.cs: (Enum.DefineType): use NamespaceClash before
10766 * typemanager.cs (: 3-line patch that gives us some tasty 11%
10767 speed increase. First, use the negative_hits cache when we get a
10768 negative. Second, add the type with its full original name
10769 instead of the new . and + encoded name (reflection uses + to
10770 separate type from a nested type). Use LookupTypeReflection
10771 directly which bypasses the type->name hashtable (that we already
10772 know does not contain the type.
10774 * decl.cs (DeclSpace.ResolveTypeExpr): track the
10775 location/container type.
10777 * driver.cs: When passing utf8, use directly the UTF8Encoding.
10779 2003-04-19 Miguel de Icaza <miguel@ximian.com>
10781 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
10783 * delegate.cs (NewDelegate.Resolve): Test whether an instance
10784 method is being referenced in the method group from a static
10785 context, and report error 120 if so.
10787 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
10790 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
10791 is created, we create the A namespace).
10793 * cs-parser.jay: A namespace also introduces a DeclarationFound.
10796 2003-04-18 Miguel de Icaza <miguel@ximian.com>
10798 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
10799 invocation to ModuleBuilder.GetType with the same values will
10800 return a new type instance, so we need to cache its return
10803 * expression.cs (Binary.ResolveOperator): Only allow the compare
10804 operators on enums if they are of the same type.
10806 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
10807 types of ValueType on their own case. Before we were giving them
10808 the same treatment as objects.
10810 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
10811 fullname. Short name is used to compare against container name.
10812 Fullname is used to check against defined namespace names.
10814 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
10815 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
10817 (Method.CheckBase): Call parent.
10818 (MemberBase.CheckBase): Check for protected members on sealed
10820 (PropertyBase.CheckBase): Call parent.
10821 (Field.Define): Call parent.
10823 * report.cs: Negative error codes are now mapped to 8000 - code,
10824 so that the display is render more nicely.
10826 * typemanager.cs: Do not use try/catch, instead report a regular
10829 (GetPointerType, GetReferenceType): These methods provide
10830 mechanisms to obtain the T* and T& from a T. We had the code
10831 previously scattered around the code base, and it also used
10832 TypeManager.LookupType that would go through plenty of caches.
10833 This one goes directly to the type source.
10835 In some places we did the Type.GetType followed by
10836 ModuleBuilder.GetType, but not in others, so this unifies the
10837 processing as well.
10839 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
10840 statements now that we have namespace information.
10842 * typemanager.cs (IsNamespace): New method, returns whether the
10843 string presented is a namespace or not.
10845 (ComputeNamespaces): New public entry point, computes the list of
10846 available namespaces, using the GetNamespaces API call in Mono, or
10847 the slower version in MS.NET.
10849 Now before we start the semantic analysis phase, we have a
10850 complete list of namespaces including everything that the user has
10853 Deleted old code to cache namespaces in .nsc files.
10855 2003-04-17 Miguel de Icaza <miguel@ximian.com>
10857 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
10858 class/struct location definition Location for the implicit
10859 constructor location.
10861 (Operator.Define): Use the location of the operator for the
10862 implicit Method definition.
10864 (Constructor.Emit): use the constructor location for the implicit
10865 base initializer constructor.
10867 * ecore.cs: Remove ITypeExpression. This interface is now gone,
10868 and the Expression class now contains two new methods:
10870 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
10871 isolate type lookup from the rest of the resolution process.
10873 Since we use Expressions to hold type definitions due to the way
10874 we parse the input we have historically overloaded Resolve to
10875 perform the Type lookups if a special flag is passed. Now this is
10876 eliminated and two methods take their place.
10878 The differences in the two methods between xStep and xTerminal is
10879 that xStep is involved in our current lookup system that uses
10880 SimpleNames to compose a name, while xTerminal is used just to
10881 catch the case where the simplename lookup failed.
10883 2003-04-16 Miguel de Icaza <miguel@ximian.com>
10885 * expression.cs (ResolveMemberAccess): Remove redundant code.
10886 TypeExpr expressions are always born fully resolved.
10888 * interface.cs (PopulateMethod): Do not lookup the types twice.
10889 We were doing it once during SemanticAnalysis and once during
10892 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
10893 in local variable type definitions, were being returned as a
10894 SimpleName (we decomposed everything into a string), that is
10895 because primary_expression was being used instead of a type in the
10896 grammar (reduce/reduce conflicts).
10898 The part that was wrong is that we converted the expression into a
10899 string (an oversimplification in one hand, compounded with primary
10900 expressions doing string concatenation).
10906 Would return "A.B.C[]" as a SimpleName. This stopped things like
10907 using clauses from working on this particular context. And a type
10908 was being matched directly against "A.B.C[]".
10910 We now use the correct approach, and allow for ComposedCast to be
10911 part of the unary expression. So the "A.B.C []" become a composed
10912 cast of "A.B.C" (as a nested group of MemberAccess with a
10913 SimpleName at the end) plus the rank composition "[]".
10917 2003-04-10 Miguel de Icaza <miguel@ximian.com>
10919 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
10920 for the access level checking.
10922 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
10923 `TypeContainer container', because I kept getting confused when I
10924 was debugging this code.
10926 * expression.cs (Indexers): Instead of tracking getters/setters,
10927 we now track them in parallel. We create one arraylist less, but
10928 most importantly it is possible now for the LValue code to find a
10929 matching get for a set.
10931 (IndexerAccess.DoResolveLValue): Update the code.
10932 GetIndexersForType has been modified already to extract all the
10933 indexers from a type. The code assumed it did not.
10935 Also make the code set the correct return type for the indexer.
10936 This was fixed a long time ago for properties, but was missing for
10937 indexers. It used to be void_type.
10939 (Binary.Emit): Test first for doubles instead of
10940 floats, as they are more common.
10942 (Binary.EmitBranchable): Use the .un version of the branch opcodes
10943 when dealing with floats and the <=, >= operators. This fixes bug
10946 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
10947 to load the array value by emitting a load on the foreach variable
10948 type. This was incorrect.
10950 We now emit the code to load an element using the the array
10951 variable type, and then we emit the conversion operator.
10955 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
10957 * attribute.cs: Avoid allocation of ArrayLists in the common case.
10959 2003-04-09 Miguel de Icaza <miguel@ximian.com>
10961 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
10962 test for protection before we test for signatures.
10964 (MethodSignature.ToString): implement.
10966 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
10967 to the case where we reduced into a LongConstant.
10969 * decl.cs (CheckAccessLevel): If the type is an array, we can not
10970 depend on whether the information is acurrate, because the
10971 Microsoft runtime will always claim that the array type is public,
10972 regardless of the real state.
10974 If the type is a pointer, another problem happens: the type is
10975 reported as non-public in Microsoft.
10977 In both cases we have to call CheckAccessLevel recursively with
10978 the underlying type as the argument to be tested.
10980 2003-04-08 Miguel de Icaza <miguel@ximian.com>
10982 * assign.cs (Assign.Emit): If we are dealing with a compound
10983 assignment expression, we should use the code path that stores the
10984 intermediate result in a temporary value. This fixes #40903.
10986 *expression.cs (Indirection.ToString): Provide ToString method for
10989 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
10991 * class.cs: Null out fields holding references to Block objects so
10992 they can be garbage collected.
10994 * expression.cs (OverloadResolve): Remove unused local.
10996 2003-04-07 Martin Baulig <martin@ximian.com>
10998 * codegen.cs (EmitContext.CurrentFile): New public field.
10999 (EmitContext.Mark): Use the CurrentFile to check whether the
11000 location is in the correct file.
11001 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
11003 2003-04-07 Martin Baulig <martin@ximian.com>
11005 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
11007 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
11008 location. [FIXME: The location argument which gets passed to this
11009 method is sometimes wrong!]
11011 2003-04-07 Nick Drochak <ndrochak@gol.com>
11013 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
11015 2003-04-07 Miguel de Icaza <miguel@ximian.com>
11017 * expression.cs (Indirection.EmitAssign): We were using the
11018 temporary, but returning immediately instead of continuing the
11021 2003-04-06 Martin Baulig <martin@ximian.com>
11023 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
11024 if it's a nested child, but also deriving from the outer class.
11027 * typemanager.cs (IsNestedChildOf): Make this work if it's a
11028 nested child, but also deriving from the outer class. See
11030 (FilterWithClosure): We may access private members of the outer
11031 class if we're a nested child and deriving from the outer class.
11032 (RealMemberLookup): Only set `closure_private_ok' if the
11033 `original_bf' contained BindingFlags.NonPublic.
11035 2003-04-05 Martin Baulig <martin@ximian.com>
11037 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
11039 2003-04-02 Miguel de Icaza <miguel@ximian.com>
11041 * class.cs (Event.Define): Do not allow abstract events to have
11044 2003-04-01 Miguel de Icaza <miguel@ximian.com>
11046 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
11047 block in event declarations.
11049 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
11050 value type, get its address.
11052 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
11053 leaving a class on the stack instead of a boolean value (int
11054 0/1). Change the code so we compare against null, and then the
11055 result against zero.
11057 * class.cs (TypeContainer.GetClassBases): We were checking for the
11058 parent class being sealed too late.
11060 * expression.cs (Binary.Emit): For <= and >= when dealing with
11061 floating point values, use cgt.un and clt.un instead of cgt and
11064 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
11066 * statement.cs: Apply the same optimization as MS: skip the
11067 GetEnumerator returning an IEnumerator, and use the one returning a
11068 CharEnumerator instead. This allows us to avoid the try-finally block
11071 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
11073 * cs-parser.jay: Attributes cannot be applied to
11074 namespaces. Fixes #40473
11076 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11079 (Add*): check if the name is valid using the full name for constants,
11080 fields, properties and events.
11082 2003-03-28 Miguel de Icaza <miguel@ximian.com>
11084 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
11085 char constants to be part of the enumeration.
11087 * expression.cs (Conditional.DoResolve): Add support for operator
11088 true. Implements the missing functionality from 14.12
11090 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
11091 operator true/false as required by the spec.
11093 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
11094 implicit conversion to boolean.
11096 * statement.cs (Statement.ResolveBoolean): A boolean expression is
11097 also one where the type implements `operator true'.
11099 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
11100 get an expression that will invoke operator true based on an
11103 (GetConversionOperators): Removed the hack that called op_True
11106 (Expression.ResolveBoolean): Move this from Statement.
11108 2003-03-17 Miguel de Icaza <miguel@ximian.com>
11110 * ecore.cs (FieldExpr): do not allow initialization of initonly
11111 fields on derived classes
11113 2003-03-13 Martin Baulig <martin@ximian.com>
11115 * statement.cs (Block.Emit): Call ig.BeginScope() and
11116 ig.EndScope() when compiling with debugging info; call
11117 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
11119 2003-03-08 Miguel de Icaza <miguel@ximian.com>
11121 * expression.cs (Indexers): Do not construct immediately, allow
11122 for new members to be appended as we go. Fixes 38143
11124 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11126 * expression.cs: save/restore context when resolving an unchecked
11129 2003-03-05 Miguel de Icaza <miguel@ximian.com>
11131 * cfold.cs: Catch division by zero in modulus operator during
11134 2003-03-03 Miguel de Icaza <miguel@ximian.com>
11136 * interface.cs (Interface.DefineMembers): Avoid defining members
11139 2003-02-27 Miguel de Icaza <miguel@ximian.com>
11141 * driver.cs: handle the +/- options for -noconfig
11143 * statement.cs (Unckeched.Resolve): Also track the state of
11144 unchecked in the Resolve phase.
11146 2003-02-27 Martin Baulig <martin@ximian.com>
11148 * ecore.cs (Expression.MemberLookup): Don't create a
11149 MethodGroupExpr for something which is not a method. Fixes #38291.
11151 2003-02-25 Miguel de Icaza <miguel@ximian.com>
11153 * class.cs (MemberBase.CheckParameters): Also check that the type
11154 is unmanaged if it is a pointer.
11156 * expression.cs (SizeOf.Resolve): Add location information.
11158 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
11159 a managed type is declared.
11161 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
11162 parameter modifiers as well. Fixes bug 38606
11164 * class.cs: Very sad. Am backing out the speed up changes
11165 introduced by the ArrayList -> Array in the TypeContainer, as they
11166 were not actually that much faster, and introduced a bug (no error
11167 reports on duplicated methods).
11169 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
11170 source first, this will guarantee that we have a valid expression
11171 before calling in lower levels functions that will require a
11172 resolved object. Then use this original_source in the
11173 target.ResolveLValue instead of the original source that was
11176 Another change. Use target.Resolve instead of LValueResolve.
11177 Although we are resolving for LValues, we will let the Assign code
11178 take care of that (it will be called again from Resolve). This
11179 basically allows code like this:
11181 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
11182 class Y { void A (X x) { x [0] += o; }
11184 The problem was that the indexer was trying to resolve for
11185 set_Item (idx, object o) and never finding one. The real set_Item
11186 was set_Item (idx, X). By delaying the process we get the right
11191 2003-02-23 Martin Baulig <martin@ximian.com>
11193 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
11194 while calling DoEmit ().
11196 * codegen.cs (EmitContext.Mark): Don't mark locations in other
11197 source files; if you use the #line directive inside a method, the
11198 compiler stops emitting line numbers for the debugger until it
11199 reaches the end of the method or another #line directive which
11200 restores the original file.
11202 2003-02-23 Martin Baulig <martin@ximian.com>
11204 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
11206 2003-02-23 Martin Baulig <martin@ximian.com>
11208 * statement.cs (Block.AddChildVariableNames): We need to call this
11209 recursively, not just for our immediate children.
11211 2003-02-23 Martin Baulig <martin@ximian.com>
11213 * class.cs (Event.Define): Always make the field private, like csc does.
11215 * typemanager.cs (TypeManager.RealMemberLookup): Make events
11216 actually work, fixes bug #37521.
11218 2003-02-23 Miguel de Icaza <miguel@ximian.com>
11220 * delegate.cs: When creating the various temporary "Parameters"
11221 classes, make sure that we call the ComputeAndDefineParameterTypes
11222 on those new parameters (just like we do with the formal ones), to
11223 allow them to be resolved in the context of the DeclSpace.
11225 This fixes the bug that Dick observed in Bugzilla #38530.
11227 2003-02-22 Miguel de Icaza <miguel@ximian.com>
11229 * expression.cs (ResolveMemberAccess): When resolving a constant,
11230 do not attempt to pull a constant if the value was not able to
11231 generate a valid constant.
11233 * const.cs (LookupConstantValue): Do not report more errors than required.
11235 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11237 * expression.cs: fixes bug #38328.
11239 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11241 * class.cs: Changed all the various members that can be part of a
11242 class from being an ArrayList to be an Array of the right type.
11243 During the DefineType type_list, interface_list, delegate_list and
11244 enum_list are turned into types, interfaces, delegates and enums
11247 And during the member population, indexer_list, event_list,
11248 constant_list, field_list, instance_constructor_list, method_list,
11249 operator_list and property_list are turned into their real arrays.
11251 Although we could probably perform this operation earlier, for
11252 good error reporting we need to keep the lists and remove the
11253 lists for longer than required.
11255 This optimization was triggered by Paolo profiling the compiler
11256 speed on the output of `gen-sample-program.pl' perl script.
11258 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
11259 not crash in methods like MemberLookupFailed that use this field.
11261 This problem arises when the compiler fails to resolve a type
11262 during interface type definition for example.
11264 2003-02-18 Miguel de Icaza <miguel@ximian.com>
11266 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
11267 inherit from System.Object, so we have to stop at null, not only
11268 when reaching System.Object.
11270 2003-02-17 Miguel de Icaza <miguel@ximian.com>
11272 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
11273 DeclaredOnly because the parent indexer might have had a different
11274 name, but did not loop until the top of the hierarchy was reached.
11276 The problem this one fixes is 35492: when a class implemented an
11277 indexer from an interface, we were getting the interface method
11278 (which was abstract) and we were flagging an error (can not invoke
11281 This also keeps bug 33089 functioning, and test-148 functioning.
11283 * typemanager.cs (IsSpecialMethod): The correct way of figuring
11284 out if a method is special is to see if it is declared in a
11285 property or event, or whether it is one of the predefined operator
11286 names. This should fix correctly #36804.
11288 2003-02-15 Miguel de Icaza <miguel@ximian.com>
11290 The goal here is to remove the dependency on EmptyCast.Peel ().
11291 Killing it completely.
11293 The problem is that currently in a number of places where
11294 constants are expected, we have to "probe" for an EmptyCast, and
11295 Peel, which is not the correct thing to do, as this will be
11296 repetitive and will likely lead to errors.
11298 The idea is to remove any EmptyCasts that are used in casts that
11299 can be reduced to constants, so we only have to cope with
11302 This bug hunt was triggered by Bug 37363 and the desire to remove
11303 the duplicate pattern where we were "peeling" emptycasts to check
11304 whether they were constants. Now constants will always be
11307 * ecore.cs: Use an enumconstant here instead of wrapping with
11310 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
11311 throwing me off. By handling this we can get rid of a few hacks.
11313 * statement.cs (Switch): Removed Peel() code.
11315 2003-02-14 Miguel de Icaza <miguel@ximian.com>
11317 * class.cs: Location information for error 508
11319 * expression.cs (New.DoResolve): Add a guard against double
11320 resolution of an expression.
11322 The New DoResolve might be called twice when initializing field
11323 expressions (see EmitFieldInitializers, the call to
11324 GetInitializerExpression will perform a resolve on the expression,
11325 and later the assign will trigger another resolution
11327 This leads to bugs (#37014)
11329 * delegate.cs: The signature for EndInvoke should contain any ref
11330 or out parameters as well. We were not doing this in the past.
11332 * class.cs (Field.Define): Do not overwrite the type definition
11333 inside the `volatile' group. Turns out that volatile enumerations
11334 were changing the type here to perform a validity test, which
11337 2003-02-12 Miguel de Icaza <miguel@ximian.com>
11339 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
11340 and structs, we do not want to load the instance variable
11342 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
11343 enum_type has to be handled like an object reference (implicit
11344 conversions exists from this to object), but the regular IsClass
11345 and IsValueType tests will never return true for this one.
11347 Also we use TypeManager.IsValueType instead of type.IsValueType,
11348 just for consistency with the rest of the code (this is only
11349 needed if we ever use the construct exposed by test-180.cs inside
11350 corlib, which we dont today).
11352 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
11354 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
11357 2003-02-09 Martin Baulig <martin@ximian.com>
11359 * namespace.cs (Namespace..ctor): Added SourceFile argument.
11360 (Namespace.DefineNamespaces): New static public method; this is
11361 called when we're compiling with debugging to add all namespaces
11362 to the symbol file.
11364 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
11365 pass it to the Namespace's .ctor.
11367 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
11368 and MethodBase arguments; pass the namespace ID to the symwriter;
11369 pass the MethodBase instead of the token to the symwriter.
11370 (SymbolWriter.DefineNamespace): New method to add a namespace to
11373 2003-02-09 Martin Baulig <martin@ximian.com>
11375 * symbolwriter.cs: New file. This is a wrapper around
11376 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
11377 methods here in near future.
11379 2003-02-09 Martin Baulig <martin@ximian.com>
11381 * codegen.cs (EmitContext.Mark): Just pass the arguments to
11382 ILGenerator.MarkSequencePoint() which are actually used by the
11385 2003-02-09 Martin Baulig <martin@ximian.com>
11387 * location.cs (SourceFile): New public sealed class. This
11388 contains the name and an index which is used in the location's token.
11389 (Location): Reserve an appropriate number of bits in the token for
11390 the source file instead of walking over that list, this gives us a
11391 really huge performance improvement when compiling with debugging.
11393 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
11394 `SourceFile' argument instead of a string.
11395 (Driver.ProcessFile): Add all the files via Location.AddFile(),
11396 but don't parse/tokenize here, we need to generate the list of all
11397 source files before we do that.
11398 (Driver.ProcessFiles): New static function. Parses/tokenizes all
11401 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
11402 instead of a string.
11404 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
11407 2003-02-09 Martin Baulig <martin@ximian.com>
11409 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
11410 filename on `#line default'.
11412 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
11414 * statement.cs: don't clear the pinned var when the fixed statement
11415 returns from the method (fixes bug#37752).
11417 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
11419 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
11422 2003-02-07 Martin Baulig <martin@ximian.com>
11424 * driver.cs: Removed the `--debug-args' command line argument.
11426 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
11427 automatically by the AsssemblyBuilder.
11428 (CodeGen.InitializeSymbolWriter): We don't need to call any
11429 initialization function on the symbol writer anymore. This method
11430 doesn't take any arguments.
11432 2003-02-03 Miguel de Icaza <miguel@ximian.com>
11434 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
11435 from referenced assemblies as well.
11437 2003-02-02 Martin Baulig <martin@ximian.com>
11439 * class.cs (MethodData.Emit): Generate debugging info for external methods.
11441 2003-02-02 Martin Baulig <martin@ximian.com>
11443 * class.cs (Constructor.Emit): Open the symbol writer before
11444 emitting the constructor initializer.
11445 (ConstructorInitializer.Emit): Call ec.Mark() to allow
11446 single-stepping through constructor initializers.
11448 2003-01-30 Miguel de Icaza <miguel@ximian.com>
11450 * class.cs: Handle error 549: do not allow virtual methods in
11453 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
11455 * decl.cs: Check access levels when resolving types
11457 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
11459 * statement.cs: Add parameters and locals set in catch blocks that might
11460 return to set vector
11462 2003-01-29 Miguel de Icaza <miguel@ximian.com>
11464 * class.cs (Operator): Set the SpecialName flags for operators.
11466 * expression.cs (Invocation.DoResolve): Only block calls to
11467 accessors and operators on SpecialName methods.
11469 (Cast.TryReduce): Handle conversions from char constants.
11472 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
11474 * statement.cs: small memory and time optimization in FlowBranching.
11476 2003-01-28 Pedro Mart <yoros@wanadoo.es>
11478 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
11479 problem that the last fix but in the other sid (Set).
11481 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
11482 access when there is no indexer in the hierarchy.
11484 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
11486 * class.cs: Combine some if statements.
11488 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11490 * driver.cs: fixed bug #37187.
11492 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
11494 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
11495 any indexer, it's needed to build a list with all the indexers in the
11496 hierarchy (AllGetters), else we have problems. Fixes #35653.
11498 2003-01-23 Miguel de Icaza <miguel@ximian.com>
11500 * class.cs (MethodData.Define): It is wrong for an interface
11501 implementation to be static in both cases: explicit and implicit.
11502 We were only handling this in one case.
11504 Improve the if situation there to not have negations.
11506 * class.cs (Field.Define): Turns out that we do not need to check
11507 the unsafe bit on field definition, only on usage. Remove the test.
11509 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11511 * driver.cs: use assembly.Location instead of Codebase (the latest
11512 patch made mcs fail when using MS assemblies).
11514 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
11516 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
11517 get the path to *corlib.dll.
11519 2003-01-21 Nick Drochak <ndrochak@gol.com>
11523 * typemanager.cs: Remove compiler warnings
11525 2003-01-20 Duncan Mak <duncan@ximian.com>
11527 * AssemblyInfo.cs: Bump the version number to 0.19.
11529 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11531 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
11533 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
11535 * class.cs (Constructor::Emit): Emit debugging info for constructors.
11537 2003-01-17 Miguel de Icaza <miguel@ximian.com>
11539 * cs-parser.jay: Small fix: we were not comparing the constructor
11540 name correctly. Thanks to Zoltan for the initial pointer.
11542 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
11544 * cs-tokenizer.cs: Set file name when specified with #line
11546 2003-01-15 Miguel de Icaza <miguel@ximian.com>
11548 * cs-parser.jay: Only perform the constructor checks here if we
11549 are named like the class; This will help provider a better
11550 error. The constructor path is taken when a type definition is
11551 not found, but most likely the user forgot to add the type, so
11552 report that rather than the constructor error.
11554 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
11556 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
11559 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11561 * cs-parser.jay: Add cleanup call.
11563 2003-01-13 Duncan Mak <duncan@ximian.com>
11565 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
11566 consistent with other methods.
11568 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
11570 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
11572 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
11574 * attribute.cs: only set GuidAttr to true when we have a
11577 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11581 * typemanager.cs: fixes to allow mcs compile corlib with the new
11582 Type.IsSubclassOf fix.
11584 2003-01-08 Miguel de Icaza <miguel@ximian.com>
11586 * expression.cs (LocalVariableReference.DoResolve): Classify a
11587 constant as a value, not as a variable. Also, set the type for
11590 * cs-parser.jay (fixed_statement): take a type instead of a
11591 pointer_type, so we can produce a better error message later.
11593 * statement.cs (Fixed.Resolve): Flag types that are not pointers
11596 (For.DoEmit): Make inifinite loops have a
11597 non-conditional branch back.
11599 (Fixed.DoEmit): First populate the pinned variables, then emit the
11600 statement, then clear the variables. Before I was emitting the
11601 code once for each fixed piece.
11604 2003-01-08 Martin Baulig <martin@ximian.com>
11606 * statement.cs (FlowBranching.MergeChild): A break in a
11607 SWITCH_SECTION does not leave a loop. Fixes #36155.
11609 2003-01-08 Martin Baulig <martin@ximian.com>
11611 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
11612 lives in the same number space than `param_map'. Fixes #36154.
11614 2003-01-07 Miguel de Icaza <miguel@ximian.com>
11616 * cs-parser.jay (constructor_declaration): Set the
11617 Constructor.ModFlags before probing for it. This makes the
11618 compiler report 514, 515 and 132 (the code was there, but got
11621 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
11622 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
11623 (GotoCase.Resolve): Set `Returns' to ALWAYS.
11625 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
11627 * enum.cs: create the enum static fields using the enum type.
11629 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
11631 * class.cs: don't try to create the ParamBuilder for the return
11632 type if it's not needed (and handle it breaking for the ms runtime
11635 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
11637 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
11639 2002-12-29 Miguel de Icaza <miguel@ximian.com>
11641 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
11642 the command. This showed up while compiling the JANET source
11643 code, which used \r as its only newline separator.
11645 2002-12-28 Miguel de Icaza <miguel@ximian.com>
11647 * class.cs (Method.Define): If we are an operator (because it
11648 reuses our code), then set the SpecialName and HideBySig. #36128
11650 2002-12-22 Miguel de Icaza <miguel@ximian.com>
11652 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
11653 exception, report error 120 `object reference required'.
11655 * driver.cs: Add --pause option, used during to measure the size
11656 of the process as it goes with --timestamp.
11658 * expression.cs (Invocation.DoResolve): Do not allow methods with
11659 SpecialName to be invoked.
11661 2002-12-21 Miguel de Icaza <miguel@ximian.com>
11663 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
11664 number before adding it.
11666 2002-12-21 Ravi Pratap <ravi@ximian.com>
11668 * ecore.cs (StandardImplicitConversion): When in an unsafe
11669 context, we allow conversion between void * to any other pointer
11670 type. This fixes bug #35973.
11672 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
11674 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
11675 is not thrown when extensionless outputs are used
11677 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11679 * rootcontext.cs: fixed compilation of corlib.
11681 2002-12-19 Miguel de Icaza <miguel@ximian.com>
11683 * attribute.cs (Attributes.Contains): Add new method.
11685 * class.cs (MethodCore.LabelParameters): if the parameter is an
11686 `out' parameter, check that no attribute `[In]' has been passed.
11688 * enum.cs: Handle the `value__' name in an enumeration.
11690 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
11692 * decl.cs: Added special case to allow overrides on "protected
11695 2002-12-18 Ravi Pratap <ravi@ximian.com>
11697 * attribute.cs (Attributes.AddAttributeSection): Rename to this
11698 since it makes much more sense.
11700 (Attributes.ctor): Don't require a Location parameter.
11702 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
11704 * attribute.cs (ApplyAttributes): Remove extra Location parameters
11705 since we already have that information per attribute.
11707 * everywhere : make appropriate changes.
11709 * class.cs (LabelParameters): Write the code which actually
11710 applies attributes to the return type. We can't do this on the MS
11711 .NET runtime so we flag a warning in the case an exception is
11714 2002-12-18 Miguel de Icaza <miguel@ximian.com>
11716 * const.cs: Handle implicit null conversions here too.
11718 2002-12-17 Ravi Pratap <ravi@ximian.com>
11720 * class.cs (MethodCore.LabelParameters): Remove the extra
11721 Type [] parameter since it is completely unnecessary. Instead
11722 pass in the method's attributes so that we can extract
11723 the "return" attribute.
11725 2002-12-17 Miguel de Icaza <miguel@ximian.com>
11727 * cs-parser.jay (parse): Use Report.Error to flag errors instead
11728 of ignoring it and letting the compile continue.
11730 * typemanager.cs (ChangeType): use an extra argument to return an
11731 error condition instead of throwing an exception.
11733 2002-12-15 Miguel de Icaza <miguel@ximian.com>
11735 * expression.cs (Unary.TryReduce): mimic the code for the regular
11736 code path. Perform an implicit cast in the cases where we can
11737 implicitly convert to one of the integral types, and then reduce
11738 based on that constant. This fixes bug #35483.
11740 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11742 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
11744 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11746 * namespace.cs: fixed bug #35489.
11748 2002-12-12 Miguel de Icaza <miguel@ximian.com>
11750 * class.cs: Remove some dead code.
11752 * cs-parser.jay: Estimate the number of methods needed
11753 (RootContext.MethodCount);
11755 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
11756 numbers instead of StringBuilders.
11758 * support.cs (PtrHashtable): Add constructor with initial size;
11759 We can now reduce reallocations of the method table.
11761 2002-12-10 Ravi Pratap <ravi@ximian.com>
11763 * attribute.cs (ApplyAttributes): Keep track of the emitted
11764 attributes on a per-target basis. This fixes bug #35413.
11766 2002-12-10 Miguel de Icaza <miguel@ximian.com>
11768 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
11769 default to the Windows 1252 encoding.
11771 (UnixParseOption): Support version, thanks to Alp for the missing
11774 * AssemblyInfo.cs: Add nice assembly information.
11776 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
11779 * cs-parser.jay: Allow a trailing comma before the close bracked
11780 in the attribute_section production.
11782 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
11783 address of the instance was being taken, I will take this out,
11784 because we take the address of the object immediately here.
11786 2002-12-09 Ravi Pratap <ravi@ximian.com>
11788 * typemanager.cs (AreMultipleAllowed): Take care of the most
11789 obvious case where attribute type is not in the current assembly -
11792 2002-12-08 Miguel de Icaza <miguel@ximian.com>
11794 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
11795 definitions, instead of doing that afterwards.
11797 Also we use a nice little hack, depending on the constructor, we
11798 know if we are a "composed" name or a simple name. Hence, we
11799 avoid the IndexOf test, and we avoid
11801 * codegen.cs: Add code to assist in a bug reporter to track down
11802 the source of a compiler crash.
11804 2002-12-07 Ravi Pratap <ravi@ximian.com>
11806 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
11807 types have been emitted for a given element and flag an error
11808 if something which does not have AllowMultiple set is used more
11811 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
11812 attribute types and their corresponding AllowMultiple properties
11814 (AreMultipleAllowed): Check the property for a given type.
11816 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
11817 property in the case we have a TypeContainer.
11819 (Attributes.AddAttribute): Detect duplicates and just skip on
11820 adding them. This trivial fix catches a pretty gross error in our
11821 attribute emission - global attributes were being emitted twice!
11823 Bugzilla bug #33187 is now fixed.
11825 2002-12-06 Miguel de Icaza <miguel@ximian.com>
11827 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
11828 instead of pp_and).
11830 * expression.cs (Binary.ResolveOperator): I can only use the
11831 Concat (string, string, string) and Concat (string, string,
11832 string, string) if the child is actually a concatenation of
11835 2002-12-04 Miguel de Icaza <miguel@ximian.com>
11837 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
11838 context where we need a 2-character lookahead.
11840 * pending.cs (PendingImplementation): Rework so we can keep track
11841 of interface types all the time, and flag those which were
11842 implemented by parents as optional.
11844 2002-12-03 Miguel de Icaza <miguel@ximian.com>
11846 * expression.cs (Binary.ResolveOperator): Use
11847 String.Concat(string,string,string) or
11848 String.Concat(string,string,string,string) when possible.
11850 * typemanager: More helper methods.
11853 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
11855 * pending.cs: remove the bogus return from GetMissingInterfaces()
11856 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
11858 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11860 * namespace.cs: avoid duplicated 'using xxx' being added to
11861 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
11862 when we get more than one 'using' statement for the same namespace.
11863 Report a CS0105 warning for it.
11865 2002-11-30 Miguel de Icaza <miguel@ximian.com>
11867 * cs-tokenizer.cs (consume_identifier): use read directly, instead
11868 of calling getChar/putback, uses internal knowledge of it.
11870 (xtoken): Reorder tokenizer so most common patterns are checked
11871 first. This reduces the compilation time in another 5% (from 8.11s
11872 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
11874 The parsing time is 22% of the compilation in mcs, and from that
11875 64% is spent on the tokenization process.
11877 I tried using a binary search for keywords, but this is slower
11878 than the hashtable. Another option would be to do a couple of
11881 * Not use a StringBuilder, instead use an array of chars,
11882 with a set value. Notice that this way we could catch
11883 the 645 error without having to do it *afterwards*.
11885 * We could write a hand-parser to avoid the hashtable
11886 compares altogether.
11888 The identifier consumption process takes 37% of the tokenization
11889 time. Another 15% is spent on is_number. 56% of the time spent
11890 on is_number is spent on Int64.Parse:
11892 * We could probably choose based on the string length to
11893 use Int32.Parse or Int64.Parse and avoid all the 64-bit
11896 Another 3% is spend on wrapping `xtoken' in the `token' function.
11898 Handle 0xa0 as whitespace (#34752)
11900 2002-11-26 Miguel de Icaza <miguel@ximian.com>
11902 * typemanager.cs (IsCLRType): New routine to tell whether a type
11903 is one of the builtin types.
11905 Maybe it needs to use TypeCodes to be faster. Maybe we could use
11906 typecode in more places instead of doing pointer comparissions.
11907 We could leverage some knowledge about the way the typecodes are
11910 New code to cache namespaces in assemblies, it is currently not
11911 invoked, to be used soon.
11913 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
11915 * expression.cs (Binary.ResolveOperator): specially handle
11916 strings, and do not perform user-defined operator overloading for
11919 2002-11-24 Miguel de Icaza <miguel@ximian.com>
11921 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
11922 internalcall as it is a pretty simple operation; Avoid whenever
11923 possible to call Char.IsLetter.
11925 (consume_identifier): Cut by half the number of
11926 hashtable calls by merging the is_keyword and GetKeyword behavior.
11928 Do not short-circuit, because if we do, we
11929 report errors (ie, #if false && true would produce an invalid
11933 2002-11-24 Martin Baulig <martin@ximian.com>
11935 * expression.cs (Cast.TryReduce): If we're in checked syntax,
11936 check constant ranges and report a CS0221. Fixes #33186.
11938 2002-11-24 Martin Baulig <martin@ximian.com>
11940 * cs-parser.jay: Make this work for uninitialized variable
11941 declarations in the `for' initializer. Fixes #32416.
11943 2002-11-24 Martin Baulig <martin@ximian.com>
11945 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
11946 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
11948 2002-11-24 Martin Baulig <martin@ximian.com>
11950 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
11951 argument; if true, we also check for user-defined conversions.
11952 This is only needed if both arguments are of a user-defined type.
11953 Fixes #30443, added test-175.cs.
11954 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
11956 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
11958 2002-11-24 Martin Baulig <martin@ximian.com>
11960 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
11961 function to get the store opcode.
11962 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
11963 only emit the Ldelema if the store opcode is Stobj. You must run
11964 both test-34 and test-167 to test this. Fixes #34529.
11966 2002-11-23 Martin Baulig <martin@ximian.com>
11968 * ecore.cs (Expression.MemberLookup): Added additional
11969 `qualifier_type' argument which is used when we're being called
11970 from MemberAccess.DoResolve() and null if we're called from a
11972 (Expression.MemberLookupFailed): New method to report errors; this
11973 does the CS1540 check and reports the correct error message.
11975 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
11976 argument for the CS1540 check and redone the way how we're dealing
11977 with private members. See the comment in the source code for details.
11978 (FilterWithClosure): Reverted this back to revision 1.197; renamed
11979 `closure_start_type' to `closure_qualifier_type' and check whether
11980 it's not null. It was not this filter being broken, it was just
11981 being called with the wrong arguments.
11983 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
11984 and pass it the correct `qualifier_type'; this also does the error
11987 2002-11-22 Miguel de Icaza <miguel@ximian.com>
11989 * expression.cs (Invocation.EmitParams): If the we are dealing
11990 with a non-built-in value type, load its address as well.
11992 (ArrayCreation): Use a a pretty constant instead
11993 of the hardcoded value 2. Use 6 instead of 2 for the number of
11994 static initializers.
11996 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
11997 because they are not really value types, just glorified integers.
11999 * driver.cs: Do not append .exe, the CSC compiler does not do it.
12001 * ecore.cs: Remove redundant code for enumerations, make them use
12002 the same code path as everything else, fixes the casting issue
12003 with enumerations in Windows.Forms.
12005 * attribute.cs: Do only cast to string if it is a string, the
12006 validation happens later.
12008 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
12009 people upgrade their corlibs.
12011 * ecore.cs: Oops, enumerations were not following the entire code path
12013 2002-11-21 Miguel de Icaza <miguel@ximian.com>
12015 * typemanager.cs (FilterWithClosure): Commented out the test for
12016 1540 in typemanager.cs, as it has problems when accessing
12017 protected methods from a parent class (see test-174.cs).
12019 * attribute.cs (Attribute.ValidateGuid): new method.
12020 (Attribute.Resolve): Use above.
12022 2002-11-19 Miguel de Icaza <miguel@ximian.com>
12024 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
12026 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
12027 handling for enumerations, as we only needed the TypeContainer
12028 functionality to begin with (this is required for the fix below to
12029 work for enums that reference constants in a container class for
12032 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
12034 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
12035 a valid TypeBuilder to perform lookups on.o
12037 * class.cs (InheritableMemberSignatureCompare): Use true in the
12038 call to GetGetMethod and GetSetMethod, because we are comparing
12039 the signature, and we need to get the methods *even* if they are
12042 (PropertyBase.CheckBase): ditto.
12044 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
12045 GotoCase.Resolve): Use Peel on EmpytCasts.
12047 * ecore.cs (EmptyCast): drop child, add Peel method.
12049 2002-11-17 Martin Baulig <martin@ximian.com>
12051 * ecore.cs (EmptyCast.Child): New public property.
12053 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
12054 label resolved to an EmptyCast. Fixes #34162.
12055 (GotoCase.Resolve): Likewise.
12056 (Block.EmitMeta): Likewise.
12058 2002-11-17 Martin Baulig <martin@ximian.com>
12060 * expression.cs (Invocation.BetterConversion): Prefer int over
12061 uint; short over ushort; long over ulong for integer literals.
12062 Use ImplicitConversionExists instead of StandardConversionExists
12063 since we also need to check for user-defined implicit conversions.
12064 Fixes #34165. Added test-173.cs.
12066 2002-11-16 Martin Baulig <martin@ximian.com>
12068 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
12069 with the `true' and `false' literals. Fixes #33151.
12071 2002-11-16 Martin Baulig <martin@ximian.com>
12073 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
12074 October 22nd; don't do the cs1540 check for static members.
12076 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
12077 now using our own filter here and doing the cs1540 check again.
12079 2002-11-16 Martin Baulig <martin@ximian.com>
12081 * support.cs (InternalParameters): Don't crash if we don't have
12082 any fixed parameters. Fixes #33532.
12084 2002-11-16 Martin Baulig <martin@ximian.com>
12086 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
12087 when looking up static methods to make this work on Windows.
12090 2002-11-16 Martin Baulig <martin@ximian.com>
12092 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
12093 a setter rather than using PropertyInfo.CanWrite.
12095 2002-11-15 Nick Drochak <ndrochak@gol.com>
12097 * class.cs: Allow acces to block member by subclasses. Fixes build
12100 2002-11-14 Martin Baulig <martin@ximian.com>
12102 * class.cs (Constructor.Emit): Added the extern/block check.
12105 2002-11-14 Martin Baulig <martin@ximian.com>
12107 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
12108 iteration while looking for indexers, this is needed because the
12109 indexer may have a different name in our base classes. Fixed the
12110 error reporting (no indexers at all, not get accessor, no
12111 overloaded match). Fixes bug #33089.
12112 (IndexerAccess.DoResolveLValue): Likewise.
12114 2002-11-14 Martin Baulig <martin@ximian.com>
12116 * class.cs (PropertyBase.CheckBase): Make this work for multiple
12117 indexers. Fixes the first part of bug #33089.
12118 (MethodSignature.InheritableMemberSignatureCompare): Added support
12121 2002-11-13 Ravi Pratap <ravi@ximian.com>
12123 * attribute.cs (Attribute.Resolve): Catch the
12124 NullReferenceException and report it since it isn't supposed to
12127 2002-11-12 Miguel de Icaza <miguel@ximian.com>
12129 * expression.cs (Binary.EmitBranchable): Also handle the cases for
12130 LogicalOr and LogicalAnd that can benefit from recursively
12131 handling EmitBranchable. The code now should be nice for Paolo.
12133 2002-11-08 Miguel de Icaza <miguel@ximian.com>
12135 * typemanager.cs (LookupType): Added a negative-hit hashtable for
12136 the Type lookups, as we perform quite a number of lookups on
12137 non-Types. This can be removed once we can deterministically tell
12138 whether we have a type or a namespace in advance.
12140 But this might require special hacks from our corlib.
12144 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
12145 and double which avoids a conversion from an integer to a double.
12147 * expression.cs: tiny optimization, avoid calling IsConstant,
12148 because it effectively performs the lookup twice.
12150 2002-11-06 Miguel de Icaza <miguel@ximian.com>
12152 But a bogus return here to keep the semantics of the old code
12153 until the Mono runtime is fixed.
12155 * pending.cs (GetMissingInterfaces): New method used to remove all
12156 the interfaces that are already implemented by our parent
12157 classes from the list of pending methods.
12159 * interface.cs: Add checks for calls after ResolveTypeExpr.
12161 2002-11-05 Miguel de Icaza <miguel@ximian.com>
12163 * class.cs (Class.Emit): Report warning 67: event not used if the
12164 warning level is beyond 3.
12166 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
12167 being a NullLiteral.
12169 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
12172 * class.cs (TypeContainer.GetClassBases): Cover a missing code
12173 path that might fail if a type can not be resolved.
12175 * expression.cs (Binary.Emit): Emit unsigned versions of the
12178 * driver.cs: use error 5.
12180 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
12182 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
12184 2002-11-01 Miguel de Icaza <miguel@ximian.com>
12186 * cs-parser.jay (switch_section): A beautiful patch from Martin
12187 Baulig that fixed 33094.
12189 2002-10-31 Miguel de Icaza <miguel@ximian.com>
12191 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
12192 Check whether the base is abstract and report an error if so.
12194 * expression.cs (IndexerAccess.DoResolveLValue,
12195 IndexerAccess.DoResolve): ditto.
12197 (Invocation.DoResolve): ditto.
12199 (Invocation.FullMethodDesc): Improve the report string.
12201 * statement.cs (Block): Eliminate IsVariableDefined as it is
12202 basically just a wrapper for GetVariableInfo.
12204 * ecore.cs (SimpleName): Use new
12206 * support.cs (ReflectionParamter.ParameterType): We unwrap the
12207 type, as we return the actual parameter ref/unref state on a
12210 2002-10-30 Miguel de Icaza <miguel@ximian.com>
12212 * support.cs: Return proper flags REF/OUT fixing the previous
12215 * expression.cs: Reverted last patch, that was wrong. Is_ref is
12216 not used to mean `ref' but `ref or out' in ParameterReference
12218 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
12219 full type signature instead of calling TypeManger.CSharpName
12222 * support.cs (InternalParameters.ParameterDesc): Do not compare
12223 directly to the modflags, because REF/OUT will actually be bitsets
12226 * delegate.cs (VerifyMethod): Check also the modifiers.
12228 * cs-tokenizer.cs: Fix bug where floating point values with an
12229 exponent where a sign was missing was ignored.
12231 * driver.cs: Allow multiple assemblies to be specified in a single
12234 2002-10-28 Miguel de Icaza <miguel@ximian.com>
12236 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
12237 because identifiers after a parenthesis would end up in this kind
12238 of production, and we needed to desamiguate it for having casts
12241 (UserDefinedType *) xxx
12243 2002-10-24 Miguel de Icaza <miguel@ximian.com>
12245 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
12246 we should set on the Bindingflags.NonPublic, but not turn on
12247 private_ok. private_ok controls whether a Private member is
12248 returned (this is chekced on the filter routine), while the
12249 BindingFlags.NonPublic just controls whether private/protected
12250 will be allowed. This fixes the problem part of the problem of
12251 private properties being allowed to be used in derived classes.
12253 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
12254 so we can call the children DoResolveLValue method (this will
12255 properly signal errors on lvalue assignments to base properties)
12257 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
12258 getter are null, and we have a property info, we know that this
12259 happened because the lookup failed, so we report an error 122 for
12260 protection level violation.
12262 We also silently return if setter and getter are null in the
12263 resolve functions, this condition only happens if we have flagged
12264 the error before. This is the other half of the problem.
12266 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
12267 not have accessibility information, that is why we were returning
12268 true in the filter function in typemanager.cs.
12270 To properly report 122 (property is inaccessible because of its
12271 protection level) correctly, we report this error in ResolveAccess
12272 by failing if both the setter and the getter are lacking (ie, the
12275 DoResolve and DoLResolve have been modified to check for both
12276 setter/getter being null and returning silently, the reason being
12277 that I did not want to put the knowledge about this error in upper
12280 int old = Report.Errors;
12281 x = new PropertyExpr (...);
12282 if (old != Report.Errors)
12287 So the property expr is returned, but it is invalid, so the error
12288 will be flagged during the resolve process.
12290 * class.cs: Remove InheritablePropertySignatureCompare from the
12291 class, as we no longer depend on the property signature to compute
12292 whether it is possible to implement a method or not.
12294 The reason is that calling PropertyInfo.GetGetMethod will return
12295 null (in .NET, in Mono it works, and we should change this), in
12296 cases where the Get Method does not exist in that particular
12301 class X { public virtual int A { get { return 1; } } }
12303 class Z : Y { public override int A { get { return 2; } } }
12305 Would fail in Z because the parent (Y) would not have the property
12306 defined. So we avoid this completely now (because the alternative
12307 fix was ugly and slow), and we now depend exclusively on the
12310 (PropertyBase.CheckBase): Use a method-base mechanism to find our
12311 reference method, instead of using the property.
12313 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
12314 routines are gone now.
12316 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
12317 names, they were incorrectly named.
12319 * cs-tokenizer.cs: Return are more gentle token on failure.
12321 * pending.cs (PendingImplementation.InterfaceMethod): This routine
12322 had an out-of-sync index variable, which caused it to remove from
12323 the list of pending methods the wrong method sometimes.
12325 2002-10-22 Miguel de Icaza <miguel@ximian.com>
12327 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
12328 CanWrite, because those refer to this particular instance of the
12329 property, and do not take into account the fact that we can
12330 override single members of a property.
12332 Constructor requires an EmitContext. The resolution process does
12333 not happen here, but we need to compute the accessors before,
12334 because the resolution does not always happen for properties.
12336 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
12337 subclass, before we did not update this flag, but we did update
12340 (GetAccessors): Drop this routine, as it did not work in the
12341 presence of partially overwritten set/get methods.
12343 Notice that this broke the cs1540 detection, but that will require
12346 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12350 * driver.cs: issue a warning instead of an error if we don't support
12351 debugging for the platform. Also ignore a couple of errors that may
12352 arise when trying to write the symbols. Undo my previous patch.
12354 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12356 * driver.cs: ignore /debug switch except for Unix platforms.
12358 2002-10-23 Nick Drochak <ndrochak@gol.com>
12360 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
12362 2002-10-21 Miguel de Icaza <miguel@ximian.com>
12364 * driver.cs: Do not make mcs-debug conditional, so we do not break
12365 builds that use it.
12367 * statement.cs (UsageVector.MergeChildren): I would like Martin to
12368 review this patch. But basically after all the children variables
12369 have been merged, the value of "Breaks" was not being set to
12370 new_breaks for Switch blocks. I think that it should be set after
12371 it has executed. Currently I set this to the value of new_breaks,
12372 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
12373 conservative, but I do not understand this code very well.
12375 I did not break anything in the build, so that is good ;-)
12377 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
12379 2002-10-20 Mark Crichton <crichton@gimp.org>
12381 * cfold.cs: Fixed compile blocker. Really fixed it this time.
12383 2002-10-20 Nick Drochak <ndrochak@gol.com>
12385 * cfold.cs: Fixed compile blocker.
12387 2002-10-20 Miguel de Icaza <miguel@ximian.com>
12389 * driver.cs: I was chekcing the key, not the file.
12391 2002-10-19 Ravi Pratap <ravi@ximian.com>
12393 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
12394 message that we were generating - we just need to silently return
12397 2002-10-19 Miguel de Icaza <miguel@ximian.com>
12399 * class.cs (Event.Define): Change my previous commit, as this
12400 breaks the debugger. This is a temporary hack, as it seems like
12401 the compiler is generating events incorrectly to begin with.
12403 * expression.cs (Binary.ResolveOperator): Added support for
12404 "U operator - (E x, E y)"
12406 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
12409 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
12410 init-only variables, but this path did not take into account that
12411 there might be also instance readonly variables. Correct this
12414 This fixes bug 32253
12416 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
12419 * driver.cs: Change the extension for modules to `netmodule'
12421 * cs-parser.jay: Improved slightly the location tracking for
12422 the debugger symbols.
12424 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
12425 modifiers that were specified instead of the hardcoded value
12426 (FamAndAssem). This was basically ignoring the static modifier,
12427 and others. Fixes 32429.
12429 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
12430 fixed a bug in the process (32476)
12432 * expression.cs (ArrayAccess.EmitAssign): Patch from
12433 hwang_rob@yahoo.ca that fixes bug 31834.3
12435 2002-10-18 Miguel de Icaza <miguel@ximian.com>
12437 * driver.cs: Make the module extension .netmodule.
12439 2002-10-16 Miguel de Icaza <miguel@ximian.com>
12441 * driver.cs: Report an error if the resource file is not found
12442 instead of crashing.
12444 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
12445 false, like Emit does.
12447 2002-10-16 Nick Drochak <ndrochak@gol.com>
12449 * typemanager.cs: Remove unused private member. Also reported mcs
12450 bug to report this as a warning like csc.
12452 2002-10-15 Martin Baulig <martin@gnome.org>
12454 * statement.cs (Statement.Emit): Made this a virtual method; emits
12455 the line number info and calls DoEmit().
12456 (Statement.DoEmit): New protected abstract method, formerly knows
12457 as Statement.Emit().
12459 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
12461 2002-10-11 Miguel de Icaza <miguel@ximian.com>
12463 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
12464 have fixed a remaining problem: not every AddXXXX was adding a
12465 fully qualified name.
12467 Now everyone registers a fully qualified name in the DeclSpace as
12468 being defined instead of the partial name.
12470 Downsides: we are slower than we need to be due to the excess
12471 copies and the names being registered this way.
12473 The reason for this is that we currently depend (on the corlib
12474 bootstrap for instance) that types are fully qualified, because
12475 we dump all the types in the namespace, and we should really have
12476 types inserted into the proper namespace, so we can only store the
12477 basenames in the defined_names array.
12479 2002-10-10 Martin Baulig <martin@gnome.org>
12481 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
12482 from bug #31834, see the bug report for a testcase which is
12485 2002-10-10 Martin Baulig <martin@gnome.org>
12487 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
12488 flow analysis code for this.
12490 * statement.cs (Do, While, For): Tell the flow analysis code about
12492 (FlowBranching.UsageVector): Added support for infinite loops.
12493 (Block.Resolve): Moved the dead code elimination here and use flow
12496 2002-10-09 Miguel de Icaza <miguel@ximian.com>
12498 * class.cs (Field.Define): Catch cycles on struct type
12501 * typemanager.cs (IsUnmanagedtype): Do not recursively check
12502 fields if the fields are static. We only need to check instance
12505 * expression.cs (As.DoResolve): Test for reference type.
12507 * statement.cs (Using.ResolveExpression): Use
12508 ConvertImplicitRequired, not ConvertImplicit which reports an
12510 (Using.ResolveLocalVariableDecls): ditto.
12512 * expression.cs (Binary.ResolveOperator): Report errors in a few
12513 places where we had to.
12515 * typemanager.cs (IsUnmanagedtype): Finish implementation.
12517 2002-10-08 Miguel de Icaza <miguel@ximian.com>
12519 * expression.cs: Use StoreFromPtr instead of extracting the type
12520 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
12522 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
12523 an enumeration value to a System.Enum, but System.Enum is not a
12524 value type, but an class type, so we need to box.
12526 (Expression.ConvertExplicit): One codepath could return
12527 errors but not flag them. Fix this. Fixes #31853
12529 * parameter.cs (Resolve): Do not allow void as a parameter type.
12531 2002-10-06 Martin Baulig <martin@gnome.org>
12533 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
12534 if it's a class type and not a struct. Fixes #31815.
12536 2002-10-06 Martin Baulig <martin@gnome.org>
12538 * statement.cs: Reworked the flow analysis code a bit to make it
12539 usable for dead code elimination.
12541 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12543 * cs-parser.jay: allow empty source files. Fixes bug #31781.
12545 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12547 * expression.cs (ComposedCast.DoResolveType): A quick workaround
12548 to fix the test 165, will investigate deeper.
12550 2002-10-04 Martin Baulig <martin@gnome.org>
12552 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
12553 finally blocks actually work.
12554 (Try.Resolve): We don't need to create a sibling for `finally' if
12555 there is no finally block.
12557 2002-10-04 Martin Baulig <martin@gnome.org>
12559 * class.cs (Constructor.Define): The default accessibility for a
12560 non-default constructor is private, not public.
12562 2002-10-04 Miguel de Icaza <miguel@ximian.com>
12564 * class.cs (Constructor): Make AllowedModifiers public, add
12567 * cs-parser.jay: Perform the modifiers test here, as the
12568 constructor for the Constructor class usually receives a zero
12569 because of the way we create it (first we create, later we
12570 customize, and we were never checking the modifiers).
12572 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
12573 is a version of LookupTypeReflection that includes the type-name
12574 cache. This can be used as a fast path for functions that know
12575 the fully qualified name and are only calling into *.GetType() to
12576 obtain a composed type.
12578 This is also used by TypeManager.LookupType during its type
12581 (LookupType): We now also track the real type name, as sometimes
12582 we can get a quey for the real type name from things like
12583 ComposedCast. This fixes bug 31422.
12585 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
12586 complete type fullname, it does not have to go through the type
12587 resolution system to obtain the composed version of the type (for
12588 obtaining arrays or pointers).
12590 (Conditional.Emit): Use the EmitBoolExpression to
12591 generate nicer code, as requested by Paolo.
12593 (ArrayCreation.CheckIndices): Use the patch from
12594 hwang_rob@yahoo.ca to validate the array initializers.
12596 2002-10-03 Miguel de Icaza <miguel@ximian.com>
12598 * class.cs (ConstructorInitializer.Emit): simplify code by using
12599 Invocation.EmitCall, and at the same time, fix the bugs in calling
12600 parent constructors that took variable arguments.
12602 * ecore.cs (Expression.ConvertNumericExplicit,
12603 Expression.ImplicitNumericConversion): Remove the code that
12604 manually wrapped decimal (InternalTypeConstructor call is now gone
12607 * expression.cs (Cast.TryReduce): Also handle decimal types when
12608 trying to perform a constant fold on the type.
12610 * typemanager.cs (IsUnmanagedtype): Partially implemented.
12612 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
12613 that only turned off an error report, and did nothing else.
12615 2002-10-02 Miguel de Icaza <miguel@ximian.com>
12617 * driver.cs: Handle and ignore /fullpaths
12619 2002-10-01 Miguel de Icaza <miguel@ximian.com>
12621 * expression.cs (Binary.ResolveOperator): Catch the case where
12622 DoNumericPromotions returns true,
12624 (Binary.DoNumericPromotions): Simplify the code, and the tests.
12626 2002-09-27 Miguel de Icaza <miguel@ximian.com>
12628 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
12631 2002-09-26 Miguel de Icaza <miguel@ximian.com>
12633 * ecore.cs (ConvertNumericExplicit): It is not enough that the
12634 conversion exists, but it is also required that the conversion be
12635 performed. This manifested in "(Type64Enum) 2".
12637 * class.cs (TypeManager.AddMethod): The fix is not to change
12638 AddEnum, because that one was using a fully qualified name (every
12639 DeclSpace derivative does), but to change the AddMethod routine
12640 that was using an un-namespaced name. This now correctly reports
12641 the duplicated name.
12643 Revert patch until I can properly fix it. The issue
12644 is that we have a shared Type space across all namespaces
12645 currently, which is wrong.
12647 Options include making the Namespace a DeclSpace, and merge
12648 current_namespace/current_container in the parser.
12650 2002-09-25 Miguel de Icaza <miguel@ximian.com>
12652 * cs-parser.jay: Improve error reporting when we get a different
12653 kind of expression in local_variable_type and
12654 local_variable_pointer_type.
12656 Propagate this to avoid missleading errors being reported.
12658 * ecore.cs (ImplicitReferenceConversion): treat
12659 TypeManager.value_type as a target just like object_type. As
12664 Is valid, and needs to result in the int 1 being boxed before it
12665 is assigned to the value type v.
12667 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
12668 to validate the enumeration name.
12670 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
12671 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
12672 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
12674 * ecore.cs (TryImplicitIntConversion): When doing an
12675 implicit-enumeration-conversion, check if the type is 64-bits and
12676 perform a conversion before passing to EnumConstant.
12678 2002-09-23 Miguel de Icaza <miguel@ximian.com>
12680 * decl.cs (Error_AmbiguousTypeReference); New routine used to
12681 report ambiguous type references. Unlike the MS version, we
12682 report what the ambiguity is. Innovation at work ;-)
12684 (DeclSpace.FindType): Require a location argument to
12685 display when we display an ambiguous error.
12687 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
12689 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
12691 * expression.cs (EmitDynamicInitializers): Apply patch from
12692 hwang_rob@yahoo.ca that fixes the order in which we emit our
12695 2002-09-21 Martin Baulig <martin@gnome.org>
12697 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
12698 delegate takes no arguments.
12700 2002-09-20 Miguel de Icaza <miguel@ximian.com>
12702 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
12705 * expression.cs: Extract the underlying type.
12707 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
12709 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
12711 2002-09-19 Miguel de Icaza <miguel@ximian.com>
12713 * class.cs (TypeContainer.DefineType): We can not use the nice
12714 PackingSize with the size set to 1 DefineType method, because it
12715 will not allow us to define the interfaces that the struct
12718 This completes the fixing of bug 27287
12720 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
12721 means also structs. This fixes part of the problem.
12722 (Expresion.ImplicitReferenceConversionExists): ditto.
12724 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
12725 error if there were no errors reported during the type lookup
12726 process, to avoid duplicates or redundant errors. Without this
12727 you would get an ambiguous errors plus a type not found. We have
12728 beaten the user enough with the first error.
12730 (DeclSparce.FindType): Emit a warning if we have an ambiguous
12733 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
12734 during the resolution process, stop the lookup, this avoids
12735 repeated error reports (same error twice).
12737 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
12739 * typemanager.cs (LookupType): Redo the type lookup code to match
12740 the needs of System.Reflection.
12742 The issue is that System.Reflection requires references to nested
12743 types to begin with a "+" sign instead of a dot. So toplevel
12744 types look like: "NameSpace.TopLevelClass", and nested ones look
12745 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
12748 2002-09-19 Martin Baulig <martin@gnome.org>
12750 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
12751 says that a method always returns or always throws an exception,
12752 don't report the CS0161.
12754 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
12755 set `Returns = new_returns'.
12757 2002-09-19 Martin Baulig <martin@gnome.org>
12759 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
12760 to an enum constant, check for a CS0176.
12762 2002-09-18 Miguel de Icaza <miguel@ximian.com>
12764 * class.cs (TypeContainer.CheckPairedOperators): Now we check
12765 for operators that must be in pairs and report errors.
12767 * ecore.cs (SimpleName.DoResolveType): During the initial type
12768 resolution process, when we define types recursively, we must
12769 check first for types in our current scope before we perform
12770 lookups in the enclosing scopes.
12772 * expression.cs (MakeByteBlob): Handle Decimal blobs.
12774 (Invocation.VerifyArgumentsCompat): Call
12775 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
12776 I thought we were supposed to always call this, but there are a
12777 few places in the code where we dont do it.
12779 2002-09-17 Miguel de Icaza <miguel@ximian.com>
12781 * driver.cs: Add support in -linkres and -resource to specify the
12782 name of the identifier.
12784 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12786 * ecore.cs (StandardConversionExists): Sync with the conversion
12787 code: allow anything-* to void* conversions.
12789 (FindMostSpecificSource): Use an Expression argument
12790 instead of a Type, because we might be handed over a Literal which
12791 gets a few more implicit conversions that plain types do not. So
12792 this information was being lost.
12794 Also, we drop the temporary type-holder expression when not
12797 2002-09-17 Martin Baulig <martin@gnome.org>
12799 * class.cs (PropertyBase.CheckBase): Don't check the base class if
12800 this is an explicit interface implementation.
12802 2002-09-17 Martin Baulig <martin@gnome.org>
12804 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
12805 different `IndexerName' attributes.
12807 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
12808 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
12809 virtual CommonResolve().
12811 2002-09-16 Miguel de Icaza <miguel@ximian.com>
12813 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
12814 and convert that to the UnderlyingType.
12816 * statement.cs (Foreach.Resolve): Indexers are just like variables
12817 or PropertyAccesses.
12819 * cs-tokenizer.cs (consume_string): Track line numbers and columns
12820 inside quoted strings, we were not doing this before.
12822 2002-09-16 Martin Baulig <martin@gnome.org>
12824 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
12825 resolve it. This is needed for the definite assignment check of the
12826 instance expression, fixes bug #29846.
12827 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
12829 2002-09-16 Nick Drochak <ndrochak@gol.com>
12831 * parameter.cs: Fix compile error. Cannot reference static member
12832 from an instance object. Is this an mcs bug?
12834 2002-09-14 Martin Baulig <martin@gnome.org>
12836 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
12837 multiple times. Fixes bug #30295, added test-166.cs.
12839 2002-09-14 Martin Baulig <martin@gnome.org>
12841 * statement.cs (Block.Emit): Don't emit unreachable code.
12842 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
12843 `break' statements.
12844 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
12846 2002-09-14 Martin Baulig <martin@gnome.org>
12848 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
12851 2002-09-14 Martin Baulig <martin@gnome.org>
12853 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
12854 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
12855 be false on the ms runtime.
12857 2002-09-13 Martin Baulig <martin@gnome.org>
12859 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
12860 the CS0038 error message.
12862 2002-09-12 Miguel de Icaza <miguel@ximian.com>
12864 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
12865 constant inside, return it.
12867 2002-09-12 Martin Baulig <martin@gnome.org>
12869 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
12870 implicit conversion can be done between enum types.
12872 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
12873 check whether an implicit conversion to the current enum's UnderlyingType
12874 exists and report an error if not.
12876 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
12877 without debugging support.
12879 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
12880 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
12882 2002-09-12 Martin Baulig <martin@gnome.org>
12884 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
12886 * ecore.cs (IMemberExpr.DeclaringType): New property.
12887 (SimpleName.SimpleNameResolve): Check whether we're accessing a
12888 nonstatic member of an outer type (CS0038).
12890 2002-09-11 Miguel de Icaza <miguel@ximian.com>
12892 * driver.cs: Activate the using-error detector at warning level
12893 4 (at least for MS-compatible APIs).
12895 * namespace.cs (VerifyUsing): Small buglett fix.
12897 * pending.cs (PendingImplementation): pass the container pointer.
12899 * interface.cs (GetMethods): Allow for recursive definition. Long
12900 term, I would like to move every type to support recursive
12901 definitions, not the current ordering mechanism that we have right
12904 The situation is this: Attributes are handled before interfaces,
12905 so we can apply attributes to interfaces. But some attributes
12906 implement interfaces, we will now handle the simple cases
12907 (recursive definitions will just get an error).
12909 * parameter.cs: Only invalidate types at the end if we fail to
12912 2002-09-09 Martin Baulig <martin@gnome.org>
12914 * ecore.cs (PropertyExpr.Emit): Also check for
12915 TypeManager.system_int_array_get_length so this'll also work when
12916 compiling corlib. Fixes #30003.
12918 2002-09-09 Martin Baulig <martin@gnome.org>
12920 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
12921 and throw an exception if we can't get the type's size. Fixed #30040,
12924 2002-09-09 Martin Baulig <martin@gnome.org>
12926 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
12928 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
12929 context. Fixes bug #30027.
12931 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
12932 virtual functions. Fixes bug #30043, added test-164.cs.
12934 2002-09-08 Ravi Pratap <ravi@ximian.com>
12936 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
12938 2002-09-08 Nick Drochak <ndrochak@gol.com>
12940 * driver.cs: Use an object to get the windows codepage since it's not a
12943 2002-09-08 Miguel de Icaza <miguel@ximian.com>
12945 * statement.cs (For.Emit): for infinite loops (test == null)
12946 return whether there is a break inside, not always "true".
12948 * namespace.cs (UsingEntry): New struct to hold the name of the
12949 using definition, the location where it is defined, and whether it
12950 has been used in a successful type lookup.
12952 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
12957 2002-09-06 Ravi Pratap <ravi@ximian.com>
12959 * attribute.cs : Fix incorrect code which relied on catching
12960 a NullReferenceException to detect a null being passed in
12961 where an object was expected.
12963 2002-09-06 Miguel de Icaza <miguel@ximian.com>
12965 * statement.cs (Try): flag the catch variable as assigned
12967 * expression.cs (Cast): Simplified by using ResolveType instead of
12968 manually resolving.
12970 * statement.cs (Catch): Fix bug by using ResolveType.
12972 2002-09-06 Ravi Pratap <ravi@ximian.com>
12974 * expression.cs (BetterConversion): Special case for when we have
12975 a NullLiteral as the argument and we have to choose between string
12976 and object types - we choose string the way csc does.
12978 * attribute.cs (Attribute.Resolve): Catch the
12979 NullReferenceException and report error #182 since the Mono
12980 runtime no more has the bug and having this exception raised means
12981 we tried to select a constructor which takes an object and is
12984 2002-09-05 Ravi Pratap <ravi@ximian.com>
12986 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
12987 message (1502, 1503) when we can't locate a method after overload
12988 resolution. This is much more informative and closes the bug
12991 * interface.cs (PopulateMethod): Return if there are no argument
12992 types. Fixes a NullReferenceException bug.
12994 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
12995 expressions too. Previously we were checking only in one place for
12996 positional arguments leaving out named arguments.
12998 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
12999 type to the enum type is not allowed. Remove code corresponding to
13002 (ConvertNumericExplicit): Allow explicit conversions from
13003 the underlying type to enum type. This precisely follows the spec
13004 and closes a bug filed by Gonzalo.
13006 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13009 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
13011 2002-09-03 Miguel de Icaza <miguel@ximian.com>
13013 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
13014 it was important that we stored the right value after the
13015 reduction in `converted'.
13017 2002-09-04 Martin Baulig <martin@gnome.org>
13019 * location.cs (Location.SymbolDocument): Use full pathnames for the
13022 2002-08-30 Miguel de Icaza <miguel@ximian.com>
13024 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
13025 of the expression resolve mechanism, because that will catch the
13026 SimpleName error failures.
13028 (Conditional): If we can not resolve the
13029 expression, return, do not crash.
13031 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13034 (location): display token name instead of its number.
13036 2002-08-28 Martin Baulig <martin@gnome.org>
13038 * expression.cs (Binary.ResolveOperator): Don't silently return
13039 but return an error if an operator cannot be applied between two
13042 2002-08-28 Martin Baulig <martin@gnome.org>
13044 * class.cs (Constructor.Define): Set the permission attributes
13045 correctly instead of making all constructors public.
13047 2002-08-28 Martin Baulig <martin@gnome.org>
13049 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
13050 for private members before reporting a CS0103; if we find anything,
13053 2002-08-28 Martin Baulig <martin@gnome.org>
13055 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
13056 to check whether `closure_start_type == closure_invocation_type',
13057 we also need to check whether `m.DeclaringType == closure_invocation_type'
13058 before bypassing the permission checks. We might be accessing
13059 protected/private members from the base class.
13060 (TypeManager.RealMemberLookup): Only set private_ok if private
13061 members were requested via BindingFlags.NonPublic.
13063 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
13065 * expression.cs (MemberAccess.ResolveMemberAccess): Set
13066 MethodGroupExpr.IsExplicitImpl if appropriate.
13067 (Invocation.DoResolve): Don't report the CS0120 for explicit
13068 interface implementations.
13070 2002-08-27 Martin Baulig <martin@gnome.org>
13072 * expression.cs (Invocation.DoResolve): If this is a static
13073 method and we don't have an InstanceExpression, we must report
13076 2002-08-25 Martin Baulig <martin@gnome.org>
13078 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
13079 `==' between a valuetype and an object.
13081 2002-08-25 Miguel de Icaza <miguel@ximian.com>
13083 * ecore.cs (TypeExpr): Provide a ToString method.
13085 2002-08-24 Martin Baulig <martin@gnome.org>
13087 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
13088 now called proggie.dbg and it's a binary file.
13090 2002-08-23 Martin Baulig <martin@gnome.org>
13092 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
13094 2002-08-23 Martin Baulig <martin@gnome.org>
13096 * struct.cs (MyStructInfo.ctor): Make this work with empty
13097 structs; it's not allowed to use foreach() on null.
13099 2002-08-23 Martin Baulig <martin@gnome.org>
13101 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
13102 writer the full pathname of the generated assembly.
13104 2002-08-23 Martin Baulig <martin@gnome.org>
13106 * statements.cs (FlowBranching.UsageVector.MergeChildren):
13107 A `finally' block never returns or breaks; improved handling of
13110 2002-08-23 Martin Baulig <martin@gnome.org>
13112 * statement.cs (Throw.Resolve): Allow `throw null'.
13114 2002-08-23 Martin Baulig <martin@gnome.org>
13116 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
13117 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
13118 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
13119 MemberLookup would return a wrong event if this is an explicit
13120 interface implementation and the class has an event with the same
13123 2002-08-23 Martin Baulig <martin@gnome.org>
13125 * statement.cs (Block.AddChildVariableNames): New public method.
13126 (Block.AddChildVariableName): Likewise.
13127 (Block.IsVariableNameUsedInChildBlock): Likewise.
13128 (Block.AddVariable): Check whether a variable name has already
13129 been used in a child block.
13131 * cs-parser.jay (declare_local_variables): Mark all variable names
13132 from the current block as being used in a child block in the
13135 2002-08-23 Martin Baulig <martin@gnome.org>
13137 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
13138 find the symbol writer.
13140 * driver.cs: csc also allows the arguments to /define being
13141 separated by commas, not only by semicolons.
13143 2002-08-23 Martin Baulig <martin@gnome.org>
13145 * interface.cs (Interface.GetMembers): Added static check for events.
13147 2002-08-15 Martin Baulig <martin@gnome.org>
13149 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
13150 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
13152 * ecore.cs (Expression.MemberLookup): Added documentation and explained
13153 why the MethodData.EmitDestructor() change was necessary.
13155 2002-08-20 Martin Baulig <martin@gnome.org>
13157 * class.cs (TypeContainer.FindMembers): Added static check for events.
13159 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
13161 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
13162 use Type.GetEvents(), not Type.FindMembers().
13164 2002-08-20 Martin Baulig <martin@gnome.org>
13166 * decl.cs (MemberCache): Added a special method cache which will
13167 be used for method-only searched. This ensures that a method
13168 search will return a MethodInfo with the correct ReflectedType for
13171 2002-08-20 Martin Baulig <martin@gnome.org>
13173 * decl.cs (DeclSpace.FindMembers): Made this public.
13175 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13177 * delegate.cs: fixed build on windows.
13178 [FIXME: Filed as bug #29150: MCS must report these errors.]
13180 2002-08-19 Ravi Pratap <ravi@ximian.com>
13182 * ecore.cs (StandardConversionExists): Return a false
13183 if we are trying to convert the void type to anything else
13184 since that is not allowed.
13186 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
13187 we flag error 70 in the event an event is trying to be accessed
13188 directly from outside the declaring type.
13190 2002-08-20 Martin Baulig <martin@gnome.org>
13192 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
13193 MemberCache from typemanager.cs to decl.cs.
13195 2002-08-19 Martin Baulig <martin@gnome.org>
13197 * class.cs (TypeContainer): Implement IMemberContainer.
13198 (TypeContainer.DefineMembers): Create the MemberCache.
13199 (TypeContainer.FindMembers): Do better BindingFlags checking; only
13200 return public members if BindingFlags.Public was given, check
13201 whether members are static.
13203 2002-08-16 Martin Baulig <martin@gnome.org>
13205 * decl.cs (DeclSpace.Define): Splitted this in Define and
13206 DefineMembers. DefineMembers is called first and initializes the
13209 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
13210 DefineMembers() on all our DeclSpaces.
13212 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
13213 but call DefineMembers() on all nested interfaces. We call their
13214 Define() in our new Define() function.
13216 * interface.cs (Interface): Implement IMemberContainer.
13217 (Interface.Define): Moved all code except the attribute stuf to
13219 (Interface.DefineMembers): Initialize the member cache.
13221 * typemanager.cs (IMemberFinder): Removed this interface, we don't
13222 need this anymore since we can use MemberCache.FindMembers directly.
13224 2002-08-19 Martin Baulig <martin@gnome.org>
13226 * typemanager.cs (MemberCache): When creating the cache for an
13227 interface type, add all inherited members.
13228 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
13229 to `out bool used_cache' and documented it.
13230 (TypeManager.MemberLookup): If we already used the cache in the first
13231 iteration, we don't need to do the interfaces check.
13233 2002-08-19 Martin Baulig <martin@gnome.org>
13235 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
13236 here from IMemberFinder and don't implement this interface anymore.
13237 (DeclSpace.MemberCache): Moved here from IMemberFinder.
13239 * typemanager.cs (IMemberFinder): This interface is now only used by
13240 classes which actually support the member cache.
13241 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
13242 since we only put DeclSpaces into this Hashtable.
13243 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
13244 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
13246 2002-08-16 Martin Baulig <martin@gnome.org>
13248 * typemanager.cs (ICachingMemberFinder): Removed.
13249 (IMemberFinder.MemberCache): New property.
13250 (TypeManager.FindMembers): Merged this with RealFindMembers().
13251 This function will never be called from TypeManager.MemberLookup()
13252 so we can't use the cache here, just the IMemberFinder.
13253 (TypeManager.MemberLookup_FindMembers): Check whether the
13254 IMemberFinder has a MemberCache and call the cache's FindMembers
13256 (MemberCache): Rewrote larger parts of this yet another time and
13257 cleaned it up a bit.
13259 2002-08-15 Miguel de Icaza <miguel@ximian.com>
13261 * driver.cs (LoadArgs): Support quoting.
13263 (Usage): Show the CSC-like command line arguments.
13265 Improved a few error messages.
13267 2002-08-15 Martin Baulig <martin@gnome.org>
13269 * typemanager.cs (IMemberContainer.Type): New property.
13270 (IMemberContainer.IsInterface): New property.
13272 The following changes are conditional to BROKEN_RUNTIME, which is
13273 defined at the top of the file.
13275 * typemanager.cs (MemberCache.MemberCache): Don't add the base
13276 class'es members, but add all members from TypeHandle.ObjectType
13277 if we're an interface.
13278 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
13279 is the current type.
13280 (MemberCache.CacheEntry.Container): Removed this field.
13281 (TypeHandle.GetMembers): Include inherited members.
13283 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13285 * typemanager.cs: fixed compilation and added a comment on a field that
13288 2002-08-15 Martin Baulig <martin@gnome.org>
13290 * class.cs (ConstructorInitializer.Resolve): In the
13291 Expression.MemberLookup call, use the queried_type as
13294 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
13295 declared' attribute, it's always true.
13296 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
13297 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
13298 temporary wrapper for FindMembers which tells MemberLookup whether
13299 members from the base classes are included in the return value.
13300 This will go away soon.
13301 (TypeManager.MemberLookup): Use this temporary hack here; once the
13302 new MemberCache is completed, we don't need to do the DeclaredOnly
13303 looping here anymore since the MemberCache will take care of this.
13304 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
13305 (MemberCache): When creating the MemberCache for a class, get
13306 members from the current class and all its base classes.
13307 (MemberCache.CacheEntry.Container): New field. This is a
13308 temporary hack until the Mono runtime is fixed to distinguish
13309 between ReflectedType and DeclaringType. It allows us to use MCS
13310 with both the MS runtime and the unfixed Mono runtime without
13311 problems and without accecting performance.
13312 (MemberCache.SearchMembers): The DeclaredOnly looping from
13313 TypeManager.MemberLookup is now done here.
13315 2002-08-14 Martin Baulig <martin@gnome.org>
13317 * statement.cs (MyStructInfo.MyStructInfo): Don't call
13318 Type.GetFields on dynamic types but get the fields from the
13319 corresponding TypeContainer.
13320 (MyStructInfo.GetStructInfo): Added check for enum types.
13322 * typemanager.cs (MemberList.IsSynchronized): Implemented.
13323 (MemberList.SyncRoot): Implemented.
13324 (TypeManager.FilterWithClosure): No need to check permissions if
13325 closure_start_type == closure_invocation_type, don't crash if
13326 closure_invocation_type is null.
13328 2002-08-13 Martin Baulig <martin@gnome.org>
13330 Rewrote TypeContainer.FindMembers to use a member cache. This
13331 gives us a speed increase of about 35% for the self-hosting MCS
13332 build and of about 15-20% for the class libs (both on GNU/Linux).
13334 * report.cs (Timer): New class to get enhanced profiling. This
13335 whole class is "TIMER" conditional since it remarkably slows down
13338 * class.cs (MemberList): New class. This is an IList wrapper
13339 which we're now using instead of passing MemberInfo[]'s around to
13340 avoid copying this array unnecessarily.
13341 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
13342 (ICachingMemberFinder, IMemberContainer): New interface.
13343 (TypeManager.FilterWithClosure): If `criteria' is null, the name
13344 has already been checked, otherwise use it for the name comparision.
13345 (TypeManager.FindMembers): Renamed to RealMemberFinder and
13346 provided wrapper which tries to use ICachingMemberFinder.FindMembers
13347 if possible. Returns a MemberList, not a MemberInfo [].
13348 (TypeHandle): New class, implements IMemberContainer. We create
13349 one instance of this class per type, it contains a MemberCache
13350 which is used to do the member lookups.
13351 (MemberCache): New class. Each instance of this class contains
13352 all members of a type and a name-based hash table.
13353 (MemberCache.FindMembers): This is our new member lookup
13354 function. First, it looks up all members of the requested name in
13355 the hash table. Then, it walks this list and sorts out all
13356 applicable members and returns them.
13358 2002-08-13 Martin Baulig <martin@gnome.org>
13360 In addition to a nice code cleanup, this gives us a performance
13361 increase of about 1.4% on GNU/Linux - not much, but it's already
13362 half a second for the self-hosting MCS compilation.
13364 * typemanager.cs (IMemberFinder): New interface. It is used by
13365 TypeManager.FindMembers to call FindMembers on a TypeContainer,
13366 Enum, Delegate or Interface.
13367 (TypeManager.finder_to_member_finder): New PtrHashtable.
13368 (TypeManager.finder_to_container): Removed.
13369 (TypeManager.finder_to_delegate): Removed.
13370 (TypeManager.finder_to_interface): Removed.
13371 (TypeManager.finder_to_enum): Removed.
13373 * interface.cs (Interface): Implement IMemberFinder.
13375 * delegate.cs (Delegate): Implement IMemberFinder.
13377 * enum.cs (Enum): Implement IMemberFinder.
13379 * class.cs (TypeContainer): Implement IMemberFinder.
13381 2002-08-12 Martin Baulig <martin@gnome.org>
13383 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
13385 2002-08-12 Martin Baulig <martin@gnome.org>
13387 * ecore.cs (ITypeExpression): New interface for expressions which
13389 (TypeExpression): Renamed to TypeLookupExpression.
13390 (Expression.DoResolve): If we're doing a types-only lookup, the
13391 expression must implement the ITypeExpression interface and we
13392 call DoResolveType() on it.
13393 (SimpleName): Implement the new ITypeExpression interface.
13394 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
13395 hack, the situation that we're only looking up types can't happen
13396 anymore when this method is called. Moved the type lookup code to
13397 DoResolveType() and call it.
13398 (SimpleName.DoResolveType): This ITypeExpression interface method
13399 is now doing the types-only lookup.
13400 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
13401 (ResolveFlags): Added MaskExprClass.
13403 * expression.cs (MemberAccess): Implement the ITypeExpression
13405 (MemberAccess.DoResolve): Added support for a types-only lookup
13406 when we're called via ITypeExpression.DoResolveType().
13407 (ComposedCast): Implement the ITypeExpression interface.
13409 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
13410 Expression.Resolve() with ResolveFlags.Type instead.
13412 2002-08-12 Martin Baulig <martin@gnome.org>
13414 * interface.cs (Interface.Define): Apply attributes.
13416 * attribute.cs (Attribute.ApplyAttributes): Added support for
13417 interface attributes.
13419 2002-08-11 Martin Baulig <martin@gnome.org>
13421 * statement.cs (Block.Emit): Only check the "this" variable if we
13422 do not always throw an exception.
13424 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
13425 whether the property has a set accessor.
13427 2002-08-11 Martin Baulig <martin@gnome.org>
13429 Added control flow analysis support for structs.
13431 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
13432 with control flow analysis turned off.
13433 (IVariable): New interface.
13434 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
13435 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
13436 (FieldExpr.DoResolve): Resolve the instance expression with flow
13437 analysis turned off and do the definite assignment check after the
13438 resolving when we know what the expression will resolve to.
13440 * expression.cs (LocalVariableReference, ParameterReference):
13441 Implement the new IVariable interface, only call the flow analysis
13442 code if ec.DoFlowAnalysis is true.
13443 (This): Added constructor which takes a Block argument. Implement
13444 the new IVariable interface.
13445 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
13446 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
13447 This does the definite assignment checks for struct members.
13449 * class.cs (Constructor.Emit): If this is a non-static `struct'
13450 constructor which doesn't have any initializer, call
13451 Block.AddThisVariable() to tell the flow analysis code that all
13452 struct elements must be initialized before control returns from
13455 * statement.cs (MyStructInfo): New public class.
13456 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
13457 argument to this indexer. If non-zero, check an individual struct
13458 member, not the whole struct.
13459 (FlowBranching.CheckOutParameters): Check struct members.
13460 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
13461 overloaded versions of these methods which take an additional
13462 `int field_idx' argument to check struct members.
13463 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
13464 overloaded versions of these methods which take an additional
13465 `string field_name' argument to check struct member.s
13466 (VariableInfo): Implement the IVariable interface.
13467 (VariableInfo.StructInfo): New public property. Returns the
13468 MyStructInfo instance of the variable if it's a struct or null.
13469 (Block.AddThisVariable): New public method. This is called from
13470 Constructor.Emit() for non-static `struct' constructor which do
13471 not have any initializer. It creates a special variable for the
13472 "this" instance variable which will be checked by the flow
13473 analysis code to ensure that all of the struct's fields are
13474 initialized before control returns from the constructor.
13475 (UsageVector): Added support for struct members. If a
13476 variable/parameter is a struct with N members, we reserve a slot
13477 in the usage vector for each member. A struct is considered fully
13478 initialized if either the struct itself (slot 0) or all its
13479 members are initialized.
13481 2002-08-08 Martin Baulig <martin@gnome.org>
13483 * driver.cs (Driver.MainDriver): Only report an error CS5001
13484 if there were no compilation errors.
13486 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
13487 `UnsafeContext' property to determine whether the parent is in
13488 unsafe context rather than checking the parent's ModFlags:
13489 classes nested in an unsafe class are unsafe as well.
13491 2002-08-08 Martin Baulig <martin@gnome.org>
13493 * statement.cs (UsageVector.MergeChildren): Distinguish between
13494 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
13495 we return. Added test17() and test18() to test-154.cs.
13497 2002-08-08 Martin Baulig <martin@gnome.org>
13499 * typemanager.cs (TypeManager.FilterWithClosure): If we have
13500 Family access, make sure the invoking type isn't a subclass of the
13501 queried type (that'd be a CS1540).
13503 * ecore.cs (Expression.MemberLookup): Added overloaded version of
13504 this method which takes an additional `Type invocation_type'.
13506 * expression.cs (BaseAccess.DoResolve): Use the base type as
13507 invocation and query type.
13508 (MemberAccess.DoResolve): If the lookup failed and we're about to
13509 report a CS0122, try a lookup with the ec.ContainerType - if this
13510 succeeds, we must report a CS1540.
13512 2002-08-08 Martin Baulig <martin@gnome.org>
13514 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
13515 (MethodGroupExpr): Implement the IMemberExpr interface.
13517 * expression (MemberAccess.ResolveMemberAccess): No need to have
13518 any special code for MethodGroupExprs anymore, they're now
13521 2002-08-08 Martin Baulig <martin@gnome.org>
13523 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
13524 Family, FamANDAssem and FamORAssem permissions.
13525 (TypeManager.IsSubclassOrNestedChildOf): New public method.
13527 2002-08-08 Martin Baulig <martin@gnome.org>
13529 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
13530 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
13533 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
13535 * driver.cs: implemented /resource option to embed managed resources.
13537 2002-08-07 Martin Baulig <martin@gnome.org>
13539 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
13540 (FieldBase.HasFieldInitializer): New public property.
13541 (FieldBase.GetInitializerExpression): New public method. Resolves and
13542 returns the field initializer and makes sure it is only resolved once.
13543 (TypeContainer.EmitFieldInitializers): Call
13544 FieldBase.GetInitializerExpression to get the initializer, this ensures
13545 that it isn't resolved multiple times.
13547 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
13548 the resolving process (SimpleName/MemberLookup) that we're currently
13549 emitting a field initializer (which must not access any instance members,
13550 this is an error CS0236).
13552 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
13553 argument, if the `IsFieldInitializer' flag is set, we must report and
13554 error CS0236 and not an error CS0120.
13556 2002-08-07 Martin Baulig <martin@gnome.org>
13558 * ecore.cs (IMemberExpr): New public interface.
13559 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
13560 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
13561 if the expression is an IMemberExpr.
13563 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
13564 to be null, implicitly default to `this' if we're non-static in
13565 this case. Simplified the code a lot by using the new IMemberExpr
13566 interface. Also fixed bug #28176 here.
13568 2002-08-06 Martin Baulig <martin@gnome.org>
13570 * cs-parser.jay (SimpleLookup): Removed. We need to create
13571 ParameterReferences during semantic analysis so that we can do a
13572 type-only search when resolving Cast, TypeOf and SizeOf.
13573 (block): Pass the `current_local_parameters' to the Block's
13576 * class.cs (ConstructorInitializer): Added `Parameters parameters'
13577 argument to the constructor.
13578 (ConstructorInitializer.Resolve): Create a temporary implicit
13579 block with the parameters.
13581 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
13582 references here if we aren't doing a type-only search.
13584 * statement.cs (Block): Added constructor which takes a
13585 `Parameters parameters' argument.
13586 (Block.Parameters): New public property.
13588 * support.cs (InternalParameters.Parameters): Renamed `parameters'
13589 to `Parameters' and made it public readonly.
13591 2002-08-06 Martin Baulig <martin@gnome.org>
13593 * ecore.cs (Expression.Warning): Made this public as well.
13595 * report.cs (Report.Debug): Print the contents of collections.
13597 2002-08-06 Martin Baulig <martin@gnome.org>
13599 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
13600 used to tell Resolve() which kinds of expressions it may return.
13601 (Expression.Resolve): Added overloaded version of this method which
13602 takes a `ResolveFlags flags' argument. This can be used to tell
13603 Resolve() which kinds of expressions it may return. Reports a
13605 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
13606 ResolveFlags.SimpleName.
13607 (Expression.Error118): Added overloaded version of this method which
13608 takes a `ResolveFlags flags' argument. It uses the flags to determine
13609 which kinds of expressions are allowed.
13611 * expression.cs (Argument.ResolveMethodGroup): New public method.
13612 Resolves an argument, but allows a MethodGroup to be returned.
13613 This is used when invoking a delegate.
13615 * TODO: Updated a bit.
13617 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13619 Fixed compilation with csc.
13621 * ecore.cs: Expression.Error made public. Is this correct? Should
13622 Warning be made public too?
13624 * expression.cs: use ea.Location instead of ea.loc.
13625 [FIXME: Filed as bug #28607: MCS must report these errors.]
13627 2002-08-06 Martin Baulig <martin@gnome.org>
13629 * ecore.cs (Expression.loc): Moved the location here instead of
13630 duplicating it in all derived classes.
13631 (Expression.Location): New public property.
13632 (Expression.Error, Expression.Warning): Made them non-static and
13633 removed the location argument.
13634 (Expression.Warning): Added overloaded version which takes an
13635 `int level' argument.
13636 (Expression.Error118): Make this non-static and removed the
13637 expression and location arguments.
13638 (TypeExpr): Added location argument to the constructor.
13640 * expression.cs (StaticCallExpr): Added location argument to
13642 (Indirection, PointerArithmetic): Likewise.
13643 (CheckedExpr, UnCheckedExpr): Likewise.
13644 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
13645 (StringPtr): Likewise.
13648 2002-08-05 Martin Baulig <martin@gnome.org>
13650 * expression.cs (BaseAccess.DoResolve): Actually report errors.
13652 * assign.cs (Assign.DoResolve): Check whether the source
13653 expression is a value or variable.
13655 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
13656 while resolving the corresponding blocks.
13658 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
13659 an error, don't silently return null.
13661 * statement.cs (Block.AddVariable): Do the error reporting here
13662 and distinguish between CS0128 and CS0136.
13663 (Block.DoResolve): Report all unused labels (warning CS0164).
13664 (LabeledStatement): Pass the location to the constructor.
13665 (LabeledStatement.HasBeenReferenced): New property.
13666 (LabeledStatement.Resolve): Set it to true here.
13668 * statement.cs (Return.Emit): Return success even after reporting
13669 a type mismatch error (CS0126 or CS0127), this is what csc does and
13670 it avoids confusing the users with any consecutive errors.
13672 2002-08-05 Martin Baulig <martin@gnome.org>
13674 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
13676 * const.cs (Const.LookupConstantValue): Catch circular definitions.
13678 * expression.cs (MemberAccess.DoResolve): Silently return if an
13679 error has already been reported.
13681 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
13682 error has already been reported.
13684 2002-08-05 Martin Baulig <martin@gnome.org>
13686 * statement.cs (UsageVector): Only initialize the `parameters'
13687 vector if we actually have any "out" parameters.
13689 2002-08-05 Martin Baulig <martin@gnome.org>
13691 * expression.cs (Binary.ResolveOperator): When combining delegates,
13692 they must have the same type.
13694 2002-08-05 Martin Baulig <martin@gnome.org>
13696 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
13697 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
13698 work with the ms runtime and we also don't need it: if we're a
13699 PropertyBuilder and not in the `indexer_arguments' hash, then we
13700 are a property and not an indexer.
13702 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
13703 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
13704 since the latter one doesn't work with the ms runtime.
13706 2002-08-03 Martin Baulig <martin@gnome.org>
13708 Fixed bugs #27998 and #22735.
13710 * class.cs (Method.IsOperator): New public field.
13711 (Method.CheckBase): Report CS0111 if there's already a method
13712 with the same parameters in the current class. Report CS0508 when
13713 attempting to change the return type of an inherited method.
13714 (MethodData.Emit): Report CS0179 if a method doesn't have a body
13715 and it's not marked abstract or extern.
13716 (PropertyBase): New abstract base class for Property and Indexer.
13717 (PropertyBase.CheckBase): Moved here from Property and made it work
13719 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
13720 the same so we can reuse it there.
13721 (Property, Indexer): Derive from PropertyBase.
13722 (MethodSignature.inheritable_property_signature_filter): New delegate
13723 to find properties and indexers.
13725 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
13726 argument and improved error reporting.
13728 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
13729 EmptyReadOnlyParameters and made it a property.
13731 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
13732 version of this method which takes a `PropertyInfo indexer'.
13733 (TypeManager.RegisterIndexer): New method.
13735 * class.cs: Added myself as author of this file :-)
13737 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13739 * class.cs: fixed compilation on windoze.
13741 2002-08-03 Martin Baulig <martin@gnome.org>
13743 * interface.cs (Interface.GetInterfaceBases): Check whether all
13744 base interfaces are at least as accessible than the current one.
13746 * class.cs (TypeContainer.GetClassBases): Check whether base types
13747 are at least as accessible than the current type.
13748 (TypeContainer.AsAccessible): Implemented and made non-static.
13749 (MemberBase.CheckParameters): Report errors if the accessibility
13752 * delegate.cs (Delegate.Delegate): The default visibility is
13753 internal for top-level types and private for nested types.
13754 (Delegate.Define): Report errors if the accessibility checks fail.
13756 * enum.cs (Enum.Enum): The default visibility is internal for
13757 top-level types and private for nested types.
13758 (Enum.DefineType): Compute the correct visibility.
13760 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
13761 function which takes a `bool is_toplevel' instead of a TypeContainer.
13763 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
13766 2002-08-02 Martin Baulig <martin@gnome.org>
13768 * expression.cs (LocalVariableReferenc): Added constructor which
13769 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
13770 (LocalVariableReference.IsReadOnly): New property.
13771 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
13772 variable is readonly, use our own readonly flag to do this; you can
13773 use the new constructor to get a writable reference to a read-only
13776 * cs-parser.jay (foreach_statement, using_statement): Get a writable
13777 reference to the local variable.
13779 2002-08-01 Miguel de Icaza <miguel@ximian.com>
13781 * rootcontext.cs (ResolveCore): Also include System.Exception
13783 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
13784 we reach an EmptyStatement.
13786 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
13789 * expression.cs (Binary.ResolveOperator): Check error result in
13792 use brtrue/brfalse directly and avoid compares to null.
13794 2002-08-02 Martin Baulig <martin@gnome.org>
13796 * class.cs (TypeContainer.Define): Define all nested interfaces here.
13797 Fixes bug #28407, added test-155.cs.
13799 2002-08-01 Martin Baulig <martin@gnome.org>
13801 * class.cs (Event.EmitDefaultMethod): Make this work with static
13802 events. Fixes #28311, added verify-3.cs.
13804 2002-08-01 Martin Baulig <martin@gnome.org>
13806 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
13807 `is_disposable' fields.
13808 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
13809 `hm.is_disposable' if we're using the collection pattern.
13810 (Foreach.EmitCollectionForeach): Use the correct type for the
13811 enumerator's local variable, only emit the try/finally block if
13812 necessary (fixes #27713).
13814 2002-08-01 Martin Baulig <martin@gnome.org>
13816 * ecore.cs (Expression.report118): Renamed to Error118 and made
13819 * statement.cs (Throw.Resolve): Check whether the expression is of
13820 the correct type (CS0118) and whether the type derives from
13821 System.Exception (CS0155).
13822 (Catch.Resolve): New method. Do the type lookup here and check
13823 whether it derives from System.Exception (CS0155).
13824 (Catch.CatchType, Catch.IsGeneral): New public properties.
13826 * typemanager.cs (TypeManager.exception_type): Added.
13828 2002-07-31 Miguel de Icaza <miguel@ximian.com>
13830 * driver.cs: Updated About function.
13832 2002-07-31 Martin Baulig <martin@gnome.org>
13834 Implemented Control Flow Analysis.
13836 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
13837 (EmitContext.CurrentBranching): Added.
13838 (EmitContext.StartFlowBranching): Added.
13839 (EmitContext.EndFlowBranching): Added.
13840 (EmitContext.KillFlowBranching): Added.
13841 (EmitContext.IsVariableAssigned): Added.
13842 (EmitContext.SetVariableAssigned): Added.
13843 (EmitContext.IsParameterAssigned): Added.
13844 (EmitContext.SetParameterAssigned): Added.
13845 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
13846 Added control flow analysis stuff here.
13848 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
13849 resolve the expression as lvalue.
13850 (LocalVariableReference.DoResolve): Check whether the variable has
13851 already been assigned.
13852 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
13853 the parameter as assigned here.
13854 (ParameterReference.DoResolve): Check whether the parameter has already
13856 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
13857 expression as lvalue.
13859 * statement.cs (FlowBranching): New class for the flow analysis code.
13860 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
13861 (LabeledStatement.IsDefined): New public property.
13862 (LabeledStatement.AddUsageVector): New public method to tell flow
13863 analyis that the label may be reached via a forward jump.
13864 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
13866 (VariableInfo.Number): New public field. This is used by flow analysis
13867 to number all locals of a block.
13868 (Block.CountVariables): New public property. This is the number of
13869 local variables in this block (including the locals from all parent
13871 (Block.EmitMeta): Number all the variables.
13873 * statement.cs: Added flow analysis support to all classes.
13875 2002-07-31 Martin Baulig <martin@gnome.org>
13877 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
13878 To get debugging messages, compile mcs with /define:MCS_DEBUG and
13879 then use this argument.
13881 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
13883 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
13884 use this to specify /define options.
13886 2002-07-29 Martin Baulig <martin@gnome.org>
13888 * statement.cs (Fixed): Moved all code that does variable lookups
13889 and resolvings from Emit to Resolve.
13891 * statement.cs (For): Moved all code that does variable lookups
13892 and resolvings from Emit to Resolve.
13894 * statement.cs (Using): Moved all code that does variable lookups
13895 and resolvings from Emit to Resolve.
13897 2002-07-29 Martin Baulig <martin@gnome.org>
13899 * attribute.cs (Attribute.Resolve): Explicitly catch a
13900 System.NullReferenceException when creating the
13901 CustromAttributeBuilder and report a different warning message.
13903 2002-07-29 Martin Baulig <martin@gnome.org>
13905 * support.cs (ParameterData.ParameterName): Added method to
13906 get the name of a parameter.
13908 * typemanager.cs (TypeManager.IsValueType): New public method.
13910 2002-07-29 Martin Baulig <martin@gnome.org>
13912 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
13913 is a flag which specifies that it's either ref or out.
13914 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
13915 the out parameter to `out Parameter.Modifier mod', also set the
13916 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
13918 * support.cs (InternalParameters.ParameterModifier): Distinguish
13919 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13920 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13922 * expression.cs (Argument.GetParameterModifier): Distinguish
13923 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
13924 Parameter.Modifier.ISBYREF flag if it's either ref or out.
13926 2002-07-29 Martin Baulig <martin@gnome.org>
13928 * expression.cs (ParameterReference.ParameterReference): Added
13929 `Location loc' argument to the constructor.
13931 * cs-parser.jay: Pass location to ParameterReference.
13933 2002-07-28 Miguel de Icaza <miguel@ximian.com>
13935 * statement.cs (Try): Initialize the location.
13937 * cs-parser.jay: pass location to Try.
13939 * expression.cs (Unary.Reduce): Change the prototype to return
13940 whether a constant fold could be performed or not. The result is
13941 returned in an out parameters. In the case of Indirection and
13942 AddressOf, we want to perform the full tests.
13944 2002-07-26 Miguel de Icaza <miguel@ximian.com>
13946 * statement.cs (Statement.Emit): Flag dead code.
13948 2002-07-27 Andrew Birkett <andy@nobugs.org>
13950 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
13952 2002-07-27 Martin Baulig <martin@gnome.org>
13954 * class.cs (MethodData.Define): Put back call to
13955 TypeManager.AddMethod(), accidentally commented this out.
13957 * report.cs (Debug): New public method to print debugging information,
13958 this is `[Conditional ("DEBUG")]'.
13960 2002-07-26 Martin Baulig <martin@gnome.org>
13962 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
13963 (switch_statement): Push the current_block to the switch_stack and
13964 pop it again when we're done with the switch.
13965 (switch_section): The new block is a child of the current_block.
13966 Fixes bug #24007, added test-152.cs.
13968 2002-07-27 Martin Baulig <martin@gnome.org>
13970 * expression.cs (Invocation.EmitArguments): When calling a varargs
13971 function with only its fixed arguments, we need to pass an empty
13974 2002-07-27 Martin Baulig <martin@gnome.org>
13976 Mono 0.13 has been released.
13978 2002-07-25 Miguel de Icaza <miguel@ximian.com>
13980 * driver.cs: Rename --resource to --linkres, because that is what
13981 we do currently, we dont support --resource yet.
13983 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
13985 2002-07-25 Martin Baulig <martin@gnome.org>
13987 * class.cs (MethodData): New public class. This is a `method builder'
13988 class for a method or one accessor of a Property/Indexer/Event.
13989 (MethodData.GetMethodFlags): Moved here from MemberBase.
13990 (MethodData.ApplyAttributes): Likewise.
13991 (MethodData.ApplyObsoleteAttribute): Likewise.
13992 (MethodData.ApplyConditionalAttribute): Likewise.
13993 (MethodData.ApplyDllImportAttribute): Likewise.
13994 (MethodData.CheckAbstractAndExternal): Likewise.
13995 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
13996 (MethodData.Emit): Formerly known as Method.Emit().
13997 (MemberBase): Moved everything which was specific to a single
13998 accessor/method to MethodData.
13999 (Method): Create a new MethodData and call Define() and Emit() on it.
14000 (Property, Indexer, Event): Create a new MethodData objects for each
14001 accessor and call Define() and Emit() on them.
14003 2002-07-25 Martin Baulig <martin@gnome.org>
14005 Made MethodCore derive from MemberBase to reuse the code from there.
14006 MemberBase now also checks for attributes.
14008 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
14009 (MemberBase.GetMethodFlags): Moved here from class Method and marked
14011 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
14012 `CallingConventions cc' and `Attributes opt_attrs' arguments.
14013 (MemberBase.ApplyAttributes): New virtual method; applies the
14014 attributes to a method or accessor.
14015 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
14016 (MemberBase.ApplyConditionalAttribute): Likewise.
14017 (MemberBase.ApplyDllImportAttribute): Likewise.
14018 (MemberBase.CheckAbstractAndExternal): Likewise.
14019 (MethodCore.ParameterTypes): This is now a property instead of a
14020 method, it's initialized from DoDefineParameters().
14021 (MethodCore.ParameterInfo): Removed the set accessor.
14022 (MethodCore.DoDefineParameters): New protected virtual method to
14023 initialize ParameterTypes and ParameterInfo.
14024 (Method.GetReturnType): We can now simply return the MemberType.
14025 (Method.GetMethodFlags): Override the MemberBase version and add
14026 the conditional flags.
14027 (Method.CheckBase): Moved some code from Define() here, call
14028 DoDefineParameters() here.
14029 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
14030 here to avoid some larger code duplication.
14031 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
14032 ensure that abstract and external accessors don't declare a body.
14034 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
14035 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
14036 lookup in the attribute's parent classes, so we need to abort as soon
14037 as we found the first match.
14038 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
14039 the attribute has no arguments.
14041 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
14044 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14046 * cs-parser.jay: reverted previous patch.
14048 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14050 * cs-parser.jay: fixed bug #22119.
14052 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14054 * attribute.cs: fixed compilation. The error was:
14055 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
14056 be assigned to before control leaves the current method."
14057 [FIXME: Filed as bug #28186: MCS must report this error.]
14059 2002-07-25 Martin Baulig <martin@gnome.org>
14061 * attribute.cs (Attribute.Conditional_GetConditionName): New static
14062 method to pull the condition name ouf of a Conditional attribute.
14063 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
14064 the obsolete message and error flag out of an Obsolete attribute.
14066 * class.cs (Method.GetMethodFlags): New public method to get the
14067 TypeManager.MethodFlags for this method.
14068 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
14070 (Method.Define): Get and apply the Obsolete and Conditional attributes;
14071 if we're overriding a virtual function, set the new private variable
14072 `parent_method'; call the new TypeManager.AddMethod().
14074 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
14075 the MethodBuilder and the Method in a PtrHashtable.
14076 (TypeManager.builder_to_method): Added for this purpose.
14077 (TypeManager.MethodFlags): Added IsObsoleteError.
14078 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
14079 Obsolete and Conditional arguments in MethodBuilders. If we discover
14080 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
14081 the message from the attribute.
14083 2002-07-24 Martin Baulig <martin@gnome.org>
14085 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
14086 preprocessor directives, ensure that the argument to #define/#undef is
14087 exactly one identifier and that it's actually an identifier.
14089 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
14092 2002-07-24 Martin Baulig <martin@gnome.org>
14094 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
14095 initialize it to TypeManager.object_type in the constructor.
14096 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
14097 of the `hm.get_current' method if we're using the collection pattern.
14098 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
14099 for the explicit conversion to make it work when we're using the collection
14100 pattern and the `Current' property has a different return type than `object'.
14103 2002-07-24 Martin Baulig <martin@gnome.org>
14105 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
14106 does not match, but don't report any errors. This method is called in
14107 order for all methods in a MethodGroupExpr until a matching method is
14108 found, so we don't want to bail out if the first method doesn't match.
14109 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
14110 matches, report the 123. Fixes #28070.
14112 2002-07-24 Martin Baulig <martin@gnome.org>
14114 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
14115 TypeManager.TypeToCoreType() to the top of the method so the
14116 following equality checks will work. Fixes #28107.
14118 2002-07-24 Martin Baulig <martin@gnome.org>
14120 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
14121 operand is of type uint, and the other operand is of type sbyte,
14122 short or int, the operands are converted to type long." -
14123 Actually do what this comment already told us. Fixes bug #28106,
14126 2002-07-24 Martin Baulig <martin@gnome.org>
14128 * class.cs (MethodBase): New abstract class. This is now a base
14129 class for Property, Indexer and Event to avoid some code duplication
14130 in their Define() and DefineMethods() methods.
14131 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
14132 generic methods for Define() and DefineMethods().
14133 (FieldBase): Derive from MemberBase, not MemberCore.
14134 (Property): Derive from MemberBase, not MemberCore.
14135 (Property.DefineMethod): Moved all the code from this method to the
14136 new MethodBase.DefineAccessor(), just call it with appropriate
14138 (Property.Define): Call the new Property.DoDefine(), this does some
14139 sanity checks and we don't need to duplicate the code everywhere.
14140 (Event): Derive from MemberBase, not MemberCore.
14141 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
14142 accessors, this will also make them work with interface events.
14143 (Indexer): Derive from MemberBase, not MemberCore.
14144 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
14145 (Indexer.Define): Use the new MethodBase functions.
14147 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
14148 argument to the constructor.
14149 (Interface.FindMembers): Added support for interface events.
14150 (Interface.PopluateEvent): Implemented.
14152 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
14154 2002-07-22 Miguel de Icaza <miguel@ximian.com>
14156 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
14157 but this is required to check for a method name being the same as
14158 the containing class.
14162 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14164 * interface.cs: initialize variable.
14166 2002-07-23 Martin Baulig <martin@gnome.org>
14168 Implemented the IndexerName attribute in interfaces.
14170 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
14171 name if this is an explicit interface implementation.
14172 (Indexer.InterfaceIndexerName): New public variable. If we're
14173 implementing an interface indexer, this is the IndexerName in that
14174 interface. Otherwise, it's the IndexerName.
14175 (Indexer.DefineMethod): If we're implementing interface indexer,
14176 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
14177 and Pending.ImplementIndexer methods.
14178 (Indexer.Define): Also define the PropertyBuilder if we're
14179 implementing an interface indexer and this is neither an explicit
14180 interface implementation nor do the IndexerName match the one in
14183 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
14184 If a method is defined here, then we always need to create a proxy
14185 for it. This is used when implementing interface indexers.
14186 (Pending.IsInterfaceIndexer): New public method.
14187 (Pending.ImplementIndexer): New public method.
14188 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
14189 This is used when implementing interface indexers to define a proxy
14191 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
14192 define a proxy if necessary.
14194 * interface.cs (Interface.IndexerName): New public variable.
14195 (Interface.PopulateIndexer): Set the IndexerName.
14196 (Interface.DefineIndexers): New private method. Populate all the
14197 indexers and make sure their IndexerNames match.
14199 * typemanager.cs (IndexerPropertyName): Added support for interface
14202 2002-07-22 Martin Baulig <martin@gnome.org>
14204 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
14205 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
14206 ret if HasReturnLabel.
14207 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
14210 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
14211 and set the ec.LoopBeginTryCatchLevel.
14212 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
14213 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
14214 the current ec.TryCatchLevel, the branch goes out of an exception
14215 block. In this case, we need to use Leave and not Br.
14217 2002-07-22 Martin Baulig <martin@gnome.org>
14219 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
14220 block unless the block does not always return or it is contained in
14221 another try { ... } catch { ... } block. Fixes bug #26506.
14222 Added verify-1.cs to the test suite.
14224 2002-07-22 Martin Baulig <martin@gnome.org>
14226 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
14227 then we do not always return. Fixes bug #24985.
14229 2002-07-22 Martin Baulig <martin@gnome.org>
14231 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
14232 lookup on a per-class level; ie. walk up the class hierarchy until we
14233 found at least one applicable method, then choose the best among them.
14234 Fixes bug #24463 and test-29.cs.
14236 2002-07-22 Martin Baulig <martin@gnome.org>
14238 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
14239 return types of the methods. The return type is not part of the
14240 signature and we must not check it to make the `new' modifier work.
14241 Fixes bug #27999, also added test-147.cs.
14242 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
14244 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
14245 on the method's return type.
14247 2002-07-21 Martin Baulig <martin@gnome.org>
14249 * assign.cs: Make this work if the rightmost source is a constant and
14250 we need to do an implicit type conversion. Also adding a few more tests
14251 to test-38.cs which should have caught this.
14253 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
14254 target in the makefile for this. The makefile.gnu is primarily intended
14255 for end-users who don't want to debug the compiler.
14257 2002-07-21 Martin Baulig <martin@gnome.org>
14259 * assign.cs: Improved the Assign class so it can now handle embedded
14260 assignments (X = Y = Z = something). As a side-effect this'll now also
14261 consume less local variables. test-38.cs now passes with MCS, added
14262 a few new test cases to that test.
14264 2002-07-20 Martin Baulig <martin@gnome.org>
14266 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
14267 instructions. Fixes bug #27977, also added test-146.cs.
14269 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14271 * cs-tokenizer.cs: fixed getHex ().
14273 2002-07-19 Martin Baulig <martin@gnome.org>
14275 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
14276 not Type.GetType() to lookup the array type. This is needed when
14277 we're constructing an array of a user-defined type.
14278 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
14279 single-dimensional arrays, but also for single-dimensial arrays of
14282 2002-07-19 Martin Baulig <martin@gnome.org>
14284 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
14285 this function is called, it's not allowed to share LocalBuilders
14286 among ILGenerators.
14288 2002-07-19 Martin Baulig <martin@gnome.org>
14290 * expression.cs (Argument.Resolve): Report an error 118 when trying
14291 to pass a type as argument.
14293 2002-07-18 Martin Baulig <martin@gnome.org>
14295 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
14296 Conv_R_Un for the signed `long' type.
14298 2002-07-15 Miguel de Icaza <miguel@ximian.com>
14300 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
14301 `expr' for the temporary result, as that will fail if we do
14302 multiple resolves on the same expression.
14304 2002-07-05 Miguel de Icaza <miguel@ximian.com>
14306 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
14307 ec.TypeContainer for looking up aliases.
14309 * class.cs (TypeContainer): Remove LookupAlias from here.
14311 * decl.cs (DeclSpace); Move here.
14313 2002-07-01 Miguel de Icaza <miguel@ximian.com>
14315 * class.cs (FindMembers): Only call filter if the constructor
14316 bulider is not null.
14318 Also handle delegates in `NestedTypes' now. Now we will perform
14319 type lookups using the standard resolution process. This also
14322 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
14323 This uses Expressions (the limited kind that can be parsed by the
14324 tree) instead of strings.
14326 * expression.cs (ComposedCast.ToString): Implement, used to flag
14327 errors since now we have to render expressions.
14329 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
14332 * ecore.cs (SimpleName.ToString): ditto.
14334 * cs-parser.jay: Instead of using strings to assemble types, use
14335 Expressions to assemble the type (using SimpleName, ComposedCast,
14336 MemberAccess). This should fix the type lookups in declarations,
14337 because we were using a different code path for this.
14339 * statement.cs (Block.Resolve): Continue processing statements
14340 even when there is an error.
14342 2002-07-17 Miguel de Icaza <miguel@ximian.com>
14344 * class.cs (Event.Define): Also remove the `remove' method from
14345 the list of pending items.
14347 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
14348 generate more compact code.
14350 2002-07-17 Martin Baulig <martin@gnome.org>
14352 * const.cs (Const.LookupConstantValue): Add support for constant
14353 `unchecked' and `checked' expressions.
14354 Also adding test case test-140.cs for this.
14356 2002-07-17 Martin Baulig <martin@gnome.org>
14358 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
14359 check whether mi.ReturnType implements the IEnumerator interface; the
14360 `==' and the IsAssignableFrom() will fail in this situation.
14362 2002-07-16 Ravi Pratap <ravi@ximian.com>
14364 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
14367 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14369 * expression.cs: fixed bug #27811.
14371 2002-07-14 Miguel de Icaza <miguel@ximian.com>
14373 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
14374 Molaro: when we are a ref, the value already contains a pointer
14375 value, do not take the address of it.
14377 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14378 * removed mb-parser.jay and mb-tokenizer.cs
14380 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14382 * expression.cs: check against the building corlib void type.
14384 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
14386 * ecore.cs: fix for valuetype static readonly fields: when
14387 initializing them, we need their address, not the address of a copy.
14389 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
14391 * typemanager.cs: register also enum_type in corlib.
14393 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14395 * class.cs: allow calling this (but not base) initializers in structs.
14397 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
14399 * ecore.cs: make sure we compare against the building base types
14402 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
14404 * typemanager.cs: fix TypeToCoreType() to handle void and object
14405 (corlib gets no more typerefs after this change).
14407 2002-07-12 Miguel de Icaza <miguel@ximian.com>
14409 * expression.cs (ArrayCreation.EmitArrayArguments): use
14410 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
14412 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
14413 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
14414 array indexes, the runtime actually forbids them.
14416 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
14417 for array arguments here.
14419 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
14420 instead of the default for ValueTypes.
14422 (New.DoEmit): Use IsValueType instead of
14423 IsSubclassOf (value_type)
14424 (New.DoResolve): ditto.
14425 (Invocation.EmitCall): ditto.
14427 * assign.cs (Assign): ditto.
14429 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
14430 Statements *are* currently doing part of their resolution during
14433 Expressions do always resolve during resolve, but statements are
14434 only required to propagate resolution to their children.
14436 2002-07-11 Miguel de Icaza <miguel@ximian.com>
14438 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
14440 (LoadAssembly): Do not add the dll if it is already specified
14442 (MainDriver): Add the System directory to the link path at the end,
14443 after all the other -L arguments.
14445 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
14446 wrong opcode for loading bytes and bools (ldelem.i1 instead of
14447 ldelem.u1) and using the opposite for sbytes.
14449 This fixes Digger, and we can finally run it.
14451 * driver.cs (UnixParseOption): Move the option parsing here.
14452 (CSCParseOption): Implement CSC-like parsing of options.
14454 We now support both modes of operation, the old Unix way, and the
14455 new CSC-like way. This should help those who wanted to make cross
14456 platform makefiles.
14458 The only thing broken is that /r:, /reference: and /lib: are not
14459 implemented, because I want to make those have the same semantics
14460 as the CSC compiler has, and kill once and for all the confussion
14461 around this. Will be doing this tomorrow.
14463 * statement.cs (Unsafe.Resolve): The state is checked during
14464 resolve, not emit, so we have to set the flags for IsUnsfe here.
14466 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14468 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
14469 not catch the Error_ObjectRefRequired in SimpleName (as it is
14470 possible to have a class/instance variable name that later gets
14471 deambiguated), we have to check this here.
14473 2002-07-10 Ravi Pratap <ravi@ximian.com>
14475 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
14476 make static and put into Expression.
14478 (Event.Define): Register the private field of the event with the
14479 TypeManager so that GetFieldFromEvent can get at it.
14481 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
14482 keep track of the private field associated with an event which
14485 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
14488 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
14490 2002-07-10 Miguel de Icaza <miguel@ximian.com>
14492 * expression.cs (Binary.EmitBranchable): this routine emits the
14493 Binary expression in a branchable context. This basically means:
14494 we need to branch somewhere, not just get the value on the stack.
14496 This works together with Statement.EmitBoolExpression.
14498 * statement.cs (Statement.EmitBoolExpression): Use
14501 2002-07-09 Miguel de Icaza <miguel@ximian.com>
14503 * statement.cs (For): Reduce the number of jumps in loops.
14505 (For): Implement loop inversion for the For statement.
14507 (Break): We can be breaking out of a Try/Catch controlled section
14508 (foreach might have an implicit try/catch clause), so we need to
14509 use Leave instead of Br.
14511 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
14512 now). If the instace expression supports IMemoryLocation, we use
14513 the AddressOf method from the IMemoryLocation to extract the
14514 address instead of emitting the instance.
14516 This showed up with `This', as we were emitting the instance
14517 always (Emit) instead of the Address of This. Particularly
14518 interesting when This is a value type, as we dont want the Emit
14519 effect (which was to load the object).
14521 2002-07-08 Miguel de Icaza <miguel@ximian.com>
14523 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
14525 * statement.cs (Checked): Set the CheckedState during the resolve
14526 process too, as the ConvCast operations track the checked state on
14527 the resolve process, and not emit.
14529 * cs-parser.jay (namespace_member_declaration): Flag that we have
14530 found a declaration when we do. This is used to flag error 1529
14532 * driver.cs: Report ok when we display the help only.
14534 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
14536 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
14538 2002-07-04 Miguel de Icaza <miguel@ximian.com>
14540 * cs-tokenizer.cs (define): We also have to track locally the
14541 defines. AllDefines is just used for the Conditional Attribute,
14542 but we also need the local defines for the current source code.
14544 2002-07-03 Miguel de Icaza <miguel@ximian.com>
14546 * statement.cs (While, For, Do): These loops can exit through a
14547 Break statement, use this information to tell whether the
14548 statement is the last piece of code.
14550 (Break): Flag that we break.
14552 * codegen.cs (EmitContexts): New `Breaks' state variable.
14554 2002-07-03 Martin Baulig <martin@gnome.org>
14556 * class.cs (TypeContainer.MethodModifiersValid): Allow override
14557 modifiers in method declarations in structs. Otherwise, you won't
14558 be able to override things like Object.Equals().
14560 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14562 * class.cs (Method, Property, Indexer): Do not allow the public
14563 modifier to be used in explicit interface implementations.
14565 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
14566 override modifiers in method declarations in structs
14568 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
14570 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
14571 integer or real overflow, report an error
14573 2002-07-02 Martin Baulig <martin@gnome.org>
14575 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
14576 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
14577 to tell the runtime about our newly created System.Object and
14578 System.ValueType types.
14580 2002-07-02 Miguel de Icaza <miguel@ximian.com>
14582 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
14583 struct instead of Ldarg/Starg.
14585 2002-07-02 Martin Baulig <martin@gnome.org>
14587 * expression.cs (Indirection.Indirection): Call
14588 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
14590 2002-07-02 Martin Baulig <martin@gnome.org>
14592 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
14593 ValueType, call TypeManager.TypeToCoreType() on it.
14594 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
14595 the OpCodes.Newarr argument.
14597 2002-07-02 Martin Baulig <martin@gnome.org>
14599 * expression.cs (Invocation.EmitCall): When compiling corlib,
14600 replace all calls to the system's System.Array type to calls to
14601 the newly created one.
14603 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
14604 System.Array methods.
14605 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
14606 from the system's System.Array type which must be replaced.
14608 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
14610 * typemanager.cs: load unverifiable_code_ctor so we can build
14611 corlib using the correct type. Avoid using GetTypeCode() with
14613 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
14614 TypeManager.object_type to allow building corlib.
14616 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
14618 * ecore.cs: handle System.Enum separately in LoadFromPtr().
14620 2002-07-01 Martin Baulig <martin@gnome.org>
14622 * class.cs: Make the last change actually work, we need to check
14623 whether `ifaces != null' to avoid a crash.
14625 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
14627 * class.cs: when we build structs without fields that implement
14628 interfaces, we need to add the interfaces separately, since there is
14629 no API to both set the size and add the interfaces at type creation
14632 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
14634 * expression.cs: the dimension arguments to the array constructors
14635 need to be converted if they are a long.
14637 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
14639 * class.cs: don't emit ldarg.0 if there is no parent constructor
14640 (fixes showstopper for corlib).
14642 2002-06-29 Martin Baulig <martin@gnome.org>
14644 MCS now compiles corlib on GNU/Linux :-)
14646 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
14647 ie. check for MethodImplOptions.InternalCall.
14649 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
14650 and TypeManager.attribute_type are null, so we must explicitly check
14651 whether parent is not null to find out whether it's an attribute type.
14652 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
14653 and SetBuilder, not only if the property is neither abstract nor external.
14654 This is necessary to set the MethodImplOptions on the accessor methods.
14655 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
14656 SetBuilder, see Property.Emit().
14658 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
14659 populate "System.Object", "System.ValueType" and "System.Attribute" since
14660 they've already been populated from BootCorlib_PopulateCoreTypes().
14662 2002-06-29 Martin Baulig <martin@gnome.org>
14664 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
14665 is the NullLiteral, we also need to make sure that target_type is not
14668 2002-06-29 Martin Baulig <martin@gnome.org>
14670 * rootcontext.cs (RootContext.ResolveCore): We must initialize
14671 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
14672 before calling BootstrapCorlib_ResolveDelegate ().
14674 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14676 * statement.cs: fixed build-breaker. All tests passed ok.
14678 2002-06-27 Martin Baulig <martin@gnome.org>
14680 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
14681 for System.Decimal when compiling corlib.
14683 2002-06-27 Martin Baulig <martin@gnome.org>
14685 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
14686 switch blocks which contain nothing but a default clause.
14688 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
14690 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
14692 2002-06-27 Martin Baulig <martin@gnome.org>
14694 * ecore.cs (PropertyExpr.PropertyExpr): Call
14695 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
14697 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
14698 is already a TypeBuilder.
14700 2002-06-27 Martin Baulig <martin@gnome.org>
14702 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
14703 `target_type == TypeManager.array_type', not IsAssignableFrom() in
14704 the "from an array-type to System.Array" case. This makes it work
14705 when compiling corlib.
14707 2002-06-27 Martin Baulig <martin@gnome.org>
14709 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
14710 non-static PropertyExpr, set its InstanceExpression. This makes
14711 the `ICollection.Count' property work in System/Array.cs.
14713 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
14715 * driver.cs: Made error handling more consistent. Errors now
14716 tracked by Report class, so many methods which used to return int
14717 now return void. Main() now prints success/failure and
14718 errors/warnings message.
14720 Renamed '--probe' compiler argument to '--expect-error'. Removed
14721 the magic number return values (123 and 124). Now, if the
14722 expected error occurs, the compiler exits with success (exit value
14723 0). If the compilation completes without seeing that particular
14724 error, the compiler exits with failure (exit value 1). The
14725 makefile in mcs/errors has been changed to handle the new behaviour.
14727 * report.cs: Made 'expected error' number a property and renamed
14728 it from 'Probe' to 'ExpectedError'.
14730 * genericparser.cs: Removed error handling support, since it is
14731 now all done by Report class.
14733 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
14734 class, so parse() no longer returns an int.
14736 * namespace.cs: Use Report.Error instead of GenericParser.error
14738 2002-06-22 Miguel de Icaza <miguel@ximian.com>
14740 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
14741 TypeContainer.AddOperator): At the front of the list put the
14742 explicit implementations, so they get resolved/defined first.
14744 2002-06-21 Miguel de Icaza <miguel@ximian.com>
14746 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
14747 interface type is implemented by this TypeContainer. Used during
14748 explicit interface implementation.
14750 (Property.Define, Indexer.Define, Method.Define): Validate that
14751 the given interface in the explicit implementation is one of the
14752 base classes for the containing type.
14754 Also if we are explicitly implementing an interface, but there is
14755 no match in the pending implementation table, report an error.
14757 (Property.Define): Only define the property if we are
14758 not explicitly implementing a property from an interface. Use the
14759 correct name also for those properties (the same CSC uses,
14760 although that is really not needed).
14762 (Property.Emit): Do not emit attributes for explicitly implemented
14763 properties, as there is no TypeBuilder.
14765 (Indexer.Emit): ditto.
14767 Hiding then means that we do not really *implement* a pending
14768 implementation, which makes code fail.
14770 2002-06-22 Martin Baulig <martin@gnome.org>
14772 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
14773 the return value of Object.GetType(). [FIXME: we need to do this whenever
14774 we get a type back from the reflection library].
14776 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
14778 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
14780 2002-06-20 Miguel de Icaza <miguel@ximian.com>
14782 * attribute.cs: Return null if we can not look up the type.
14784 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
14785 the interface types found.
14787 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
14788 interface types found.
14790 * typemanager.cs (GetInterfaces): Make this routine returns alll
14791 the interfaces and work around the lame differences between
14792 System.Type and System.Reflection.Emit.TypeBuilder in the results
14793 result for GetInterfaces.
14795 (ExpandInterfaces): Given an array of interface types, expand and
14796 eliminate repeated ocurrences of an interface. This expands in
14797 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
14800 2002-06-21 Martin Baulig <martin@gnome.org>
14802 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
14805 2002-06-21 Martin Baulig <martin@gnome.org>
14807 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
14808 and called with one of the core types, return the corresponding typebuilder for
14811 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
14814 2002-06-21 Martin Baulig <martin@gnome.org>
14816 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
14817 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
14818 (Expression.ConvertReferenceExplicit): Likewise.
14820 * expression.cs (ElementAccess.DoResolve): Likewise.
14821 (ElementAccess.DoResolveLValue): Likewise.
14823 2002-06-10 Martin Baulig <martin@gnome.org>
14825 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
14826 add the "value" parameter to the parameter list.
14828 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
14831 2002-06-19 Miguel de Icaza <miguel@ximian.com>
14833 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
14834 the argument to an int, uint, long or ulong, per the spec. Also
14835 catch negative constants in array creation.
14837 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
14839 * class.cs: do not allow the same interface to appear twice in
14840 the definition list.
14842 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
14844 * ecore.cs: don't use ldlen with System.Array.
14846 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
14848 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
14850 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
14852 * modifiers.cs: produce correct field attributes for protected
14853 internal. Easy fix so miguel can work on ther harder stuff:-)
14855 2002-06-18 Miguel de Icaza <miguel@ximian.com>
14857 * pending.cs: New file. Move the code from class.cs here.
14858 Support clearning the pending flag for all methods (when not doing
14859 explicit interface implementation).
14861 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
14863 * rootcontext.cs: added a couple more types needed to bootstrap.
14865 2002-06-17 Miguel de Icaza <miguel@ximian.com>
14867 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
14868 constructor in the type, instead of any constructor in the type
14869 hierarchy. Thanks to Paolo for finding this bug (it showed up as
14870 a bug in the Mono runtime when applying the params attribute).
14872 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
14873 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
14875 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
14877 * expression.cs (Unary.ResolveOperator): Use TypeManager
14878 to resolve the type.
14880 2002-06-13 Ravi Pratap <ravi@ximian.com>
14882 * cs-parser.jay (enum_member_declaration): Pass in the attributes
14885 * enum.cs (AddEnumMember): Add support to store the attributes associated
14886 with each member too.
14888 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
14889 field builders too - this takes care of the enum member case.
14891 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
14893 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
14894 address-of operator on both value types and pointers.
14896 2002-06-10 Martin Baulig <martin@gnome.org>
14898 * interface.cs (Interface.PopulateIndexer): Add the indexer's
14899 PropertyBuilder to the `property_builders' list.
14901 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
14902 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
14903 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
14904 find any indexers which are inherited from an interface.
14906 2002-06-09 Martin Baulig <martin@gnome.org>
14908 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
14909 the same type as the constant if necessary. There's also a test-130.cs
14912 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
14914 * typemanager.cs (TypeManager.ChangeType): Previously known as
14915 Enum.ChangeEnumType().
14917 2002-06-09 Martin Baulig <martin@gnome.org>
14919 * expression.cs (Cast.TryReduce): Added support for consts.
14921 2002-06-08 Ravi Pratap <ravi@ximian.com>
14923 * class.cs (Accessor): Hold attributes information so we can pass
14926 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
14927 Modify to pass in attributes attached to the methods.
14929 (add_accessor_declaration, remove_accessor_declaration): Ditto.
14931 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
14932 to handle the Accessor kind :-)
14934 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
14936 2002-06-08 Martin Baulig <martin@gnome.org>
14938 * expression.cs (Unary.TryReduceNegative): Added support for
14941 2002-06-08 Martin Baulig <martin@gnome.org>
14943 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
14944 name can't be found in the `defined_names' - the caller will do a
14945 MemberLookup in this case and thus find methods in System.Enum
14946 such as Enum.IsDefined().
14948 2002-06-08 Martin Baulig <martin@gnome.org>
14950 * enum.cs (Enum.ChangeEnumType): This is a custom version of
14951 Convert.ChangeType() which works with TypeBuilder created types.
14952 (Enum.LookupEnumValue, Enum.Define): Use it here.
14954 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
14955 `TypeBuilder.BaseType != null' check.
14956 (TypeContainer.FindMembers): Only lookup parent members if we
14957 actually have a parent.
14958 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
14959 (ConstructorInitializer.Resolve): Likewise.
14961 * interface.cs (Interface.FindMembers): Added
14962 `TypeBuilder.BaseType != null' check.
14964 * rootcontext.cs (RootContext.ResolveCore): Added
14965 "System.Runtime.CompilerServices.IndexerNameAttribute" to
14966 classes_second_stage.
14968 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
14969 debug_type and trace_type when compiling with --nostdlib.
14971 2002-06-07 Martin Baulig <martin@gnome.org>
14973 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
14974 (AddField): Set it to true when adding a non-static field.
14975 (DefineType): Use `have_nonstatic_fields' to find out whether we
14976 have non-static fields, not `Fields != null'.
14978 2002-06-02 Miguel de Icaza <miguel@ximian.com>
14980 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
14981 dereferencing a null on the static-field code path)
14983 2002-05-30 Martin Baulig <martin@gnome.org>
14985 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
14986 to take command line arguments. Use reflection to call the new
14987 custom `Initialize' function on the symbol writer and pass it the
14988 command line arguments.
14990 * driver.cs (--debug-args): New command line argument to pass command
14991 line arguments to the symbol writer.
14993 2002-05-28 Miguel de Icaza <miguel@ximian.com>
14995 * assign.cs (DoResolve): Forgot to do the implicit conversion to
14996 the target type for indexers and properties. Thanks to Joe for
14999 2002-05-27 Miguel de Icaza <miguel@ximian.com>
15001 * typemanager.cs (MethodFlags): returns the method flags
15002 (Obsolete/ShouldIgnore) that control warning emission and whether
15003 the invocation should be made, or ignored.
15005 * expression.cs (Invocation.Emit): Remove previous hack, we should
15006 not do this on matching a base type, we should do this based on an attribute
15008 Only emit calls to System.Diagnostics.Debug and
15009 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
15010 on the command line.
15012 * rootcontext.cs: Global settings for tracing and debugging.
15014 * cs-tokenizer.cs (define): New utility function to track
15015 defines. Set the global settings for TRACE and DEBUG if found.
15017 2002-05-25 Ravi Pratap <ravi@ximian.com>
15019 * interface.cs (Populate*): Pass in the TypeContainer as well as
15020 the DeclSpace as parameters so that we can create EmitContexts and
15021 then use that to apply attributes etc.
15023 (PopulateMethod, PopulateEvent, PopulateProperty)
15024 (PopulateIndexer): Apply attributes everywhere.
15026 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
15029 (ApplyAttributes): Update accordingly.
15031 We now apply interface attributes for all members too.
15033 2002-05-26 Miguel de Icaza <miguel@ximian.com>
15035 * class.cs (Indexer.Define); Correctly check if we are explicit
15036 implementation (instead of checking the Name for a ".", we
15037 directly look up if the InterfaceType was specified).
15039 Delay the creation of the PropertyBuilder.
15041 Only create the PropertyBuilder if we are not an explicit
15042 interface implementation. This means that explicit interface
15043 implementation members do not participate in regular function
15044 lookups, and hence fixes another major ambiguity problem in
15045 overload resolution (that was the visible effect).
15047 (DefineMethod): Return whether we are doing an interface
15050 * typemanager.cs: Temporary hack until we get attributes in
15051 interfaces (Ravi is working on that) and we get IndexerName
15052 support in interfaces.
15054 * interface.cs: Register the indexers as properties.
15056 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
15057 warning, I have verified that this is a bug in the .NET runtime
15058 (JavaScript suffers of the same problem).
15060 * typemanager.cs (MemberLookup): When looking up members for
15061 interfaces, the parent of an interface is the implicit
15062 System.Object (so we succeed in searches of Object methods in an
15063 interface method invocation. Example: IEnumerable x; x.ToString
15066 2002-05-25 Miguel de Icaza <miguel@ximian.com>
15068 * class.cs (Event): Events should also register if they do
15069 implement the methods that an interface requires.
15071 * typemanager.cs (MemberLookup); use the new GetInterfaces
15074 (GetInterfaces): The code used to lookup interfaces for a type is
15075 used in more than one place, factor it here.
15077 * driver.cs: Track the errors at the bottom of the file, we kept
15080 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
15081 instance if the method we are calling is static!
15083 2002-05-24 Miguel de Icaza <miguel@ximian.com>
15085 * attribute.cs (ApplyAttributes): Make this function filter out
15086 the IndexerName attribute (as that attribute in reality is never
15087 applied) and return the string constant for the IndexerName
15090 * class.cs (TypeContainer.Emit): Validate that all the indexers
15091 have the same IndexerName attribute, and if so, set the
15092 DefaultName attribute on the class.
15094 * typemanager.cs: The return value might contain other stuff (not
15095 only methods). For instance, consider a method with an "Item"
15096 property and an Item method.
15098 * class.cs: If there is a problem with the parameter types,
15101 2002-05-24 Ravi Pratap <ravi@ximian.com>
15103 * ecore.cs (ImplicitConversionExists): Wrapper function which also
15104 looks at user defined conversion after making a call to
15105 StandardConversionExists - we need this for overload resolution.
15107 * expression.cs : Update accordingly the various method calls.
15109 This fixes 2 bugs filed against implicit user defined conversions
15111 2002-05-22 Miguel de Icaza <miguel@ximian.com>
15113 * statement.cs: Track the result of the assignment.
15115 2002-05-21 Miguel de Icaza <miguel@ximian.com>
15117 * expression.cs (MemberAccess): Improved error reporting for
15118 inaccessible members.
15120 2002-05-22 Martin Baulig <martin@gnome.org>
15122 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
15123 itself with debugging support.
15125 2002-05-22 Martin Baulig <martin@gnome.org>
15127 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
15128 Removed, this isn't needed anymore.
15130 2002-05-20 Martin Baulig <martin@gnome.org>
15132 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
15133 be underlying type for an enum.
15135 2002-05-20 Miguel de Icaza <miguel@ximian.com>
15137 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
15138 that splits out the loading of just the core types.
15140 * rootcontext.cs (ResolveCore): Split the struct resolution in
15141 two, so we can load the enumeration underlying types before any
15144 * expression.cs (Is): Bandaid until we fix properly Switch (see
15145 bug #24985 for details).
15147 * typemanager.cs (ImplementsInterface): The hashtable will contain
15148 a null if there are no interfaces implemented.
15150 2002-05-18 Miguel de Icaza <miguel@ximian.com>
15152 * cs-parser.jay (indexer_declarator): It is fine to have array
15155 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15157 * typemanager.cs: (RegisterBuilder): New function used to register
15158 TypeBuilders that implement interfaces. Since
15159 TypeBuilder.GetInterfaces (as usual) does not work with lame
15161 (AddUserType): register interfaces.
15163 (ImplementsInterface): Use the builder_to_ifaces hash if we are
15164 dealing with TypeBuilder. Also, arrays are showing up as
15165 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
15166 methods can not be invoked on them!
15168 * ecore.cs (ExplicitReferenceConversionExists): Made public.
15169 (ImplicitReferenceConversionExists): Split out from
15170 StandardConversionExists.
15172 * expression.cs (As): We were only implementing one of the three
15173 cases for the as operator. We now implement them all.
15174 (Is): Implement the various other cases for Is as well.
15176 * typemanager.cs (CACHE): New define used to control if we want or
15177 not the FindMembers cache. Seems to have a negative impact on
15178 performance currently
15180 (MemberLookup): Nested types have full acess to
15181 enclosing type members
15183 Remove code that coped with instance/static returns for events, we
15184 now catch this in RealFindMembers.
15186 (RealFindMembers): only perform static lookup if the instance
15187 lookup did not return a type or an event.
15189 2002-05-17 Miguel de Icaza <miguel@ximian.com>
15191 * assign.cs (CompoundAssign): We pass more semantic information
15192 now to Compound Assignments than we did before: now we have all
15193 the information at hand, and now we resolve the target *before* we
15194 do the expression expansion, which allows the "CacheValue" method
15195 to have the effect we intended (before, a [x] += 1 would generate
15196 two differen ArrayAccess expressions from the ElementAccess,
15197 during the resolution process).
15199 (CompoundAssign.DoResolve): Resolve target and original_source here.
15201 2002-05-16 Miguel de Icaza <miguel@ximian.com>
15203 * expression.cs (ArrayAccess): dropped debugging information.
15205 * typemanager.cs: Small bug fix: I was always returning i_members,
15206 instead of one of i_members or s_members (depending on which had
15209 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
15210 method is invoked before any code generation takes place, and it
15211 is a mechanism to inform that the expression will be invoked more
15212 than once, and that the method should use temporary values to
15213 avoid having side effects
15215 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
15217 * ecore.cs (Expression.CacheTemporaries): Provide empty default
15220 * expression.cs (Indirection, ArrayAccess): Add support for
15221 CacheTemporaries in these two bad boys.
15223 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
15224 ldobj or ldind_ref.
15225 (StoreFromPtr): Handle stobj as well.
15227 * expression.cs (UnaryMutator): Share more code.
15229 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
15230 down: I was not tracking the Filter function as well, which
15231 was affecting the results of the cache.
15233 2002-05-15 Miguel de Icaza <miguel@ximian.com>
15235 * attribute.cs: Remove the hack to handle the CharSet property on
15238 2002-05-14 Miguel de Icaza <miguel@ximian.com>
15240 * attribute.cs (DoResolve): More uglyness, we now only try to
15241 resolve the attribute partially, to extract the CharSet
15242 information (only if we are a StructLayout attribute). Otherwise
15244 (GetExtraTypeInfo): Add some code to conditionally kill in the
15245 future this. I am more and more convinced that the .NET
15246 framework has special code to handle the attribute setting on
15249 * expression.cs (IsParamsMethodApplicable): Revert my previous
15250 foreach change here, it was wrong.
15252 2002-05-13 Miguel de Icaza <miguel@ximian.com>
15254 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
15255 (pp_expr): do not abort on unknown input, just return.
15256 (eval): abort if there are pending chars.
15258 * attribute.cs (Attribute.Resolve): Positional parameters are
15259 optional. Deal with that case.
15261 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
15262 the Ansi/Unicode/Auto information for the type.
15264 (TypeContainer.DefineType): instantiate the EmitContext here, as
15265 we will be using it during the type definition (to resolve
15266 attributes) and during the emit phase.
15268 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
15269 to pull type information out of the attributes
15271 (Attribute.Resolve): track the constructor builder, and allow for
15272 multiple invocations (structs and classes will use this).
15274 * ecore.cs (MemberLookupFinal): new version with all the
15275 parameters customizable.
15277 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
15278 constructors. Return if the result value is null (as the error
15279 would have been flagged already by MemberLookupFinal)
15281 Do not allow instances of abstract classes or interfaces to be
15284 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
15285 We have to compare the assembly property here when dealing with
15286 FamANDAssem and Assembly access modifiers, because we might be
15287 creating an assembly from *modules* (that means that we are not
15288 getting TypeBuilders for types defined in other modules that are
15289 part of this assembly).
15291 (Method.Emit): If the method is marked abstract and has a body,
15294 (TypeContainer.DefineMembers): If both the defined member and the
15295 parent name match are methods, then do not emit any warnings: let
15296 the Method.Define routine take care of flagging warnings. But if
15297 there is a mismatch (method overrides something else, or method is
15298 overriwritten by something, then emit warning).
15300 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
15301 set to null, this means `do not check for the return type on the
15304 (Method.Define): set the return type for the method signature to
15305 null, so that we get methods with the same name and parameters and
15306 different return types. This is used to flag warning 114 (you are
15307 hiding a method, and you probably want to use the new/override
15310 * typemanager.cs (MemberLookup): Implemented proper access
15311 control, closing a long standing set of bug reports. The problem
15312 was that the Framework only has two bits: Public and NonPublic,
15313 and NonPublic includes private and protected methods, but we need
15314 to enforce the FamANDAssem, FamOrAssem and Family.
15316 2002-05-11 Miguel de Icaza <miguel@ximian.com>
15318 * statement.cs (GotoCase): Return true: Ammounts to giving up
15319 knowledge on whether we return or not, and letting the other case
15320 be responsible for it.
15322 2002-05-10 Miguel de Icaza <miguel@ximian.com>
15324 * driver.cs: Do not load directories for each file processed, only
15325 do it if there is a pattern.
15327 * ecore.cs: Report readonly assigns here as well, as we might have
15328 been resolved only by MemberAccess.
15330 (SimpleName.SimpleNameResolve): Also be useful for LValue
15331 resolution. We need this to propagate assign to local readonly variables
15333 * typemanager.cs: Use a ptrhashtable for the criteria, because we
15334 do not want to reuse potential criteria memory.
15336 * class.cs (MyEventBuilder): Set reflected_type;
15338 * ecore.cs (Constantify): Added support for constifying bools.
15340 (RootContext.LookupType): Added a cache for values looked up in
15341 the declaration space.
15343 * typemanager.cs (FindMembers): Now is a front-end to
15344 RealFindMembers, and provides a two-level hashtable-based cache to
15347 15% performance improvement: from 22.5 to 19.2 seconds.
15349 * expression.cs (IsParamsMethodApplicable): use foreach.
15350 (Invocation.DoResolve): ditto.
15351 (New.DoResolve): ditto.
15352 (ArrayCreation.DoResolve): ditto.
15354 * ecore.cs (FindMostEncompassingType): use foreach.
15356 * delegate.cs (NewDelegate.DoResolve): Use foreach
15358 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
15359 (RemoveMethods): use foreach.
15361 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
15362 nested foreach statements instead of for, and also break out of
15363 the inner loop once a match is found.
15365 (Invocation.OverloadResolve): Use foreach, simplify the code.
15367 2002-05-08 Miguel de Icaza <miguel@ximian.com>
15369 * cfold.cs (BinaryFold): During an enumeration evaluation context,
15370 we actually unwrap the expression to allow for extra information
15373 * expression.cs: Use Shr_Un on unsigned operations.
15375 2002-05-08 Ravi Pratap <ravi@ximian.com>
15377 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
15378 applicable operators was not being considered correctly. This closes
15379 the bug Miguel reported.
15381 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
15383 * attribute.cs: check that the type derives from System.Attribute
15384 and report the correct error in that case (moved the duplicate code to
15385 its own method, too).
15387 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
15389 * attribute.cs: lookup attribute type name as the spec says: first the
15390 bare attribute name and then name + "Attribute" (nant compiles with
15391 mcs after this fix).
15393 2002-05-07 Miguel de Icaza <miguel@ximian.com>
15395 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
15396 Because of the way we parse things, we should try to see if a
15397 UIntConstant can fit in an integer.
15399 2002-05-07 Ravi Pratap <ravi@ximian.com>
15401 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
15402 when we are in an explicit context.
15404 (ConvertReferenceExplicit): When converting from Iface type S to Class
15405 T make sure the rules are implemented as an OR.
15407 * parameter.cs (ParameterType): Make it a property for now although the
15408 purpose really isn't anything immediate.
15410 * expression.cs (Is*Applicable): Do better checking on the parameter type
15411 of a ref/out parameter. The ones from the system assemblies are already
15412 marked with the correct type so we don't need to do any correction.
15414 * ecore.cs (StandardConversionExists): Conversion from Interface types to
15415 the object type is standard too so include that.
15417 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15419 * ecore.cs (StandardConversionExists): Augment with missing code:
15420 deal with IntConstant, LongConstants and Enumerations.
15422 * assign.cs: Report the error, instead of failing silently
15424 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
15425 typecontainer that they are declared, because the
15426 typecontainer/namespace will have the list of using clauses that
15427 need to be applied.
15429 Assembly Attributes were escaping the normal registration
15432 (EmitCode): Apply attributes within an EmitContext that represents
15433 the container they were declared on.
15435 * cs-parser.jay: Track bases for structs. How did I get this wrong?
15437 2002-05-06 Ravi Pratap <ravi@ximian.com>
15439 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
15440 Revamp completely - make much cleaner as we now operate only
15443 (FindMostSpecificSource, FindMostSpecificTarget): New methods
15444 to implement the logic detailed in the spec more correctly.
15446 (UserDefinedConversion): Update accordingly.
15448 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15450 * statement.cs: Return flow analysis information up.
15452 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
15455 (token): Do not consume an extra character before calling
15458 2002-05-06 Piers Haken <piersh@friskit.com>
15460 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
15462 2002-05-06 Miguel de Icaza <miguel@ximian.com>
15464 * class.cs (Constructor.Emit): Set the IsStatic flag in the
15465 EmitContext during the instance constructor initializer
15466 resolution, to stop access to instance variables.
15468 This is mandated by the spec, last paragraph of the `constructor
15469 initializers' section.
15471 2002-05-05 Miguel de Icaza <miguel@ximian.com>
15473 * cs-parser.jay, class.cs (Accessor): new class used to represent
15474 an accessor (get or set). In the past we used `null' to represent
15475 a missing accessor. But this is ambiguous because there was no
15476 way to tell in abstract indexers/properties if one of them was
15479 Now there is a way of addressing that.
15481 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
15482 instead of FindMembers.
15484 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
15485 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
15487 * attribute.cs: Treat indexers and properties as the same in terms
15488 of applying attributes
15490 * ecore.cs (FindMostEncompassedType): Use statically initialized
15491 EmptyExpressions()s like we do elsewhere to avoid creating useless
15492 objects (and we take this out of the tight loop).
15494 (GetConversionOperators): Move the code to extract the actual
15495 operators to a separate routine to clean things up.
15497 2002-05-04 Miguel de Icaza <miguel@ximian.com>
15499 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
15500 events are always registered FieldBuilders.
15502 * class.cs (FieldBase): New class shared by Fields
15504 * delegate.cs: If we are a toplevel delegate, use our full name.
15505 If we are a nested delegate, then only use our tail name.
15507 2002-05-02 Ravi Pratap <ravi@ximian.com>
15509 * expression.cs (IsApplicable): Ensure that we add the "&" to
15510 ref/out types before comparing it with the type of the argument.
15512 (IsParamsMethodApplicable): Ditto.
15514 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
15517 * delegate.cs : Handle the case when we have more than one applicable
15518 method. Flag an error only when we finish checking all.
15520 2002-05-02 Miguel de Icaza <miguel@ximian.com>
15522 * expression.cs: Add support for boolean static initializers.
15524 2002-05-01 Miguel de Icaza <miguel@ximian.com>
15526 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
15528 * parameter.cs (ComputeParameterTypes,
15529 ComputeAndDefineParameterTypes): Better error handling: now we
15530 clear the `types' cache if we fail during any of the type lookups.
15531 We also return the status code correctly to our caller
15533 * delegate.cs: If we fail to define a delegate, abort the extra
15536 * expression.cs (Binary.ResolveOperator): for
15537 operator==(object,object) and operator !=(object, object) we also
15538 have to verify that there is an implicit conversion from one to
15541 (ArrayAccess.DoResolve): Array Access can operate on
15544 2002-04-30 Miguel de Icaza <miguel@ximian.com>
15546 * assign.cs (CompoundAssign): A new class used as a "flag" that
15547 the assignment actually is happening as part of a compound
15548 assignment operator.
15550 During compound assignment, a few new rules exist to enable things
15557 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
15558 to the type of x) if y is implicitly convertible to the type of x,
15559 and the operator is a builtin operator and the return type of the
15560 operator is explicitly convertible to the type of x.
15562 * rootcontext.cs: Reset warning level to 2. 4 catches various
15563 "interesting" features in mcs, we must clean this up at some
15564 point, but currently am trying to kill other bugs ;-)
15566 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
15567 in container classes as well.
15569 * expression.cs (Binary.ResolveOperator): Handle string case
15570 before anything else (as operator overloading does emit an error
15571 before doing anything else).
15573 This code could go away when we move to a table driven model, but
15574 i could not come up with a good plan last night.
15576 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
15578 * typemanager.cs (CSharpName): reimplementation using regex.
15579 * class.cs: added null check for fields in Emit
15580 * rootcontext.cs: set warninglevel to 4
15582 2002-04-29 Miguel de Icaza <miguel@ximian.com>
15584 * typemanager.cs (CSharpName): reimplemented with Lupus
15587 2002-04-28 Miguel de Icaza <miguel@ximian.com>
15589 * statement.cs (If): correclty implement Resolve, because we were
15590 not catching sem errors in there. The same process is needed
15592 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
15595 (Statement.Warning_DeadCodeFound): Factorize code.
15596 (While): Report dead code here too.
15598 (Statement): Added Resolve virtual method to allow
15599 for resolution split from the emit code.
15601 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15603 * statement.cs (EmitBoolExpression): No longer try to resolve the
15605 (MakeBoolean): New utility function that resolve, implicitly
15606 converts to boolean and tags the expression.
15609 (If, Do): Implement dead code elimination.
15610 (While): Implement loop inversion
15612 (Do, While, For, If): Resolve the expression prior to calling our
15615 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
15618 - added method Report28 (warning: program has more than one entry point)
15619 - added method IsEntryPoint, implements paragraph 10.1 of the spec
15620 - modified method Method.Define, the part at the end of the method
15622 * rootcontext.cs: added static public Location EntryPointLocation;
15624 * ../errors/cs0028.cs : Add test case for the above warning.
15627 - modified method CSharpName to allow arrays of primitive type to
15628 be printed nicely (e.g. instead of System.Int32[][] it now prints
15630 - added method CSharpSignature: returns the signature of a method
15631 in string format to be used in reporting errors, warnings, etc.
15633 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
15636 2002-04-26 Ravi Pratap <ravi@ximian.com>
15638 * delegate.cs (Define): Fix extremely silly bug where I was
15639 setting the type of the 'object' parameter of the BeginInvoke
15640 method to System.IAsyncResult instead of System.Object ;-)
15642 2002-04-26 Miguel de Icaza <miguel@ximian.com>
15644 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
15647 (Constructor.Emit): return if we fail to initialize the
15648 constructor. Another door closed!
15650 * expression.cs (New.DoResolve): Improve error message (from -6 to
15651 1501). Use DeclaredOnly lookup to find the exact constructor.
15653 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
15654 loop. This is useful.
15656 * cs-parser.jay: Adjust the default parameters so that destructors
15657 have the proper signature.
15659 2002-04-26 Martin Baulig <martin@gnome.org>
15661 * driver.cs (LoadAssembly): If `assembly' contains any characters
15662 which are only valid in path names and not in assembly names
15663 (currently slash, backslash and point), use Assembly.LoadFrom ()
15664 instead of Assembly.Load () on the `assembly' (before iteration
15665 over the link_paths).
15667 2002-04-26 Martin Baulig <martin@gnome.org>
15669 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
15671 2002-04-25 Miguel de Icaza <miguel@ximian.com>
15673 * class.cs (Property): use the new typemanager.MemberLookup
15675 (TypeContainer.MemberLookup): Implement using the
15676 TypeManager.MemberLookup now.
15678 * typemanager.cs: Make MemberLookup a function of the TypeManager,
15679 and return MemberInfos, so that these can be used without an
15680 EmitContext (what we had before).
15682 2002-04-24 Miguel de Icaza <miguel@ximian.com>
15684 * expression.cs: Fix the case where the argument to params if the
15685 type of the params. I omitted handling this before. Fixed
15687 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15689 * driver.cs: Call BootCorlib_PopulateCoreType
15691 * class.cs (Property.CheckBase): Check for properties only, not
15694 * interface.cs: Temporary hack: try/catch around the
15695 CustomAttributeBuilder, because I am getting an exception that I
15698 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
15699 types whose definitions are required to be there (attributes are
15700 defined before standard types).
15702 Compute definitions as we boot the various types, as they are used
15703 immediately (value_type class will need object_type, but if we do
15704 not initialize object_type, we will pass a null, which will let
15705 the runtime pick the System.Object from the existing corlib, which
15706 is not what we want).
15708 2002-04-22 Patrik Torstensson <totte@labs2.com>
15710 * cs-tokenizer.cs: fixed a number of trim() issues.
15712 2002-04-22 Ravi Pratap <ravi@ximian.com>
15714 * expression.cs (Argument.Type): Ensure that we return the correct
15715 type when we have out or ref parameters [in which case we
15718 2002-04-22 Miguel de Icaza <miguel@ximian.com>
15720 * class.cs (Property, Indexer): Allow extern modifier in there.
15722 * typemanager.cs (InitBaseTypes): Initializes object_type and
15723 value_type, since those will be used early on during the bootstrap
15724 process to compile corlib.
15726 (InitCoreTypes): Move code from here to InitBaseTypes.
15728 2002-04-21 Miguel de Icaza <miguel@ximian.com>
15730 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
15731 single-dimension arrays as using the ldlen opcode.
15733 Daniel Lewis discovered this optimization.
15735 * typemanager.cs: Add signature for System.Array::get_Length
15737 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15739 * statement.cs: report the error when the foreach does not apply to an
15740 array nor a collection.
15742 2002-04-19 Miguel de Icaza <miguel@ximian.com>
15744 * expression.cs: Add implicit conversions to the operator ~.
15746 * constant.cs (DecimalConstant.Emit): Emit decimal value.
15748 * typemanager.cs: Locate the decimal constructor.
15750 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15752 * attribute.cs: use the new property of TypeOf.
15753 * expression.cs: added 'get' property around typearg.
15755 These changes fix a build breaker reported by NickD. Is this the
15756 correct way to fix? If not, please, revert my changes and make it
15759 2002-04-17 Miguel de Icaza <miguel@ximian.com>
15761 * attribute.cs: Add support for typeof in attribute invocations.
15762 I am not sure that this is right though.
15764 2002-04-14 Duncan Mak <duncan@ximian.com>
15766 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
15767 Binary.Operator.Division case.
15769 2002-04-13 Ravi Pratap <ravi@ximian.com>
15771 * class.cs (DefineType): Ensure that we do a proper check on
15772 attribute types and also register it with the TypeManager.
15774 (TypeContainer.Targets): The default for attribute types is
15775 AttributeTargets.All.
15777 * attribute.cs (ApplyAttributes): Registering the attribute type
15778 is done elsewhere, not when we discover we have a Usage attribute.
15780 2002-04-12 Ravi Pratap <ravi@ximian.com>
15782 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
15783 and get rid of is_delegate parameter.
15785 * everywhere : update.
15787 2002-04-12 Ravi Pratap <ravi@ximian.com>
15789 * cs-parser.jay (compilation_unit): Revamp completely to use
15790 some new ideas that I got from Rhys' grammar to solve the problems
15791 with assembly level attributes.
15793 (outer_declaration): New grammar production.
15795 (attribute_sections): Add.
15797 (opt_attributes): Base on attribute_sections
15799 (namespace_declaration): Allow opt_attributes to tackle the case
15800 when we have assembly level attributes - we are clever in this
15803 * attribute.cs (ApplyAttributes): Do not worry about assembly
15804 attributes in the non-global context.
15806 * rootcontext.cs (AddGlobalAttributes): Go back to using this
15807 instead of SetGlobalAttributes.
15809 * class.cs, rootcontext.cs : Ensure we define and generate
15810 attribute types before anything else.
15812 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
15813 and flag the new error -20 for the case when the attribute type
15814 does not have valid targets specified. csc does not catch this.
15816 * ../errors/errors.txt : update for error # -20
15818 2002-04-11 Ravi Pratap <ravi@ximian.com>
15820 * support.cs (InternalParameters.ParameterModifier): Do some null
15821 checking and return sane values.
15823 * class.cs (Method.Define): If we are a PInvoke method, ensure
15824 that we are static and extern. Report error # 601
15826 * ../errors/cs0601.cs : Add test case for the above error.
15828 2002-04-07 Ravi Pratap <ravi@ximian.com>
15830 * rootcontext.cs (attribute_types): We need to keep type of
15831 all attribute types separately and emit code for them first.
15833 (RegisterAttribute) : Implement.
15835 * class.cs (DefineType): Check if the current Type is a custom
15836 attribute type and register it accordingly.
15838 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
15839 adding the first attribute twice and rename to
15841 (SetGlobalAttributes): this.
15843 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
15846 * attribute.cs (ApplyAttributes): Take an additional argument telling us
15847 if we are processing global arguments. Hmm, I am unsure of this.
15849 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
15851 * expression.cs: added static array of strings to avoid calling
15852 Enum.ToString () for Operator in Binary. Significant recover of
15855 2002-04-10 Miguel de Icaza <miguel@ximian.com>
15857 * class.cs (FindMembers): Allow the Builders of the various
15858 members to be null. If they are skip them. This only happens
15859 during the PInvoke declaration.
15861 2002-04-09 Miguel de Icaza <miguel@ximian.com>
15863 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
15864 failure, so we do not keep going afterwards.
15866 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
15867 wanted to pass `false' as the `is_delegate' argument. If this is
15868 the case, why not use delegate_type == null to mean `is_delegate =
15869 false' and anything else as is_delegate = true.
15871 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
15873 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
15874 code for the section, not the beginning of the tests.
15876 2002-04-08 Miguel de Icaza <miguel@ximian.com>
15878 * cfold.cs: Handle operator + (Enum x, Underlying x)
15880 * expression.cs (Binary): same. Warn about errors where we have
15881 Enum/Enum in operator + as well.
15883 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
15886 - added support for switch(bool)
15887 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
15888 - add TableSwitchEmit() to handle table-based switch statements
15890 2002-04-05 Ravi Pratap <ravi@ximian.com>
15892 * expression.cs (Invocation.OverloadResolve): Factor out code which
15893 does parameter compatibility checking with arguments so that we can
15894 re-use the code even from Delegate.VerifyApplicability
15896 (VerifyArgumentsCompat): Move above code here.
15898 * delegate.cs (VerifyApplicability): Get rid of duplicate code
15899 and instead make a call to the above method.
15901 2002-03-31 Ravi Pratap <ravi@ximian.com>
15903 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
15904 We use it to keep track of classes which are attribute types.
15906 2002-04-02 Miguel de Icaza <miguel@ximian.com>
15908 * delegate.cs (Delegate.Define): Correctly define the types in the
15909 presence of fixed and array parameters.
15911 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
15914 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
15915 include NonPublic after the first iteration.
15917 * class.cs (Indexer.CheckBase): Only check if both parents are
15920 * cs-parser.jay (accessor_body): If empty, set to null.
15922 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
15923 same code path here to resolve constants names that we did have in
15924 MemberAccess.DoResolve. There is too much code duplicated here.
15926 2002-04-01 Miguel de Icaza <miguel@ximian.com>
15928 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
15930 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
15933 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
15934 tokens, numbers and strings.
15936 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
15939 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
15940 asyncronous parameters and the regular parameters.
15942 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
15943 specify the target directory.
15945 * expression.cs: (This.DoResolve): Simplify
15946 (As.Emit): Optimize, do not generate IsInst if the expression is
15947 always of the given type.
15949 (Is.DoResolve): Bug fix, we were reporting both always/never for
15952 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
15953 creating too many unnecessary arrays.
15955 2002-03-31 Miguel de Icaza <miguel@ximian.com>
15957 * class.cs (EmitFieldInitializer): Use Assign expression to assign
15958 fields instead of rolling our own initializer. Takes care of all
15959 implicit conversions, and drops unnecessary static checks/argument.
15961 2002-03-31 Dick Porter <dick@ximian.com>
15963 * driver.cs: use the GetDirectories() return values properly, and
15964 use "/" as path separator.
15966 2002-03-30 Miguel de Icaza <miguel@ximian.com>
15968 * expression.cs (Unary): Optimize - - expr into expr.
15969 (Binary): Optimize a + (-b) into a -b.
15971 * codegen.cs (CodeGen): Made all methods static.
15973 2002-03-29 Miguel de Icaza <miguel@ximian.com>
15977 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
15978 TypeBuilder property.
15980 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
15983 * tree.cs: Removed the various RecordXXXX, and replaced with a
15984 single RecordDecl. Removed all the accessor methods, and just
15985 left a single access point Type
15987 * enum.cs: Rename DefineEnum to DefineType.
15989 * decl.cs: New abstract method `DefineType' used to unify the
15990 Defines for Enumerations, Interfaces, TypeContainers and
15993 (FindType): Moved LookupInterfaceOrClass here. Moved the
15994 LookupBaseClasses method that used to live in class.cs and
15995 interface.cs here, and renamed to FindType.
15997 * delegate.cs: Implement DefineType. Take advantage of the
15998 refactored pattern for locating the parent builder without taking
15999 the parent_builder argument (which we know does not work if we are
16000 nested, and triggering a toplevel definition).
16002 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16004 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
16005 accessibility of a member has changed during override and report
16008 * class.cs (Method.Define, Property.Define): Only complain on
16009 overrides if the method is private, any other accessibility is
16010 fine (and since we just checked the permission is the same, we are
16013 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
16014 and elif are processed always. The other pre-processing
16015 directives are only processed if we are "taking" the path
16017 2002-03-29 Martin Baulig <martin@gnome.org>
16019 * class.cs (Method.Emit): Only emit symbolic debugging info if the
16020 current location is not Null.
16022 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
16023 a separate method so we can profile it.
16025 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
16026 `span.Seconds' are just seconds, but no minutes or hours.
16027 (MainDriver): Profile the CodeGen.SaveSymbols calls.
16029 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16031 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
16032 Remove the gratuitous set of Final:
16034 // If an interface implementation, then we can set Final.
16035 if (((flags & MethodAttributes.Abstract) == 0) &&
16036 implementing.DeclaringType.IsInterface)
16037 flags |= MethodAttributes.Final;
16039 I do not know what I was smoking when I used that.
16042 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
16043 step into fixing the name resolution issues for delegates and
16044 unifying the toplevel name resolution.
16046 2002-03-28 Martin Baulig <martin@gnome.org>
16048 * class.cs (Method.Emit): If we have a symbol writer, call its
16049 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
16050 tell it about the current method.
16052 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
16053 writer that we're going to emit the first byte of IL code for a new
16054 statement (a new source line).
16055 (EmitContext.EmitTopBlock): If we have a symbol writer, call
16056 EmitContext.Mark() before emitting any code.
16058 * location.cs (SymbolDocument): Return null when we're Null.
16060 * statement.cs (Statement): Moved the `Location loc' variable here.
16061 (Statement.EmitBoolExpression): If we have a symbol writer, call
16062 ec.Mark() before emitting any code to tell it that we're at the
16063 beginning of a new statement.
16064 (StatementExpression): Added `Location' argument to the constructor.
16065 (Block): Added public readonly variable `StartLocation' and public
16066 variable `EndLocation'. The latter is to be set using SetEndLocation().
16067 (Block): Added constructor which takes a start and end location.
16068 (Block.SetEndLocation): New method. This sets the end location.
16069 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
16070 local variables we create.
16071 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
16072 each statement and do also mark the begin and end of the block.
16074 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
16075 tell it the current lexer.Location, use Location.Null for the end of the
16077 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
16078 current block, set its end location using SetEndLocation().
16079 (statement_expression): StatementExpression constructor now takes the
16080 lexer.Location as additional argument.
16081 (for_statement, declare_local_variables): Likewise.
16082 (declare_local_variables): When creating a new implicit block, use the
16083 new Block constructor and pass it the lexer.Location.
16085 2002-03-28 Miguel de Icaza <miguel@ximian.com>
16087 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
16088 members also on the parent interfaces recursively.
16090 2002-03-27 Miguel de Icaza <miguel@ximian.com>
16092 * report.cs: Use new formats, since Gonzalo finished the missing
16095 * expression.cs (Binary.ResolveOperator): added missing operator|
16096 operator& and operator^ for bool/bool.
16098 * cs-parser.jay: CheckDef now takes a Location argument that is
16099 used to report errors more precisly (instead of reporting the end
16100 of a definition, we try to track something which is a lot closer
16101 to the source of the problem).
16103 * cs-tokenizer.cs: Track global token use, so we can properly flag
16104 the use of #define/#undef after the first token has been seen.
16106 Also, rename the reportXXXX to Error_DescriptiveName
16108 * decl.cs (DeclSpace.IsTopLevel): Move property here from
16109 TypeContainer, so that Enum and Interface can use this too.
16111 * class.cs (TypeContainer.LookupInterfaceOrClass,
16112 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
16113 `builder' argument. Typically this was used to pass the parent
16114 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
16117 The problem is that a nested class could trigger the definition of
16118 a toplevel class, and the builder would be obviously wrong in that
16121 So we drop this argument, and we compute dynamically the
16122 TypeBuilder/ModuleBuilder (the correct information was available
16123 to us anyways from DeclSpace.Parent)
16125 * interface.cs (Interface.DefineInterface): Drop builder
16126 parameter cleanup like class.cs
16128 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
16131 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
16134 (Try.Emit): Propagate the returns value from the statement.
16136 (Return.Emit): Even if we are leavning
16138 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
16140 * modifiers.cs: Fix the computation of MethodAttributes flags.
16142 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
16144 * driver.cs: allow compilation of files that start with '/'.
16145 Add a default case when checking the argument of --target.
16147 2002-03-25 Miguel de Icaza <miguel@ximian.com>
16149 * interface.cs: Implement the same search algorithm for types in
16150 the interface code.
16152 * delegate.cs: Do not allow multiple definition.
16154 * Recovered ChangeLog that got accidentally amputated
16156 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
16158 * rootcontext.cs: Load manually enum to allow core classes to
16159 contain enumerations.
16161 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
16162 Update to new static methods in TypeManager.
16164 * typemanager.cs (GetMethod, GetConstructor): Use our
16165 implementation of FindMembers to find the members, since during
16166 corlib compilation, the types are TypeBuilders and GetMethod and
16167 GetConstructor do not work.
16169 Make all methods in TypeManager static.
16171 (InitCodeHelpers): Split the functionality from
16172 the InitCodeTypes function.
16174 * driver.cs: Call InitCodeHelpers after we have populated the
16177 * cs-parser.jay (delegate_declaration): we did not used to compute
16178 the delegate name correctly for void delegates.
16180 2002-03-24 Miguel de Icaza <miguel@ximian.com>
16182 * rootcontext.cs (RootContext): Init the interface_resolve_order
16183 and type_container_resolve_order always.
16185 (ResolveCore, BootstrapCorlib_ResolveClass,
16186 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
16187 compiler when compiling with --nostdlib
16189 * class.cs (TypeContainer.DefineType): Check that our parent is
16190 not null. This test is most important when we are bootstraping
16193 * codegen.cs: Split out the symbol writing code.
16195 2002-03-25 Martin Baulig <martin@gnome.org>
16197 * driver.cs (-g): Made -g an alias for --debug.
16199 2002-03-24 Martin Baulig <martin@gnome.org>
16201 * codegen.cs (SymbolWriter): New public variable. Returns the
16202 current symbol writer.
16203 (CodeGen): Added `bool want_debugging_support' argument to the
16204 constructor. If true, tell the ModuleBuild that we want debugging
16205 support and ask it for the ISymbolWriter.
16206 (Save): If we have a symbol writer, call it's Close() method after
16207 saving the assembly.
16209 * driver.c (--debug): New command line argument to create a
16210 debugger information file.
16212 * location.cs (SymbolDocument): New public property. Returns an
16213 ISymbolDocumentWriter object for the current source file or null
16214 if we don't have a symbol writer.
16216 2002-03-21 Miguel de Icaza <miguel@ximian.com>
16218 * driver.cs (LoadAssembly): Correctly return when all the paths
16219 have been tried and not before.
16221 * statement.cs (Switch.Emit): return the actual coverage for this
16222 statement (returns/not-returns)
16224 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
16225 switch of the statement if we are the last switch section. That
16226 kills two problems: try/catch problems (we used to emit an empty
16227 nop at the end) and switch statements where all branches would
16230 2002-03-19 Miguel de Icaza <miguel@ximian.com>
16232 * driver.cs: Add default assemblies (the equivalent to the
16233 Microsoft CSC.RSP file)
16235 * cs-tokenizer.cs: When updating `cols and setting it to zero,
16236 also update tokens_seen and set it to false.
16238 * driver.cs: Implement --recurse for Mike.
16240 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
16241 correctly splitting out the paths.
16243 2002-03-18 Miguel de Icaza <miguel@ximian.com>
16245 * interface.cs (Interface.PopulateProperty): Instead of using
16246 `parent' as the declaration space for the set parameters, use
16249 * support.cs (InternalParameters): InternalParameters constructor
16250 takes a DeclSpace instead of a TypeContainer.
16252 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
16253 types are being initialized, load the address of it before calling
16256 (New): Provide a mechanism to disable the generation of local
16257 value type temporaries when the caller will be providing us with
16258 an address to store it.
16260 (ArrayCreation.EmitDynamicInitializers): Use it.
16262 2002-03-17 Miguel de Icaza <miguel@ximian.com>
16264 * expression.cs (Invocation.EmitArguments): Only probe for array
16265 property if there is more than one argument. Sorry about that.
16267 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
16268 empty param arrays.
16270 * class.cs (Method.LabelParameters): Fix incorrect code path that
16271 prevented the `ParamArrayAttribute' from being applied to the
16274 2002-03-16 Miguel de Icaza <miguel@ximian.com>
16276 * support.cs (ReflectionParameters): Correctly compute whether the
16277 last argument is a params array. Fixes the problem with
16280 * typemanager.cs: Make the assemblies array always be non-null
16281 (empty, but non-null)
16283 * tree.cs (RecordDecl): New function that abstracts the recording
16284 of names. This reports error 101, and provides a pointer to the
16285 previous declaration. Fixes a crash in the compiler.
16287 * cs-parser.jay (constructor_declaration): Update to new grammar,
16288 and provide a constructor_body that can be empty.
16290 2002-03-15 Miguel de Icaza <miguel@ximian.com>
16292 * driver.cs: Add support for --resources.
16294 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
16295 Make all types for the various array helper methods be integer.
16297 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
16298 CheckState to ConvCast.
16300 (ConvCast): Now it takes a `checked' state argument, to avoid
16301 depending on the emit context for the conversion, and just using
16302 the resolve time setting.
16304 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
16305 instead of Invocation.EmitArguments. We do not emit the original
16306 arguments, instead we emit those which have been converted to
16307 unsigned int expressions.
16309 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
16311 * codegen.cs: ditto.
16313 * expression.cs (LocalVariableReference): Drop the use of the
16314 Store function that depended on the variable index.
16316 * statement.cs (VariableInfo): Drop the `Idx' property from this
16317 class, as this is not taking into account the indexes for
16318 temporaries tat we generate during the execution, getting the
16321 * class.cs: First emit class initializers, then call the parent
16324 * expression.cs (Binary): Fix opcode emision.
16325 (UnaryMutator.EmitCode): Support checked code generation
16327 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
16328 matches for events for both the Static and Instance scans,
16329 pointing to the same element. Fix that.
16331 2002-03-14 Miguel de Icaza <miguel@ximian.com>
16333 * rootcontext.cs (ResolveTree): Always set the
16334 interface_resolve_order, because nested interfaces will be calling
16337 * class.cs (GetInterfaceOrClass): Track the same resolution
16338 process used by TypeManager.LookupType. This fixes the nested
16339 type lookups in class declarations (separate path from
16342 (TypeContainer.DefineType): Also define nested interfaces.
16343 (TypeContainer.RegisterOrder): New public function used to
16344 register the order in which child interfaces need to be closed.
16346 Nested interfaces need to be closed after their parents have been
16349 * interface.cs (InterfaceAttr): Put all the logic for computing
16350 the interface attribute here.
16352 (DefineInterface): Register our interface order with the
16353 RootContext or with the TypeContainer depending on the case.
16355 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16357 * cs-parser.jay: rework foreach statement to work with the new
16358 changes to the policy on SimpleNames.
16360 * report.cs: support Stacktrace on warnings as well.
16362 * makefile: drop --unsafe and /unsafe from the compile.
16364 2002-03-13 Ravi Pratap <ravi@ximian.com>
16366 * ecore.cs (StandardConversionExists): Modify to take an Expression
16367 as the first parameter. Ensure we do null -> reference type conversion
16370 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
16371 temporary Expression objects.
16373 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
16375 * interface.cs: workaround bug in method overloading resolution
16376 (there is already a bugzilla bug for it).
16378 2002-03-12 Miguel de Icaza <miguel@ximian.com>
16380 We could also solve this problem by having a separate path for
16381 performing type lookups, instead of DoResolve, we could have a
16382 ResolveType entry point, and only participating pieces of the
16383 production (simplename, deref, array) would implement this.
16385 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
16386 signal SimpleName to only resolve type names and not attempt to
16387 resolve anything else.
16389 * expression.cs (Cast): Set the flag.
16391 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
16393 * class.cs: Only report 108 if there is no `new' modifier.
16395 * cs-parser.jay: rework foreach statement to work with the new
16396 changes to the policy on SimpleNames.
16398 * report.cs: support Stacktrace on warnings as well.
16400 * makefile: drop --unsafe and /unsafe from the compile.
16402 2002-03-11 Miguel de Icaza <miguel@ximian.com>
16404 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16405 lookups here, instead of doing that at parse time. This means
16406 that our grammar will not introduce `LocalVariableReferences' as
16407 expressions at this point. That solves the problem of code like
16411 static void Main ()
16415 This is only half the fix. The full fix requires parameters to
16416 also be handled in this way.
16418 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
16419 makes the use more obvious of the DeclSpace. The
16420 ec.TypeContainer.TypeBuilder is now only used to pull the
16421 TypeBuilder for it.
16423 My theory is that I can get rid of the TypeBuilder completely from
16424 the EmitContext, and have typecasts where it is used (from
16425 DeclSpace to where it matters).
16427 The only pending problem is that the code that implements Aliases
16428 is on TypeContainer, and probably should go in DeclSpace.
16430 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
16431 lookups here, instead of doing that at parse time. This means
16432 that our grammar will not introduce `LocalVariableReferences' as
16433 expressions at this point. That solves the problem of code like
16437 static void Main ()
16441 This is only half the fix. The full fix requires parameters to
16442 also be handled in this way.
16444 * class.cs (Property.DefineMethod): When implementing an interface
16445 method, set newslot, when implementing an abstract method, do not
16446 set the flag (before we tried never setting it, or always setting
16447 it, which is the difference).
16448 (Indexer.DefineMethod): same.
16449 (Method.DefineMethod): same.
16451 * ecore.cs: Only set the status used flag if we get back a Field.
16453 * attribute.cs: Temporary hack, so Paolo can keep working.
16455 2002-03-08 Ravi Pratap <ravi@ximian.com>
16457 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
16458 the unmanaged type in the case we have a MarshalAs attribute.
16460 (Resolve): Handle the case when we are parsing the special MarshalAs
16461 attribute [we need to store the unmanaged type to use later]
16463 * typemanager.cs (marshal_as_attr_type): Built in type for the
16464 MarshalAs Attribute.
16466 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
16467 on parameters and accordingly set the marshalling info.
16469 2002-03-09 Miguel de Icaza <miguel@ximian.com>
16471 * class.cs: Optimizing slightly by removing redundant code after
16472 we switched to the `NoTypes' return value.
16473 (Property.DefineMethod): use NoTypes here too.
16475 This fixes the bug I introduced in my last batch of changes.
16477 2002-03-05 Ravi Pratap <ravi@ximian.com>
16479 * tree.cs (RecordEnum): Add. We now keep track of enums too.
16481 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
16482 Enums since those are types too.
16484 * cs-parser.jay (enum_declaration): Record enums as we parse them.
16486 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
16487 thanks to a call during the lookup process.
16489 2002-03-07 Miguel de Icaza <miguel@ximian.com>
16491 * statement.cs (Foreach): Lots of work to accomodate a particular
16492 kind of foreach statement that I had not kept in mind. It is
16493 possible to have foreachs on classes that provide a GetEnumerator
16494 method that return objects that implement the "pattern" for using
16495 a foreach, there is no need to support GetEnumerator
16498 This is needed to compile nant.
16500 * decl.cs: Only report 114 if the member is not `Finalize' and if
16501 the warning level is at least 2.
16503 * class.cs: Moved the compare function from Method to
16506 (MethodSignature.InheritableMemberSignatureCompare): Add new
16507 filter function that is used to extract inheritable methods from a
16510 (Method.Define): Use the new `inheritable_method_signature_filter'
16513 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
16516 2002-03-06 Miguel de Icaza <miguel@ximian.com>
16518 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
16520 * cs-parser.jay: Add opt_semicolon to the interface declaration.
16522 * expression.cs: Pass location information to
16523 ConvertImplicitStandard.
16525 * class.cs: Added debugging code to track return values from
16528 2002-03-05 Miguel de Icaza <miguel@ximian.com>
16530 * expression.cs (Is.DoResolve): If either side of the `is' is an
16531 interface, do not flag the warning.
16533 * ecore.cs (ImplicitReferenceConversion): We need a separate test
16536 * report.cs: Allow for --fatal to be used with --probe.
16538 * typemanager.cs (NoTypes): Move the definition for the empty Type
16541 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
16543 (TypeContainer.DefineProxy): New function used to proxy to parent
16544 implementations when implementing interfaces.
16545 (TypeContainer.ParentImplements): used to lookup if our parent
16546 implements a public function that is required by an interface.
16547 (TypeContainer.VerifyPendingMethods): Hook this up.
16549 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
16550 `modules' and `assemblies' arraylists into arrays. We only grow
16551 these are the very early start up of the program, so this improves
16552 the speedof LookupType (nicely measured).
16554 * expression.cs (MakeByteBlob): Replaced unsafe code with
16555 BitConverter, as suggested by Paolo.
16557 * cfold.cs (ConstantFold.Binary): Special case: perform constant
16558 folding of string concatenation, but if either side is a string,
16559 and the other is not, then return null, and let the runtime use
16560 the concatenation on the string plus the object (using
16561 `Object.ToString').
16563 2002-03-04 Miguel de Icaza <miguel@ximian.com>
16565 Constant Folding has been implemented now.
16567 * expression.cs (Unary.Reduce): Do not throw an exception, catch
16568 the error instead on types that are not supported in one's
16571 * constant.cs (Constant and all children): New set of functions to
16572 perform implict and explicit conversions.
16574 * ecore.cs (EnumConstant): Implement the new functions to perform
16575 conversion by proxying to the child expression.
16577 * codegen.cs: (ConstantCheckState): Constant evaluation has its
16578 own separate setting that can not be turned off from the command
16579 line using --unchecked or --checked and is only controlled using
16580 the checked/unchecked statements and expressions. This setting is
16581 used by the constant folder to flag errors.
16583 * expression.cs (CheckedExpr, UncheckedExpr): Set the
16584 ConstantCheckState as well.
16586 During Resolve, they also have to flag the state, because the
16587 constant folder runs completely in the Resolve phase.
16589 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
16592 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16594 * cfold.cs: New file, this file contains the constant folder.
16596 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
16597 argument to track whether we are using the resulting address to
16598 load or store a value and provide better error messages.
16600 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
16601 new AddressOf arguments.
16603 * statement.cs (Foreach.EmitCollectionForeach): Update
16605 * expression.cs (Argument.Emit): Call AddressOf with proper
16606 arguments to track usage.
16608 (New.DoEmit): Call AddressOf with new arguments.
16610 (Unary.Emit): Adjust AddressOf call.
16612 2002-03-01 Ravi Pratap <ravi@ximian.com>
16614 * cs-parser.jay (member_access): Change the case for pre-defined types
16615 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
16618 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
16621 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
16622 essentially like methods and apply attributes like MethodImplOptions to them too.
16624 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
16627 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
16628 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
16631 * Update code everywhere accordingly.
16633 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
16635 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
16637 2002-02-28 Ravi Pratap <ravi@ximian.com>
16639 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
16640 try performing lookups against those instead of jumping straight into using
16641 the 'using' clauses.
16643 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
16645 (LookupType): Perform lookups in implicit parents too.
16647 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
16648 sequence as RootContext.LookupType.
16650 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
16651 the various cases of namespace lookups into this method.
16653 2002-03-01 Miguel de Icaza <miguel@ximian.com>
16655 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
16656 in positional arguments)
16658 * class.cs (Operator): Update the AllowedModifiers to contain
16661 * cs-parser.jay: Update operator declaration to allow for the
16662 operator body to be empty.
16664 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
16667 2002-02-27 Miguel de Icaza <miguel@ximian.com>
16669 * class.cs (Method.Emit): Label parameters.
16671 * driver.cs: Return 1 or 0 as the program exit code.
16673 2002-02-26 Miguel de Icaza <miguel@ximian.com>
16675 * expression.cs: Special case the `null' object when trying to
16676 auto-compute the type, as anything can be explicitly converted to
16679 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
16680 spotting this Paolo.
16682 (Expression.ImplicitNumericConversion): Perform comparissions of
16683 the type using the underlying type in the case of an enumeration
16684 rather than using the enumeration type for the compare.
16686 Cope with the underlying == type case, which is not possible to
16689 (Expression.ConvertNumericExplicit): Perform comparissions of
16690 the type using the underlying type in the case of an enumeration
16691 rather than using the enumeration type for the compare.
16693 * driver.cs: If the user does not supply an extension, assume .exe
16695 * cs-parser.jay (if_statement): Rewrote so that we can track the
16696 location for the if statement.
16698 * expression.cs (Binary.ConstantFold): Only concat strings when
16699 the operation is "+", not everything ;-)
16701 * statement.cs (Statement.EmitBoolExpression): Take a location
16703 (If, While, Do): Track location.
16705 * expression.cs (Binary.ResolveOperator): In the object + string
16706 case, I was missing a call to ConvertImplicit
16708 2002-02-25 Ravi Pratap <ravi@ximian.com>
16710 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
16711 Location arguments. Ensure we use RootContext.LookupType to do our work
16712 and not try to do a direct Type.GetType and ModuleBuilder.GetType
16714 * interface.cs (PopulateMethod): Handle the type of the parameter being
16717 * expression.cs (Invocation.BetterFunction): Handle the case when we
16718 have a params method with no fixed arguments and a call is made with no
16721 2002-02-25 Miguel de Icaza <miguel@ximian.com>
16723 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
16724 the verbatim-string-literal
16726 * support.cs (InternalParameters.ParameterModifier): handle null
16728 (InternalParameters.ParameterType): ditto.
16730 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
16731 duplicating the name of the variable parameter.
16732 (GetParameterByName): Fix bug where we were not looking up array
16733 paramters if they were the only present (thanks Paolo!).
16734 (GetParameterInfo): We only have an empty set of types if both
16735 fixed and array are set to null.
16736 (GetParameterInfo-idx): Handle FixedParameter == null
16738 * cs-parser.jay: Handle the case where there is no catch
16739 statements (missing null test).
16741 2002-02-22 Miguel de Icaza <miguel@ximian.com>
16743 * driver.cs (MainDriver): Be conservative on our command line
16746 Catch DirectoryNotFoundException when calling GetFiles.
16748 (SplitPathAndPattern): Used to split the input specification into
16749 a path and a pattern that we can feed to Directory.GetFiles.
16751 2002-02-21 Miguel de Icaza <miguel@ximian.com>
16753 * statement.cs (Fixed): Implement the last case of the Fixed
16754 statement (string handling).
16756 * expression.cs (StringPtr): New class used to return a char * to
16757 a string; Used by the Fixed statement.
16759 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
16761 * expression.cs (Binary.ResolveOperator): Remove redundant
16762 MemberLookup pn parent type.
16763 Optimize union call, we do not need a union if the types are the same.
16764 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
16767 Specialize the use of MemberLookup everywhere, instead of using
16768 the default settings.
16770 (StackAlloc): Implement stackalloc keyword.
16772 * cs-parser.jay: Add rule to parse stackalloc.
16774 * driver.cs: Handle /h, /help, /?
16776 * expression.cs (MakeByteBlob): Removed the hacks we had in place
16777 before we supported unsafe code.
16779 * makefile: add --unsafe to the self compilation of mcs.
16781 2002-02-20 Miguel de Icaza <miguel@ximian.com>
16783 * expression.cs (PointerArithmetic): New class that is used to
16784 perform pointer arithmetic.
16785 (Binary.Resolve): Handle pointer arithmetic
16786 Handle pointer comparission.
16787 (ArrayPtr): Utility expression class that is used to take the
16788 address of an array.
16790 (ElementAccess): Implement array access for pointers
16792 * statement.cs (Fixed): Implement fixed statement for arrays, we
16793 are missing one more case before we are done.
16795 * expression.cs (Indirection): Implement EmitAssign and set the
16796 ExprClass to Variable. This allows pointer dereferences to be
16797 treated as variables, and to have values assigned to them.
16799 * ecore.cs (Expression.StoreFromPtr): New utility function to
16800 store values dereferencing.
16802 2002-02-20 Ravi Pratap <ravi@ximian.com>
16804 * expression.cs (Binary.ResolveOperator): Ensure that we are
16805 not trying to operate on a void type - this fixes the reported
16808 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
16809 the parent implementation is sealed.
16811 * ../errors/cs0239.cs : Add.
16813 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
16815 * typemanager.cs (unverifiable_code_type): Corresponds to
16816 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
16817 which have unsafe code in them.
16819 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
16822 2002-02-19 Miguel de Icaza <miguel@ximian.com>
16824 * cs-tokenizer.cs: Add support for @"litreal strings"
16826 Make tokenizer accept pre-processor directives
16827 on any column (remove the old C-like limitation).
16829 * rootcontext.cs (EmitCode): Emit any global attributes.
16830 (AddGlobalAttributes): Used to keep track of assembly attributes.
16832 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
16834 * cs-parser.jay: Add support for global attributes.
16836 2002-02-17 Miguel de Icaza <miguel@ximian.com>
16838 * expression.cs (Indirection): New helper class. Unary will
16839 create Indirection classes to be able to implement the
16840 IMemoryLocation interface on it.
16842 2002-02-16 Miguel de Icaza <miguel@ximian.com>
16844 * cs-parser.jay (fixed_statement): reference the right statement.
16846 * statement.cs (Fixed.Emit): Finish implementing the fixed
16847 statement for the &x case.
16849 2002-02-14 Miguel de Icaza <miguel@ximian.com>
16851 * class.cs (Property.Define, Method.Define): Remove newslot when
16854 * modifiers.cs: My use of NewSlot when `Abstract' was set was
16855 wrong. NewSlot should only be used if the `new' keyword is present.
16857 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
16858 locating our system dir. Sorry about this.
16860 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16862 * driver.cs (GetSystemDir): Compute correctly the location of our
16863 system assemblies. I was using the compiler directory instead of
16864 the library directory.
16866 2002-02-13 Ravi Pratap <ravi@ximian.com>
16868 * expression.cs (BetterFunction): Put back in what Miguel commented out
16869 since it is the correct fix. The problem is elsewhere ;-)
16871 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
16872 parameters of the parms method are themselves compatible or not !
16874 (StandardConversionExists): Fix very dangerous bug where we were forgetting
16875 to check that a class implements an interface before saying that an implicit
16876 conversion was allowed. Use ImplementsInterface to do the checking.
16878 2002-02-13 Miguel de Icaza <miguel@ximian.com>
16880 * class.cs (Method.Define): Track whether we are an explicit
16881 implementation or not. And only call DefineMethodOverride if we
16882 are an explicit implementation.
16884 (Property.DefineMethod): Ditto.
16886 2002-02-11 Ravi Pratap <ravi@ximian.com>
16888 * expression.cs (BetterFunction): Catch hideous bug which was
16889 preventing us from detecting ambiguous calls due to implicit casts i.e
16892 2002-01-29 Miguel de Icaza <miguel@ximian.com>
16894 * support.cs (Pair): Remove un-needed method. I figured why I was
16895 getting the error in cs-parser.jay, the variable in a foreach loop
16896 is readonly, and the compiler does not really treat this as a variable.
16898 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
16899 instead of EQUALS in grammar.
16901 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
16903 * expression.cs (Unary.DoResolve): Check whether the argument is
16906 2002-01-28 Miguel de Icaza <miguel@ximian.com>
16908 * support.cs: Api for Pair to set a value. Despite the fact that
16909 the variables are public the MS C# compiler refuses to compile
16910 code that accesses the field if the variable is part of a foreach
16913 * statement.cs (Fixed): Begin implementation of the fixed
16916 (Block.AddVariable): Return the VariableInfo on success and null
16917 on failure instead of true/false.
16919 * cs-parser.jay (foreach): Catch errors on variables already
16920 defined (we were ignoring this value before) and properly unwind
16921 the block hierarchy
16923 (fixed_statement): grammar for the fixed statement.
16925 2002-01-25 Miguel de Icaza <miguel@ximian.com>
16927 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
16928 pointer types to be incretemented.
16930 (SizeOf): Implement.
16932 * cs-parser.jay (pointer_member_access): Implement
16933 expr->IDENTIFIER production.
16935 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
16936 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
16939 (Unary): Implement indirection.
16941 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
16942 use in non-unsafe context).
16944 (SimpleName.DoResolve): Check for pointers in field access on safe
16947 (Expression.LoadFromPtr): Factor the load-indirect code in this
16948 function. This was duplicated in UnboxCast and ParameterReference
16950 2002-01-24 Miguel de Icaza <miguel@ximian.com>
16952 * expression.cs (ComposedCast): report an error if a pointer cast
16953 is used in a safe region.
16955 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
16956 pointer type casts in unsafe context.
16958 * codegen.cs (EmitContext): Set up IsUnsafe.
16960 * cs-parser.jay (non_expression_type): Add productions for pointer
16963 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
16964 code. We should not use force into static mode if the method is
16965 not virtual. Fixes bug in MIS
16967 * statement.cs (Do.Emit, While.Emit, For.Emit,
16968 Statement.EmitBoolExpression): Add support to Do and While to
16969 propagate infinite loop as `I do return' semantics.
16971 Improve the For case to also test for boolean constants.
16973 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
16974 to the list of attributes we can add.
16976 Remove `EmitContext' argument.
16978 * class.cs (Method.Define): Apply parameter attributes.
16979 (Constructor.Define): Apply parameter attributes.
16980 (MethodCore.LabelParameters): Move here the core of labeling
16983 * support.cs (ReflectionParameters.ParameterModifier,
16984 InternalParameters.ParameterModifier): Use IsByRef on the type and
16985 only return the OUT bit for these parameters instead of in/out/ref
16988 This is because I miss-understood things. The ParameterInfo.IsIn
16989 and IsOut represent whether the parameter has the [In] and [Out]
16992 2002-01-22 Miguel de Icaza <miguel@ximian.com>
16994 * ecore.cs (FieldExpr.Emit): Release temporaries.
16996 * assign.cs (LocalTemporary.Release): new function.
16998 * codegen.cs (EmitContext.GetTemporaryStorage,
16999 EmitContext.FreeTemporaryStorage): Rework the way we deal with
17000 temporary storage. Now we can "put back" localbuilders when we
17003 2002-01-21 Miguel de Icaza <miguel@ximian.com>
17005 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
17006 need to make a copy of the variable to generate verifiable code.
17008 2002-01-19 Miguel de Icaza <miguel@ximian.com>
17010 * driver.cs: Compute dynamically the system directory.
17012 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
17013 Slower, but more generally useful. Used by the abstract
17014 registering implementation.
17016 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
17017 the rules for the special rule on Type/instances. First check if
17018 we have the same name, and if so, try that special static path
17019 rather than the instance path.
17021 2002-01-18 Miguel de Icaza <miguel@ximian.com>
17023 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
17026 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
17027 Enum, ValueType, Delegate or Array for non-corlib compiles.
17029 * cs-tokenizer.cs: Catch long identifiers (645)
17031 * typemanager.cs (IndexerPropetyName): Ravi never tested this
17034 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
17035 fix, we were returning too early, so we were not registering
17036 pending methods from abstract classes.
17038 Do not register pending methods if the class is abstract.
17040 * expression.cs (Conditional.DoResolve): Report circular implicit
17041 conversions when we neecd to compute it for conditional
17044 (Is.DoResolve): If the expression is always of the provided type,
17045 flag warning 183. If the expression can not ever be of the
17046 provided type flag warning 184.
17048 * class.cs: Catch 169 as well.
17050 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
17053 2002-01-18 Nick Drochak <ndrochak@gol.com>
17055 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
17057 2002-01-17 Miguel de Icaza <miguel@ximian.com>
17059 * interface.cs: (PopulateMethod): Check for pointers being defined
17060 only if the unsafe context is active.
17061 (PopulateProperty): ditto.
17062 (PopulateIndexer): ditto.
17064 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
17065 specified. If pointers are present, make sure that they are
17066 present in an unsafe context.
17067 (Constructor, Constructor.Define): ditto.
17068 (Field, Field.Define): ditto.
17069 (Property, Property.Define): ditto.
17070 (Event, Event.Define): ditto.
17072 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
17073 hashtable if there are classes or structs defined.
17075 * expression.cs (LocalVariableReference.DoResolve): Simplify this
17076 code, as the constant resolution moved.
17078 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
17079 the metadata, so we can flag error 133.
17081 * decl.cs (MemberCore.UnsafeOK): New function to test that a
17082 pointer is being declared in an unsafe context.
17084 2002-01-16 Miguel de Icaza <miguel@ximian.com>
17086 * modifiers.cs (Modifiers.Check): Require a Location argument.
17087 Report error 227 for Unsafe use.
17089 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
17091 * statement.cs (For.Emit): If the test is null, then report that
17092 we do `return', as we wont reach anything afterwards.
17094 (Switch.SwitchGoverningType): Track the expression that matched
17097 * driver.cs: Allow negative numbers as an error code to flag.
17099 * cs-parser.jay: Handle 1551.
17101 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
17103 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17105 * cs-parser.jay: Report 1518 (type declaration can only contain
17106 class, struct, interface, enum or delegate)
17108 (switch_label): Report 1523 (keywords `case' or `default' must
17111 (opt_switch_sections): Report 1522 (empty switch)
17113 * driver.cs: Report 1515 (response file specified multiple times)
17114 Report 1516 (Source file specified multiple times).
17116 * expression.cs (Argument.Resolve): Signal 1510
17118 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
17119 access not allowed in static code)
17121 2002-01-11 Ravi Pratap <ravi@ximian.com>
17123 * typemanager.cs (IsPointerType): Utility method which we are going
17126 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
17127 the object type, so we take care of that.
17129 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
17131 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
17132 added to non-params parameters :-)
17134 * typemanager.cs (CSharpName): Include 'void' type too.
17136 (void_ptr_type): Include in the set of core types.
17138 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
17141 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
17144 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
17145 completely forgotten about it.
17147 2002-01-10 Ravi Pratap <ravi@ximian.com>
17149 * cs-parser.jay (pointer_type): Add. This begins our implementation
17150 of parsing rules for unsafe code.
17152 (unsafe_statement): Implement.
17154 (embedded_statement): Modify to include the above.
17156 * statement.cs (Unsafe): Implement new class for unsafe blocks.
17158 * codegen.cs (EmitContext.InUnsafe): Add. This determines
17159 if the current context is an unsafe one.
17161 * cs-parser.jay (local_variable_pointer_type): Since local variable types
17162 are handled differently, we need separate rules for them.
17164 (local_variable_declaration): Update to use local_variable_pointer_type
17165 to allow variable declarations of unmanaged pointer types.
17167 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
17168 in unsafe contexts.
17170 * ../errors/cs0214.cs : Add.
17172 2002-01-16 Nick Drochak <ndrochak@gol.com>
17174 * makefile: remove 'response' file when cleaning.
17176 2002-01-15 Miguel de Icaza <miguel@ximian.com>
17178 * cs-parser.jay: Report 1524.
17180 2002-01-14 Miguel de Icaza <miguel@ximian.com>
17182 * typemanager.cs (RegisterMethod): drop checking if we have
17183 registered this from here
17185 2002-01-12 Miguel de Icaza <miguel@ximian.com>
17187 * class.cs (Method.EmitDestructor): Implement calling our base
17190 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
17191 value of InFinally.
17193 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
17194 this routine and will wrap the call in a try/catch block. Deal
17197 2002-01-11 Miguel de Icaza <miguel@ximian.com>
17199 * ecore.cs (Expression.MemberLookup): instead of taking a
17200 parameter `same_type' that was used to tell whether we could
17201 access private members we compute our containing type from the
17204 (FieldExpr): Added partial support for volatile fields. This does
17205 not work for volatile fields exposed from assemblies, as I can not
17206 figure out how to extract the modreq from it.
17208 Updated all the source files to use this.
17210 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
17211 because it is referenced by MemberLookup very often.
17213 2002-01-09 Ravi Pratap <ravi@ximian.com>
17215 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
17216 TypeBuilder.GetCustomAttributes to retrieve what we need.
17218 Get rid of redundant default_member_attr_type as this is the same as
17219 default_member_type which already exists.
17221 * interface.cs, attribute.cs : Update accordingly.
17223 2002-01-08 Miguel de Icaza <miguel@ximian.com>
17225 * typemanager.cs: Enable IndexerPropertyName again. It does not
17226 work for TYpeBuilders though. Ravi, can you please fix this?
17228 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
17230 * expression.cs (Argument.Emit): Handle the case of ref objects
17231 being passed to ref functions;
17233 (ParameterReference.EmitLoad): Loads the content of the pointer
17234 without dereferencing.
17236 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17238 * cs-tokenizer.cs: Implemented the pre-processing expressions.
17240 2002-01-08 Ravi Pratap <ravi@ximian.com>
17242 * class.cs (Indexer.DefineMethod): Incorporate the interface
17243 type in the name of the method if we are doing explicit interface
17246 * expression.cs (ConversionExists): Remove as it is completely obsolete.
17248 (BetterConversion): Fix extremely trivial bug where we were referring to
17249 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
17252 * ../errors/bug16.cs : Add although we have fixed it.
17254 2002-01-07 Miguel de Icaza <miguel@ximian.com>
17256 * expression.cs (BaseIndexer): Begin implementation.
17258 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
17260 * cs-parser.jay (indexer_declarator): Use qualified_identifier
17261 production directly to remove a shift/reduce, and implement
17262 explicit interface implementation.
17264 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
17265 after a floating point suffix.
17267 * expression.cs (DoNumericPromotions): Improved the conversion for
17268 uint/uint. If we have a constant, we avoid doing a typecast to a
17271 * class.cs (Indexer): Implement explicit interface implementation
17274 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
17276 * class.cs: make the default instance constructor public and hidebysig.
17278 2001-01-03 Ravi Pratap <ravi@ximian.com>
17280 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
17281 so we can call it from elsewhere.
17283 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
17284 we emit it internally if the class has a defined indexer; otherwise the user
17285 emits it by decorating the class definition with the DefaultMemberAttribute.
17287 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
17288 attribute is not used on a type which defines an indexer.
17290 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
17291 character when we skip whitespace.
17293 * ../errors/cs0646.cs : Add.
17295 2002-01-03 Miguel de Icaza <miguel@ximian.com>
17297 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
17300 * makefile: Add practical target `mcs3.exe' which builds the third
17301 generation compiler.
17303 * expression.cs (New): Fix structures constructor calling.
17305 * class.cs (Property, Method, Indexer): Emit Final flag on the
17306 method if we are an interface implementation and we are not
17309 * ecore.cs (PropertyExpr): New public field `IsBase', tells
17310 whether this property is referencing a `base' method.
17312 * expression.cs (Invocation.EmitCall): take an extra argument:
17313 is_base, this is used to determine whether the `call' or
17314 `callvirt' opcode should be used.
17317 * delegate.cs: update EmitCall.
17319 * class.cs (Method.Define): Set NewSlot for the cases where we are
17320 not implementing an interface method.
17322 (Property.Define): ditto.
17324 2002-01-02 Miguel de Icaza <miguel@ximian.com>
17326 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
17327 'r'. Allows mcs to parse itself fully.
17329 2002-01-02 Ravi Pratap <ravi@ximian.com>
17331 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
17332 of the number of initializers that require the InitializeArray method.
17334 (CheckIndices): Store the Expression in all cases - not the plain value. Also
17335 update the above field where necessary.
17337 (MakeByteBlob): Update accordingly.
17339 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
17342 (EmitDynamicInitializers): Update in accordance with the new optimization.
17344 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
17345 same OpCode applies.
17347 * cs-parser.jay : Fix some glaring errors I introduced.
17349 2002-01-01 Ravi Pratap <ravi@ximian.com>
17351 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
17352 so that we can check for name clashes there too.
17354 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
17355 for interface indexers.
17357 * interfaces.cs (Define): Emit the default member attribute.
17359 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
17360 variable was being referred to while setting the value ;-)
17362 2002-01-01 Miguel de Icaza <miguel@ximian.com>
17364 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
17365 byte-by-byte information when we know the data is zero.
17367 Make the block always a multiple of 4, because
17368 DefineInitializedData has a bug.
17370 * assign.cs: Fix, we should assign from the temporary, not from
17373 * expression.cs (MakeByteBlob): Fix my incorrect code.
17375 2001-12-31 Miguel de Icaza <miguel@ximian.com>
17377 * typemanager.cs (EnumToUnderlying): This function is used to get
17378 the underlying type from an enumeration, because it does not
17381 * constant.cs: Use the I4_S form for values between -128 and 127.
17383 * statement.cs (Block.LookupLabel): Looks up a label.
17384 (Block): Drop support for labeled blocks.
17386 (LabeledStatement): New kind of statement that represents a label
17389 (Goto): Finally implement this bad boy.
17391 * cs-parser.jay: Update to reflect new mechanism to implement
17394 2001-12-30 Miguel de Icaza <miguel@ximian.com>
17396 * codegen.cs (EmitContext.This): a codegen property that keeps the
17397 a single instance of this instead of creating many different this
17400 * delegate.cs (Delegate.DoResolve): Update to use the property;
17402 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
17404 * expression.cs (BaseAccess.DoResolve): Ditto.
17406 2001-12-29 Ravi Pratap <ravi@ximian.com>
17408 * typemanager.cs (methodimpl_attr_type): Add to hold the type
17409 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
17411 (InitCoreTypes): Update accordingly.
17413 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
17414 so we can quickly store the state.
17416 (ApplyAttributes): Set the correct implementation flags
17417 for InternalCall methods.
17419 2001-12-29 Miguel de Icaza <miguel@ximian.com>
17421 * expression.cs (EmitCall): if a method is not virtual, then do
17422 not use callvirt on it.
17424 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
17425 user defined stuff) requires the use of stobj, which takes an
17426 address on the stack instead of an array and an index. So emit
17427 the Ldelema operation for it.
17429 (EmitStoreOpcode): Use stobj for valuetypes.
17431 (UnaryMutator.EmitCode): Use the right 1 value depending on
17432 whether we are dealing with int64/uint64, float or doubles.
17434 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
17435 constructors that I implemented last night.
17437 (Constructor.IsDefault): Fix to work properly for static
17440 * cs-parser.jay (CheckDef): report method signature errors.
17441 Update error number 103 to be 132.
17443 * decl.cs: New AdditionResult enumeration value: MethodExists.
17444 Although we do this check for methods later on in the semantic
17445 analysis, catching repeated default constructors is so easy that
17446 we catch these here.
17448 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
17451 (ParameterReference.EmitAssign, Emit): handle
17454 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
17455 (ArrayAccess.EmitStoreOpcode): ditto.
17457 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
17459 * expression.cs (MakeByteBlob): Complete all the missing types
17460 (uint, short, ushort, byte, sbyte)
17462 * class.cs: Only init instance field initializers on instance
17465 Rename `constructors' to instance_constructors.
17467 (TypeContainer.AddConstructor): Only add constructors to the list
17468 if it is not static.
17470 Make sure that we handle default_static_constructor independently
17471 everywhere where we handle instance_constructors
17473 2001-12-28 Miguel de Icaza <miguel@ximian.com>
17475 * class.cs: Do not lookup or create a base initializer for a
17476 static constructor.
17478 (ConstructorInitializer.Resolve): use the proper type to lookup
17481 * cs-parser.jay: Report error 1585 (modifiers between type and name).
17483 * enum.cs, interface.cs: Remove CloseType, this is taken care by
17486 * decl.cs: CloseType is now an virtual method, the default
17487 implementation just closes this type.
17489 2001-12-28 Ravi Pratap <ravi@ximian.com>
17491 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
17492 to PreserveSig by default. Also emit HideBySig on such methods.
17494 Basically, set the defaults to standard values.
17496 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
17497 argument, if candidate is better, it can't be worse than the best !
17499 (Invocation): Re-write bits to differentiate between methods being
17500 applicable in their expanded form and their normal form - for params
17503 Get rid of use_standard everywhere as only standard conversions are allowed
17504 in overload resolution.
17506 More spec conformance.
17508 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17510 * driver.cs: Add --timestamp, to see where the compiler spends
17513 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
17514 `this' in static code.
17516 (SimpleName.DoResolve): Implement in terms of a helper function
17517 that allows static-references to be passed upstream to
17520 (Expression.ResolveWithSimpleName): Resolve specially simple
17521 names when called by MemberAccess to implement the special
17524 (Expression.ImplicitReferenceConversion): Handle conversions from
17525 Null to reference types before others, as Null's type is
17528 * expression.cs (Invocation.EmitCall): Handle the special case of
17529 calling methods declared on a reference type from a ValueType
17530 (Base classes System.Object and System.Enum)
17532 (MemberAccess.Resolve): Only perform lookups on Enumerations if
17533 the left hand side is a TypeExpr, not on every enumeration.
17535 (Binary.Resolve): If types are reference types, then do a cast to
17536 object on operators != and == of both arguments.
17538 * typemanager.cs (FindMembers): Extract instance and static
17539 members if requested.
17541 * interface.cs (PopulateProperty): Use void_type instead of null
17542 as the return type for the setter method.
17544 (PopulateIndexer): ditto.
17546 2001-12-27 Ravi Pratap <ravi@ximian.com>
17548 * support.cs (ReflectionParameters): Fix minor bug where we
17549 were examining the wrong parameter for the ParamArray attribute.
17551 Cope with requests for the type of the parameter at position
17552 greater than the params parameter's. We now return the element
17553 type of the params array as that makes more sense.
17555 * expression.cs (Invocation.IsParamsMethodApplicable): Update
17556 accordingly as we no longer have to extract the element type
17559 (Invocation.OverloadResolve): Update.
17561 2001-12-27 Miguel de Icaza <miguel@ximian.com>
17563 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
17564 against IEnumerator, test whether the return value is a descendant
17565 of the IEnumerator interface.
17567 * class.cs (Indexer.Define): Use an auxiliary method to implement
17568 the other bits of the method definition. Begin support for
17569 explicit interface implementation.
17571 (Property.DefineMethod): Use TypeManager.void_type instead of null
17572 for an empty return value.
17574 2001-12-26 Miguel de Icaza <miguel@ximian.com>
17576 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
17577 dealing with a FieldExpr which is composed of a FieldBuilder, in
17578 the code path we did extract the constant, but we should have
17579 obtained the underlying value to be able to cast it (otherwise we
17580 end up in an infinite loop, this is what Ravi was running into).
17582 (ArrayCreation.UpdateIndices): Arrays might be empty.
17584 (MemberAccess.ResolveMemberAccess): Add support for section
17585 14.5.4.1 that deals with the special case of E.I when E is a type
17586 and something else, that I can be a reference to a static member.
17588 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
17589 handle a particular array type to create byte blobs, it is just
17590 something we dont generate byteblobs for.
17592 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
17595 * location.cs (Push): remove the key from the hashtable that we
17596 are about to add. This happens for empty files.
17598 * driver.cs: Dispose files after we have parsed them.
17600 (tokenize): new function that only runs the tokenizer on its
17601 input, for speed testing.
17603 2001-12-26 Ravi Pratap <ravi@ximian.com>
17605 * class.cs (Event.Define): Define the private field only if there
17606 are no accessors defined.
17608 * expression.cs (ResolveMemberAccess): If there is no associated
17609 field with the event, that means we have an event defined with its
17610 own accessors and we should flag error cs0070 since transforming
17611 ourselves into a field is not valid in that case.
17613 * ecore.cs (SimpleName.DoResolve): Same as above.
17615 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
17616 and charset to sane values.
17618 2001-12-25 Ravi Pratap <ravi@ximian.com>
17620 * assign.cs (DoResolve): Perform check on events only if they
17621 are being accessed outside the declaring type.
17623 * cs-parser.jay (event_declarations): Update rules to correctly
17624 set the type of the implicit parameter etc.
17626 (add_accessor, remove_accessor): Set current local parameters.
17628 * expression.cs (Binary): For delegate addition and subtraction,
17629 cast the return value from the method into the appropriate delegate
17632 2001-12-24 Ravi Pratap <ravi@ximian.com>
17634 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
17635 of these as the workaround is unnecessary.
17637 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
17638 delegate data - none of that is needed at all.
17640 Re-write bits to extract the instance expression and the delegate method
17643 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
17646 * attribute.cs (ApplyAttributes): New method to take care of common tasks
17647 of attaching attributes instead of duplicating code everywhere.
17649 * everywhere : Update code to do attribute emission using the above method.
17651 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17653 * expression.cs (IsParamsMethodApplicable): if there are not
17654 parameters, return immediately.
17656 * ecore.cs: The 0 literal can be implicity converted to an enum
17659 (SimpleName.DoResolve): First lookup the type, then lookup the
17662 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
17663 want to get its address. If the InstanceExpression is not
17664 addressable, store the result in a temporary variable, then get
17667 * codegen.cs: Only display 219 errors on warning level or above.
17669 * expression.cs (ArrayAccess): Make it implement the
17670 IMemoryLocation interface.
17672 (Binary.DoResolve): handle the operator == (object a, object b)
17673 and operator != (object a, object b) without incurring into a
17674 BoxedCast (because 5 != o should never be performed).
17676 Handle binary enumerator operators.
17678 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
17679 value type, otherwise use Ldelem_ref.
17681 Use precomputed names;
17683 (AddressOf): Implement address of
17685 * cs-parser.jay (labeled_statement): Fix recursive block
17686 addition by reworking the production.
17688 * expression.cs (New.DoEmit): New has a special case:
17690 If we are dealing with a ValueType, we have a few
17691 situations to deal with:
17693 * The target of New is a ValueType variable, that is
17694 easy, we just pass this as the variable reference
17696 * The target of New is being passed as an argument,
17697 to a boxing operation or a function that takes a
17700 In this case, we need to create a temporary variable
17701 that is the argument of New.
17704 2001-12-23 Ravi Pratap <ravi@ximian.com>
17706 * rootcontext.cs (LookupType): Check that current_type is not null before
17707 going about looking at nested types.
17709 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
17710 not implement the IAssignMethod interface any more.
17712 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
17713 where we tranform them into FieldExprs if they are being resolved from within
17714 the declaring type.
17716 * ecore.cs (SimpleName.DoResolve): Do the same here.
17718 * assign.cs (DoResolve, Emit): Clean up code considerably.
17720 * ../errors/bug10.cs : Add.
17722 * ../errors/cs0070.cs : Add.
17724 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
17726 * assign.cs : Get rid of EventIsLocal everywhere.
17728 2001-12-23 Miguel de Icaza <miguel@ximian.com>
17730 * ecore.cs (ConvertIntLiteral): finished the implementation.
17732 * statement.cs (SwitchLabel): Convert the value we are using as a
17733 key before looking up the table.
17735 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17737 * codegen.cs (EmitTopBlock): Require a Location argument now.
17739 * cs-parser.jay (constructor_declarator): We need to setup
17740 current_local_parameters before we parse the
17741 opt_constructor_initializer, to allow the variables to be bound
17742 to the constructor arguments.
17744 * rootcontext.cs (LookupType): First lookup nested classes in our
17745 class and our parents before we go looking outside our class.
17747 * expression.cs (ConstantFold): Extract/debox the values at the
17750 * rootcontext.cs (EmitCode): Resolve the constants first before we
17751 resolve the types. This is not really needed, but it helps debugging.
17753 * statement.cs: report location.
17755 * cs-parser.jay: pass location to throw statement.
17757 * driver.cs: Small bug fix.
17759 * report.cs: Updated format to be 4-zero filled digits.
17761 2001-12-22 Ravi Pratap <ravi@ximian.com>
17763 * expression.cs (CheckIndices): Fix minor bug where the wrong
17764 variable was being referred to ;-)
17766 (DoEmit): Do not call EmitStaticInitializers when the
17767 underlying type is System.Object.
17769 2001-12-21 Ravi Pratap <ravi@ximian.com>
17771 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
17772 and do the usual workaround for SRE.
17774 * class.cs (MyEventBuilder.EventType): New member to get at the type
17775 of the event, quickly.
17777 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
17779 * assign.cs (Assign.DoResolve): Handle the case when the target
17780 is an EventExpr and perform the necessary checks.
17782 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
17785 (SimpleName.MemberStaticCheck): Include check for EventExpr.
17787 (EventExpr): Set the type in the constructor itself since we
17788 are meant to be born fully resolved.
17790 (EventExpr.Define): Revert code I wrote earlier.
17792 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
17793 instance expression is null. The instance expression is a This in that case
17794 or a null, depending on whether it is a static method or not.
17796 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
17797 refers to more than one method.
17799 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
17800 and accordingly flag errors.
17802 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17804 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
17806 2001-12-22 Miguel de Icaza <miguel@ximian.com>
17808 * location.cs (ToString): Provide useful rutine.
17810 2001-12-21 Miguel de Icaza <miguel@ximian.com>
17812 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
17813 objects, return the actual integral boxed.
17815 * statement.cs (SwitchLabel): define an ILLabel for each
17818 (Switch.CheckSwitch): If the value is a Literal, extract
17819 the underlying literal.
17821 Also in the unused hashtable we had, add the SwitchLabel so we can
17822 quickly look this value up.
17824 * constant.cs: Implement a bunch of new constants. Rewrite
17825 Literal based on this. Made changes everywhere to adapt to this.
17827 * expression.cs (Expression.MakeByteBlob): Optimize routine by
17828 dereferencing array only once, and also copes with enumrations.
17830 bytes are two bytes wide, not one.
17832 (Cast): Perform constant conversions.
17834 * ecore.cs (TryImplicitIntConversion): Return literals instead of
17835 wrappers to the literals here.
17837 * expression.cs (DoNumericPromotions): long literals can converted
17838 to ulong implicity (this is taken care of elsewhere, but I was
17839 missing this spot).
17841 * ecore.cs (Expression.Literalize): Make the return type Literal,
17842 to improve type checking.
17844 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
17846 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17848 * literal.cs: Revert code from ravi that checked the bounds. The
17849 bounds are sane by the definition of the type itself.
17851 * typemanager.cs: Fix implementation of ImplementsInterface. We
17852 need to actually look up in our parent hierarchy for interfaces
17855 * const.cs: Use the underlying type for enumerations
17857 * delegate.cs: Compute the basename for the delegate creation,
17858 that should fix the delegate test case, and restore the correct
17859 Type Lookup semantics in rootcontext
17861 * rootcontext.cs: Revert Ravi's last patch. The correct way of
17862 referencing a nested type with the Reflection API is using the "+"
17865 * cs-parser.jay: Do not require EOF token at the end.
17867 2001-12-20 Ravi Pratap <ravi@ximian.com>
17869 * rootcontext.cs (LookupType): Concatenate type names with
17870 a '.' instead of a '+' The test suite passes again.
17872 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
17873 field of the enumeration.
17875 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
17876 the case when the member is an EventExpr.
17878 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
17879 static has an associated instance expression.
17881 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
17883 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
17885 * class.cs (Event.Define): Register event and perform appropriate checks
17888 We define the Add and Remove methods even if the use provides none because
17889 in that case, we provide default implementations ourselves.
17891 Define a private field of the type of the event. This is done by the CSC compiler
17892 and we should be doing it too ;-)
17894 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
17895 More methods we use in code we generate.
17897 (multicast_delegate_type, delegate_type): Two separate types since the distinction
17900 (InitCoreTypes): Update accordingly for the above.
17902 * class.cs (Event.Emit): Generate code for default accessors that we provide
17904 (EmitDefaultMethod): Do the job in the above.
17906 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
17909 2001-12-20 Miguel de Icaza <miguel@ximian.com>
17911 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
17912 builders even if we were missing one.
17914 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
17915 pass the Basename as our class name instead of the Name. The
17916 basename will be correctly composed for us.
17918 * parameter.cs (Paramters): Now takes a Location argument.
17920 * decl.cs (DeclSpace.LookupType): Removed convenience function and
17921 make all the code call directly LookupType in RootContext and take
17922 this chance to pass the Location information everywhere.
17924 * Everywhere: pass Location information.
17926 2001-12-19 Miguel de Icaza <miguel@ximian.com>
17928 * class.cs (Constructor.Define): Updated way of detecting the
17929 length of the parameters.
17931 (TypeContainer.DefineType): Use basename as the type name for
17934 (TypeContainer.Define): Do not recursively define types here, as
17935 definition is taken care in order by the RootContext.
17937 * tree.cs: Keep track of namespaces in a per-file basis.
17939 * parameter.cs (Parameter.ComputeSignature): Update to use
17942 (Parameters.GetSignature): ditto.
17944 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
17945 instead of a TypeContainer.
17947 (Interface.SemanticAnalysis): Use `this' instead of our parent to
17948 resolve names. Because we need to be resolve in our context, not
17951 * driver.cs: Implement response files.
17953 * class.cs (TypeContainer.DefineType): If we are defined, do not
17954 redefine ourselves.
17956 (Event.Emit): Emit the code for add/remove handlers.
17957 (Event.Define): Save the MethodBuilders for add/remove.
17959 * typemanager.cs: Use pair here too.
17961 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
17962 DictionaryEntry requires the first argument to be non-null.
17964 (enum_declaration): Compute full name for registering the
17967 (delegate_declaration): Instead of using
17968 formal_parameter_list, use opt_formal_parameter_list as the list
17971 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
17972 (EventParsing): New property that controls whether `add' and
17973 `remove' are returned as tokens or identifiers (for events);
17975 2001-12-19 Ravi Pratap <ravi@ximian.com>
17977 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
17978 use MyEventBuilder only and let it wrap the real builder for us.
17980 (MyEventBuilder): Revamp constructor etc.
17982 Implement all operations that we perform on EventBuilder in precisely the same
17985 (FindMembers): Update to use the EventBuilder member.
17987 (Event.Emit): Update accordingly.
17989 2001-12-18 Ravi Pratap <ravi@ximian.com>
17991 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
17992 by calling the appropriate methods.
17994 (GetCustomAttributes): Make stubs as they cannot possibly do anything
17997 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
17999 2001-12-17 Ravi Pratap <ravi@ximian.com>
18001 * delegate.cs (Delegate.Populate): Check that the return type
18002 and various parameters types are indeed accessible.
18004 * class.cs (Constructor.Define): Same here.
18006 (Field.Define): Ditto.
18008 (Event.Define): Ditto.
18010 (Operator.Define): Check that the underlying Method defined itself
18011 correctly - so it's MethodBuilder should not be null.
18013 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
18014 expression happens to be null.
18016 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
18017 members but as of now we don't seem to be able to do anything really useful with it.
18019 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
18020 not the EventBuilder.
18022 2001-12-18 Miguel de Icaza <miguel@ximian.com>
18024 * cs-tokenizer.cs: Add support for defines.
18025 Add support for #if, #elif, #else, #endif
18027 (eval_var): evaluates a variable.
18028 (eval): stubbed for evaluating functions.
18030 * cs-parser.jay: Pass the defines information
18032 * driver.cs: Add --define command line option.
18034 * decl.cs: Move MemberCore here.
18036 Make it the base class for DeclSpace. This allows us to catch and
18037 report 108 and 109 for everything now.
18039 * class.cs (TypeContainer.Define): Extract all the members
18040 before populating and emit the warning 108 (new keyword required
18041 to override) instead of having each member implement this.
18043 (MemberCore.Define): New abstract method, we will be using this in
18044 the warning reporting engine in Populate.
18046 (Operator.Define): Adjust to new MemberCore protocol.
18048 * const.cs (Const): This does not derive from Expression, it is a
18049 temporary object we use to create fields, it is a MemberCore.
18051 * class.cs (Method.Define): Allow the entry point to be in a
18054 * driver.cs: Rewrite the argument handler to clean it up a bit.
18056 * rootcontext.cs: Made it just an auxiliary namespace feature by
18057 making everything static.
18059 * driver.cs: Adapt code to use RootContext type name instead of
18062 * delegate.cs: Remove RootContext argument.
18064 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
18067 * class.cs (Event.Define): The lookup can fail.
18069 * cs-tokenizer.cs: Begin implementation of pre-procesor.
18071 * expression.cs: Resolve the this instance before invoking the code.
18073 2001-12-17 Miguel de Icaza <miguel@ximian.com>
18075 * cs-parser.jay: Add a production in element_access that allows
18076 the thing to become a "type" reference. This way we can parse
18077 things like "(string [])" as a type.
18079 Note that this still does not handle the more complex rules of
18083 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
18085 * ecore.cs: (CopyNewMethods): new utility function used to
18086 assemble the list of methods from running FindMembers.
18088 (MemberLookup): Rework FindMembers so that
18090 2001-12-16 Miguel de Icaza <miguel@ximian.com>
18092 * class.cs (TypeContainer): Remove Delegates who fail to be
18095 * delegate.cs (Populate): Verify that we dont get null return
18096 values. TODO: Check for AsAccessible.
18098 * cs-parser.jay: Use basename to emit error 574 (destructor should
18099 have the same name as container class), not the full name.
18101 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
18102 possible representation.
18104 Also implements integer type suffixes U and L.
18106 2001-12-15 Miguel de Icaza <miguel@ximian.com>
18108 * expression.cs (ArrayCreation.DoResolve): We need to do the
18109 argument resolution *always*.
18111 * decl.cs: Make this hold the namespace. Hold the root context as
18113 (LookupType): Move here.
18115 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
18117 * location.cs (Row, Name): Fixed the code, it was always returning
18118 references to the first file.
18120 * interface.cs: Register properties defined through interfaces.
18122 * driver.cs: Add support for globbing on the command line
18124 * class.cs (Field): Make it derive from MemberCore as well.
18127 2001-12-15 Ravi Pratap <ravi@ximian.com>
18129 * class.cs (Event::Define): Check that the type of the event is a delegate
18130 type else flag error #66.
18132 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
18135 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
18136 values of EntryPoint, CharSet etc etc.
18138 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
18140 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
18141 be null and we should ignore this. I am not sure if this is really clean. Apparently,
18142 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
18143 which needs this to do its work.
18145 * ../errors/cs0066.cs : Add.
18147 2001-12-14 Miguel de Icaza <miguel@ximian.com>
18149 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
18152 * class.cs: (MethodSignature.MethodSignature): Removed hack that
18153 clears out the parameters field.
18154 (MemberSignatureCompare): Cleanup
18156 (MemberCore): New base class used to share code between MethodCore
18159 (RegisterRequiredImplementations) BindingFlags.Public requires
18160 either BindingFlags.Instace or Static. Use instance here.
18162 (Property): Refactored code to cope better with the full spec.
18164 * parameter.cs (GetParameterInfo): Return an empty array instead
18167 * class.cs (Property): Abstract or extern properties have no bodies.
18169 * parameter.cs (GetParameterInfo): return a zero-sized array.
18171 * class.cs (TypeContainer.MethodModifiersValid): Move all the
18172 method modifier validation to the typecontainer so we can reuse
18173 this on properties.
18175 (MethodCore.ParameterTypes): return an empty sized array of types.
18177 (Property.Define): Test property modifier validity.
18179 Add tests for sealed/override too.
18181 (Method.Emit): abstract or extern methods have no bodies.
18183 2001-12-14 Ravi Pratap <ravi@ximian.com>
18185 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
18188 (Method::Define, ::Emit): Modify accordingly.
18190 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
18192 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
18194 * makefile: Pass in /unsafe.
18196 2001-12-13 Miguel de Icaza <miguel@ximian.com>
18198 * class.cs (MakeKey): Kill routine.
18200 * class.cs (TypeContainer.Define): Correctly define explicit
18201 method implementations (they require the full interface name plus
18204 * typemanager.cs: Deply the PtrHashtable here and stop using the
18205 lame keys. Things work so much better.
18207 This of course broke everyone who depended on `RegisterMethod' to
18208 do the `test for existance' test. This has to be done elsewhere.
18210 * support.cs (PtrHashtable): A hashtable that avoid comparing with
18211 the object stupid Equals method (because, that like fails all over
18212 the place). We still do not use it.
18214 * class.cs (TypeContainer.SetRequiredInterface,
18215 TypeContainer.RequireMethods): Killed these two routines and moved
18216 all the functionality to RegisterRequiredImplementations.
18218 (TypeContainer.RegisterRequiredImplementations): This routine now
18219 registers all the implementations required in an array for the
18220 interfaces and abstract methods. We use an array of structures
18221 which can be computed ahead of time to reduce memory usage and we
18222 also assume that lookups are cheap as most classes will not
18223 implement too many interfaces.
18225 We also avoid creating too many MethodSignatures.
18227 (TypeContainer.IsInterfaceMethod): Update and optionally does not
18228 clear the "pending" bit if we find that there are problems with
18231 (TypeContainer.VerifyPendingMethods): Update to report errors of
18232 methods that look like implementations but are not.
18234 (TypeContainer.Define): Add support for explicit interface method
18237 2001-12-12 Miguel de Icaza <miguel@ximian.com>
18239 * typemanager.cs: Keep track of the parameters here instead of
18240 being a feature of the TypeContainer.
18242 * class.cs: Drop the registration of parameters here, as
18243 InterfaceMethods are also interface declarations.
18245 * delegate.cs: Register methods with the TypeManager not only with
18246 the TypeContainer. This code was buggy.
18248 * interface.cs: Full registation here.
18250 2001-12-11 Miguel de Icaza <miguel@ximian.com>
18252 * expression.cs: Remove reducer for binary expressions, it can not
18255 * const.cs: Put here the code that used to go into constant.cs
18257 * constant.cs: Put here the code for constants, this is a new base
18258 class for Literals.
18260 * literal.cs: Make Literal derive from Constant.
18262 2001-12-09 Miguel de Icaza <miguel@ximian.com>
18264 * statement.cs (Return.Emit): Report error 157 if the user
18265 attempts to return from a finally block.
18267 (Return.Emit): Instead of emitting a return, jump to the end of
18270 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
18271 LocalBuilder to store the result of the function. ReturnLabel is
18272 the target where we jump.
18275 2001-12-09 Radek Doulik <rodo@ximian.com>
18277 * cs-parser.jay: remember alias in current namespace
18279 * ecore.cs (SimpleName::DoResolve): use aliases for types or
18282 * class.cs (LookupAlias): lookup alias in my_namespace
18284 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
18286 (LookupAlias): lookup alias in this and if needed in parent
18289 2001-12-08 Miguel de Icaza <miguel@ximian.com>
18293 * rootcontext.cs: (ModuleBuilder) Made static, first step into
18294 making things static. I need this to avoid passing the
18295 TypeContainer when calling ParameterType.
18297 * support.cs (InternalParameters.ParameterType): Remove ugly hack
18298 that did string manipulation to compute the type and then call
18299 GetType. Use Parameter.ParameterType instead.
18301 * cs-tokenizer.cs: Consume the suffix for floating values.
18303 * expression.cs (ParameterReference): figure out whether this is a
18304 reference parameter or not. Kill an extra variable by computing
18305 the arg_idx during emission.
18307 * parameter.cs (Parameters.GetParameterInfo): New overloaded
18308 function that returns whether a parameter is an out/ref value or not.
18310 (Parameter.ParameterType): The type of the parameter (base,
18311 without ref/out applied).
18313 (Parameter.Resolve): Perform resolution here.
18314 (Parameter.ExternalType): The full type (with ref/out applied).
18316 * statement.cs (Using.Emit, Using.EmitExpression): Implement
18317 support for expressions on the using statement.
18319 2001-12-07 Miguel de Icaza <miguel@ximian.com>
18321 * statement.cs (Using.EmitLocalVariableDecls): Split the
18322 localvariable handling of the using statement.
18324 (Block.EmitMeta): Keep track of variable count across blocks. We
18325 were reusing slots on separate branches of blocks.
18327 (Try.Emit): Emit the general code block, we were not emitting it.
18329 Check the type of the declaration to be an IDisposable or
18330 something that can be implicity converted to it.
18332 Emit conversions if required.
18334 * ecore.cs (EmptyExpression): New utility class.
18335 (Expression.ImplicitConversionExists): New utility function.
18337 2001-12-06 Miguel de Icaza <miguel@ximian.com>
18339 * statement.cs (Using): Implement.
18341 * expression.cs (LocalVariableReference): Support read only variables.
18343 * statement.cs: Remove the explicit emit for the Leave opcode.
18344 (VariableInfo): Add a readonly field.
18346 2001-12-05 Miguel de Icaza <miguel@ximian.com>
18348 * ecore.cs (ConvCast): new class used to encapsulate the various
18349 explicit integer conversions that works in both checked and
18350 unchecked contexts.
18352 (Expression.ConvertNumericExplicit): Use new ConvCast class to
18353 properly generate the overflow opcodes.
18355 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18357 * statement.cs: The correct type for the EmptyExpression is the
18358 element_type, not the variable type. Ravi pointed this out.
18360 2001-12-04 Ravi Pratap <ravi@ximian.com>
18362 * class.cs (Method::Define): Handle PInvoke methods specially
18363 by using DefinePInvokeMethod instead of the usual one.
18365 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
18366 above to do the task of extracting information and defining the method.
18368 2001-12-04 Ravi Pratap <ravi@ximian.com>
18370 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
18371 of the condition for string type.
18373 (Emit): Move that here.
18375 (ArrayCreation::CheckIndices): Keep string literals in their expression
18378 (EmitDynamicInitializers): Handle strings appropriately.
18380 2001-12-04 Miguel de Icaza <miguel@ximian.com>
18382 * codegen.cs (EmitContext): Replace multiple variables with a
18383 single pointer to the current Switch statement.
18385 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
18388 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18392 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
18395 (Foreach.Emit): Foreach on arrays was not setting
18396 up the loop variables (for break/continue).
18398 (GotoCase): Semi-implented.
18400 2001-12-03 Ravi Pratap <ravi@ximian.com>
18402 * attribute.cs (CheckAttribute): Handle system attributes by using
18403 Attribute.GetAttributes to examine information we need.
18405 (GetValidPlaces): Same here.
18407 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
18409 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
18411 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
18413 (Method::Define): Set appropriate flags if we have a DllImport attribute.
18415 (Method::Emit): Handle the case when we are a PInvoke method.
18417 2001-12-03 Miguel de Icaza <miguel@ximian.com>
18419 * expression.cs: Use ResolveWithSimpleName on compound names.
18421 2001-12-02 Ravi Pratap <ravi@ximian.com>
18423 * constant.cs (EmitConstant): Make sure we resolve the associated expression
18424 before trying to reduce it.
18426 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
18428 * constant.cs (LookupConstantValue): Implement.
18430 (EmitConstant): Use the above in emitting the constant.
18432 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
18433 that are user-defined by doing a LookupConstantValue on them.
18435 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
18438 2001-11-29 Miguel de Icaza <miguel@ximian.com>
18440 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
18442 (BaseAccess.DoResolve): Implement.
18444 (MemberAccess.DoResolve): Split this routine into a
18445 ResolveMemberAccess routine that can be used independently
18447 2001-11-28 Miguel de Icaza <miguel@ximian.com>
18449 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
18450 As that share bits of the implementation. Is returns a boolean,
18451 while As returns the Type that is being probed.
18453 2001-12-01 Ravi Pratap <ravi@ximian.com>
18455 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
18456 instead of a Literal - much easier.
18458 (EnumInTransit): Remove - utterly useless :-)
18460 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
18462 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
18464 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
18465 chain when we have no associated expression.
18467 2001-11-30 Ravi Pratap <ravi@ximian.com>
18469 * constant.cs (Define): Use Location while reporting the errror.
18471 Also emit a warning when 'new' is used and there is no inherited
18474 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
18477 (LookupEnumValue): Implement to lookup an enum member's value and define it
18480 (Populate): Re-write accordingly to use the above routine.
18482 2001-11-27 Miguel de Icaza <miguel@ximian.com>
18484 * expression.cs (This): Fix prototype for DoResolveLValue to
18485 override the base class DoResolveLValue.
18487 * cs-parser.cs: Report errors cs574 and cs575 (destructor
18490 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
18491 (we need to load the address of the field here). This fixes
18494 (FieldExpr.DoResolveLValue): Call the DoResolve
18495 function to initialize the Instance expression.
18497 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
18498 correctly the GetEnumerator operation on a value type.
18500 * cs-parser.jay: Add more simple parsing error catches.
18502 * statement.cs (Switch): Add support for string switches.
18503 Handle null specially.
18505 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
18507 2001-11-28 Ravi Pratap <ravi@ximian.com>
18509 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
18511 (declare_local_constant): New helper function.
18513 * statement.cs (AddConstant): Keep a separate record of constants
18515 (IsConstant): Implement to determine if a variable is a constant.
18517 (GetConstantExpression): Implement.
18519 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
18521 * statement.cs (IsVariableDefined): Re-write.
18523 2001-11-27 Ravi Pratap <ravi@ximian.com>
18525 * class.cs (TypeContainer::FindMembers): Look for constants
18526 in the case when we are looking for MemberTypes.Field
18528 * expression.cs (MemberAccess::DoResolve): Check that in the
18529 case we are a FieldExpr and a Literal, we are not being accessed
18530 by an instance reference.
18532 * cs-parser.jay (local_constant_declaration): Implement.
18534 (declaration_statement): Implement for constant declarations.
18536 2001-11-26 Miguel de Icaza <miguel@ximian.com>
18538 * statement.cs (Switch): Catch double defaults.
18540 (Switch): More work on the switch() statement
18541 implementation. It works for integral values now, need to finish
18545 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18547 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
18548 integer literals into other integer literals. To be used by
18551 2001-11-24 Ravi Pratap <ravi@ximian.com>
18553 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
18556 (EmitDynamicInitializers): Cope with the above since we extract data
18557 directly from ArrayData now.
18559 (ExpectInitializers): Keep track of whether initializers are mandatory
18562 (Bounds): Make it a hashtable to prevent the same dimension being
18563 recorded for every element in that dimension.
18565 (EmitDynamicInitializers): Fix bug which prevented the Set array method
18568 Also fix bug which was causing the indices to be emitted in the reverse
18571 2001-11-24 Miguel de Icaza <miguel@ximian.com>
18573 * expression.cs (ArrayCreation): Implement the bits that Ravi left
18574 unfinished. They do not work, because the underlying code is
18577 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18579 * cs-parser.jay: Remove bogus fixme.
18581 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
18582 on Switch statement.
18584 2001-11-23 Ravi Pratap <ravi@ximian.com>
18586 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
18589 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
18590 parameter. Apparently, any expression is allowed.
18592 (ValidateInitializers): Update accordingly.
18594 (CheckIndices): Fix some tricky bugs thanks to recursion.
18596 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
18597 I was being completely brain-dead.
18599 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
18600 and re-write acordingly.
18602 (DelegateInvocation): Re-write accordingly.
18604 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
18606 (MakeByteBlob): Handle types more correctly.
18608 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
18609 initialization from expressions but it is incomplete because I am a complete
18612 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18614 * statement.cs (If.Emit): Fix a bug that generated incorrect code
18615 on If. Basically, we have to return `true' (ie, we do return to
18616 our caller) only if both branches of the if return.
18618 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
18619 short-circuit operators, handle them as short circuit operators.
18621 (Cast.DoResolve): Resolve type.
18622 (Cast.Cast): Take an expression as the target type.
18624 * cs-parser.jay (cast_expression): Remove old hack that only
18625 allowed a limited set of types to be handled. Now we take a
18626 unary_expression and we resolve to a type during semantic
18629 Use the grammar productions from Rhys to handle casts (this is
18630 not complete like Rhys syntax yet, we fail to handle that corner
18631 case that C# has regarding (-x), but we will get there.
18633 2001-11-22 Ravi Pratap <ravi@ximian.com>
18635 * class.cs (EmitFieldInitializer): Take care of the case when we have a
18636 field which is an array type.
18638 * cs-parser.jay (declare_local_variables): Support array initialization too.
18640 * typemanager.cs (MakeKey): Implement.
18642 (everywhere): Use the above appropriately.
18644 * cs-parser.jay (for_statement): Update for array initialization while
18645 declaring variables.
18647 * ecore.cs : The error message was correct, it's the variable's names that
18648 were misleading ;-) Make the code more readable.
18650 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
18651 the correct type etc.
18653 (ConvertExplicit): Handle Enum types by examining the underlying type.
18655 2001-11-21 Ravi Pratap <ravi@ximian.com>
18657 * parameter.cs (GetCallingConvention): Always return
18658 CallingConventions.Standard for now.
18660 2001-11-22 Miguel de Icaza <miguel@ximian.com>
18662 * expression.cs (Binary.ResolveOperator): Update the values of `l'
18663 and `r' after calling DoNumericPromotions.
18665 * ecore.cs: Fix error message (the types were in the wrong order).
18667 * statement.cs (Foreach.ProbeCollectionType): Need to pass
18668 BindingFlags.Instance as well
18670 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
18671 implicit int literal conversion in an empty cast so that we
18672 propagate the right type upstream.
18674 (UnboxCast): new class used to unbox value types.
18675 (Expression.ConvertExplicit): Add explicit type conversions done
18678 (Expression.ImplicitNumericConversion): Oops, forgot to test for
18679 the target type before applying the implicit LongLiterals to ULong
18682 2001-11-21 Miguel de Icaza <miguel@ximian.com>
18684 * cs-parser.jay (for_statement): Reworked the way For works: now
18685 we declare manually any variables that are introduced in
18686 for_initializer to solve the problem of having out-of-band code
18687 emition (that is what got for broken).
18689 (declaration_statement): Perform the actual variable declaration
18690 that used to be done in local_variable_declaration here.
18692 (local_variable_declaration): Do not declare anything, just pass
18693 the information on a DictionaryEntry
18695 2001-11-20 Ravi Pratap <ravi@ximian.com>
18697 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
18698 re-write of the logic to now make it recursive.
18700 (UpdateIndices): Re-write accordingly.
18702 Store element data in a separate ArrayData list in the above methods.
18704 (MakeByteBlob): Implement to dump the array data into a byte array.
18706 2001-11-19 Ravi Pratap <ravi@ximian.com>
18708 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
18711 * constant.cs (Define): Implement.
18713 (EmitConstant): Re-write fully.
18715 Pass in location info.
18717 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
18720 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
18721 DictionaryEntry since we need location info too.
18723 (constant_declaration): Update accordingly.
18725 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
18726 code into another method : UpdateIndices.
18728 2001-11-18 Ravi Pratap <ravi@ximian.com>
18730 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
18731 some type checking etc.
18733 2001-11-17 Ravi Pratap <ravi@ximian.com>
18735 * expression.cs (ArrayCreation::ValidateInitializers): Implement
18736 bits to provide dimension info if the user skips doing that.
18738 Update second constructor to store the rank correctly.
18740 2001-11-16 Ravi Pratap <ravi@ximian.com>
18742 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
18743 and try to implement.
18745 * ../errors/cs0150.cs : Add.
18747 * ../errors/cs0178.cs : Add.
18749 2001-11-16 Miguel de Icaza <miguel@ximian.com>
18751 * statement.cs: Implement foreach on multi-dimensional arrays.
18753 * parameter.cs (Parameters.GetParameterByName): Also lookup the
18754 name of the params argument.
18756 * expression.cs: Use EmitStoreOpcode to get the right opcode while
18757 initializing the array.
18759 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
18760 we can use this elsewhere.
18762 * statement.cs: Finish implementation of foreach for single
18765 * cs-parser.jay: Use an out-of-band stack to pass information
18766 around, I wonder why I need this.
18768 foreach_block: Make the new foreach_block the current_block.
18770 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
18771 function used to return a static Parameters structure. Used for
18772 empty parameters, as those are created very frequently.
18774 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
18776 2001-11-15 Ravi Pratap <ravi@ximian.com>
18778 * interface.cs : Default modifier is private, not public. The
18779 make verify test passes again.
18781 2001-11-15 Ravi Pratap <ravi@ximian.com>
18783 * support.cs (ReflectionParameters): Fix logic to determine
18784 whether the last parameter is a params one. Test 9 passes again.
18786 * delegate.cs (Populate): Register the builders we define with
18787 RegisterParameterForBuilder. Test 19 passes again.
18789 * cs-parser.jay (property_declaration): Reference $6 instead
18790 of $$ to get at the location.
18792 (indexer_declaration): Similar stuff.
18794 (attribute): Ditto.
18796 * class.cs (Property): Register parameters for the Get and Set methods
18797 if they exist. Test 23 passes again.
18799 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
18800 call to EmitArguments as we are sure there aren't any params arguments.
18801 Test 32 passes again.
18803 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
18804 IndexOutOfRangeException.
18806 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
18807 Test 33 now passes again.
18809 2001-11-15 Miguel de Icaza <miguel@ximian.com>
18811 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
18812 broke a bunch of things. Will have to come up with a better way
18813 of tracking locations.
18815 * statement.cs: Implemented foreach for single dimension arrays.
18817 2001-11-09 Miguel de Icaza <miguel@ximian.com>
18819 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
18820 an error. This removes the lookup from the critical path.
18822 * cs-parser.jay: Removed use of temporary_loc, which is completely
18825 2001-11-14 Miguel de Icaza <miguel@ximian.com>
18827 * support.cs (ReflectionParameters.ParameterModifier): Report
18828 whether the argument is a PARAMS argument or not.
18830 * class.cs: Set the attribute `ParamArrayAttribute' on the
18831 parameter argument.
18833 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
18834 and cons_param_array_attribute (ConstructorInfo for
18835 ParamArrayAttribute).,
18837 * codegen.cs: Emit the return using the `Return' statement, that
18838 way we can report the error correctly for missing return values.
18840 * class.cs (Method.Emit): Clean up.
18842 * expression.cs (Argument.Resolve): Take another argument: the
18843 location where this argument is used. Notice that this is not
18844 part of the "Argument" class as to reduce the size of the
18845 structure (we know the approximate location anyways).
18847 Test if the argument is a variable-reference, if not, then
18848 complain with a 206.
18850 (Argument.Emit): Emit addresses of variables.
18852 (Argument.FullDesc): Simplify.
18854 (Invocation.DoResolve): Update for Argument.Resolve.
18856 (ElementAccess.DoResolve): ditto.
18858 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
18859 method should be virtual, as this method is always virtual.
18861 (NewDelegate.DoResolve): Update for Argument.Resolve.
18863 * class.cs (ConstructorInitializer.DoResolve): ditto.
18865 * attribute.cs (Attribute.Resolve): ditto.
18867 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18869 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
18871 * expression.cs (ParameterReference): Drop IStackStorage and implement
18872 IAssignMethod instead.
18874 (LocalVariableReference): ditto.
18876 * ecore.cs (FieldExpr): Drop IStackStorage and implement
18877 IAssignMethod instead.
18879 2001-11-13 Miguel de Icaza <miguel@ximian.com>
18881 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
18882 enumerations that are used in heavily used structures derive from
18883 byte in a laughable and pathetic attempt to reduce memory usage.
18884 This is the kind of pre-optimzations that you should not do at
18885 home without adult supervision.
18887 * expression.cs (UnaryMutator): New class, used to handle ++ and
18888 -- separatedly from the other unary operators. Cleans up the
18889 code, and kills the ExpressionStatement dependency in Unary.
18891 (Unary): Removed `method' and `Arguments' from this class, making
18892 it smaller, and moving it all to SimpleCall, so I can reuse this
18893 code in other locations and avoid creating a lot of transient data
18894 strucutres when not required.
18896 * cs-parser.jay: Adjust for new changes.
18898 2001-11-11 Miguel de Icaza <miguel@ximian.com>
18900 * enum.cs (Enum.Populate): If there is a failure during
18903 * cs-parser.jay (opt_enum_base): we used to catch type errors
18904 here, but this is really incorrect. The type error should be
18905 catched during semantic analysis.
18907 2001-12-11 Ravi Pratap <ravi@ximian.com>
18909 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
18910 current_local_parameters as expected since I, in my stupidity, had forgotten
18913 * attribute.cs (GetValidPlaces): Fix stupid bug.
18915 * class.cs (Method::Emit): Perform check on applicability of attributes.
18917 (Constructor::Emit): Ditto.
18919 (Field::Emit): Ditto.
18921 (Field.Location): Store location information.
18923 (Property, Event, Indexer, Operator): Ditto.
18925 * cs-parser.jay (field_declaration): Pass in location for each field.
18927 * ../errors/cs0592.cs : Add.
18929 2001-11-12 Ravi Pratap <ravi@ximian.com>
18931 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
18933 (InitCoreTypes): Update accordingly.
18935 (RegisterAttrType, LookupAttr): Implement.
18937 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
18938 info about the same.
18940 (Resolve): Update to populate the above as necessary.
18942 (Error592): Helper.
18944 (GetValidPlaces): Helper to the above.
18946 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
18948 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
18950 2001-11-12 Ravi Pratap <ravi@ximian.com>
18952 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
18954 * ../errors/cs0617.cs : Add.
18956 2001-11-11 Ravi Pratap <ravi@ximian.com>
18958 * enum.cs (Emit): Rename to Populate to be more consistent with what
18959 we expect it to do and when exactly it is called.
18961 * class.cs, rootcontext.cs : Update accordingly.
18963 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
18964 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
18966 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
18968 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
18969 of a fieldinfo using the above, when dealing with a FieldBuilder.
18971 2001-11-10 Ravi Pratap <ravi@ximian.com>
18973 * ../errors/cs0031.cs : Add.
18975 * ../errors/cs1008.cs : Add.
18977 * ../errrors/cs0543.cs : Add.
18979 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
18982 (FindMembers): Implement.
18984 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
18985 enums and delegates too.
18987 (enum_types): Rename to builder_to_enum.
18989 (delegate_types): Rename to builder_to_delegate.
18991 * delegate.cs (FindMembers): Implement.
18993 2001-11-09 Ravi Pratap <ravi@ximian.com>
18995 * typemanager.cs (IsEnumType): Implement.
18997 * enum.cs (Emit): Re-write parts to account for the underlying type
18998 better and perform checking etc.
19000 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
19001 of the underlying type.
19003 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
19006 * enum.cs (error31): Helper to report error #31.
19008 * cs-parser.jay (enum_declaration): Store location of each member too.
19010 * enum.cs (member_to_location): New hashtable.
19012 (AddEnumMember): Update location hashtable.
19014 (Emit): Use the location of each member while reporting errors.
19016 2001-11-09 Miguel de Icaza <miguel@ximian.com>
19018 * cs-parser.jay: A for_initializer if is a
19019 local_variable_declaration really ammount to have an implicit
19020 block with the variable declaration and no initializer for for.
19022 * statement.cs (For.Emit): Cope with null initializers.
19024 This fixes the infinite loop on for initializers.
19026 2001-11-08 Miguel de Icaza <miguel@ximian.com>
19028 * enum.cs: More cleanup.
19030 * ecore.cs: Remove dead code.
19032 * class.cs (Property.Emit): More simplification.
19033 (Event.Emit): ditto.
19035 Reworked to have less levels of indentation.
19037 2001-11-08 Ravi Pratap <ravi@ximian.com>
19039 * class.cs (Property): Emit attributes.
19049 * enum.cs (Emit): Ditto.
19051 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
19054 * class.cs (Field, Event, etc.): Move attribute generation into the
19055 Emit method everywhere.
19057 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
19058 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
19059 as we had no way of defining nested enums !
19061 * rootcontext.cs : Adjust code accordingly.
19063 * typemanager.cs (AddEnumType): To keep track of enum types separately.
19065 2001-11-07 Ravi Pratap <ravi@ximian.com>
19067 * expression.cs (EvalConstantExpression): Move into ecore.cs
19069 * enum.cs (Enum): Rename some members and make them public and readonly
19070 according to our convention.
19072 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
19075 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
19077 (Enum::Emit): Write a simple version for now which doesn't try to compute
19078 expressions. I shall modify this to be more robust in just a while.
19080 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
19082 (TypeContainer::CloseType): Create the Enum types too.
19084 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
19086 * expression.cs (EvalConstantExpression): Get rid of completely.
19088 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
19089 user-defined values and other cases.
19091 (IsValidEnumLiteral): Helper function.
19093 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
19094 out there in the case we had a literal FieldExpr.
19096 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
19098 (Literalize): Revamp a bit to take two arguments.
19100 (EnumLiteral): New class which derives from Literal to wrap enum literals.
19102 2001-11-06 Ravi Pratap <ravi@ximian.com>
19104 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
19106 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
19108 (Resolve): Use the above to ensure we have proper initializers.
19110 2001-11-05 Ravi Pratap <ravi@ximian.com>
19112 * expression.cs (Expression::EvalConstantExpression): New method to
19113 evaluate constant expressions.
19115 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
19117 2001-11-07 Miguel de Icaza <miguel@ximian.com>
19119 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
19122 (Binary.ResolveOperator): Handle operator != (object a, object b)
19123 and operator == (object a, object b);
19125 (Binary.DoNumericPromotions): Indicate whether the numeric
19126 promotion was possible.
19128 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
19131 Made the ArrayAccess implement interface IAssignMethod instead of
19132 IStackStore as the order in which arguments are passed reflects
19135 * assign.cs: Instead of using expr.ExprClass to select the way of
19136 assinging, probe for the IStackStore/IAssignMethod interfaces.
19138 * typemanager.cs: Load InitializeArray definition.
19140 * rootcontext.cs (RootContext.MakeStaticData): Used to define
19141 static data that can be used to initialize arrays.
19143 2001-11-05 Miguel de Icaza <miguel@ximian.com>
19145 * expression.cs: Handle operator== and operator!= for booleans.
19147 (Conditioal.Reduce): Implement reducer for the ?: operator.
19149 (Conditional.Resolve): Implement dead code elimination.
19151 (Binary.Resolve): Catch string literals and return a new
19152 concatenated string.
19154 (Unary.Reduce): Implement reduction of unary expressions.
19156 * ecore.cs: Split out the expression core handling here.
19158 (Expression.Reduce): New method used to perform constant folding
19159 and CSE. This is needed to support constant-expressions.
19161 * statement.cs (Statement.EmitBoolExpression): Pass true and false
19162 targets, and optimize for !x.
19164 2001-11-04 Ravi Pratap <ravi@ximian.com>
19166 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
19167 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
19168 set custom atttributes.
19170 * literal.cs (Literal::GetValue): New abstract method to return the actual
19171 value of the literal, cast as an object.
19173 (*Literal): Implement GetValue method.
19175 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
19176 expressions to the arraylist but objects of type Argument.
19178 * class.cs (TypeContainer::Emit): Emit our attributes too.
19180 (Method::Emit, Constructor::Emit): Ditto.
19182 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
19183 to be ignoring earlier.
19185 2001-11-03 Ravi Pratap <ravi@ximian.com>
19187 * attribute.cs (AttributeSection::Define): Implement to do the business
19188 of constructing a CustomAttributeBuilder.
19190 (Attribute): New trivial class. Increases readability of code.
19192 * cs-parser.jay : Update accordingly.
19194 (positional_argument_list, named_argument_list, named_argument): New rules
19196 (attribute_arguments): Use the above so that we are more correct.
19198 2001-11-02 Ravi Pratap <ravi@ximian.com>
19200 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
19201 to perform all checks for a method with a params parameter.
19203 (Invocation::OverloadResolve): Update to use the above method and therefore
19204 cope correctly with params method invocations.
19206 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
19209 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
19210 constructors in our parent too because we can't afford to miss out on
19213 * attribute.cs (AttributeSection): New name for the class Attribute
19215 Other trivial changes to improve readability.
19217 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
19218 use the new class names.
19220 2001-11-01 Ravi Pratap <ravi@ximian.com>
19222 * class.cs (Method::Define): Complete definition for params types too
19224 (Indexer::Define): Ditto.
19226 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
19227 Cope everywhere with a request for info about the array parameter.
19229 2001-11-01 Ravi Pratap <ravi@ximian.com>
19231 * tree.cs (RecordNamespace): Fix up to check for the correct key.
19233 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
19234 local_variable_type to extract the string corresponding to the type.
19236 (local_variable_type): Fixup the action to use the new helper method.
19238 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
19241 * expression.cs : Clean out code which uses the above.
19243 2001-10-31 Ravi Pratap <ravi@ximian.com>
19245 * typemanager.cs (RegisterMethod): Check if we already have an existing key
19246 and bale out if necessary by returning a false.
19248 (RegisterProperty): Ditto.
19250 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
19251 and print out appropriate error messages.
19253 * interface.cs (everywhere): Ditto.
19255 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
19256 location to constructor.
19258 * class.cs (Property, Event, Indexer): Update accordingly.
19260 * ../errors/cs111.cs : Added.
19262 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
19263 of a method, as laid down by the spec.
19265 (Invocation::OverloadResolve): Use the above method.
19267 2001-10-31 Ravi Pratap <ravi@ximian.com>
19269 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
19270 now take a TypeContainer and a Parameters object.
19272 (ParameterData): Modify return type of ParameterModifier method to be
19273 Parameter.Modifier and not a string.
19275 (ReflectionParameters, InternalParameters): Update accordingly.
19277 * expression.cs (Argument::GetParameterModifier): Same here.
19279 * support.cs (InternalParameters::ParameterType): Find a better way of determining
19280 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
19281 symbol in it at all so maybe this is only for now.
19283 2001-10-30 Ravi Pratap <ravi@ximian.com>
19285 * support.cs (InternalParameters): Constructor now takes an extra argument
19286 which is the actual Parameters class.
19288 (ParameterDesc): Update to provide info on ref/out modifiers.
19290 * class.cs (everywhere): Update call to InternalParameters to pass in
19291 the second argument too.
19293 * support.cs (ParameterData): Add ParameterModifier, which is a method
19294 to return the modifier info [ref/out etc]
19296 (InternalParameters, ReflectionParameters): Implement the above.
19298 * expression.cs (Argument::ParameterModifier): Similar function to return
19299 info about the argument's modifiers.
19301 (Invocation::OverloadResolve): Update to take into account matching modifiers
19304 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
19305 a new SetFormalParameters object which we pass to InternalParameters.
19307 2001-10-30 Ravi Pratap <ravi@ximian.com>
19309 * expression.cs (NewArray): Merge into the ArrayCreation class.
19311 2001-10-29 Ravi Pratap <ravi@ximian.com>
19313 * expression.cs (NewArray): Merge classes NewBuiltinArray and
19314 NewUserdefinedArray into one as there wasn't much of a use in having
19317 * expression.cs (Argument): Change field's name to ArgType from Type.
19319 (Type): New readonly property which returns the proper type, taking into
19320 account ref/out modifiers.
19322 (everywhere): Adjust code accordingly for the above.
19324 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
19325 whether we are emitting for a ref or out parameter.
19327 * expression.cs (Argument::Emit): Use the above field to set the state.
19329 (LocalVariableReference::Emit): Update to honour the flag and emit the
19332 * parameter.cs (Attributes): Set the correct flags for ref parameters.
19334 * expression.cs (Argument::FullDesc): New function to provide a full desc.
19336 * support.cs (ParameterData): Add method ParameterDesc to the interface.
19338 (ReflectionParameters, InternalParameters): Implement the above method.
19340 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
19343 (Invocation::FullMethodDesc): Ditto.
19345 2001-10-29 Miguel de Icaza <miguel@ximian.com>
19347 * cs-parser.jay: Add extra production for the second form of array
19350 * expression.cs (ArrayCreation): Update to reflect the above
19353 * Small changes to prepare for Array initialization.
19355 2001-10-28 Miguel de Icaza <miguel@ximian.com>
19357 * typemanager.cs (ImplementsInterface): interface might be null;
19358 Deal with this problem;
19360 Also, we do store negative hits on the cache (null values), so use
19361 this instead of calling t.GetInterfaces on the type everytime.
19363 2001-10-28 Ravi Pratap <ravi@ximian.com>
19365 * typemanager.cs (IsBuiltinType): New method to help determine the same.
19367 * expression.cs (New::DoResolve): Get rid of array creation code and instead
19368 split functionality out into different classes.
19370 (New::FormArrayType): Move into NewBuiltinArray.
19372 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
19375 (NewBuiltinArray): New class to handle creation of built-in arrays.
19377 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
19378 account creation of one-dimensional arrays.
19380 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
19382 (NewUserdefinedArray::DoResolve): Implement.
19384 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
19386 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
19387 we maintain inside the TypeManager. This is necessary to perform lookups on the
19390 (LookupType): Update to perform GetType on the module builders too.
19392 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
19394 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
19396 2001-10-23 Ravi Pratap <ravi@ximian.com>
19398 * expression.cs (New::DoResolve): Implement guts of array creation.
19400 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
19402 2001-10-27 Miguel de Icaza <miguel@ximian.com>
19404 * expression.cs: Fix bug I introduced lsat night that broke
19407 (Expression.Resolve): Report a 246 error (can not resolve name)
19408 if we find a SimpleName in the stream.
19410 (Expression.ResolveLValue): Ditto.
19412 (Expression.ResolveWithSimpleName): This function is a variant of
19413 ResolveName, this one allows SimpleNames to be returned without a
19414 warning. The only consumer of SimpleNames is MemberAccess
19416 2001-10-26 Miguel de Icaza <miguel@ximian.com>
19418 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
19419 might arrive here. I have my doubts that this is correct.
19421 * statement.cs (Lock): Implement lock statement.
19423 * cs-parser.jay: Small fixes to support `lock' and `using'
19425 * cs-tokenizer.cs: Remove extra space
19427 * driver.cs: New flag --checked, allows to turn on integer math
19430 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
19431 Threading.Monitor.Exit
19433 2001-10-23 Miguel de Icaza <miguel@ximian.com>
19435 * expression.cs (IndexerAccess::DoResolveLValue): Set the
19436 Expression Class to be IndexerAccess.
19438 Notice that Indexer::DoResolve sets the eclass to Value.
19440 2001-10-22 Miguel de Icaza <miguel@ximian.com>
19442 * class.cs (TypeContainer::Emit): Emit code for indexers.
19444 * assign.cs (IAssignMethod): New interface implemented by Indexers
19445 and Properties for handling assignment.
19447 (Assign::Emit): Simplify and reuse code.
19449 * expression.cs (IndexerAccess, PropertyExpr): Implement
19450 IAssignMethod, clean up old code.
19452 2001-10-22 Ravi Pratap <ravi@ximian.com>
19454 * typemanager.cs (ImplementsInterface): New method to determine if a type
19455 implements a given interface. Provides a nice cache too.
19457 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
19460 (ConvertReferenceExplicit): Ditto.
19462 * delegate.cs (Delegate::Populate): Update to define the parameters on the
19463 various methods, with correct names etc.
19465 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
19466 Operator.UnaryNegation.
19468 * cs-parser.jay (operator_declarator): Be a little clever in the case where
19469 we have a unary plus or minus operator.
19471 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
19474 * everywhere : update accordingly.
19476 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
19479 * class.cs (Method::Define): For the case where we are implementing a method
19480 inherited from an interface, we need to set the MethodAttributes.Final flag too.
19481 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
19483 2001-10-21 Ravi Pratap <ravi@ximian.com>
19485 * interface.cs (FindMembers): Implement to work around S.R.E
19488 * typemanager.cs (IsInterfaceType): Implement.
19490 (FindMembers): Update to handle interface types too.
19492 * expression.cs (ImplicitReferenceConversion): Re-write bits which
19493 use IsAssignableFrom as that is not correct - it doesn't work.
19495 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
19496 and accordingly override EmitStatement.
19498 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
19499 using the correct logic :-)
19501 2001-10-19 Ravi Pratap <ravi@ximian.com>
19503 * ../errors/cs-11.cs : Add to demonstrate error -11
19505 2001-10-17 Miguel de Icaza <miguel@ximian.com>
19507 * assign.cs (Assign::Resolve): Resolve right hand side first, and
19508 then pass this as a hint to ResolveLValue.
19510 * expression.cs (FieldExpr): Add Location information
19512 (FieldExpr::LValueResolve): Report assignment to readonly
19515 (Expression::ExprClassFromMemberInfo): Pass location information.
19517 (Expression::ResolveLValue): Add new method that resolves an
19520 (Expression::DoResolveLValue): Default invocation calls
19523 (Indexers): New class used to keep track of indexers in a given
19526 (IStackStore): Renamed from LValue, as it did not really describe
19527 what this did. Also ResolveLValue is gone from this interface and
19528 now is part of Expression.
19530 (ElementAccess): Depending on the element access type
19532 * typemanager.cs: Add `indexer_name_type' as a Core type
19533 (System.Runtime.CompilerServices.IndexerNameAttribute)
19535 * statement.cs (Goto): Take a location.
19537 2001-10-18 Ravi Pratap <ravi@ximian.com>
19539 * delegate.cs (Delegate::VerifyDelegate): New method to verify
19540 if two delegates are compatible.
19542 (NewDelegate::DoResolve): Update to take care of the case when
19543 we instantiate a delegate from another delegate.
19545 * typemanager.cs (FindMembers): Don't even try to look up members
19546 of Delegate types for now.
19548 2001-10-18 Ravi Pratap <ravi@ximian.com>
19550 * delegate.cs (NewDelegate): New class to take care of delegate
19553 * expression.cs (New): Split the delegate related code out into
19554 the NewDelegate class.
19556 * delegate.cs (DelegateInvocation): New class to handle delegate
19559 * expression.cs (Invocation): Split out delegate related code into
19560 the DelegateInvocation class.
19562 2001-10-17 Ravi Pratap <ravi@ximian.com>
19564 * expression.cs (New::DoResolve): Implement delegate creation fully
19565 and according to the spec.
19567 (New::DoEmit): Update to handle delegates differently.
19569 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
19570 because of which we were printing out arguments in reverse order !
19572 * delegate.cs (VerifyMethod): Implement to check if the given method
19573 matches the delegate.
19575 (FullDelegateDesc): Implement.
19577 (VerifyApplicability): Implement.
19579 * expression.cs (Invocation::DoResolve): Update to accordingly handle
19580 delegate invocations too.
19582 (Invocation::Emit): Ditto.
19584 * ../errors/cs1593.cs : Added.
19586 * ../errors/cs1594.cs : Added.
19588 * delegate.cs (InstanceExpression, TargetMethod): New properties.
19590 2001-10-16 Ravi Pratap <ravi@ximian.com>
19592 * typemanager.cs (intptr_type): Core type for System.IntPtr
19594 (InitCoreTypes): Update for the same.
19596 (iasyncresult_type, asynccallback_type): Ditto.
19598 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
19601 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
19604 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
19605 the builders for the 4 members of a delegate type :-)
19607 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
19610 * expression.cs (New::DoResolve): Implement guts for delegate creation.
19612 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
19614 2001-10-15 Miguel de Icaza <miguel@ximian.com>
19616 * statement.cs (Break::Emit): Implement.
19617 (Continue::Emit): Implement.
19619 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
19620 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
19621 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
19622 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
19625 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
19626 properties that track the label for the current loop (begin of the
19627 loop and end of the loop).
19629 2001-10-15 Ravi Pratap <ravi@ximian.com>
19631 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
19632 use of emitting anything at all.
19634 * class.cs, rootcontext.cs : Get rid of calls to the same.
19636 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
19638 (Populate): Define the constructor correctly and set the implementation
19641 * typemanager.cs (delegate_types): New hashtable to hold delegates that
19644 (AddDelegateType): Implement.
19646 (IsDelegateType): Implement helper method.
19648 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
19650 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
19651 and accordingly handle it.
19653 * delegate.cs (Populate): Take TypeContainer argument.
19654 Implement bits to define the Invoke method. However, I still haven't figured out
19655 how to take care of the native int bit :-(
19657 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
19658 Qualify the name of the delegate, not its return type !
19660 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
19663 (StandardConversionExists): Checking for array types turns out to be recursive.
19665 (ConvertReferenceExplicit): Implement array conversion.
19667 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
19669 2001-10-12 Ravi Pratap <ravi@ximian.com>
19671 * cs-parser.jay (delegate_declaration): Store the fully qualified
19672 name as it is a type declaration.
19674 * delegate.cs (ReturnType, Name): Rename members to these. Make them
19677 (DefineDelegate): Renamed from Define. Does the same thing essentially,
19678 as TypeContainer::DefineType.
19680 (Populate): Method in which all the definition of the various methods (Invoke)
19683 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
19686 (CloseDelegate): Finally creates the delegate.
19688 * class.cs (TypeContainer::DefineType): Update to define delegates.
19689 (Populate, Emit and CloseType): Do the same thing here too.
19691 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
19692 delegates in all these operations.
19694 2001-10-14 Miguel de Icaza <miguel@ximian.com>
19696 * expression.cs: LocalTemporary: a new expression used to
19697 reference a temporary that has been created.
19699 * assign.cs: Handle PropertyAccess back here, so that we can
19700 provide the proper semantic access to properties.
19702 * expression.cs (Expression::ConvertReferenceExplicit): Implement
19703 a few more explicit conversions.
19705 * modifiers.cs: `NEW' modifier maps to HideBySig.
19707 * expression.cs (PropertyExpr): Make this into an
19708 ExpressionStatement, and support the EmitStatement code path.
19710 Perform get/set error checking, clean up the interface.
19712 * assign.cs: recognize PropertyExprs as targets, and if so, turn
19713 them into toplevel access objects.
19715 2001-10-12 Miguel de Icaza <miguel@ximian.com>
19717 * expression.cs: PropertyExpr::PropertyExpr: use work around the
19720 * typemanager.cs: Keep track here of our PropertyBuilders again to
19721 work around lameness in SRE.
19723 2001-10-11 Miguel de Icaza <miguel@ximian.com>
19725 * expression.cs (LValue::LValueResolve): New method in the
19726 interface, used to perform a second resolution pass for LValues.
19728 (This::DoResolve): Catch the use of this in static methods.
19730 (This::LValueResolve): Implement.
19732 (This::Store): Remove warning, assigning to `this' in structures
19735 (Invocation::Emit): Deal with invocation of
19736 methods on value types. We need to pass the address to structure
19737 methods rather than the object itself. (The equivalent code to
19738 emit "this" for structures leaves the entire structure on the
19739 stack instead of a pointer to it).
19741 (ParameterReference::DoResolve): Compute the real index for the
19742 argument based on whether the method takes or not a `this' pointer
19743 (ie, the method is static).
19745 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
19746 value types returned from functions when we need to invoke a
19747 method on the sturcture.
19750 2001-10-11 Ravi Pratap <ravi@ximian.com>
19752 * class.cs (TypeContainer::DefineType): Method to actually do the business of
19753 defining the type in the Modulebuilder or Typebuilder. This is to take
19754 care of nested types which need to be defined on the TypeBuilder using
19755 DefineNestedMethod.
19757 (TypeContainer::GetClassBases): Implement. Essentially the code from the
19758 methods in RootContext, only ported to be part of TypeContainer.
19760 (TypeContainer::GetInterfaceOrClass): Ditto.
19762 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
19764 * interface.cs (Interface::DefineInterface): New method. Does exactly
19765 what RootContext.CreateInterface did earlier, only it takes care of nested types
19768 (Interface::GetInterfaces): Move from RootContext here and port.
19770 (Interface::GetInterfaceByName): Same here.
19772 * rootcontext.cs (ResolveTree): Re-write.
19774 (PopulateTypes): Re-write.
19776 * class.cs (TypeContainer::Populate): Populate nested types too.
19777 (TypeContainer::Emit): Emit nested members too.
19779 * typemanager.cs (AddUserType): Do not make use of the FullName property,
19780 instead just use the name argument passed in as it is already fully
19783 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
19784 to TypeContainer mapping to see if a type is user-defined.
19786 * class.cs (TypeContainer::CloseType): Implement.
19788 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
19789 the default constructor.
19791 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
19794 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
19796 * interface.cs (CloseType): Create the type here.
19798 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
19801 Remove all the methods which are now in TypeContainer.
19803 2001-10-10 Ravi Pratap <ravi@ximian.com>
19805 * delegate.cs (Define): Re-write bits to define the delegate
19808 2001-10-10 Miguel de Icaza <miguel@ximian.com>
19810 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
19812 * expression.cs (ImplicitReferenceConversion): handle null as well
19813 as a source to convert to any reference type.
19815 * statement.cs (Return): Perform any implicit conversions to
19816 expected return type.
19818 Validate use of return statement.
19820 * codegen.cs (EmitContext): Pass the expected return type here.
19822 * class.cs (Method, Constructor, Property): Pass expected return
19823 type to EmitContext.
19825 2001-10-09 Miguel de Icaza <miguel@ximian.com>
19827 * expression.cs: Make DoResolve take an EmitContext instead of a
19830 Replaced `l' and `location' for `loc', for consistency.
19832 (Error, Warning): Remove unneeded Tc argument.
19834 * assign.cs, literal.cs, constant.cs: Update to new calling
19837 * codegen.cs: EmitContext now contains a flag indicating whether
19838 code is being generated in a static method or not.
19840 * cs-parser.jay: DecomposeQI, new function that replaces the old
19841 QualifiedIdentifier. Now we always decompose the assembled
19842 strings from qualified_identifier productions into a group of
19845 2001-10-08 Miguel de Icaza <miguel@ximian.com>
19847 * rootcontext.cs: Deal with field-less struct types correctly now
19848 by passing the size option to Define Type.
19850 * class.cs: Removed hack that created one static field.
19852 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19854 * statement.cs: Moved most of the code generation here.
19856 2001-10-09 Ravi Pratap <ravi@ximian.com>
19858 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
19861 (ElementAccess): Remove useless bits for now - keep checks as the spec
19864 2001-10-08 Ravi Pratap <ravi@ximian.com>
19866 * expression.cs (ElementAccess::DoResolve): Remove my crap code
19867 and start performing checks according to the spec.
19869 2001-10-07 Ravi Pratap <ravi@ximian.com>
19871 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
19872 rank_specifiers instead.
19874 (rank_specifiers): Change the order in which the rank specifiers are stored
19876 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
19878 * expression.cs (ElementAccess): Implement the LValue interface too.
19880 2001-10-06 Ravi Pratap <ravi@ximian.com>
19882 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
19883 except that user defined conversions are not included.
19885 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
19886 perform the conversion of the return type, if necessary.
19888 (New::DoResolve): Check whether we are creating an array or an object
19889 and accordingly do the needful.
19891 (New::Emit): Same here.
19893 (New::DoResolve): Implement guts of array creation.
19895 (New::FormLookupType): Helper function.
19897 2001-10-07 Miguel de Icaza <miguel@ximian.com>
19899 * codegen.cs: Removed most of the code generation here, and move the
19900 corresponding code generation bits to the statement classes.
19902 Added support for try/catch/finalize and throw.
19904 * cs-parser.jay: Added support for try/catch/finalize.
19906 * class.cs: Catch static methods having the flags override,
19907 virtual or abstract.
19909 * expression.cs (UserCast): This user cast was not really doing
19910 what it was supposed to do. Which is to be born in fully resolved
19911 state. Parts of the resolution were being performed at Emit time!
19915 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19917 * expression.cs: Implicity convert the result from UserCast.
19919 2001-10-05 Ravi Pratap <ravi@ximian.com>
19921 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
19922 prevented it from working correctly.
19924 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
19925 merely ConvertImplicit.
19927 2001-10-05 Miguel de Icaza <miguel@ximian.com>
19929 * typemanager.cs: Make the LookupTypeContainer function static,
19930 and not per-instance.
19932 * class.cs: Make static FindMembers (the one that takes a Type
19935 * codegen.cs: Add EmitForeach here.
19937 * cs-parser.jay: Make foreach a toplevel object instead of the
19938 inline expansion, as we need to perform semantic analysis on it.
19940 2001-10-05 Ravi Pratap <ravi@ximian.com>
19942 * expression.cs (Expression::ImplicitUserConversion): Rename to
19943 UserDefinedConversion.
19945 (Expression::UserDefinedConversion): Take an extra argument specifying
19946 whether we look for explicit user conversions too.
19948 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
19950 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
19952 (ExplicitUserConversion): Make it a call to UserDefinedConversion
19953 with the appropriate arguments.
19955 * cs-parser.jay (cast_expression): Record location too.
19957 * expression.cs (Cast): Record location info.
19959 (Expression::ConvertExplicit): Take location argument.
19961 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
19962 to determine if we are doing explicit conversions.
19964 (UserCast::Emit): Update accordingly.
19966 (Expression::ConvertExplicit): Report an error if everything fails.
19968 * ../errors/cs0030.cs : Add.
19970 2001-10-04 Miguel de Icaza <miguel@ximian.com>
19972 * modifiers.cs: If the ABSTRACT keyword is present, also set the
19973 virtual and newslot bits.
19975 * class.cs (TypeContainer::RegisterRequiredImplementations):
19976 Record methods we need.
19978 (TypeContainer::MakeKey): Helper function to make keys for
19979 MethodBases, since the Methodbase key is useless.
19981 (TypeContainer::Populate): Call RegisterRequiredImplementations
19982 before defining the methods.
19984 Create a mapping for method_builders_to_methods ahead of time
19985 instead of inside a tight loop.
19987 (::RequireMethods): Accept an object as the data to set into the
19988 hashtable so we can report interface vs abstract method mismatch.
19990 2001-10-03 Miguel de Icaza <miguel@ximian.com>
19992 * report.cs: Make all of it static.
19994 * rootcontext.cs: Drop object_type and value_type computations, as
19995 we have those in the TypeManager anyways.
19997 Drop report instance variable too, now it is a global.
19999 * driver.cs: Use try/catch on command line handling.
20001 Add --probe option to debug the error reporting system with a test
20004 * report.cs: Add support for exiting program when a probe
20005 condition is reached.
20007 2001-10-03 Ravi Pratap <ravi@ximian.com>
20009 * expression.cs (Binary::DoNumericPromotions): Fix the case when
20010 we do a forcible conversion regardless of type, to check if
20011 ForceConversion returns a null.
20013 (Binary::error19): Use location to report error.
20015 (Unary::error23): Use location here too.
20017 * ../errors/cs0019.cs : Check in.
20019 * ../errors/cs0023.cs : Check in.
20021 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
20022 case of a non-null MethodInfo object with a length of 0 !
20024 (Binary::ResolveOperator): Flag error if overload resolution fails to find
20025 an applicable member - according to the spec :-)
20026 Also fix logic to find members in base types.
20028 (Unary::ResolveOperator): Same here.
20030 (Unary::report23): Change name to error23 and make first argument a TypeContainer
20031 as I was getting thoroughly confused between this and error19 :-)
20033 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
20034 (::FindMostEncompassedType): Implement.
20035 (::FindMostEncompassingType): Implement.
20036 (::StandardConversionExists): Implement.
20038 (UserImplicitCast): Re-vamp. We now need info about most specific
20039 source and target types so that we can do the necessary conversions.
20041 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
20042 mathematical union with no duplicates.
20044 2001-10-03 Miguel de Icaza <miguel@ximian.com>
20046 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
20047 in order from base classes to child classes, so that we can in
20048 child classes look up in our parent for method names and
20049 attributes (required for handling abstract, virtual, new, override
20050 constructs: we need to instrospect our base class, and if we dont
20051 populate the classes in order, the introspection might be
20052 incorrect. For example, a method could query its parent before
20053 the parent has any methods and would determine that the parent has
20054 no abstract methods (while it could have had them)).
20056 (RootContext::CreateType): Record the order in which we define the
20059 2001-10-02 Miguel de Icaza <miguel@ximian.com>
20061 * class.cs (TypeContainer::Populate): Also method definitions can
20062 fail now, keep track of this.
20064 (TypeContainer::FindMembers): Implement support for
20065 DeclaredOnly/noDeclaredOnly flag.
20067 (Constructor::Emit) Return the ConstructorBuilder.
20069 (Method::Emit) Return the MethodBuilder.
20070 Check for abstract or virtual methods to be public.
20072 * rootcontext.cs (RootContext::CreateType): Register all the
20073 abstract methods required for the class to be complete and the
20074 interface methods that must be implemented.
20076 * cs-parser.jay: Report error 501 (method requires body if it is
20077 not marked abstract or extern).
20079 * expression.cs (TypeOf::Emit): Implement.
20081 * typemanager.cs: runtime_handle_type, new global type.
20083 * class.cs (Property::Emit): Generate code for properties.
20085 2001-10-02 Ravi Pratap <ravi@ximian.com>
20087 * expression.cs (Unary::ResolveOperator): Find operators on base type
20088 too - we now conform exactly to the spec.
20090 (Binary::ResolveOperator): Same here.
20092 * class.cs (Operator::Define): Fix minor quirk in the tests.
20094 * ../errors/cs0215.cs : Added.
20096 * ../errors/cs0556.cs : Added.
20098 * ../errors/cs0555.cs : Added.
20100 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20102 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
20103 single integer which is really efficient
20105 2001-10-01 Ravi Pratap <ravi@ximian.com>
20107 * expression.cs (Expression::ImplicitUserConversion): Use location
20108 even in the case when we are examining True operators.
20110 * class.cs (Operator::Define): Perform extensive checks to conform
20111 with the rules for operator overloading in the spec.
20113 * expression.cs (Expression::ImplicitReferenceConversion): Implement
20114 some of the other conversions mentioned in the spec.
20116 * typemanager.cs (array_type): New static member for the System.Array built-in
20119 (cloneable_interface): For System.ICloneable interface.
20121 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
20122 we start resolving the tree and populating types.
20124 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
20126 2001-10-01 Miguel de Icaza <miguel@ximian.com>
20128 * expression.cs (Expression::ExprClassFromMemberInfo,
20129 Expression::Literalize): Create literal expressions from
20130 FieldInfos which are literals.
20132 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
20133 type casts, because they were wrong. The test suite in tests
20136 (ImplicitNumericConversion): ushort to ulong requires a widening
20139 Int32 constant to long requires widening cast as well.
20141 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
20142 for integers because the type on the stack is not i4.
20144 2001-09-30 Miguel de Icaza <miguel@ximian.com>
20146 * expression.cs (report118): require location argument.
20148 * parameter.cs: Do not dereference potential null value.
20150 * class.cs: Catch methods that lack the `new' keyword when
20151 overriding a name. Report warnings when `new' is used without
20152 anything being there to override.
20154 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
20156 * class.cs: Only add constructor to hashtable if it is non-null
20157 (as now constructors can fail on define).
20159 (TypeManager, Class, Struct): Take location arguments.
20161 Catch field instance initialization in structs as errors.
20163 accepting_filter: a new filter for FindMembers that is static so
20164 that we dont create an instance per invocation.
20166 (Constructor::Define): Catch errors where a struct constructor is
20169 * cs-parser.jay: Pass location information for various new
20172 * delegate.cs (Delegate): take a location argument.
20174 * driver.cs: Do not call EmitCode if there were problesm in the
20175 Definition of the types, as many Builders wont be there.
20177 * decl.cs (Decl::Decl): Require a location argument.
20179 * cs-tokenizer.cs: Handle properly hex constants that can not fit
20180 into integers, and find the most appropiate integer for it.
20182 * literal.cs: Implement ULongLiteral.
20184 * rootcontext.cs: Provide better information about the location of
20185 failure when CreateType fails.
20187 2001-09-29 Miguel de Icaza <miguel@ximian.com>
20189 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
20192 * expression.cs (Binary::CheckShiftArguments): Add missing type
20194 (Binary::ResolveOperator): Add type to the logical and and logical
20195 or, Bitwise And/Or and Exclusive Or code paths, it was missing
20198 (Binary::DoNumericPromotions): In the case where either argument
20199 is ulong (and most signed types combined with ulong cause an
20200 error) perform implicit integer constant conversions as well.
20202 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20204 * expression.cs (UserImplicitCast): Method should always be
20206 (Invocation::BetterConversion): Simplified test for IntLiteral.
20208 (Expression::ImplicitNumericConversion): Split this routine out.
20209 Put the code that performs implicit constant integer conversions
20212 (Expression::Resolve): Become a wrapper around DoResolve so we can
20213 check eclass and type being set after resolve.
20215 (Invocation::Badness): Remove this dead function
20217 (Binary::ResolveOperator): Do not compute the expensive argumnets
20218 unless we have a union for it.
20220 (Probe::Emit): Is needs to do an isinst and then
20221 compare against null.
20223 (::CanConvert): Added Location argument. If the Location argument
20224 is null (Location.Null), then we do not report errors. This is
20225 used by the `probe' mechanism of the Explicit conversion. We do
20226 not want to generate an error for something that the user
20227 explicitly requested to be casted. But the pipeline for an
20228 explicit cast first tests for potential implicit casts.
20230 So for now, if the Location is null, it means `Probe only' to
20231 avoid adding another argument. Might have to revise this
20234 (ClassCast): New class used to type cast objects into arbitrary
20235 classes (used in Explicit Reference Conversions).
20237 Implement `as' as well.
20239 Reverted all the patches from Ravi below: they were broken:
20241 * The use of `level' as a mechanism to stop recursive
20242 invocations is wrong. That was there just to catch the
20243 bug with a strack trace but not as a way of addressing
20246 To fix the problem we have to *understand* what is going
20247 on and the interactions and come up with a plan, not
20248 just get things going.
20250 * The use of the type conversion cache that I proposed
20251 last night had an open topic: How does this work across
20252 protection domains. A user defined conversion might not
20253 be public in the location where we are applying the
20254 conversion, a different conversion might be selected
20255 (ie, private A->B (better) but public B->A (worse),
20256 inside A, A->B applies, but outside it, B->A will
20259 * On top of that (ie, even if the above is solved),
20260 conversions in a cache need to be abstract. Ie, `To
20261 convert from an Int to a Short use an OpcodeCast', not
20262 `To convert from an Int to a Short use the OpcodeCast on
20263 the variable 5' (which is what this patch was doing).
20265 2001-09-28 Ravi Pratap <ravi@ximian.com>
20267 * expression.cs (Invocation::ConversionExists): Re-write to use
20268 the conversion cache
20270 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
20271 cache all conversions done, not just user-defined ones.
20273 (Invocation::BetterConversion): The real culprit. Use ConversionExists
20274 to determine if a conversion exists instead of acutually trying to
20275 perform the conversion. It's faster too.
20277 (Expression::ConvertExplicit): Modify to use ConversionExists to check
20278 and only then attempt the implicit conversion.
20280 2001-09-28 Ravi Pratap <ravi@ximian.com>
20282 * expression.cs (ConvertImplicit): Use a cache for conversions
20283 already found. Check level of recursion and bail out if necessary.
20285 2001-09-28 Miguel de Icaza <miguel@ximian.com>
20287 * typemanager.cs (string_concat_string_string, string_concat_object_object):
20288 Export standard methods that we expect for string operations.
20290 * statement.cs (Block::UsageWarning): Track usage of variables and
20291 report the errors for not used variables.
20293 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
20296 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20298 * codegen.cs: remove unnneded code
20300 * expression.cs: Removed BuiltinTypeAccess class
20302 Fix the order in which implicit conversions are
20305 The previous fixed dropped support for boxed conversions (adding a
20306 test to the test suite now)
20308 (UserImplicitCast::CanConvert): Remove test for source being null,
20309 that code is broken. We should not feed a null to begin with, if
20310 we do, then we should track the bug where the problem originates
20311 and not try to cover it up here.
20313 Return a resolved expression of type UserImplicitCast on success
20314 rather than true/false. Ravi: this is what I was talking about,
20315 the pattern is to use a static method as a "constructor" for
20318 Also, do not create arguments until the very last minute,
20319 otherwise we always create the arguments even for lookups that
20320 will never be performed.
20322 (UserImplicitCast::Resolve): Eliminate, objects of type
20323 UserImplicitCast are born in a fully resolved state.
20325 * typemanager.cs (InitCoreTypes): Init also value_type
20326 (System.ValueType).
20328 * expression.cs (Cast::Resolve): First resolve the child expression.
20330 (LValue): Add new method AddressOf to be used by
20333 Change the argument of Store to take an EmitContext instead of an
20334 ILGenerator, because things like FieldExpr need to be able to call
20335 their children expression to generate the instance code.
20337 (Expression::Error, Expression::Warning): Sugar functions for
20340 (Expression::MemberLookup): Accept a TypeContainer instead of a
20341 Report as the first argument.
20343 (Expression::ResolvePrimary): Killed. I still want to improve
20344 this as currently the code is just not right.
20346 (Expression::ResolveMemberAccess): Simplify, but it is still
20349 (Unary::Resolve): Catch errors in AddressOf operators.
20351 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
20352 index to a byte for the short-version, or the compiler will choose
20353 the wrong Emit call, which generates the wrong data.
20355 (ParameterReference::Emit, ::Store): same.
20357 (FieldExpr::AddressOf): Implement.
20359 * typemanager.cs: TypeManager: made public variable instead of
20362 * driver.cs: document --fatal.
20364 * report.cs (ErrorMessage, WarningMessage): new names for the old
20365 Error and Warning classes.
20367 * cs-parser.jay (member_access): Turn built-in access to types
20368 into a normal simplename
20370 2001-09-27 Ravi Pratap <ravi@ximian.com>
20372 * expression.cs (Invocation::BetterConversion): Fix to cope
20373 with q being null, since this was introducing a bug.
20375 * expression.cs (ConvertImplicit): Do built-in conversions first.
20377 2001-09-27 Ravi Pratap <ravi@ximian.com>
20379 * expression.cs (UserImplicitCast::Resolve): Fix bug.
20381 2001-09-27 Ravi Pratap <ravi@ximian.com>
20383 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
20384 I had introduced long ago (what's new ?).
20386 * expression.cs (UserImplicitCast::CanConvert): Static method to do
20387 the work of all the checking.
20388 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20389 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
20391 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
20392 that is the right way.
20394 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
20395 overloading resolution. Use everywhere instead of cutting and pasting code.
20397 (Binary::ResolveOperator): Use MakeUnionSet.
20399 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
20400 we have to convert to bool types. Not complete yet.
20402 2001-09-27 Miguel de Icaza <miguel@ximian.com>
20404 * typemanager.cs (TypeManager::CSharpName): support ushort.
20406 * expression.cs (Expression::TryImplicitIntConversion): Attempts
20407 to provide an expression that performsn an implicit constant int
20408 conversion (section 6.1.6).
20409 (Expression::ConvertImplicitRequired): Reworked to include
20410 implicit constant expression conversions.
20412 (Expression::ConvertNumericExplicit): Finished.
20414 (Invocation::Emit): If InstanceExpression is null, then it means
20415 that we perform a call on this.
20417 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20419 * expression.cs (Unary::Emit): Remove some dead code.
20420 (Probe): Implement Resolve and Emit for `is'.
20421 (Expression::ConvertImplicitRequired): Attempt to do constant
20422 expression conversions here. Maybe should be moved to
20423 ConvertImplicit, but I am not sure.
20424 (Expression::ImplicitLongConstantConversionPossible,
20425 Expression::ImplicitIntConstantConversionPossible): New functions
20426 that tell whether is it possible to apply an implicit constant
20427 expression conversion.
20429 (ConvertNumericExplicit): Started work on explicit numeric
20432 * cs-parser.jay: Update operator constants.
20434 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
20435 (Parameters::GetSignature): Hook up VerifyArgs here.
20436 (Parameters::VerifyArgs): Verifies that no two arguments have the
20439 * class.cs (Operator): Update the operator names to reflect the
20440 ones that the spec expects (as we are just stringizing the
20443 * expression.cs (Unary::ResolveOperator): Fix bug: Use
20444 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
20445 previous usage did only work for our methods.
20446 (Expression::ConvertImplicit): Handle decimal implicit numeric
20447 conversions as well.
20448 (Expression::InternalTypeConstructor): Used to invoke constructors
20449 on internal types for default promotions.
20451 (Unary::Emit): Implement special handling for the pre/post
20452 increment/decrement for overloaded operators, as they need to have
20453 the same semantics as the other operators.
20455 (Binary::ResolveOperator): ditto.
20456 (Invocation::ConversionExists): ditto.
20457 (UserImplicitCast::Resolve): ditto.
20459 2001-09-26 Ravi Pratap <ravi@ximian.com>
20461 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
20462 operator, return after emitting body. Regression tests pass again !
20464 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
20465 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
20466 (Invocation::OverloadResolve): Ditto.
20467 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
20469 * everywhere : update calls to the above methods accordingly.
20471 2001-09-26 Miguel de Icaza <miguel@ximian.com>
20473 * assign.cs (Assign): Make it inherit from ExpressionStatement.
20475 * expression.cs (ExpressionStatement): New base class used for
20476 expressions that can appear in statements, so that we can provide
20477 an alternate path to generate expression that do not leave a value
20480 (Expression::Emit, and all the derivatives): We no longer return
20481 whether a value is left on the stack or not. Every expression
20482 after being emitted leaves a single value on the stack.
20484 * codegen.cs (EmitContext::EmitStatementExpression): Use the
20485 facilties of ExpressionStatement if possible.
20487 * cs-parser.jay: Update statement_expression.
20489 2001-09-25 Miguel de Icaza <miguel@ximian.com>
20491 * driver.cs: Change the wording of message
20493 2001-09-25 Ravi Pratap <ravi@ximian.com>
20495 * expression.cs (Binary::ResolveOperator): Had forgottten to set
20496 the type of the expression to the return type of the method if
20497 we have an overloaded operator match ! The regression tests pass again !
20498 (Unary::ResolveOperator): Ditto.
20500 * expression.cs (Invocation::ConversionExists): Correct the member lookup
20501 to find "op_Implicit", not "implicit" ;-)
20502 (UserImplicitCast): New class to take care of user-defined implicit conversions.
20503 (ConvertImplicit, ForceConversion): Take TypeContainer argument
20505 * everywhere : Correct calls to the above accordingly.
20507 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
20508 (ConvertImplicit): Do user-defined conversion if it exists.
20510 2001-09-24 Miguel de Icaza <miguel@ximian.com>
20512 * assign.cs: track location.
20513 (Resolve): Use implicit conversions on assignment.
20515 * literal.cs: Oops. Not good, Emit of short access values should
20516 pass (Bytes) or the wrong argument will be selected.
20518 * expression.cs (Unary::Emit): Emit code for -expr.
20520 (Unary::ResolveOperator): Handle `Substract' for non-constants
20521 (substract from zero from the non-constants).
20522 Deal with Doubles as well.
20524 (Expression::ConvertImplicitRequired): New routine that reports an
20525 error if no implicit conversion exists.
20527 (Invocation::OverloadResolve): Store the converted implicit
20528 expressions if we make them
20530 2001-09-24 Ravi Pratap <ravi@ximian.com>
20532 * class.cs (ConstructorInitializer): Take a Location argument.
20533 (ConstructorBaseInitializer): Same here.
20534 (ConstructorThisInitializer): Same here.
20536 * cs-parser.jay : Update all calls accordingly.
20538 * expression.cs (Unary, Binary, New): Take location argument.
20539 Update accordingly everywhere.
20541 * cs-parser.jay : Update all calls to the above to take a location
20544 * class.cs : Ditto.
20546 2001-09-24 Ravi Pratap <ravi@ximian.com>
20548 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
20549 (Invocation::BetterConversion): Same here
20550 (Invocation::ConversionExists): Ditto.
20552 (Invocation::ConversionExists): Implement.
20554 2001-09-22 Ravi Pratap <ravi@ximian.com>
20556 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
20557 Also take an additional TypeContainer argument.
20559 * All over : Pass in TypeContainer as argument to OverloadResolve.
20561 * typemanager.cs (CSharpName): Update to check for the string type and return
20564 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
20567 2001-09-21 Ravi Pratap <ravi@ximian.com>
20569 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
20570 (Invocation::BetterFunction): Implement.
20571 (Invocation::BetterConversion): Implement.
20572 (Invocation::ConversionExists): Skeleton, no implementation yet.
20574 Okay, things work fine !
20576 2001-09-21 Miguel de Icaza <miguel@ximian.com>
20578 * typemanager.cs: declare and load enum_type, delegate_type and
20581 * expression.cs (Expression::Emit): Now emit returns a value that
20582 tells whether a value is left on the stack or not. This strategy
20583 might be reveted tomorrow with a mechanism that would address
20584 multiple assignments.
20585 (Expression::report118): Utility routine to report mismatches on
20588 (Unary::Report23): Report impossible type/operator combination
20591 (Unary::IsIncrementableNumber): Whether the type can be
20592 incremented or decremented with add.
20593 (Unary::ResolveOperator): Also allow enumerations to be bitwise
20595 (Unary::ResolveOperator): Implement ++, !, ~,
20597 (Invocation::Emit): Deal with new Emit convetion.
20599 * All Expression derivatives: Updated their Emit method to return
20600 whether they leave values on the stack or not.
20602 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
20603 stack for expressions that are statements.
20605 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20607 * expression.cs (LValue): New interface. Must be implemented by
20609 (LocalVariableReference, ParameterReference, FieldExpr): Implement
20612 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
20613 interface for generating code, simplifies the code.
20615 2001-09-20 Ravi Pratap <ravi@ximian.com>
20617 * expression.cs (everywhere): Comment out return statements in ::Resolve
20618 methods to avoid the warnings.
20620 2001-09-20 Miguel de Icaza <miguel@ximian.com>
20622 * driver.cs (parse): Report error 2001 if we can not open the
20625 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
20628 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
20631 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
20632 otherwise nested blocks end up with the same index.
20634 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
20636 * expression.cs: Instead of having FIXMEs in the Resolve
20637 functions, throw exceptions so it is obvious that we are facing a
20640 * cs-parser.jay (invocation_expression): Pass Location information.
20642 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
20643 Use a basename for those routines because .NET does not like paths
20646 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
20649 2001-09-19 Miguel de Icaza <miguel@ximian.com>
20651 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
20652 are loading the correct data types (throws an exception if not).
20653 (TypeManager::InitCoreTypes): Use CoreLookupType
20655 * expression.cs (Unary::ResolveOperator): return the child
20656 expression for expressions which are just +expr.
20657 (Unary::ResolveOperator): Return negative literals for -LITERAL
20658 expressions (otherwise they are Unary {Literal}).
20659 (Invocation::Badness): Take into account `Implicit constant
20660 expression conversions'.
20662 * literal.cs (LongLiteral): Implement long literal class.
20663 (IntLiteral): export the `Value' of the intliteral.
20665 2001-09-19 Ravi Pratap <ravi@ximian.com>
20667 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
20669 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
20670 instead of 'Operator'
20672 * expression.cs (Binary::ResolveOperator): Update accordingly.
20673 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
20676 * cs-parser.jay (unary_expression): Update to use the new names.
20678 * gen-treedump.cs (GetUnary): Same here.
20680 * expression.cs (Unary::Resolve): Implement.
20681 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
20682 operators are found instead of making noise ;-)
20683 (Unary::ResolveOperator): New method to do precisely the same thing which
20684 Binary::ResolveOperator does for Binary expressions.
20685 (Unary.method, .Arguments): Add.
20686 (Unary::OperName): Implement.
20687 (Unary::ForceConversion): Copy and Paste !
20689 * class.cs (Operator::Define): Fix a small bug for the case when we have
20692 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
20693 for the inbuilt operators. Only overloading works for now ;-)
20695 2001-09-18 Miguel de Icaza <miguel@ximian.com>
20697 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
20698 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
20700 * expression.cs (This::Emit): Implement.
20701 (This::Resolve): Implement.
20702 (TypeOf:Resolve): Implement.
20703 (Expression::ResolveSimpleName): Add an implicit this to instance
20705 (MemberAccess::Resolve): Deal with Parameters and Fields.
20706 Bind instance variable to Field expressions.
20707 (FieldExpr::Instance): New field used to track the expression that
20708 represents the object instance.
20709 (FieldExpr::Resolve): Track potential errors from MemberLookup not
20711 (FieldExpr::Emit): Implement.
20713 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
20714 the last instruction contains a return opcode to avoid generating
20715 the last `ret' instruction (this generates correct code, and it is
20716 nice to pass the peverify output).
20718 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
20719 initializer for static and instance variables.
20720 (Constructor::Emit): Allow initializer to be null in the case of
20721 static constructors. Only emit initializer for instance
20724 (TypeContainer::FindMembers): Return a null array if there are no
20727 Also fix the code for the MemberTypes.Method branch, as it was not
20728 scanning that for operators (or tried to access null variables before).
20730 * assign.cs (Assign::Emit): Handle instance and static fields.
20734 * driver.cs: Stop compilation if there are parse errors.
20736 * cs-parser.jay (constructor_declaration): Provide default base
20737 initializer for non-static constructors.
20738 (constructor_declarator): Do not provide a default base
20739 initializers if none was specified.
20740 Catch the fact that constructors should not have parameters.
20742 * class.cs: Do not emit parent class initializers for static
20743 constructors, that should be flagged as an error.
20745 2001-09-18 Ravi Pratap <ravi@ximian.com>
20747 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
20748 Move back code into TypeContainer::Populate.
20750 2001-09-18 Ravi Pratap <ravi@ximian.com>
20752 * class.cs (TypeContainer::AddConstructor): Fix the check to
20753 compare against Name, not Basename.
20754 (Operator::OpType): Change Plus and Minus to Add and Subtract.
20756 * cs-parser.jay : Update accordingly.
20758 * class.cs (TypeContainer::FindMembers): For the case where we are searching
20759 for methods, don't forget to look into the operators too.
20760 (RegisterMethodBuilder): Helper method to take care of this for
20761 methods, constructors and operators.
20762 (Operator::Define): Completely revamp.
20763 (Operator.OperatorMethod, MethodName): New fields.
20764 (TypeContainer::Populate): Move the registering of builders into
20765 RegisterMethodBuilder.
20766 (Operator::Emit): Re-write.
20768 * expression.cs (Binary::Emit): Comment out code path to emit method
20769 invocation stuff for the case when we have a user defined operator. I am
20770 just not able to get it right !
20772 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20774 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
20777 (Expression::MemberLookup): Provide a version that allows to
20778 specify the MemberTypes and BindingFlags.
20780 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
20781 so it was not fetching variable information from outer blocks.
20783 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
20784 Beforefieldinit as it was buggy.
20786 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
20787 that Ravi put here.
20789 * class.cs (Constructor::Emit): Only emit if block is not null.
20790 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
20791 deal with this by semantically definining it as if the user had
20794 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
20795 constructors as we now "emit" them at a higher level.
20797 (TypeContainer::DefineDefaultConstructor): Used to define the
20798 default constructors if none was provided.
20800 (ConstructorInitializer): Add methods Resolve and Emit.
20802 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
20804 2001-09-17 Ravi Pratap <ravi@ximian.com>
20806 * class.cs (TypeContainer::EmitDefaultConstructor): Register
20807 the default constructor builder with our hashtable for methodbuilders
20810 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
20811 and argument_count is 0 in which case we have a match.
20812 (Binary::ResolveOperator): More null checking and miscellaneous coding
20815 2001-09-17 Ravi Pratap <ravi@ximian.com>
20817 * rootcontext.cs (IsNameSpace): Compare against null.
20819 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
20821 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
20822 and Unary::Operator.
20824 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
20827 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
20828 we have overloaded operators.
20829 (Binary::ResolveOperator): Implement the part which does the operator overload
20832 * class.cs (Operator::Emit): Implement.
20833 (TypeContainer::Emit): Emit the operators we have too.
20835 * expression.cs (Binary::Emit): Update to emit the appropriate code for
20836 the case when we have a user-defined operator.
20838 2001-09-17 Miguel de Icaza <miguel@ximian.com>
20840 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
20842 2001-09-16 Ravi Pratap <ravi@ximian.com>
20844 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
20845 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
20846 (Constructor::Emit): Implement.
20847 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
20848 if we have no work to do.
20849 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
20852 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
20853 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
20855 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
20858 2001-09-15 Ravi Pratap <ravi@ximian.com>
20860 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
20862 (Tree::RecordNamespace): Method to do what the name says ;-)
20863 (Tree::Namespaces): Property to get at the namespaces hashtable.
20865 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
20868 * rootcontext.cs (IsNamespace): Fixed it :-)
20870 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20872 * class.cs (TypeContainer::FindMembers): Add support for
20874 (MethodCore): New class that encapsulates both the shared aspects
20875 of a Constructor and a Method.
20876 (Method, Constructor): Factored pieces into MethodCore.
20878 * driver.cs: Added --fatal which makes errors throw exceptions.
20879 Load System assembly as well as part of the standard library.
20881 * report.cs: Allow throwing exceptions on errors for debugging.
20883 * modifiers.cs: Do not use `parent', instead use the real type
20884 container to evaluate permission settings.
20886 * class.cs: Put Ravi's patch back in. He is right, and we will
20887 have to cope with the
20889 2001-09-14 Ravi Pratap <ravi@ximian.com>
20891 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
20892 FamORAssem, not FamANDAssem.
20894 2001-09-14 Miguel de Icaza <miguel@ximian.com>
20896 * driver.cs: Added --parse option that only parses its input files
20899 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
20900 incorrect. IsTopLevel is not used to tell whether an object is
20901 root_types or not (that can be achieved by testing this ==
20902 root_types). But to see if this is a top-level *class* (not
20903 necessarly our "toplevel" container).
20905 2001-09-14 Ravi Pratap <ravi@ximian.com>
20907 * enum.cs (Enum::Define): Modify to call the Lookup method on the
20908 parent instead of a direct call to GetType.
20910 2001-09-14 Ravi Pratap <ravi@ximian.com>
20912 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
20913 Modifiers.TypeAttr. This should just be a call to that method.
20915 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
20916 object so that we can determine if we are top-level or not.
20918 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
20921 * enum.cs (Enum::Define): Ditto.
20923 * modifiers.cs (FieldAttr): Re-write.
20925 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
20926 (TypeContainer::HaveStaticConstructor): New property to provide access
20927 to precisely that info.
20929 * modifiers.cs (MethodAttr): Re-write.
20930 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
20932 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
20933 of top-level types as claimed.
20935 2001-09-13 Miguel de Icaza <miguel@ximian.com>
20937 * expression.cs (MemberLookup): Fruitless attempt to lookup
20938 constructors. Maybe I need to emit default constructors? That
20939 might be it (currently .NET emits this for me automatically).
20940 (Invocation::OverloadResolve): Cope with Arguments == null.
20941 (Invocation::EmitArguments): new function, shared by the new
20942 constructor and us.
20943 (Invocation::Emit): Handle static and instance methods. Emit
20944 proper call instruction for virtual or non-virtual invocations.
20945 (New::Emit): Implement.
20946 (New::Resolve): Implement.
20947 (MemberAccess:Resolve): Implement.
20948 (MethodGroupExpr::InstanceExpression): used conforming to the spec
20949 to track instances.
20950 (FieldExpr::Resolve): Set type.
20952 * support.cs: Handle empty arguments.
20954 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
20955 SimpleLookup): Auxiliary routines to help parse a qualifier
20958 Update qualifier_identifier rule.
20960 * codegen.cs: Removed debugging messages.
20962 * class.cs: Make this a global thing, this acts just as a "key" to
20963 objects that we might have around.
20965 (Populate): Only initialize method_builders_to_methods once.
20967 * expression.cs (PropertyExpr): Initialize type from the
20970 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
20971 Resolve pattern. Attempt to implicitly convert value to boolean.
20974 * expression.cs: Set the type for the int32/int32 argument case.
20975 (Binary::ResolveOperator): Set the return type to boolean for
20976 comparission operators
20978 * typemanager.cs: Remove debugging print code.
20980 (Invocation::Resolve): resolve type.
20982 * class.cs: Allocate a MemberInfo of the correct size, as the code
20983 elsewhere depends on the test to reflect the correct contents.
20985 (Method::) Keep track of parameters, due to System.Reflection holes
20987 (TypeContainer::Populate): Keep track of MethodBuilders to Method
20990 (TypeContainer::FindMembers): Use ArrayList and then copy an array
20991 of the exact size and return that.
20993 (Class::LookupMethodByBuilder): New function that maps
20994 MethodBuilders to its methods. Required to locate the information
20995 on methods because System.Reflection bit us again.
20997 * support.cs: New file, contains an interface ParameterData and
20998 two implementations: ReflectionParameters and InternalParameters
20999 used to access Parameter information. We will need to grow this
21002 * expression.cs (Invocation::GetParameterData): implement a cache
21003 and a wrapper around the ParameterData creation for methods.
21004 (Invocation::OverloadResolve): Use new code.
21006 2001-09-13 Ravi Pratap <ravi@ximian.com>
21008 * class.cs (TypeContainer::EmitField): Remove and move into
21009 (Field::Define): here and modify accordingly.
21010 (Field.FieldBuilder): New member.
21011 (TypeContainer::Populate): Update accordingly.
21012 (TypeContainer::FindMembers): Implement.
21014 2001-09-13 Miguel de Icaza <miguel@ximian.com>
21016 * statement.cs: (VariableInfo::VariableType): New field to be
21017 initialized with the full type once it is resolved.
21019 2001-09-12 Miguel de Icaza <miguel@ximian.com>
21021 * parameter.cs (GetParameterInfo): Use a type cache to compute
21022 things only once, and to reuse this information
21024 * expression.cs (LocalVariableReference::Emit): Implement.
21025 (OpcodeCast::Emit): fix.
21027 (ParameterReference::Resolve): Implement.
21028 (ParameterReference::Emit): Implement.
21030 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
21031 that are expressions need to stay as Expressions.
21033 * typemanager.cs (CSharpName): Returns the C# name of a type if
21036 * expression.cs (Expression::ConvertImplicit): New function that
21037 implements implicit type conversions.
21039 (Expression::ImplicitReferenceConversion): Implements implicit
21040 reference conversions.
21042 (EmptyCast): New type for transparent casts.
21044 (OpcodeCast): New type for casts of types that are performed with
21045 a sequence of bytecodes.
21047 (BoxedCast): New type used for casting value types into reference
21048 types. Emits a box opcode.
21050 (Binary::DoNumericPromotions): Implements numeric promotions of
21051 and computation of the Binary::Type.
21053 (Binary::EmitBranchable): Optimization.
21055 (Binary::Emit): Implement code emission for expressions.
21057 * typemanager.cs (TypeManager): Added two new core types: sbyte
21060 2001-09-12 Ravi Pratap <ravi@ximian.com>
21062 * class.cs (TypeContainer::FindMembers): Method which does exactly
21063 what Type.FindMembers does, only we don't have to use reflection. No
21064 implementation yet.
21066 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
21067 typecontainer objects as we need to get at them.
21068 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
21070 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
21071 typecontainer object.
21073 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
21074 of just a Report object.
21076 2001-09-11 Ravi Pratap <ravi@ximian.com>
21078 * class.cs (Event::Define): Go back to using the prefixes "add_" and
21080 (TypeContainer::Populate): Now define the delegates of the type too.
21081 (TypeContainer.Delegates): Property to access the list of delegates defined
21084 * delegates.cs (Delegate::Define): Implement partially.
21086 * modifiers.cs (TypeAttr): Handle more flags.
21088 2001-09-11 Ravi Pratap <ravi@ximian.com>
21090 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
21092 (Operator::Define): Re-write logic to get types by using the LookupType method
21093 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
21094 (Indexer::Define): Ditto.
21095 (Event::Define): Ditto.
21096 (Property::Define): Ditto.
21098 2001-09-10 Ravi Pratap <ravi@ximian.com>
21100 * class.cs (TypeContainer::Populate): Now define operators too.
21101 (TypeContainer.Operators): New property to access the list of operators
21103 (Operator.OperatorMethodBuilder): New member to hold the method builder
21104 for the operator we are defining.
21105 (Operator::Define): Implement.
21107 2001-09-10 Ravi Pratap <ravi@ximian.com>
21109 * class.cs (Event::Define): Make the prefixes of the accessor methods
21110 addOn_ and removeOn_
21112 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
21113 of the location being passed in too. Ideally, this should go later since all
21114 error reporting should be done through the Report object.
21116 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
21117 (Populate): Iterate thru the indexers we have and define them too.
21118 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
21119 for the get and set accessors.
21120 (Indexer::Define): Implement.
21122 2001-09-09 Miguel de Icaza <miguel@ximian.com>
21124 * expression.cs (Binary::Resolve): Beginning of it. I scratched
21125 my previous implementation, did not work.
21127 * typemanager.cs: Add a couple of missing types (the longs).
21129 * literal.cs: Use TypeManager.bool_type instead of getting it.
21131 * expression.cs (EventExpr): New kind of expressions.
21132 (Expressio::ExprClassFromMemberInfo): finish
21134 2001-09-08 Miguel de Icaza <miguel@ximian.com>
21136 * assign.cs: Emit stores to static fields differently.
21138 2001-09-08 Ravi Pratap <ravi@ximian.com>
21140 * Merge in changes and adjust code to tackle conflicts. Backed out my
21141 code in Assign::Resolve ;-)
21143 2001-09-08 Ravi Pratap <ravi@ximian.com>
21145 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
21146 instead Report.Error and also pass in the location.
21147 (CSharpParser::Lexer): New readonly property to return the reference
21148 to the Tokenizer object.
21149 (declare_local_variables): Use Report.Error with location instead of plain
21153 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
21154 (Operator.CheckBinaryOperator): Ditto.
21156 * cs-parser.jay (operator_declarator): Update accordingly.
21158 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
21159 (CheckBinaryOperator): Same here.
21161 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
21162 on the name without any prefixes of namespace names etc. This is because we
21163 already might have something already fully qualified like
21164 'System.Console.WriteLine'
21166 * assign.cs (Resolve): Begin implementation. Stuck ;-)
21168 2001-09-07 Ravi Pratap <ravi@ximian.com>
21170 * cs-tokenizer.cs (location): Return a string which also contains
21173 * expression.cs (ElementAccess): New class for expressions of the
21174 type 'element access.'
21175 (BaseAccess): New class for expressions of the type 'base access.'
21176 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
21179 * cs-parser.jay (element_access): Implement action.
21180 (base_access): Implement actions.
21181 (checked_expression, unchecked_expression): Implement.
21183 * cs-parser.jay (local_variable_type): Correct and implement.
21184 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
21186 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
21188 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
21189 name and the specifiers.
21191 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
21193 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
21194 making them all public ;-)
21196 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
21199 2001-09-07 Miguel de Icaza <miguel@ximian.com>
21201 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
21203 (FieldExpr, PropertyExprs): New resolved expressions.
21204 (SimpleName::MemberStaticCheck): Perform static checks for access
21205 to non-static fields on static methods. Maybe this should be
21206 generalized for MemberAccesses.
21207 (SimpleName::ResolveSimpleName): More work on simple name
21210 * cs-parser.jay (primary_expression/qualified_identifier): track
21211 the parameter index.
21213 * codegen.cs (CodeGen::Save): Catch save exception, report error.
21214 (EmitContext::EmitBoolExpression): Chain to expression generation
21215 instead of temporary hack.
21216 (::EmitStatementExpression): Put generic expression code generation.
21218 * assign.cs (Assign::Emit): Implement variable assignments to
21219 local variables, parameters and fields.
21221 2001-09-06 Miguel de Icaza <miguel@ximian.com>
21223 * statement.cs (Block::GetVariableInfo): New method, returns the
21224 VariableInfo for a variable name in a block.
21225 (Block::GetVariableType): Implement in terms of GetVariableInfo
21227 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
21228 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
21230 2001-09-06 Ravi Pratap <ravi@ximian.com>
21232 * cs-parser.jay (operator_declaration): Continue on my quest : update
21233 to take attributes argument.
21234 (event_declaration): Ditto.
21235 (enum_declaration): Ditto.
21236 (indexer_declaration): Ditto.
21238 * class.cs (Operator::Operator): Update constructor accordingly.
21239 (Event::Event): Ditto.
21241 * delegate.cs (Delegate::Delegate): Same here.
21243 * enum.cs (Enum::Enum): Same here.
21245 2001-09-05 Ravi Pratap <ravi@ximian.com>
21247 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
21249 * ../tests/cs0658.cs : New file to demonstrate error 0658.
21251 * attribute.cs (Attributes): New class to encapsulate all attributes which were
21252 being passed around as an arraylist.
21253 (Attributes::AddAttribute): Method to add attribute sections.
21255 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
21256 (struct_declaration): Update accordingly.
21257 (constant_declaration): Update.
21258 (field_declaration): Update.
21259 (method_header): Update.
21260 (fixed_parameter): Update.
21261 (parameter_array): Ditto.
21262 (property_declaration): Ditto.
21263 (destructor_declaration): Ditto.
21265 * class.cs (Struct::Struct): Update constructors accordingly.
21266 (Class::Class): Ditto.
21267 (Field::Field): Ditto.
21268 (Method::Method): Ditto.
21269 (Property::Property): Ditto.
21270 (TypeContainer::OptAttribute): update property's return type.
21272 * interface.cs (Interface.opt_attributes): New member.
21273 (Interface::Interface): Update to take the extra Attributes argument.
21275 * parameter.cs (Parameter::Parameter): Ditto.
21277 * constant.cs (Constant::Constant): Ditto.
21279 * interface.cs (InterfaceMemberBase): New OptAttributes field.
21280 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
21281 the attributes as a parameter.
21282 (InterfaceProperty): Update constructor call.
21283 (InterfaceEvent): Ditto.
21284 (InterfaceMethod): Ditto.
21285 (InterfaceIndexer): Ditto.
21287 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
21288 pass the attributes too.
21289 (interface_event_declaration): Ditto.
21290 (interface_property_declaration): Ditto.
21291 (interface_method_declaration): Ditto.
21292 (interface_declaration): Ditto.
21294 2001-09-05 Miguel de Icaza <miguel@ximian.com>
21296 * class.cs (Method::Define): Track the "static Main" definition to
21297 create an entry point.
21299 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
21300 EntryPoint if we find it.
21302 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
21303 (EmitContext::ig): Make this variable public.
21305 * driver.cs: Make the default output file be the first file name
21306 with the .exe extension.
21308 Detect empty compilations
21310 Handle various kinds of output targets. Handle --target and
21311 rename -t to --dumper.
21313 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
21314 methods inherited from Expression return now an Expression. This
21315 will is used during the tree rewriting as we resolve them during
21318 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
21319 the spec. Missing entirely is the information about
21320 accessability of elements of it.
21322 (Expression::ExprClassFromMemberInfo): New constructor for
21323 Expressions that creates a fully initialized Expression based on
21324 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
21327 (Invocation::Resolve): Begin implementing resolution of invocations.
21329 * literal.cs (StringLiteral): Implement Emit.
21331 2001-09-05 Ravi Pratap <ravi@ximian.com>
21333 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
21336 2001-09-04 Ravi Pratap <ravi@ximian.com>
21338 * cs-parser.jay (attribute_arguments): Implement actions.
21339 (attribute): Fix bug in production. Implement action.
21340 (attribute_list): Implement.
21341 (attribute_target): Implement.
21342 (attribute_target_specifier, opt_target_specifier): Implement
21343 (CheckAttributeTarget): New method to check if the attribute target
21345 (attribute_section): Implement.
21346 (opt_attributes): Implement.
21348 * attribute.cs : New file to handle attributes.
21349 (Attribute): Class to hold attribute info.
21351 * cs-parser.jay (opt_attribute_target_specifier): Remove production
21352 (attribute_section): Modify production to use 2 different rules to
21353 achieve the same thing. 1 s/r conflict down !
21354 Clean out commented, useless, non-reducing dimension_separator rules.
21356 * class.cs (TypeContainer.attributes): New member to hold list
21357 of attributes for a type.
21358 (Struct::Struct): Modify to take one more argument, the attribute list.
21359 (Class::Class): Ditto.
21360 (Field::Field): Ditto.
21361 (Method::Method): Ditto.
21362 (Property::Property): Ditto.
21364 * cs-parser.jay (struct_declaration): Update constructor call to
21365 pass in the attributes too.
21366 (class_declaration): Ditto.
21367 (constant_declaration): Ditto.
21368 (field_declaration): Ditto.
21369 (method_header): Ditto.
21370 (fixed_parameter): Ditto.
21371 (parameter_array): Ditto.
21372 (property_declaration): Ditto.
21374 * constant.cs (Constant::Constant): Update constructor similarly.
21375 Use System.Collections.
21377 * parameter.cs (Parameter::Parameter): Update as above.
21379 2001-09-02 Ravi Pratap <ravi@ximian.com>
21381 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
21382 (TypeContainer.delegates): New member to hold list of delegates.
21384 * cs-parser.jay (delegate_declaration): Implement the action correctly
21385 this time as I seem to be on crack ;-)
21387 2001-09-02 Miguel de Icaza <miguel@ximian.com>
21389 * rootcontext.cs (RootContext::IsNamespace): new function, used to
21390 tell whether an identifier represents a namespace.
21392 * expression.cs (NamespaceExpr): A namespace expression, used only
21393 temporarly during expression resolution.
21394 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
21395 utility functions to resolve names on expressions.
21397 2001-09-01 Miguel de Icaza <miguel@ximian.com>
21399 * codegen.cs: Add hook for StatementExpressions.
21401 * class.cs: Fix inverted test for static flag in methods.
21403 2001-09-02 Ravi Pratap <ravi@ximian.com>
21405 * class.cs (Operator::CheckUnaryOperator): Correct error number used
21406 to make it coincide with MS' number.
21407 (Operator::CheckBinaryOperator): Ditto.
21409 * ../errors/errors.txt : Remove error numbers added earlier.
21411 * ../errors/cs1019.cs : Test case for error # 1019
21413 * ../errros/cs1020.cs : Test case for error # 1020
21415 * cs-parser.jay : Clean out commented cruft.
21416 (dimension_separators, dimension_separator): Comment out. Ostensibly not
21417 used anywhere - non-reducing rule.
21418 (namespace_declarations): Non-reducing rule - comment out.
21420 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
21421 with TypeContainer::AddEnum.
21423 * delegate.cs : New file for delegate handling classes.
21424 (Delegate): Class for declaring delegates.
21426 * makefile : Update.
21428 * cs-parser.jay (delegate_declaration): Implement.
21430 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
21432 * class.cs (Event::Define): Implement.
21433 (Event.EventBuilder): New member.
21435 * class.cs (TypeContainer::Populate): Update to define all enums and events
21437 (Events): New property for the events arraylist we hold. Shouldn't we move to using
21438 readonly fields for all these cases ?
21440 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21442 * class.cs (Property): Revamp to use the convention of making fields readonly.
21443 Accordingly modify code elsewhere.
21445 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
21446 the Define method of the Property class.
21448 * class.cs : Clean up applied patch and update references to variables etc. Fix
21450 (TypeContainer::Populate): Update to define all the properties we have. Also
21451 define all enumerations.
21453 * enum.cs (Define): Implement.
21455 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
21457 * cs-parser.jay (overloadable_operator): The semantic value is an
21458 enum of the Operator class.
21459 (operator_declarator): Implement actions.
21460 (operator_declaration): Implement.
21462 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
21463 validity of definitions.
21464 (Operator::CheckBinaryOperator): Static method to check for binary operators
21465 (TypeContainer::AddOperator): New method to add an operator to a type.
21467 * cs-parser.jay (indexer_declaration): Added line to actually call the
21468 AddIndexer method so it gets added ;-)
21470 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
21471 already taken care of by the MS compiler ?
21473 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21475 * class.cs (Operator): New class for operator declarations.
21476 (Operator::OpType): Enum for the various operators.
21478 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
21480 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
21481 ostensibly handle this in semantic analysis.
21483 * cs-parser.jay (general_catch_clause): Comment out
21484 (specific_catch_clauses, specific_catch_clause): Ditto.
21485 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
21486 (catch_args, opt_catch_args): New productions.
21487 (catch_clause): Rewrite to use the new productions above
21488 (catch_clauses): Modify accordingly.
21489 (opt_catch_clauses): New production to use in try_statement
21490 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
21491 and re-write the code in the actions to extract the specific and
21492 general catch clauses by being a little smart ;-)
21494 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
21495 Hooray, try and catch statements parse fine !
21497 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21499 * statement.cs (Block::GetVariableType): Fix logic to extract the type
21500 string from the hashtable of variables.
21502 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
21503 I end up making that mistake ;-)
21504 (catch_clauses): Fixed gross error which made Key and Value of the
21505 DictionaryEntry the same : $1 !!
21507 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21509 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
21511 * cs-parser.jay (event_declaration): Correct to remove the semicolon
21512 when the add and remove accessors are specified.
21514 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
21516 * cs-parser.jay (IndexerDeclaration): New helper class to hold
21517 information about indexer_declarator.
21518 (indexer_declarator): Implement actions.
21519 (parsing_indexer): New local boolean used to keep track of whether
21520 we are parsing indexers or properties. This is necessary because
21521 implicit_parameters come into picture even for the get accessor in the
21522 case of an indexer.
21523 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
21525 * class.cs (Indexer): New class for indexer declarations.
21526 (TypeContainer::AddIndexer): New method to add an indexer to a type.
21527 (TypeContainer::indexers): New member to hold list of indexers for the
21530 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21532 * cs-parser.jay (add_accessor_declaration): Implement action.
21533 (remove_accessor_declaration): Implement action.
21534 (event_accessors_declaration): Implement
21535 (variable_declarators): swap statements for first rule - trivial.
21537 * class.cs (Event): New class to hold information about event
21539 (TypeContainer::AddEvent): New method to add an event to a type
21540 (TypeContainer::events): New member to hold list of events.
21542 * cs-parser.jay (event_declaration): Implement actions.
21544 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
21546 * cs-parser.jay (dim_separators): Implement. Make it a string
21547 concatenating all the commas together, just as they appear.
21548 (opt_dim_separators): Modify accordingly
21549 (rank_specifiers): Update accordingly. Basically do the same
21550 thing - instead, collect the brackets here.
21551 (opt_rank_sepcifiers): Modify accordingly.
21552 (array_type): Modify to actually return the complete type string
21553 instead of ignoring the rank_specifiers.
21554 (expression_list): Implement to collect the expressions
21555 (variable_initializer): Implement. We make it a list of expressions
21556 essentially so that we can handle the array_initializer case neatly too.
21557 (variable_initializer_list): Implement.
21558 (array_initializer): Make it a list of variable_initializers
21559 (opt_array_initializer): Modify accordingly.
21561 * expression.cs (New::NType): Add enumeration to help us
21562 keep track of whether we have an object/delegate creation
21563 or an array creation.
21564 (New:NewType, New::Rank, New::Indices, New::Initializers): New
21565 members to hold data about array creation.
21566 (New:New): Modify to update NewType
21567 (New:New): New Overloaded contructor for the array creation
21570 * cs-parser.jay (array_creation_expression): Implement to call
21571 the overloaded New constructor.
21573 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
21575 * class.cs (TypeContainer::Constructors): Return member
21576 constructors instead of returning null.
21578 2001-08-26 Miguel de Icaza <miguel@ximian.com>
21580 * typemanager.cs (InitCoreTypes): Initialize the various core
21581 types after we have populated the type manager with the user
21582 defined types (this distinction will be important later while
21583 compiling corlib.dll)
21585 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
21586 on Expression Classification. Now all expressions have a method
21587 `Resolve' and a method `Emit'.
21589 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
21590 generation from working. Also add some temporary debugging
21593 2001-08-24 Miguel de Icaza <miguel@ximian.com>
21595 * codegen.cs: Lots of code generation pieces. This is only the
21596 beginning, will continue tomorrow with more touches of polish. We
21597 handle the fundamentals of if, while, do, for, return. Others are
21598 trickier and I need to start working on invocations soon.
21600 * gen-treedump.cs: Bug fix, use s.Increment here instead of
21603 * codegen.cs (EmitContext): New struct, used during code
21604 emission to keep a context. Most of the code generation will be
21607 * cs-parser.jay: Add embedded blocks to the list of statements of
21608 this block. So code generation proceeds in a top down fashion.
21610 2001-08-23 Miguel de Icaza <miguel@ximian.com>
21612 * statement.cs: Add support for multiple child blocks.
21614 2001-08-22 Miguel de Icaza <miguel@ximian.com>
21616 * codegen.cs (EmitCode): New function, will emit the code for a
21617 Block of code given a TypeContainer and its ILGenerator.
21619 * statement.cs (Block): Standard public readonly optimization.
21620 (Block::Block constructors): Link children.
21621 (Block::Child): Child Linker.
21622 (Block::EmitVariables): Emits IL variable declarations.
21624 * class.cs: Drop support for MethodGroups here, delay until
21626 (Method::): Applied the same simplification that I did before, and
21627 move from Properties to public readonly fields.
21628 (Method::ParameterTypes): Returns the parameter types for the
21629 function, and implements a cache that will be useful later when I
21630 do error checking and the semantic analysis on the methods is
21632 (Constructor::GetCallingConvention): Renamed from CallingConvetion
21633 and made a method, optional argument tells whether this is a class
21634 or a structure to apply the `has-this' bit.
21635 (Method::GetCallingConvention): Implement, returns the calling
21637 (Method::Define): Defines the type, a second pass is performed
21638 later to populate the methods.
21640 (Constructor::ParameterTypes): implement a cache similar to the
21641 one on Method::ParameterTypes, useful later when we do semantic
21644 (TypeContainer::EmitMethod): New method. Emits methods.
21646 * expression.cs: Removed MethodGroup class from here.
21648 * parameter.cs (Parameters::GetCallingConvention): new method.
21650 2001-08-21 Miguel de Icaza <miguel@ximian.com>
21652 * class.cs (TypeContainer::Populate): Drop RootContext from the
21655 (Constructor::CallingConvention): Returns the calling convention.
21656 (Constructor::ParameterTypes): Returns the constructor parameter
21659 (TypeContainer::AddConstructor): Keep track of default constructor
21660 and the default static constructor.
21662 (Constructor::) Another class that starts using `public readonly'
21663 instead of properties.
21665 (Constructor::IsDefault): Whether this is a default constructor.
21667 (Field::) use readonly public fields instead of properties also.
21669 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
21670 track of static constructors; If none is used, turn on
21671 BeforeFieldInit in the TypeAttributes.
21673 * cs-parser.jay (opt_argument_list): now the return can be null
21674 for the cases where there are no arguments.
21676 (constructor_declarator): If there is no implicit `base' or
21677 `this', then invoke the default parent constructor.
21679 * modifiers.cs (MethodAttr): New static function maps a set of
21680 modifiers flags into a MethodAttributes enum
21681 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
21682 MethodAttr, TypeAttr to represent the various mappings where the
21683 modifiers are used.
21684 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
21686 2001-08-19 Miguel de Icaza <miguel@ximian.com>
21688 * parameter.cs (GetParameterInfo): Fix bug where there would be no
21691 * interface.cs (PopulateIndexer): Implemented the code generator
21692 for interface indexers.
21694 2001-08-17 Miguel de Icaza <miguel@ximian.com>
21696 * interface.cs (InterfaceMemberBase): Now we track the new status
21699 (PopulateProperty): Implement property population. Woohoo! Got
21700 Methods and Properties going today.
21702 Removed all the properties for interfaces, and replaced them with
21703 `public readonly' fields.
21705 2001-08-16 Miguel de Icaza <miguel@ximian.com>
21707 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
21708 initialize their hashtables/arraylists only when they are needed
21709 instead of doing this always.
21711 * parameter.cs: Handle refs and out parameters.
21713 * cs-parser.jay: Use an ArrayList to construct the arguments
21714 instead of the ParameterCollection, and then cast that to a
21717 * parameter.cs: Drop the use of ParameterCollection and use
21718 instead arrays of Parameters.
21720 (GetParameterInfo): Use the Type, not the Name when resolving
21723 2001-08-13 Miguel de Icaza <miguel@ximian.com>
21725 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
21726 and instead use public readonly fields.
21728 * class.cs: Put back walking code for type containers.
21730 2001-08-11 Miguel de Icaza <miguel@ximian.com>
21732 * class.cs (MakeConstant): Code to define constants.
21734 * rootcontext.cs (LookupType): New function. Used to locate types
21737 2001-08-08 Miguel de Icaza <miguel@ximian.com>
21739 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
21740 this System.Reflection code is. Kudos to Microsoft
21742 * typemanager.cs: Implement a type cache and avoid loading all
21743 types at boot time. Wrap in LookupType the internals. This made
21744 the compiler so much faster. Wow. I rule!
21746 * driver.cs: Make sure we always load mscorlib first (for
21747 debugging purposes, nothing really important).
21749 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
21750 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
21752 * rootcontext.cs: Lookup types on their namespace; Lookup types
21753 on namespaces that have been imported using the `using' keyword.
21755 * class.cs (TypeContainer::TypeAttr): Virtualize.
21756 (Class::TypeAttr): Return attributes suitable for this bad boy.
21757 (Struct::TypeAttr): ditto.
21758 Handle nested classes.
21759 (TypeContainer::) Remove all the type visiting code, it is now
21760 replaced with the rootcontext.cs code
21762 * rootcontext.cs (GetClassBases): Added support for structs.
21764 2001-08-06 Miguel de Icaza <miguel@ximian.com>
21766 * interface.cs, statement.cs, class.cs, parameter.cs,
21767 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
21768 Drop use of TypeRefs, and use strings instead.
21770 2001-08-04 Miguel de Icaza <miguel@ximian.com>
21774 * class.cs (Struct::Struct): set the SEALED flags after
21775 checking the modifiers.
21776 (TypeContainer::TypeAttr): new property, returns the
21777 TypeAttributes for a class.
21779 * cs-parser.jay (type_list): Oops, list production was creating a
21780 new list of base types.
21782 * rootcontext.cs (StdLib): New property.
21783 (GetInterfaceTypeByName): returns an interface by type name, and
21784 encapsulates error handling here.
21785 (GetInterfaces): simplified.
21786 (ResolveTree): Encapsulated all the tree resolution here.
21787 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
21790 * driver.cs: Add support for --nostdlib, to avoid loading the
21791 default assemblies.
21792 (Main): Do not put tree resolution here.
21794 * rootcontext.cs: Beginning of the class resolution.
21796 2001-08-03 Miguel de Icaza <miguel@ximian.com>
21798 * rootcontext.cs: Provide better error reporting.
21800 * cs-parser.jay (interface_base): set our $$ to be interfaces.
21802 * rootcontext.cs (CreateInterface): Handle the case where there
21803 are no parent interfaces.
21805 (CloseTypes): Routine to flush types at the end.
21806 (CreateInterface): Track types.
21807 (GetInterfaces): Returns an array of Types from the list of
21808 defined interfaces.
21810 * typemanager.c (AddUserType): Mechanism to track user types (puts
21811 the type on the global type hash, and allows us to close it at the
21814 2001-08-02 Miguel de Icaza <miguel@ximian.com>
21816 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
21817 RecordInterface instead.
21819 * cs-parser.jay: Updated to reflect changes above.
21821 * decl.cs (Definition): Keep track of the TypeBuilder type that
21822 represents this type here. Not sure we will use it in the long
21823 run, but wont hurt for now.
21825 * driver.cs: Smaller changes to accomodate the new code.
21827 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
21830 * rootcontext.cs (CreateInterface): New method, used to create
21831 the System.TypeBuilder type for interfaces.
21832 (ResolveInterfaces): new entry point to resolve the interface
21834 (CodeGen): Property, used to keep track of the code generator.
21836 2001-07-26 Miguel de Icaza <miguel@ximian.com>
21838 * cs-parser.jay: Add a second production for delegate_declaration
21841 (enum_body): Put an opt_comma here instead of putting it on
21842 enum_body or enum_member_declarations so we can handle trailing
21843 commas on enumeration members. Gets rid of a shift/reduce.
21845 (type_list): Need a COMMA in the middle.
21847 (indexer_declaration): Tell tokenizer to recognize get/set
21849 * Remove old targets.
21851 * Re-add the parser target.
21853 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21855 * cs-parser.jay: Add precendence rules for a number of operators
21856 ot reduce the number of shift/reduce conflicts in the grammar.
21858 2001-07-17 Miguel de Icaza <miguel@ximian.com>
21860 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
21863 Get rid of old crufty code.
21865 * rootcontext.cs: Use this to keep track of the parsed
21866 representation and the defined types available to the program.
21868 * gen-treedump.cs: adjust for new convention.
21870 * type.cs: Split out the type manager, and the assembly builder
21873 * typemanager.cs: the type manager will live here now.
21875 * cil-codegen.cs: And the code generator here.
21877 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
21879 * makefile: Fixed up for easy making.
21881 2001-07-13 Simon Cozens <simon@simon-cozens.org>
21883 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
21886 (unary_expression): Expand pre_increment_expression and
21887 post_decrement_expression to reduce a shift/reduce.
21889 2001-07-11 Simon Cozens
21891 * cs-tokenizer.cs: Hex numbers should begin with a 0.
21893 Improve allow_keyword_as_indent name.
21895 2001-06-19 Miguel de Icaza <miguel@ximian.com>
21897 * Adjustments for Beta2.
21899 2001-06-13 Miguel de Icaza <miguel@ximian.com>
21901 * decl.cs: Added `Define' abstract method.
21902 (InTransit): new property, used to catch recursive definitions.
21904 * interface.cs: Implement `Define'.
21906 * modifiers.cs: Map Modifiers.constants to
21907 System.Reflection.TypeAttribute flags.
21909 * class.cs: Keep track of types and user-defined types.
21910 (BuilderInit): New method for creating an assembly
21911 (ResolveType): New function to launch the resolution process, only
21912 used by interfaces for now.
21914 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
21915 that are inserted into the name space.
21917 2001-06-08 Miguel de Icaza <miguel@ximian.com>
21919 * ARGH. I have screwed up my tree so many times due to the use of
21920 rsync rather than using CVS. Going to fix this at once.
21922 * driver.cs: Objetify driver. Load assemblies, use assemblies to
21925 2001-06-07 Miguel de Icaza <miguel@ximian.com>
21927 * Experiment successful: Use System.Type rather that our own
21930 2001-05-25 Miguel de Icaza <miguel@ximian.com>
21932 * cs-parser.jay: Removed nsAliases from here.
21934 Use new namespaces, handle `using XXX;'
21936 * namespace.cs: Reimplemented namespace handling, use a recursive
21937 definition of the class. Now we can keep track of using clauses
21938 and catch invalid using clauses.
21940 2001-05-24 Miguel de Icaza <miguel@ximian.com>
21942 * gen-treedump.cs: Adapted for all the renaming.
21944 * expression.cs (Expression): this class now has a Type property
21945 which returns an expression Type.
21947 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
21948 `Type', as this has a different meaning now in the base
21950 2001-05-22 Miguel de Icaza <miguel@ximian.com>
21952 * interface.cs, class.cs: Removed from all the sources the
21953 references to signature computation, as we can not do method
21954 signature computation during the parsing time, as we are not
21955 trying to solve at that point distinguishing:
21959 void a (NS.Blah x) {}
21962 Which depending on the context might be valid or not, as we do not
21963 know if Blah is the same thing as NS.Blah at that point.
21965 * Redid everything so the code uses TypeRefs now instead of
21966 Types. TypeRefs are just temporary type placeholders, that need
21967 to be resolved. They initially have a pointer to a string and the
21968 current scope in which they are used. This is used later by the
21969 compiler to resolve the reference to an actual Type.
21971 * DeclSpace is no longer a CIR.Type, and neither are
21972 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
21973 are all DeclSpaces, but no Types.
21975 * type.cs (TypeRefManager): This implements the TypeRef manager,
21976 which keeps track of all the types that need to be resolved after
21977 the parsing has finished.
21979 2001-05-13 Miguel de Icaza <miguel@ximian.com>
21981 * ARGH. We are going to have to store `foreach' as a class rather
21982 than resolving it, as we need to verify error 1579 after name
21983 resolution. *OR* we could keep a flag that says `This request to
21984 IEnumerator comes from a foreach statement' which we can then use
21985 to generate the error.
21987 2001-05-10 Miguel de Icaza <miguel@ximian.com>
21989 * class.cs (TypeContainer.AddMethod): we now add methods to the
21990 MethodGroup instead of the method hashtable.
21992 * expression.cs: Add MethodGroup abstraction, which gets us one
21993 step closer to the specification in the way we handle method
21996 * cs-parser.jay (primary_expression): qualified_identifier now
21997 tried to match up an identifier to a local variable reference or
21998 to a parameter reference.
22000 current_local_parameters is now a parser global variable that
22001 points to the current parameters for the block, used during name
22004 (property_declaration): Now creates an implicit `value' argument to
22007 2001-05-09 Miguel de Icaza <miguel@ximian.com>
22009 * parameter.cs: Do not use `param' arguments as part of the
22010 signature, per the spec.
22012 2001-05-08 Miguel de Icaza <miguel@ximian.com>
22014 * decl.cs: Base class for classes, structs and interfaces. This
22015 is the "Declaration Space"
22017 * cs-parser.jay: Use CheckDef for checking declaration errors
22018 instead of having one on each function.
22020 * class.cs: Factor out some code for handling error handling in
22021 accordance to the "Declarations" section in the "Basic Concepts"
22022 chapter in the ECMA C# spec.
22024 * interface.cs: Make all interface member classes derive from
22025 InterfaceMemberBase.
22027 2001-05-07 Miguel de Icaza <miguel@ximian.com>
22029 * Many things: all interfaces are parsed and generated in
22030 gen-treedump. Support for member variables, constructors,
22031 destructors, properties, constants is there.
22033 Beginning of the IL backend, but very little done, just there for
22036 2001-04-29 Miguel de Icaza <miguel@ximian.com>
22038 * cs-parser.jay: Fix labeled statement.
22040 * cs-tokenizer.cs (escape): Escape " and ' always.
22041 ref_line, ref_name: keep track of the line/filename as instructed
22042 by #line by the compiler.
22045 2001-04-27 Miguel de Icaza <miguel@ximian.com>
22047 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
22048 to match the values in System.CodeDOM.
22050 Divid renamed to Divide.
22052 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
22054 (Statements.set): remove.
22056 * System.CodeDOM/CodeCatchClause.cs: always have a valid
22059 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
22060 falseStatements always have valid values.
22062 * cs-parser.jay: Use System.CodeDOM now.