1 2005-02-21 Marek Safar <marek.safar@seznam.cz>
4 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
5 argument. Call ResolveAttributeUsage for unresolved.
6 when types doesn't match ctor arguments.
8 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
9 for nested attribute classes.
10 (Class.attribute_usage): Removed.
11 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
14 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
16 * rootcontext.cs (RegisterAttribute): Removed, attributes are
18 (attribute_types): Removed.
19 (EmitCode): Global attributes are emited as the latest.
21 2005-02-18 Marek Safar <marek.safar@seznam.cz>
23 * class.cs (EmitFieldInitializers): Don't emit field initializer
24 for default values when optimilization is on.
26 * constant.cs (Constant.IsDefaultValue): New property.
28 * driver.cs: Add /optimize handling.
32 * literal.cs: Implement new IsDefaultValue property.
34 * rootcontext.cs (Optimize): New field, holds /optimize option.
36 2005-02-18 Raja R Harinath <rharinath@novell.com>
38 Fix crasher in re-opened #72347.
39 * namespace.cs (Namespace.Lookup): Return null if
40 DeclSpace.DefineType returns null.
43 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
45 2005-02-18 Raja R Harinath <rharinath@novell.com>
47 Fix remainder of #63202. Change semantics of DoResolveLValue: it
48 now returns null if it cannot resolve to an lvalue.
49 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
50 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
51 returned null. Remove check for SimpleName.
52 (EventExpr.DoResolveLValue): New.
53 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
54 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
56 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
58 (Unary.ResolveOperator): Move CS0211 check ...
59 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
61 (Unary.DoResolveLValue): Simplify.
62 (AddressOf.DoResolveLValue): New.
63 (ArrayAccess.DoResolveLValue): New.
65 2005-02-16 Marek Safar <marek.safar@seznam.cz>
67 * attribute.cs (Attribute.Resolve): Add arguments casting for
68 when types doesn't match ctor arguments.
70 2005-02-16 Raja R Harinath <rharinath@novell.com>
73 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
74 lookup of operator in base type. Ensure that all checks happen
75 when the operator resolves to an "op_..." method.
77 2005-02-15 Raja R Harinath <rharinath@novell.com>
80 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
81 'ignore_cs0104' parameter. Pass it to ...
82 (NamespaceEntry.Lookup): ... this.
83 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
84 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
85 (TypeLookupExpression.DoResolveAsTypeStep): Update.
86 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
87 Update. Request that cs0104 errors be ignored.
88 (ComposedCast.ResolveAsTypeStep): Update.
90 2005-02-14 Raja R Harinath <rharinath@novell.com>
93 * expression.cs (Invocation.BetterFunction): Remove support for
94 comparing virtual functions and their overrides.
95 (Invocation.IsOverride): New.
96 (Invocation.OverloadResolve): Don't consider 'override' functions
97 during candidate selection. Store them in a lookaside list.
98 If the selected method is a 'virtual' function, use the list to
99 find any overrides that are closer to the LHS type.
101 2005-02-14 Marek Safar <marek.safar@seznam.cz>
103 * expression.cs (New.DoResolve): Add complex core type reduction.
104 (New.Constantify): Converts complex core type syntax like 'new int ()'
107 2005-02-14 Raja R Harinath <rharinath@novell.com>
109 * decl.cs (EntryType.EntryType): New constructor to create an
110 updated copy of a cache entry.
111 (MemberCache.AddMethods): Use it.
112 (MemberCache.ClearDeclaredOnly): Remove.
113 (MemberCache.MemberCache): Update.
115 2005-02-11 Miguel de Icaza <miguel@novell.com>
117 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
118 variable. This one is represents the actual low-level declaration
119 of the method, as opposed to the semantic level `IsStatic'.
121 An anonymous method which is hosted into a static method might be
122 actually an instance method. IsStatic would reflect the
123 container, while MethodIsStatic represents the actual code
126 * expression.cs (ParameterReference): Use the new MethodIsStatic
129 * anonymous.cs (AnonymousMethod.Compatible): Pass the
130 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
131 set on the current EmitContext.
133 * expression.cs (Cast): Overload DoResolveLValue so we can pass
134 resolve our casted expression as an LValue. This triggers the
135 proper LValue processing that is later required by Assign.
139 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
141 2005-02-11 Marek Safar <marek.safar@seznam.cz>
143 C# 2.0 Fixed buffer implementation
145 * anonymous.cs: Update after RegisterHelperClass renaming.
147 * attribute.cs (AttributeTester.fixed_buffer_cache):
148 Cache of external fixed buffers.
149 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
150 implementation if field is fixed buffer else null.
153 (TypeContainer.AddField): Accept FieldMember instead of Field.
154 (FieldBase.IsFieldClsCompliant): Extracted code from
155 VerifyClsCompliance descendant customization.
156 (FixedField): New class handles fixed buffer fields.
157 (FixedFieldExternal): Keeps information about imported fixed
159 (IFixedField): Make access to internal or external fixed buffer
162 * cs-parser.jay: Add fixed buffer parsing.
164 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
167 * expression.cs (Indirection): Extended implementation to accept
169 (PointerArithmetic.Emit): Get element from fixed buffer as well.
170 (ElementAccess.MakePointerAccess): Get type as parameter.
171 (DoResolve): Add fixed buffer field expression conversion.
172 (DoResolveLValue): Ditto.
173 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
174 (ArrayPtr): Derives from FixedBufferPtr.
175 (ArrayPtr.Emit): Add extra emit for array elements.
177 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
179 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
180 for compiler generated types.
181 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
183 * statement.cs (Fixed): Refactored to be easier add fixed buffer
184 and consume less memory.
185 (Fixed.Resolve): Add fixed buffer case.
187 * typemanager.cs (compiler_generated_attr_ctor,
188 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
189 (HasElementType): Add our own implementation to work on every
192 2005-02-11 Miguel de Icaza <miguel@novell.com>
194 * anonymous.cs (CaptureContext): Track whether `this' has been
197 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
198 only captured `this' if it was implicitly done (instance
199 methods/variables were used).
201 * codegen.cs (EmitContext.CaptureThis): New method to flag that
202 `this' must be captured.
204 2005-01-30 Miguel de Icaza <miguel@novell.com>
206 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
207 is null it means that there has been no need to capture anything,
208 so we just create a sibling.
210 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
212 Just a partial fix. The other half is fairly elusive.
214 2005-02-10 Raja R Harinath <rharinath@novell.com>
216 Fix #52586, cs0121-4.cs.
217 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
218 and return a hashtable.
219 (MemberCache.ClearDeclaredOnly): New.
220 (MemberCache.MemberCache): Update to change. Make a deep copy of
221 the method_hash of a base type too.
222 (MemberCache.AddMethods): Adapt to having a deep copy of the base
223 type methods. Overwrite entries with the same MethodHandle so
224 that the ReflectedType is correct. The process leaves in base
225 virtual functions and their overrides as distinct entries.
226 (CacheEntry): Now a class instead of a struct. It shouldn't alter
227 matters since it was boxed in a ArrayList before.
228 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
230 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
231 case of a virtual function and its override (choose the overload
233 (Invocation.OverloadResolve): Avoid 'override' members during
234 'applicable_type' calculation.
236 2005-02-09 Raja R Harinath <rharinath@novell.com>
238 Combine two near-redundant caches.
239 * typemanager.cs (method_params): Rename from method_internal_params.
240 (TypeManager.GetParameterData): New. Replace
241 Invocation.GetParameterData.
242 (TypeManager.LookupParametersByBuilder): Remove.
243 * expression.cs (Invocation.method_parameter_cache): Remove.
244 (Invocation.GetParameterData): Remove.
246 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
249 2005-02-08 Raja R Harinath <rharinath@novell.com>
252 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
253 TypeManager.multicast_delegate_type is null, resolve it by looking
254 up "System.MulticastDelegate".
255 * rootcontext.cs (RootContext.ResolveCore): Simplify.
257 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
258 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
259 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
262 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
263 (LabeledStatement.AddReference): New. Set 'referenced'.
264 (Goto.Resolve): Use it.
266 2005-02-05 John Luke <john.luke@gmail.com>
268 * driver.cs: remove duplicate -doc line in Usage ()
270 2005-02-04 Raja R Harinath <rharinath@novell.com>
272 * location.cs (Location.AddFile): Fix CS2002 error report.
274 2005-02-02 Martin Baulig <martin@ximian.com>
276 * delegate.cs (Delegate.DefineType): Report an internal error if
277 TypeManager.multicast_delegate_type is null. See bug #72015 for
280 2005-02-02 Raja R Harinath <rharinath@novell.com>
282 Fix a crasher in a variant of #31984.
283 * const.cs (Constant.CheckBase): New override that defers the
284 new-or-override check in case the base type hasn't been populated
286 (Constant.Define): Ensure the new-or-override check is performed.
288 2005-02-01 Duncan Mak <duncan@ximian.com>
290 * const.cs (LookupConstantValue): Check that `ce' is not null
291 before calling GetValue ().
293 2005-02-01 Raja R Harinath <rharinath@novell.com>
295 Fix test-334.cs (#69519).
296 * cs-parser.jay (using_alias_directive): Pass in an expression to
297 NamespaceEntry.UsingAlias.
298 (using_namespace_directive): Pass in an expression to
299 NamespaceEntry.Using.
300 (namespace_name): Don't flatten to a string.
301 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
302 (NamespaceEntry.AliasEntry.Resolve): Lookup using
304 (NamespaceEntry.UsingEntry): Likewise.
305 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
307 (NamespaceEntry.LookupForUsing): Remove.
308 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
310 (NamespaceEntry.Lookup): Remove support for dotted names.
312 2005-02-01 Raja R Harinath <rharinath@novell.com>
314 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
316 (NamespaceEntry.ImplicitParent): Compute on demand.
317 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
318 parallels the current.
319 (NamespaceEntry.LookupForUsing): Use it.
320 (NamespaceEntry.Lookup): If the current namespace-entry is
321 implicit, don't search aliases and using tables.
323 2005-02-01 Raja R Harinath <rharinath@novell.com>
326 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
328 (TypeContainer.BaseCache): Compute on demand.
329 (TypeContainer.FindMembers): Define constants and types if they're
331 (FieldMember.Define): Move resetting of ec.InUnsafe before error
333 * const.cs (Constant.Define): Make idempotent.
335 2005-01-29 Miguel de Icaza <miguel@novell.com>
337 * pending.cs: Produce better code (no nops produced by using Ldarg
340 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
341 i - 1' it should be arg + 1.
345 2005-01-28 Raja R Harinath <rharinath@novell.com>
347 * attribute.cs (Attribute.CheckAttributeType): Make private
349 (Attribute.ResolveType): Make virtual.
350 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
351 handling of RootContext.Tree.Types.
353 2005-01-27 Raja R Harinath <rharinath@novell.com>
355 Update attribute-handling to use the SimpleName/MemberAccess
357 * cs-parser.jay (attribute): Pass in an expression to the
358 constructors of Attribute and GlobalAttribute.
359 * attribute.cs (Attribute): Take an expression for the name.
360 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
361 passed in attribute name expression.
362 (Attribute.CheckAttributeType): Use it.
363 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
364 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
365 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
366 argument to prevent error messages if the lookup fails.
368 2005-01-27 Marek Safar <marek.safar@seznam.cz>
370 * expression.cs (Indirection): Implemented IVariable interface
371 to support indirection in AddressOf operator.
372 (PointerArithmetic.Emit): Add optimalization for case where
373 result can be precomputed.
375 2005-01-26 Martin Baulig <martin@ximian.com>
377 * class.cs (TypeContainer.AttributeTargets): Return the correct
378 AttributeTargets depending on our `Kind' instead of throwing an
379 exception; fixes #71632.
381 2005-01-26 Marek Safar <marek.safar@seznam.cz>
384 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
387 2005-03-17 Martin Baulig <martin@ximian.com>
389 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
390 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
392 2005-03-17 Martin Baulig <martin@ximian.com>
394 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
395 to bool so we can return an error condition.
396 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
399 2005-03-17 Martin Baulig <martin@ximian.com>
401 * generic.cs (TypeMananager.IsIEnumerable): New public method.
403 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
404 converting from an array-type of T to `IEnumerable<T>'.
406 2005-03-16 Martin Baulig <martin@ximian.com>
408 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
409 (Nullable.LiftedUnaryMutator): New public class.
411 * expression.cs (UnaryMutator.DoResolve): Added support for
414 2005-03-14 Martin Baulig <martin@ximian.com>
416 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
418 2005-03-14 Martin Baulig <martin@ximian.com>
420 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
421 the comparision operators `<', `>', `<=' and `>='.
423 2005-03-13 Martin Baulig <martin@ximian.com>
426 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
427 avoid confusion with the `NullLiteral'.
428 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
430 2005-03-13 Martin Baulig <martin@ximian.com>
432 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
433 comparing arbitrary types with the null literal.
435 2005-03-13 Martin Baulig <martin@ximian.com>
437 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
438 boolean operators '&&', '||', '&' and '|'.
439 (Nullable.OperatorTrueOrFalse): New public class.
441 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
442 instead of a `StaticCallExpr'; added support for nullables.
444 2005-03-10 Martin Baulig <martin@ximian.com>
447 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
448 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
450 2005-03-07 Martin Baulig <martin@ximian.com>
452 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
453 it work if `expr' is not an IMemoryLocation.
454 (Nullable.Lifted): Implement IMemoryLocation.
455 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
458 2005-03-05 Martin Baulig <martin@ximian.com>
460 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
461 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
462 (Nullable): Added support for lifted unary and binary operators.
464 * expression.cs (Unary.DoResolve): Added support for nullable types.
465 (Binary.DoResolve): Likewise.
466 (Conditional.DoResolve): Likewise.
468 2005-03-02 Martin Baulig <martin@ximian.com>
470 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
472 * class.cs (ClassPart.SetParameterInfo): Override this.
473 (PartialContainer.SetParameterInfo): Override this.
474 (TypeContainer.CheckConstraints): New protected method.
475 (PartialContainer.CheckConstraints): Override this and check
476 whether the same contraints were specified in all parts of a
477 partial generic type definition.
478 (PartialContainer.UpdateConstraints): New public method.
480 * generic.cs (TypeParameter.UpdateConstraints): New public method.
482 2005-03-02 Martin Baulig <martin@ximian.com>
484 Committing a patch from Carlos Alberto Cortez to fix #72887.
486 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
487 casts from `T []' to `int []'.
489 2005-03-02 Martin Baulig <martin@ximian.com>
491 * generic.cs (TypeManager.IsEqual): Make this symmetric.
493 * expression.cs (Binary.ResolveOperator): When resolving a
494 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
495 `=='. Fixes #71866. See gen-127.cs.
497 2005-03-02 Martin Baulig <martin@ximian.com>
499 * class.cs (TypeContainer.DoDefineMembers): We also need a default
500 static constructor in static classes.
502 2005-03-02 Martin Baulig <martin@ximian.com>
505 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
506 (Nullable.LiftedConversion): Added support for user-defined
509 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
511 * cs-parser.jay: Use ComposedCast everywhere instead of
512 NullableType, so we don't need to check for NullableType
514 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
515 case where we'll be resolved into a `parenthesized_expression_0'
519 (Convert.UserDefinedConversion): Added nullable conversions.
521 2005-02-28 Martin Baulig <martin@ximian.com>
523 * generic.cs (TypeManager.IsNullableType): New static method.
524 (Nullable): New abstract class.
525 (Nullable.NullLiteral): New public class.
526 (Nullable.LiftedConversion): New public class.
528 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
529 `builtin_types opt_nullable'.
532 (Convert.ImplicitConversionStandard): Added nullable conversions.
533 (Convert.ExplicitConversionStandard): Likewise.
534 (Convert.ExplicitConversion): Likewise.
536 2005-02-26 Martin Baulig <martin@ximian.com>
538 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
539 begin with a "?", for instance "?[]". Don't do a type lookup if
542 2005-02-25 Martin Baulig <martin@ximian.com>
544 The first part of Nullable Types :-)
546 * generic.cs (NullableType): New public class.
547 (NullCoalescingOperator): New public class.
548 (TypeArguments.Resolve): Add a CS0306 check.
550 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
551 (opt_nullable): New rule.
552 (type): Added `opt_nullable' to `namespace_or_type_name',
553 `builtin_types' and `pointer_type'.
554 (array_type): Added `opt_nullable'.
555 (opt_rank_specifier_or_nullable): New rule; this is the
556 combination of `opt_rank_specifier' and `opt_nullable'.
557 (opt_error): New rule; catch errors here.
558 (nullable_type_or_conditional): New rule; we use this to check for
559 nullable and still detect the conditional operator.
560 (local_variable_type): Use `opt_rank_specifier_or_nullable'
561 instead `opt_rank_specifier'.
563 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
566 2005-02-24 Martin Baulig <martin@ximian.com>
568 * README, README.Changes: Removed; they're old and obsolete.
570 2005-02-22 Martin Baulig <martin@ximian.com>
572 * generic.cs (TypeParameter.Resolve): If resolving the constraints
573 returned an error, set `constraints' to null to avoid a crash
575 (TypeParameter.ResolveType): Likewise.
577 2005-02-22 Martin Baulig <martin@ximian.com>
580 (Constraints.ResolveTypes): Protect against being called twice.
581 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
582 (TypeParameter.ResolveType): New public method; calls
583 constraints.ResolveTypes().
584 (TypeParameter.DefineType): Moved constraints.ResolveType() out
585 into the new ResolveType().
586 (GenericMethod.Define): Call ResolveType() on all our
589 2005-02-21 Martin Baulig <martin@ximian.com>
592 (TypeManager.generic_nullable_type): New static public field.
593 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
596 (RootContext.ResolveCore): Resolve "System.Nullable`1".
598 2005-02-15 Martin Baulig <martin@ximian.com>
600 * generic.cs (ConstructedType.Constraints): Correctly check
601 constraints if the argument type is a type parameter; fixes
604 2005-02-02 Martin Baulig <martin@ximian.com>
606 * delegate.cs (Delegate.DefineType): Report an internal error if
607 TypeManager.multicast_delegate_type is null. See bug #72015 for
610 2005-01-29 Miguel de Icaza <miguel@novell.com>
612 * pending.cs: Produce better code (no nops produced by using Ldarg
615 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
616 i - 1' it should be arg + 1.
620 2005-01-26 Martin Baulig <martin@ximian.com>
622 * cs-parser.jay (indexer_declarator): Don't report an error if we
623 have type parameters since we can be an explicit interface
624 implementation; fixes #71449.
626 2005-01-26 Martin Baulig <martin@ximian.com>
628 * class.cs (TypeContainer.AttributeTargets): Return the correct
629 AttributeTargets depending on our `Kind' instead of throwing an
630 exception; fixes #71632.
632 2005-01-26 Martin Baulig <martin@ximian.com>
634 * delegate.cs (Delegate.DefineType): Correctly define our type
635 parameters. Fixes #71483.
637 2005-01-25 Raja R Harinath <rharinath@novell.com>
640 * expression.cs (MemberAccess.DoResolve): Don't complain with
641 cs0572 when the LHS of a member access has identical name and type
644 2005-01-25 Marek Safar <marek.safar@seznam.cz>
647 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
649 Create custom PermissionSet only for PermissionSetAttribute.
651 2005-01-24 Marek Safar <marek.safar@seznam.cz>
654 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
655 delegates in static class.
657 2005-01-24 Martin Baulig <martin@ximian.com>
659 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
660 merging an implicit block, just use its reachability.
662 * statement.cs (Block.Resolve): Make the unreachable code check
663 work wrt. implicit blocks; see test-337 from #63842.
665 2005-01-21 Alp Toker <alp@atoker.com>
667 * cs-parser.jay: destructor_declaration's container is PartialContainer
668 not Class when partial types are used, so use Kind prop instead of
671 2005-01-22 Miguel de Icaza <miguel@ximian.com>
673 * cs-parser.jay: Improve error reporting when an interface
676 2005-01-20 Dick Porter <dick@ximian.com>
678 * support.cs: SeekableStreamReader fix from Sandor Dobos
679 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
680 chars are read. Fixes bug 70369.
682 2005-01-20 Raja R Harinath <rharinath@novell.com>
684 * cs-parser.jay (catch_clause): Simplify current_block handling
687 2005-01-17 Miguel de Icaza <miguel@ximian.com>
689 * convert.cs (ImplicitStandardConversionExists): Synchronize the
690 code with ImplicitStandardConversion to handle the implicit
691 conversion of method groups into valid delegate invocations.
693 The problem is that in parameter handling we were using this code
694 path. Fixes bug #64698
696 2005-01-19 Raja R Harinath <rharinath@novell.com>
698 * cs-parser.jay: Fix several infelicities.
699 - Avoid assigning to the parser value stack. Code like
700 '$3 = null' is unclean. Synthesize a value for the code block
702 - Avoid using oob_stack for storing location information. Use ...
703 (_mark_): ... this. New (empty) rule. Saves the current location
705 (foreach_statement): Avoid using oob_stack for current_block
706 handling. Use technique used in for_statement and
707 using_statement. Synthesize a value for the code block to store
708 additional intermediate information.
710 2005-01-13 Miguel de Icaza <miguel@ximian.com>
712 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
713 of a different type is only allowed to private fields of a
714 containing type, not on fields of a base class.
716 See test-174.cs and error cs0122-9.cs
718 2005-01-13 Raja R Harinath <rharinath@novell.com>
720 Fix test-335.cs (bug #58126).
721 * cs-parser.jay (argument): Split out non-expression parts of the
722 rule into 'non_simple_argument'.
723 (invocation_expression): Support parenthesized invocations with
724 multiple arguments, and with single non-simple arguments.
726 2005-01-13 Raja R Harinath <rharinath@novell.com>
728 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
731 2005-01-12 Raja R Harinath <rharinath@novell.com>
733 Fix cs0038-1.cs, cs1640-6.cs.
734 * ecore.cs (Expression.Resolve): Remove special-case for
735 SimpleName in error-handling.
736 (Expression.almostMatchedMembers): Relax access permission to
738 (Expression.MemberLookupFailed): Handle duplicates in
739 almostMatchedMembers list.
740 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
741 * expression.cs (New.DoResolve): Report CS1540 for more cases.
742 * typemanager.cs (GetFullNameSignature): Use the MethodBase
743 overload if the passed in MemberInfo is a MethodBase.
745 2005-01-25 Martin Baulig <martin@ximian.com>
748 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
750 2005-01-12 Marek Safar <marek.safar@seznam.cz>
753 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
754 for non-CAS & merge permission sets properly.
756 2005-01-11 Raja R Harinath <rharinath@novell.com>
758 Improve standard-compliance of simple name and member access
759 resolution. Fixes bugs #52697, #57200, #67520, #69519.
760 * ecore.cs (FullNamedExpression): New abstract base class
761 for Namespaces and TypeExpressions.
762 (ResolveFlags.SimpleName): Remove.
763 (SimpleName): Remove support for dotted names.
764 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
765 DeclSpace.FindType and DeclSpace.LookupType.
766 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
767 (Expression.ExprClassName): Make member function.
768 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
769 a namespace. Remove creation of dotted "SimpleName"s.
770 (MemberAccess.DoResolve): Likewise.
771 * decl.cs (DeclSpace.Cache): Make private.
772 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
773 (DeclSpace.FindType): Update.
774 (DeclSpace.LookupType): Move here from RootContext. Return a
776 * namespace.cs (Namespace): Derive from FullNamedExpression
777 so that it can be part of expression resolution.
778 (Namespace.Lookup): Return an FullNamedExpression.
779 (NamespaceEntry.LookupAlias): Lookup aliases only in current
781 * rootcontext.cs (NamespaceLookup): Remove.
782 (LookupType): Move to DeclSpace.
783 * attribute.cs (CheckAttributeType): Update.
784 * doc.cs (FindDocumentedType): Remove allowAlias argument.
785 (FindDocumentedTypeNonArray): Likewise.
787 2005-01-11 Raja R Harinath <rharinath@novell.com>
789 Fix cs0509.cs, cs1632.cs.
790 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
791 is the same as IsInterface.
792 (TypeContainer.GetClassBases): Likewise.
793 * statement.cs (LabeledStatement.ig): New field.
794 (LabeledStatement.LabelTarget): Save ILGenerator which created the
796 (LabeledStatement.DoEmit): Check that the label was created with
797 the same ILGenerator.
799 2005-01-10 Marek Safar <marek.safar@seznam.cz>
802 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
803 accessors to its properties.
805 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
806 from accessors to property.
808 2005-01-10 Marek Safar <marek.safar@seznam.cz>
811 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
814 2005-01-08 Miguel de Icaza <miguel@ximian.com>
816 * attribute.cs: Check for null and empty strings.
818 I have lost another battle to Paolo.
820 2005-01-07 Marek Safar <marek.safar@seznam.cz>
823 * class.cs (PropertyMethod): Set Parent field in ctors.
824 (SetMethod.InternalParameters): Add unsafe switch hack.
825 Override MarkForDuplicationCheck where it is appropriate.
827 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
828 It says whether container allows members with the same name.
830 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
831 Removed is_method parameter.
833 2005-01-06 Duncan Mak <duncan@ximian.com>
835 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
836 because the previous change led to incorrect reporting of CS1032
837 ("Cannot define/undefine preprocessor symbols after first token in
838 file"). Instead of using `tokens_seen' as the only flag that
839 triggers CS1040, introduce `comments_seen'. This new flag is used
840 to signify having seen comments on the current line, so it is
841 unset after a newline.
843 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
845 * doc.cs : When searching for a type, find nested type too.
846 This fixes bug #71040.
848 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
851 - Warn missing member comment on those classes which also does not
852 have doc comments. Fixed bug #71041.
853 - Don't warn missing doc comment on default constructor.
856 2005-01-06 Duncan Mak <duncan@ximian.com>
858 * cs-tokenizer.cs (xtoken): After handling traditional C-style
859 comments, set `tokens_seen' to true. This allows us to detect
860 misplaced preprocessor directives (i.e. not at the beginning of
861 the a line, nor after whitespaces). In that case, report error
862 CS1040. This fixes bug #56460.
864 * cs-parser.jay (interface_member_declaration): Add checks for
865 IsExplicitImpl, and report CS0541 error if an interface member is
866 defined as an explicit interface declaration.
868 2005-01-06 Marek Safar <marek.safar@seznam.cz>
871 * class.cs (PropertyMethod): Set Parent field in ctors.
872 (SetMethod.InternalParameters): Add unsafe switch hack.
874 * decl.cs (MemberCore.Parent): Cannot be readonly.
876 2005-01-06 Raja R Harinath <rharinath@novell.com>
878 * decl.cs (DeclSpace.ResolveType): Remove.
879 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
880 Merge in code from ...
881 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
882 * class.cs, enum.cs: Update to changes.
884 2005-01-06 Miguel de Icaza <miguel@ximian.com>
886 * anonymous.cs: Ensure that we init the scope of our parent if it
887 has not been initialized yet.
889 2004-12-30 Duncan Mak <duncan@ximian.com>
891 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
892 if field.FieldBuilder is null. Fixes #70758.
894 * convert.cs: Fixed some typos and updated some of the comments.
895 (ImplicitStandardConversionExists):
896 (TryImplicitIntConversion): If `target_type' is an interface and
897 the type of `ic' implements this interface, return true or a new
898 BoxedCast instead of null. This fixes #70468.
900 2004-12-29 Duncan Mak <duncan@ximian.com>
902 * expression.cs (Argument.Emit): Check that Expr is
903 IMemoryLocation before casting to it, and report CS1510 otherwise.
907 2004-12-21 Ben Maurer <bmaurer@ximian.com>
909 * statement.cs (Block.ThisVariable): remove the recursion here, to
910 make the --profile more sane.
912 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
914 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
915 assembly, by JB Evain.
917 2004-12-17 Raja R Harinath <rharinath@novell.com>
919 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
920 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
921 "parent" refers to enclosing type/class. "base" refers to superclass.
923 2004-12-17 Raja R Harinath <rharinath@novell.com>
925 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
926 Ensure that we only have GlobalAttributes.
927 * attribute.cs (Attribute.Emit): Make non-virtual.
928 (GlobalAttribute.Emit): Remove.
929 (Attribute.Resolve): Make virtual.
930 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
931 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
932 the argument. Don't create one.
933 (Attribute.GetObsoleteAttribute): Likewise.
934 (Attribute.GetClsCompliantAttributeValue): Likewise.
935 * class.cs, decl.cs: Update to changes.
937 2004-12-17 Marek Safar <marek.safar@seznam.cz>
939 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
941 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
943 * statement.cs (Foreach.Resolve): Add error 186 report.
945 2004-12-16 Marek Safar <marek.safar@seznam.cz>
947 * expression.cs (Conditional.DoResolve): Add warning 429.
949 * statement.cs (If.Resolve): Add warning 665.
951 2004-12-16 Raja R Harinath <rharinath@novell.com>
953 New invariant: RootContext.Tree.Types.NamespaceEntry == null
954 except when in the parser, and in GlobalAttribute.
955 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
956 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
957 RootContext.Tree.Types.NamespaceEntry once work is done.
958 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
959 and resets RootContext.Tree.Types.NamespaceEntry.
961 2004-12-15 Marek Safar <marek.safar@seznam.cz>
963 * cs-parser.jay: Don't create a block for every variable.
965 2004-12-14 Miguel de Icaza <miguel@ximian.com>
967 * location.cs: Provide extra information.
969 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
970 variables from the captured environment, it is the ldarg_0.
972 2004-12-14 Marek Safar <marek.safar@seznam.cz>
974 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
977 * class.cs: Changed warning level for 169 to avoid developer
978 displeasure from warning flooding. It will be changed back when they
979 fix most of current BCL warnings.
981 * RootContext.cs: Pushed default WarningLevel to 3.
983 * statement.cs: Removed unused variable.
985 2004-12-14 Marek Safar <marek.safar@seznam.cz>
987 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
988 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
989 Add error 502 report.
990 (StaticClass.DefineType): Add error 441 report.
991 (Class.AllowedModifiersProp): New virtual property as temporary
992 extension to AllowedModifiers.
993 (Class.DefineType): Add error 418 report. Moved ModFlags check here
994 to share implementation with StaticClass and don't call virtual
997 * driver.cs (MainDriver): Add error 1558 test.
999 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
1000 report. Moved error 36 test here.
1002 * statement.cs (Throw.Resolve): Add error 724 report.
1004 * typemanager.cs: Add out_attribute_type core type.
1006 2004-12-13 Marek Safar <marek.safar@seznam.cz>
1008 * class.cs (TypeContainer.VerifyClsCompliance): Add error
1010 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
1012 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
1015 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
1017 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
1018 Add error 3023 report.
1019 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
1021 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
1024 2004-12-12 John Luke <john.luke@gmail.com>
1026 * driver.cs (AddArgs): take -- into account when
1027 adding arguments, fixes bug 65710
1029 2004-12-12 Martin Baulig <martin@ximian.com>
1031 * expression.cs (Unary.TryReduceNegative): Added support for
1032 SByteConstant and ByteConstant.
1033 (Unary.Reduce): Check error values from TryReduceNegative().
1035 2004-12-10 Marek Safar <marek.safar@seznam.cz>
1037 * attributes.cs (Attribute.Resolve): Avoid multiple error report
1038 and report exception as error 182.
1040 2004-12-10 Raja R Harinath <rharinath@novell.com>
1042 * driver.cs (Main): Fix message when there are warnings.
1044 2004-12-09 Miguel de Icaza <miguel@ximian.com>
1046 * delegate.cs: Fixed my fix from yesterday, sorry about that.
1048 2004-12-09 Marek Safar <marek.safar@seznam.cz>
1050 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
1051 Reduced number of warnings.
1053 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
1055 2004-12-08 Miguel de Icaza <miguel@ximian.com>
1057 * driver.cs: Removed message.
1059 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
1061 2004-12-08 <vargaz@freemail.hu>
1063 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
1065 2004-12-08 Martin Baulig <martin@ximian.com>
1067 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1068 instead of a CS3002 for properties and indexer.
1070 2004-12-08 Martin Baulig <martin@ximian.com>
1072 * decl.cs (MemberName.ToString): Make this work again.
1074 2004-12-08 Marek Safar <marek.safar@seznam.cz>
1076 * attribute.cs (Resolve): Add error 591 detection.
1078 * class.cs (FieldMember.Define): Add error 1547 detection.
1079 (Indexer.Define): Add error 620 detection.
1080 (Operator.Define): Add error 590 detection.
1082 * ecore.cs: Missing argument for error 79.
1084 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
1087 2004-12-07 Marek Safar <marek.safar@seznam.cz>
1090 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
1093 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1095 * cs-parser.jay : handle doc comments on implicit/explicit operators.
1096 Some operator comments were suppressed.
1097 * doc.cs : Implicit/explicit operator name in doc comments are like
1098 "op_Explicit(type)~returnType", so added suffix handling.
1100 2005-01-21 Alp Toker <alp@atoker.com>
1102 * cs-parser.jay: destructor_declaration's container is PartialContainer
1103 not Class when partial types are used, so use Kind prop instead of 'is'.
1105 2004-12-12 Martin Baulig <martin@ximian.com>
1107 * expression.cs (Unary.TryReduceNegative): Added support for
1108 SByteConstant and ByteConstant.
1109 (Unary.Reduce): Check error values from TryReduceNegative().
1111 2004-12-11 Martin Baulig <martin@ximian.com>
1113 * support.cs (ReflectionParameters.ParameterName): If we have a
1114 `gpd', call `ParameterName' on it.
1116 * parameter.cs (Parameter.GetParameterAttributes): New static method.
1118 * pending.cs (PendingImplementation.DefineProxy): Call
1119 DefineParameter() for all of the MethodBuilder's arguments.
1121 2004-12-09 Martin Baulig <martin@ximian.com>
1123 * doc.cs (DocUtil): Make this a static class.
1125 2004-12-09 Martin Baulig <martin@ximian.com>
1127 * expression.cs (Invocation.InferType): Moved the type inference
1128 implementation into TypeManager.
1130 * generics.cs (TypeManager): Moved the type inference
1131 implementation here.
1133 2004-12-09 Martin Baulig <martin@ximian.com>
1135 * typemanager.cs (TypeManager): Make this a partial class.
1138 (TypeManager): Move the generics part of `TypeManager' here.
1140 2004-12-08 Martin Baulig <martin@ximian.com>
1142 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1143 instead of a CS3002 for properties and indexer. Added CS3024
1144 check for generic interfaces.
1146 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
1147 instances are not CLS-compliant.
1149 2004-12-08 Martin Baulig <martin@ximian.com>
1152 (void_pointer_expression): New rule for `void*', `void**' etc.
1153 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
1155 2004-12-08 Martin Baulig <martin@ximian.com>
1157 * expression.cs (Invocation.InferType): Removed the hack for
1158 MethodCore.MayUnify().
1160 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
1163 * class.cs (MethodCore.MayUnify): Use
1164 TypeManager.MayBecomeEqualGenericTypes().
1166 2004-12-08 Martin Baulig <martin@ximian.com>
1168 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
1169 parameter, box it. Fixes #69233.
1171 2004-12-08 Martin Baulig <martin@ximian.com>
1173 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
1174 have the ctor constraint. Fixes #68326.
1176 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1178 * cs-parser.jay : interface comment was not consumed because of
1179 extra opt_semicolon before doc handling.
1181 2004-12-03 Raja R Harinath <rharinath@novell.com>
1183 Fix test-327.cs, test-328.cs, and put in early infrastructure
1184 for eventually fixing #52697.
1185 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
1186 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
1188 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
1189 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
1190 (VerifyUsing, error246): Update.
1191 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1192 'NamespaceEntry.LookupNamespaceOrType'.
1194 2004-12-07 Martin Baulig <martin@ximian.com>
1196 * driver.cs: Call it "BETA SOFTWARE" :-)
1198 2004-12-06 Raja R Harinath <rharinath@novell.com>
1200 Fix crash on cs0657-17.cs.
1201 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1202 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1203 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1204 the case where the NamespaceEntry gets overwritten.
1206 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1208 Fixed #69195, #56821
1209 * ecore.cs (ResolveBoolean): Tiny refactoring.
1211 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1212 of right expression resolving when left is false constant and
1213 operator is LogicalAnd OR true constant and operator is LogicalOr.
1215 * statement.cs (ResolveUnreachable): Always reports warning.
1217 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1219 * class.cs: Distinguish between 1721 and 1722 (just a little help
1220 for the programmer).
1222 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1224 * delegate.cs: Only allow this on new versions of the language.
1226 2004-12-02 Duncan Mak <duncan@ximian.com>
1228 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1230 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1231 here as a static method. Take an additional bool out parameter
1232 `must_do_cs1540_check' for signaling to InstanceResolve.
1233 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1234 member field from PropertyExpr class and made it an argument of
1236 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1237 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1238 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1239 and `remove_accessor' as well as InstanceResolve: report CS0122
1244 2004-12-07 Martin Baulig <martin@ximian.com>
1246 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
1247 and CS0692 where appropriate.
1249 2004-12-06 Martin Baulig <martin@ximian.com>
1251 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
1252 IsDuplicateImplementation() and improved it.
1254 * expression.cs (Invocation.InferTypeArguments): Added
1255 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
1256 and removed the "ref" modifier from `infered_types'.
1258 * decl.cs (MemberName.ToString): Removed the exception.
1260 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1262 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1263 comments are allowed.
1265 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1267 * delegate.cs: Add checks for subtypes in paramaters and return values
1268 in VerifyMethod () to add support for Covariance/Contravariance
1271 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1273 * report.cs: Remove extra closing parenthesis.
1275 * convert.cs (Error_CannotImplicitConversion): If the name of the
1276 types are the same, provide some extra information.
1278 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1281 * attribute.cs (Resolve): Improved implementation of params
1282 attribute arguments.
1284 * support.cs (ParameterData): Add HasParams to be faster.
1286 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1288 all things are for /doc support:
1290 * doc.cs: new file that supports XML documentation generation.
1291 * mcs.exe.sources: added doc.cs.
1293 Handle /doc command line option.
1294 Report error 2006 instead of 5 for missing file name for /doc.
1295 Generate XML documentation when required, after type resolution.
1297 Added support for picking up documentation (/// and /** ... */),
1298 including a new XmlCommentState enumeration.
1300 Added lines to fill Documentation element for field, constant,
1301 property, indexer, method, constructor, destructor, operator, event
1302 and class, struct, interface, delegate, enum.
1303 Added lines to warn incorrect comment.
1305 Added Documentation field (passed only when /doc was specified).
1307 Added DocComment, DocCommentHeader, GenerateDocComment() and
1308 OnGenerateDocComment() and some supporting private members for
1309 /doc feature to MemberCore.
1311 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1313 Added overriden DocCommentHeader.
1315 Added overriden DocCommentHeader and GenerateDocComment().
1317 2004-12-01 Miguel de Icaza <miguel@ximian.com>
1319 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
1320 unwrapping the enumeration values, chain to
1321 DoConstantNumericPromotions again, so we can promote things to the
1322 fundamental types (takes care of enums that are bytes, sbytes).
1326 2004-12-01 Raja R Harinath <rharinath@novell.com>
1328 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
1329 Fix long-standing bug in type-lookup. Use FindType instead of
1330 LookupType when ec.ResolvingTypeTree.
1331 (Attribute.ResolveType, Attribute.Resolve)
1332 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
1334 (Attributes.Search): Remove internal version. Update.
1335 (Attributes.SearchMulti): Update.
1336 (Attributes.GetClsCompliantAttribute): Remove.
1337 (Attributes.GetIndexerNameAttribute): Remove.
1338 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
1339 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
1340 * class.cs (Indexer.Define): Likewise.
1342 2004-12-01 Marek Safar <marek.safar@seznam.cz>
1345 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
1346 MarshallByReference members access.
1348 * expression.cs: Use CheckMarshallByRefAccess;
1349 Better error CS0197 message.
1351 * report.cs: Print whole related error message.
1353 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1355 * class (GetClassBases): Better error 60 report.
1356 (EventProperty): Disabled warning 67 detection.
1358 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1361 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
1363 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
1366 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1369 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
1371 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
1373 2004-11-26 Miguel de Icaza <miguel@ximian.com>
1375 * attribute.cs (Attribute.Resolve): Refine error reporting and
1376 report a cs0117 if the identifier does not exist, to distinguish
1377 from 0617 which is a miss-use of the actual identifier.
1379 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
1380 between cs0070 and cs0079.
1382 * class.cs (MemberBase.DoDefine): When reporting a wrong
1383 accessibility level, we use MethodCore to compare instead of
1384 Method (this was a regression in some refactoring effort).
1386 So now we correctly report cs0056 again.
1388 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
1389 testing the target_type (which was known to be object_type) and
1390 not the source type (which is anonymous_method).
1392 Fixed reporting of error cs1660.
1394 * expression.cs (UserCast.Source): Expose the underlying cast.
1396 * statement.cs (Switch.SwitchGoverningType): Sort the list of
1397 allowed types to find a match to int32 first (most common).
1399 In addition, it ignores any ImplicitUserConversions that did an
1400 internal implicit conversion (as the switch statement allows only
1401 one integral conversion to exist).
1403 * class.cs (PartialContainer.Create): rename `name' to
1404 `member_name' for clarity. Then replace the string calls with a
1405 call to MemberName.GetPartialName, as now using
1406 MemberName.ToString is an error (this is due to the side effects
1407 it had, that were fixed in the past).
1409 This will restore the error reporting on a number of partial class
1410 errors that were missusing this (and getting an exception as a
1411 results, which is now just a plain textual warning, because
1412 yyparse debug output would crash otherwise).
1414 2004-11-26 Raja R Harinath <rharinath@novell.com>
1416 * Makefile (PROGRAM_INSTALL_DIR): Remove.
1418 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1420 * rootcontext.cs (LookupType): Make sure to cache lookups that
1421 don't give us a negative result. This saves about 5% of corlib
1424 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1426 * report.cs (AbstractMessage.Print): messages are sent to stderr
1428 * class.cs (TypeContainer.GetClassBases): It is an error to have a
1429 non-interface in the list of interfaces (at this point, either
1430 parent was properly set, or a base class is being listed in the
1431 interfaces section).
1433 This flags error 1722, and resolves the crash from bug 69259.
1435 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1437 * statement.cs (Using.EmitExpressionFinally): make this work right
1438 for valuetypes. Fixes 69926.
1440 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1442 * const.cs (Const.ChangeType): Cope with the "0 literal can be
1443 converted to an enum" here, before we try to change the underlying
1444 type. This code exists, but it is a different code path than the
1445 one used while encoding constants.
1447 (ImplicitReferenceConversionExists): In addition, resynchronized
1448 the code here, so it matches the same code in
1449 ImplicitReferenceConversionExists for the `from any class-type S
1450 to any interface-type T'.
1452 2004-11-25 Marek Safar <marek.safar@seznam.cz>
1454 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
1456 2004-11-24 Miguel de Icaza <miguel@ximian.com>
1458 * cs-parser.jay: Use verbosity accordingly.
1460 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1462 * expression.cs (Unary.ResolveOperator): Do not report warning;
1463 AddressOf reads from variable.
1465 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
1467 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1471 * attribute.cs (Attributable): Removed CheckTargets.
1472 (Attributes.Emit): Explicit attribute targets are tested here.
1474 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1475 not enabled for interfaces.
1477 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1478 (GetAssemblyName): Ouch next bug there.
1480 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1482 * expression.cs: Error 275 added.
1484 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1486 Fix bug #69177 (Implemented decimal constant support)
1488 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1489 (BinaryFold): Add DecimalConstant.
1491 * const.cs (Define): Decimal constant
1493 (ChangeType): Add decimal type handling.
1494 (LookupConstantValue): Don't set value for decimal type but
1495 emit DecimalConstantAttribute. Needed for constant optimization.
1497 * constant.cs (ToDecimal): New method.
1498 (ConvertToDecimal): New method.
1499 (IntConstant): Implemented ConvertToDecimal.
1500 (DecimalConstant.Emit): Emit optimized version for decimals in
1503 * expression.cs (ResolveOperator): Changed order of constant
1504 reduction to work correctly with native types which have
1505 overloaded operators.
1506 (ResolveMemberAccess): Extract constant value from attribute
1509 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1511 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1512 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1513 (ChangeType): Decimal is special.
1514 (TypeToCoreType): Add decimal type.
1516 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1518 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1521 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1523 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1526 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1528 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1530 * pending.cs (PendingImplementation): Grab only interfaces.
1532 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1534 * statement.cs (ForeachHelperMethods): Add location member and
1535 error 202 detection.
1537 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1539 * expression.cs (DoResolveBase): Fixed wrong warning for out
1542 2004-12-04 Martin Baulig <martin@ximian.com>
1544 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
1545 to check whether the conversion is ok.
1547 * typemanager.cs (TypeManager.GetTypeArguments): Just return
1548 `Type.EmptyTypes' if we're not a generic TypeContainer.
1550 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1552 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1553 old bug: when converting from the null literal to a pointer,
1554 return an EmptyCast, not the NullLiteral.
1556 This fixes #69921, the recent null_type changes probably made this
1559 2004-12-03 Martin Baulig <martin@ximian.com>
1561 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1562 method as our child, call AnonymousMethod.Compatible() on it.
1564 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1566 * class.cs (FieldBase): Use an unused bit field from the field to
1567 encode the `has_offset' property from the FieldMember. This saves
1568 a couple of Ks on bootstrap compilation.
1570 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1571 method as our child, return the AnonymousMethod resolved
1574 * expression.cs (New.DoResolve): Allow return values from
1575 NewDelegate to also include AnonymousMethods.
1579 2004-11-29 Raja R Harinath <rharinath@novell.com>
1581 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
1583 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
1584 System.Runtime.InteropServices._Exception, since it's a base
1585 interface of the core type System.Exception in the net_2_0 profile.
1587 2004-11-27 Martin Baulig <martin@ximian.com>
1589 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
1591 2004-11-26 Raja R Harinath <rharinath@novell.com>
1593 * Makefile: Convert to use executable.make.
1594 * gmcs.exe.sources: New.
1596 2004-11-25 Martin Baulig <martin@ximian.com>
1598 * expression.cs (Invocation.InferType): Added support for byref types.
1600 2004-11-25 Martin Baulig <martin@ximian.com>
1602 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
1603 in TypeManager.TypeToCoreType().
1605 2004-11-25 Martin Baulig <martin@ximian.com>
1607 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
1608 "Dispose" method from the `current_type'.
1609 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
1610 DoDefineMembers() instead of using the MethodBuilder; this is
1611 required for generic iterators.
1613 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
1615 2004-11-24 Martin Baulig <martin@ximian.com>
1617 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
1619 2004-11-20 Martin Baulig <martin@ximian.com>
1621 * expression.cs (Invocation.InferType): Correctly infer generic
1622 instances; see gen-103.cs.
1623 (Invocation.InferTypeArguments): If a generic method doesn't have
1624 any unbound type parameters, we don't need to infer anything.
1626 2004-11-19 Raja R Harinath <rharinath@novell.com>
1628 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1630 2004-11-17 Raja R Harinath <rharinath@novell.com>
1632 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1633 (TypeHandle.GetMemberCache): New.
1634 (TypeHandle.TypeHandle): Update.
1635 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1636 (TypeManager.LookupParentInterfacesCache):
1637 Rename from LookupInterfaceCache. Optimize slightly.
1638 (TypeManager.MemberLookup_FindMembers): Update.
1639 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1641 (AddCacheContents): Rename from AddHashtable.
1642 * class.cs (TypeContainer.parent_container): Remove.
1643 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1644 (TypeContainer.DoDefineMembers): Don't initialize it.
1645 Update to name changes.
1647 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1649 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1650 that factors the code to check access modifiers on override.
1652 (PropertyBase): Use the code here.
1654 Patch from Lluis S'anchez, fixes bug #69361.
1656 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1658 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1659 routine that is used to report the use of a captured variable
1660 whose address has been taken.
1662 There are two checks: one when variables are being captured and
1663 the other check is when the address of a variable is taken.
1665 (because an anonymous methods might be resolved before *or* after
1666 the address has been taken) and
1668 * expression.cs (Conditional.DoResolve): Remove the special
1669 casing that Martin added to trueExpr and falseExpr being both
1670 NullLiteral. We get the right behavior now just by introducing
1671 the null_type into the compiler.
1673 * convert.cs (ExplicitConversion): Change the code to use
1674 null_type instead of testing `expr is NullLiteral'.
1675 (ImplicitConversionStandard): use null_type too.
1676 (ImplicitReferenceConversionExists): use null_type too.
1677 (ImplicitReferenceConversion): use null_type too.
1679 * literal.cs: The type of `NullLiteral' is now null_type instead
1681 (Resolve): Set the type here.
1683 * typemanager.cs: Introduce null_type.
1685 2004-11-18 Martin Baulig <martin@ximian.com>
1688 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1690 2004-11-18 Martin Baulig <martin@ximian.com>
1692 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1694 2004-11-18 Martin Baulig <martin@ximian.com>
1696 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1697 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1698 call ResolveConstructedType() on it to resolve it without checking
1700 (Constraints.ResolveTypes): Check them here.
1701 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1702 but don't check constraints.
1703 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1704 check constraints here.
1705 (ConstructedType.ResolveConstructedType): New public method. This
1706 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1707 resolve ourselves without checking constraints.
1709 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1711 2004-11-18 Martin Baulig <martin@ximian.com>
1714 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1716 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1718 2004-11-18 Martin Baulig <martin@ximian.com>
1720 * ecore.cs (TypeExpr.ResolveType): Removed.
1721 (Expression.ResolveAsTypeTerminal): We always return a fully
1722 resolved `TypeExpr', so we can just access its `Type'.
1724 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1726 2004-11-17 Martin Baulig <martin@ximian.com>
1728 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1729 sure we don't return any unresolved TypeExpr's.
1730 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1732 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1734 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1735 unresolved `ConstructedType's.
1737 2004-11-17 Martin Baulig <martin@ximian.com>
1739 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1741 2004-11-17 Martin Baulig <martin@ximian.com>
1744 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1746 * decl.cs (DeclSpace.ResolveType): Removed.
1747 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1749 2004-11-17 Martin Baulig <martin@ximian.com>
1751 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1752 direction, like FindMembers() does. Fixes #69546, testcase is in
1755 2004-11-16 Martin Baulig <martin@ximian.com>
1757 This is based on a patch from Marek Safar, see bug #69082.
1758 Fixes bugs #63705 and #67130.
1760 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1761 method; create a MemberCache for an interface type and cache the
1764 * decl.cs (IMemberContainer.ParentContainer): Removed.
1765 (IMemberContainer.ParentCache): New property.
1766 (MemberCache.SetupCacheForInterface): Removed.
1767 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1768 to create a cache for an interface's "parent".
1770 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1773 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1775 * statement.cs: Avoid adding bools to a hashtable.
1777 2004-11-15 Martin Baulig <martin@ximian.com>
1779 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1781 2004-11-11 Martin Baulig <martin@ximian.com>
1783 * typemanager.cs (TypeManager.GetMethodName): New method.
1785 * class.cs (MethodData.Define): Include the generic arity in the
1786 name of an explicit interface; also add it to the method name.
1788 * pending.cs (PendingImplementation.InterfaceMethod): The method
1789 name now includes the generic arity.
1791 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1793 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1794 calling an unsafe method from a safe location.
1796 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1799 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1801 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1803 * namespace.cs (VerifyUsing): use GetPartialName instead of
1806 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1808 * statement.cs (Return.Resolve): Fix regression in typo: if
1809 `in_exc', we have to request a NeedReturnLabel, this was a typo
1810 introduced in the anonymous method check-in. Fixes #69131.
1812 * Indexers were using the ShortName when defining themselves,
1813 causing a regression in the compiler bootstrap when applying the
1814 patch from 2004-11-02 (first part), now they use their full name
1815 and the bug is gone.
1817 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1819 * driver.cs: Strip the path from the names of embedded resources. Fixes
1822 2004-11-04 Raja R Harinath <rharinath@novell.com>
1824 Fix error message regression: cs0104-2.cs.
1825 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1826 (AliasEntry.Resolve): Update.
1827 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1829 (RootContext.LookupType): Update.
1831 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1833 * cs-parser.jay: Add support for handling accessor modifiers
1834 * class: Add support port accessor modifiers and error checking,
1835 define PropertyMethod.Define as virtual (not abstract anymore)
1836 * ecore.cs: Add checking for proeprties access with access modifiers
1837 * iterators.cs: Modify Accessor constructor call based in the modified
1839 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1841 * expression.cs (StringConcat): Handle being called twice,
1842 as when we have a concat in a field init with more than two
1845 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1847 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1848 special case explicit implementations, we should always produce
1849 the .property or .event declaration.
1851 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1852 since it will not return correct data if people use this
1853 unresolved in the presence of using statements (see test-313).
1855 * class.cs (MethodData.Define): If we are an explicit interface
1856 implementation, set the method name to the full name of the
1857 interface plus the name of the method.
1859 Notice that using the method.MethodName.GetFullName() does not
1860 work, as it will only contain the name as declared on the source
1861 file (it can be a shorthand in the presence of using statements)
1862 and not the fully qualifed type name, for example:
1866 class D : ICloneable {
1867 object ICloneable.Clone () {
1871 Would produce a method called `ICloneable.Clone' instead of
1872 `System.ICloneable.Clone'.
1874 * namespace.cs (Alias.Resolve): Use GetPartialName.
1876 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1878 * cs-parser.jay: Add error 1055 report.
1880 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1882 * assign.cs (Assign.DoResolve): Only do the transform of
1883 assignment into a New if the types are compatible, if not, fall
1884 through and let the implicit code deal with the errors and with
1885 the necessary conversions.
1887 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1889 * cs-parser.jay: Add error 1031 report.
1891 * cs-tokenizer.cs: Add location for error 1038.
1893 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1895 * cs-parser.jay: Add error 1016 report.
1897 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1899 * cs-parser.jay: Add errors 1575,1611 report.
1901 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1903 * cs-parser.jay: Add error 1001 report.
1905 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1908 * attribute.cs (GetMarshal): Add method argument for
1909 caller identification.
1911 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1912 agument for GetMarshal and RuntimeMissingSupport.
1914 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1916 * attribute.cs (ExtractSecurityPermissionSet): Removed
1917 TypeManager.code_access_permission_type.
1919 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1921 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1923 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1924 for obsolete use of a variable here. Fixes regression on errors
1925 cs0619-25 and cs0619-26.
1927 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1929 Fix #62358, implemented security attribute encoding.
1931 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1932 Tests permitted SecurityAction for assembly or other types.
1933 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1934 data from SecurityPermissionAttribute to PermisionSet class.
1936 * class.cs (ApplyAttributeBuilder): Added special handling
1937 for System.Security.Permissions.SecurityAttribute based types.
1939 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1940 special handling for System.Security.Permissions.SecurityAttribute
1943 * enum.cs (ApplyAttributeBuilder): Added special handling
1944 for System.Security.Permissions.SecurityAttribute based types.
1946 * parameter.cs (ApplyAttributeBuilder): Added special handling
1947 for System.Security.Permissions.SecurityAttribute based types.
1949 * rootcontext.cs: Next 2 core types.
1951 * typemanager.cs (TypeManager.security_permission_attr_type):
1952 Built in type for the SecurityPermission Attribute.
1953 (code_access_permission_type): Build in type.
1955 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1957 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1958 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1959 all of this information into
1960 EmitContext.EmitCapturedVariableInstance.
1962 * codegen.cs (EmitCapturedVariableInstance): move here the
1963 funcionality of emitting an ldarg.0 in the presence of a
1964 remapping. This centralizes the instance emit code.
1966 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1967 then emit a load of this: it means that we have reached the
1968 topmost ScopeInfo: the one that contains the pointer to the
1969 instance of the class hosting the anonymous method.
1971 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1972 captures to the topmost CaptureContext.
1974 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1976 * expression.cs (LocalVariableReference): Move the knowledge about
1977 the iterators into codegen's EmitCapturedVariableInstance.
1979 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1981 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1982 all code paths return a value from an anonymous method (it is the
1983 same as the 161 error, but for anonymous methods).
1985 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1987 The introduction of anonymous methods in the compiler changed
1988 various ways of doing things in the compiler. The most
1989 significant one is the hard split between the resolution phase
1990 and the emission phases of the compiler.
1992 For instance, routines that referenced local variables no
1993 longer can safely create temporary variables during the
1994 resolution phase: they must do so from the emission phase,
1995 since the variable might have been "captured", hence access to
1996 it can not be done with the local-variable operations from the runtime.
2000 (Block.Flags): New flag `IsTopLevel' to indicate that this block
2001 is a toplevel block.
2003 (ToplevelBlock): A new kind of Block, these are the blocks that
2004 are created by the parser for all toplevel method bodies. These
2005 include methods, accessors and anonymous methods.
2007 These contain some extra information not found in regular blocks:
2008 A pointer to an optional CaptureContext (for tracking captured
2009 local variables and parameters). A pointer to the parent
2012 (Return.Resolve): Catch missmatches when returning a value from an
2013 anonymous method (error 1662).
2014 Invoke NeedReturnLabel from the Resolve phase instead of the emit
2017 (Break.Resolve): ditto.
2019 (SwitchLabel): instead of defining the labels during the
2020 resolution phase, we now turned the public ILLabel and ILLabelCode
2021 labels into methods called GetILLabelCode() and GetILLabel() that
2022 only define the label during the Emit phase.
2024 (GotoCase): Track the SwitchLabel instead of the computed label
2025 (its contained therein). Emit the code by using
2026 SwitchLabel.GetILLabelCode ().
2028 (LocalInfo.Flags.Captured): A new flag has been introduce to track
2029 whether the Local has been captured or not.
2031 (LocalInfo.IsCaptured): New property, used to tell whether the
2032 local has been captured.
2034 * anonymous.cs: Vastly updated to contain the anonymous method
2037 The main classes here are: CaptureContext which tracks any
2038 captured information for a toplevel block and ScopeInfo used to
2039 track the activation frames for various local variables.
2041 Each toplevel block has an optional capture context associated
2042 with it. When a method contains an anonymous method both the
2043 toplevel method and the anonymous method will create a capture
2044 context. When variables or parameters are captured, they are
2045 recorded on the CaptureContext that owns them, for example:
2049 MyDelegate d = delegate {
2054 Here `a' will be recorded as captured on the toplevel
2055 CapturedContext, the inner captured context will not have anything
2056 (it will only have data if local variables or parameters from it
2057 are captured in a nested anonymous method.
2059 The ScopeInfo is used to track the activation frames for local
2060 variables, for example:
2062 for (int i = 0; i < 10; i++)
2063 for (int j = 0; j < 10; j++){
2064 MyDelegate d = delegate {
2069 At runtime this captures a single captured variable `i', but it
2070 captures 10 different versions of the variable `j'. The variable
2071 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
2072 recorded on a child.
2074 The toplevel ScopeInfo will also track information like the `this'
2075 pointer if instance variables were referenced (this is necessary
2076 as the anonymous method lives inside a nested class in the host
2077 type of the method).
2079 (AnonymousMethod): Expanded to track the Toplevel, implement
2080 `AnonymousMethod.Compatible' to tell whether an anonymous method
2081 can be converted to a target delegate type.
2083 The routine now also produces the anonymous method content
2085 (AnonymousDelegate): A helper class that derives from
2086 DelegateCreation, this is used to generate the code necessary to
2087 produce the delegate for the anonymous method that was created.
2089 * assign.cs: API adjustments for new changes in
2090 Convert.ImplicitStandardConversionExists.
2092 * class.cs: Adjustments to cope with the fact that now toplevel
2093 blocks are of type `ToplevelBlock'.
2095 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
2096 insteda of standard blocks.
2098 Flag errors if params arguments are passed to anonymous methods.
2100 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
2101 `CurrentAnonymousMethod' which points to the current Anonymous
2102 Method. The variable points to the AnonymousMethod class that
2103 holds the code being compiled. It is set in the new EmitContext
2104 created for the anonymous method.
2106 (EmitContext.Phase): Introduce a variable and an enumeration to
2107 assist in enforcing some rules about when and where we are allowed
2108 to invoke certain methods (EmitContext.NeedsReturnLabel is the
2109 only one that enfonces this right now).
2111 (EmitContext.HaveCaptureInfo): new helper method that returns
2112 whether we have a CapturedContext initialized.
2114 (EmitContext.CaptureVariable): New method used to register that a
2115 LocalInfo must be flagged for capturing.
2117 (EmitContext.CapturedParameter): New method used to register that a
2118 parameters must be flagged for capturing.
2120 (EmitContext.CapturedField): New method used to register that a
2121 field must be flagged for capturing.
2123 (EmitContext.HaveCapturedVariables,
2124 EmitContext.HaveCapturedFields): Return whether there are captured
2125 variables or fields.
2127 (EmitContext.EmitMethodHostInstance): This is used to emit the
2128 instance for the anonymous method. The instance might be null
2129 (static methods), this (for anonymous methods that capture nothing
2130 and happen to live side-by-side with the current method body) or a
2131 more complicated expression if the method has a CaptureContext.
2133 (EmitContext.EmitTopBlock): Routine that drives the emission of
2134 code: it will first resolve the top block, then emit any metadata
2135 and then emit the code. The split is done so that we can extract
2136 any anonymous methods and flag any captured variables/parameters.
2138 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
2139 during this phase, the ILGenerator should not be used as labels
2140 and local variables declared here might not be accessible to any
2141 code that is part of an anonymous method.
2143 Exceptions to this include the temporary variables that are
2144 created by some statements internally for holding temporary
2147 (EmitContext.EmitMeta): New routine, in charge of emitting all the
2150 (EmitContext.TemporaryReturn): This method is typically called
2151 from the Emit phase, and its the only place where we allow the
2152 ReturnLabel to be defined other than the EmitMeta. The reason is
2153 that otherwise we would have to duplicate a lot of logic in the
2154 Resolve phases of various methods that today is on the Emit
2157 (EmitContext.NeedReturnLabel): This no longer creates the label,
2158 as the ILGenerator is not valid during the resolve phase.
2160 (EmitContext.EmitThis): Extended the knowledge in this class to
2161 work in anonymous methods in addition to iterators.
2163 (EmitContext.EmitCapturedVariableInstance): This emits whatever
2164 code is necessary on the stack to access the instance to a local
2165 variable (the variable will be accessed as a field).
2167 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
2168 EmitContext.EmitAddressOfParameter): Routines to support
2169 parameters (not completed at this point).
2171 Removals: Removed RemapLocal and RemapLocalLValue. We probably
2172 will also remove the parameters.
2174 * convert.cs (Convert): Define a `ConstantEC' which points to a
2175 null. This is just to prefity some code that uses
2176 ImplicitStandardConversion code and do not have an EmitContext
2179 The idea is to flag explicitly that at that point in time, it is
2180 known that the conversion will not trigger the delegate checking
2181 code in implicit conversions (which requires a valid
2184 Everywhere: pass new EmitContext parameter since
2185 ImplicitStandardConversionExists now requires it to check for
2186 anonymous method conversions.
2188 (Convert.ImplicitStandardConversionExists): If the type of an
2189 expression is the anonymous_method_type, and the type is a
2190 delegate, we invoke the AnonymousMethod.Compatible method to check
2191 whether an implicit conversion is possible.
2193 (Convert.ImplicitConversionStandard): Only do implicit method
2194 group conversions if the language level is not ISO_1.
2196 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2197 MethodInfo for the Invoke method. used by Delegate and
2200 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2201 method conversions if the target type is a delegate.
2203 Removed extra debugging nops.
2205 (LocalVariableReference): Turn the `local_info' into a public
2208 Add `prepared' field, the same hack used for FieldExprs to cope
2209 with composed assignments, as Local variables do not necessarily
2210 operate purely on the stack as they used to: they can be captured
2213 Add `temp' for a temporary result, like fields.
2215 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2217 It now copes with Local variables that are captured and emits the
2218 proper instance variable to load it from a field in the captured
2221 (ParameterReference.DoResolveBase): During the resolve phase,
2222 capture parameters if we are in an anonymous method.
2224 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2225 anonymous method, use the EmitContext helper routines to emit the
2226 parameter reference.
2228 * iterators.cs: Set RemapToProxy to true/false during the
2231 * parameters.cs (GetParameterByName): New helper method.
2233 * typemanager.cs (anonymous_method_type) a new type that
2234 represents an anonyous method. This is always an internal type,
2235 used as a fencepost to test against the anonymous-methodness of an
2238 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2240 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2242 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2244 2004-11-10 Martin Baulig <martin@ximian.com>
2246 * expression.cs (Invocation.BetterFunction): If two methods have
2247 equal parameter types, but only one of them is generic, the
2248 non-generic one wins.
2249 (New.DoResolve): Don't set `is_struct' to false if we're a generic
2250 instance; just use `Type.IsValueType' to determine whether
2251 something is a struct or not.
2252 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
2253 so we can be called multiple times.
2255 2004-11-10 Martin Baulig <martin@ximian.com>
2257 * generic.cs (TypeParameter.DefineConstraints): New public method.
2258 (TypeParameter.CheckAccessLevel): Override this and return true.
2259 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
2260 override ResolveType() anymore.
2261 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
2263 2004-11-10 Martin Baulig <martin@ximian.com>
2265 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
2266 call DeclSpace.ResolveNestedType() on it.
2268 2004-11-10 Martin Baulig <martin@ximian.com>
2270 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
2271 non-null, call ParameterModifier() on it.
2273 2004-11-10 Martin Baulig <martin@ximian.com>
2276 (Iterators): Added `current_type' and `this_type' fields.
2277 (Iterators.DefineIterator): Create a new EmitContext and store it
2278 in `ec'; compute `this_type'.
2280 2004-11-10 Martin Baulig <martin@ximian.com>
2283 (TypeManager.IsPrivateAccessible): New public method.
2284 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
2286 2004-11-10 Martin Baulig <martin@ximian.com>
2288 * class.cs (TypeContainer.DefineType): Call
2289 TypeBuilder.DefineGenericParameters() before resolving the type
2291 (MethodData.parent_method): New protected field.
2292 (MethodData..ctor): Added `MethodInfo parent_method' argument.
2293 (MethodData.Define): Compute `parent_method'.
2296 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
2297 (MemberCore.GetClsCompliantAttributeValue): Likewise.
2298 (DeclSpace.ec): New protected field; store the EmitContext here.
2299 (DeclSpace.EmitContext): New public property.
2300 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
2301 (DeclSpace.ResolveNestedType): New public method.
2302 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
2303 (DeclSpace.NestedAccessible): Added `Type tb' argument.
2304 (DeclSpace.FamilyAccessible): Likewise.
2305 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
2306 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
2309 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
2312 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
2313 (Enum.Emit): Don't create a new EmitContext.
2315 2004-10-18 Martin Baulig <martin@ximian.com>
2317 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2318 `Type' directly, but call ResolveType() on it.
2319 (Catch.Resolve): Likewise.
2320 (Foreach.Resolve): Likewise.
2322 2004-10-18 Martin Baulig <martin@ximian.com>
2324 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2325 `Type' directly, but call ResolveType() on it.
2326 (Probe.DoResolve): Likewise.
2327 (ArrayCreation.LookupType): Likewise.
2328 (TypeOf.DoResolve): Likewise.
2329 (SizeOf.DoResolve): Likewise.
2331 2004-10-18 Raja R Harinath <rharinath@novell.com>
2333 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2336 2004-10-17 John Luke <john.luke@gmail.com>
2338 * class.cs (Operator.GetSignatureForError): use CSharpName
2340 * parameter.cs (Parameter.GetSignatureForError): Returns
2341 correct name even if was not defined.
2343 2004-10-13 Raja R Harinath <rharinath@novell.com>
2346 * class.cs (TypeContainer.EmitContext): New property.
2347 (DefineNestedTypes): Create an emitcontext for each part.
2348 (MethodCore.DoDefineParameters): Use container's emitcontext.
2349 Pass type array to InternalParameters.
2350 (MemberBase.DoDefine): Use container's emitcontext.
2351 (FieldMember.Define): Likewise.
2352 (Event.Define): Likewise.
2353 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2354 Pass type array to InternalParameters.
2355 (SetIndexerMethod.GetParameterInfo): Likewise.
2356 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2357 * delegate.cs (Define): Pass emitcontext to
2358 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2359 array to InternalParameters.
2360 * expression.cs (ParameterReference.DoResolveBase): Pass
2361 emitcontext to GetParameterInfo.
2362 (ComposedCast.DoResolveAsTypeStep): Remove check on
2363 ec.ResolvingTypeTree.
2364 * parameter.cs (Parameter.Resolve): Change argument to
2365 EmitContext. Use ResolveAsTypeTerminal.
2366 (Parameter.GetSignature): Change argument to EmitContext.
2367 (Parameters.ComputeSignature): Likewise.
2368 (Parameters.ComputeParameterTypes): Likewise.
2369 (Parameters.GetParameterInfo): Likewise.
2370 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2371 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2372 * support.cs (InternalParameters..ctor): Remove variant that takes
2374 * typemanager.cs (system_intptr_expr): New.
2375 (InitExpressionTypes): Initialize it.
2377 2004-10-12 Chris Toshok <toshok@ximian.com>
2379 * cs-parser.jay: fix location for try_statement and catch_clause.
2381 2004-10-18 Martin Baulig <martin@ximian.com>
2383 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2384 `Type' directly, but call ResolveType() on it.
2385 (MemberBase.DoDefine): Likewise.
2387 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2388 `Type' directly, but call ResolveType() on it.
2389 (ComposedCast.DoResolveAsTypeStep): Likewise.
2391 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2392 `Type' directly, but call ResolveType() on it.
2394 2004-10-17 John Luke <john.luke@gmail.com>
2396 * class.cs (Operator.GetSignatureForError): use CSharpName
2398 * parameter.cs (Parameter.GetSignatureForError): Returns
2399 correct name even if was not defined.
2401 2004-10-13 Raja R Harinath <rharinath@novell.com>
2404 * class.cs (TypeContainer.EmitContext): New property.
2405 (DefineNestedTypes): Create an emitcontext for each part.
2406 (MethodCore.DoDefineParameters): Use container's emitcontext.
2407 Pass type array to InternalParameters.
2408 (MemberBase.DoDefine): Use container's emitcontext.
2409 (FieldMember.Define): Likewise.
2410 (Event.Define): Likewise.
2411 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2412 Pass type array to InternalParameters.
2413 (SetIndexerMethod.GetParameterInfo): Likewise.
2414 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2415 * delegate.cs (Define): Pass emitcontext to
2416 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2417 array to InternalParameters.
2418 * expression.cs (ParameterReference.DoResolveBase): Pass
2419 emitcontext to GetParameterInfo.
2420 (ComposedCast.DoResolveAsTypeStep): Remove check on
2421 ec.ResolvingTypeTree.
2422 * parameter.cs (Parameter.Resolve): Change argument to
2423 EmitContext. Use ResolveAsTypeTerminal.
2424 (Parameter.GetSignature): Change argument to EmitContext.
2425 (Parameters.ComputeSignature): Likewise.
2426 (Parameters.ComputeParameterTypes): Likewise.
2427 (Parameters.GetParameterInfo): Likewise.
2428 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2429 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2430 * support.cs (InternalParameters..ctor): Remove variant that takes
2432 * typemanager.cs (system_intptr_expr): New.
2433 (InitExpressionTypes): Initialize it.
2435 2004-10-12 Chris Toshok <toshok@ximian.com>
2437 * cs-parser.jay: fix location for try_statement and catch_clause.
2439 2004-10-07 Raja R Harinath <rharinath@novell.com>
2441 More DeclSpace.ResolveType avoidance.
2442 * decl.cs (MemberCore.InUnsafe): New property.
2443 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2444 with newly created EmitContext.
2445 (FieldMember.Define): Likewise.
2446 * delegate.cs (Delegate.Define): Likewise.
2447 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2448 only if normal name-lookup fails.
2449 (TypeExpr.DoResolve): Enable error-checking.
2450 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2451 (SizeOf.DoResolve): Likewise.
2452 (ComposedCast.DoResolveAsTypeStep): Likewise.
2453 (StackAlloc.DoResolve): Likewise.
2454 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2455 (Block.Unsafe): New property.
2456 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2457 (Unsafe): Set 'unsafe' flag of contained block.
2458 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2459 (Fixed.Resolve): Likewise.
2460 (Catch.Resolve): Likewise.
2461 (Using.ResolveLocalVariableDecls): Likewise.
2462 (Foreach.Resolve): Likewise.
2464 2004-10-05 John Luke <john.luke@gmail.com>
2466 * cs-parser.jay: add location to error CS0175
2468 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2470 * ecore.cs (Expression.Constantity): Add support for turning null
2473 * const.cs (Const.Define): Allow constants to be reference types
2474 as long as the value is Null.
2476 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2478 * namespace.cs (NamespaceEntry.Using): No matter which warning
2479 level is set, check if this namespace name has already been added.
2481 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2483 * expression.cs: reftype [!=]= null should always use br[true,false].
2486 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2489 * attribute.cs: Enum conversion moved to
2490 GetAttributeArgumentExpression to be applied to the all
2493 2004-10-01 Raja R Harinath <rharinath@novell.com>
2495 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2496 * class.c (TypeContainer.DefineType): Flag error if
2497 base types aren't accessible due to access permissions.
2498 * decl.cs (DeclSpace.ResolveType): Move logic to
2499 Expression.ResolveAsTypeTerminal.
2500 (DeclSpace.ResolveTypeExpr): Thin layer over
2501 Expression.ResolveAsTypeTerminal.
2502 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2503 Refactor code into NestedAccess. Use it.
2504 (DeclSpace.NestedAccess): New.
2505 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2506 argument to silence errors. Check access permissions.
2507 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2508 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2509 (Cast.DoResolve): Likewise.
2510 (New.DoResolve): Likewise.
2511 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2512 (TypeOf.DoResolve): Likewise.
2514 * expression.cs (Invocation.BetterConversion): Return the Type of
2515 the better conversion. Implement section 14.4.2.3 more faithfully.
2516 (Invocation.BetterFunction): Make boolean. Make correspondence to
2517 section 14.4.2.2 explicit.
2518 (Invocation.OverloadResolve): Update.
2519 (Invocation): Remove is_base field.
2520 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2521 (Invocation.Emit): Likewise.
2523 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2525 * cs-parser.jay: Reverted 642 warning fix.
2527 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2530 * decl.cs (FindMemberWithSameName): Indexer can have more than
2533 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2535 * expression.cs (LocalVariableReference.DoResolveLValue):
2536 Do not report warning 219 for out values.
2537 (EmptyExpression.Null): New member to avoid extra allocations.
2539 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2541 * cs-parser.jay: Fix wrong warning 642 report.
2543 * cs-tokenizer.cs (CheckNextToken): New helper;
2544 Inspect next character if is same as expected.
2546 2004-09-23 Martin Baulig <martin@ximian.com>
2548 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2549 (Convert.ImplicitReferenceConversionExists): Likewise.
2551 2004-11-09 Raja R Harinath <rharinath@novell.com>
2553 * Makefile (DISTFILES): Comment out a few missing files.
2555 2004-10-29 Raja R Harinath <rharinath@novell.com>
2557 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
2558 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
2559 (gmcs.exe): Invoke bootstrap-libs.
2560 (clean-local): Clean the net_2_0_bootstrap profile too.
2561 (PROGRAM_INSTALL_DIR): New.
2562 (install-local): Use it.
2564 2004-10-13 Martin Baulig <martin@ximian.com>
2566 * generic.cs (TypeManager.InflatedConstraints): New nested class.
2567 (TypeParameter.DefineType): If we're a method type parameter and
2568 that method is overriding something, "inflate" its constraints.
2570 2004-10-12 Martin Baulig <martin@ximian.com>
2572 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
2573 and have type arguments, create and resolve a ConstructedType.
2575 2004-10-12 Martin Baulig <martin@ximian.com>
2577 * decl.cs (MemberCache.FindMemberToOverride): Use
2578 TypeManager.IsEqual() to compare the parameters and Type.Equals()
2579 to compare the invocationType.
2581 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
2582 When comparing two type parameters, only do the signature-only
2583 comparision for method type parameters.
2585 2004-10-11 Martin Baulig <martin@ximian.com>
2587 * report.cs: Don't make --fatal abort on warnings, we have
2588 -warnaserror for that.
2590 2004-10-11 Martin Baulig <martin@ximian.com>
2593 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
2594 (TypeManager.IsEqual): Call ourself recursively instead of using
2597 2004-10-11 Martin Baulig <martin@ximian.com>
2599 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
2600 on our own type parameters, not on the ones we inherit from a containing
2603 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
2606 * generic.cs (TypeParameter.Define): We may only be called once.
2608 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
2609 instead of TypeManager.IsEqual().
2611 2004-09-28 Martin Baulig <martin@ximian.com>
2614 (GenericConstraints.EffectiveBaseClass): New public property.
2615 (TypeParameter.GenericConstraints): New public property.
2616 (ConstructedType.CheckConstraints): Improved.
2618 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
2619 (Convert.TypeParameterConversion): New private method; use this in
2620 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
2621 for all conversions related to type parameters.
2623 2004-09-24 Martin Baulig <martin@ximian.com>
2625 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2626 type parameter conversions for type parameters which are known to
2629 2004-09-24 Martin Baulig <martin@ximian.com>
2631 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2632 `IsValueType' properties.
2634 * support.cs (ReflectionConstraints): Use
2635 Type.GetGenericParameterConstraints() instead of the old hack.
2637 2004-09-24 Martin Baulig <martin@ximian.com>
2639 * generic.cs (GenericConstraints): Moved here and made it an
2642 * support.cs (GenericConstraints): Moved to generic.cs.
2644 2004-09-24 Martin Baulig <martin@ximian.com>
2647 (ReflectionConstraints): Un-nested this class and made it public.
2650 (TypeManager.GetTypeParameterConstraints): New public method.
2651 (TypeManager.HasConstructorConstraint): Use the attributes.
2653 2004-09-24 Martin Baulig <martin@ximian.com>
2655 * support.cs (GenericConstraints): Replaced `HasConstructor',
2656 `IsReferenceType' and `IsValueType' with `Attributes'.
2657 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2658 method and made the .ctor public.
2660 * generic.cs (Constraints.Attributes): New public property.
2661 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2662 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2663 `IsValueType' -> `HasValueTypeConstraint'.
2665 2004-09-23 Martin Baulig <martin@ximian.com>
2667 * generic.cs (Constraints): Reflect latest runtime changes.
2669 2004-09-23 Martin Baulig <martin@ximian.com>
2671 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2672 (Convert.ImplicitReferenceConversionExists): Likewise.
2674 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2676 * class.cs (Operator.Define): Add error 448 and 559 report.
2678 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2680 * class.cs (MemberBase.IsTypePermitted): New protected
2681 method for checking error CS0610.
2683 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2685 * class.cs (TypeContainer.HasExplicitLayout): New property
2686 Returns whether container has StructLayout attribute set Explicit.
2687 (FieldMember): New abstract class for consts and fields.
2688 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2689 (Field): Reuse FieldMember.
2691 * const.cs (Const): Reuse FieldMember.
2693 * rootcontext.cs: EmitConstants call moved to class.
2695 2004-09-22 Martin Baulig <martin@ximian.com>
2697 Marek and me just fixed one of our oldest bugs: #28562 :-)
2699 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2701 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2702 we're an EnumConstant, just return that.
2703 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2704 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2705 to get the value which'll actually be written into the attribute.
2706 However, we have to use GetValue() to access the attribute's value
2709 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2711 * constant.cs (Constant.IsNegative): New abstract property
2714 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2715 (StackAlloc.DoResolve): Reused IsNegative.
2717 2004-09-22 Martin Baulig <martin@ximian.com>
2719 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2720 public method; like LookupTypeContainer, but also works for
2723 * report.cs (Report.SymbolRelatedToPreviousError): Use
2724 TypeManager.LookupGenericTypeContainer().
2726 2004-09-22 Martin Baulig <martin@ximian.com>
2728 Thanks to Peter Sestoft for this bug report.
2730 * expression.cs (Conditional): If both the `trueExpr' and the
2731 `falseExpr' is a NullLiteral, return a NullLiteral.
2733 2004-09-22 Martin Baulig <martin@ximian.com>
2735 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2736 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2737 for the "get_Current" call.
2739 2004-09-21 Martin Baulig <martin@ximian.com>
2741 * convert.cs (Convert.ImplicitReferenceConversion): When
2742 converting to an interface type, first check whether we're
2743 converting from a reference type.
2745 2004-09-14 Martin Baulig <martin@ximian.com>
2747 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2749 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2752 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2753 called and is obsolete then this member suppress message
2754 when call is inside next [Obsolete] method or type.
2756 * expression.cs: Use TestObsoleteMethodUsage member.
2758 2004-09-14 Martin Baulig <martin@ximian.com>
2760 * genericparser.cs: Removed.
2762 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2764 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2766 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2768 * attribute.cs (Attribute.Resolve): Add error 653 report.
2770 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2772 (Method.ApplyAttributeBuilder): Add error 685 report.
2773 (Operator.Define): Add error 564 report.
2775 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2777 * expression.cs (Invocation.DoResolve): Add error
2780 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2783 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2785 * class.cs (ConstructorInitializer.Resolve):
2786 Wrong error number (515->516).
2788 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2790 * class.cs (Indexer.Define): Add error 631 report.
2792 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2794 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2796 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2798 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2800 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2802 * cs-parser.jay: Added error CS0241 report.
2804 2004-09-10 Raja R Harinath <rharinath@novell.com>
2806 * cs-parser.jay (fixed_statement): Introduce a scope for the
2807 declaration in the 'fixed' statement.
2809 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2811 * cs-parser.jay: Added CS0230 error report.
2813 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2815 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2817 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2819 * expression.cs (Argument.Resolve): Added error CS0192 and
2822 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2824 C# 2.0 #pragma warning feature
2826 * cs-tokenizer.cs (PreProcessPragma): New method;
2827 Handles #pragma directive.
2829 * report.cs (WarningRegions): New class; Support
2830 class for #pragma warning directive. It tests whether
2831 warning is enabled for a given line.
2833 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2835 * const.cs: Add more descriptive error report, tahnks to
2838 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2840 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2842 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2844 * expression.cs: Apply patch from Ben: Remove dead code from
2845 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2846 as that code just threw an exception anwyays.
2848 * const.cs: Remove the call to the turnintoconstant, for details
2851 * literal.cs: The type of the null-literal is the null type; So
2852 we use a placeholder type (literal.cs:System.Null, defined here)
2855 * expression.cs (Conditional.DoResolve): Remove some old code that
2856 is no longer needed, conversions have been fixed.
2858 (ArrayCreationExpression.DoResolve): Return false if we fail to
2859 resolve the inner expression.
2861 2004-09-07 Raja R Harinath <rharinath@novell.com>
2864 * cs-parser.jay (delegate_declaration): Record a delegate
2865 declaration as a type declaration.
2866 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2868 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2870 * parameter.cs: Do not crash if the type can not be resolved.
2872 * expression.cs: Report errors with unsafe pointers, fixes #64896
2874 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2876 * expression.cs: Pointer arith always needs to do a conv.i
2877 if the operand is a long. fix 65320
2879 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2881 Fixed cs0619-37.cs, cs0619-38.cs
2883 * enum.cs (GetObsoleteAttribute): Removed.
2885 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2886 on Enum member is double staged. The first is tested member
2889 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2891 Fixed #56986, #63631, #65231
2893 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2894 adds member to name container.
2895 (TypeContainer.AddToTypeContainer): New method, adds type to
2897 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2898 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2899 AddOperator): Simplified by reusing AddToMemberContainer.
2900 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2902 (Method.CheckForDuplications): Fixed implementation to test all
2904 (MemberBase): Detection whether member is explicit interface
2905 implementation is now in constructor.
2906 (MemberBase.UpdateMemberName): Handles IndexerName.
2907 (Accessor): Changed to keep also location information.
2908 (AbstractPropertyEventMethod): Is derived from MemberCore.
2909 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2910 will be emited or not.
2911 (PropertyBase.AreAccessorsDuplicateImplementation):
2912 Tests whether accessors are not in collision with some method.
2913 (Operator): Is derived from MethodCore to simplify common
2916 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2918 (DeclSpace.AddToContainer): Adds the member to defined_names
2919 table. It tests for duplications and enclosing name conflicts.
2921 * enum.cs (EnumMember): Clean up to reuse the base structures
2923 2004-09-03 Martin Baulig <martin@ximian.com>
2925 Merged latest changes into gmcs. Please keep this comment in
2926 here, it makes it easier for me to see what changed in MCS since
2927 the last time I merged.
2929 2004-09-03 Martin Baulig <martin@ximian.com>
2931 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2932 into TypeContainer, to make partial classes work again.
2934 2004-09-03 Martin Baulig <martin@ximian.com>
2936 * rootcontext.cs (RootContext.V2): Removed.
2938 2004-03-23 Martin Baulig <martin@ximian.com>
2940 * expression.cs (Invocation.OverloadResolve): Added `bool
2941 may_fail' argument and use it instead of the Location.IsNull() hack.
2943 2004-09-09 Martin Baulig <martin@ximian.com>
2945 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
2947 2004-09-09 Martin Baulig <martin@ximian.com>
2949 * generic.cs (TypeParameter.DefineType): Added support for
2950 explicit interface methods.
2952 2004-09-09 Martin Baulig <martin@ximian.com>
2954 * README.Changes: New document. Started to list important changes
2955 between MCS and GMCS here.
2957 2004-09-08 Martin Baulig <martin@ximian.com>
2960 (TypeContainer.CheckRecursiveDefinition): New protected method.
2961 (TypeContainer.DefineType): Move the CS0146 check into
2962 CheckRecursiveDefinition().
2964 2004-09-06 Martin Baulig <martin@ximian.com>
2966 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
2967 types for the constructor constraint.
2969 2004-09-03 Martin Baulig <martin@ximian.com>
2971 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2972 into TypeContainer, to make partial classes work again.
2974 2004-09-03 Martin Baulig <martin@ximian.com>
2976 * rootcontext.cs (RootContext.V2): Removed.
2978 2004-03-23 Martin Baulig <martin@ximian.com>
2980 * expression.cs (Invocation.OverloadResolve): Added `bool
2981 may_fail' argument and use it instead of the Location.IsNull() hack.
2983 2004-09-03 Martin Baulig <martin@ximian.com>
2985 Merged latest changes into gmcs. Please keep this comment in
2986 here, it makes it easier for me to see what changed in MCS since
2987 the last time I merged.
2989 2004-09-03 Raja R Harinath <rharinath@novell.com>
2992 * expression.cs (BetterConversion): Don't allow either conversion
2993 to be null. Remove redundant implicit conversion test when 'q ==
2994 null' -- when this function is invoked, we already know that the
2995 implicit conversion exists.
2996 (BetterFunction): Assume that 'best' is non-null. Remove
2997 redundant reimplementation of IsApplicable when 'best' is null.
2998 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2999 number of arguments.
3000 (IsAncestralType): Extract from OverloadResolve.
3001 (OverloadResolve): Make robust to the MethodGroupExpr being
3002 unsorted. Implement all the logic of Section 14.5.5.1, and
3003 support overloading of methods from multiple applicable types.
3004 Clean up logic somewhat. Don't pass null methods to BetterFunction.
3006 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
3007 (RealError, Warning): Append type of report to related symbol.
3009 2004-09-03 Marek Safar <marek.safar@seznam.cz>
3011 * enum.cs: Fixed CLS-Compliance checks for enum members.
3012 Error tests cs3008-8.cs, cs3014-8.cs
3014 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3016 Fixed bug #62342, #63102
3017 * class.cs: ImplementIndexer uses member.IsExplicitImpl
3018 like ImplementMethod.
3020 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3022 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3025 2004-09-02 Martin Baulig <martin@ximian.com>
3027 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3028 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3031 2004-09-01 Marek Safar <marek.safar@seznam.cz>
3033 C# 2.0 Static classes implemented
3035 * class.cs (TypeContainer): instance_constructors,
3036 initialized_fields, initialized_static_fields,
3037 default_constructor, base_inteface_types are protected to be
3038 accessible from StaticClass.
3039 (TypeContainer.DefineDefaultConstructor): New virtual method
3040 for custom default constructor generating
3041 (StaticClass): New class to handle "Static classes" feature.
3043 * cs-parser.jay: Handle static keyword on class like instance
3046 * driver.cs: Added "/langversion" command line switch with two
3047 options (iso-1, default).
3049 2004-08-31 Marek Safar <marek.safar@seznam.cz>
3051 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
3053 2004-08-31 Miguel de Icaza <miguel@ximian.com>
3055 * delegate.cs: Style.
3057 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
3059 * delegate.cs: Add seperate instance expr field for miguel.
3061 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3063 * PointerArithmetic (Resolve): make sure we are not doing
3064 pointer arith on void*. Also, make sure we are resolved
3065 by not setting eclass until resolve.
3067 All callers: Make sure that PointerArithmetic gets resolved.
3069 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3071 * ArrayCreation (LookupType): If the type does not resolve
3072 to an array, give an error.
3074 2004-08-27 Marek Safar <marek.safar@seznam.cz>
3076 * statement.cs (Try.Resolve): Fixed bug #64222
3078 2004-08-27 Martin Baulig <martin@ximian.com>
3081 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3084 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3086 * ecore.cs (Constantify): Get underlying type via
3087 System.Enum.GetUnderlyingType to avoid StackOverflow on the
3088 Windows in special cases.
3090 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3092 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
3093 for obtaining also private methods.
3094 (GetRemoveMethod): Used GetRemoveMethod (true)
3095 for obtaining also private methods.
3097 2004-09-02 Martin Baulig <martin@ximian.com>
3099 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3100 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3103 2004-08-27 Martin Baulig <martin@ximian.com>
3106 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3109 2004-08-25 Martin Baulig <martin@ximian.com>
3111 * support.cs (ReflectionParameters..ctor): If this is a generic
3112 method, retrieve and store its type parameters.
3113 (InternalParameters..ctor): Added `TypeParameter[]' argument.
3114 (ReflectionParameters.GenericConstraints): The argument specifies
3115 the type parameter, not the method parameter.
3116 (InternalParameters.GenericConstraints): Likewise.
3118 * generic.cs (TypeParameter.DefineType): Correctly handle
3119 constraints wrt. generic methods in interfaces and their
3122 2004-08-24 Martin Baulig <martin@ximian.com>
3124 * generic.cs (TypeParameter.IsSubclassOf): New public method.
3125 (Constraints.IsSubclassOf): New internal method.
3127 * typemanager.cs (TypeManager.FindMembers): Added special support
3128 for GenericTypeParameterBuilder's.
3129 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
3132 2004-08-24 Martin Baulig <martin@ximian.com>
3135 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
3136 this for accessibility checks.
3137 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
3138 IsNestedFamilyAccessible.
3139 (TypeManager.IsSubclassOf): New method, do what the name actually
3142 2004-08-24 Martin Baulig <martin@ximian.com>
3144 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
3145 as a SimpleName, include the generic arity.
3147 2004-08-24 Martin Baulig <martin@ximian.com>
3149 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
3150 MethodAttributes.HideBySig for operators.
3152 2004-08-23 Martin Baulig <martin@ximian.com>
3154 Back to the old error reporting system :-)
3156 * report.cs (Message): Removed.
3157 (Report.MessageData, ErrorData, WarningData): Removed.
3158 (Report.Error, Warning): Back to the old system.
3160 2004-08-23 Martin Baulig <martin@ximian.com>
3162 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
3164 * class.cs (TypeContainer.ParentContainer): New public virtual
3165 method; replaces the explicit interface implementation.
3166 (ClassPart.ParentContainer): Override.
3168 2004-08-23 Martin Baulig <martin@ximian.com>
3170 * statement.cs (Switch): Added support for constant switches; see
3171 #59428 or test-285.cs.
3173 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3176 * statement.cs (GetEnumeratorFilter): Removed useless
3177 logic because C# specs is strict. GetEnumerator must be
3180 2004-08-22 Martin Baulig <martin@ximian.com>
3182 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3183 a switch and may break, reset the barrier. Fixes #59867.
3185 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3187 CLS-Compliance speed up (~5% for corlib)
3189 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
3190 New method. Tests container for CLS-Compliant names
3192 * class.cs (TypeContainer.VerifyClsName): New method.
3193 Checks whether container name is CLS Compliant.
3194 (Constructor): Implements IMethodData.
3196 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3197 low-case table for CLS Compliance test.
3198 (MemberCache.VerifyClsParameterConflict): New method.
3199 Checks method parameters for CS3006 error.
3201 * enum.cs (EnumMember): Is derived from MemberCore.
3202 (Enum.VerifyClsName): Optimized for better performance.
3204 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3206 * report.cs: Renamed Error_T to Error and changed all
3209 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3211 * class.cs (TypeContainer.IndexerArrayList): New inner class
3212 container for indexers.
3213 (TypeContainer.DefaultIndexerName): New constant for default
3214 indexer name. Replaced all "Item" with this constant.
3215 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3217 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3218 DefaultMemberAttribute constructor.
3220 2004-08-05 Martin Baulig <martin@ximian.com>
3222 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3225 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3227 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3228 multi platforms problem.
3230 * compiler.csproj: Included shared files.
3232 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3234 Fix bug 60333, 55971 in the more general way
3235 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3236 Added arg_type argument for constant conversion.
3237 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3239 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3242 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3243 OperatorArrayList, MethodCoreArrayList for typecontainer
3244 containers. Changed class member types to these new types.
3245 (MethodArrayList.DefineMembers): Added test for CS0659.
3247 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3249 * cfold.cs: Synchronize the folding with the code in expression.cs
3250 Binary.DoNumericPromotions for uint operands.
3252 * attribute.cs: Revert patch from Raja, it introduced a regression
3253 while building Blam-1.2.1 (hard to isolate a test case).
3255 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3259 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3261 (MethodCore.parent_method): New member. The method we're overriding
3262 if this is an override method.
3263 (MethodCore.CheckBase): Moved from Method class and made common.
3264 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3266 (MethodCore.CheckForDuplications): New abstract method. For custom
3267 member duplication search in a container
3268 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3269 method and its return type.
3270 (Event.conflict_symbol): New member. Symbol with same name in the
3274 (MemberCache.FindMemberWithSameName): New method. The method
3275 is looking for conflict with inherited symbols.
3277 2004-08-04 Martin Baulig <martin@ximian.com>
3279 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3281 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3283 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3285 * report.cs (Message): New enum for better error, warning reference in
3287 (MessageData): New inner abstract class. It generally handles printing of
3288 error and warning messages.
3289 Removed unused Error, Warning, Message methods.
3291 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3293 Fix for cs0592-8.cs test
3295 (Attributable.ValidAttributeTargets): Made public.
3296 (Attribute.ExplicitTarget): New member for explicit target value.
3297 (Attribute.CheckTargets): Now we translate explicit attribute
3298 target to Target here.
3300 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3302 * ecore.cs (MethodGroupExpr): new IsBase property.
3304 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3306 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3307 rather than an instance expr.
3309 (DelegateCreation.Emit): Use the method group rather than
3310 the instance expression. Also, if you have base.Foo as the
3311 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3313 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3315 (NewDelegate.DoResolve): Only check for the existance of Invoke
3316 if the method is going to be needed. Use MethodGroupExpr.
3318 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3320 * expression.cs: For pointer arith., make sure to use
3321 the size of the type, not the size of the pointer to
3324 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3327 * class.cs (Class): Added error CS0502 test.
3329 2004-08-03 John Luke <jluke@cfl.rr.com>
3330 Raja R Harinath <rharinath@novell.com>
3333 * attribute.cs (Attribute.complained_before): New flag.
3334 (Attribute.ResolveType, Attribute.Resolve),
3335 (Attribute.DefinePInvokeMethod): Set it.
3336 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3338 2004-08-03 Martin Baulig <martin@ximian.com>
3340 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3341 use a user-defined operator; we still need to do numeric
3342 promotions in case one argument is a builtin type and the other
3343 one has an implicit conversion to that type. Fixes #62322.
3345 2004-08-18 Martin Baulig <martin@ximian.com>
3347 * class.cs (Method.Define): Use the correct method name when
3348 creating the MethodBuilder for a generic method.
3350 2004-08-17 Martin Baulig <martin@ximian.com>
3352 * generic.cs (Constraints): Support type parameter constraints.
3354 2004-08-16 Martin Baulig <martin@ximian.com>
3356 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
3357 (Token.GENERIC_DIMENSION): New token; this is returned if we
3358 encounter an unbound generic type in a typeof() expression.
3360 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
3361 this token is only generated while parsing a typeof() expression.
3362 (typeof_expression): Removed the old unbound_type hack.
3364 * generic.cs (TypeArguments.IsUnbound): New public property.
3366 * decl.cs (MemberName): Added support for unbound types.
3368 2004-08-14 Martin Baulig <martin@ximian.com>
3371 (TypeManager.IsEqualGenericInstance): New static method.
3372 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
3373 just used to check accessibility, so follow the rules of 26.1.6.
3375 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
3376 ConstructedType instead of a TypeExpression if we have type arguments.
3378 * cs-parser.jay (typeof_expression): Support unbound generic types.
3380 * ecore.cs (UnboundTypeExpression): New public class.
3382 2004-08-12 Martin Baulig <martin@ximian.com>
3384 * typemanager.cs (TypeManager.IsNestedChildOf): Use
3385 TypeManager.IsEqual() rather than `=='.
3387 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
3388 generic instances as well.
3390 2004-08-12 Martin Baulig <martin@ximian.com>
3392 * expression.cs (Invocation.InferType): We can only infer method
3393 type parameters. Fixes #62647.
3395 2004-08-11 Martin Baulig <martin@ximian.com>
3397 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
3398 before resolving the base classes.
3400 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3402 * Makefile: install .mdb file too.
3404 2004-08-05 Martin Baulig <martin@ximian.com>
3406 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
3407 initializer, the current type is just the TypeBuilder, not the
3408 instantiated generic type.
3409 (FieldExpr.IsFieldInitializer): New public property.
3411 2004-08-04 Martin Baulig <martin@ximian.com>
3413 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3415 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3417 2004-08-03 Martin Baulig <martin@ximian.com>
3419 * class.cs (MethodData.Define): If we're an explicit
3420 implementation, remove the generic arity from the type name.
3422 2004-08-03 Martin Baulig <martin@ximian.com>
3424 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3425 use a user-defined operator; we still need to do numeric
3426 promotions in case one argument is a builtin type and the other
3427 one has an implicit conversion to that type. Fixes #62322.
3429 2004-08-02 Martin Baulig <martin@ximian.com>
3431 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
3433 (TypeContainer.GetClassBases): Return the unexpanded list of
3434 interfaces; we expand them later.
3435 (TypeContainer.DefineType): After creating the TypeBuilder, call
3436 TypeManager.ExpandInterfaces() to get an expanded and resolved
3439 * ecore.cs (TypeExpr.GetInterfaces): Removed
3441 * generics.cs (Constraints.InterfaceConstraints): Remove.
3442 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
3443 register the interface constraints.
3446 (TypeManager.AddUserType): Removed the `ifaces' argument.
3447 (TypeManager.AddTypeParameter): Likewise.
3448 (TypeManager.AddUserInterface): Removed, was unused.
3449 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
3450 `TypeExpr[]' array for the interfaces.
3451 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
3452 has been defined, returns a list of the resolved interfaces types.
3453 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
3454 (TypeManager.GetExplicitInterfaces): Likewise.
3456 2004-08-02 Martin Baulig <martin@ximian.com>
3458 * expression.cs (Invocation.EmitCall): If we're invoking a method
3459 on a type parameter, use the new `Constrained' prefix opcode.
3461 2004-08-02 Martin Baulig <martin@ximian.com>
3463 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3464 (LocalInfo.IsThis): New public property.
3465 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3467 2004-08-01 Martin Baulig <martin@ximian.com>
3469 * class.cs (TypeContainer.GetClassBases): Don't set the default
3470 here since we may get called from GetPartialBases().
3471 (TypeContainer.DefineType): If GetClassBases() didn't return a
3472 parent, use the default one.
3474 2004-07-30 Martin Baulig <martin@ximian.com>
3476 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3478 * class.cs (SourceMethod): New public class, derive from the
3479 symbol writer's ISourceMethod.
3480 (Method): Use the new symbol writer API.
3482 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3483 as argument and use the new symbol writer.
3486 (SourceFile): Implement the symbol writer's ISourceFile.
3487 (Location.SymbolDocument): Removed.
3488 (Location.SourceFile): New public property.
3490 * symbolwriter.cs: Use the new symbol writer API.
3492 2004-07-30 Raja R Harinath <rharinath@novell.com>
3494 * Makefile (install-local): Remove. Functionality moved to
3497 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3499 * Makefile: Install mcs.exe.config file together with mcs.exe.
3500 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3501 correct runtime version.
3503 2004-07-25 Martin Baulig <martin@ximian.com>
3506 (TypeContainer.RegisterOrder): Removed, this was unused.
3507 (TypeContainer, interface_order): Removed.
3508 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3509 TypeContainer as argument since we can also be called with a
3510 `PartialContainer' for a partial class/struct/interface.
3511 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3512 of checking whether we're an `Interface' - we could be a
3514 (PartialContainer.Register): Override; call
3515 AddClass()/AddStruct()/AddInterface() on our parent.
3517 * cs-parser.jay (interface_member_declaration): Add things to the
3518 `current_container', not the `current_class'.
3520 * rootcontext.cs (RegisterOrder): The overloaded version which
3521 takes an `Interface' was unused, removed.
3523 * typemanager.cs (TypeManager.LookupInterface): Return a
3524 `TypeContainer', not an `Interface'.
3525 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3526 contain a `PartialContainer' for an interface, so check it's
3527 `Kind' to figure out what it is.
3529 2004-07-25 Martin Baulig <martin@ximian.com>
3531 * class.cs (Class.DefaultTypeAttributes): New public constant.
3532 (Struct.DefaultTypeAttributes): Likewise.
3533 (Interface.DefaultTypeAttributes): Likewise.
3534 (PartialContainer.TypeAttr): Override this and add the
3535 DefaultTypeAttributes.
3537 2004-07-25 Martin Baulig <martin@ximian.com>
3539 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3540 we can just use the `Parent' field instead.
3542 2004-07-25 Martin Baulig <martin@ximian.com>
3544 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3546 2004-07-25 Martin Baulig <martin@ximian.com>
3548 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3549 our parts before defining any methods.
3550 (TypeContainer.VerifyImplements): Make this virtual.
3551 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3552 on our PartialContainer.
3554 2004-07-25 Martin Baulig <martin@ximian.com>
3556 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3558 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3559 argument, we can just use the `Parent' field instead.
3562 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3563 (MemberBase.DoDefine): Likewise.
3565 2004-07-24 Martin Baulig <martin@ximian.com>
3567 * decl.cs (MemberCore.Parent): New public field.
3568 (DeclSpace.Parent): Moved to MemberCore.
3570 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3571 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3573 (FieldBase, Field, Operator): Likewise.
3574 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3575 (EventField, Event): Likewise.
3577 2004-07-23 Martin Baulig <martin@ximian.com>
3579 * class.cs (PartialContainer): New public class.
3580 (ClassPart): New public class.
3581 (TypeContainer): Added support for partial classes.
3582 (TypeContainer.GetClassBases): Splitted some of the functionality
3583 out into GetNormalBases() and GetPartialBases().
3585 * cs-tokenizer.cs (Token.PARTIAL): New token.
3586 (Tokenizer.consume_identifier): Added some hacks to recognize
3587 `partial', but only if it's immediately followed by `class',
3588 `struct' or `interface'.
3590 * cs-parser.jay: Added support for partial clases.
3592 2004-07-23 Martin Baulig <martin@ximian.com>
3594 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3595 a `DeclSpace' and also made it readonly.
3596 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3597 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3598 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3600 * cs-parser.jay: Pass the `current_class', not the
3601 `current_container' (at the moment, this is still the same thing)
3602 to a new Method, Property, Event, Indexer or Constructor.
3604 2004-07-23 Martin Baulig <martin@ximian.com>
3606 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3607 and removed the `current_interface' one.
3608 (struct_declaration, class_declaration, interface_declaration):
3609 Set `current_class' to the newly created class/struct/interface;
3610 set their `Bases' and call Register() before parsing their body.
3612 2004-07-23 Martin Baulig <martin@ximian.com>
3614 * class.cs (Kind): New public enum.
3615 (TypeContainer): Made this class abstract.
3616 (TypeContainer.Kind): New public readonly field.
3617 (TypeContainer.CheckDef): New public method; moved here from
3619 (TypeContainer.Register): New public abstract method.
3620 (TypeContainer.GetPendingImplementations): New public abstract
3622 (TypeContainer.GetClassBases): Removed the `is_class' and
3623 `is_iface' parameters.
3624 (TypeContainer.DefineNestedTypes): Formerly known as
3626 (ClassOrStruct): Made this class abstract.
3628 * tree.cs (RootTypes): New public type.
3630 2004-07-20 Martin Baulig <martin@ximian.com>
3632 * tree.cs (Tree.RecordNamespace): Removed.
3633 (Tree.Namespaces): Removed.
3635 * rootcontext.cs (RootContext.IsNamespace): Removed.
3637 * cs-parser.jay (namespace_declaration): Just create a new
3638 NamespaceEntry here.
3640 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3642 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3643 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3644 entry to make sure it runs in the correct runtime version.
3646 2004-07-18 Martin Baulig <martin@ximian.com>
3648 * generic.cs (ConstructedType.CheckConstraints): Improved
3649 constraints checking.
3651 2004-07-18 Martin Baulig <martin@ximian.com>
3653 * expression.cs (Invocation.BetterMethod): Call
3654 TypeManager.TypeToCoreType() on all types and removed my previous
3655 hack; we're already doig the right thing here.
3657 2004-07-17 Martin Baulig <martin@ximian.com>
3659 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3661 2004-07-16 Martin Baulig <martin@ximian.com>
3663 * iterators.cs: Added generics support.
3665 2004-07-16 Martin Baulig <martin@ximian.com>
3667 * iterators.cs: Rewrote this. We're now using one single Proxy
3668 class for both the IEnumerable and the IEnumerator interface and
3669 `Iterator' derives from Class so we can use the high-level API.
3671 * class.cs (TypeContainer.AddIterator): New method.
3672 (TypeContainer.DoDefineType): New protected virtual method, which
3673 is called from DefineType().
3674 (TypeContainer.DoDefineMembers): Call DefineType() and
3675 DefineMembers() on all our iterators.
3676 (TypeContainer.Emit): Call Emit() on all our iterators.
3677 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3679 * codegen.cs (EmitContext.CurrentIterator): New public field.
3681 2004-07-15 Martin Baulig <martin@ximian.com>
3684 (TypeManager.not_supported_exception_type): New type.
3686 2004-07-14 Martin Baulig <martin@ximian.com>
3689 (TypeManager.generic_ienumerable_type): New type.
3690 (TypeManager.generic_ienumerator_type): New type.
3693 (RootContext.interfaces_first_stage): Added
3694 "System.Collections.Generic.IEnumerator`1" and
3695 "System.Collections.Generic.IEnumerable`1".
3697 2004-07-14 Martin Baulig <martin@ximian.com>
3699 * iterators.cs: Use real error numbers.
3701 2004-07-14 Martin Baulig <martin@ximian.com>
3703 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3704 requires this to be a System.Collection.IEnumerable and not a
3705 class implementing that interface.
3706 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3708 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3710 * class.cs: Fixed previous fix, it broke some error tests.
3712 2004-07-12 Martin Baulig <martin@ximian.com>
3714 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3717 2004-07-14 Martin Baulig <martin@ximian.com>
3719 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3720 an exclamation mark (!) for the generic arity to reflect the
3721 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3723 2004-07-13 Martin Baulig <martin@ximian.com>
3725 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3726 specifiers being part of a type argument.
3728 2004-07-13 Martin Baulig <martin@ximian.com>
3730 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3731 name for generic types.
3733 2004-07-13 Martin Baulig <martin@ximian.com>
3735 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3738 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3740 * assign.cs (LocalTemporary): Add new argument: is_address,If
3741 `is_address' is true, then the value that we store is the address
3742 to the real value, and not the value itself.
3744 * ecore.cs (PropertyExpr): use the new local temporary
3745 stuff to allow us to handle X.Y += z (where X is a struct)
3747 2004-07-08 Martin Baulig <martin@ximian.com>
3749 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3750 not always return, just like we're doing in Using.Resolve().
3752 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3754 * cs-parser.jay (fixed_statement): flag this as Pinned.
3756 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3758 * typemanager.cs (TypeManager): Removed MakePinned method, this
3759 mechanism is replaced with the .NET 2.x compatible mechanism of
3760 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3762 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3763 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3764 `IsFixed' property which has a different meaning.
3766 2004-07-02 Raja R Harinath <rharinath@novell.com>
3768 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3769 visible from inside a nested class, not just the names of the
3770 immediately enclosing class.
3773 2004-06-24 Raja R Harinath <rharinath@novell.com>
3775 * expression.cs (BetterConversion): Remove buggy special-case
3776 handling of "implicit constant expression conversions". At this
3777 point, we already know that the conversion is possible -- we're
3778 only checking to see which is better.
3780 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3782 * cs-parser.jay: Added error CS0210 test.
3784 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3786 * cs-parser.jay: Added error CS0134 test.
3788 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3791 * cs-parser.jay: Added error CS0145 test.
3793 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3795 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3797 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3799 * expression.cs (StackAlloc.Resolve): The argument may not
3800 be a constant; deal with this case.
3802 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3804 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3805 GetIndexerAttributeValue.
3806 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3808 * class.cs (Indexer.Define): Added error tests for CS0415,
3811 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3813 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3816 2004-06-23 Martin Baulig <martin@ximian.com>
3818 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3819 neither return nor throw, reset the barrier as well. Fixes #60457.
3821 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3823 * class.cs : EventAttributes is now set to None by default.
3824 This fixes bug #60459.
3826 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3829 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3830 Don't throw exception but return null (it's sufficient now).
3832 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3834 * typemanager.cs (GetArgumentTypes): Faster implementation.
3836 2004-06-18 Martin Baulig <martin@ximian.com>
3838 * attribute.cs (Attribute.Resolve): Check whether we're an
3839 EmptyCast which a Constant child. Fixes #60333.
3841 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3843 * statement.cs (EmitCollectionForeach): Account for the fact that
3844 not all valuetypes are in areas which we can take the address of.
3845 For these variables, we store to a temporary variable. Also, make
3846 sure that we dont emit a `callvirt' on a valuetype method.
3848 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3850 * expression.cs (StackAlloc.DoReSolve): Added test for
3851 negative parameter (CS0247).
3853 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3856 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3858 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3861 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3864 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3866 Fix bug #58254 & cs1555.cs, cs1556.cs
3867 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3869 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3871 * cs-parser.jay: Added error CS1669 test for indexers.
3873 2004-06-18 Martin Baulig <martin@ximian.com>
3875 * generics.cs (GenericMethod.ctor): Don't take an Attributes
3876 argument. Fixes #60441.
3878 2004-06-16 Ben Maurer <bmaurer@ximian.com>
3879 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
3880 The name needs to have the actual name of the method in order
3881 for other tests (such as the one in OverloadResolve for Invoke
3882 on a delegate) to work. As well, it does not really help
3883 error reporting because the method group had multiple methods.
3884 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
3885 Make profiling work.
3887 2004-06-13 Martin Baulig <martin@ximian.com>
3889 * cs-parser.jay: Don't allow generic attributes.
3891 2004-06-13 Martin Baulig <martin@ximian.com>
3893 * class.cs (MemberBase.DoDefineBase): New protected method.
3894 (MemberBase.DoDefine): Compute the `flags' in the new
3895 DoDefineBase() which must be called first.
3896 (Method.Define): Call DoDefineBase() first so we have the flags
3897 when defining the generic method.
3899 * cs-parser.jay (interface_method_declaration): Support generic methods.
3901 2004-06-13 Martin Baulig <martin@ximian.com>
3903 * decl.cs (TypeName): Removed.
3904 (MemberName): Removed TypeName and MemberNow; now we just have
3907 * cs-parser.jay: Don't distinguish between type arguments and type
3908 parameters in the grammar and simplified the rules a bit. The
3909 reduce/reduce conflicts are now gone (except the one we inherited
3912 2004-06-11 Martin Baulig <martin@ximian.com>
3914 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3915 call this twice: for params and varargs methods.
3917 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3920 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3922 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3924 * attribute.cs (Attribute.GetValidTargets): Made public.
3927 (AbstractPropertyEventMethod): New class for better code sharing.
3928 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3930 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3932 2004-06-09 Martin Baulig <martin@ximian.com>
3934 * cs-parser.jay: Removed a reduce/reduce conflict.
3936 2004-06-03 Martin Baulig <martin@ximian.com>
3938 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
3939 GetSimpleName() and return a SimpleName.
3941 * ecore.cs (SimpleName.Arguments): New public field.
3942 (SimpleName): Added overloaded ctor which takes an additional
3943 TypeArguments argument.
3944 (SimpleName.SimpleNameResolve): Added support for generic methods.
3945 (MethodGroupExpr.ResolveGeneric): New public method. The code was
3946 formerly in MemberAccess.DoResolve(), but we also need it in
3947 SimpleNameResolve().
3949 * expression.cs (MemberAccess.DoResolve): Use the new
3950 MethodGroupExpr.ResolveGeneric().
3952 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3954 * decl.cs: If possible, use lookuptypedirect here. We can only do
3955 this if there is no `.' after the namespace. Avoids using
3956 LookupType, which does lots of slow processing.
3957 (FindNestedType) New method, does what it says :-).
3958 * namespace.cs: use LookupTypeDirect.
3959 * rootcontext.cs: use membercache, if possible.
3960 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3962 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3965 According to the spec,
3967 In a member access of the form E.I, if E is a single identifier,
3968 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3969 field, property, localvariable, or parameter with the same type as
3970 the meaning of E as a type-name (§3.8), then both possible
3971 meanings of E are permitted.
3973 We did not check that E as a simple-name had the same type as E as
3976 This trivial check gives us 5-7% on bootstrap time.
3978 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3980 * expression.cs (Invocation.OverloadResolve): Avoid the
3981 use of hashtables and boxing here by allocating on demand.
3983 2004-05-30 Martin Baulig <martin@ximian.com>
3985 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3986 we're doing a silent lookup. Don't try to lookup nested types in
3987 TypeManager.object_type (thanks to Ben Maurer).
3989 2004-05-30 Martin Baulig <martin@ximian.com>
3991 Committing a patch from Ben Maurer.
3993 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3995 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3997 * convert.cs: add a trivial cache for overload operator resolution.
3999 2004-05-31 Marek Safar <marek.safar@seznam.cz>
4002 (AttributeTester.GetObsoleteAttribute): Returns instance of
4003 ObsoleteAttribute when type is obsolete.
4006 (TypeContainer.VerifyObsoleteAttribute): Override.
4007 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
4008 (MethodCode.VerifyObsoleteAttribute): Override.
4009 (MemberBase.VerifyObsoleteAttribute): Override.
4012 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
4013 and report proper error.
4016 (Delegate.VerifyObsoleteAttribute): Override.
4019 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
4020 and report proper error.
4021 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
4024 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
4028 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
4029 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
4030 Added test for ObsoleteAttribute.
4033 (Catch): Derived from Statement.
4035 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4037 * decl.cs: If possible, use lookuptypedirect here. We can only do
4038 this if there is no `.' after the namespace. Avoids using
4039 LookupType, which does lots of slow processing.
4040 (FindNestedType) New method, does what it says :-).
4041 * namespace.cs: use LookupTypeDirect.
4042 * rootcontext.cs: use membercache, if possible.
4043 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
4045 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4048 According to the spec,
4050 In a member access of the form E.I, if E is a single identifier,
4051 and if the meaning of E as a simple-name (§7.5.2) is a constant,
4052 field, property, localvariable, or parameter with the same type as
4053 the meaning of E as a type-name (§3.8), then both possible
4054 meanings of E are permitted.
4056 We did not check that E as a simple-name had the same type as E as
4059 This trivial check gives us 5-7% on bootstrap time.
4061 2004-05-30 Marek Safar <marek.safar@seznam.cz>
4063 Fixed bug #59071 & cs0160.cs
4064 * statement.cs (Try.Resolve): Check here whether order of catch
4065 clauses matches their dependencies.
4067 2004-05-30 Marek Safar <marek.safar@seznam.cz>
4070 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
4073 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4075 * expression.cs (Invocation.OverloadResolve): Avoid the
4076 use of hashtables and boxing here by allocating on demand.
4078 2004-05-30 Martin Baulig <martin@ximian.com>
4080 * rootcontext.cs (RootContext.LookupType): Don't cache things if
4081 we're doing a silent lookup. Don't try to lookup nested types in
4082 TypeManager.object_type (thanks to Ben Maurer).
4084 2004-05-30 Martin Baulig <martin@ximian.com>
4086 Committing a patch from Ben Maurer.
4088 * rootcontext.cs (RootContext.LookupType): Cache negative results.
4090 2004-05-29 Martin Baulig <martin@ximian.com>
4092 * class.cs (IMethodData.ShouldIgnore): New method.
4094 * typemanager.cs (TypeManager.MethodFlags): Don't take a
4095 `Location' argument, we don't need it anywhere. Use
4096 `IMethodData.ShouldIgnore ()' instead of
4097 `MethodData.GetMethodFlags ()'.
4098 (TypeManager.AddMethod): Removed.
4099 (TypeManager.AddMethod2): Renamed to AddMethod.
4101 2004-05-29 Martin Baulig <martin@ximian.com>
4103 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
4105 * convert.cs (Convert.ImplicitReferenceConversion): If we're
4106 converting from a class type S to an interface type and we already
4107 have an object on the stack, don't box it again. Fixes #52578.
4109 2004-05-29 Martin Baulig <martin@ximian.com>
4111 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4112 Added support for `params' parameters. Fixes #59267.
4114 2004-05-29 Martin Baulig <martin@ximian.com>
4116 * literal.cs (NullPointer): Provide a private .ctor which sets
4117 `type' to TypeManager.object_type. Fixes #59048.
4119 2004-05-29 Martin Baulig <martin@ximian.com>
4121 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
4122 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
4124 * ecore.cs (EventExpr.instance_expr): Make the field private.
4126 2004-05-26 Marek Safar <marek.safar@seznam.cz>
4128 Fixed bug #50080 & cs0214-2.cs
4129 * expression.cs (Cast.DoResolve): Check unsafe context here.
4131 * statement.cs (Resolve.DoResolve): Likewise.
4133 2004-05-26 Martin Baulig <martin@ximian.com>
4135 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
4137 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
4138 (RootContext.LookupType): Pass down the `silent' flag.
4140 2004-05-25 Martin Baulig <martin@ximian.com>
4143 (MethodGroupExpr.IdenticalTypeName): New public property.
4144 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
4145 expression actually refers to a type.
4147 2004-05-25 Martin Baulig <martin@ximian.com>
4149 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
4150 for #56176 and made it actually work.
4152 2004-05-25 Martin Baulig <martin@ximian.com>
4154 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
4155 (FieldExpr, PropertyExpr): Override and implement
4156 CacheTemporaries. Fixes #52279.
4158 2004-05-25 Miguel de Icaza <miguel@ximian.com>
4160 * location.cs: In the new compiler listing a file twice is a
4161 warning, not an error.
4163 2004-05-24 Martin Baulig <martin@ximian.com>
4165 * enum.cs (Enum.DefineType): For the `BaseType' to be a
4166 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
4168 2004-05-24 Martin Baulig <martin@ximian.com>
4170 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
4171 walking the `using' list. Fixes #53921.
4173 2004-05-24 Martin Baulig <martin@ximian.com>
4175 * const.cs (Const.LookupConstantValue): Added support for
4176 EmptyCast's; fixes #55251.
4178 2004-05-24 Martin Baulig <martin@ximian.com>
4180 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
4181 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
4182 which does the CS0135 check. The reason is that we first need to
4183 check whether the variable actually exists.
4185 2004-05-24 Martin Baulig <martin@ximian.com>
4187 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
4188 than RootContext.LookupType() to find the explicit interface
4191 2004-05-24 Raja R Harinath <rharinath@novell.com>
4193 * Makefile: Simplify. Use executable.make.
4194 * mcs.exe.sources: New file. List of sources of mcs.exe.
4196 2004-05-24 Anders Carlsson <andersca@gnome.org>
4200 Use the invariant culture when doing String.Compare for CLS case
4203 2004-05-23 Martin Baulig <martin@ximian.com>
4205 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4206 don't have any dots. Fixes #52622, added cs0246-8.cs.
4208 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4210 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4212 * class.cs (MemberBase.Define): Reuse MemberType member for
4213 resolved type. Other methods can use it too.
4215 2004-05-23 Martin Baulig <martin@ximian.com>
4217 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4218 the variable also exists in the current block (otherwise, we need
4219 to report a CS0103). Fixes #58670.
4221 2004-05-23 Martin Baulig <martin@ximian.com>
4223 * flowanalysis.cs (Reachability.Reachable): Compute this
4224 on-the-fly rather than storing it as a field.
4226 2004-05-23 Martin Baulig <martin@ximian.com>
4228 * flowanalysis.cs (Reachability.And): Manually compute the
4229 resulting `barrier' from the reachability.
4231 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4234 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4235 instance of ObsoleteAttribute when symbol is obsolete.
4238 (IMethodData): Extended interface for ObsoleteAttribute support.
4240 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4242 * attribute.cs: Fix bug #55970
4244 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4248 (GetObsoleteAttribute): New method. Creates the instance of
4250 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4251 ObsoleteAttribute when member is obsolete.
4252 (AttributeTester.Report_ObsoleteMessage): Common method for
4253 Obsolete error/warning reporting.
4256 (TypeContainer.base_classs_type): New member for storing parent type.
4259 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4260 for this MemberCore.
4262 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4264 * attribute.cs, const.cs: Fix bug #58590
4266 2004-05-21 Martin Baulig <martin@ximian.com>
4268 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4269 out parameters if the end of the method is unreachable. Fixes
4272 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4274 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4275 Hari was right, why extra method.
4277 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4279 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4281 2004-05-20 Martin Baulig <martin@ximian.com>
4283 * delegate.cs: Convert this file to Unix mode - like the original
4286 2004-05-20 Martin Baulig <martin@ximian.com>
4288 * attribute.cs: Convert this file to Unix mode - like the original
4291 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4293 Fix bug #58688 (MCS does not report error when the same attribute
4296 * attribute.cs (Attribute.Emit): Distinction between null and default.
4298 2004-05-19 Raja R Harinath <rharinath@novell.com>
4300 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4301 of a top-level attribute without an attribute target.
4302 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4304 (Attribute.Conditional_GetConditionName),
4305 (Attribute.Obsolete_GetObsoleteMessage): Update.
4306 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4307 part of ScanForIndexerName.
4308 (Attribute.CanIgnoreInvalidAttribute): New function.
4309 (Attribute.ScanForIndexerName): Move to ...
4310 (Attributes.ScanForIndexerName): ... here.
4311 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4312 (Attributes.Search): New internal variant that can choose not to
4313 complain if types aren't resolved. The original signature now
4315 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4316 complaints suppressed.
4317 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4318 only if it not useful.
4319 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4320 top-level for attributes that are shared between the assembly
4321 and a top-level class.
4322 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4323 * class.cs: Update to reflect changes.
4324 (DefineIndexers): Fuse loops.
4325 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4326 a couple more variants of attribute names.
4328 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4330 Fix bug #52585 (Implemented explicit attribute declaration)
4333 (Attributable.ValidAttributeTargets): New abstract method. It gets
4334 list of valid attribute targets for explicit target declaration.
4335 (Attribute.Target): It holds target itself.
4336 (AttributeSection): Removed.
4337 (Attribute.CheckTargets): New method. It checks whether attribute
4338 target is valid for the current element.
4341 (EventProperty): New class. For events that are declared like
4342 property (with add and remove accessors).
4343 (EventField): New class. For events that are declared like field.
4346 * cs-parser.jay: Implemented explicit attribute target declaration.
4348 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4349 Override ValidAttributeTargets.
4352 (ReturnParameter): Class for applying custom attributes on
4354 (ParameterAtribute): New class. Class for applying custom
4355 attributes on the parameter type.
4357 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4359 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4362 (Method): Allow UNSAFE here.
4364 * modifiers.cs: Support unsafe reporting.
4366 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4368 * decl.cs: Fix bug #58478.
4370 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4372 * statement.cs: When checking for unreachable code on an EmptyStatement,
4373 set the location. Fixes bug #58488.
4375 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4377 * driver.cs: Add -pkg handling.
4379 From Gonzalo: UseShelLExecute=false
4381 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4384 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4386 (Attribute.IsClsCompliaceRequired): Moved to base for better
4388 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4389 when attribute is AttributeUsageAttribute.
4390 (Attribute.GetValidTargets): Simplified.
4391 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4392 attribute for this type.
4393 (Attribute.ApplyAttributes): Method renamed to Emit and make
4395 (GlobalAttributeSection): New class for special handling of global
4396 attributes (assembly, module).
4397 (AttributeSection.Emit): New method.
4399 * class.cs: Implemented Attributable abstract methods.
4400 (MethodCore.LabelParameters): Moved to Parameter class.
4401 (Accessor): Is back simple class.
4402 (PropertyMethod): Implemented Attributable abstract class.
4403 (DelegateMethod): Implemented Attributable abstract class.
4404 (Event): New constructor for disctintion between normal Event
4405 and Event with accessors.
4407 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4409 * codegen.cs, const.cs, decl.cs, delegate.cs:
4410 (CommonAssemblyModulClass): Implemented Attributable abstract class
4413 * enum.cs: Implement IAttributeSupport interface.
4414 (EnumMember): New class for emum members. Implemented Attributable
4418 (ParameterBase): Is abstract.
4419 (ReturnParameter): New class for easier [return:] attribute handling.
4421 * typemanager.cs: Removed builder_to_attr.
4423 2004-05-11 Raja R Harinath <rharinath@novell.com>
4426 * attribute.cs (Attribute.GetPositionalValue): New function.
4427 * class.cs (TypeContainer.VerifyMembers): New function.
4428 (TypeContainer.Emit): Use it.
4429 (ClassOrStruct): New base class for Class and Struct.
4430 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4431 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4433 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4434 then each non-static field should have a FieldOffset attribute.
4435 Otherwise, none of the fields should have a FieldOffset attribute.
4436 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4437 and FieldOffset attributes.
4438 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4439 (TypeManager.field_offset_attribute_type): New core types.
4440 (TypeManager.InitCoreTypes): Initialize them.
4442 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4444 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4445 Return correct type.
4448 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4450 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4451 be implicitly converted to ulong.
4453 * expression.cs: The logic for allowing operator &, | and ^ worked
4454 was wrong, it worked before because we did not report an error in
4455 an else branch. Fixes 57895.
4457 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4458 allow volatile fields to be reference types.
4460 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4462 * driver.cs: Add support for /debug-
4464 2004-05-07 Raja R Harinath <rharinath@novell.com>
4466 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4467 Add a 'complain' parameter to silence errors.
4468 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4469 silently overlooked type-resolutions.
4470 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4472 (Attributes.Search): New function.
4473 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4474 (Attributes.GetAttributeFullName): Remove hack.
4475 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4476 Update to reflect changes.
4477 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4478 Use Attributes.Search instead of nested loops.
4480 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4483 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4484 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4485 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4487 * report.cs: (Report.Warning): Renamed to Warning_T because of
4488 parameter collision.
4490 2004-05-05 Raja R Harinath <rharinath@novell.com>
4492 * expression.cs (MemberAccess.ResolveMemberAccess):
4493 Exit with non-zero status after Report.Error.
4494 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4496 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4498 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4500 * support.cs: Don't hang when the file is empty.
4502 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4504 * support.cs: In SeekableStreamReader, compute the preamble size of the
4505 underlying stream. Position changes should take into account that initial
4508 2004-05-03 Todd Berman <tberman@sevenl.net>
4510 * driver.cs: remove unused GetSysVersion function.
4512 2004-05-03 Todd Berman <tberman@sevenl.net>
4514 * driver.cs: Remove the hack from saturday, as well as the hack
4515 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4516 link_paths to get that bit proper.
4518 2004-05-01 Todd Berman <tberman@sevenl.net>
4520 * driver.cs: Try a LoadFrom before a Load, this checks the current
4521 path. This is currently a bug in mono that is be fixed, however, this
4522 provides a workaround for now. This will be removed when the bug
4525 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4527 * CryptoConvert.cs: Updated to latest version. Fix issue with
4528 incomplete key pairs (#57941).
4530 2004-05-01 Todd Berman <tberman@sevenl.net>
4532 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4535 2004-04-30 Jackson Harper <jackson@ximian.com>
4537 * codegen.cs: Open keys readonly.
4539 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4541 * typemanager.cs: don't report cyclic struct layout when a struct
4542 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4543 which has 2 Pango.Rectangle fields.
4545 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4547 * expression.cs: Handle IntPtr comparisons with IL code
4548 rather than a method call.
4550 2004-04-29 Martin Baulig <martin@ximian.com>
4552 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4553 the list of PropertyInfo's in class hierarchy and find the
4554 accessor. Fixes #56013.
4556 2004-04-29 Martin Baulig <martin@ximian.com>
4558 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4560 2004-04-29 Martin Baulig <martin@ximian.com>
4562 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4564 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4566 2004-04-29 Martin Baulig <martin@ximian.com>
4568 * class.cs (ConstructorInitializer.Resolve): Check whether the
4569 parent .ctor is accessible. Fixes #52146.
4571 2004-04-29 Martin Baulig <martin@ximian.com>
4573 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4575 * statement.cs (Using.EmitLocalVariableDecls): Use
4576 TypeManager.idisposable_type, not typeof (IDisposable).
4577 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4579 2004-04-29 Martin Baulig <martin@ximian.com>
4581 * class.cs (Event.Define): Don't emit the field and don't set
4582 RTSpecialName and SpecialName for events on interfaces. Fixes
4585 2004-04-29 Raja R Harinath <rharinath@novell.com>
4587 Refactor Attribute.ApplyAttributes.
4588 * attribute.cs (Attributable): New base class for objects that can
4589 have Attributes applied on them.
4590 (Attribute): Make AttributeUsage fields public.
4591 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4592 (Attribute.IsInternalCall): New property.
4593 (Attribute.UsageAttr): Convert to a public read-only property.
4594 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4595 (Attribute.ResolveType, Attribute.Resolve)
4596 (Attribute.ScanForIndexerName): Update to reflect changes.
4597 (Attribute.CheckAttributeTarget): Re-format.
4598 (Attribute.ApplyAttributes): Refactor, to various
4599 Attributable.ApplyAttributeBuilder methods.
4600 * decl.cs (MemberCore): Make Attributable.
4601 * class.cs (Accessor): Make Attributable.
4602 (MethodData.ApplyAttributes): Use proper attribute types, not
4604 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4605 (TypeContainer.ApplyAttributeBuilder)
4606 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4607 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4608 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4609 (Operator.ApplyAttributeBuilder): New factored-out methods.
4610 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4611 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4612 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4613 * parameter.cs (ParameterBase): New Attributable base class
4614 that can also represent Return types.
4615 (Parameter): Update to the changes.
4617 2004-04-29 Jackson Harper <jackson@ximian.com>
4619 * driver.cs: Prefer the corlib system version when looking for
4620 assemblies in the GAC. This is still a hack, but its a better hack
4623 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4625 * decl.cs, enum.cs: Improved error 3005 reporting.
4627 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4628 (related_symbols): New private member for list of symbols
4629 related to reported error/warning.
4631 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4633 2004-04-29 Martin Baulig <martin@ximian.com>
4635 * ecore.cs (Expression.Constantify): If we're an enum and
4636 TypeManager.TypeToCoreType() doesn't give us another type, use
4637 t.UnderlyingSystemType. Fixes #56178.
4639 2004-04-29 Martin Baulig <martin@ximian.com>
4641 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4642 interfaces and for each interface, only add members directly
4643 declared in that interface. Fixes #53255.
4645 2004-04-28 Martin Baulig <martin@ximian.com>
4647 * expression.cs (ConditionalLogicalOperator): Use a temporary
4648 variable for `left' to avoid that we evaluate it more than once;
4651 2004-04-28 Martin Baulig <martin@ximian.com>
4653 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4656 2004-04-28 Martin Baulig <martin@ximian.com>
4658 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4661 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4662 whether the type is not void (CS1547).
4664 2004-04-28 Martin Baulig <martin@ximian.com>
4666 * expression.cs (Unary.DoResolveLValue): Override this and report
4667 CS0131 for anything but Operator.Indirection.
4669 2004-04-28 Martin Baulig <martin@ximian.com>
4671 Committing a patch from Ben Maurer; see bug #50820.
4673 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4676 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4679 2004-04-28 Martin Baulig <martin@ximian.com>
4681 Committing a patch from Ben Maurer; see bug #50820.
4683 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4686 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4689 2004-04-28 Martin Baulig <martin@ximian.com>
4691 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4692 (Block.AddLabel): Call DoLookupLabel() to only search in the
4695 2004-04-28 Martin Baulig <martin@ximian.com>
4697 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4698 comparing StringConstants and NullLiterals in Equality and Inequality.
4700 2004-04-28 Jackson Harper <jackson@ximian.com>
4702 * driver.cs: Attempt to load referenced assemblies from the
4703 GAC. This is the quick and dirty version of this method that
4704 doesnt take into account versions and just takes the first
4705 canidate found. Will be good enough for now as we will not have more
4706 then one version installed into the GAC until I update this method.
4708 2004-04-28 Martin Baulig <martin@ximian.com>
4710 * typemanager.cs (TypeManager.CheckStructCycles): New public
4711 static method to check for cycles in the struct layout.
4713 * rootcontext.cs (RootContext.PopulateTypes): Call
4714 TypeManager.CheckStructCycles() for each TypeContainer.
4715 [Note: We only need to visit each type once.]
4717 2004-04-28 Martin Baulig <martin@ximian.com>
4719 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4721 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4722 success and added `out object value'. Use a `bool resolved' field
4723 to check whether we've already been called rather than
4724 `ConstantValue != null' since this breaks for NullLiterals.
4726 2004-04-28 Raja R Harinath <rharinath@novell.com>
4728 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4729 setting of this flag, since the 'set' method may be non-public.
4731 2004-04-28 Raja R Harinath <rharinath@novell.com>
4733 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4734 check on current_vector.Block.
4736 2004-04-27 Martin Baulig <martin@ximian.com>
4738 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4739 a field initializer. Fixes #56459.
4741 2004-04-27 Martin Baulig <martin@ximian.com>
4743 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4744 we're not attempting to use an indexer. Fixes #52154.
4746 2004-04-27 Martin Baulig <martin@ximian.com>
4748 * statement.cs (Return): Don't create a return label if we don't
4749 need it; reverts my change from January 20th. Thanks to Ben
4752 2004-04-27 Martin Baulig <martin@ximian.com>
4754 According to the spec, `goto' can only leave a nested scope, but
4757 * statement.cs (Block.LookupLabel): Only lookup in the current
4758 block, don't recurse into parent or child blocks.
4759 (Block.AddLabel): Check in parent and child blocks, report
4760 CS0140/CS0158 if we find a duplicate.
4761 (Block): Removed this indexer for label lookups.
4762 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4763 this already does the error reporting for us.
4766 (FlowBranching.UsageVector.Block): New public variable; may be null.
4767 (FlowBranching.CreateSibling): Added `Block' argument.
4768 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4769 label for the target of a `goto' and check whether we're not
4770 leaving a `finally'.
4772 2004-04-27 Martin Baulig <martin@ximian.com>
4774 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4775 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4778 2004-04-27 Martin Baulig <martin@ximian.com>
4780 * statement.cs (Block.AddLabel): Also check for implicit blocks
4781 and added a CS0158 check.
4783 2004-04-27 Martin Baulig <martin@ximian.com>
4785 * flowanalysis.cs (FlowBranchingLoop): New class.
4786 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4787 UsageVector's instead of an ArrayList.
4788 (FlowBranching.Label): Likewise.
4789 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4790 (FlowBranching.AddBreakVector): New method.
4792 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4794 * attribute.cs: Small regression fix: only convert the type if we
4795 the type is different, fixes System.Drawing build.
4797 2004-04-27 Martin Baulig <martin@ximian.com>
4799 * attribute.cs (Attribute.Resolve): If we have a constant value
4800 for a named field or property, implicity convert it to the correct
4803 2004-04-27 Raja R Harinath <rharinath@novell.com>
4805 * statement.cs (Block.Block): Implicit blocks share
4806 'child_variable_names' fields with parent blocks.
4807 (Block.AddChildVariableNames): Remove.
4808 (Block.AddVariable): Mark variable as "used by a child block" in
4809 every surrounding block.
4810 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4811 been used in a child block, complain about violation of "Invariant
4812 meaning in blocks" rule.
4813 * cs-parser.jay (declare_local_variables): Don't use
4814 AddChildVariableNames.
4815 (foreach_statement): Don't create an implicit block: 'foreach'
4818 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4820 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4821 converting from 0L to ulong. Fixes 57522.
4823 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4825 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4826 derived class hides via 'new' keyword field from base class (test-242.cs).
4827 TODO: Handle this in the more general way.
4829 * class.cs (CheckBase): Ditto.
4831 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4833 * decl.cs (caching_flags): New member for storing cached values
4835 (MemberCore.Flags): New enum where bit flags for caching_flags
4837 (MemberCore.cls_compliance): Moved to caching_flags.
4838 (DeclSpace.Created): Moved to caching_flags.
4840 * class.cs: Use caching_flags instead of DeclSpace.Created
4842 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4844 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4845 if we are only a derived class, not a nested class.
4847 * typemanager.cs: Same as above, but do this at the MemberLookup
4848 level (used by field and methods, properties are handled in
4849 PropertyExpr). Allow for the qualified access if we are a nested
4852 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4854 * class.cs: Refactoring.
4855 (IMethodData): New inteface; Holds links to parent members
4856 to avoid member duplication (reduced memory allocation).
4857 (Method): Implemented IMethodData interface.
4858 (PropertyBase): New inner classes for get/set methods.
4859 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4860 (Event): New inner classes for add/remove methods.
4861 (Event.DelegateMethod): Implemented IMethodData interface.
4863 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4864 EmitContext (related to class.cs refactoring).
4866 2004-04-21 Raja R Harinath <rharinath@novell.com>
4868 * delegate.cs (Delegate.VerifyApplicability): If the number of
4869 arguments are the same as the number of parameters, first try to
4870 verify applicability ignoring any 'params' modifier on the last
4874 2004-04-08 Martin Baulig <martin@ximian.com>
4876 Merged latest changes into gmcs. Please keep this comment in
4877 here, it makes it easier for me to see what changed in MCS since
4878 the last time I merged.
4880 2004-04-16 Raja R Harinath <rharinath@novell.com>
4882 * class.cs (TypeContainer.AddIndexer): Use
4883 'ExplicitInterfaceName' to determine if interface name was
4884 explicitly specified. 'InterfaceType' is not initialized at this time.
4885 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4886 Indexers array is already in the required order. Initialize
4887 'IndexerName' only if there are normal indexers.
4888 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4889 (TypeContainer.Emit): Emit DefaultMember attribute only if
4890 IndexerName is initialized.
4893 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4895 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4898 2004-04-15 Raja R Harinath <rharinath@novell.com>
4900 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4904 * attribute.cs (Attribute.Resolve): Check for duplicate named
4908 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4910 * iterators.cs (MarkYield): track whether we are in an exception,
4911 and generate code accordingly. Use a temporary value to store the
4912 result for our state.
4914 I had ignored a bit the interaction of try/catch with iterators
4915 since their behavior was not entirely obvious, but now it is
4916 possible to verify that our behavior is the same as MS .NET 2.0
4920 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4922 * iterators.cs: Avoid creating temporaries if there is no work to
4925 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4926 Enumerations, use TypeManager.EnumToUnderlying and call
4929 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4932 (This.Emit): Use EmitContext.EmitThis to emit our
4935 (This.EmitAssign): Ditto.
4937 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4938 codepaths, we will move all the functionality into
4941 (FieldExpr.EmitAssign): Ditto.
4943 This fixes several hidden bugs that I uncovered while doing a code
4944 review of this today.
4946 * codegen.cs (EmitThis): reworked so the semantics are more clear
4947 and also support value types "this" instances.
4949 * iterators.cs: Changed so that for iterators in value types, we
4950 do not pass the value type as a parameter.
4952 Initialization of the enumerator helpers is now done in the caller
4953 instead of passing the parameters to the constructors and having
4954 the constructor set the fields.
4956 The fields have now `assembly' visibility instead of private.
4958 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4960 * expression.cs (Argument.Resolve): Check if fields passed as ref
4961 or out are contained in a MarshalByRefObject.
4963 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4964 another compiler type.
4966 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4968 * class.cs (Indexer.Define): use the new name checking method.
4969 Also, return false on an error.
4970 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4971 (is_identifier_[start/part]_character): make static.
4973 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4975 * expression.cs (Binary.ResolveOperator): Do no append strings
4976 twice: since we can be invoked more than once (array evaluation)
4977 on the same concatenation, take care of this here. Based on a fix
4978 from Ben (bug #56454)
4980 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4982 * codegen.cs: Fix another case where CS1548 must be reported (when
4983 delay-sign isn't specified and no private is available #56564). Fix
4984 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4985 error when MCS is used on the MS runtime and we need to delay-sign
4986 (which seems unsupported by AssemblyBuilder - see #56621).
4988 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4990 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4991 (TypeManager.ComputeNamespaces): Faster implementation for
4994 * compiler.csproj: Updated AssemblyName to mcs.
4996 2004-05-11 Jackson Harper <jackson@ximian.com>
4998 * Makefile: Preserve MONO_PATH
5000 2004-05-11 Jackson Harper <jackson@ximian.com>
5002 * Makefile: Use mono and mcs to build gmcs
5004 2004-05-03 Miguel de Icaza <miguel@ximian.com>
5006 * codegen.cs: Add patch from Robert Shade
5007 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
5010 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
5012 * CryptoConvert.cs: Updated to latest version. Fix issue with
5013 incomplete key pairs (#57941).
5015 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
5017 * codegen.cs: Fix another case where CS1548 must be reported (when
5018 delay-sign isn't specified and no private is available #56564). Fix
5019 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
5020 error when MCS is used on the MS runtime and we need to delay-sign
5021 (which seems unsupported by AssemblyBuilder - see #56621).
5023 2004-04-29 Jackson Harper <jackson@ximian.com>
5025 * Makefile: Set MONO_PATH to use the bootstrap corlib
5026 * driver.cs: Check the GAC for referenced assemblies.
5028 2004-04-29 Martin Baulig <martin@ximian.com>
5030 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
5032 2004-04-07 Martin Baulig <martin@ximian.com>
5034 * expression.cs (Binary.ResolveOperator): Added special case for
5035 Equality/Inequality between a type parameter and a null literal.
5037 2004-04-07 Martin Baulig <martin@ximian.com>
5039 * convert.cs: Check null literal -> type parameter conversions.
5041 2004-04-07 Martin Baulig <martin@ximian.com>
5043 * generic.cs (ConstructedType.CheckConstraints): Enforce the
5044 `class' and `struct' constraints.
5046 2004-04-07 Martin Baulig <martin@ximian.com>
5048 * generic.cs (SpecialConstraint): New public enum.
5049 (Constraints.Resolve): Added support for the `class' and `struct'
5052 * cs-parser.jay (type_parameter_constraint): Added support for the
5053 `class' and `struct' constraints.
5055 2004-04-07 Martin Baulig <martin@ximian.com>
5057 * support.cs (GenericConstraints): Replaced `Types' by
5058 `ClassConstraint' and `InterfaceConstraints'; added
5059 `HasClassConstraint'.
5061 2004-04-07 Martin Baulig <martin@ximian.com>
5064 (Constraints.InterfaceConstraints): New public property.
5065 (Constraints.Types): Make this property public
5066 (TypeParameter): Implement IMemberContainer.
5067 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
5068 instead of a TypeBuilder/MethodBuilder; pass the interface
5069 constraints to TypeManager.AddTypeParameter().
5070 (TypeParameter.DefineType): Just take an EmitContext and no
5071 TypeBuilder/MethodBuilder. Use the new public API.
5073 * typemanager.cs (TypeManager.AddTypeParameter): Added
5074 `TypeExpr[]' argument; add the interfaces to the
5075 `builder_to_ifaces' hash.
5076 (TypeManager.LookupMemberContainer): For
5077 GenericTypeParameterBuilders, get the TypeParameter from the
5078 `builder_to_type_param'.
5079 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
5080 the TypeParameter and call FindMembers on it.
5082 2004-04-07 Martin Baulig <martin@ximian.com>
5085 (MethodCore.GenericMethod): Moved this field here from Method.
5086 (MethodCore.IsDuplicateImplementation): Take the number of type
5087 parameters into account if we're a generic method.
5089 * expression.cs (Invocation.InferTypeArguments): Don't return true
5090 if `arguments' is null; we still need to check whether we actually
5091 don't need to infer anything in this case.
5092 (MemberAccess): Merged the functionality from GenericMemberAccess
5095 * generic.cs (GenericMemberAccess): Removed.
5097 2004-04-05 Martin Baulig <martin@ximian.com>
5099 * decl.cs (MemberCore): For generic classes, interfaces and
5100 structs, `Name' now includes the number of type parameters
5102 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
5103 encode the number of type arguments in the type name.
5105 * expression.cs (Expression.MemberLookup): Removed the
5106 `num_type_args' argument; we now encode the number of type
5107 arguments in the type name.
5109 * ecore.cs (SimpleName): Encode the number of type arguments in
5110 the type name itself.
5112 * generic.cs (ConstructedType): Likewise.
5114 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
5115 `MemberName'; we now include the number of type parameters in the
5118 * typemanager.cs (TypeManager.CheckGeneric): Removed.
5119 (TypeManager.MemberLookup): Removed the
5120 `num_type_args' argument; we now encode the number of type
5121 arguments in the type name.
5123 2004-04-03 Martin Baulig <martin@ximian.com>
5125 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
5126 (MemberCore.MemberName): Moved here from MemberBase.
5127 (DeclSpace.SetParameterInfo): Just take the constraints as an
5128 ArrayList; we already have the type parameters in our
5129 `MemberName'; also do the CS0080 reporting here.
5131 * cs-parser.jay (struct_declaration): Use `member_name' instead of
5132 `IDENTIFIER opt_type_parameter_list'; when constructing our
5133 `MemberName', it'll already include our type parameters.
5134 (class_declaration, interface_declaration): Likewise.
5135 (delegate_declaration): Likewise.
5136 (MakeName): Take a MemberName and return a MemberName.
5137 The following two changes are required to avoid shift/reduce conflicts:
5138 (member_name): Don't include a TypeName anymore; ie. this is now
5139 just 'IDENTIFIER opt_type_parameter_list'.
5140 (property_declaration, event_declaration): Use a
5141 `namespace_or_type_name' instead of a `member_name'.
5143 2004-04-03 Martin Baulig <martin@ximian.com>
5145 * decl.cs (MemberName): Renamed to `TypeName' and created a new
5147 (TypeName): Formerly known as MemberName.
5149 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
5150 instead of a `MemberName'.
5152 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
5153 (member_name): New rule; create a MemberName.
5155 2004-04-02 Martin Baulig <martin@ximian.com>
5157 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
5158 (CS0305 and CS0308).
5160 2004-04-02 Martin Baulig <martin@ximian.com>
5162 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
5163 support for nested types.
5165 2004-04-02 Martin Baulig <martin@ximian.com>
5167 * ecore.cs (IAlias): New public interface.
5168 (TypeExpr, TypeExpression): Implement IAlias.
5169 (TypeAliasExpression): New public class.
5171 * namespace.cs (Namespace): Implement IAlias.
5172 (Namespace.Lookup): Return an IAlias instead on an object.
5173 (Namespace.DefineName): Take an IAlias instead of an object.
5174 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
5176 (NamespaceEntry.UsingAlias): Take a Membername instead of an
5178 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
5180 (NamespaceEntry.Lookup): Likewise.
5182 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
5185 * decl.cs (DeclSpace): Implement IAlias.
5186 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
5188 * generic.cs (ConstructedType): Improved error checking.
5190 2004-04-02 Martin Baulig <martin@ximian.com>
5192 * convert.cs: Added type parameter conversions.
5195 (UnboxCast.Emit): Emit an `unbox.any' for type params.
5196 (ClassCast.Emit): If the source type is a type parameter, box it.
5197 If the target type is a type parameter, emit an `unbox.any'
5198 instead of a `classcast'.1
5200 2004-04-01 Martin Baulig <martin@ximian.com>
5202 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
5204 2004-04-01 Martin Baulig <martin@ximian.com>
5206 * generic.cs (ConstructedType.CheckConstraints): Use
5207 Convert.ImplicitStandardConversionExists(); user-defined implicit
5208 conversions are not allowed according to the spec.
5210 2004-03-30 Martin Baulig <martin@ximian.com>
5212 * expression.cs (New): Added support for type parameters.
5215 (TypeManager.activator_type): New public static field.
5216 (TypeManager.activator_create_instance): Likewise.
5218 2004-03-30 Martin Baulig <martin@ximian.com>
5220 * typemanager.cs (TypeManager.HasConstructorConstraint): New
5223 2004-03-30 Martin Baulig <martin@ximian.com>
5225 * generic.cs (ConstructedType.CheckConstraints): Actually follow
5226 the spec here: the argument type must be convertible to the
5229 2004-03-30 Martin Baulig <martin@ximian.com>
5232 (TypeParameter.Define, TypeParameter.DefineMethod): Call
5233 TypeManager.AddTypeParameter().
5234 (ConstructedType.CheckConstraints): Re-enable this and actually
5235 check whether we have a constructor constraint.
5238 (TypeManager.builder_to_type_param): New static field.
5239 (TypeManager.AddTypeParameter): New static method.
5240 (TypeManager.LookupTypeParameter): New public method.
5242 2004-03-30 Martin Baulig <martin@ximian.com>
5244 * generic.cs (TypeParameter.DefineType): Return a boolean and use
5245 the new API to actually define the constructor constraint.
5248 (TypeManager.new_constraint_attr_type): New static field.
5249 (TypeManager.InitCoreTypes): Initialize it.
5251 2004-03-30 Martin Baulig <martin@ximian.com>
5253 * generic.cs (Constraints): Completed error checking, use correct
5256 2004-03-29 Martin Baulig <martin@ximian.com>
5258 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
5260 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5261 public version which takes a `ParameterData pd' instead of an
5264 2004-03-29 Martin Baulig <martin@ximian.com>
5266 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
5269 2004-03-29 Martin Baulig <martin@ximian.com>
5271 * expression.cs (Argument.ResolveMethodGroup): If we're a
5272 ConstructedType, call GetMemberAccess() on it.
5274 2004-03-29 Martin Baulig <martin@ximian.com>
5276 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
5277 (MethodCore.CheckGenericOverride): When overriding a generic
5278 method, check whether the constraints match.
5280 * support.cs (GenericConstraints): New public interface.
5281 (ParameterData.GenericConstraints): New public method.
5283 * parameter.cs (Parameter.Resolve): Check whether we're a generic
5284 method parameter and compute our constraints if appropriate.
5285 (Parameter.GenericConstraints): New public property.
5287 * generic.cs (Constraints): Implement GenericConstraints.
5289 2004-03-29 Martin Baulig <martin@ximian.com>
5291 * decl.cs (MemberCache.FindMemberToOverride): Use
5292 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
5294 2004-03-29 Martin Baulig <martin@ximian.com>
5296 * generic.cs (GenericMethod.Define): Resolve our type parameters.
5298 2004-03-29 Martin Baulig <martin@ximian.com>
5300 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
5301 not allowed on non-generic declarations").
5303 2004-03-29 Martin Baulig <martin@ximian.com>
5305 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5306 public version of this method.
5308 * class.cs (MethodCore.IsDuplicateImplementation): Use
5309 Invocation.InferTypeArguments() to check this.
5311 2004-03-29 Martin Baulig <martin@ximian.com>
5313 * convert.cs: Use TypeManager.IsDelegateType() instead of
5314 comparing types correctly.
5316 2004-03-29 Martin Baulig <martin@ximian.com>
5318 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
5319 types directly to make it work for generic instances.
5321 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
5323 2004-03-29 Martin Baulig <martin@ximian.com>
5325 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
5328 2004-03-24 Martin Baulig <martin@ximian.com>
5330 * decl.cs (DeclSpace.FindType): Also use
5331 TypeManager.CheckGeneric() for types from the using clauses.
5333 2004-03-23 Martin Baulig <martin@ximian.com>
5335 * expression.cs (Invocation.OverloadResolve): Added `bool
5336 may_fail' argument and use it instead of the Location.IsNull() hack.
5338 2004-03-23 Martin Baulig <martin@ximian.com>
5340 * expression.cs (Invocation.InferType): Use correct type inference
5343 2004-03-23 Martin Baulig <martin@ximian.com>
5345 * ecore.cs (MethodGroupExpr.Name): Use
5346 TypeManager.CSharpSignature() instead of just the name.
5348 * expression.cs (Invocation.OverloadResolve): Provide better error
5350 (Invocation.DoResolve): OverloadResolve() never returns null
5351 without reporting an error, so removed the error -6 reporting here.
5353 2004-03-23 Martin Baulig <martin@ximian.com>
5355 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
5358 * cs-parser.jay (delegate_declaration): Support generic delegates.
5360 * delegate.cs: Support generic delegates.
5362 2004-03-22 Martin Baulig <martin@ximian.com>
5364 * expression.cs (Invocation.InferParamsTypeArguments): New static
5365 method; does type inference for params arguments.
5367 2004-03-21 Martin Baulig <martin@ximian.com>
5369 * typemanager.cs (TypeManager.IsGenericMethod): New public static
5370 method; checks whether a method is a generic method.
5372 * expression.cs (Invocation.InferTypeArguments): New static method;
5373 infer type arguments for generic method invocation.
5375 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
5376 property; we set this to true if we're resolving a generic method
5377 invocation and the user specified type arguments, ie. we're not
5378 doing type inference.
5380 2004-03-20 Martin Baulig <martin@ximian.com>
5382 * class.cs (MethodData.DeclaringType): New public property.
5383 (MethodData.Define): Set DeclaringType here.
5384 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
5385 instead of OperatorMethodBuilder.DeclaringType.
5387 2004-03-20 Martin Baulig <martin@ximian.com>
5389 * cs-tokenizer.cs (xtoken): Return a special
5390 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
5392 * cs-parser.jay (default_value_expression): Switch to the new
5395 2004-03-19 Martin Baulig <martin@ximian.com>
5397 * decl.cs (MemberName): New class. We use this to "construct"
5398 namespace_or_type_name's.
5400 * generics.cs (TypeArguments.GetDeclarations): New public method;
5401 returns the type arguments as a string[] and reports a CS0081 if
5402 one of them is not an identifier.
5404 * class.cs (MemberBase): The .ctor now takes the name as a
5405 MemberName instead of a string.
5406 (MemberBase.ExplicitInterfaceName): Changed type from string to
5408 (MemberBase.DoDefine): If we're an explicit implementation, the
5409 InterfaceType may be a generic instance.
5411 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
5412 (namespace_name): Call MemberName.GetName () to transform the
5413 MemberName into a string and ensure we don't have any type
5415 (type_name): Call MemberName.GetTypeExpression() to transfrom the
5416 MemberName into an expression.
5417 (method_header): Use namespace_or_type_name instead of member_name.
5419 2004-04-07 Miguel de Icaza <miguel@ximian.com>
5421 * rootcontext.cs: Add new types to the boot resolution.
5423 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
5424 MulticastDelegate is not allowed.
5426 * typemanager.cs: Add new types to lookup: System.TypedReference
5429 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
5430 check for TypedReference or ArgIterator, they are not allowed.
5432 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
5433 makes us properly catch 1510 in some conditions (see bug 56016 for
5436 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
5438 * CryptoConvert.cs: update from corlib version
5441 2004-04-05 Miguel de Icaza <miguel@ximian.com>
5443 * class.cs (Indexer.Define): Check indexername declaration
5445 2004-04-05 Marek Safar <marek.safar@seznam.cz>
5447 * attribute.cs (IsClsCompliant): Fixed problem with handling
5448 all three states (compliant, not-compliant, undetected).
5450 2004-03-30 Marek Safar <marek.safar@seznam.cz>
5452 * attribute.cs (Attribute): Location is now public.
5453 (Resolve): Store resolved arguments (pos_values) in attribute class.
5454 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
5455 (GetClsCompliantAttributeValue): New method that gets
5456 CLSCompliantAttribute value.
5457 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
5458 if exists else null.
5459 (AttributeTester): New class for CLS-Compliant verification routines.
5461 * class.cs (Emit): Add CLS-Compliant verification.
5462 (Method.GetSignatureForError): Implemented.
5463 (Constructor.GetSignatureForError): Implemented
5464 (Constructor.HasCompliantArgs): Returns if constructor has
5465 CLS-Compliant arguments.
5466 (Constructor.Emit): Override.
5467 (Construcor.IsIdentifierClsCompliant): New method; For constructors
5468 is needed to test only parameters.
5469 (FieldBase.GetSignatureForError): Implemented.
5470 (TypeContainer): New member for storing base interfaces.
5471 (TypeContainer.FindMembers): Search in base interfaces too.
5473 * codegen.cs (GetClsComplianceAttribute): New method that gets
5474 assembly or module CLSCompliantAttribute value.
5475 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5477 (ModuleClass.Emit): Add error 3012 test.
5479 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5481 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5482 state for all decl types.
5483 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5484 if CLS-Compliant tests are required.
5485 (IsClsCompliaceRequired): New method. Analyze whether code
5486 must be CLS-Compliant.
5487 (IsExposedFromAssembly): New method. Returns true when MemberCore
5488 is exposed from assembly.
5489 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5490 value or gets cached value.
5491 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5492 is explicitly marked with CLSCompliantAttribute.
5493 (IsIdentifierClsCompliant): New abstract method. This method is
5494 used to testing error 3005.
5495 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5496 for identifier and parameters CLS-Compliant testing.
5497 (VerifyClsCompliance): New method. The main virtual method for
5498 CLS-Compliant verifications.
5499 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5500 null. I don't know why is null (too many public members !).
5501 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5502 and get value of first CLSCompliantAttribute that found.
5504 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5505 (VerifyClsCompliance): Override and add extra tests.
5507 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5508 clscheck- disable CLS-Compliant verification event if assembly is has
5509 CLSCompliantAttribute(true).
5511 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5512 ApllyAttribute is now called in emit section as in the other cases.
5513 Possible future Emit integration.
5514 (IsIdentifierClsCompliant): New override.
5515 (VerifyClsCompliance): New override.
5516 (GetEnumeratorName): Returns full enum name.
5518 * parameter.cs (GetSignatureForError): Implemented.
5520 * report.cs (WarningData): New struct for Warning message information.
5521 (LocationOfPreviousError): New method.
5522 (Warning): New method. Reports warning based on the warning table.
5523 (Error_T): New method. Reports error based on the error table.
5525 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5526 verifications are done here.
5528 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5530 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5531 CLSCompliantAttribute.
5532 (all_imported_types): New member holds all imported types from other
5534 (LoadAllImportedTypes): New method fills static table with exported types
5535 from all referenced assemblies.
5536 (Modules): New property returns all assembly modules.
5538 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5540 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5541 throwing a parser error.
5543 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5544 which removes the hardcoded get_/set_ prefixes for properties, as
5545 IL allows for the properties to be named something else.
5549 * expression.cs: Do not override operand before we know if it is
5552 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5554 * typemanager.cs: support for pinned variables.
5556 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5558 * decl.cs, typemanager.cs: Avoid using an arraylist
5559 as a buffer if there is only one result set.
5561 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5563 * expression.cs: Make sure you cant call a static method
5564 with an instance expression, bug #56174.
5566 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5568 * class.cs (IsDuplicateImplementation): Improve error reporting to
5569 flag 663 (method only differs in parameter modifier).
5571 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5572 in preprocessor directives.
5574 * location.cs (LookupFile): Allow for the empty path.
5576 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5577 better approach for some of that patch, but its failing with the
5578 CharSet enumeration. For now try/catch will do.
5580 * typemanager.cs: Do not crash if a struct does not have fields.
5583 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5585 * expression.cs: cs0213, cant fix a fixed expression.
5588 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5590 * cs-parser.jay: detect invalid embeded statements gracefully.
5593 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5595 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5598 the invocation type may not be a subclass of the tye of the item/
5599 The type of the item must be a subclass of the invocation item.
5604 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5606 * attribute.cs: Added methods to get a string and a bool from an
5607 attribute. Required to information from AssemblyKeyFileAttribute,
5608 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5609 * codegen.cs: Modified AssemblyName creation to include support for
5610 strongnames. Catch additional exceptions to report them as CS1548.
5611 * compiler.csproj: Updated include CryptoConvert.cs.
5612 * compiler.csproj.user: Removed file - user specific configuration.
5613 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5614 Mono.Security assembly. The original class is maintained and tested in
5615 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5616 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5617 like CSC 8.0 (C# v2) supports.
5618 * Makefile: Added CryptoConvert.cs to mcs sources.
5619 * rootcontext.cs: Added new options for strongnames.
5621 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5623 * driver.cs: For --expect-error, report error code `2'
5624 if the program compiled with no errors, error code `1' if
5625 it compiled with an error other than the one expected.
5627 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5629 * compiler.csproj: Updated for Visual Studio .NET 2003.
5630 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5631 * compiler.sln: Updated for Visual Studio .NET 2003.
5633 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5635 * expression.cs: Fix bug #47234. We basically need to apply the
5636 rule that we prefer the conversion of null to a reference type
5637 when faced with a conversion to 'object' (csc behaviour).
5639 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5641 * statement.cs: Shorter form for foreach, eliminates
5642 a local variable. r=Martin.
5644 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5646 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5647 checks if we can use brtrue/brfalse to test for 0.
5648 * expression.cs: use the above in the test for using brtrue/brfalse.
5651 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5653 * expression.cs: Rewrite string concat stuff. Benefits:
5655 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5656 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5657 rather than a concat chain.
5659 * typemanager.cs: Add lookups for more concat overloads.
5661 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5663 * expression.cs: Emit shorter il code for array init.
5680 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5682 * statement.cs: Before, two switch blocks would be merged if the
5683 total size of the blocks (end_item - begin_item + 1) was less than
5684 two times the combined sizes of the blocks.
5686 Now, it will only merge if after the merge at least half of the
5691 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5693 * class.cs : csc build fix for GetMethods(). See bug #52503.
5695 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5697 * expression.cs: Make sure fp comparisons work with NaN.
5698 This fixes bug #54303. Mig approved this patch a long
5699 time ago, but we were not able to test b/c the runtime
5702 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5704 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5706 2004-03-19 Martin Baulig <martin@ximian.com>
5708 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5709 two overloads may unify for some type parameter substitutions and
5710 report a CS0408 if appropriate.
5712 2004-03-19 Martin Baulig <martin@ximian.com>
5714 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5715 error here and not in our caller.
5717 2004-03-19 Martin Baulig <martin@ximian.com>
5719 * interface.cs: Completely killed this file.
5720 (Interface): We're now a TypeContainer and live in class.cs.
5722 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5723 argument; we're now also called for interfaces.
5724 (TypeContainer.DefineMembers): Allow this method being called
5726 (TypeContainer.GetMethods): New public method; formerly known as
5727 Interface.GetMethod(). This is used by PendingImplementation.
5728 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5729 it's now private and non-static.
5730 (Interface): Moved this here; it's now implemented similar to
5732 (Method, Property, Event, Indexer): Added `bool is_interface'
5733 argument to their .ctor's.
5734 (MemberBase.IsInterface): New public field.
5736 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5737 instances instead of InterfaceMethod, InterfaceProperty, etc.
5738 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5739 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5741 2004-03-19 Martin Baulig <martin@ximian.com>
5743 * class.cs (MethodCore.IsDuplicateImplementation): New private
5744 method which does the CS0111 checking.
5745 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5746 Use IsDuplicateImplementation().
5748 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5750 * decl.cs (FindMemberToOverride): New method to find the correct
5751 method or property to override in the base class.
5753 - Make Method/Property use the above method to find the
5754 version in the base class.
5755 - Remove the InheritableMemberSignatureCompare as it is now
5758 This patch makes large code bases much faster to compile, as it is
5759 O(n) rather than O(n^2) to do this validation.
5761 Also, it fixes bug 52458 which is that nested classes are not
5762 taken into account when finding the base class member.
5764 Reviewed/Approved by Martin.
5766 2004-03-17 Martin Baulig <martin@ximian.com>
5768 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5769 of type arguments into account; use the `real_num_type_args'
5770 approach like in DoResolveAsTypeStep().
5772 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5775 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5777 * interface.cs: In all interface classes removed redundant
5778 member initialization.
5780 2004-03-16 Martin Baulig <martin@ximian.com>
5782 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5784 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5786 * decl.cs (DefineTypeAndParents): New helper method to define a
5787 type's containers before the type itself is defined; This is a
5788 bug exposed by the recent changes to Windows.Forms when an
5789 implemented interface was defined inside a class that had not been
5792 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5794 (Check): Loop correctly to report errors modifiers
5795 (UNSAFE was not in the loop, since it was the same as TOP).
5797 * interface.cs: Every interface member now takes a ModFlags,
5798 instead of a "is_new" bool, which we set on the base MemberCore.
5800 Every place where we called "UnsafeOk" in the interface, now we
5801 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5802 the unsafe settings from the member declaration instead of the
5803 container interface.
5805 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5807 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5808 `set_indexer_name' to the pending bits (one per type).
5810 We fixed a bug today that was picking the wrong method to
5811 override, since for properties the existing InterfaceMethod code
5812 basically ignored the method name. Now we make sure that the
5813 method name is one of the valid indexer names.
5815 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5817 * support.cs (SeekableStreamReader): Keep track of stream byte
5818 positions and don't mix them with character offsets to the buffer.
5820 Patch from Gustavo Giráldez
5822 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5824 * interface.cs (InterfaceSetGetBase): Removed double member
5825 initialization, base class does it as well.
5827 2004-03-13 Martin Baulig <martin@ximian.com>
5829 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5830 when compiling corlib.
5832 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5834 * convert.cs (ExplicitConversion): We were reporting an error on
5835 certain conversions (object_type source to a value type, when the
5836 expression was `null') before we had a chance to pass it through
5837 the user defined conversions.
5839 * driver.cs: Replace / and \ in resource specifications to dots.
5842 * class.cs: Add check for duplicate operators. Fixes 52477
5844 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5846 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5847 that are in the middle of the statements, not only at the end.
5850 * class.cs (TypeContainer.AddField): No longer set the
5851 `HaveStaticConstructor' flag, now we call it
5852 `UserDefineStaticConstructor' to diferentiate the slightly
5853 semantic difference.
5855 The situation is that we were not adding BeforeFieldInit (from
5856 Modifiers.TypeAttr) to classes that could have it.
5857 BeforeFieldInit should be set to classes that have no static
5862 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5864 And most importantly Zoltan's comment:
5866 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5868 "I think beforefieldinit means 'it's ok to initialize the type sometime
5869 before its static fields are used', i.e. initialization does not need
5870 to be triggered by the first access to the type. Setting this flag
5871 helps the JIT to compile better code, since it can run the static
5872 constructor at JIT time, and does not need to generate code to call it
5873 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5874 this flag for lots of classes like String.
5876 csc sets this flag if the type does not have an explicit static
5877 constructor. The reasoning seems to be that if there are only static
5878 initalizers for a type, and no static constructor, then the programmer
5879 does not care when this initialization happens, so beforefieldinit
5882 This bug prevents the AOT compiler from being usable, since it
5883 generates so many calls to mono_runtime_class_init that the AOT code
5884 is much slower than the JITted code. The JITted code is faster,
5885 because it does not generate these calls if the vtable is type is
5886 already initialized, which is true in the majority of cases. But the
5887 AOT compiler can't do this."
5889 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5891 * class.cs (MethodData.Emit): Refactor the code so symbolic
5892 information is generated for destructors; For some reasons we
5893 were taking a code path that did not generate symbolic information
5896 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5898 * class.cs: Create a Constructor.CheckBase method that
5899 takes care of all validation type code. The method
5900 contains some code that was moved from Define.
5902 It also includes new code that checks for duplicate ctors.
5903 This fixes bug #55148.
5905 2004-03-09 Joshua Tauberer <tauberer@for.net>
5907 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5908 a { ... }-style array creation invokes EmitStaticInitializers
5909 which is not good for reference-type arrays. String, decimal
5910 and now null constants (NullCast) are not counted toward
5911 static initializers.
5913 2004-03-05 Martin Baulig <martin@ximian.com>
5915 * location.cs (SourceFile.HasLineDirective): New public field;
5916 specifies whether the file contains or is referenced by a "#line"
5918 (Location.DefineSymbolDocuments): Ignore source files which
5919 either contain or are referenced by a "#line" directive.
5921 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5923 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5924 direct access to our parent, so check the method inline there.
5926 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5928 * expression.cs (Invocation.EmitCall): Miguel's last commit
5929 caused a regression. If you had:
5934 In Foo the implict this would be null.
5936 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5938 * expression.cs (Invocation.EmitCall): If the method is not
5939 virtual, do not emit a CallVirt to it, use Call.
5941 * typemanager.cs (GetFullNameSignature): Improve the method to
5942 cope with ".ctor" and replace it with the type name.
5944 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5945 as an argument the ConstructorBuilder where it is being defined,
5946 to catch the recursive constructor invocations.
5948 2004-03-16 Martin Baulig <martin@ximian.com>
5950 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
5951 ConstructedType, call ResolveType() on it to get the type rather
5952 than just using `expr.Type'.
5954 2004-03-16 Martin Baulig <martin@ximian.com>
5956 * generics.cs (ConstructedType.GetMemberAccess): Take the
5957 EmitContext instead on the TypeExpr and use
5958 ec.TypeContainer.CurrentType/ec.ContainerType.
5960 2004-03-16 Martin Baulig <martin@ximian.com>
5962 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
5963 parameters before aliases.
5965 2004-03-16 Martin Baulig <martin@ximian.com>
5967 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
5968 New oublic function; checks whether two generic instances may become
5969 equal under some instantiations (26.3.1).
5971 * class.cs (TypeContainer.Define): Call
5972 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
5975 2004-03-16 Martin Baulig <martin@ximian.com>
5977 * class.cs (TypeContainer.GetClassBases): Moved
5978 Error_TypeParameterAsBase() here and also check whether the base
5979 class is not an attribute.
5981 2004-03-16 Martin Baulig <martin@ximian.com>
5983 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5985 2004-03-16 Martin Baulig <martin@ximian.com>
5987 * class.cs (Error_TypeParameterAsBase): Use correct error number
5990 2004-03-16 Martin Baulig <martin@ximian.com>
5992 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
5995 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
5998 2004-03-15 Martin Baulig <martin@ximian.com>
6000 * typemanager.cs (TypeManager.GetFullName): New public method.
6001 (TypeManager.MemberLookup): Added `int_num_type_arguments'
6002 argument; only return members with the correct number of type
6004 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
6005 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
6006 whether the number of type arguments matches.
6008 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
6009 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
6011 * expression.cs (MemberAccess): Added public `NumTypeArguments'
6012 field; it's set by the protected .ctor when we're actually a
6013 GenericMemberAccess.
6014 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
6015 arguments and pass it to MemberLookupFinal ().
6017 * ecore.cs (Expression.MemberLookup): Added `int
6018 num_type_arguments' argument; only return members with the correct
6019 number of type arguments.
6020 (Expression.MemberLookupFailed): Check whether the MemberLookup
6021 failed because we did not have the correct number of type
6022 arguments; report CS0305 in this case.
6024 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
6025 `e.ResolveAsTypeTerminal()' already did so.
6027 2004-03-15 Martin Baulig <martin@ximian.com>
6029 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
6030 we're a ConstructedType; in this case, the caller must report an
6031 error (for instance CS0131).
6033 * generic.cs (TypeArguments): Added Location argument to the .ctor.
6034 (TypeArguments.Resolve): Actually report errors here.
6036 2004-03-15 Miguel de Icaza <miguel@ximian.com>
6038 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
6039 `set_indexer_name' to the pending bits (one per type).
6041 We fixed a bug today that was picking the wrong method to
6042 override, since for properties the existing InterfaceMethod code
6043 basically ignored the method name. Now we make sure that the
6044 method name is one of the valid indexer names.
6046 2004-03-15 Martin Baulig <martin@ximian.com>
6048 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
6049 for generic instances.
6051 2004-03-13 Martin Baulig <martin@ximian.com>
6053 * class.cs (TypeContainer.DefineType): Call
6054 TypeManager.AddUserType() immediately after creating the
6055 TypeBuilder; pass all type parameters when creating the
6058 * decl.cs (DeclSpace.FindNestedType): New public method.
6059 (DeclSpace.FindType): Added `int num_type_args' argument; only
6060 return types with the correct number of type parameters.
6061 (DeclSpace.CountTypeParams): New public property.
6063 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
6064 the number of type parameters; defaults to zero.
6066 * generic.cs (TypeArguments.Count): New public property.
6067 (ConstructedType.DoResolveAsTypeStep): First call
6068 ds.FindNestedType() to find out whether we're nested in the
6069 current generic type; in this case, we inherit all type parameters
6070 from the current class.
6072 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
6073 num_type_args' argument.
6074 (RootContext.LookupType): Added overloaded version which takes the
6075 number of type arguments; only return types with the correct
6076 number of type arguments.
6078 * typemanager.cs (TypeManager.CheckGeneric): New public function;
6079 checks whether `Type t' has `int num_type_args'.
6081 2004-03-13 Martin Baulig <martin@ximian.com>
6083 * generic.cs (GenericMethod.DefineType): New method; calls
6084 DefineType() on all the type parameters.
6086 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
6087 (MethodData.Define): If we're a generic method, call
6088 GenericMethod.DefineType() to define the type parameters.
6090 2004-03-10 Martin Baulig <martin@ximian.com>
6092 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
6093 instead of IsAssignableFrom.
6095 2004-03-10 Martin Baulig <martin@ximian.com>
6097 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
6099 * support.cs (ParameterData.HasArrayParameter): New property.
6100 (ReflectionParameters.ctor): Take a MethodBase instead of a
6101 ParameterInfo[]. If we have any type parameters, get the generic
6102 method definition and ask it whether we have variable arguments.
6104 2004-02-26 Miguel de Icaza <miguel@ximian.com>
6106 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
6107 routines to check if a type is an enumerable/enumerator allow
6108 classes that implement the IEnumerable or IEnumerator interfaces.
6110 * class.cs (Property, Operator): Implement IIteratorContainer, and
6111 implement SetYields.
6113 (Property.Define): Do the block swapping for get_methods in the
6114 context of iterators. We need to check if Properties also
6115 include indexers or not.
6117 (Operator): Assign the Block before invoking the
6118 OperatorMethod.Define, so we can trigger the Iterator code
6121 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
6122 Property and Operator classes are not created when we parse the
6123 declarator but until we have the block completed, so we use a
6124 singleton SimpleIteratorContainer.Simple to flag whether the
6125 SetYields has been invoked.
6127 We propagate this setting then to the Property or the Operator to
6128 allow the `yield' to function.
6130 2004-02-25 Marek Safar <marek.safar@seznam.cz>
6132 * codegen.cs: Implemented attribute support for modules.
6133 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
6134 Assembly/Module functionality.
6136 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
6137 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
6138 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
6140 2004-02-16 Marek Safar <marek.safar@seznam.cz>
6142 * interface.cs (FindMembers): The operation is performed on all base
6143 interfaces and not only on the first. It is required for future CLS Compliance patch.
6145 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
6147 * statement.cs, codegen.cs:
6148 This patch deals with patterns such as:
6150 public class List : IEnumerable {
6152 public MyEnumerator GetEnumerator () {
6153 return new MyEnumerator(this);
6156 IEnumerator IEnumerable.GetEnumerator () {
6160 public struct MyEnumerator : IEnumerator {
6165 Before, there were a few things we did wrong:
6166 1) we would emit callvirt on a struct, which is illegal
6167 2) we emited ldarg when we needed to emit ldarga
6168 3) we would mistakenly call the interface methods on an enumerator
6169 type that derived from IEnumerator and was in another assembly. For example:
6171 public class MyEnumerator : IEnumerator
6173 Would have the interface methods called, even if there were public impls of the
6174 method. In a struct, this lead to invalid IL code.
6176 2004-02-11 Marek Safar <marek.safar@seznam.cz>
6178 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
6181 * delegate.cs (Define): Fixed crash when delegate type is undefined.
6183 2004-02-11 Miguel de Icaza <miguel@ximian.com>
6185 * cs-parser.jay: Fix small regression: we were not testing V2
6186 compiler features correctly.
6188 * interface.cs: If the emit context is null, then create one
6190 2004-02-09 Marek Safar <marek.safar@seznam.cz>
6192 * decl.cs (GetSignatureForError): New virtual method to get full name
6195 * attribute.cs (IAttributeSupport): New interface for attribute setting.
6196 Now it is possible to rewrite ApplyAttributes method to be less if/else.
6198 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
6199 Duplicated members and code in these classes has been removed.
6200 Better encapsulation in these classes.
6202 2004-02-07 Miguel de Icaza <miguel@ximian.com>
6204 * assign.cs (Assign.DoResolve): When dealing with compound
6205 assignments, there is a new rule in ECMA C# 2.4 (might have been
6206 there before, but it is documented here) that states that in:
6210 If b is of type int, and the `op' is a shift-operator, then the
6211 above is evaluated as:
6215 * expression.cs (Binary.ResolveOperator): Instead of testing for
6216 int/uint/long/ulong, try to implicitly convert to any of those
6217 types and use that in pointer arithmetic.
6219 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
6220 method to print information for from the type, not from the
6221 null-method we were given.
6223 2004-02-01 Duncan Mak <duncan@ximian.com>
6225 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
6226 parsing for cmd, fixes bug #53694.
6228 2004-02-04 Marek Safar <marek.safar@seznam.cz>
6230 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
6231 in the member name duplication tests. Property and operator name duplication
6232 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
6234 2004-02-03 Marek Safar <marek.safar@seznam.cz>
6236 * interface.cs (PopulateMethod): Fixed crash when interface method
6237 returns not existing type (error test cs0246-3.cs).
6239 2004-02-02 Ravi Pratap M <ravi@ximian.com>
6241 * cs-parser.jay (interface_accessors): Re-write actions to also
6242 store attributes attached to get and set methods. Fix spelling
6245 (inteface_property_declaration): Modify accordingly.
6247 (InterfaceAccessorInfo): New helper class to store information to pass
6248 around between rules that use interface_accessors.
6250 * interface.cs (Emit): Apply attributes on the get and set
6251 accessors of properties and indexers too.
6253 * attribute.cs (ApplyAttributes): Modify accordingly to use the
6254 right MethodBuilder when applying attributes to the get and set accessors.
6256 2004-01-31 Miguel de Icaza <miguel@ximian.com>
6258 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
6260 2004-01-26 Miguel de Icaza <miguel@ximian.com>
6262 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
6264 2004-01-25 Miguel de Icaza <miguel@ximian.com>
6266 * cs-parser.jay: Remove YIELD token, instead use the new grammar
6267 changes that treat `yield' specially when present before `break'
6270 * cs-tokenizer.cs: yield is no longer a keyword.
6272 2004-01-23 Marek Safar <marek.safar@seznam.cz>
6274 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
6275 setting for default constructors.
6276 For default constructors are almost every time set wrong Modifier. The
6277 generated IL code has been alright. But inside mcs this values was
6278 wrong and this was reason why several of my CLS Compliance tests
6281 2004-02-27 Martin Baulig <martin@ximian.com>
6283 * generics.cs (ConstructedType.ResolveType): Make the nested type
6284 stuff actually work.
6286 2004-02-25 Martin Baulig <martin@ximian.com>
6288 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
6289 property; returns the type parameters just from the current type,
6290 ie. with the ones from outer classes.
6291 (DeclSpace.LookupGeneric): First search in the current class, then
6293 (DeclSpace.initialize_type_params): When hiding a type parameter
6294 from an outer class, put it into the `type_param_list' anyways.
6296 * expression.cs (MemberAccess.expr): Made this field protected.
6298 * class.cs (TypeContainer.Define): The `CurrentType' just contains
6299 the type parameters from the current class.
6301 * generic.cs (ConstructedType.ResolveType): Support nested generic
6302 types by taking the type parameters which we inherit from outer
6303 classes into account.
6304 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
6305 support for nested generic types.
6307 2004-02-23 Martin Baulig <martin@ximian.com>
6309 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
6310 field and check whether we're nested inside a generic type.
6311 (DeclSpace.ResolveType): If we're resolving to a generic type
6312 definition, create a ConstructedType and return its resolved type.
6313 (DeclSpace.initialize_type_params): New private method;
6314 initializes the `type_param_list' field from the type parameters
6315 from this and all enclosing classes.
6316 (DeclSpace.TypeParameters): Call initialize_type_params() unless
6317 we're already initialized.
6319 2004-02-23 Martin Baulig <martin@ximian.com>
6321 * class.cs (Method.Define): Create the generic method before
6323 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
6324 the TypeContainer one); we use this for generic methods.
6326 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
6327 parent's TypeBuilder.
6329 2004-02-18 Martin Baulig <martin@ximian.com>
6331 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
6332 to check for equality.
6334 2004-02-05 Martin Baulig <martin@ximian.com>
6336 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
6337 `ec.TypeContainer.CurrentType', use it instead of
6338 `ec.ContainerType' to check whether we're in the type's ctor.
6340 2004-01-29 Martin Baulig <martin@ximian.com>
6342 * expression.cs (Invocation.DoResolve): If we're a
6343 `ConstructedType', then we're actually a generic method, so
6344 rewrite the expr as a GenericMemberAccess.
6346 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
6347 here; manually parse it into a string.
6349 2004-01-28 Martin Baulig <martin@ximian.com>
6351 * typemanager.cs (TypeManager.IsEqual): New static method.
6352 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
6353 check for equality instead of using `=='.
6355 2004-01-26 Martin Baulig <martin@ximian.com>
6357 * decl.cs (DeclSpace.CurrentType): New public field.
6359 * expression.cs (This.ResolveBase): If we have an
6360 `ec.TypeContainer.CurrentType', use it instead of
6363 * class.cs (TypeContainer.DefineType): If we're a generic type,
6364 create the `CurrentType' (unresolved).
6365 (TypeContainer.GenericType): New private field.
6366 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
6367 it and store it in `GenericType' before creating the MemberCache.
6368 (TypeContainer.GetMembers): If we have a `GenericType', call
6369 TypeManager.FindMembers() on it.
6371 * interface.cs (Interface.GenericType): New private field.
6372 (Interface.DefineType): If we're a generic type, create the
6373 `CurrentType' (unresolved).
6374 (Interface.DefineMembers): If we have a `CurrentType', resolve it
6375 and store it in `GenericType' before creating the MemberCache.
6376 (Interface.GetMembers): If we have a `GenericType', call
6377 TypeManager.FindMembers() on it.
6379 2004-01-22 Martin Baulig <martin@ximian.com>
6381 * cs-parser.jay (namespace_or_type_name): Return an Expression,
6382 not a QualifiedIdentifier. This is what `type_name_expression'
6383 was previously doing.
6384 (type_name_expression): Removed; the code is now in
6385 `namespace_or_type_name'.
6386 (qualified_identifier): Removed, use `namespace_or_type_name'
6388 (QualifiedIdentifier): Removed this class.
6390 2004-01-22 Martin Baulig <martin@ximian.com>
6392 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
6393 not a string as alias name.
6395 2004-01-21 Miguel de Icaza <miguel@ximian.com>
6397 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
6398 #52730 bug, and instead compute correctly the need to use a
6399 temporary variable when requesting an address based on the
6400 static/instace modified of the field and the constructor.
6402 2004-01-21 Martin Baulig <martin@ximian.com>
6404 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
6405 class and namespace before looking up aliases. Fixes #52517.
6407 2004-01-21 Martin Baulig <martin@ximian.com>
6409 * flowanalysis.cs (UsageVector.Merge): Allow variables being
6410 assinged in a 'try'; fixes exception4.cs.
6412 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6413 * class.cs : Implemented parameter-less constructor for TypeContainer
6415 * decl.cs: Attributes are now stored here. New property OptAttributes
6417 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
6419 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
6421 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6423 * typemanager.cs (CSharpSignature): Now reports also inner class name.
6424 (CSharpSignature): New method for indexer and property signature.
6426 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6428 * pending.cs (IsVirtualFilter): Faster implementation.
6430 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6432 * typemanager.cs: Avoid inclusion of same assembly more than once.
6434 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6436 * cs-parser.jay: Fixed problem where the last assembly attribute
6437 has been applied also to following declaration (class, struct, etc.)
6439 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6441 * class.cs: Added error CS0538, CS0539 reporting.
6442 Fixed crash on Microsoft runtime when field type is void.
6444 * cs-parser.jay: Added error CS0537 reporting.
6446 * pending.cs: Added error CS0535 reporting.
6447 Improved error report for errors CS0536, CS0534.
6449 2004-01-20 Miguel de Icaza <miguel@ximian.com>
6451 Merge a few bits from the Anonymous Method MCS tree.
6453 * statement.cs (ToplevelBlock): New class for toplevel methods,
6454 will hold anonymous methods, lifted variables.
6456 * cs-parser.jay: Create toplevel blocks for delegates and for
6457 regular blocks of code.
6459 2004-01-20 Martin Baulig <martin@ximian.com>
6461 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
6462 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
6463 and `NeedExplicitReturn'; added `IsLastStatement'.
6464 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
6465 have a `ReturnLabel' or we're not unreachable.
6467 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
6468 child's reachability; don't just override ours with it. Fixes
6469 #58058 (lluis's example).
6470 (FlowBranching): Added public InTryOrCatch(), InCatch(),
6471 InFinally(), InLoop(), InSwitch() and
6472 BreakCrossesTryCatchBoundary() methods.
6474 * statement.cs (Return): Do all error checking in Resolve().
6475 Unless we are the last statement in a top-level block, always
6476 create a return label and jump to it.
6477 (Break, Continue): Do all error checking in Resolve(); also make
6478 sure we aren't leaving a `finally'.
6479 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
6480 statement in a top-level block.
6481 (Block.Flags): Added `IsDestructor'.
6482 (Block.IsDestructor): New public property.
6484 2004-01-20 Martin Baulig <martin@ximian.com>
6486 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
6488 2004-01-20 Martin Baulig <martin@ximian.com>
6490 * statement.cs (Statement.ResolveUnreachable): New public method.
6491 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
6492 (Block.Resolve): Resolve unreachable statements.
6494 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6496 * expression.cs: We need to fix the case where we do
6497 not have a temp variable here.
6499 * assign.cs: Only expression compound assignments need
6500 temporary variables.
6502 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6504 * flowanalysis.cs: Reduce memory allocation in a few ways:
6505 - A block with no variables should not allocate a bit
6507 - A method with no out parameters does not need any tracking
6508 for assignment of the parameters, so we need not allocate
6511 public readonly Type[] VariableTypes;
6512 public readonly string[] VariableNames;
6513 Are redundant. The data is already stored in the variable
6514 map, so we need not allocate another array for it.
6515 - We need to add alot of checks for if (params | locals) == null
6516 due to the first two changes.
6518 2004-01-18 Miguel de Icaza <miguel@ximian.com>
6520 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
6521 implement IMemoryLocation, we store a copy on a local variable and
6522 take the address of it. Patch from Benjamin Jemlich
6524 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
6525 to use a special "type_name_expression" rule which reduces the
6526 number of "QualifiedIdentifier" classes created, and instead
6527 directly creates MemberAccess expressions.
6529 2004-01-17 Miguel de Icaza <miguel@ximian.com>
6531 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
6532 that fixes #52853. Null literal assignment to ValueType
6534 * class.cs (MethodData.Emit): Instead of checking the name of the
6535 method to determine if its a destructor, create a new derived
6536 class from Method called Destructor, and test for that.
6538 * cs-parser.jay: Create a Destructor object instead of a Method.
6540 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
6544 2004-01-16 Miguel de Icaza <miguel@ximian.com>
6546 * expression.cs (Binary.ResolveOperator): Perform an implicit
6547 conversion from MethodGroups to their delegate types on the
6550 * delegate.cs: Introduce a new class DelegateCreation that is the
6551 base class for `NewDelegate' and `ImplicitDelegateCreation',
6552 factor some code in here.
6554 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
6555 conversion from MethodGroups to compatible delegate types.
6557 * ecore.cs (Expression.Resolve): Do not flag error 654
6558 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
6559 we allow conversions from MethodGroups to delegate types now.
6561 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
6562 assignments in v2 either.
6564 2004-01-10 Miguel de Icaza <miguel@ximian.com>
6566 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
6567 static read-only fields in ctors.
6569 Applied patch from Benjamin Jemlich
6571 * expression.cs (UnaryMutator): Avoid leaking local variables.
6573 2004-01-09 Miguel de Icaza <miguel@ximian.com>
6575 * cs-tokenizer.cs (IsCastToken): Allow the various native types
6576 here to return true, as they can be used like this:
6580 Fixed 49836 and all the other dups
6582 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
6584 * driver.cs: Implement /win32res and /win32icon.
6586 2004-01-08 Miguel de Icaza <miguel@ximian.com>
6588 * cs-parser.jay: Add a rule to improve error handling for the
6589 common mistake of placing modifiers after the type.
6591 2004-01-07 Miguel de Icaza <miguel@ximian.com>
6593 * cs-parser.jay (interface_event_declaration): Catch
6594 initialization of events on interfaces, and report cs0068
6596 * cs-parser.jay (interface_event_declaration): Catch
6597 initialization of events.
6599 * ecore.cs: Better report missing constructors.
6601 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6602 the error reporting done in the wrong place. Fix.
6604 * expression.cs (Binary.ResolveOperator): Catch the
6605 operator + (E x, E y) error earlier, and later allow for implicit
6606 conversions in operator +/- (E e, U x) from U to the underlying
6609 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6610 52596, if the container class is abstract, the default constructor
6611 is protected otherwise its public (before, we were always public).
6613 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6616 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6617 Jemlich that fixes bug #52597, MCS was generating invalid code for
6618 idisposable structs. Thanks to Ben for following up with this
6621 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6623 * driver.cs: Allow assemblies without code to be generated, fixes
6626 2004-01-07 Nick Drochak <ndrochak@gol.com>
6628 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6630 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6632 * cs-parser.jay: Add rules to improve error reporting if fields or
6633 methods are declared at the namespace level (error 116)
6635 * Add rules to catch event add/remove
6637 2004-01-04 David Sheldon <dave-mono@earth.li>
6639 * expression.cs: Added matching ")" to error message for
6642 2004-01-03 Todd Berman <tberman@gentoo.org>
6644 * ecore.cs, attribute.cs:
6645 Applying fix from #52429.
6647 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6649 * ecore.cs, expression.cs, statement.cs:
6650 Total rewrite of how we handle branching. We
6651 now handle complex boolean expressions with fewer
6652 jumps. As well if (x == 0) no longer emits a ceq.
6654 if (x is Foo) is much faster now, because we generate
6657 Overall, we get a pretty big improvement on our benchmark
6658 tests. The code we generate is smaller and more readable.
6660 I did a full two-stage bootstrap. The patch was reviewed
6661 by Martin and Miguel.
6663 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6665 * cs-parser.jay: Make primary_expression not take a QI.
6666 we dont need this because the member_access rule covers
6667 us here. So we replace the rule with just IDENTIFIER.
6669 This has two good effects. First, we remove a s/r conflict.
6670 Second, we allocate many fewer QualifiedIdentifier objects.
6672 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6674 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6675 set the correct information via SRE. This prevents
6676 hanging on the MS runtime. Fixes #29374.
6678 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6680 * convert.cs: correctly handle conversions to value types
6681 from Enum and ValueType as unboxing conversions.
6683 Fixes bug #52569. Patch by Benjamin Jemlich.
6685 2004-01-02 Ravi Pratap <ravi@ximian.com>
6687 * expression.cs (BetterConversion): Prefer int -> uint
6688 over int -> ulong (csc's behaviour). This fixed bug #52046.
6690 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6692 * decl.cs (MemberCache.FindMembers): now returns a
6695 * typemanager.cs: In general, go with with ^^.
6696 (CopyNewMethods): take an IList.
6697 (RealMemberLookup): Only allocate an arraylist
6698 if we copy from two sets of methods.
6700 This change basically does two things:
6701 1) Fewer array lists allocated due to CopyNewMethods.
6702 2) the explicit cast in MemberList costed ALOT.
6704 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6706 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6707 a hashtable to avoid needless string allocations when an identifier is
6708 used more than once (the common case).
6710 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6712 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6713 is broken, it will not return anything. So, we
6714 have to use the information we have in mcs to
6717 * typemanager.cs: Add a cache for GetInterfaces,
6718 since this will now be used more often (due to ^^)
6720 (GetExplicitInterfaces) New method that gets the
6721 declared, not effective, interfaces on a type
6722 builder (eg, if you have interface IFoo, interface
6723 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6726 This patch makes MCS able to bootstrap itself on
6729 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6731 * expression.cs: Remove the Nop's that Miguel put
6734 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6736 * report.cs, codegen.cs: Give the real stack trace to
6737 the error when an exception is thrown.
6739 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6741 * decl.cs: only allocate hashtables for ifaces if
6744 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6746 * expression.cs: fix the error from cs0121-2.cs
6747 (a parent interface has two child interfaces that
6748 have a function with the same name and 0 params
6749 and the function is called through the parent).
6751 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6753 * class.cs, rootcontext.cs, typmanager.cs: do not
6756 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6758 * codegen.cs: remove stack for the ec flow branching.
6759 It is already a linked list, so no need.
6761 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6763 * Makefile: Allow custom profiler here.
6765 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6767 * typemanager.cs (LookupType):
6768 - Use a static char [], because split takes
6769 a param array for args, so it was allocating
6771 - Do not store true in a hashtable, it boxes.
6773 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6775 * flowanalysis.cs: bytify common enums.
6777 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6779 * modifiers.cs: Add a new set of flags for the
6780 flags allowed on explicit interface impls.
6781 * cs-parser.jay: catch the use of modifiers in
6782 interfaces correctly.
6783 * class.cs: catch private void IFoo.Blah ().
6785 All related to bug #50572.
6787 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6789 * decl.cs: Rewrite the consistant accessability checking.
6790 Accessability is not linear, it must be implemented in
6791 a tableish way. Fixes #49704.
6793 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6795 * expression.cs: Handle negation in a checked context.
6796 We must use subtraction from zero. Fixes #38674.
6798 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6800 * class.cs: Ignore static void main in DLLs.
6801 * rootcontext.cs: Handle the target type here,
6802 since we are have to access it from class.cs
6803 * driver.cs: account for the above.
6805 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6807 * report.cs: Give line numbers and files if available.
6809 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6811 * driver.cs: Implement /addmodule.
6813 * typemanager.cs: Change 'modules' field so it now contains Modules not
6816 2003-12-20 Martin Baulig <martin@ximian.com>
6818 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6819 (FieldBase.IsAssigned): Removed this field.
6820 (FieldBase.SetAssigned): New public method.
6821 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6823 2003-12-20 Martin Baulig <martin@ximian.com>
6825 * expression.cs (LocalVariableReference.DoResolve): Don't set
6826 `vi.Used' if we're called from DoResolveLValue().
6828 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6829 returns the usage vector it just merged into the current one -
6830 pass this one to UsageWarning().
6831 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6832 of the `EmitContext', don't call this recursively on our children.
6834 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6836 * driver.cs: Implement /target:module.
6838 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6840 * support.cs (CharArrayHashtable): New helper class.
6842 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6843 char arrays, not strings, so we can avoid creating a string in
6844 consume_identifier if the identifier is a keyword.
6846 2003-12-16 Martin Baulig <martin@ximian.com>
6848 * statement.cs (LocalInfo.Assigned): Removed this property.
6849 (LocalInfo.Flags): Removed `Assigned'.
6850 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6851 and uses flow analysis.
6852 (Block.UsageWarning): Made this method private.
6853 (Block.Resolve): Call UsageWarning() if appropriate.
6855 * expression.cs (LocalVariableReference.DoResolve): Always set
6856 LocalInfo.Used here.
6858 2003-12-13 Martin Baulig <martin@ximian.com>
6860 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6861 any value here; we're now using flow analysis to figure out
6862 whether a statement/block returns a value.
6864 2003-12-13 Martin Baulig <martin@ximian.com>
6866 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6868 (FlowBranching.MergeFinally): Don't call
6869 `branching.CheckOutParameters()' here, this is called in
6871 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6872 when adding the `finally' vector.
6874 2003-12-13 Martin Baulig <martin@ximian.com>
6877 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6878 actually work and also fix #48962.
6880 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6882 * decl.cs: Do not check System.Object for nested types,
6883 since we know it does not have any. Big bang for buck:
6888 corlib: 17.99 seconds
6892 corlib: 17.39 seconds
6894 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6896 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6897 time we are returning 0 members, so we save alot here.
6899 2003-12-11 Martin Baulig <martin@ximian.com>
6901 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6902 `MergeChild()', also just take the `FlowBranching' as argument;
6903 call Merge() on it and return the result.
6904 (FlowBranching.Merge): We don't need to do anything if we just
6907 2003-12-11 Martin Baulig <martin@ximian.com>
6909 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6910 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6911 Maurer for this idea.
6913 2003-12-11 Martin Baulig <martin@ximian.com>
6915 * flowanalysis.cs (MergeResult): This class is now gone; we now
6916 use the `UsageVector' for this. The reason for this is that if a
6917 branching just has one sibling, we don't need to "merge" them at
6918 all - that's the next step to do.
6919 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6922 2003-12-11 Martin Baulig <martin@ximian.com>
6924 Reworked flow analyis and made it more precise and bug-free. The
6925 most important change is that we're now using a special `Reachability'
6926 class instead of having "magic" meanings of `FlowReturns'. I'll
6927 do some more cleanups and optimizations and also add some more
6928 documentation this week.
6930 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6931 largely reworked this class.
6932 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6933 the new `Reachability' class instead of having "magic" values here.
6934 (FlowBranching): We're now using an instance of `Reachability'
6935 instead of having separate `Returns', `Breaks' etc. fields.
6937 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6938 based on flow analysis; ignore the return value of block.Emit ().
6940 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6942 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6943 if they are private.
6945 2003-12-09 Martin Baulig <martin@ximian.com>
6947 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6948 call them directly on the UsageVector.
6950 2003-12-09 Martin Baulig <martin@ximian.com>
6952 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6953 Changed return type from `FlowReturns' to `Reachability'.
6955 2003-12-09 Martin Baulig <martin@ximian.com>
6957 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6958 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6959 `Reachable' fields with a single `Reachability' one.
6961 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6963 * class.cs (FindMembers): Remove foreach's.
6976 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6981 This patch does a few things:
6982 1. EmptyStatement is now a singleton, so it is never reallocated.
6983 2. All blah is EmptyStatement constructs have been changed to
6984 blah == EmptyStatement.Value, which is much faster and valid
6985 now that EmptyStatement is a singleton.
6986 3. When resolving a block, rather than allocating a new array for
6987 the non-empty statements, empty statements are replaced with
6988 EmptyStatement.Value
6989 4. Some recursive functions have been made non-recursive.
6990 Mainly the performance impact is from (3), however (1) and (2) are needed for
6991 this to work. (4) does not make a big difference in normal situations, however
6992 it makes the profile look saner.
6997 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6998 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6999 Total memory allocated: 56397 KB
7002 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
7003 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
7004 Total memory allocated: 55666 KB
7006 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7008 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
7009 than the hashtable in a hashtable version
7011 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
7012 we always end up concating a string. This results in a huge perf
7013 loss, because many strings have to be tracked by the GC. In this
7014 patch, we first use a hashtable that works with two keys, so that
7015 the strings do not need to be concat'ed.
7026 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7028 * Makefile: Add a new target `do-time' that does a quick and simple
7029 profile, leaving easy to parse output.
7031 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
7033 * codegen.cs (Init): Create the dynamic assembly with
7034 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
7036 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
7038 * support.cs: Make the PtrHashtable use only one
7039 instance of its comparer.
7041 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
7043 * typemanager.cs: Fix lookup of GetNamespaces.
7045 2003-11-29 Miguel de Icaza <miguel@ximian.com>
7047 * expression.cs: Removed redundant line.
7049 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
7050 ArrayLists, use for loops with bounds.
7052 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
7055 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
7056 arraylists, use for loop with bounds.
7058 The above three changes give us a 0.071 second performance
7059 improvement out of 3.294 seconds down to 3.223. On my machine
7060 the above changes reduced the memory usage by 1,387 KB during
7063 * cs-parser.jay (QualifiedIdentifier): New class used to represent
7064 QualifiedIdentifiers. Before we created a new string through
7065 concatenation, and mostly later on, the result would be
7066 manipulated by DecomposeQI through string manipulation.
7068 This reduced the compiler memory usage for bootstrapping from
7069 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
7070 compile times in 0.05 seconds.
7072 2003-11-28 Dick Porter <dick@ximian.com>
7074 * support.cs: Do string compares with the Invariant culture.
7082 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
7083 the comparison is done with the Invariant culture.
7085 2003-11-27 Miguel de Icaza <miguel@ximian.com>
7087 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
7088 GetEnumerator method.
7090 (ProbeCollectionType): Iterate starting at the most specific type
7091 upwards looking for a GetEnumerator
7093 * expression.cs: Shift count can be up to 31 for int/uint and 63
7096 2003-11-26 Miguel de Icaza <miguel@ximian.com>
7098 * statement.cs (Block.LookupLabel): Also look for the label on the
7099 children blocks. Use a hash table to keep track of visited
7102 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
7103 we actually did transform the other operand, otherwise fall back
7104 to the common codepath that casts to long.
7106 * cs-tokenizer.cs: Use the same code pattern as the int case.
7107 Maybe I should do the parsing myself, and avoid depending on the
7108 Parse routines to get this done.
7110 2003-11-25 Miguel de Icaza <miguel@ximian.com>
7112 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
7113 which fixes bug 51347. This time test it.
7115 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
7116 attributes for example can not tell the difference between these.
7117 The difference was only a syntax feature of the language.
7119 * attribute.cs: Apply attributes to delegates.
7121 * delegate.cs: Call the apply attributes method.
7123 2003-11-24 Miguel de Icaza <miguel@ximian.com>
7125 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
7126 comparing 0 vs Byte.MinValue, not the value
7128 (ImplicitConversionRequired): When reporting a conversion error,
7129 use error 31 to print out the constant error instead of the
7132 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
7133 which fixes bug 51347.
7135 2003-11-22 Miguel de Icaza <miguel@ximian.com>
7137 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
7138 which fixes the -warnaserror command line option.
7140 2003-11-21 Miguel de Icaza <miguel@ximian.com>
7142 * cfold.cs (DoNumericPromotions): During constant folding of
7143 additions on UIntConstant, special case intconstants with
7144 IntConstants like we do on the expression binary operator.
7146 2003-11-12 Miguel de Icaza <miguel@ximian.com>
7148 * convert.cs (ImplicitReferenceConversion): We were missing a case
7149 (System.Enum are not value types or class types, so we need to
7150 classify them separatedly).
7152 * driver.cs: We do not support error 2007.
7154 2003-11-12 Jackson Harper <jackson@ximian.com>
7156 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
7157 system directory. Also use the full file name so users can
7158 libraries names mscorlib-o-tron.dll in a non system dir.
7160 2004-01-04 David Sheldon <dave-mono@earth.li>
7162 * expression.cs: Added matching ")" to error message for CS0077.
7164 2003-12-19 Martin Baulig <martin@ximian.com>
7166 * typemanager.cs (TypeManager.IsEqualGenericType): New public
7167 static method; see documentation in the method.
7168 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
7170 * convert.cs (Convert.ImplicitReferenceConversion,
7171 Convert.ImplicitReferenceConversionExists): Add support for
7172 generic type declarations; see gen-36.cs.
7174 2003-12-19 Martin Baulig <martin@ximian.com>
7176 * pending.cs (Pending.InterfaceMethod): Use
7177 `Type.IsAssignableFrom()' instead of `=='.
7179 2003-12-18 Martin Baulig <martin@ximian.com>
7181 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
7184 * convert.cs (Convert.ImplicitStandardConversionExists): Use
7185 `expr_type.Equals (target_type)' instead of `=='.
7187 2003-12-08 Martin Baulig <martin@ximian.com>
7189 * generics.cs (Constraints.Types): Removed.
7190 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
7192 (Constraints.ResolveTypes): New public method; resolves the
7193 TypeExpr's to Type's.
7194 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
7195 longer takes the constraints.
7196 (TypeParameter.DefineMethod): Likewise.
7197 (TypeParameter.DefineType): New public method. Calls
7198 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
7201 2003-12-08 Martin Baulig <martin@ximian.com>
7203 * convert.cs (Convert.ImplicitConversionStandard): Use
7204 `expr_type.Equals (target_type)' instead of `=='.
7206 2003-12-08 Martin Baulig <martin@ximian.com>
7208 * typemanager.cs (TypeManager.GetReferenceType): Call
7209 `Type.MakeByRefType ()'.
7211 2003-12-08 Martin Baulig <martin@ximian.com>
7213 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
7214 just has some special meaning in some situations. For instance,
7215 it is allowed to use `where' as the name of a variable etc.
7217 2003-12-04 Martin Baulig <martin@ximian.com>
7219 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
7220 `Type.MakeArrayType()' for array types.
7222 2003-11-18 Miguel de Icaza <miguel@ximian.com>
7224 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
7227 (SizeOf.DoResolve): assign the `type_queried' field. This gets
7230 2003-11-16 Martin Baulig <martin@ximian.com>
7232 * codegen.cs (EmitContext.IsGeneric): Removed.
7234 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
7235 ResolveGeneric() on the DeclSpace.
7237 2003-11-16 Martin Baulig <martin@ximian.com>
7239 * generic.cs (TypeArguments.Resolve):
7240 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
7241 `ResolveType()' on it to get the Type.
7243 2003-11-15 Martin Baulig <martin@ximian.com>
7245 * generic.cs (ConstructedType.GetInterfaces): Override this.
7247 2003-11-14 Martin Baulig <martin@ximian.com>
7249 * interface.cs (Interface.DefineType): Define all type parameters
7250 before adding the interfaces we inherit.
7252 2003-11-11 Martin Baulig <martin@ximian.com>
7254 * generic.cs (ConstructedType.ResolveType): Always call
7255 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
7257 2003-11-10 Martin Baulig <martin@ximian.com>
7259 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
7260 (TypeManager.InitCoreTypes): Initialize them here, but instead of
7261 calling `ResolveType()' on them, directly assign their `Type'.
7263 2003-11-08 Martin Baulig <martin@ximian.com>
7265 * generic.cs (ConstructedType): Override `IsClass' etc.
7267 2003-11-08 Martin Baulig <martin@ximian.com>
7269 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
7270 return value and the `out parent' parameter.
7271 (TypeContainer.DefineType): Moved the CS0644 check into
7272 GetClassBases(). Don't pass the interface types to the
7273 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
7274 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
7276 * ecore.cs (TypeExpr.IsAttribute): New property.
7277 (TypeExpr.GetInterfaces): New method.
7279 * interface.cs (Interface.GetInterfaceTypeByName): Return a
7280 TypeExpr instead of a Type.
7281 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
7282 (Interface.DefineType): Don't pass the interface types to the
7283 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
7284 them later and then call `TypeBulider.AddInterfaceImplementation()'.
7286 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
7287 instead of a `Type[]'.
7288 (TypeManager.RegisterBuilder): Likewise.
7289 (TypeManager.AddUserInterface): Likewise.
7290 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
7291 `Type[]' and also return a `TypeExpr[]'.
7292 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
7294 2003-11-08 Martin Baulig <martin@ximian.com>
7296 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
7299 2003-11-08 Martin Baulig <martin@ximian.com>
7301 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
7302 TypeManager.ResolveExpressionTypes().
7304 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
7305 instead of an Expression.
7306 (TypeExpr): This is now an abstract base class for `TypeExpression'.
7307 (TypeExpression): New public class; formerly known as `TypeExpr'.
7309 * expression.cs (ComposedCast): Derive from TypeExpr.
7311 * typemanager.cs (TypeManager.system_*_expr): These are now
7312 TypExpr's instead of Expression's.
7313 (TypeManager.ResolveExpressionTypes): New public static function;
7314 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
7317 2003-11-06 Miguel de Icaza <miguel@ximian.com>
7319 * expression.cs (New.DoResolve): Do not dereference value that
7320 might be a null return.
7322 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
7323 sure that the constant value has the right type. Fixes an
7324 unreported bug, similar to 50425.
7326 * const.cs (Const.LookupConstantValue): Call
7327 ImplicitStandardConversionExists before doing a conversion to
7328 avoid havng the TypeManager.ChangeType do conversions.
7330 Reduced the number of casts used
7332 (Const.ChangeType): New routine to enable reuse of the constant
7333 type changing code from statement.
7335 * typemanager.cs (ChangeType): Move common initialization to
7336 static global variables.
7340 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
7341 every value type to go through, even if it was void. Fix that.
7343 * cs-tokenizer.cs: Use is_identifier_start_character on the start
7344 character of the define, and the is_identifier_part_character for
7345 the rest of the string.
7347 2003-11-05 Miguel de Icaza <miguel@ximian.com>
7349 * expression.cs (UnaryMutator.EmitCode): When I updated
7350 LocalVariableReference.DoResolve, I overdid it, and dropped an
7351 optimization done on local variable references.
7353 2003-11-04 Miguel de Icaza <miguel@ximian.com>
7355 * ecore.cs: Convert the return from Ldlen into an int.
7357 2003-10-20 Miguel de Icaza <miguel@ximian.com>
7359 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
7360 the accessibility, this is a special case for toplevel non-public
7361 classes (internal for instance).
7363 2003-10-20 Nick Drochak <ndrochak@gol.com>
7365 * ecore.cs: Fix typo and build. Needed another right paren.
7367 2003-10-19 Miguel de Icaza <miguel@ximian.com>
7369 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
7370 `internal' case regular and protected, but not allowing protected
7371 to be evaluated later. Bug 49840
7373 2003-10-15 Miguel de Icaza <miguel@ximian.com>
7375 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
7376 to kb.Nlast, and not the kb.nFirst to isolate the switch
7379 Extract the underlying type, so enumerations of long/ulong are
7380 treated like long/ulong.
7382 2003-10-14 Miguel de Icaza <miguel@ximian.com>
7384 * expression.cs (New): Overload the meaning of RequestedType to
7385 track the possible creation of the NewDelegate type, since
7386 DoResolve is invoked more than once for new constructors on field
7389 See bugs: #48800 and #37014
7391 * cs-parser.jay (declare_local_constants): Take an arraylist
7392 instead of a single constant.
7394 (local_constant_declaration): It should take a
7395 constant_declarators, not a constant_declarator. Fixes 49487
7397 * convert.cs: Fix error report.
7399 2003-10-13 Jackson Harper <jackson@ximian.com>
7401 * typemanager.cs (TypeToCoreType): Add float and double this fixes
7404 2003-11-03 Martin Baulig <martin@ximian.com>
7406 * expression.cs (ArrayAccess.GetStoreOpcode): Added
7407 `out bool has_type_arg'; if set, we need to pass the type to
7409 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
7410 Stelem_Any/Ldelem_Any for generic parameters.
7412 2003-11-02 Martin Baulig <martin@ximian.com>
7414 * expression.cs (Invocation.EmitCall): Use
7415 `TypeManager.IsValueType()' to check whether it's a value type.
7416 Don't set `struct_call' when calling a method on a type parameter.
7418 2003-11-02 Martin Baulig <martin@ximian.com>
7420 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
7421 and removed the TypeBuilder argument.
7423 * typemanager.cs (TypeManager.IsValueType): Return
7424 `t.IsGenericParameter || t.IsValueType'.
7426 2003-10-25 Martin Baulig <martin@ximian.com>
7428 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
7429 call ConstructedType.Resolve() on it.
7431 * generic.cs (ConstructedType.Resolve): Set `type' on success.
7433 2003-10-25 Martin Baulig <martin@ximian.com>
7435 * class.cs (TypeContainer.GetClassBases): Changed
7436 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
7437 CS8214 reporting here.
7438 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
7439 instead of a `Type' for our parent. In case of a recursive
7440 declaration (see tests/gen-23.cs for an example), our parent is a
7441 ConstructedType and it doesn't have its type set. So, first
7442 create our own TypeBuilder, then call constructed.Resolve() to get
7443 the parent's type and finally TypeBuilder.SetParent() it.
7445 * ecore.cs (TypeExpr.Name): New public virtual property.
7448 (ConstructedType): We're now a TypeExpr and not just an Expression.
7449 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
7450 arguments here; this is done later.
7451 (ConstructedType.Resolve): New public method to resolve the type
7452 arguments and bind them.
7454 2003-10-21 Martin Baulig <martin@ximian.com>
7456 * convert.cs: Use `TypeManager.IsValueType' instead of
7457 'type.IsValueType' everywhere.
7459 * typemanager.cs (TypeManager.IsValueType): Return true for type
7460 parameters. The reason for this is that we need to box a type
7461 parameter when converting it to a reference type.
7463 * cs-parser.jay: Added support for default value expressions.
7465 * generics.cs (DefaultValueExpression): New public class.
7467 2003-10-17 Martin Baulig <martin@ximian.com>
7469 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
7470 TypeContainer so we can also use this for Interfaces.
7471 (TypeParameter.Resolve): Likewise.
7473 * interface.cs (Interface.DefineType): Added support for generic
7476 * cs-parser.jay: Added support for generic structs and interfaces.
7478 2003-10-17 Martin Baulig <martin@ximian.com>
7480 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
7481 call generic methods :-)
7483 2003-10-16 Martin Baulig <martin@ximian.com>
7485 * cs-parser.jay (namespace_or_type_name): Only create a
7486 GenericMemberAccess if we actually have type arguments.
7488 2003-10-13 Martin Baulig <martin@ximian.com>
7490 * class.cs (Method.Define): If we're a generic method, call
7491 TypeBuilder.DefineGenericMethod () before resolving
7493 (MethodData): Added .ctor which takes an additional MethodBuilder
7494 argument; this is used for generic methods.
7495 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
7496 we already have a MethodBuilder.
7498 2003-10-10 Martin Baulig <martin@ximian.com>
7500 * class.cs (Method): Added .ctor which takes a `GenericMethod'
7501 instead of a `DeclSpace'. This is used for generic methods.
7503 * cs-parser.jay (method_header): Added support for generic
7504 methods; create a `GenericMethod' instance and pass it to the
7505 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
7506 parameters and locals.
7508 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
7509 since we already have the location. Check whether we're a generic
7510 type declaration or a generic method and create the correct type
7513 * generic.cs (TypeParameter.DefineMethod): New public method.
7514 (GenericMethod): New public class; derives from DeclSpace and is
7515 used for generic methods.
7517 2003-10-09 Martin Baulig <martin@ximian.com>
7519 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
7521 (MethodCore.DoDefineParameters): Removed the TypeContainer
7522 argument; use the DeclSpace which was passed to the .ctor instead.
7523 (MethodCore.CheckParameter): Take a DeclSpace instead of a
7524 TypeContainer; we only need a DeclSpace here.
7526 2003-10-09 Martin Baulig <martin@ximian.com>
7528 * class.cs (MethodData): Added additional `DeclSpace ds' argument
7530 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
7531 EmitContext's .ctor.
7533 2003-10-09 Martin Baulig <martin@ximian.com>
7535 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
7536 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
7537 AsAccessible(), moved them as well.
7539 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
7541 2003-10-07 Miguel de Icaza <miguel@ximian.com>
7543 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
7544 generation for >=, as spotted by Paolo, bug 48679.
7545 Patch from David Waite.
7547 * cs-tokenizer.cs: Add handling for #pragma.
7549 * cs-parser.jay: Allow for both yield and yield return in the
7550 syntax. The anti-cobolization of C# fight will go on!
7552 * class.cs (TypeBuilder.DefineType): Catch error condition here
7553 (Parent.DefineType erroring out and returning null).
7555 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7556 coping with enumerations variables, we were mistakenly processing
7557 them as a regular value type instead of built-in types. Fixes the
7560 * typemanager.cs (IsBuiltinOrEnum): New method.
7562 2003-09-30 Miguel de Icaza <miguel@ximian.com>
7564 * cs-parser.jay: Upgrade: yield now needs the return clause.
7566 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7568 * cs-parser.jay : Renamed yyName to yyNames related to jay.
7570 2003-09-29 Martin Baulig <martin@ximian.com>
7572 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
7573 inflated generic methods.
7575 * generics.cs (ConstructedType): Distinguish between open and
7576 closed constructed types; correctly resolve the arguments.
7578 2003-09-22 Martin Baulig <martin@ximian.com>
7580 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
7581 all type arguments meet their constraints.
7583 2003-09-19 Martin Baulig <martin@ximian.com>
7585 * decl.cs (MemberCache.SetupCacheForInterface): Take a
7586 `MemberCache parent' argument. Normally, an interface doesn't
7587 have a parent type except System.Object, but we use this in gmcs
7588 for generic type parameters.
7590 2003-09-18 Martin Baulig <martin@ximian.com>
7592 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
7593 on `type.IsInterface'; don't check whether the type has a parent
7594 to determine whether it's an interface.
7596 2003-09-17 Martin Baulig <martin@ximian.com>
7598 * generic.cs (ConstructedType.ToString): Always use `name' as the
7601 2003-09-15 Martin Baulig <martin@ximian.com>
7603 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
7605 * generic.cs (Constraints.Resolve): New public method; this is
7606 called to resolve the constraint types and to check whether all
7607 the constraints are correct.
7608 (Constraints.Types): New public property.
7609 (TypeParameter.Resolve): New public method; resolves all the
7612 * class.cs (TypeContainer.DefineType): Call
7613 TypeParameter.Resolve() before actually defining the type.
7615 2003-09-15 Martin Baulig <martin@ximian.com>
7617 * class.cs (TypeContainer.DefineType): Added an error flag to
7618 avoid reporting duplicate CS0146's ("class definition is
7621 * driver.cs (Driver.MainDriver): Abort if
7622 RootContext.ResolveTree() reported any errors.
7624 2003-09-07 Martin Baulig <martin@ximian.com>
7626 * report.cs (Error, Warning): Added overloaded versions which take
7627 a `params object[] args' and call String.Format().
7629 2003-09-07 Martin Baulig <martin@ximian.com>
7631 * decl.cs (DeclSpace..ctor): Don't call
7632 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7633 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7634 (DeclSpace.RecordDecl): New method.
7636 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7638 2003-09-02 Ravi Pratap <ravi@ximian.com>
7640 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7641 value attributes to be applied to ParameterBuilders.
7643 * class.cs (MethodCore.LabelParameters): Make static and more
7644 generic so that it can be used from other places - like interface
7645 methods, for instance.
7647 * interface.cs (Interface.Emit): Call LabelParameters before
7648 emitting attributes on the InterfaceMethod.
7650 2003-09-07 Martin Baulig <martin@ximian.com>
7652 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7653 if the number of type parameters doesn't match.
7655 2003-09-04 Martin Baulig <martin@ximian.com>
7657 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7658 for arrays of generic type params (ie. `!0[]').
7660 2003-09-04 Martin Baulig <martin@ximian.com>
7662 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7665 2003-09-04 Martin Baulig <martin@ximian.com>
7667 * decl.cs (DeclSpace.LookupGeneric): New method.
7668 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7671 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7672 argument, not just a string.
7673 (TypeParameter.Define): New public method; this is called to
7674 actually define the generic parameter; after this, you can use the
7675 new `Type' property to get the type.
7677 2003-09-04 Martin Baulig <martin@ximian.com>
7679 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7680 is now an ArrayList; initialize the result of the `TypeParameters'
7682 (DeclSpace.GetGenericData): Removed.
7683 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7684 implement this in a different way.
7685 (DeclSpace.GetTypeParameters): Removed; there's now a
7686 `TypeParameters' property.
7687 (DeclSpace.TypeParameters): New public property.
7689 * generic.cs (Constraints): Make this class public.
7690 (TypeParameter): New public class.
7692 2003-09-04 Martin Baulig <martin@ximian.com>
7694 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7697 * class.cs (TypeContainer.DefineType): Call
7698 TypeBuilder.DefineGenericParameter () on all generic parameters if
7699 this is a generic type.
7701 2003-08-28 Martin Baulig <martin@ximian.com>
7703 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7706 * sample-hello.cs: Compile this with gmcs: "gmcs
7707 /r:sample-stack.dll sample-hello.cs".
7709 2003-08-28 Martin Baulig <martin@ximian.com>
7711 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7712 the parameters to the generic type.
7714 2003-08-28 Martin Baulig <martin@ximian.com>
7716 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7718 2003-08-28 Martin Baulig <martin@ximian.com>
7720 * cs-parser.jay (opt_type_argument_list): Use
7721 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7722 (primary_expression): Replace `qualified_identifier' with `type_name'.
7723 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7725 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7726 parser to check whether it is syntactically a type parameter list;
7727 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7730 2003-08-26 Martin Baulig <martin@ximian.com>
7732 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7733 resolving aliases; fixes #47927.
7735 2003-08-26 Martin Baulig <martin@ximian.com>
7737 * statement.cs (Using.DoResolve): This is internally emitting a
7738 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7739 do not always return. Fixes #47681.
7741 2003-08-26 Martin Baulig <martin@ximian.com>
7743 * decl.cs (MemberCore): Moved WarningNotHiding(),
7744 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7746 (AdditionResult): Make this nested in DeclSpace.
7747 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7748 argument; call NamespaceEntry.Define() unless we're nested in a
7751 * namespace.cs (Namespace.DefineName): New public function. This
7752 is called from DeclSpace's .ctor to add
7753 (Namespace.Lookup): Include DeclSpaces in the lookup.
7755 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7757 * const.cs (Const): Derive from MemberBase, not MemberCore.
7759 2003-08-25 Martin Baulig <martin@ximian.com>
7761 * convert.cs (Convert.ExplicitReferenceConversion): When
7762 converting from an interface type to a class, unbox if the target
7763 type is a struct type. Fixes #47822.
7765 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7767 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7770 2003-08-22 Martin Baulig <martin@ximian.com>
7772 * class.cs (TypeManager.DefineType): When defining a nested type,
7773 call DefineType() on our parent; fixes #47801.
7775 2003-08-22 Martin Baulig <martin@ximian.com>
7777 * class.cs (MethodData.Define): While checking if a method is an
7778 interface implementation, improve the test a bit more to fix #47654.
7780 2003-08-22 Martin Baulig <martin@ximian.com>
7782 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7783 correctly; fixes #47722.
7785 2003-08-22 Martin Baulig <martin@ximian.com>
7787 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7788 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7790 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7792 2003-08-22 Martin Baulig <martin@ximian.com>
7794 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7795 can only be assigned in static constructors. Fixes #47161.
7797 2003-08-22 Martin Baulig <martin@ximian.com>
7799 Rewrote and improved the flow analysis code.
7801 * flowbranching.cs (FlowBranching): Make this class abstract.
7802 (FlowBranching.CreateBranching): New static function to create a
7804 (FlowBranchingBlock, FlowBranchingException): New classes.
7805 (FlowBranching.UsageVector.Type): New public readonly field.
7806 (FlowBranching.UsageVector.Breaks): Removed the setter.
7807 (FlowBranching.UsageVector.Returns): Removed the setter.
7808 (FlowBranching.UsageVector): Added Break(), Return(),
7809 NeverReachable() and Throw() methods to modify the reachability.
7810 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7811 done by FlowBranching.Merge().
7812 (FlowBranching.UsageVector.MergeChild): New method; merges the
7813 merge result into the current vector.
7814 (FlowBranching.Merge): New abstract method to merge a branching.
7816 2003-08-12 Martin Baulig <martin@ximian.com>
7818 * expression.cs (Indirection.CacheTemporaries): Create the
7819 LocalTemporary with the pointer type, not its element type.
7821 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7823 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7824 token was a keyword or not.
7826 Add `error' options where an IDENTIFIER was expected; Provide
7827 CheckToken and CheckIdentifierToken convenience error reporting
7830 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7832 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7833 NameSpaceEntry NameSpaceEntry.
7835 (LookupInterfaceOrClass): Avoid creating a full qualified name
7836 from namespace and name: avoid doing lookups when we know the
7837 namespace is non-existant. Use new Tree.LookupByNamespace which
7838 looks up DeclSpaces based on their namespace, name pair.
7840 * driver.cs: Provide a new `parser verbose' to display the
7841 exception thrown during parsing. This is turned off by default
7842 now, so the output of a failure from mcs is more graceful.
7844 * namespace.cs: Track all the namespaces defined in a hashtable
7847 (IsNamespace): New method
7849 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7851 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7852 we know that we need to concatenate (full typename can never be
7857 * statement.cs: Use a bitfield; Do not initialize to null things
7858 which are done by the constructor by default.
7860 * cs-parser.jay: bug fix, parameter was 4, not 3.
7862 * expression.cs: Just use the property;
7864 * statement.cs: No need for GetVariableInfo method.
7866 2003-08-08 Martin Baulig <martin@ximian.com>
7868 * flowanalysis.cs (FlowReturns): This is now nested in the
7869 `FlowBranching' class.
7870 (MyBitVector): Moved this here from statement.cs.
7871 (FlowBranching.SiblingType): New enum type.
7872 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7874 2003-08-07 Martin Baulig <martin@ximian.com>
7876 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7877 `FlowBranching' class and called `BranchingType'.
7879 2003-08-07 Martin Baulig <martin@ximian.com>
7881 * flowanalysis.cs: Moved all the control flow analysis code into
7884 2003-08-07 Martin Baulig <martin@ximian.com>
7886 * assign.cs (Assign.DoResolve): `target' must either be an
7887 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7890 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7892 * expression.cs (BinaryMethod): This kind of expression is created by the
7893 Binary class if it determines that the operator has to be handled
7896 (BinaryDelegate): This kind of expression is created if we are
7897 dealing with a + or - operator on delegates.
7899 (Binary): remove method, argumetns, and DelegateOperator: when
7900 dealing with methods,
7902 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7904 * statement.cs (Block): use bitfields for the three extra booleans
7905 we had in use. Remove unused topblock parameter.
7907 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7909 * assign.cs: Drop extra unneeded tests.
7911 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7913 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7915 * statement.cs (Foreach): Use VariableStorage instead of
7918 * codegen.cs (VariableStorage): New class used by clients that
7919 require a variable stored: locals or fields for variables that
7920 need to live across yield.
7922 Maybe provide a convenience api for EmitThis+EmitLoad?
7924 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7927 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7929 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7930 RemapParameterLValue): New methods that are used to turn a
7931 precomputed FieldInfo into an expression like this:
7935 The idea is to use this instead of making LocalVariableReference
7936 have more than one meaning.
7938 * cs-parser.jay: Add error production to BASE.
7940 * ecore.cs: Deal with TypeManager.GetField returning null, which
7941 is now a valid return value.
7943 (FieldExprNoAddress): New expression for Fields whose address can
7946 * expression.cs (LocalVariableReference): During the resolve
7947 phases, create new expressions if we are in a remapping context.
7948 Remove code that dealt with remapping here.
7950 (ParameterReference): same.
7952 (ProxyInstance): New expression, like the `This' expression, but
7953 it is born fully resolved. We know what we are doing, so remove
7954 the errors that are targeted to user-provided uses of `this'.
7956 * statement.cs (Foreach): our variable is now stored as an
7957 Expression; During resolution, follow the protocol, dont just
7958 assume it will return this.
7960 2003-08-06 Martin Baulig <martin@ximian.com>
7962 * support.cs (SeekableStreamReader.cs): New public class.
7964 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7965 SeekableStreamReader instead of the normal StreamReader.
7967 2003-08-04 Martin Baulig <martin@ximian.com>
7969 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7970 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7971 deambiguate casts and delegate invocations.
7972 (parenthesized_expression): Use the new tokens to ensure this is
7973 not a cast of method invocation.
7975 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7976 when reading a `)' and Deambiguate_CloseParens () was previously
7979 * expression.cs (ParenthesizedExpression): New class. This is
7980 just used for the CS0075 test.
7981 (Binary.DoResolve): Check for CS0075.
7983 2003-07-29 Ravi Pratap <ravi@ximian.com>
7985 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7986 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7987 reference comparison.
7989 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7990 examine the ReturnType for equality - this is necessary in the
7991 cases of implicit and explicit operators whose signature also
7992 includes the return type.
7994 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7996 * namespace.cs: Cache the result of the namespace computation,
7997 instead of computing it every time.
7999 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8001 * decl.cs: Use a global arraylist that we reuse over invocations
8002 to avoid excesive memory consumption. Reduces memory usage on an
8003 mcs compile by one meg (45 average).
8005 * typemanager.cs (LookupTypeReflection): In .NET pointers are
8006 private, work around that.
8008 2003-07-23 Miguel de Icaza <miguel@ximian.com>
8010 * literal.cs (IntLiteral): Define Zero and One static literals.
8012 * cs-parser.jay (integer_literal): use static literals to reduce
8013 memory usage for the most used literals (0, 1 and -1). 211kb
8014 reduced in memory usage.
8016 Replace all calls to `new ArrayList' with `new
8017 ArrayList(4)' which is a good average number for most allocations,
8018 and also requires only 16 bytes of memory for its buffer by
8021 This reduced MCS memory usage in seven megabytes for the RSS after
8024 2003-07-28 Ravi Pratap <ravi@ximian.com>
8026 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
8027 handle params methods the correct way by forming only one
8028 applicable set with params and normal methods in them. Earlier we
8029 were looking at params methods only if we found no normal methods
8030 which was not the correct thing to do.
8032 (Invocation.BetterFunction): Take separate arguments indicating
8033 when candidate and the best method are params methods in their
8036 This fixes bugs #43367 and #46199.
8038 * attribute.cs: Documentation updates.
8040 (CheckAttribute): Rename to CheckAttributeTarget.
8041 (GetValidPlaces): Rename to GetValidTargets.
8043 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
8044 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
8048 2003-07-28 Miguel de Icaza <miguel@ximian.com>
8050 * codegen.cs: Compute IsGeneric correctly.
8052 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
8055 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
8056 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
8057 regressions, and I was chasing more bugs than I required.
8059 * interface.cs: Use expressions for base type names (like classes
8060 and structs have been doing for a while now), and resolve that.
8061 This patch should probably go into head as well.
8063 This makes it one less user of FindType.
8065 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8067 This compiler can not self host currently. Need to fix that.
8069 * Makefile: compile to `gmcs.exe'
8071 * driver.cs: Turn on v2 by default on gmcs.
8073 * generic.cs (ConstructedType): Does no longer take a container
8074 type argument; That will be taken care of later.
8076 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
8077 Use SimpleName to resolve for now, so we can continue the work on
8078 the parser, until we get Type.GetType that understands generics.
8080 (ConstructedType.ToString): Implement
8082 (TypeArguments.Resolve): Resolve the child expressions as types.
8084 * cs-parser.jay: Rename interface_constraints to
8085 type_parameter_constraints
8087 (namespace_or_type_name): Only use constructed types for the basic
8088 construction, we will deal with identifier<...> later.
8090 (type/type_name): No longer call DecomposeQI, as
8091 namespace_or_type_name is always decoded now.
8093 2003-07-22 Ravi Pratap <ravi@ximian.com>
8095 * expression.cs (Invocation.OverloadResolve): Follow the spec more
8096 closely: we eliminate methods in base types when we have an
8097 applicable method in a top-level type.
8099 Please see section 14.5.5.1 for an exact description of what goes
8102 This fixes bug #45127 and a host of other related to corlib compilation.
8104 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
8105 array is the method corresponding to the top-level type (this is
8106 because of the changes made to icall.c) so we change this
8109 (MethodGroupExpr.Name): This too.
8111 * typemanager.cs (GetElementType): New method which does the right
8112 thing when compiling corlib.
8114 * everywhere: Make use of the above in the relevant places.
8116 2003-07-22 Martin Baulig <martin@ximian.com>
8118 * cs-parser.jay (invocation_expression): Moved
8119 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
8120 `cast_expression', but create a InvocationOrCast which later
8121 resolves to either an Invocation or a Cast.
8123 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
8124 method; call this before EmitStatement() to make sure that this
8125 expression can be used as a statement.
8127 * expression.cs (InvocationOrCast): New class; resolves to either
8128 an Invocation or a Cast.
8130 * statement.cs (StatementExpression): Call ResolveStatement() on
8131 the ExpressionStatement before emitting it.
8133 2003-07-21 Martin Baulig <martin@ximian.com>
8135 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
8136 `ref' and `out' attributes match; fixes #46220.
8137 (MemberAccess.ResolveMemberAccess): You can't reference a type
8138 through an expression; fixes #33180.
8139 (Indexers.GetIndexersForType): Don't return the indexers from
8140 interfaces the class implements; fixes #46502.
8142 2003-07-21 Martin Baulig <martin@ximian.com>
8144 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
8145 CS0661 checks; fixes bug #30442.
8147 2003-07-21 Martin Baulig <martin@ximian.com>
8149 * decl.cs (AdditionResult): Added `Error'.
8151 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
8153 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
8154 cs0031.cs actually work.
8156 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8158 * cs-parser.jay (namespace_name): do not use
8159 namespace_or_type_name, use qualified_identifier, because
8160 namespace_or_type_name will soon return a composed expression
8161 instead of a string.
8163 (namespace_or_type_name): Instead of returning a string, now this
8164 production returns an expression.
8166 * codegen.cs (EmitContext): Setup IsGeneric property based on
8167 whether our DeclSpace is generic, our the method is generic.
8169 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
8170 the method is generic.
8172 * cs-parser.jay (type_arguments, opt_type_argument_list,
8173 type_parameters, type_parameter_list, opt_type_parameter_list,
8174 type_parameter,, opt_type_parameter_constraints_clauses,
8175 type_parameter_constraints_clauses,
8176 type_parameter_constraint_clause, type_parameter_constraint,
8177 interface_constraints): Add new production
8179 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
8180 DeclSpace is generic or not.
8182 (DeclSpace.SetParameterInfo): New routine, used to set the
8183 parameter info for a type.
8185 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
8186 returns a GenericTypeExpr
8188 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
8189 generic, lookup the generic argument.
8191 * attribute.cs: Do not allow TypeParameterExpressions in
8194 * class.cs: Do not allow the Main method to be defined in a
8197 * expression.cs (SizeOf): Do not allow generic types to be used as
8198 arguments to sizeof.
8200 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
8201 it: whether a type is generic or not. Only works for types we are
8202 currently building for now.
8204 2003-07-20 Martin Baulig <martin@ximian.com>
8206 * namespace.cs: Fixed that bug which caused a crash when compiling
8209 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8211 * typemanager.cs (LookupTypeReflection): Never expose types which
8212 are NotPublic, NestedPrivate, NestedAssembly, or
8213 NestedFamANDAssem. We used to return these, and later do a check
8214 that would report a meaningful error, but the problem is that we
8215 would not get the real match, if there was a name override.
8217 2003-07-18 Miguel de Icaza <miguel@ximian.com>
8219 * namespace.cs (Namespace, Name): Do not compute the namespace
8220 name dynamically, compute it in the constructor. This reduced
8221 memory usage by 1697 KB.
8223 * driver.cs: Use --pause to pause at the end.
8225 2003-07-17 Peter Williams <peter@newton.cx>
8227 * Makefile: Change the name of the test target so that it doesn't
8228 conflict with the recursive test target.
8230 2003-07-17 Miguel de Icaza <miguel@ximian.com>
8232 * expression.cs (LocalVariableReference.Emit, EmitAssign,
8233 AddressOf): Do not use EmitThis, that was wrong, use the actual
8236 2003-07-15 Miguel de Icaza <miguel@ximian.com>
8238 * class.cs (MethodData.Define): While checking if a method is an
8239 interface implementation, improve the test: If we are not public
8240 (use new test here: use the computed MethodAttributes directly,
8241 instead of the parsed modifier flags) check if the `implementing'
8242 method comes from an interface or not.
8244 * pending.cs (VerifyPendingMethods): Slightly better error
8247 * makefile: add test target that does the mcs bootstrap.
8249 2003-07-16 Ravi Pratap <ravi@ximian.com>
8251 * interface.cs (Define): Do nothing here since there are no
8252 members to populate etc. Move the attribute emission out of here
8253 since this was just totally the wrong place to put it. Attribute
8254 application happens during the 'Emit' phase, not in the 'Define'
8257 (Emit): Add this method and move the attribute emission here
8259 * rootcontext.cs (EmitCode): Call the Emit method on interface
8262 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8264 * expression.cs (OverloadResolve): Report error only if Location
8265 is not 'Null' which means that there was a probe going on.
8267 2003-07-14 Martin Baulig <martin@ximian.com>
8269 * expression.cs (ConditionalLogicalOperator): New public class to
8270 implement user defined conditional logical operators.
8271 This is section 14.11.2 in the spec and bug #40505.
8273 2003-07-14 Martin Baulig <martin@ximian.com>
8275 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
8277 2003-07-14 Martin Baulig <martin@ximian.com>
8279 * codegen.cs (EmitContext.InFixedInitializer): New public field.
8281 * ecore.cs (IVariable.VerifyFixed): New interface method.
8283 * expression.cs (Unary.ResolveOperator): When resolving the `&'
8284 operator, check whether the variable is actually fixed. Fixes bug
8285 #36055. Set a variable definitely assigned when taking its
8286 address as required by the spec.
8288 * statement.cs (LocalInfo.IsFixed): New field.
8289 (LocalInfo.MakePinned): Set `IsFixed' to true.
8291 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8293 * attribute.cs (Attribute.Resolve): While doing a Member lookup
8294 for .ctors, ensure that we only ask for members declared in the
8295 attribute type (BindingFlags.DeclaredOnly).
8299 * expression.cs (Error_WrongNumArguments): Report error 1501
8300 correctly the way CSC does.
8302 2003-07-13 Martin Baulig <martin@ximian.com>
8304 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
8305 lookup on the fully qualified name, to make things like "X.X" work
8306 where "X.X" is a fully qualified type name, but we also have a
8307 namespace "X" in the using list. Fixes #41975.
8309 2003-07-13 Martin Baulig <martin@ximian.com>
8311 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
8312 function. If we're a CompoundAssign, we need to create an embedded
8313 CompoundAssign, not an embedded Assign.
8314 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
8317 2003-07-13 Martin Baulig <martin@ximian.com>
8319 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
8320 work to fix bug #46088.
8322 2003-07-13 Ravi Pratap <ravi@ximian.com>
8324 * class.cs (Operator.Emit): Do not emit attributes here - it is
8325 taken care of by the Method class that we delegate too. This takes
8328 2003-07-10 Martin Baulig <martin@ximian.com>
8330 * expression.cs (TypeOfVoid): New class.
8331 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
8333 2003-07-10 Martin Baulig <martin@ximian.com>
8335 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
8338 2003-07-10 Martin Baulig <martin@ximian.com>
8340 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
8341 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
8343 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
8345 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
8347 2003-07-10 Martin Baulig <martin@ximian.com>
8349 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
8350 of decimal. Fixes #42850.
8352 NOTE: I also fixed the created byte blob, but this doesn't work on
8353 the MS runtime and csc never produces any byte blobs for decimal
8356 2003-07-10 Martin Baulig <martin@ximian.com>
8358 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
8359 structs; fixes #32068.
8360 (Block.AddChildVariableNames): Fixed #44302.
8362 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8364 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
8366 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8368 * attribute.cs: And this test is onger needed.
8370 2003-07-08 Martin Baulig <martin@ximian.com>
8372 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
8373 inaccessible types. Fixes #36313.
8375 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
8377 * namespace.cs (NamespaceEntry): Create implicit entries for all
8378 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
8379 implicit entries for N1.N2 and N1.
8381 2003-07-08 Martin Baulig <martin@ximian.com>
8383 Rewrote the handling of namespaces to fix a lot of the issues
8384 wrt. `using' aliases etc.
8386 * namespace.cs (Namespace): Splitted this class into a
8387 per-assembly `Namespace' and a per-file `NamespaceEntry'.
8389 * typemanager.cs (TypeManager.IsNamespace): Removed.
8390 (TypeManager.ComputeNamespaces): Only compute namespaces from
8391 loaded assemblies here, not the namespaces from the assembly we're
8392 currently compiling.
8394 2003-07-08 Martin Baulig <martin@ximian.com>
8396 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
8398 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8400 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
8403 I thought about the memory savings here, but LookupTypeReflection
8404 is used under already very constrained scenarios. Compiling
8405 corlib or mcs only exposes one hit, so it would not really reduce
8406 any memory consumption.
8408 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8410 * typemanager.cs: fixes bug #45889 by only adding public types from
8411 other assemblies to the list of known types.
8413 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8415 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
8416 on the type we resolved.
8418 2003-07-05 Martin Baulig <martin@ximian.com>
8420 * pending.cs (PendingImplementation.ParentImplements): Don't
8421 create the proxy if the parent is abstract.
8423 * class.cs (TypeContainer.DefineIndexers): Process explicit
8424 interface implementations first. Fixes #37714.
8426 2003-07-04 Miguel de Icaza <miguel@ximian.com>
8428 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
8429 defined recursively; but since we modify the input parameters
8430 (left is set to `this' temporarily), we reset this value if the
8431 left_is_explicit is false, which gives the original semantics to
8434 * literal.cs (NullPointer): new class used to represent a null
8435 literal in a pointer context.
8437 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
8438 type is a pointer, use a NullPointer object instead of a
8439 NullLiteral. Closes 43687
8441 (ExplicitConversion): Convert pointer values using
8442 the conv opcode to the proper type.
8444 * ecore.cs (New): change ValueTypeVariable property into a method,
8445 that returns whether the valuetype is suitable for being used.
8447 * expression.cs (Binary.DoNumericPromotions): Only return if we
8448 the int constant was a valid uint, and we can return both left and
8449 right as uints. If not, we continue processing, to trigger the
8450 type conversion. This fixes 39018.
8452 * statement.cs (Block.EmitMeta): During constant resolution, set
8453 the CurrentBlock property on the emitcontext, so that we resolve
8454 constants propertly.
8456 2003-07-02 Martin Baulig <martin@ximian.com>
8458 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
8459 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
8461 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
8462 than emitting it here.
8464 * statement.cs: Fixed some more flow analysis bugs.
8466 2003-07-02 Martin Baulig <martin@ximian.com>
8468 * class.cs (MethodData.Define): When implementing interface
8469 methods, set Final unless we're Virtual.
8471 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
8472 check work for interface methods.
8474 2003-07-01 Martin Baulig <martin@ximian.com>
8476 * ecore.cs (EmitContext.This): Replaced this property with a
8477 GetThis() method which takes a Location argument. This ensures
8478 that we get the correct error location for a CS0188.
8480 2003-07-01 Miguel de Icaza <miguel@ximian.com>
8482 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
8483 ImplicitStandardConversion.
8485 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
8487 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
8489 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
8492 2003-06-30 Miguel de Icaza <miguel@ximian.com>
8494 * class.cs (Constructor.Define): Turn off initlocals for unsafe
8497 (MethodData.Define): Turn off initlocals for unsafe methods.
8499 2003-06-29 Miguel de Icaza <miguel@ximian.com>
8501 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
8502 complete; Fixes #37521.
8504 * delegate.cs: Use Modifiers.TypeAttr to compute the
8505 TypeAttributes, instead of rolling our own. This makes the flags
8506 correct for the delegates.
8508 2003-06-28 Miguel de Icaza <miguel@ximian.com>
8510 * class.cs (Constructor.Define): Set the private flag for static
8511 constructors as well.
8513 * cs-parser.jay (statement_expression): Set the return value to
8514 null, to avoid a crash when we catch an error.
8516 2003-06-24 Miguel de Icaza <miguel@ximian.com>
8518 * cs-parser.jay: Applied patch from Jackson that adds support for
8519 extern and unsafe modifiers to destructor declarations.
8521 * expression.cs: Report error 21 if the user is trying to index a
8524 * driver.cs: Add an error message, suggested by the bug report.
8526 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
8527 if we do not have a ": this ()" constructor initializer. Fixes 45149
8529 2003-06-14 Miguel de Icaza <miguel@ximian.com>
8531 * namespace.cs: Add some information to reduce FAQs.
8533 2003-06-13 Miguel de Icaza <miguel@ximian.com>
8535 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
8536 underlying enumeration types. Fixes #43915.
8538 * expression.cs: Treat ushort/short as legal values to be used in
8541 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
8543 * delegate.cs: transfer custom attributes for paramenters from
8544 the delegate declaration to Invoke and BeginInvoke.
8546 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
8548 * attribute.cs: handle custom marshalers and emit marshal info
8551 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
8553 * makefile.gnu: Added anonymous.cs to the compiler sources.
8555 2003-05-28 Miguel de Icaza <miguel@ximian.com>
8557 * iterators.cs: Change the name of the proxy class to include two
8560 * cs-parser.jay: Update grammar to include anonymous methods.
8562 * anonymous.cs: new file.
8564 2003-05-27 Miguel de Icaza <miguel@ximian.com>
8566 * class.cs (Field.Define): Add missing test for pointers and
8569 2003-05-27 Ravi Pratap <ravi@ximian.com>
8571 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
8572 we use the stobj opcode.
8574 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
8575 since it wasn't the correct fix.
8577 It still is puzzling that we are required to use stobj for IntPtr
8578 which seems to be a ValueType.
8580 2003-05-26 Miguel de Icaza <miguel@ximian.com>
8582 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
8583 during regular simple name resolution. Now, the trick is that
8584 instead of returning for processing the simplename, we do a
8585 TypeManager.LookupType (ie, a rooted lookup as opposed to a
8586 contextual lookup type). If a match is found, return that, if
8587 not, return for further composition.
8589 This fixes long-standing 30485.
8591 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8592 using the address to initialize an object, do an Stobj instead of
8593 using the regular Stelem.
8595 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
8596 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
8597 Because if we are a BaseIndexerAccess that value will be true.
8600 * statement.cs (GotoCase.Resolve): Return after reporting an
8601 error, do not attempt to continue.
8603 * expression.cs (PointerArithmetic.Emit): If our operand is a
8604 long, convert our constants to match the operand before
8605 multiplying. Convert to I type before adding. Fixes 43670.
8607 2003-05-14 Ravi Pratap <ravi@ximian.com>
8609 * enum.cs (ImplicitConversionExists) : Rename to
8610 ImplicitEnumConversionExists to remove ambiguity.
8612 * ecore.cs (NullCast): New type of cast expression class which
8613 basically is very similar to EmptyCast with the difference being
8614 it still is a constant since it is used only to cast a null to
8618 * convert.cs (ImplicitReferenceConversion): When casting a null
8619 literal, we return a NullCast.
8621 * literal.cs (NullLiteralTyped): Remove - I don't see why this
8622 should be around anymore.
8624 The renaming (reported was slightly wrong). Corrections:
8626 ConvertImplicitStandard -> ImplicitConversionStandard
8627 ConvertExplicitStandard -> ExplicitConversionStandard
8629 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8630 before passing them in !
8632 * convert.cs (ImplicitConversionStandard): When comparing for
8633 equal expr and target types, ensure that expr is not a
8636 In general, we must not be checking (expr_type ==
8637 target_type) in the top level conversion methods
8638 (ImplicitConversion, ExplicitConversion etc). This checking is
8639 done in the methods that they delegate to.
8641 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8643 * convert.cs: Move Error_CannotConvertType,
8644 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8645 ImplicitNumericConversion, ImplicitConversionExists,
8646 ImplicitUserConversionExists, StandardConversionExists,
8647 FindMostEncompassedType, FindMostSpecificSource,
8648 FindMostSpecificTarget, ImplicitUserConversion,
8649 ExplicitUserConversion, GetConversionOperators,
8650 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8651 TryImplicitIntConversion, Error_CannotConvertImplicit,
8652 ConvertImplicitRequired, ConvertNumericExplicit,
8653 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8654 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8657 Perform the following renames:
8659 StandardConversionExists -> ImplicitStandardConversionExists
8660 ConvertImplicit -> ImplicitConversion
8661 ConvertImplicitStandard -> ImplicitStandardConversion
8662 TryImplicitIntConversion -> ImplicitIntConversion
8663 ConvertImplicitRequired -> ImplicitConversionRequired
8664 ConvertNumericExplicit -> ExplicitNumericConversion
8665 ConvertReferenceExplicit -> ExplicitReferenceConversion
8666 ConvertExplicit -> ExplicitConversion
8667 ConvertExplicitStandard -> ExplicitStandardConversion
8669 2003-05-19 Martin Baulig <martin@ximian.com>
8671 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8672 (TypeInfo): Added support for structs having structs as fields.
8674 * ecore.cs (FieldExpr): Implement IVariable.
8675 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8676 VariableInfo for the field.
8678 2003-05-18 Martin Baulig <martin@ximian.com>
8680 * expression.cs (This.DoResolve): Report a CS0027 if we're
8681 emitting a field initializer.
8683 2003-05-18 Martin Baulig <martin@ximian.com>
8685 * expression.cs (This.ResolveBase): New public function.
8686 (This.DoResolve): Check for CS0188.
8688 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8691 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8692 `instance_expression' to null if we don't have any non-static
8695 2003-05-18 Martin Baulig <martin@ximian.com>
8697 Reworked the way how local variables and parameters are handled by
8698 the flow analysis code.
8700 * statement.cs (TypeInfo, VariableMap): New public classes.
8701 (VariableInfo): New public class. This is now responsible for
8702 checking whether a variable has been assigned. It is used for
8703 parameters and local variables.
8704 (Block.EmitMeta): Take the InternalParameters as argument; compute
8705 the layout of the flow vectors here.
8706 (Block.LocalMap, Block.ParameterMap): New public properties.
8707 (FlowBranching): The .ctor doesn't get the InternalParameters
8708 anymore since Block.EmitMeta() now computes the layout of the flow
8710 (MyStructInfo): This class is now known as `StructInfo' and nested
8711 in `TypeInfo'; we don't access this directly anymore.
8713 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8714 property and removed IsAssigned(), IsFieldAssigned(),
8715 SetAssigned() and SetFieldAssigned(); we now call them on the
8716 VariableInfo so we don't need to duplicate this code everywhere.
8718 * expression.cs (ParameterReference): Added `Block block' argument
8720 (LocalVariableReference, ParameterReference, This): The new
8721 VariableInfo class is now responsible for all the definite
8724 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8725 IsParameterAssigned, SetParameterAssigned): Removed.
8727 2003-05-18 Martin Baulig <martin@ximian.com>
8729 * typemanager.cs (InitCoreTypes): Try calling
8730 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8731 the 3-args-version. Corlib now also needs our `void_type'.
8732 (GetMethod): Added overloaded version which takes an optional
8733 `bool report_errors' to allow lookups of optional methods.
8735 2003-05-12 Martin Baulig <martin@ximian.com>
8737 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8738 only used for locals and not for parameters.
8740 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8742 * support.cs (InternalParameters.ParameterType): Return the
8743 ExternalType of the parameter.
8745 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8748 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8750 * class.cs (MethodData.Define): Do not set the `newslot' on
8751 interface members, if they are also flagged as "override".
8753 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8754 better code for ++i and i++. This only works for static fields
8755 and local variables.
8757 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8758 want to pull the DeclSpace out of the builder_to_declspace instead
8759 of the TypeBuilder (like in TypeContainer.FindMembers).
8761 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8762 instead of LookupTypeContainer. Fixes the crash on .NET for
8763 looking up interface members.
8765 * const.cs: Create our own emit context during the Definition
8766 stage, so that constants are evaluated in the proper context, when
8767 a recursive definition happens.
8769 2003-05-11 Martin Baulig <martin@ximian.com>
8771 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8772 new block for a switch section.
8773 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8774 the adding/lookup in the switch block. Fixes #39828.
8776 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8778 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8779 functionality: I needed to convert the data after I had performed
8780 the add/sub operation into the operands type size.
8782 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8783 pass the type for the box operation, otherwise the resulting
8784 object would have been of type object.
8786 (BoxedCast): Add constructor to specify the type to box as.
8788 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8790 * iterators.cs: I was reusing the `count' variable inadvertently,
8791 take steps to not allow this to happen.
8793 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8795 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8796 by creating an array at the point where the params starts and
8797 putting all those arguments there, then adjusting the size of the
8800 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8802 * expression.cs (New.AddressOf): Implement interface
8803 IMemoryLocation. This is used when the `new' operator is used in
8804 the context of an invocation to a method on a value type.
8806 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8809 * namespace.cs: Also check the using aliases here.
8811 * driver.cs: Move the test for using validity after the types have
8812 been entered, so we do a single pass that also includes the using
8815 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8816 in the regular case. CreateSiblingForFinally is doing extra
8819 * attribute.cs (GetAttributeArgumentExpression): Store the result
8820 on an out value, and use the return value to indicate failure
8821 instead of using null (which is a valid return for Constant.GetValue).
8823 * statement.cs: Perform the analysis flow for the increment
8824 portion after the statement, because this will be the real flow of
8825 execution. Fixes #42385
8827 * codegen.cs (EmitContext.EmitArgument,
8828 EmitContext.EmitStoreArgument): New helper functions when the
8829 RemapToProxy flag is set.
8831 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8834 Add support for remapping parameters.
8836 * iterators.cs: Propagate parameter values; Store parameter
8837 values in the proxy classes.
8839 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8841 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8842 need a proxy reference; I do not know what I was thinking
8844 * cs-parser.jay (constructor_initializer): catch another error,
8845 and display nice message.
8847 (field_declaration): catch void field declaration
8848 to flag a better error.
8850 * class.cs (MemberBase.CheckBase): Report an error instead of a
8851 warning if a new protected member is declared in a struct.
8852 (Field.Define): catch the error of readonly/volatile.
8854 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8856 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8857 volatile variable is taken
8859 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8861 * statement.cs (Fixed.Resolve): Report an error if we are not in
8864 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8866 * typemanager.cs: reuse the code that handles type clashes for
8867 delegates and enumerations.
8869 * class.cs (Report28): Always report.
8871 * expression.cs (EncodeAsAttribute): Allow nulls here.
8873 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8875 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8876 the functionality for testing whether an expression is valid for
8877 an attribute here. Also handle the case of arrays of elements
8880 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8881 encoding a linear array into an array of objects that are suitable
8882 to be passed to an CustomAttributeBuilder.
8884 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8886 * ecore.cs: (FieldExpr): Handle field remapping here.
8888 * iteratators.cs: Pass the instance variable (if the method is an
8889 instance method) to the constructors, so we can access the field
8890 variables on the class.
8892 TODO: Test this with structs. I think the THIS variable on
8893 structs might have to be a pointer, and not a refenrece
8895 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8897 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8898 local variables to fields in a proxy class.
8900 * iterators.cs (PopulateProxy): Rename our internal fields to
8902 Create a <THIS> field if we are an instance method, so we can
8903 reference our parent container variables.
8904 (MapVariable): Called back from the EmitContext code to enter a
8905 new variable to field mapping into the proxy class (we just create
8909 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8910 for using the remapped locals to fields.
8912 I placed the code here, because that gives the same semantics to
8913 local variables, and only changes the Emit code.
8915 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8916 statements inside iterators.
8917 (VariableInfo): Add a FieldBuilder for the cases when we are
8918 remapping local variables to fields in a proxy class
8920 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8921 current_block != null.
8923 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8924 not cope with strings, as it has been moved to the
8925 TableSwitchEmit. Fixed bug in switch generation.
8927 * expression.cs (New.DoResolve): Provide more context for the user
8928 when reporting an error.
8930 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8933 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8934 check the permissions for it. Note than in a type-resolution
8935 context the check was already present in DeclSpace.ResolveType,
8936 but was missing from the MemberAccess.
8938 (ArrayCreation.CheckIndices): warn if the user has
8939 more nested levels of expressions, but there are no more
8940 dimensions specified. Avoids crash on bug 41906.
8942 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8944 * statement.cs (Block): replace Implicit bool, for a generic
8946 New flag: `Unchecked'. This is used during the EmitMeta phase
8947 (which is out-of-line with the regular Resolve/Emit process for a
8948 statement, as this is done ahead of time, but still gets a chance
8949 to call constant resolve).
8951 (Block.Flags): new enum for adding a new flag.
8953 (Block.EmitMeta): track the state of unchecked.
8955 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8956 to enable constant resolution to work there as well.
8958 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8960 * typemanager.cs (ienumerable_type): Also look up
8961 System.Collections.IEnumerable.
8963 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8965 TODO: Test more than one conditional per method.
8967 * class.cs (Indexer.Define): Report the location where the user is
8968 referencing the unsupported feature.
8970 (MethodData): Overload the use of `conditionals' to
8971 minimize the creation of needless ArrayLists. This saves roughly
8972 212kb on my machine.
8974 (Method): Implement the new IIteratorContainer interface.
8975 (Method.SetYields): Implement the method by setting the ModFlags
8976 to contain METHOD_YIELDS.
8978 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8979 which just got set to null.
8981 * iterators.cs: New file.
8983 (Yield, YieldBreak): New statements.
8985 * statement.cs (Return.Resolve): Flag an error if we are used in
8988 * codegen.cs (InIterator): New flag set if the code is being
8989 compiled in an iterator method.
8991 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8992 internal modifier, and we just use it to avoid adding extra
8993 fields, as this is seldom used.
8995 * cs-parser.jay: Add yield_statement (yield and yield break).
8997 * driver.cs: New flag -v2 to turn on version 2 features.
8999 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
9000 hashtable when v2 is enabled.
9002 2003-04-20 Miguel de Icaza <miguel@ximian.com>
9004 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
9005 there is already a namespace defined with this name.
9007 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
9008 people upgraded their corlibs.
9010 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
9011 always use fully qualified types, no need to use the compiler
9014 (TypeManager.IsNamespace): Use binarysearch.
9016 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
9017 AddDelegate): I did not quite use the new IsValid API properly: I
9018 have to pass the short-name and the fullname. I was passing only
9019 the basename instead of the fullname sometimes.
9021 (TypeContainer.DefineType): call NamespaceClash.
9023 * interface.cs (Interface.DefineType): use NamespaceClash before
9026 * delegate.cs (Delegate.DefineType): use NamespaceClash before
9029 * enum.cs: (Enum.DefineType): use NamespaceClash before
9032 * typemanager.cs (: 3-line patch that gives us some tasty 11%
9033 speed increase. First, use the negative_hits cache when we get a
9034 negative. Second, add the type with its full original name
9035 instead of the new . and + encoded name (reflection uses + to
9036 separate type from a nested type). Use LookupTypeReflection
9037 directly which bypasses the type->name hashtable (that we already
9038 know does not contain the type.
9040 * decl.cs (DeclSpace.ResolveTypeExpr): track the
9041 location/container type.
9043 * driver.cs: When passing utf8, use directly the UTF8Encoding.
9045 2003-04-19 Miguel de Icaza <miguel@ximian.com>
9047 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
9049 * delegate.cs (NewDelegate.Resolve): Test whether an instance
9050 method is being referenced in the method group from a static
9051 context, and report error 120 if so.
9053 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
9056 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
9057 is created, we create the A namespace).
9059 * cs-parser.jay: A namespace also introduces a DeclarationFound.
9062 2003-04-18 Miguel de Icaza <miguel@ximian.com>
9064 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
9065 invocation to ModuleBuilder.GetType with the same values will
9066 return a new type instance, so we need to cache its return
9069 * expression.cs (Binary.ResolveOperator): Only allow the compare
9070 operators on enums if they are of the same type.
9072 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
9073 types of ValueType on their own case. Before we were giving them
9074 the same treatment as objects.
9076 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
9077 fullname. Short name is used to compare against container name.
9078 Fullname is used to check against defined namespace names.
9080 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
9081 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
9083 (Method.CheckBase): Call parent.
9084 (MemberBase.CheckBase): Check for protected members on sealed
9086 (PropertyBase.CheckBase): Call parent.
9087 (Field.Define): Call parent.
9089 * report.cs: Negative error codes are now mapped to 8000 - code,
9090 so that the display is render more nicely.
9092 * typemanager.cs: Do not use try/catch, instead report a regular
9095 (GetPointerType, GetReferenceType): These methods provide
9096 mechanisms to obtain the T* and T& from a T. We had the code
9097 previously scattered around the code base, and it also used
9098 TypeManager.LookupType that would go through plenty of caches.
9099 This one goes directly to the type source.
9101 In some places we did the Type.GetType followed by
9102 ModuleBuilder.GetType, but not in others, so this unifies the
9105 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
9106 statements now that we have namespace information.
9108 * typemanager.cs (IsNamespace): New method, returns whether the
9109 string presented is a namespace or not.
9111 (ComputeNamespaces): New public entry point, computes the list of
9112 available namespaces, using the GetNamespaces API call in Mono, or
9113 the slower version in MS.NET.
9115 Now before we start the semantic analysis phase, we have a
9116 complete list of namespaces including everything that the user has
9119 Deleted old code to cache namespaces in .nsc files.
9121 2003-04-17 Miguel de Icaza <miguel@ximian.com>
9123 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
9124 class/struct location definition Location for the implicit
9125 constructor location.
9127 (Operator.Define): Use the location of the operator for the
9128 implicit Method definition.
9130 (Constructor.Emit): use the constructor location for the implicit
9131 base initializer constructor.
9133 * ecore.cs: Remove ITypeExpression. This interface is now gone,
9134 and the Expression class now contains two new methods:
9136 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
9137 isolate type lookup from the rest of the resolution process.
9139 Since we use Expressions to hold type definitions due to the way
9140 we parse the input we have historically overloaded Resolve to
9141 perform the Type lookups if a special flag is passed. Now this is
9142 eliminated and two methods take their place.
9144 The differences in the two methods between xStep and xTerminal is
9145 that xStep is involved in our current lookup system that uses
9146 SimpleNames to compose a name, while xTerminal is used just to
9147 catch the case where the simplename lookup failed.
9149 2003-04-16 Miguel de Icaza <miguel@ximian.com>
9151 * expression.cs (ResolveMemberAccess): Remove redundant code.
9152 TypeExpr expressions are always born fully resolved.
9154 * interface.cs (PopulateMethod): Do not lookup the types twice.
9155 We were doing it once during SemanticAnalysis and once during
9158 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
9159 in local variable type definitions, were being returned as a
9160 SimpleName (we decomposed everything into a string), that is
9161 because primary_expression was being used instead of a type in the
9162 grammar (reduce/reduce conflicts).
9164 The part that was wrong is that we converted the expression into a
9165 string (an oversimplification in one hand, compounded with primary
9166 expressions doing string concatenation).
9172 Would return "A.B.C[]" as a SimpleName. This stopped things like
9173 using clauses from working on this particular context. And a type
9174 was being matched directly against "A.B.C[]".
9176 We now use the correct approach, and allow for ComposedCast to be
9177 part of the unary expression. So the "A.B.C []" become a composed
9178 cast of "A.B.C" (as a nested group of MemberAccess with a
9179 SimpleName at the end) plus the rank composition "[]".
9183 2003-04-10 Miguel de Icaza <miguel@ximian.com>
9185 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
9186 for the access level checking.
9188 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
9189 `TypeContainer container', because I kept getting confused when I
9190 was debugging this code.
9192 * expression.cs (Indexers): Instead of tracking getters/setters,
9193 we now track them in parallel. We create one arraylist less, but
9194 most importantly it is possible now for the LValue code to find a
9195 matching get for a set.
9197 (IndexerAccess.DoResolveLValue): Update the code.
9198 GetIndexersForType has been modified already to extract all the
9199 indexers from a type. The code assumed it did not.
9201 Also make the code set the correct return type for the indexer.
9202 This was fixed a long time ago for properties, but was missing for
9203 indexers. It used to be void_type.
9205 (Binary.Emit): Test first for doubles instead of
9206 floats, as they are more common.
9208 (Binary.EmitBranchable): Use the .un version of the branch opcodes
9209 when dealing with floats and the <=, >= operators. This fixes bug
9212 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
9213 to load the array value by emitting a load on the foreach variable
9214 type. This was incorrect.
9216 We now emit the code to load an element using the the array
9217 variable type, and then we emit the conversion operator.
9221 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
9223 * attribute.cs: Avoid allocation of ArrayLists in the common case.
9225 2003-04-09 Miguel de Icaza <miguel@ximian.com>
9227 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
9228 test for protection before we test for signatures.
9230 (MethodSignature.ToString): implement.
9232 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
9233 to the case where we reduced into a LongConstant.
9235 * decl.cs (CheckAccessLevel): If the type is an array, we can not
9236 depend on whether the information is acurrate, because the
9237 Microsoft runtime will always claim that the array type is public,
9238 regardless of the real state.
9240 If the type is a pointer, another problem happens: the type is
9241 reported as non-public in Microsoft.
9243 In both cases we have to call CheckAccessLevel recursively with
9244 the underlying type as the argument to be tested.
9246 2003-04-08 Miguel de Icaza <miguel@ximian.com>
9248 * assign.cs (Assign.Emit): If we are dealing with a compound
9249 assignment expression, we should use the code path that stores the
9250 intermediate result in a temporary value. This fixes #40903.
9252 *expression.cs (Indirection.ToString): Provide ToString method for
9255 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
9257 * class.cs: Null out fields holding references to Block objects so
9258 they can be garbage collected.
9260 * expression.cs (OverloadResolve): Remove unused local.
9262 2003-04-07 Martin Baulig <martin@ximian.com>
9264 * codegen.cs (EmitContext.CurrentFile): New public field.
9265 (EmitContext.Mark): Use the CurrentFile to check whether the
9266 location is in the correct file.
9267 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
9269 2003-04-07 Martin Baulig <martin@ximian.com>
9271 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
9273 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
9274 location. [FIXME: The location argument which gets passed to this
9275 method is sometimes wrong!]
9277 2003-04-07 Nick Drochak <ndrochak@gol.com>
9279 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
9281 2003-04-07 Miguel de Icaza <miguel@ximian.com>
9283 * expression.cs (Indirection.EmitAssign): We were using the
9284 temporary, but returning immediately instead of continuing the
9287 2003-04-06 Martin Baulig <martin@ximian.com>
9289 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
9290 if it's a nested child, but also deriving from the outer class.
9293 * typemanager.cs (IsNestedChildOf): Make this work if it's a
9294 nested child, but also deriving from the outer class. See
9296 (FilterWithClosure): We may access private members of the outer
9297 class if we're a nested child and deriving from the outer class.
9298 (RealMemberLookup): Only set `closure_private_ok' if the
9299 `original_bf' contained BindingFlags.NonPublic.
9301 2003-04-05 Martin Baulig <martin@ximian.com>
9303 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
9304 probe if its a type parameter, and if so, flag an error.
9306 * decl.cs: Move here the SetParameterInfo code from class.cs.
9307 Handle IsGeneric here.
9309 Handle a variety of errors in the parameter info definition.
9311 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
9312 type parameters here.
9314 * cs-parser.jay (class_declaration): report errors for parameters
9317 2003-01-21 Miguel de Icaza <miguel@ximian.com>
9319 * generic.cs: New file, contains support code for generics.
9321 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
9322 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
9324 Update parser for the above removals.
9326 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
9327 now taken care of in the parser.
9329 2003-04-02 Miguel de Icaza <miguel@ximian.com>
9331 * class.cs (Event.Define): Do not allow abstract events to have
9334 2003-04-01 Miguel de Icaza <miguel@ximian.com>
9336 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
9337 block in event declarations.
9339 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
9340 value type, get its address.
9342 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
9343 leaving a class on the stack instead of a boolean value (int
9344 0/1). Change the code so we compare against null, and then the
9345 result against zero.
9347 * class.cs (TypeContainer.GetClassBases): We were checking for the
9348 parent class being sealed too late.
9350 * expression.cs (Binary.Emit): For <= and >= when dealing with
9351 floating point values, use cgt.un and clt.un instead of cgt and
9354 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
9356 * statement.cs: Apply the same optimization as MS: skip the
9357 GetEnumerator returning an IEnumerator, and use the one returning a
9358 CharEnumerator instead. This allows us to avoid the try-finally block
9361 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
9363 * cs-parser.jay: Attributes cannot be applied to
9364 namespaces. Fixes #40473
9366 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9369 (Add*): check if the name is valid using the full name for constants,
9370 fields, properties and events.
9372 2003-03-28 Miguel de Icaza <miguel@ximian.com>
9374 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
9375 char constants to be part of the enumeration.
9377 * expression.cs (Conditional.DoResolve): Add support for operator
9378 true. Implements the missing functionality from 14.12
9380 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
9381 operator true/false as required by the spec.
9383 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
9384 implicit conversion to boolean.
9386 * statement.cs (Statement.ResolveBoolean): A boolean expression is
9387 also one where the type implements `operator true'.
9389 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
9390 get an expression that will invoke operator true based on an
9393 (GetConversionOperators): Removed the hack that called op_True
9396 (Expression.ResolveBoolean): Move this from Statement.
9398 2003-03-17 Miguel de Icaza <miguel@ximian.com>
9400 * ecore.cs (FieldExpr): do not allow initialization of initonly
9401 fields on derived classes
9403 2003-03-13 Martin Baulig <martin@ximian.com>
9405 * statement.cs (Block.Emit): Call ig.BeginScope() and
9406 ig.EndScope() when compiling with debugging info; call
9407 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
9409 2003-03-08 Miguel de Icaza <miguel@ximian.com>
9411 * expression.cs (Indexers): Do not construct immediately, allow
9412 for new members to be appended as we go. Fixes 38143
9414 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9416 * expression.cs: save/restore context when resolving an unchecked
9419 2003-03-05 Miguel de Icaza <miguel@ximian.com>
9421 * cfold.cs: Catch division by zero in modulus operator during
9424 2003-03-03 Miguel de Icaza <miguel@ximian.com>
9426 * interface.cs (Interface.DefineMembers): Avoid defining members
9429 2003-02-27 Miguel de Icaza <miguel@ximian.com>
9431 * driver.cs: handle the +/- options for -noconfig
9433 * statement.cs (Unckeched.Resolve): Also track the state of
9434 unchecked in the Resolve phase.
9436 2003-02-27 Martin Baulig <martin@ximian.com>
9438 * ecore.cs (Expression.MemberLookup): Don't create a
9439 MethodGroupExpr for something which is not a method. Fixes #38291.
9441 2003-02-25 Miguel de Icaza <miguel@ximian.com>
9443 * class.cs (MemberBase.CheckParameters): Also check that the type
9444 is unmanaged if it is a pointer.
9446 * expression.cs (SizeOf.Resolve): Add location information.
9448 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
9449 a managed type is declared.
9451 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
9452 parameter modifiers as well. Fixes bug 38606
9454 * class.cs: Very sad. Am backing out the speed up changes
9455 introduced by the ArrayList -> Array in the TypeContainer, as they
9456 were not actually that much faster, and introduced a bug (no error
9457 reports on duplicated methods).
9459 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
9460 source first, this will guarantee that we have a valid expression
9461 before calling in lower levels functions that will require a
9462 resolved object. Then use this original_source in the
9463 target.ResolveLValue instead of the original source that was
9466 Another change. Use target.Resolve instead of LValueResolve.
9467 Although we are resolving for LValues, we will let the Assign code
9468 take care of that (it will be called again from Resolve). This
9469 basically allows code like this:
9471 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
9472 class Y { void A (X x) { x [0] += o; }
9474 The problem was that the indexer was trying to resolve for
9475 set_Item (idx, object o) and never finding one. The real set_Item
9476 was set_Item (idx, X). By delaying the process we get the right
9481 2003-02-23 Martin Baulig <martin@ximian.com>
9483 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
9484 while calling DoEmit ().
9486 * codegen.cs (EmitContext.Mark): Don't mark locations in other
9487 source files; if you use the #line directive inside a method, the
9488 compiler stops emitting line numbers for the debugger until it
9489 reaches the end of the method or another #line directive which
9490 restores the original file.
9492 2003-02-23 Martin Baulig <martin@ximian.com>
9494 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
9496 2003-02-23 Martin Baulig <martin@ximian.com>
9498 * statement.cs (Block.AddChildVariableNames): We need to call this
9499 recursively, not just for our immediate children.
9501 2003-02-23 Martin Baulig <martin@ximian.com>
9503 * class.cs (Event.Define): Always make the field private, like csc does.
9505 * typemanager.cs (TypeManager.RealMemberLookup): Make events
9506 actually work, fixes bug #37521.
9508 2003-02-23 Miguel de Icaza <miguel@ximian.com>
9510 * delegate.cs: When creating the various temporary "Parameters"
9511 classes, make sure that we call the ComputeAndDefineParameterTypes
9512 on those new parameters (just like we do with the formal ones), to
9513 allow them to be resolved in the context of the DeclSpace.
9515 This fixes the bug that Dick observed in Bugzilla #38530.
9517 2003-02-22 Miguel de Icaza <miguel@ximian.com>
9519 * expression.cs (ResolveMemberAccess): When resolving a constant,
9520 do not attempt to pull a constant if the value was not able to
9521 generate a valid constant.
9523 * const.cs (LookupConstantValue): Do not report more errors than required.
9525 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9527 * expression.cs: fixes bug #38328.
9529 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9531 * class.cs: Changed all the various members that can be part of a
9532 class from being an ArrayList to be an Array of the right type.
9533 During the DefineType type_list, interface_list, delegate_list and
9534 enum_list are turned into types, interfaces, delegates and enums
9537 And during the member population, indexer_list, event_list,
9538 constant_list, field_list, instance_constructor_list, method_list,
9539 operator_list and property_list are turned into their real arrays.
9541 Although we could probably perform this operation earlier, for
9542 good error reporting we need to keep the lists and remove the
9543 lists for longer than required.
9545 This optimization was triggered by Paolo profiling the compiler
9546 speed on the output of `gen-sample-program.pl' perl script.
9548 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
9549 not crash in methods like MemberLookupFailed that use this field.
9551 This problem arises when the compiler fails to resolve a type
9552 during interface type definition for example.
9554 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9556 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
9557 inherit from System.Object, so we have to stop at null, not only
9558 when reaching System.Object.
9560 2003-02-17 Miguel de Icaza <miguel@ximian.com>
9562 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
9563 DeclaredOnly because the parent indexer might have had a different
9564 name, but did not loop until the top of the hierarchy was reached.
9566 The problem this one fixes is 35492: when a class implemented an
9567 indexer from an interface, we were getting the interface method
9568 (which was abstract) and we were flagging an error (can not invoke
9571 This also keeps bug 33089 functioning, and test-148 functioning.
9573 * typemanager.cs (IsSpecialMethod): The correct way of figuring
9574 out if a method is special is to see if it is declared in a
9575 property or event, or whether it is one of the predefined operator
9576 names. This should fix correctly #36804.
9578 2003-02-15 Miguel de Icaza <miguel@ximian.com>
9580 The goal here is to remove the dependency on EmptyCast.Peel ().
9581 Killing it completely.
9583 The problem is that currently in a number of places where
9584 constants are expected, we have to "probe" for an EmptyCast, and
9585 Peel, which is not the correct thing to do, as this will be
9586 repetitive and will likely lead to errors.
9588 The idea is to remove any EmptyCasts that are used in casts that
9589 can be reduced to constants, so we only have to cope with
9592 This bug hunt was triggered by Bug 37363 and the desire to remove
9593 the duplicate pattern where we were "peeling" emptycasts to check
9594 whether they were constants. Now constants will always be
9597 * ecore.cs: Use an enumconstant here instead of wrapping with
9600 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
9601 throwing me off. By handling this we can get rid of a few hacks.
9603 * statement.cs (Switch): Removed Peel() code.
9605 2003-02-14 Miguel de Icaza <miguel@ximian.com>
9607 * class.cs: Location information for error 508
9609 * expression.cs (New.DoResolve): Add a guard against double
9610 resolution of an expression.
9612 The New DoResolve might be called twice when initializing field
9613 expressions (see EmitFieldInitializers, the call to
9614 GetInitializerExpression will perform a resolve on the expression,
9615 and later the assign will trigger another resolution
9617 This leads to bugs (#37014)
9619 * delegate.cs: The signature for EndInvoke should contain any ref
9620 or out parameters as well. We were not doing this in the past.
9622 * class.cs (Field.Define): Do not overwrite the type definition
9623 inside the `volatile' group. Turns out that volatile enumerations
9624 were changing the type here to perform a validity test, which
9627 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9629 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9630 and structs, we do not want to load the instance variable
9632 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9633 enum_type has to be handled like an object reference (implicit
9634 conversions exists from this to object), but the regular IsClass
9635 and IsValueType tests will never return true for this one.
9637 Also we use TypeManager.IsValueType instead of type.IsValueType,
9638 just for consistency with the rest of the code (this is only
9639 needed if we ever use the construct exposed by test-180.cs inside
9640 corlib, which we dont today).
9642 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9644 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9647 2003-02-09 Martin Baulig <martin@ximian.com>
9649 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9650 (Namespace.DefineNamespaces): New static public method; this is
9651 called when we're compiling with debugging to add all namespaces
9654 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9655 pass it to the Namespace's .ctor.
9657 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9658 and MethodBase arguments; pass the namespace ID to the symwriter;
9659 pass the MethodBase instead of the token to the symwriter.
9660 (SymbolWriter.DefineNamespace): New method to add a namespace to
9663 2003-02-09 Martin Baulig <martin@ximian.com>
9665 * symbolwriter.cs: New file. This is a wrapper around
9666 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9667 methods here in near future.
9669 2003-02-09 Martin Baulig <martin@ximian.com>
9671 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9672 ILGenerator.MarkSequencePoint() which are actually used by the
9675 2003-02-09 Martin Baulig <martin@ximian.com>
9677 * location.cs (SourceFile): New public sealed class. This
9678 contains the name and an index which is used in the location's token.
9679 (Location): Reserve an appropriate number of bits in the token for
9680 the source file instead of walking over that list, this gives us a
9681 really huge performance improvement when compiling with debugging.
9683 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9684 `SourceFile' argument instead of a string.
9685 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9686 but don't parse/tokenize here, we need to generate the list of all
9687 source files before we do that.
9688 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9691 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9692 instead of a string.
9694 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9697 2003-02-09 Martin Baulig <martin@ximian.com>
9699 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9700 filename on `#line default'.
9702 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9704 * statement.cs: don't clear the pinned var when the fixed statement
9705 returns from the method (fixes bug#37752).
9707 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9709 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9712 2003-02-07 Martin Baulig <martin@ximian.com>
9714 * driver.cs: Removed the `--debug-args' command line argument.
9716 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9717 automatically by the AsssemblyBuilder.
9718 (CodeGen.InitializeSymbolWriter): We don't need to call any
9719 initialization function on the symbol writer anymore. This method
9720 doesn't take any arguments.
9722 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9724 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9725 from referenced assemblies as well.
9727 2003-02-02 Martin Baulig <martin@ximian.com>
9729 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9731 2003-02-02 Martin Baulig <martin@ximian.com>
9733 * class.cs (Constructor.Emit): Open the symbol writer before
9734 emitting the constructor initializer.
9735 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9736 single-stepping through constructor initializers.
9738 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9740 * class.cs: Handle error 549: do not allow virtual methods in
9743 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9745 * decl.cs: Check access levels when resolving types
9747 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9749 * statement.cs: Add parameters and locals set in catch blocks that might
9750 return to set vector
9752 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9754 * class.cs (Operator): Set the SpecialName flags for operators.
9756 * expression.cs (Invocation.DoResolve): Only block calls to
9757 accessors and operators on SpecialName methods.
9759 (Cast.TryReduce): Handle conversions from char constants.
9762 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9764 * statement.cs: small memory and time optimization in FlowBranching.
9766 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9768 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9769 problem that the last fix but in the other sid (Set).
9771 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9772 access when there is no indexer in the hierarchy.
9774 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9776 * class.cs: Combine some if statements.
9778 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9780 * driver.cs: fixed bug #37187.
9782 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9784 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9785 any indexer, it's needed to build a list with all the indexers in the
9786 hierarchy (AllGetters), else we have problems. Fixes #35653.
9788 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9790 * class.cs (MethodData.Define): It is wrong for an interface
9791 implementation to be static in both cases: explicit and implicit.
9792 We were only handling this in one case.
9794 Improve the if situation there to not have negations.
9796 * class.cs (Field.Define): Turns out that we do not need to check
9797 the unsafe bit on field definition, only on usage. Remove the test.
9799 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9801 * driver.cs: use assembly.Location instead of Codebase (the latest
9802 patch made mcs fail when using MS assemblies).
9804 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9806 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9807 get the path to *corlib.dll.
9809 2003-01-21 Nick Drochak <ndrochak@gol.com>
9813 * typemanager.cs: Remove compiler warnings
9815 2003-01-20 Duncan Mak <duncan@ximian.com>
9817 * AssemblyInfo.cs: Bump the version number to 0.19.
9819 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9821 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9823 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9825 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9827 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9829 * cs-parser.jay: Small fix: we were not comparing the constructor
9830 name correctly. Thanks to Zoltan for the initial pointer.
9832 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9834 * cs-tokenizer.cs: Set file name when specified with #line
9836 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9838 * cs-parser.jay: Only perform the constructor checks here if we
9839 are named like the class; This will help provider a better
9840 error. The constructor path is taken when a type definition is
9841 not found, but most likely the user forgot to add the type, so
9842 report that rather than the constructor error.
9844 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9846 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9849 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9851 * cs-parser.jay: Add cleanup call.
9853 2003-01-13 Duncan Mak <duncan@ximian.com>
9855 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9856 consistent with other methods.
9858 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9860 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9862 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9864 * attribute.cs: only set GuidAttr to true when we have a
9867 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9871 * typemanager.cs: fixes to allow mcs compile corlib with the new
9872 Type.IsSubclassOf fix.
9874 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9876 * expression.cs (LocalVariableReference.DoResolve): Classify a
9877 constant as a value, not as a variable. Also, set the type for
9880 * cs-parser.jay (fixed_statement): take a type instead of a
9881 pointer_type, so we can produce a better error message later.
9883 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9886 (For.DoEmit): Make inifinite loops have a
9887 non-conditional branch back.
9889 (Fixed.DoEmit): First populate the pinned variables, then emit the
9890 statement, then clear the variables. Before I was emitting the
9891 code once for each fixed piece.
9894 2003-01-08 Martin Baulig <martin@ximian.com>
9896 * statement.cs (FlowBranching.MergeChild): A break in a
9897 SWITCH_SECTION does not leave a loop. Fixes #36155.
9899 2003-01-08 Martin Baulig <martin@ximian.com>
9901 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9902 lives in the same number space than `param_map'. Fixes #36154.
9904 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9906 * cs-parser.jay (constructor_declaration): Set the
9907 Constructor.ModFlags before probing for it. This makes the
9908 compiler report 514, 515 and 132 (the code was there, but got
9911 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9912 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9913 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9915 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9917 * enum.cs: create the enum static fields using the enum type.
9919 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9921 * class.cs: don't try to create the ParamBuilder for the return
9922 type if it's not needed (and handle it breaking for the ms runtime
9925 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9927 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9929 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9931 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9932 the command. This showed up while compiling the JANET source
9933 code, which used \r as its only newline separator.
9935 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9937 * class.cs (Method.Define): If we are an operator (because it
9938 reuses our code), then set the SpecialName and HideBySig. #36128
9940 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9942 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9943 exception, report error 120 `object reference required'.
9945 * driver.cs: Add --pause option, used during to measure the size
9946 of the process as it goes with --timestamp.
9948 * expression.cs (Invocation.DoResolve): Do not allow methods with
9949 SpecialName to be invoked.
9951 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9953 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9954 number before adding it.
9956 2002-12-21 Ravi Pratap <ravi@ximian.com>
9958 * ecore.cs (StandardImplicitConversion): When in an unsafe
9959 context, we allow conversion between void * to any other pointer
9960 type. This fixes bug #35973.
9962 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9964 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9965 is not thrown when extensionless outputs are used
9967 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9969 * rootcontext.cs: fixed compilation of corlib.
9971 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9973 * attribute.cs (Attributes.Contains): Add new method.
9975 * class.cs (MethodCore.LabelParameters): if the parameter is an
9976 `out' parameter, check that no attribute `[In]' has been passed.
9978 * enum.cs: Handle the `value__' name in an enumeration.
9980 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9982 * decl.cs: Added special case to allow overrides on "protected
9985 2002-12-18 Ravi Pratap <ravi@ximian.com>
9987 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9988 since it makes much more sense.
9990 (Attributes.ctor): Don't require a Location parameter.
9992 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9994 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9995 since we already have that information per attribute.
9997 * everywhere : make appropriate changes.
9999 * class.cs (LabelParameters): Write the code which actually
10000 applies attributes to the return type. We can't do this on the MS
10001 .NET runtime so we flag a warning in the case an exception is
10004 2002-12-18 Miguel de Icaza <miguel@ximian.com>
10006 * const.cs: Handle implicit null conversions here too.
10008 2002-12-17 Ravi Pratap <ravi@ximian.com>
10010 * class.cs (MethodCore.LabelParameters): Remove the extra
10011 Type [] parameter since it is completely unnecessary. Instead
10012 pass in the method's attributes so that we can extract
10013 the "return" attribute.
10015 2002-12-17 Miguel de Icaza <miguel@ximian.com>
10017 * cs-parser.jay (parse): Use Report.Error to flag errors instead
10018 of ignoring it and letting the compile continue.
10020 * typemanager.cs (ChangeType): use an extra argument to return an
10021 error condition instead of throwing an exception.
10023 2002-12-15 Miguel de Icaza <miguel@ximian.com>
10025 * expression.cs (Unary.TryReduce): mimic the code for the regular
10026 code path. Perform an implicit cast in the cases where we can
10027 implicitly convert to one of the integral types, and then reduce
10028 based on that constant. This fixes bug #35483.
10030 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10032 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
10034 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10036 * namespace.cs: fixed bug #35489.
10038 2002-12-12 Miguel de Icaza <miguel@ximian.com>
10040 * class.cs: Remove some dead code.
10042 * cs-parser.jay: Estimate the number of methods needed
10043 (RootContext.MethodCount);
10045 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
10046 numbers instead of StringBuilders.
10048 * support.cs (PtrHashtable): Add constructor with initial size;
10049 We can now reduce reallocations of the method table.
10051 2002-12-10 Ravi Pratap <ravi@ximian.com>
10053 * attribute.cs (ApplyAttributes): Keep track of the emitted
10054 attributes on a per-target basis. This fixes bug #35413.
10056 2002-12-10 Miguel de Icaza <miguel@ximian.com>
10058 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
10059 default to the Windows 1252 encoding.
10061 (UnixParseOption): Support version, thanks to Alp for the missing
10064 * AssemblyInfo.cs: Add nice assembly information.
10066 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
10069 * cs-parser.jay: Allow a trailing comma before the close bracked
10070 in the attribute_section production.
10072 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
10073 address of the instance was being taken, I will take this out,
10074 because we take the address of the object immediately here.
10076 2002-12-09 Ravi Pratap <ravi@ximian.com>
10078 * typemanager.cs (AreMultipleAllowed): Take care of the most
10079 obvious case where attribute type is not in the current assembly -
10082 2002-12-08 Miguel de Icaza <miguel@ximian.com>
10084 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
10085 definitions, instead of doing that afterwards.
10087 Also we use a nice little hack, depending on the constructor, we
10088 know if we are a "composed" name or a simple name. Hence, we
10089 avoid the IndexOf test, and we avoid
10091 * codegen.cs: Add code to assist in a bug reporter to track down
10092 the source of a compiler crash.
10094 2002-12-07 Ravi Pratap <ravi@ximian.com>
10096 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
10097 types have been emitted for a given element and flag an error
10098 if something which does not have AllowMultiple set is used more
10101 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
10102 attribute types and their corresponding AllowMultiple properties
10104 (AreMultipleAllowed): Check the property for a given type.
10106 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
10107 property in the case we have a TypeContainer.
10109 (Attributes.AddAttribute): Detect duplicates and just skip on
10110 adding them. This trivial fix catches a pretty gross error in our
10111 attribute emission - global attributes were being emitted twice!
10113 Bugzilla bug #33187 is now fixed.
10115 2002-12-06 Miguel de Icaza <miguel@ximian.com>
10117 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
10118 instead of pp_and).
10120 * expression.cs (Binary.ResolveOperator): I can only use the
10121 Concat (string, string, string) and Concat (string, string,
10122 string, string) if the child is actually a concatenation of
10125 2002-12-04 Miguel de Icaza <miguel@ximian.com>
10127 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
10128 context where we need a 2-character lookahead.
10130 * pending.cs (PendingImplementation): Rework so we can keep track
10131 of interface types all the time, and flag those which were
10132 implemented by parents as optional.
10134 2002-12-03 Miguel de Icaza <miguel@ximian.com>
10136 * expression.cs (Binary.ResolveOperator): Use
10137 String.Concat(string,string,string) or
10138 String.Concat(string,string,string,string) when possible.
10140 * typemanager: More helper methods.
10143 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
10145 * pending.cs: remove the bogus return from GetMissingInterfaces()
10146 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
10148 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10150 * namespace.cs: avoid duplicated 'using xxx' being added to
10151 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
10152 when we get more than one 'using' statement for the same namespace.
10153 Report a CS0105 warning for it.
10155 2002-11-30 Miguel de Icaza <miguel@ximian.com>
10157 * cs-tokenizer.cs (consume_identifier): use read directly, instead
10158 of calling getChar/putback, uses internal knowledge of it.
10160 (xtoken): Reorder tokenizer so most common patterns are checked
10161 first. This reduces the compilation time in another 5% (from 8.11s
10162 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
10164 The parsing time is 22% of the compilation in mcs, and from that
10165 64% is spent on the tokenization process.
10167 I tried using a binary search for keywords, but this is slower
10168 than the hashtable. Another option would be to do a couple of
10171 * Not use a StringBuilder, instead use an array of chars,
10172 with a set value. Notice that this way we could catch
10173 the 645 error without having to do it *afterwards*.
10175 * We could write a hand-parser to avoid the hashtable
10176 compares altogether.
10178 The identifier consumption process takes 37% of the tokenization
10179 time. Another 15% is spent on is_number. 56% of the time spent
10180 on is_number is spent on Int64.Parse:
10182 * We could probably choose based on the string length to
10183 use Int32.Parse or Int64.Parse and avoid all the 64-bit
10186 Another 3% is spend on wrapping `xtoken' in the `token' function.
10188 Handle 0xa0 as whitespace (#34752)
10190 2002-11-26 Miguel de Icaza <miguel@ximian.com>
10192 * typemanager.cs (IsCLRType): New routine to tell whether a type
10193 is one of the builtin types.
10195 Maybe it needs to use TypeCodes to be faster. Maybe we could use
10196 typecode in more places instead of doing pointer comparissions.
10197 We could leverage some knowledge about the way the typecodes are
10200 New code to cache namespaces in assemblies, it is currently not
10201 invoked, to be used soon.
10203 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
10205 * expression.cs (Binary.ResolveOperator): specially handle
10206 strings, and do not perform user-defined operator overloading for
10209 2002-11-24 Miguel de Icaza <miguel@ximian.com>
10211 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
10212 internalcall as it is a pretty simple operation; Avoid whenever
10213 possible to call Char.IsLetter.
10215 (consume_identifier): Cut by half the number of
10216 hashtable calls by merging the is_keyword and GetKeyword behavior.
10218 Do not short-circuit, because if we do, we
10219 report errors (ie, #if false && true would produce an invalid
10223 2002-11-24 Martin Baulig <martin@ximian.com>
10225 * expression.cs (Cast.TryReduce): If we're in checked syntax,
10226 check constant ranges and report a CS0221. Fixes #33186.
10228 2002-11-24 Martin Baulig <martin@ximian.com>
10230 * cs-parser.jay: Make this work for uninitialized variable
10231 declarations in the `for' initializer. Fixes #32416.
10233 2002-11-24 Martin Baulig <martin@ximian.com>
10235 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
10236 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
10238 2002-11-24 Martin Baulig <martin@ximian.com>
10240 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
10241 argument; if true, we also check for user-defined conversions.
10242 This is only needed if both arguments are of a user-defined type.
10243 Fixes #30443, added test-175.cs.
10244 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
10246 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
10248 2002-11-24 Martin Baulig <martin@ximian.com>
10250 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
10251 function to get the store opcode.
10252 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
10253 only emit the Ldelema if the store opcode is Stobj. You must run
10254 both test-34 and test-167 to test this. Fixes #34529.
10256 2002-11-23 Martin Baulig <martin@ximian.com>
10258 * ecore.cs (Expression.MemberLookup): Added additional
10259 `qualifier_type' argument which is used when we're being called
10260 from MemberAccess.DoResolve() and null if we're called from a
10262 (Expression.MemberLookupFailed): New method to report errors; this
10263 does the CS1540 check and reports the correct error message.
10265 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
10266 argument for the CS1540 check and redone the way how we're dealing
10267 with private members. See the comment in the source code for details.
10268 (FilterWithClosure): Reverted this back to revision 1.197; renamed
10269 `closure_start_type' to `closure_qualifier_type' and check whether
10270 it's not null. It was not this filter being broken, it was just
10271 being called with the wrong arguments.
10273 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
10274 and pass it the correct `qualifier_type'; this also does the error
10277 2002-11-22 Miguel de Icaza <miguel@ximian.com>
10279 * expression.cs (Invocation.EmitParams): If the we are dealing
10280 with a non-built-in value type, load its address as well.
10282 (ArrayCreation): Use a a pretty constant instead
10283 of the hardcoded value 2. Use 6 instead of 2 for the number of
10284 static initializers.
10286 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
10287 because they are not really value types, just glorified integers.
10289 * driver.cs: Do not append .exe, the CSC compiler does not do it.
10291 * ecore.cs: Remove redundant code for enumerations, make them use
10292 the same code path as everything else, fixes the casting issue
10293 with enumerations in Windows.Forms.
10295 * attribute.cs: Do only cast to string if it is a string, the
10296 validation happens later.
10298 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
10299 people upgrade their corlibs.
10301 * ecore.cs: Oops, enumerations were not following the entire code path
10303 2002-11-21 Miguel de Icaza <miguel@ximian.com>
10305 * typemanager.cs (FilterWithClosure): Commented out the test for
10306 1540 in typemanager.cs, as it has problems when accessing
10307 protected methods from a parent class (see test-174.cs).
10309 * attribute.cs (Attribute.ValidateGuid): new method.
10310 (Attribute.Resolve): Use above.
10312 2002-11-19 Miguel de Icaza <miguel@ximian.com>
10314 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
10316 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
10317 handling for enumerations, as we only needed the TypeContainer
10318 functionality to begin with (this is required for the fix below to
10319 work for enums that reference constants in a container class for
10322 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
10324 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
10325 a valid TypeBuilder to perform lookups on.o
10327 * class.cs (InheritableMemberSignatureCompare): Use true in the
10328 call to GetGetMethod and GetSetMethod, because we are comparing
10329 the signature, and we need to get the methods *even* if they are
10332 (PropertyBase.CheckBase): ditto.
10334 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
10335 GotoCase.Resolve): Use Peel on EmpytCasts.
10337 * ecore.cs (EmptyCast): drop child, add Peel method.
10339 2002-11-17 Martin Baulig <martin@ximian.com>
10341 * ecore.cs (EmptyCast.Child): New public property.
10343 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
10344 label resolved to an EmptyCast. Fixes #34162.
10345 (GotoCase.Resolve): Likewise.
10346 (Block.EmitMeta): Likewise.
10348 2002-11-17 Martin Baulig <martin@ximian.com>
10350 * expression.cs (Invocation.BetterConversion): Prefer int over
10351 uint; short over ushort; long over ulong for integer literals.
10352 Use ImplicitConversionExists instead of StandardConversionExists
10353 since we also need to check for user-defined implicit conversions.
10354 Fixes #34165. Added test-173.cs.
10356 2002-11-16 Martin Baulig <martin@ximian.com>
10358 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
10359 with the `true' and `false' literals. Fixes #33151.
10361 2002-11-16 Martin Baulig <martin@ximian.com>
10363 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
10364 October 22nd; don't do the cs1540 check for static members.
10366 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
10367 now using our own filter here and doing the cs1540 check again.
10369 2002-11-16 Martin Baulig <martin@ximian.com>
10371 * support.cs (InternalParameters): Don't crash if we don't have
10372 any fixed parameters. Fixes #33532.
10374 2002-11-16 Martin Baulig <martin@ximian.com>
10376 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
10377 when looking up static methods to make this work on Windows.
10380 2002-11-16 Martin Baulig <martin@ximian.com>
10382 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
10383 a setter rather than using PropertyInfo.CanWrite.
10385 2002-11-15 Nick Drochak <ndrochak@gol.com>
10387 * class.cs: Allow acces to block member by subclasses. Fixes build
10390 2002-11-14 Martin Baulig <martin@ximian.com>
10392 * class.cs (Constructor.Emit): Added the extern/block check.
10395 2002-11-14 Martin Baulig <martin@ximian.com>
10397 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
10398 iteration while looking for indexers, this is needed because the
10399 indexer may have a different name in our base classes. Fixed the
10400 error reporting (no indexers at all, not get accessor, no
10401 overloaded match). Fixes bug #33089.
10402 (IndexerAccess.DoResolveLValue): Likewise.
10404 2002-11-14 Martin Baulig <martin@ximian.com>
10406 * class.cs (PropertyBase.CheckBase): Make this work for multiple
10407 indexers. Fixes the first part of bug #33089.
10408 (MethodSignature.InheritableMemberSignatureCompare): Added support
10411 2002-11-13 Ravi Pratap <ravi@ximian.com>
10413 * attribute.cs (Attribute.Resolve): Catch the
10414 NullReferenceException and report it since it isn't supposed to
10417 2002-11-12 Miguel de Icaza <miguel@ximian.com>
10419 * expression.cs (Binary.EmitBranchable): Also handle the cases for
10420 LogicalOr and LogicalAnd that can benefit from recursively
10421 handling EmitBranchable. The code now should be nice for Paolo.
10423 2002-11-08 Miguel de Icaza <miguel@ximian.com>
10425 * typemanager.cs (LookupType): Added a negative-hit hashtable for
10426 the Type lookups, as we perform quite a number of lookups on
10427 non-Types. This can be removed once we can deterministically tell
10428 whether we have a type or a namespace in advance.
10430 But this might require special hacks from our corlib.
10434 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
10435 and double which avoids a conversion from an integer to a double.
10437 * expression.cs: tiny optimization, avoid calling IsConstant,
10438 because it effectively performs the lookup twice.
10440 2002-11-06 Miguel de Icaza <miguel@ximian.com>
10442 But a bogus return here to keep the semantics of the old code
10443 until the Mono runtime is fixed.
10445 * pending.cs (GetMissingInterfaces): New method used to remove all
10446 the interfaces that are already implemented by our parent
10447 classes from the list of pending methods.
10449 * interface.cs: Add checks for calls after ResolveTypeExpr.
10451 2002-11-05 Miguel de Icaza <miguel@ximian.com>
10453 * class.cs (Class.Emit): Report warning 67: event not used if the
10454 warning level is beyond 3.
10456 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
10457 being a NullLiteral.
10459 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
10462 * class.cs (TypeContainer.GetClassBases): Cover a missing code
10463 path that might fail if a type can not be resolved.
10465 * expression.cs (Binary.Emit): Emit unsigned versions of the
10468 * driver.cs: use error 5.
10470 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
10472 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
10474 2002-11-01 Miguel de Icaza <miguel@ximian.com>
10476 * cs-parser.jay (switch_section): A beautiful patch from Martin
10477 Baulig that fixed 33094.
10479 2002-10-31 Miguel de Icaza <miguel@ximian.com>
10481 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
10482 Check whether the base is abstract and report an error if so.
10484 * expression.cs (IndexerAccess.DoResolveLValue,
10485 IndexerAccess.DoResolve): ditto.
10487 (Invocation.DoResolve): ditto.
10489 (Invocation.FullMethodDesc): Improve the report string.
10491 * statement.cs (Block): Eliminate IsVariableDefined as it is
10492 basically just a wrapper for GetVariableInfo.
10494 * ecore.cs (SimpleName): Use new
10496 * support.cs (ReflectionParamter.ParameterType): We unwrap the
10497 type, as we return the actual parameter ref/unref state on a
10500 2002-10-30 Miguel de Icaza <miguel@ximian.com>
10502 * support.cs: Return proper flags REF/OUT fixing the previous
10505 * expression.cs: Reverted last patch, that was wrong. Is_ref is
10506 not used to mean `ref' but `ref or out' in ParameterReference
10508 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
10509 full type signature instead of calling TypeManger.CSharpName
10512 * support.cs (InternalParameters.ParameterDesc): Do not compare
10513 directly to the modflags, because REF/OUT will actually be bitsets
10516 * delegate.cs (VerifyMethod): Check also the modifiers.
10518 * cs-tokenizer.cs: Fix bug where floating point values with an
10519 exponent where a sign was missing was ignored.
10521 * driver.cs: Allow multiple assemblies to be specified in a single
10524 2002-10-28 Miguel de Icaza <miguel@ximian.com>
10526 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
10527 because identifiers after a parenthesis would end up in this kind
10528 of production, and we needed to desamiguate it for having casts
10531 (UserDefinedType *) xxx
10533 2002-10-24 Miguel de Icaza <miguel@ximian.com>
10535 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
10536 we should set on the Bindingflags.NonPublic, but not turn on
10537 private_ok. private_ok controls whether a Private member is
10538 returned (this is chekced on the filter routine), while the
10539 BindingFlags.NonPublic just controls whether private/protected
10540 will be allowed. This fixes the problem part of the problem of
10541 private properties being allowed to be used in derived classes.
10543 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
10544 so we can call the children DoResolveLValue method (this will
10545 properly signal errors on lvalue assignments to base properties)
10547 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
10548 getter are null, and we have a property info, we know that this
10549 happened because the lookup failed, so we report an error 122 for
10550 protection level violation.
10552 We also silently return if setter and getter are null in the
10553 resolve functions, this condition only happens if we have flagged
10554 the error before. This is the other half of the problem.
10556 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
10557 not have accessibility information, that is why we were returning
10558 true in the filter function in typemanager.cs.
10560 To properly report 122 (property is inaccessible because of its
10561 protection level) correctly, we report this error in ResolveAccess
10562 by failing if both the setter and the getter are lacking (ie, the
10565 DoResolve and DoLResolve have been modified to check for both
10566 setter/getter being null and returning silently, the reason being
10567 that I did not want to put the knowledge about this error in upper
10570 int old = Report.Errors;
10571 x = new PropertyExpr (...);
10572 if (old != Report.Errors)
10577 So the property expr is returned, but it is invalid, so the error
10578 will be flagged during the resolve process.
10580 * class.cs: Remove InheritablePropertySignatureCompare from the
10581 class, as we no longer depend on the property signature to compute
10582 whether it is possible to implement a method or not.
10584 The reason is that calling PropertyInfo.GetGetMethod will return
10585 null (in .NET, in Mono it works, and we should change this), in
10586 cases where the Get Method does not exist in that particular
10591 class X { public virtual int A { get { return 1; } } }
10593 class Z : Y { public override int A { get { return 2; } } }
10595 Would fail in Z because the parent (Y) would not have the property
10596 defined. So we avoid this completely now (because the alternative
10597 fix was ugly and slow), and we now depend exclusively on the
10600 (PropertyBase.CheckBase): Use a method-base mechanism to find our
10601 reference method, instead of using the property.
10603 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
10604 routines are gone now.
10606 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
10607 names, they were incorrectly named.
10609 * cs-tokenizer.cs: Return are more gentle token on failure.
10611 * pending.cs (PendingImplementation.InterfaceMethod): This routine
10612 had an out-of-sync index variable, which caused it to remove from
10613 the list of pending methods the wrong method sometimes.
10615 2002-10-22 Miguel de Icaza <miguel@ximian.com>
10617 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
10618 CanWrite, because those refer to this particular instance of the
10619 property, and do not take into account the fact that we can
10620 override single members of a property.
10622 Constructor requires an EmitContext. The resolution process does
10623 not happen here, but we need to compute the accessors before,
10624 because the resolution does not always happen for properties.
10626 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10627 subclass, before we did not update this flag, but we did update
10630 (GetAccessors): Drop this routine, as it did not work in the
10631 presence of partially overwritten set/get methods.
10633 Notice that this broke the cs1540 detection, but that will require
10636 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10640 * driver.cs: issue a warning instead of an error if we don't support
10641 debugging for the platform. Also ignore a couple of errors that may
10642 arise when trying to write the symbols. Undo my previous patch.
10644 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10646 * driver.cs: ignore /debug switch except for Unix platforms.
10648 2002-10-23 Nick Drochak <ndrochak@gol.com>
10650 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10652 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10654 * driver.cs: Do not make mcs-debug conditional, so we do not break
10655 builds that use it.
10657 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10658 review this patch. But basically after all the children variables
10659 have been merged, the value of "Breaks" was not being set to
10660 new_breaks for Switch blocks. I think that it should be set after
10661 it has executed. Currently I set this to the value of new_breaks,
10662 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10663 conservative, but I do not understand this code very well.
10665 I did not break anything in the build, so that is good ;-)
10667 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10669 2002-10-20 Mark Crichton <crichton@gimp.org>
10671 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10673 2002-10-20 Nick Drochak <ndrochak@gol.com>
10675 * cfold.cs: Fixed compile blocker.
10677 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10679 * driver.cs: I was chekcing the key, not the file.
10681 2002-10-19 Ravi Pratap <ravi@ximian.com>
10683 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10684 message that we were generating - we just need to silently return
10687 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10689 * class.cs (Event.Define): Change my previous commit, as this
10690 breaks the debugger. This is a temporary hack, as it seems like
10691 the compiler is generating events incorrectly to begin with.
10693 * expression.cs (Binary.ResolveOperator): Added support for
10694 "U operator - (E x, E y)"
10696 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10699 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10700 init-only variables, but this path did not take into account that
10701 there might be also instance readonly variables. Correct this
10704 This fixes bug 32253
10706 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10709 * driver.cs: Change the extension for modules to `netmodule'
10711 * cs-parser.jay: Improved slightly the location tracking for
10712 the debugger symbols.
10714 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10715 modifiers that were specified instead of the hardcoded value
10716 (FamAndAssem). This was basically ignoring the static modifier,
10717 and others. Fixes 32429.
10719 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10720 fixed a bug in the process (32476)
10722 * expression.cs (ArrayAccess.EmitAssign): Patch from
10723 hwang_rob@yahoo.ca that fixes bug 31834.3
10725 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10727 * driver.cs: Make the module extension .netmodule.
10729 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10731 * driver.cs: Report an error if the resource file is not found
10732 instead of crashing.
10734 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10735 false, like Emit does.
10737 2002-10-16 Nick Drochak <ndrochak@gol.com>
10739 * typemanager.cs: Remove unused private member. Also reported mcs
10740 bug to report this as a warning like csc.
10742 2002-10-15 Martin Baulig <martin@gnome.org>
10744 * statement.cs (Statement.Emit): Made this a virtual method; emits
10745 the line number info and calls DoEmit().
10746 (Statement.DoEmit): New protected abstract method, formerly knows
10747 as Statement.Emit().
10749 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10751 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10753 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10754 have fixed a remaining problem: not every AddXXXX was adding a
10755 fully qualified name.
10757 Now everyone registers a fully qualified name in the DeclSpace as
10758 being defined instead of the partial name.
10760 Downsides: we are slower than we need to be due to the excess
10761 copies and the names being registered this way.
10763 The reason for this is that we currently depend (on the corlib
10764 bootstrap for instance) that types are fully qualified, because
10765 we dump all the types in the namespace, and we should really have
10766 types inserted into the proper namespace, so we can only store the
10767 basenames in the defined_names array.
10769 2002-10-10 Martin Baulig <martin@gnome.org>
10771 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10772 from bug #31834, see the bug report for a testcase which is
10775 2002-10-10 Martin Baulig <martin@gnome.org>
10777 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10778 flow analysis code for this.
10780 * statement.cs (Do, While, For): Tell the flow analysis code about
10782 (FlowBranching.UsageVector): Added support for infinite loops.
10783 (Block.Resolve): Moved the dead code elimination here and use flow
10786 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10788 * class.cs (Field.Define): Catch cycles on struct type
10791 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10792 fields if the fields are static. We only need to check instance
10795 * expression.cs (As.DoResolve): Test for reference type.
10797 * statement.cs (Using.ResolveExpression): Use
10798 ConvertImplicitRequired, not ConvertImplicit which reports an
10800 (Using.ResolveLocalVariableDecls): ditto.
10802 * expression.cs (Binary.ResolveOperator): Report errors in a few
10803 places where we had to.
10805 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10807 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10809 * expression.cs: Use StoreFromPtr instead of extracting the type
10810 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10812 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10813 an enumeration value to a System.Enum, but System.Enum is not a
10814 value type, but an class type, so we need to box.
10816 (Expression.ConvertExplicit): One codepath could return
10817 errors but not flag them. Fix this. Fixes #31853
10819 * parameter.cs (Resolve): Do not allow void as a parameter type.
10821 2002-10-06 Martin Baulig <martin@gnome.org>
10823 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10824 if it's a class type and not a struct. Fixes #31815.
10826 2002-10-06 Martin Baulig <martin@gnome.org>
10828 * statement.cs: Reworked the flow analysis code a bit to make it
10829 usable for dead code elimination.
10831 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10833 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10835 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10837 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10838 to fix the test 165, will investigate deeper.
10840 2002-10-04 Martin Baulig <martin@gnome.org>
10842 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10843 finally blocks actually work.
10844 (Try.Resolve): We don't need to create a sibling for `finally' if
10845 there is no finally block.
10847 2002-10-04 Martin Baulig <martin@gnome.org>
10849 * class.cs (Constructor.Define): The default accessibility for a
10850 non-default constructor is private, not public.
10852 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10854 * class.cs (Constructor): Make AllowedModifiers public, add
10857 * cs-parser.jay: Perform the modifiers test here, as the
10858 constructor for the Constructor class usually receives a zero
10859 because of the way we create it (first we create, later we
10860 customize, and we were never checking the modifiers).
10862 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10863 is a version of LookupTypeReflection that includes the type-name
10864 cache. This can be used as a fast path for functions that know
10865 the fully qualified name and are only calling into *.GetType() to
10866 obtain a composed type.
10868 This is also used by TypeManager.LookupType during its type
10871 (LookupType): We now also track the real type name, as sometimes
10872 we can get a quey for the real type name from things like
10873 ComposedCast. This fixes bug 31422.
10875 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10876 complete type fullname, it does not have to go through the type
10877 resolution system to obtain the composed version of the type (for
10878 obtaining arrays or pointers).
10880 (Conditional.Emit): Use the EmitBoolExpression to
10881 generate nicer code, as requested by Paolo.
10883 (ArrayCreation.CheckIndices): Use the patch from
10884 hwang_rob@yahoo.ca to validate the array initializers.
10886 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10888 * class.cs (ConstructorInitializer.Emit): simplify code by using
10889 Invocation.EmitCall, and at the same time, fix the bugs in calling
10890 parent constructors that took variable arguments.
10892 * ecore.cs (Expression.ConvertNumericExplicit,
10893 Expression.ImplicitNumericConversion): Remove the code that
10894 manually wrapped decimal (InternalTypeConstructor call is now gone
10897 * expression.cs (Cast.TryReduce): Also handle decimal types when
10898 trying to perform a constant fold on the type.
10900 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10902 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10903 that only turned off an error report, and did nothing else.
10905 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10907 * driver.cs: Handle and ignore /fullpaths
10909 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10911 * expression.cs (Binary.ResolveOperator): Catch the case where
10912 DoNumericPromotions returns true,
10914 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10916 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10918 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10921 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10923 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10924 conversion exists, but it is also required that the conversion be
10925 performed. This manifested in "(Type64Enum) 2".
10927 * class.cs (TypeManager.AddMethod): The fix is not to change
10928 AddEnum, because that one was using a fully qualified name (every
10929 DeclSpace derivative does), but to change the AddMethod routine
10930 that was using an un-namespaced name. This now correctly reports
10931 the duplicated name.
10933 Revert patch until I can properly fix it. The issue
10934 is that we have a shared Type space across all namespaces
10935 currently, which is wrong.
10937 Options include making the Namespace a DeclSpace, and merge
10938 current_namespace/current_container in the parser.
10940 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10942 * cs-parser.jay: Improve error reporting when we get a different
10943 kind of expression in local_variable_type and
10944 local_variable_pointer_type.
10946 Propagate this to avoid missleading errors being reported.
10948 * ecore.cs (ImplicitReferenceConversion): treat
10949 TypeManager.value_type as a target just like object_type. As
10954 Is valid, and needs to result in the int 1 being boxed before it
10955 is assigned to the value type v.
10957 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10958 to validate the enumeration name.
10960 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10961 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10962 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10964 * ecore.cs (TryImplicitIntConversion): When doing an
10965 implicit-enumeration-conversion, check if the type is 64-bits and
10966 perform a conversion before passing to EnumConstant.
10968 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10970 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10971 report ambiguous type references. Unlike the MS version, we
10972 report what the ambiguity is. Innovation at work ;-)
10974 (DeclSpace.FindType): Require a location argument to
10975 display when we display an ambiguous error.
10977 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10979 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10981 * expression.cs (EmitDynamicInitializers): Apply patch from
10982 hwang_rob@yahoo.ca that fixes the order in which we emit our
10985 2002-09-21 Martin Baulig <martin@gnome.org>
10987 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10988 delegate takes no arguments.
10990 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10992 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10995 * expression.cs: Extract the underlying type.
10997 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10999 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
11001 2002-09-19 Miguel de Icaza <miguel@ximian.com>
11003 * class.cs (TypeContainer.DefineType): We can not use the nice
11004 PackingSize with the size set to 1 DefineType method, because it
11005 will not allow us to define the interfaces that the struct
11008 This completes the fixing of bug 27287
11010 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
11011 means also structs. This fixes part of the problem.
11012 (Expresion.ImplicitReferenceConversionExists): ditto.
11014 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
11015 error if there were no errors reported during the type lookup
11016 process, to avoid duplicates or redundant errors. Without this
11017 you would get an ambiguous errors plus a type not found. We have
11018 beaten the user enough with the first error.
11020 (DeclSparce.FindType): Emit a warning if we have an ambiguous
11023 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
11024 during the resolution process, stop the lookup, this avoids
11025 repeated error reports (same error twice).
11027 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
11029 * typemanager.cs (LookupType): Redo the type lookup code to match
11030 the needs of System.Reflection.
11032 The issue is that System.Reflection requires references to nested
11033 types to begin with a "+" sign instead of a dot. So toplevel
11034 types look like: "NameSpace.TopLevelClass", and nested ones look
11035 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
11038 2002-09-19 Martin Baulig <martin@gnome.org>
11040 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
11041 says that a method always returns or always throws an exception,
11042 don't report the CS0161.
11044 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
11045 set `Returns = new_returns'.
11047 2002-09-19 Martin Baulig <martin@gnome.org>
11049 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
11050 to an enum constant, check for a CS0176.
11052 2002-09-18 Miguel de Icaza <miguel@ximian.com>
11054 * class.cs (TypeContainer.CheckPairedOperators): Now we check
11055 for operators that must be in pairs and report errors.
11057 * ecore.cs (SimpleName.DoResolveType): During the initial type
11058 resolution process, when we define types recursively, we must
11059 check first for types in our current scope before we perform
11060 lookups in the enclosing scopes.
11062 * expression.cs (MakeByteBlob): Handle Decimal blobs.
11064 (Invocation.VerifyArgumentsCompat): Call
11065 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
11066 I thought we were supposed to always call this, but there are a
11067 few places in the code where we dont do it.
11069 2002-09-17 Miguel de Icaza <miguel@ximian.com>
11071 * driver.cs: Add support in -linkres and -resource to specify the
11072 name of the identifier.
11074 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11076 * ecore.cs (StandardConversionExists): Sync with the conversion
11077 code: allow anything-* to void* conversions.
11079 (FindMostSpecificSource): Use an Expression argument
11080 instead of a Type, because we might be handed over a Literal which
11081 gets a few more implicit conversions that plain types do not. So
11082 this information was being lost.
11084 Also, we drop the temporary type-holder expression when not
11087 2002-09-17 Martin Baulig <martin@gnome.org>
11089 * class.cs (PropertyBase.CheckBase): Don't check the base class if
11090 this is an explicit interface implementation.
11092 2002-09-17 Martin Baulig <martin@gnome.org>
11094 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
11095 different `IndexerName' attributes.
11097 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
11098 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
11099 virtual CommonResolve().
11101 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11103 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
11104 and convert that to the UnderlyingType.
11106 * statement.cs (Foreach.Resolve): Indexers are just like variables
11107 or PropertyAccesses.
11109 * cs-tokenizer.cs (consume_string): Track line numbers and columns
11110 inside quoted strings, we were not doing this before.
11112 2002-09-16 Martin Baulig <martin@gnome.org>
11114 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
11115 resolve it. This is needed for the definite assignment check of the
11116 instance expression, fixes bug #29846.
11117 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
11119 2002-09-16 Nick Drochak <ndrochak@gol.com>
11121 * parameter.cs: Fix compile error. Cannot reference static member
11122 from an instance object. Is this an mcs bug?
11124 2002-09-14 Martin Baulig <martin@gnome.org>
11126 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
11127 multiple times. Fixes bug #30295, added test-166.cs.
11129 2002-09-14 Martin Baulig <martin@gnome.org>
11131 * statement.cs (Block.Emit): Don't emit unreachable code.
11132 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
11133 `break' statements.
11134 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
11136 2002-09-14 Martin Baulig <martin@gnome.org>
11138 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
11141 2002-09-14 Martin Baulig <martin@gnome.org>
11143 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
11144 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
11145 be false on the ms runtime.
11147 2002-09-13 Martin Baulig <martin@gnome.org>
11149 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
11150 the CS0038 error message.
11152 2002-09-12 Miguel de Icaza <miguel@ximian.com>
11154 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
11155 constant inside, return it.
11157 2002-09-12 Martin Baulig <martin@gnome.org>
11159 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
11160 implicit conversion can be done between enum types.
11162 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
11163 check whether an implicit conversion to the current enum's UnderlyingType
11164 exists and report an error if not.
11166 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
11167 without debugging support.
11169 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
11170 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
11172 2002-09-12 Martin Baulig <martin@gnome.org>
11174 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
11176 * ecore.cs (IMemberExpr.DeclaringType): New property.
11177 (SimpleName.SimpleNameResolve): Check whether we're accessing a
11178 nonstatic member of an outer type (CS0038).
11180 2002-09-11 Miguel de Icaza <miguel@ximian.com>
11182 * driver.cs: Activate the using-error detector at warning level
11183 4 (at least for MS-compatible APIs).
11185 * namespace.cs (VerifyUsing): Small buglett fix.
11187 * pending.cs (PendingImplementation): pass the container pointer.
11189 * interface.cs (GetMethods): Allow for recursive definition. Long
11190 term, I would like to move every type to support recursive
11191 definitions, not the current ordering mechanism that we have right
11194 The situation is this: Attributes are handled before interfaces,
11195 so we can apply attributes to interfaces. But some attributes
11196 implement interfaces, we will now handle the simple cases
11197 (recursive definitions will just get an error).
11199 * parameter.cs: Only invalidate types at the end if we fail to
11202 2002-09-09 Martin Baulig <martin@gnome.org>
11204 * ecore.cs (PropertyExpr.Emit): Also check for
11205 TypeManager.system_int_array_get_length so this'll also work when
11206 compiling corlib. Fixes #30003.
11208 2002-09-09 Martin Baulig <martin@gnome.org>
11210 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
11211 and throw an exception if we can't get the type's size. Fixed #30040,
11214 2002-09-09 Martin Baulig <martin@gnome.org>
11216 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
11218 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
11219 context. Fixes bug #30027.
11221 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
11222 virtual functions. Fixes bug #30043, added test-164.cs.
11224 2002-09-08 Ravi Pratap <ravi@ximian.com>
11226 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
11228 2002-09-08 Nick Drochak <ndrochak@gol.com>
11230 * driver.cs: Use an object to get the windows codepage since it's not a
11233 2002-09-08 Miguel de Icaza <miguel@ximian.com>
11235 * statement.cs (For.Emit): for infinite loops (test == null)
11236 return whether there is a break inside, not always "true".
11238 * namespace.cs (UsingEntry): New struct to hold the name of the
11239 using definition, the location where it is defined, and whether it
11240 has been used in a successful type lookup.
11242 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
11247 2002-09-06 Ravi Pratap <ravi@ximian.com>
11249 * attribute.cs : Fix incorrect code which relied on catching
11250 a NullReferenceException to detect a null being passed in
11251 where an object was expected.
11253 2002-09-06 Miguel de Icaza <miguel@ximian.com>
11255 * statement.cs (Try): flag the catch variable as assigned
11257 * expression.cs (Cast): Simplified by using ResolveType instead of
11258 manually resolving.
11260 * statement.cs (Catch): Fix bug by using ResolveType.
11262 2002-09-06 Ravi Pratap <ravi@ximian.com>
11264 * expression.cs (BetterConversion): Special case for when we have
11265 a NullLiteral as the argument and we have to choose between string
11266 and object types - we choose string the way csc does.
11268 * attribute.cs (Attribute.Resolve): Catch the
11269 NullReferenceException and report error #182 since the Mono
11270 runtime no more has the bug and having this exception raised means
11271 we tried to select a constructor which takes an object and is
11274 2002-09-05 Ravi Pratap <ravi@ximian.com>
11276 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
11277 message (1502, 1503) when we can't locate a method after overload
11278 resolution. This is much more informative and closes the bug
11281 * interface.cs (PopulateMethod): Return if there are no argument
11282 types. Fixes a NullReferenceException bug.
11284 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
11285 expressions too. Previously we were checking only in one place for
11286 positional arguments leaving out named arguments.
11288 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
11289 type to the enum type is not allowed. Remove code corresponding to
11292 (ConvertNumericExplicit): Allow explicit conversions from
11293 the underlying type to enum type. This precisely follows the spec
11294 and closes a bug filed by Gonzalo.
11296 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11299 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
11301 2002-09-03 Miguel de Icaza <miguel@ximian.com>
11303 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
11304 it was important that we stored the right value after the
11305 reduction in `converted'.
11307 2002-09-04 Martin Baulig <martin@gnome.org>
11309 * location.cs (Location.SymbolDocument): Use full pathnames for the
11312 2002-08-30 Miguel de Icaza <miguel@ximian.com>
11314 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
11315 of the expression resolve mechanism, because that will catch the
11316 SimpleName error failures.
11318 (Conditional): If we can not resolve the
11319 expression, return, do not crash.
11321 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11324 (location): display token name instead of its number.
11326 2002-08-28 Martin Baulig <martin@gnome.org>
11328 * expression.cs (Binary.ResolveOperator): Don't silently return
11329 but return an error if an operator cannot be applied between two
11332 2002-08-28 Martin Baulig <martin@gnome.org>
11334 * class.cs (Constructor.Define): Set the permission attributes
11335 correctly instead of making all constructors public.
11337 2002-08-28 Martin Baulig <martin@gnome.org>
11339 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
11340 for private members before reporting a CS0103; if we find anything,
11343 2002-08-28 Martin Baulig <martin@gnome.org>
11345 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
11346 to check whether `closure_start_type == closure_invocation_type',
11347 we also need to check whether `m.DeclaringType == closure_invocation_type'
11348 before bypassing the permission checks. We might be accessing
11349 protected/private members from the base class.
11350 (TypeManager.RealMemberLookup): Only set private_ok if private
11351 members were requested via BindingFlags.NonPublic.
11353 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
11355 * expression.cs (MemberAccess.ResolveMemberAccess): Set
11356 MethodGroupExpr.IsExplicitImpl if appropriate.
11357 (Invocation.DoResolve): Don't report the CS0120 for explicit
11358 interface implementations.
11360 2002-08-27 Martin Baulig <martin@gnome.org>
11362 * expression.cs (Invocation.DoResolve): If this is a static
11363 method and we don't have an InstanceExpression, we must report
11366 2002-08-25 Martin Baulig <martin@gnome.org>
11368 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
11369 `==' between a valuetype and an object.
11371 2002-08-25 Miguel de Icaza <miguel@ximian.com>
11373 * ecore.cs (TypeExpr): Provide a ToString method.
11375 2002-08-24 Martin Baulig <martin@gnome.org>
11377 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
11378 now called proggie.dbg and it's a binary file.
11380 2002-08-23 Martin Baulig <martin@gnome.org>
11382 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
11384 2002-08-23 Martin Baulig <martin@gnome.org>
11386 * struct.cs (MyStructInfo.ctor): Make this work with empty
11387 structs; it's not allowed to use foreach() on null.
11389 2002-08-23 Martin Baulig <martin@gnome.org>
11391 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
11392 writer the full pathname of the generated assembly.
11394 2002-08-23 Martin Baulig <martin@gnome.org>
11396 * statements.cs (FlowBranching.UsageVector.MergeChildren):
11397 A `finally' block never returns or breaks; improved handling of
11400 2002-08-23 Martin Baulig <martin@gnome.org>
11402 * statement.cs (Throw.Resolve): Allow `throw null'.
11404 2002-08-23 Martin Baulig <martin@gnome.org>
11406 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
11407 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
11408 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
11409 MemberLookup would return a wrong event if this is an explicit
11410 interface implementation and the class has an event with the same
11413 2002-08-23 Martin Baulig <martin@gnome.org>
11415 * statement.cs (Block.AddChildVariableNames): New public method.
11416 (Block.AddChildVariableName): Likewise.
11417 (Block.IsVariableNameUsedInChildBlock): Likewise.
11418 (Block.AddVariable): Check whether a variable name has already
11419 been used in a child block.
11421 * cs-parser.jay (declare_local_variables): Mark all variable names
11422 from the current block as being used in a child block in the
11425 2002-08-23 Martin Baulig <martin@gnome.org>
11427 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
11428 find the symbol writer.
11430 * driver.cs: csc also allows the arguments to /define being
11431 separated by commas, not only by semicolons.
11433 2002-08-23 Martin Baulig <martin@gnome.org>
11435 * interface.cs (Interface.GetMembers): Added static check for events.
11437 2002-08-15 Martin Baulig <martin@gnome.org>
11439 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
11440 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
11442 * ecore.cs (Expression.MemberLookup): Added documentation and explained
11443 why the MethodData.EmitDestructor() change was necessary.
11445 2002-08-20 Martin Baulig <martin@gnome.org>
11447 * class.cs (TypeContainer.FindMembers): Added static check for events.
11449 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
11451 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
11452 use Type.GetEvents(), not Type.FindMembers().
11454 2002-08-20 Martin Baulig <martin@gnome.org>
11456 * decl.cs (MemberCache): Added a special method cache which will
11457 be used for method-only searched. This ensures that a method
11458 search will return a MethodInfo with the correct ReflectedType for
11461 2002-08-20 Martin Baulig <martin@gnome.org>
11463 * decl.cs (DeclSpace.FindMembers): Made this public.
11465 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11467 * delegate.cs: fixed build on windows.
11468 [FIXME: Filed as bug #29150: MCS must report these errors.]
11470 2002-08-19 Ravi Pratap <ravi@ximian.com>
11472 * ecore.cs (StandardConversionExists): Return a false
11473 if we are trying to convert the void type to anything else
11474 since that is not allowed.
11476 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
11477 we flag error 70 in the event an event is trying to be accessed
11478 directly from outside the declaring type.
11480 2002-08-20 Martin Baulig <martin@gnome.org>
11482 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
11483 MemberCache from typemanager.cs to decl.cs.
11485 2002-08-19 Martin Baulig <martin@gnome.org>
11487 * class.cs (TypeContainer): Implement IMemberContainer.
11488 (TypeContainer.DefineMembers): Create the MemberCache.
11489 (TypeContainer.FindMembers): Do better BindingFlags checking; only
11490 return public members if BindingFlags.Public was given, check
11491 whether members are static.
11493 2002-08-16 Martin Baulig <martin@gnome.org>
11495 * decl.cs (DeclSpace.Define): Splitted this in Define and
11496 DefineMembers. DefineMembers is called first and initializes the
11499 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
11500 DefineMembers() on all our DeclSpaces.
11502 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
11503 but call DefineMembers() on all nested interfaces. We call their
11504 Define() in our new Define() function.
11506 * interface.cs (Interface): Implement IMemberContainer.
11507 (Interface.Define): Moved all code except the attribute stuf to
11509 (Interface.DefineMembers): Initialize the member cache.
11511 * typemanager.cs (IMemberFinder): Removed this interface, we don't
11512 need this anymore since we can use MemberCache.FindMembers directly.
11514 2002-08-19 Martin Baulig <martin@gnome.org>
11516 * typemanager.cs (MemberCache): When creating the cache for an
11517 interface type, add all inherited members.
11518 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
11519 to `out bool used_cache' and documented it.
11520 (TypeManager.MemberLookup): If we already used the cache in the first
11521 iteration, we don't need to do the interfaces check.
11523 2002-08-19 Martin Baulig <martin@gnome.org>
11525 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
11526 here from IMemberFinder and don't implement this interface anymore.
11527 (DeclSpace.MemberCache): Moved here from IMemberFinder.
11529 * typemanager.cs (IMemberFinder): This interface is now only used by
11530 classes which actually support the member cache.
11531 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
11532 since we only put DeclSpaces into this Hashtable.
11533 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
11534 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
11536 2002-08-16 Martin Baulig <martin@gnome.org>
11538 * typemanager.cs (ICachingMemberFinder): Removed.
11539 (IMemberFinder.MemberCache): New property.
11540 (TypeManager.FindMembers): Merged this with RealFindMembers().
11541 This function will never be called from TypeManager.MemberLookup()
11542 so we can't use the cache here, just the IMemberFinder.
11543 (TypeManager.MemberLookup_FindMembers): Check whether the
11544 IMemberFinder has a MemberCache and call the cache's FindMembers
11546 (MemberCache): Rewrote larger parts of this yet another time and
11547 cleaned it up a bit.
11549 2002-08-15 Miguel de Icaza <miguel@ximian.com>
11551 * driver.cs (LoadArgs): Support quoting.
11553 (Usage): Show the CSC-like command line arguments.
11555 Improved a few error messages.
11557 2002-08-15 Martin Baulig <martin@gnome.org>
11559 * typemanager.cs (IMemberContainer.Type): New property.
11560 (IMemberContainer.IsInterface): New property.
11562 The following changes are conditional to BROKEN_RUNTIME, which is
11563 defined at the top of the file.
11565 * typemanager.cs (MemberCache.MemberCache): Don't add the base
11566 class'es members, but add all members from TypeHandle.ObjectType
11567 if we're an interface.
11568 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
11569 is the current type.
11570 (MemberCache.CacheEntry.Container): Removed this field.
11571 (TypeHandle.GetMembers): Include inherited members.
11573 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11575 * typemanager.cs: fixed compilation and added a comment on a field that
11578 2002-08-15 Martin Baulig <martin@gnome.org>
11580 * class.cs (ConstructorInitializer.Resolve): In the
11581 Expression.MemberLookup call, use the queried_type as
11584 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
11585 declared' attribute, it's always true.
11586 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
11587 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
11588 temporary wrapper for FindMembers which tells MemberLookup whether
11589 members from the base classes are included in the return value.
11590 This will go away soon.
11591 (TypeManager.MemberLookup): Use this temporary hack here; once the
11592 new MemberCache is completed, we don't need to do the DeclaredOnly
11593 looping here anymore since the MemberCache will take care of this.
11594 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
11595 (MemberCache): When creating the MemberCache for a class, get
11596 members from the current class and all its base classes.
11597 (MemberCache.CacheEntry.Container): New field. This is a
11598 temporary hack until the Mono runtime is fixed to distinguish
11599 between ReflectedType and DeclaringType. It allows us to use MCS
11600 with both the MS runtime and the unfixed Mono runtime without
11601 problems and without accecting performance.
11602 (MemberCache.SearchMembers): The DeclaredOnly looping from
11603 TypeManager.MemberLookup is now done here.
11605 2002-08-14 Martin Baulig <martin@gnome.org>
11607 * statement.cs (MyStructInfo.MyStructInfo): Don't call
11608 Type.GetFields on dynamic types but get the fields from the
11609 corresponding TypeContainer.
11610 (MyStructInfo.GetStructInfo): Added check for enum types.
11612 * typemanager.cs (MemberList.IsSynchronized): Implemented.
11613 (MemberList.SyncRoot): Implemented.
11614 (TypeManager.FilterWithClosure): No need to check permissions if
11615 closure_start_type == closure_invocation_type, don't crash if
11616 closure_invocation_type is null.
11618 2002-08-13 Martin Baulig <martin@gnome.org>
11620 Rewrote TypeContainer.FindMembers to use a member cache. This
11621 gives us a speed increase of about 35% for the self-hosting MCS
11622 build and of about 15-20% for the class libs (both on GNU/Linux).
11624 * report.cs (Timer): New class to get enhanced profiling. This
11625 whole class is "TIMER" conditional since it remarkably slows down
11628 * class.cs (MemberList): New class. This is an IList wrapper
11629 which we're now using instead of passing MemberInfo[]'s around to
11630 avoid copying this array unnecessarily.
11631 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11632 (ICachingMemberFinder, IMemberContainer): New interface.
11633 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11634 has already been checked, otherwise use it for the name comparision.
11635 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11636 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11637 if possible. Returns a MemberList, not a MemberInfo [].
11638 (TypeHandle): New class, implements IMemberContainer. We create
11639 one instance of this class per type, it contains a MemberCache
11640 which is used to do the member lookups.
11641 (MemberCache): New class. Each instance of this class contains
11642 all members of a type and a name-based hash table.
11643 (MemberCache.FindMembers): This is our new member lookup
11644 function. First, it looks up all members of the requested name in
11645 the hash table. Then, it walks this list and sorts out all
11646 applicable members and returns them.
11648 2002-08-13 Martin Baulig <martin@gnome.org>
11650 In addition to a nice code cleanup, this gives us a performance
11651 increase of about 1.4% on GNU/Linux - not much, but it's already
11652 half a second for the self-hosting MCS compilation.
11654 * typemanager.cs (IMemberFinder): New interface. It is used by
11655 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11656 Enum, Delegate or Interface.
11657 (TypeManager.finder_to_member_finder): New PtrHashtable.
11658 (TypeManager.finder_to_container): Removed.
11659 (TypeManager.finder_to_delegate): Removed.
11660 (TypeManager.finder_to_interface): Removed.
11661 (TypeManager.finder_to_enum): Removed.
11663 * interface.cs (Interface): Implement IMemberFinder.
11665 * delegate.cs (Delegate): Implement IMemberFinder.
11667 * enum.cs (Enum): Implement IMemberFinder.
11669 * class.cs (TypeContainer): Implement IMemberFinder.
11671 2002-08-12 Martin Baulig <martin@gnome.org>
11673 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11675 2002-08-12 Martin Baulig <martin@gnome.org>
11677 * ecore.cs (ITypeExpression): New interface for expressions which
11679 (TypeExpression): Renamed to TypeLookupExpression.
11680 (Expression.DoResolve): If we're doing a types-only lookup, the
11681 expression must implement the ITypeExpression interface and we
11682 call DoResolveType() on it.
11683 (SimpleName): Implement the new ITypeExpression interface.
11684 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11685 hack, the situation that we're only looking up types can't happen
11686 anymore when this method is called. Moved the type lookup code to
11687 DoResolveType() and call it.
11688 (SimpleName.DoResolveType): This ITypeExpression interface method
11689 is now doing the types-only lookup.
11690 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11691 (ResolveFlags): Added MaskExprClass.
11693 * expression.cs (MemberAccess): Implement the ITypeExpression
11695 (MemberAccess.DoResolve): Added support for a types-only lookup
11696 when we're called via ITypeExpression.DoResolveType().
11697 (ComposedCast): Implement the ITypeExpression interface.
11699 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11700 Expression.Resolve() with ResolveFlags.Type instead.
11702 2002-08-12 Martin Baulig <martin@gnome.org>
11704 * interface.cs (Interface.Define): Apply attributes.
11706 * attribute.cs (Attribute.ApplyAttributes): Added support for
11707 interface attributes.
11709 2002-08-11 Martin Baulig <martin@gnome.org>
11711 * statement.cs (Block.Emit): Only check the "this" variable if we
11712 do not always throw an exception.
11714 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11715 whether the property has a set accessor.
11717 2002-08-11 Martin Baulig <martin@gnome.org>
11719 Added control flow analysis support for structs.
11721 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11722 with control flow analysis turned off.
11723 (IVariable): New interface.
11724 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11725 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11726 (FieldExpr.DoResolve): Resolve the instance expression with flow
11727 analysis turned off and do the definite assignment check after the
11728 resolving when we know what the expression will resolve to.
11730 * expression.cs (LocalVariableReference, ParameterReference):
11731 Implement the new IVariable interface, only call the flow analysis
11732 code if ec.DoFlowAnalysis is true.
11733 (This): Added constructor which takes a Block argument. Implement
11734 the new IVariable interface.
11735 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11736 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11737 This does the definite assignment checks for struct members.
11739 * class.cs (Constructor.Emit): If this is a non-static `struct'
11740 constructor which doesn't have any initializer, call
11741 Block.AddThisVariable() to tell the flow analysis code that all
11742 struct elements must be initialized before control returns from
11745 * statement.cs (MyStructInfo): New public class.
11746 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11747 argument to this indexer. If non-zero, check an individual struct
11748 member, not the whole struct.
11749 (FlowBranching.CheckOutParameters): Check struct members.
11750 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11751 overloaded versions of these methods which take an additional
11752 `int field_idx' argument to check struct members.
11753 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11754 overloaded versions of these methods which take an additional
11755 `string field_name' argument to check struct member.s
11756 (VariableInfo): Implement the IVariable interface.
11757 (VariableInfo.StructInfo): New public property. Returns the
11758 MyStructInfo instance of the variable if it's a struct or null.
11759 (Block.AddThisVariable): New public method. This is called from
11760 Constructor.Emit() for non-static `struct' constructor which do
11761 not have any initializer. It creates a special variable for the
11762 "this" instance variable which will be checked by the flow
11763 analysis code to ensure that all of the struct's fields are
11764 initialized before control returns from the constructor.
11765 (UsageVector): Added support for struct members. If a
11766 variable/parameter is a struct with N members, we reserve a slot
11767 in the usage vector for each member. A struct is considered fully
11768 initialized if either the struct itself (slot 0) or all its
11769 members are initialized.
11771 2002-08-08 Martin Baulig <martin@gnome.org>
11773 * driver.cs (Driver.MainDriver): Only report an error CS5001
11774 if there were no compilation errors.
11776 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11777 `UnsafeContext' property to determine whether the parent is in
11778 unsafe context rather than checking the parent's ModFlags:
11779 classes nested in an unsafe class are unsafe as well.
11781 2002-08-08 Martin Baulig <martin@gnome.org>
11783 * statement.cs (UsageVector.MergeChildren): Distinguish between
11784 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11785 we return. Added test17() and test18() to test-154.cs.
11787 2002-08-08 Martin Baulig <martin@gnome.org>
11789 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11790 Family access, make sure the invoking type isn't a subclass of the
11791 queried type (that'd be a CS1540).
11793 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11794 this method which takes an additional `Type invocation_type'.
11796 * expression.cs (BaseAccess.DoResolve): Use the base type as
11797 invocation and query type.
11798 (MemberAccess.DoResolve): If the lookup failed and we're about to
11799 report a CS0122, try a lookup with the ec.ContainerType - if this
11800 succeeds, we must report a CS1540.
11802 2002-08-08 Martin Baulig <martin@gnome.org>
11804 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11805 (MethodGroupExpr): Implement the IMemberExpr interface.
11807 * expression (MemberAccess.ResolveMemberAccess): No need to have
11808 any special code for MethodGroupExprs anymore, they're now
11811 2002-08-08 Martin Baulig <martin@gnome.org>
11813 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11814 Family, FamANDAssem and FamORAssem permissions.
11815 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11817 2002-08-08 Martin Baulig <martin@gnome.org>
11819 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11820 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11823 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11825 * driver.cs: implemented /resource option to embed managed resources.
11827 2002-08-07 Martin Baulig <martin@gnome.org>
11829 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11830 (FieldBase.HasFieldInitializer): New public property.
11831 (FieldBase.GetInitializerExpression): New public method. Resolves and
11832 returns the field initializer and makes sure it is only resolved once.
11833 (TypeContainer.EmitFieldInitializers): Call
11834 FieldBase.GetInitializerExpression to get the initializer, this ensures
11835 that it isn't resolved multiple times.
11837 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11838 the resolving process (SimpleName/MemberLookup) that we're currently
11839 emitting a field initializer (which must not access any instance members,
11840 this is an error CS0236).
11842 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11843 argument, if the `IsFieldInitializer' flag is set, we must report and
11844 error CS0236 and not an error CS0120.
11846 2002-08-07 Martin Baulig <martin@gnome.org>
11848 * ecore.cs (IMemberExpr): New public interface.
11849 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11850 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11851 if the expression is an IMemberExpr.
11853 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11854 to be null, implicitly default to `this' if we're non-static in
11855 this case. Simplified the code a lot by using the new IMemberExpr
11856 interface. Also fixed bug #28176 here.
11858 2002-08-06 Martin Baulig <martin@gnome.org>
11860 * cs-parser.jay (SimpleLookup): Removed. We need to create
11861 ParameterReferences during semantic analysis so that we can do a
11862 type-only search when resolving Cast, TypeOf and SizeOf.
11863 (block): Pass the `current_local_parameters' to the Block's
11866 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11867 argument to the constructor.
11868 (ConstructorInitializer.Resolve): Create a temporary implicit
11869 block with the parameters.
11871 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11872 references here if we aren't doing a type-only search.
11874 * statement.cs (Block): Added constructor which takes a
11875 `Parameters parameters' argument.
11876 (Block.Parameters): New public property.
11878 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11879 to `Parameters' and made it public readonly.
11881 2002-08-06 Martin Baulig <martin@gnome.org>
11883 * ecore.cs (Expression.Warning): Made this public as well.
11885 * report.cs (Report.Debug): Print the contents of collections.
11887 2002-08-06 Martin Baulig <martin@gnome.org>
11889 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11890 used to tell Resolve() which kinds of expressions it may return.
11891 (Expression.Resolve): Added overloaded version of this method which
11892 takes a `ResolveFlags flags' argument. This can be used to tell
11893 Resolve() which kinds of expressions it may return. Reports a
11895 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11896 ResolveFlags.SimpleName.
11897 (Expression.Error118): Added overloaded version of this method which
11898 takes a `ResolveFlags flags' argument. It uses the flags to determine
11899 which kinds of expressions are allowed.
11901 * expression.cs (Argument.ResolveMethodGroup): New public method.
11902 Resolves an argument, but allows a MethodGroup to be returned.
11903 This is used when invoking a delegate.
11905 * TODO: Updated a bit.
11907 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11909 Fixed compilation with csc.
11911 * ecore.cs: Expression.Error made public. Is this correct? Should
11912 Warning be made public too?
11914 * expression.cs: use ea.Location instead of ea.loc.
11915 [FIXME: Filed as bug #28607: MCS must report these errors.]
11917 2002-08-06 Martin Baulig <martin@gnome.org>
11919 * ecore.cs (Expression.loc): Moved the location here instead of
11920 duplicating it in all derived classes.
11921 (Expression.Location): New public property.
11922 (Expression.Error, Expression.Warning): Made them non-static and
11923 removed the location argument.
11924 (Expression.Warning): Added overloaded version which takes an
11925 `int level' argument.
11926 (Expression.Error118): Make this non-static and removed the
11927 expression and location arguments.
11928 (TypeExpr): Added location argument to the constructor.
11930 * expression.cs (StaticCallExpr): Added location argument to
11932 (Indirection, PointerArithmetic): Likewise.
11933 (CheckedExpr, UnCheckedExpr): Likewise.
11934 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11935 (StringPtr): Likewise.
11938 2002-08-05 Martin Baulig <martin@gnome.org>
11940 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11942 * assign.cs (Assign.DoResolve): Check whether the source
11943 expression is a value or variable.
11945 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11946 while resolving the corresponding blocks.
11948 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11949 an error, don't silently return null.
11951 * statement.cs (Block.AddVariable): Do the error reporting here
11952 and distinguish between CS0128 and CS0136.
11953 (Block.DoResolve): Report all unused labels (warning CS0164).
11954 (LabeledStatement): Pass the location to the constructor.
11955 (LabeledStatement.HasBeenReferenced): New property.
11956 (LabeledStatement.Resolve): Set it to true here.
11958 * statement.cs (Return.Emit): Return success even after reporting
11959 a type mismatch error (CS0126 or CS0127), this is what csc does and
11960 it avoids confusing the users with any consecutive errors.
11962 2002-08-05 Martin Baulig <martin@gnome.org>
11964 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11966 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11968 * expression.cs (MemberAccess.DoResolve): Silently return if an
11969 error has already been reported.
11971 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11972 error has already been reported.
11974 2002-08-05 Martin Baulig <martin@gnome.org>
11976 * statement.cs (UsageVector): Only initialize the `parameters'
11977 vector if we actually have any "out" parameters.
11979 2002-08-05 Martin Baulig <martin@gnome.org>
11981 * expression.cs (Binary.ResolveOperator): When combining delegates,
11982 they must have the same type.
11984 2002-08-05 Martin Baulig <martin@gnome.org>
11986 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11987 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11988 work with the ms runtime and we also don't need it: if we're a
11989 PropertyBuilder and not in the `indexer_arguments' hash, then we
11990 are a property and not an indexer.
11992 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11993 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11994 since the latter one doesn't work with the ms runtime.
11996 2002-08-03 Martin Baulig <martin@gnome.org>
11998 Fixed bugs #27998 and #22735.
12000 * class.cs (Method.IsOperator): New public field.
12001 (Method.CheckBase): Report CS0111 if there's already a method
12002 with the same parameters in the current class. Report CS0508 when
12003 attempting to change the return type of an inherited method.
12004 (MethodData.Emit): Report CS0179 if a method doesn't have a body
12005 and it's not marked abstract or extern.
12006 (PropertyBase): New abstract base class for Property and Indexer.
12007 (PropertyBase.CheckBase): Moved here from Property and made it work
12009 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
12010 the same so we can reuse it there.
12011 (Property, Indexer): Derive from PropertyBase.
12012 (MethodSignature.inheritable_property_signature_filter): New delegate
12013 to find properties and indexers.
12015 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
12016 argument and improved error reporting.
12018 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
12019 EmptyReadOnlyParameters and made it a property.
12021 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
12022 version of this method which takes a `PropertyInfo indexer'.
12023 (TypeManager.RegisterIndexer): New method.
12025 * class.cs: Added myself as author of this file :-)
12027 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12029 * class.cs: fixed compilation on windoze.
12031 2002-08-03 Martin Baulig <martin@gnome.org>
12033 * interface.cs (Interface.GetInterfaceBases): Check whether all
12034 base interfaces are at least as accessible than the current one.
12036 * class.cs (TypeContainer.GetClassBases): Check whether base types
12037 are at least as accessible than the current type.
12038 (TypeContainer.AsAccessible): Implemented and made non-static.
12039 (MemberBase.CheckParameters): Report errors if the accessibility
12042 * delegate.cs (Delegate.Delegate): The default visibility is
12043 internal for top-level types and private for nested types.
12044 (Delegate.Define): Report errors if the accessibility checks fail.
12046 * enum.cs (Enum.Enum): The default visibility is internal for
12047 top-level types and private for nested types.
12048 (Enum.DefineType): Compute the correct visibility.
12050 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
12051 function which takes a `bool is_toplevel' instead of a TypeContainer.
12053 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
12056 2002-08-02 Martin Baulig <martin@gnome.org>
12058 * expression.cs (LocalVariableReferenc): Added constructor which
12059 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
12060 (LocalVariableReference.IsReadOnly): New property.
12061 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
12062 variable is readonly, use our own readonly flag to do this; you can
12063 use the new constructor to get a writable reference to a read-only
12066 * cs-parser.jay (foreach_statement, using_statement): Get a writable
12067 reference to the local variable.
12069 2002-08-01 Miguel de Icaza <miguel@ximian.com>
12071 * rootcontext.cs (ResolveCore): Also include System.Exception
12073 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
12074 we reach an EmptyStatement.
12076 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
12079 * expression.cs (Binary.ResolveOperator): Check error result in
12082 use brtrue/brfalse directly and avoid compares to null.
12084 2002-08-02 Martin Baulig <martin@gnome.org>
12086 * class.cs (TypeContainer.Define): Define all nested interfaces here.
12087 Fixes bug #28407, added test-155.cs.
12089 2002-08-01 Martin Baulig <martin@gnome.org>
12091 * class.cs (Event.EmitDefaultMethod): Make this work with static
12092 events. Fixes #28311, added verify-3.cs.
12094 2002-08-01 Martin Baulig <martin@gnome.org>
12096 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
12097 `is_disposable' fields.
12098 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
12099 `hm.is_disposable' if we're using the collection pattern.
12100 (Foreach.EmitCollectionForeach): Use the correct type for the
12101 enumerator's local variable, only emit the try/finally block if
12102 necessary (fixes #27713).
12104 2002-08-01 Martin Baulig <martin@gnome.org>
12106 * ecore.cs (Expression.report118): Renamed to Error118 and made
12109 * statement.cs (Throw.Resolve): Check whether the expression is of
12110 the correct type (CS0118) and whether the type derives from
12111 System.Exception (CS0155).
12112 (Catch.Resolve): New method. Do the type lookup here and check
12113 whether it derives from System.Exception (CS0155).
12114 (Catch.CatchType, Catch.IsGeneral): New public properties.
12116 * typemanager.cs (TypeManager.exception_type): Added.
12118 2002-07-31 Miguel de Icaza <miguel@ximian.com>
12120 * driver.cs: Updated About function.
12122 2002-07-31 Martin Baulig <martin@gnome.org>
12124 Implemented Control Flow Analysis.
12126 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
12127 (EmitContext.CurrentBranching): Added.
12128 (EmitContext.StartFlowBranching): Added.
12129 (EmitContext.EndFlowBranching): Added.
12130 (EmitContext.KillFlowBranching): Added.
12131 (EmitContext.IsVariableAssigned): Added.
12132 (EmitContext.SetVariableAssigned): Added.
12133 (EmitContext.IsParameterAssigned): Added.
12134 (EmitContext.SetParameterAssigned): Added.
12135 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
12136 Added control flow analysis stuff here.
12138 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
12139 resolve the expression as lvalue.
12140 (LocalVariableReference.DoResolve): Check whether the variable has
12141 already been assigned.
12142 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
12143 the parameter as assigned here.
12144 (ParameterReference.DoResolve): Check whether the parameter has already
12146 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
12147 expression as lvalue.
12149 * statement.cs (FlowBranching): New class for the flow analysis code.
12150 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
12151 (LabeledStatement.IsDefined): New public property.
12152 (LabeledStatement.AddUsageVector): New public method to tell flow
12153 analyis that the label may be reached via a forward jump.
12154 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
12156 (VariableInfo.Number): New public field. This is used by flow analysis
12157 to number all locals of a block.
12158 (Block.CountVariables): New public property. This is the number of
12159 local variables in this block (including the locals from all parent
12161 (Block.EmitMeta): Number all the variables.
12163 * statement.cs: Added flow analysis support to all classes.
12165 2002-07-31 Martin Baulig <martin@gnome.org>
12167 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
12168 To get debugging messages, compile mcs with /define:MCS_DEBUG and
12169 then use this argument.
12171 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
12173 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
12174 use this to specify /define options.
12176 2002-07-29 Martin Baulig <martin@gnome.org>
12178 * statement.cs (Fixed): Moved all code that does variable lookups
12179 and resolvings from Emit to Resolve.
12181 * statement.cs (For): Moved all code that does variable lookups
12182 and resolvings from Emit to Resolve.
12184 * statement.cs (Using): Moved all code that does variable lookups
12185 and resolvings from Emit to Resolve.
12187 2002-07-29 Martin Baulig <martin@gnome.org>
12189 * attribute.cs (Attribute.Resolve): Explicitly catch a
12190 System.NullReferenceException when creating the
12191 CustromAttributeBuilder and report a different warning message.
12193 2002-07-29 Martin Baulig <martin@gnome.org>
12195 * support.cs (ParameterData.ParameterName): Added method to
12196 get the name of a parameter.
12198 * typemanager.cs (TypeManager.IsValueType): New public method.
12200 2002-07-29 Martin Baulig <martin@gnome.org>
12202 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
12203 is a flag which specifies that it's either ref or out.
12204 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
12205 the out parameter to `out Parameter.Modifier mod', also set the
12206 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
12208 * support.cs (InternalParameters.ParameterModifier): Distinguish
12209 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12210 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12212 * expression.cs (Argument.GetParameterModifier): Distinguish
12213 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12214 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12216 2002-07-29 Martin Baulig <martin@gnome.org>
12218 * expression.cs (ParameterReference.ParameterReference): Added
12219 `Location loc' argument to the constructor.
12221 * cs-parser.jay: Pass location to ParameterReference.
12223 2002-07-28 Miguel de Icaza <miguel@ximian.com>
12225 * statement.cs (Try): Initialize the location.
12227 * cs-parser.jay: pass location to Try.
12229 * expression.cs (Unary.Reduce): Change the prototype to return
12230 whether a constant fold could be performed or not. The result is
12231 returned in an out parameters. In the case of Indirection and
12232 AddressOf, we want to perform the full tests.
12234 2002-07-26 Miguel de Icaza <miguel@ximian.com>
12236 * statement.cs (Statement.Emit): Flag dead code.
12238 2002-07-27 Andrew Birkett <andy@nobugs.org>
12240 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
12242 2002-07-27 Martin Baulig <martin@gnome.org>
12244 * class.cs (MethodData.Define): Put back call to
12245 TypeManager.AddMethod(), accidentally commented this out.
12247 * report.cs (Debug): New public method to print debugging information,
12248 this is `[Conditional ("DEBUG")]'.
12250 2002-07-26 Martin Baulig <martin@gnome.org>
12252 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
12253 (switch_statement): Push the current_block to the switch_stack and
12254 pop it again when we're done with the switch.
12255 (switch_section): The new block is a child of the current_block.
12256 Fixes bug #24007, added test-152.cs.
12258 2002-07-27 Martin Baulig <martin@gnome.org>
12260 * expression.cs (Invocation.EmitArguments): When calling a varargs
12261 function with only its fixed arguments, we need to pass an empty
12264 2002-07-27 Martin Baulig <martin@gnome.org>
12266 Mono 0.13 has been released.
12268 2002-07-25 Miguel de Icaza <miguel@ximian.com>
12270 * driver.cs: Rename --resource to --linkres, because that is what
12271 we do currently, we dont support --resource yet.
12273 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
12275 2002-07-25 Martin Baulig <martin@gnome.org>
12277 * class.cs (MethodData): New public class. This is a `method builder'
12278 class for a method or one accessor of a Property/Indexer/Event.
12279 (MethodData.GetMethodFlags): Moved here from MemberBase.
12280 (MethodData.ApplyAttributes): Likewise.
12281 (MethodData.ApplyObsoleteAttribute): Likewise.
12282 (MethodData.ApplyConditionalAttribute): Likewise.
12283 (MethodData.ApplyDllImportAttribute): Likewise.
12284 (MethodData.CheckAbstractAndExternal): Likewise.
12285 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
12286 (MethodData.Emit): Formerly known as Method.Emit().
12287 (MemberBase): Moved everything which was specific to a single
12288 accessor/method to MethodData.
12289 (Method): Create a new MethodData and call Define() and Emit() on it.
12290 (Property, Indexer, Event): Create a new MethodData objects for each
12291 accessor and call Define() and Emit() on them.
12293 2002-07-25 Martin Baulig <martin@gnome.org>
12295 Made MethodCore derive from MemberBase to reuse the code from there.
12296 MemberBase now also checks for attributes.
12298 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
12299 (MemberBase.GetMethodFlags): Moved here from class Method and marked
12301 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
12302 `CallingConventions cc' and `Attributes opt_attrs' arguments.
12303 (MemberBase.ApplyAttributes): New virtual method; applies the
12304 attributes to a method or accessor.
12305 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
12306 (MemberBase.ApplyConditionalAttribute): Likewise.
12307 (MemberBase.ApplyDllImportAttribute): Likewise.
12308 (MemberBase.CheckAbstractAndExternal): Likewise.
12309 (MethodCore.ParameterTypes): This is now a property instead of a
12310 method, it's initialized from DoDefineParameters().
12311 (MethodCore.ParameterInfo): Removed the set accessor.
12312 (MethodCore.DoDefineParameters): New protected virtual method to
12313 initialize ParameterTypes and ParameterInfo.
12314 (Method.GetReturnType): We can now simply return the MemberType.
12315 (Method.GetMethodFlags): Override the MemberBase version and add
12316 the conditional flags.
12317 (Method.CheckBase): Moved some code from Define() here, call
12318 DoDefineParameters() here.
12319 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
12320 here to avoid some larger code duplication.
12321 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
12322 ensure that abstract and external accessors don't declare a body.
12324 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
12325 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
12326 lookup in the attribute's parent classes, so we need to abort as soon
12327 as we found the first match.
12328 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
12329 the attribute has no arguments.
12331 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
12334 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12336 * cs-parser.jay: reverted previous patch.
12338 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12340 * cs-parser.jay: fixed bug #22119.
12342 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12344 * attribute.cs: fixed compilation. The error was:
12345 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
12346 be assigned to before control leaves the current method."
12347 [FIXME: Filed as bug #28186: MCS must report this error.]
12349 2002-07-25 Martin Baulig <martin@gnome.org>
12351 * attribute.cs (Attribute.Conditional_GetConditionName): New static
12352 method to pull the condition name ouf of a Conditional attribute.
12353 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
12354 the obsolete message and error flag out of an Obsolete attribute.
12356 * class.cs (Method.GetMethodFlags): New public method to get the
12357 TypeManager.MethodFlags for this method.
12358 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
12360 (Method.Define): Get and apply the Obsolete and Conditional attributes;
12361 if we're overriding a virtual function, set the new private variable
12362 `parent_method'; call the new TypeManager.AddMethod().
12364 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
12365 the MethodBuilder and the Method in a PtrHashtable.
12366 (TypeManager.builder_to_method): Added for this purpose.
12367 (TypeManager.MethodFlags): Added IsObsoleteError.
12368 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
12369 Obsolete and Conditional arguments in MethodBuilders. If we discover
12370 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
12371 the message from the attribute.
12373 2002-07-24 Martin Baulig <martin@gnome.org>
12375 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
12376 preprocessor directives, ensure that the argument to #define/#undef is
12377 exactly one identifier and that it's actually an identifier.
12379 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
12382 2002-07-24 Martin Baulig <martin@gnome.org>
12384 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
12385 initialize it to TypeManager.object_type in the constructor.
12386 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
12387 of the `hm.get_current' method if we're using the collection pattern.
12388 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
12389 for the explicit conversion to make it work when we're using the collection
12390 pattern and the `Current' property has a different return type than `object'.
12393 2002-07-24 Martin Baulig <martin@gnome.org>
12395 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
12396 does not match, but don't report any errors. This method is called in
12397 order for all methods in a MethodGroupExpr until a matching method is
12398 found, so we don't want to bail out if the first method doesn't match.
12399 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
12400 matches, report the 123. Fixes #28070.
12402 2002-07-24 Martin Baulig <martin@gnome.org>
12404 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
12405 TypeManager.TypeToCoreType() to the top of the method so the
12406 following equality checks will work. Fixes #28107.
12408 2002-07-24 Martin Baulig <martin@gnome.org>
12410 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
12411 operand is of type uint, and the other operand is of type sbyte,
12412 short or int, the operands are converted to type long." -
12413 Actually do what this comment already told us. Fixes bug #28106,
12416 2002-07-24 Martin Baulig <martin@gnome.org>
12418 * class.cs (MethodBase): New abstract class. This is now a base
12419 class for Property, Indexer and Event to avoid some code duplication
12420 in their Define() and DefineMethods() methods.
12421 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
12422 generic methods for Define() and DefineMethods().
12423 (FieldBase): Derive from MemberBase, not MemberCore.
12424 (Property): Derive from MemberBase, not MemberCore.
12425 (Property.DefineMethod): Moved all the code from this method to the
12426 new MethodBase.DefineAccessor(), just call it with appropriate
12428 (Property.Define): Call the new Property.DoDefine(), this does some
12429 sanity checks and we don't need to duplicate the code everywhere.
12430 (Event): Derive from MemberBase, not MemberCore.
12431 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
12432 accessors, this will also make them work with interface events.
12433 (Indexer): Derive from MemberBase, not MemberCore.
12434 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
12435 (Indexer.Define): Use the new MethodBase functions.
12437 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
12438 argument to the constructor.
12439 (Interface.FindMembers): Added support for interface events.
12440 (Interface.PopluateEvent): Implemented.
12442 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
12444 2002-07-22 Miguel de Icaza <miguel@ximian.com>
12446 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
12447 but this is required to check for a method name being the same as
12448 the containing class.
12452 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12454 * interface.cs: initialize variable.
12456 2002-07-23 Martin Baulig <martin@gnome.org>
12458 Implemented the IndexerName attribute in interfaces.
12460 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
12461 name if this is an explicit interface implementation.
12462 (Indexer.InterfaceIndexerName): New public variable. If we're
12463 implementing an interface indexer, this is the IndexerName in that
12464 interface. Otherwise, it's the IndexerName.
12465 (Indexer.DefineMethod): If we're implementing interface indexer,
12466 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
12467 and Pending.ImplementIndexer methods.
12468 (Indexer.Define): Also define the PropertyBuilder if we're
12469 implementing an interface indexer and this is neither an explicit
12470 interface implementation nor do the IndexerName match the one in
12473 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
12474 If a method is defined here, then we always need to create a proxy
12475 for it. This is used when implementing interface indexers.
12476 (Pending.IsInterfaceIndexer): New public method.
12477 (Pending.ImplementIndexer): New public method.
12478 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
12479 This is used when implementing interface indexers to define a proxy
12481 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
12482 define a proxy if necessary.
12484 * interface.cs (Interface.IndexerName): New public variable.
12485 (Interface.PopulateIndexer): Set the IndexerName.
12486 (Interface.DefineIndexers): New private method. Populate all the
12487 indexers and make sure their IndexerNames match.
12489 * typemanager.cs (IndexerPropertyName): Added support for interface
12492 2002-07-22 Martin Baulig <martin@gnome.org>
12494 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
12495 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
12496 ret if HasReturnLabel.
12497 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
12500 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
12501 and set the ec.LoopBeginTryCatchLevel.
12502 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
12503 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
12504 the current ec.TryCatchLevel, the branch goes out of an exception
12505 block. In this case, we need to use Leave and not Br.
12507 2002-07-22 Martin Baulig <martin@gnome.org>
12509 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
12510 block unless the block does not always return or it is contained in
12511 another try { ... } catch { ... } block. Fixes bug #26506.
12512 Added verify-1.cs to the test suite.
12514 2002-07-22 Martin Baulig <martin@gnome.org>
12516 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
12517 then we do not always return. Fixes bug #24985.
12519 2002-07-22 Martin Baulig <martin@gnome.org>
12521 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
12522 lookup on a per-class level; ie. walk up the class hierarchy until we
12523 found at least one applicable method, then choose the best among them.
12524 Fixes bug #24463 and test-29.cs.
12526 2002-07-22 Martin Baulig <martin@gnome.org>
12528 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
12529 return types of the methods. The return type is not part of the
12530 signature and we must not check it to make the `new' modifier work.
12531 Fixes bug #27999, also added test-147.cs.
12532 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
12534 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
12535 on the method's return type.
12537 2002-07-21 Martin Baulig <martin@gnome.org>
12539 * assign.cs: Make this work if the rightmost source is a constant and
12540 we need to do an implicit type conversion. Also adding a few more tests
12541 to test-38.cs which should have caught this.
12543 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
12544 target in the makefile for this. The makefile.gnu is primarily intended
12545 for end-users who don't want to debug the compiler.
12547 2002-07-21 Martin Baulig <martin@gnome.org>
12549 * assign.cs: Improved the Assign class so it can now handle embedded
12550 assignments (X = Y = Z = something). As a side-effect this'll now also
12551 consume less local variables. test-38.cs now passes with MCS, added
12552 a few new test cases to that test.
12554 2002-07-20 Martin Baulig <martin@gnome.org>
12556 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
12557 instructions. Fixes bug #27977, also added test-146.cs.
12559 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12561 * cs-tokenizer.cs: fixed getHex ().
12563 2002-07-19 Martin Baulig <martin@gnome.org>
12565 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
12566 not Type.GetType() to lookup the array type. This is needed when
12567 we're constructing an array of a user-defined type.
12568 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
12569 single-dimensional arrays, but also for single-dimensial arrays of
12572 2002-07-19 Martin Baulig <martin@gnome.org>
12574 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
12575 this function is called, it's not allowed to share LocalBuilders
12576 among ILGenerators.
12578 2002-07-19 Martin Baulig <martin@gnome.org>
12580 * expression.cs (Argument.Resolve): Report an error 118 when trying
12581 to pass a type as argument.
12583 2002-07-18 Martin Baulig <martin@gnome.org>
12585 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
12586 Conv_R_Un for the signed `long' type.
12588 2002-07-15 Miguel de Icaza <miguel@ximian.com>
12590 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
12591 `expr' for the temporary result, as that will fail if we do
12592 multiple resolves on the same expression.
12594 2002-07-05 Miguel de Icaza <miguel@ximian.com>
12596 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
12597 ec.TypeContainer for looking up aliases.
12599 * class.cs (TypeContainer): Remove LookupAlias from here.
12601 * decl.cs (DeclSpace); Move here.
12603 2002-07-01 Miguel de Icaza <miguel@ximian.com>
12605 * class.cs (FindMembers): Only call filter if the constructor
12606 bulider is not null.
12608 Also handle delegates in `NestedTypes' now. Now we will perform
12609 type lookups using the standard resolution process. This also
12612 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
12613 This uses Expressions (the limited kind that can be parsed by the
12614 tree) instead of strings.
12616 * expression.cs (ComposedCast.ToString): Implement, used to flag
12617 errors since now we have to render expressions.
12619 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
12622 * ecore.cs (SimpleName.ToString): ditto.
12624 * cs-parser.jay: Instead of using strings to assemble types, use
12625 Expressions to assemble the type (using SimpleName, ComposedCast,
12626 MemberAccess). This should fix the type lookups in declarations,
12627 because we were using a different code path for this.
12629 * statement.cs (Block.Resolve): Continue processing statements
12630 even when there is an error.
12632 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12634 * class.cs (Event.Define): Also remove the `remove' method from
12635 the list of pending items.
12637 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12638 generate more compact code.
12640 2002-07-17 Martin Baulig <martin@gnome.org>
12642 * const.cs (Const.LookupConstantValue): Add support for constant
12643 `unchecked' and `checked' expressions.
12644 Also adding test case test-140.cs for this.
12646 2002-07-17 Martin Baulig <martin@gnome.org>
12648 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12649 check whether mi.ReturnType implements the IEnumerator interface; the
12650 `==' and the IsAssignableFrom() will fail in this situation.
12652 2002-07-16 Ravi Pratap <ravi@ximian.com>
12654 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12657 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12659 * expression.cs: fixed bug #27811.
12661 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12663 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12664 Molaro: when we are a ref, the value already contains a pointer
12665 value, do not take the address of it.
12667 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12668 * removed mb-parser.jay and mb-tokenizer.cs
12670 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12672 * expression.cs: check against the building corlib void type.
12674 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12676 * ecore.cs: fix for valuetype static readonly fields: when
12677 initializing them, we need their address, not the address of a copy.
12679 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12681 * typemanager.cs: register also enum_type in corlib.
12683 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12685 * class.cs: allow calling this (but not base) initializers in structs.
12687 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12689 * ecore.cs: make sure we compare against the building base types
12692 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12694 * typemanager.cs: fix TypeToCoreType() to handle void and object
12695 (corlib gets no more typerefs after this change).
12697 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12699 * expression.cs (ArrayCreation.EmitArrayArguments): use
12700 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12702 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12703 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12704 array indexes, the runtime actually forbids them.
12706 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12707 for array arguments here.
12709 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12710 instead of the default for ValueTypes.
12712 (New.DoEmit): Use IsValueType instead of
12713 IsSubclassOf (value_type)
12714 (New.DoResolve): ditto.
12715 (Invocation.EmitCall): ditto.
12717 * assign.cs (Assign): ditto.
12719 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12720 Statements *are* currently doing part of their resolution during
12723 Expressions do always resolve during resolve, but statements are
12724 only required to propagate resolution to their children.
12726 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12728 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12730 (LoadAssembly): Do not add the dll if it is already specified
12732 (MainDriver): Add the System directory to the link path at the end,
12733 after all the other -L arguments.
12735 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12736 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12737 ldelem.u1) and using the opposite for sbytes.
12739 This fixes Digger, and we can finally run it.
12741 * driver.cs (UnixParseOption): Move the option parsing here.
12742 (CSCParseOption): Implement CSC-like parsing of options.
12744 We now support both modes of operation, the old Unix way, and the
12745 new CSC-like way. This should help those who wanted to make cross
12746 platform makefiles.
12748 The only thing broken is that /r:, /reference: and /lib: are not
12749 implemented, because I want to make those have the same semantics
12750 as the CSC compiler has, and kill once and for all the confussion
12751 around this. Will be doing this tomorrow.
12753 * statement.cs (Unsafe.Resolve): The state is checked during
12754 resolve, not emit, so we have to set the flags for IsUnsfe here.
12756 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12758 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12759 not catch the Error_ObjectRefRequired in SimpleName (as it is
12760 possible to have a class/instance variable name that later gets
12761 deambiguated), we have to check this here.
12763 2002-07-10 Ravi Pratap <ravi@ximian.com>
12765 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12766 make static and put into Expression.
12768 (Event.Define): Register the private field of the event with the
12769 TypeManager so that GetFieldFromEvent can get at it.
12771 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12772 keep track of the private field associated with an event which
12775 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12778 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12780 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12782 * expression.cs (Binary.EmitBranchable): this routine emits the
12783 Binary expression in a branchable context. This basically means:
12784 we need to branch somewhere, not just get the value on the stack.
12786 This works together with Statement.EmitBoolExpression.
12788 * statement.cs (Statement.EmitBoolExpression): Use
12791 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12793 * statement.cs (For): Reduce the number of jumps in loops.
12795 (For): Implement loop inversion for the For statement.
12797 (Break): We can be breaking out of a Try/Catch controlled section
12798 (foreach might have an implicit try/catch clause), so we need to
12799 use Leave instead of Br.
12801 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12802 now). If the instace expression supports IMemoryLocation, we use
12803 the AddressOf method from the IMemoryLocation to extract the
12804 address instead of emitting the instance.
12806 This showed up with `This', as we were emitting the instance
12807 always (Emit) instead of the Address of This. Particularly
12808 interesting when This is a value type, as we dont want the Emit
12809 effect (which was to load the object).
12811 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12813 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12815 * statement.cs (Checked): Set the CheckedState during the resolve
12816 process too, as the ConvCast operations track the checked state on
12817 the resolve process, and not emit.
12819 * cs-parser.jay (namespace_member_declaration): Flag that we have
12820 found a declaration when we do. This is used to flag error 1529
12822 * driver.cs: Report ok when we display the help only.
12824 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12826 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12828 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12830 * cs-tokenizer.cs (define): We also have to track locally the
12831 defines. AllDefines is just used for the Conditional Attribute,
12832 but we also need the local defines for the current source code.
12834 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12836 * statement.cs (While, For, Do): These loops can exit through a
12837 Break statement, use this information to tell whether the
12838 statement is the last piece of code.
12840 (Break): Flag that we break.
12842 * codegen.cs (EmitContexts): New `Breaks' state variable.
12844 2002-07-03 Martin Baulig <martin@gnome.org>
12846 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12847 modifiers in method declarations in structs. Otherwise, you won't
12848 be able to override things like Object.Equals().
12850 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12852 * class.cs (Method, Property, Indexer): Do not allow the public
12853 modifier to be used in explicit interface implementations.
12855 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12856 override modifiers in method declarations in structs
12858 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12860 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12861 integer or real overflow, report an error
12863 2002-07-02 Martin Baulig <martin@gnome.org>
12865 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12866 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12867 to tell the runtime about our newly created System.Object and
12868 System.ValueType types.
12870 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12872 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12873 struct instead of Ldarg/Starg.
12875 2002-07-02 Martin Baulig <martin@gnome.org>
12877 * expression.cs (Indirection.Indirection): Call
12878 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12880 2002-07-02 Martin Baulig <martin@gnome.org>
12882 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12883 ValueType, call TypeManager.TypeToCoreType() on it.
12884 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12885 the OpCodes.Newarr argument.
12887 2002-07-02 Martin Baulig <martin@gnome.org>
12889 * expression.cs (Invocation.EmitCall): When compiling corlib,
12890 replace all calls to the system's System.Array type to calls to
12891 the newly created one.
12893 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12894 System.Array methods.
12895 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12896 from the system's System.Array type which must be replaced.
12898 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12900 * typemanager.cs: load unverifiable_code_ctor so we can build
12901 corlib using the correct type. Avoid using GetTypeCode() with
12903 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12904 TypeManager.object_type to allow building corlib.
12906 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12908 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12910 2002-07-01 Martin Baulig <martin@gnome.org>
12912 * class.cs: Make the last change actually work, we need to check
12913 whether `ifaces != null' to avoid a crash.
12915 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12917 * class.cs: when we build structs without fields that implement
12918 interfaces, we need to add the interfaces separately, since there is
12919 no API to both set the size and add the interfaces at type creation
12922 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12924 * expression.cs: the dimension arguments to the array constructors
12925 need to be converted if they are a long.
12927 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12929 * class.cs: don't emit ldarg.0 if there is no parent constructor
12930 (fixes showstopper for corlib).
12932 2002-06-29 Martin Baulig <martin@gnome.org>
12934 MCS now compiles corlib on GNU/Linux :-)
12936 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12937 ie. check for MethodImplOptions.InternalCall.
12939 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12940 and TypeManager.attribute_type are null, so we must explicitly check
12941 whether parent is not null to find out whether it's an attribute type.
12942 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12943 and SetBuilder, not only if the property is neither abstract nor external.
12944 This is necessary to set the MethodImplOptions on the accessor methods.
12945 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12946 SetBuilder, see Property.Emit().
12948 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12949 populate "System.Object", "System.ValueType" and "System.Attribute" since
12950 they've already been populated from BootCorlib_PopulateCoreTypes().
12952 2002-06-29 Martin Baulig <martin@gnome.org>
12954 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12955 is the NullLiteral, we also need to make sure that target_type is not
12958 2002-06-29 Martin Baulig <martin@gnome.org>
12960 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12961 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12962 before calling BootstrapCorlib_ResolveDelegate ().
12964 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12966 * statement.cs: fixed build-breaker. All tests passed ok.
12968 2002-06-27 Martin Baulig <martin@gnome.org>
12970 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12971 for System.Decimal when compiling corlib.
12973 2002-06-27 Martin Baulig <martin@gnome.org>
12975 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12976 switch blocks which contain nothing but a default clause.
12978 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12980 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12982 2002-06-27 Martin Baulig <martin@gnome.org>
12984 * ecore.cs (PropertyExpr.PropertyExpr): Call
12985 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12987 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12988 is already a TypeBuilder.
12990 2002-06-27 Martin Baulig <martin@gnome.org>
12992 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12993 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12994 the "from an array-type to System.Array" case. This makes it work
12995 when compiling corlib.
12997 2002-06-27 Martin Baulig <martin@gnome.org>
12999 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
13000 non-static PropertyExpr, set its InstanceExpression. This makes
13001 the `ICollection.Count' property work in System/Array.cs.
13003 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
13005 * driver.cs: Made error handling more consistent. Errors now
13006 tracked by Report class, so many methods which used to return int
13007 now return void. Main() now prints success/failure and
13008 errors/warnings message.
13010 Renamed '--probe' compiler argument to '--expect-error'. Removed
13011 the magic number return values (123 and 124). Now, if the
13012 expected error occurs, the compiler exits with success (exit value
13013 0). If the compilation completes without seeing that particular
13014 error, the compiler exits with failure (exit value 1). The
13015 makefile in mcs/errors has been changed to handle the new behaviour.
13017 * report.cs: Made 'expected error' number a property and renamed
13018 it from 'Probe' to 'ExpectedError'.
13020 * genericparser.cs: Removed error handling support, since it is
13021 now all done by Report class.
13023 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
13024 class, so parse() no longer returns an int.
13026 * namespace.cs: Use Report.Error instead of GenericParser.error
13028 2002-06-22 Miguel de Icaza <miguel@ximian.com>
13030 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
13031 TypeContainer.AddOperator): At the front of the list put the
13032 explicit implementations, so they get resolved/defined first.
13034 2002-06-21 Miguel de Icaza <miguel@ximian.com>
13036 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
13037 interface type is implemented by this TypeContainer. Used during
13038 explicit interface implementation.
13040 (Property.Define, Indexer.Define, Method.Define): Validate that
13041 the given interface in the explicit implementation is one of the
13042 base classes for the containing type.
13044 Also if we are explicitly implementing an interface, but there is
13045 no match in the pending implementation table, report an error.
13047 (Property.Define): Only define the property if we are
13048 not explicitly implementing a property from an interface. Use the
13049 correct name also for those properties (the same CSC uses,
13050 although that is really not needed).
13052 (Property.Emit): Do not emit attributes for explicitly implemented
13053 properties, as there is no TypeBuilder.
13055 (Indexer.Emit): ditto.
13057 Hiding then means that we do not really *implement* a pending
13058 implementation, which makes code fail.
13060 2002-06-22 Martin Baulig <martin@gnome.org>
13062 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
13063 the return value of Object.GetType(). [FIXME: we need to do this whenever
13064 we get a type back from the reflection library].
13066 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
13068 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
13070 2002-06-20 Miguel de Icaza <miguel@ximian.com>
13072 * attribute.cs: Return null if we can not look up the type.
13074 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
13075 the interface types found.
13077 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
13078 interface types found.
13080 * typemanager.cs (GetInterfaces): Make this routine returns alll
13081 the interfaces and work around the lame differences between
13082 System.Type and System.Reflection.Emit.TypeBuilder in the results
13083 result for GetInterfaces.
13085 (ExpandInterfaces): Given an array of interface types, expand and
13086 eliminate repeated ocurrences of an interface. This expands in
13087 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
13090 2002-06-21 Martin Baulig <martin@gnome.org>
13092 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
13095 2002-06-21 Martin Baulig <martin@gnome.org>
13097 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
13098 and called with one of the core types, return the corresponding typebuilder for
13101 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
13104 2002-06-21 Martin Baulig <martin@gnome.org>
13106 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
13107 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
13108 (Expression.ConvertReferenceExplicit): Likewise.
13110 * expression.cs (ElementAccess.DoResolve): Likewise.
13111 (ElementAccess.DoResolveLValue): Likewise.
13113 2002-06-10 Martin Baulig <martin@gnome.org>
13115 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
13116 add the "value" parameter to the parameter list.
13118 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
13121 2002-06-19 Miguel de Icaza <miguel@ximian.com>
13123 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
13124 the argument to an int, uint, long or ulong, per the spec. Also
13125 catch negative constants in array creation.
13127 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
13129 * class.cs: do not allow the same interface to appear twice in
13130 the definition list.
13132 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
13134 * ecore.cs: don't use ldlen with System.Array.
13136 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
13138 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
13140 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
13142 * modifiers.cs: produce correct field attributes for protected
13143 internal. Easy fix so miguel can work on ther harder stuff:-)
13145 2002-06-18 Miguel de Icaza <miguel@ximian.com>
13147 * pending.cs: New file. Move the code from class.cs here.
13148 Support clearning the pending flag for all methods (when not doing
13149 explicit interface implementation).
13151 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
13153 * rootcontext.cs: added a couple more types needed to bootstrap.
13155 2002-06-17 Miguel de Icaza <miguel@ximian.com>
13157 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
13158 constructor in the type, instead of any constructor in the type
13159 hierarchy. Thanks to Paolo for finding this bug (it showed up as
13160 a bug in the Mono runtime when applying the params attribute).
13162 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13163 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
13165 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
13167 * expression.cs (Unary.ResolveOperator): Use TypeManager
13168 to resolve the type.
13170 2002-06-13 Ravi Pratap <ravi@ximian.com>
13172 * cs-parser.jay (enum_member_declaration): Pass in the attributes
13175 * enum.cs (AddEnumMember): Add support to store the attributes associated
13176 with each member too.
13178 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
13179 field builders too - this takes care of the enum member case.
13181 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
13183 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
13184 address-of operator on both value types and pointers.
13186 2002-06-10 Martin Baulig <martin@gnome.org>
13188 * interface.cs (Interface.PopulateIndexer): Add the indexer's
13189 PropertyBuilder to the `property_builders' list.
13191 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
13192 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
13193 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
13194 find any indexers which are inherited from an interface.
13196 2002-06-09 Martin Baulig <martin@gnome.org>
13198 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
13199 the same type as the constant if necessary. There's also a test-130.cs
13202 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
13204 * typemanager.cs (TypeManager.ChangeType): Previously known as
13205 Enum.ChangeEnumType().
13207 2002-06-09 Martin Baulig <martin@gnome.org>
13209 * expression.cs (Cast.TryReduce): Added support for consts.
13211 2002-06-08 Ravi Pratap <ravi@ximian.com>
13213 * class.cs (Accessor): Hold attributes information so we can pass
13216 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
13217 Modify to pass in attributes attached to the methods.
13219 (add_accessor_declaration, remove_accessor_declaration): Ditto.
13221 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
13222 to handle the Accessor kind :-)
13224 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
13226 2002-06-08 Martin Baulig <martin@gnome.org>
13228 * expression.cs (Unary.TryReduceNegative): Added support for
13231 2002-06-08 Martin Baulig <martin@gnome.org>
13233 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
13234 name can't be found in the `defined_names' - the caller will do a
13235 MemberLookup in this case and thus find methods in System.Enum
13236 such as Enum.IsDefined().
13238 2002-06-08 Martin Baulig <martin@gnome.org>
13240 * enum.cs (Enum.ChangeEnumType): This is a custom version of
13241 Convert.ChangeType() which works with TypeBuilder created types.
13242 (Enum.LookupEnumValue, Enum.Define): Use it here.
13244 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
13245 `TypeBuilder.BaseType != null' check.
13246 (TypeContainer.FindMembers): Only lookup parent members if we
13247 actually have a parent.
13248 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
13249 (ConstructorInitializer.Resolve): Likewise.
13251 * interface.cs (Interface.FindMembers): Added
13252 `TypeBuilder.BaseType != null' check.
13254 * rootcontext.cs (RootContext.ResolveCore): Added
13255 "System.Runtime.CompilerServices.IndexerNameAttribute" to
13256 classes_second_stage.
13258 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
13259 debug_type and trace_type when compiling with --nostdlib.
13261 2002-06-07 Martin Baulig <martin@gnome.org>
13263 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
13264 (AddField): Set it to true when adding a non-static field.
13265 (DefineType): Use `have_nonstatic_fields' to find out whether we
13266 have non-static fields, not `Fields != null'.
13268 2002-06-02 Miguel de Icaza <miguel@ximian.com>
13270 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
13271 dereferencing a null on the static-field code path)
13273 2002-05-30 Martin Baulig <martin@gnome.org>
13275 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
13276 to take command line arguments. Use reflection to call the new
13277 custom `Initialize' function on the symbol writer and pass it the
13278 command line arguments.
13280 * driver.cs (--debug-args): New command line argument to pass command
13281 line arguments to the symbol writer.
13283 2002-05-28 Miguel de Icaza <miguel@ximian.com>
13285 * assign.cs (DoResolve): Forgot to do the implicit conversion to
13286 the target type for indexers and properties. Thanks to Joe for
13289 2002-05-27 Miguel de Icaza <miguel@ximian.com>
13291 * typemanager.cs (MethodFlags): returns the method flags
13292 (Obsolete/ShouldIgnore) that control warning emission and whether
13293 the invocation should be made, or ignored.
13295 * expression.cs (Invocation.Emit): Remove previous hack, we should
13296 not do this on matching a base type, we should do this based on an attribute
13298 Only emit calls to System.Diagnostics.Debug and
13299 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
13300 on the command line.
13302 * rootcontext.cs: Global settings for tracing and debugging.
13304 * cs-tokenizer.cs (define): New utility function to track
13305 defines. Set the global settings for TRACE and DEBUG if found.
13307 2002-05-25 Ravi Pratap <ravi@ximian.com>
13309 * interface.cs (Populate*): Pass in the TypeContainer as well as
13310 the DeclSpace as parameters so that we can create EmitContexts and
13311 then use that to apply attributes etc.
13313 (PopulateMethod, PopulateEvent, PopulateProperty)
13314 (PopulateIndexer): Apply attributes everywhere.
13316 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
13319 (ApplyAttributes): Update accordingly.
13321 We now apply interface attributes for all members too.
13323 2002-05-26 Miguel de Icaza <miguel@ximian.com>
13325 * class.cs (Indexer.Define); Correctly check if we are explicit
13326 implementation (instead of checking the Name for a ".", we
13327 directly look up if the InterfaceType was specified).
13329 Delay the creation of the PropertyBuilder.
13331 Only create the PropertyBuilder if we are not an explicit
13332 interface implementation. This means that explicit interface
13333 implementation members do not participate in regular function
13334 lookups, and hence fixes another major ambiguity problem in
13335 overload resolution (that was the visible effect).
13337 (DefineMethod): Return whether we are doing an interface
13340 * typemanager.cs: Temporary hack until we get attributes in
13341 interfaces (Ravi is working on that) and we get IndexerName
13342 support in interfaces.
13344 * interface.cs: Register the indexers as properties.
13346 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
13347 warning, I have verified that this is a bug in the .NET runtime
13348 (JavaScript suffers of the same problem).
13350 * typemanager.cs (MemberLookup): When looking up members for
13351 interfaces, the parent of an interface is the implicit
13352 System.Object (so we succeed in searches of Object methods in an
13353 interface method invocation. Example: IEnumerable x; x.ToString
13356 2002-05-25 Miguel de Icaza <miguel@ximian.com>
13358 * class.cs (Event): Events should also register if they do
13359 implement the methods that an interface requires.
13361 * typemanager.cs (MemberLookup); use the new GetInterfaces
13364 (GetInterfaces): The code used to lookup interfaces for a type is
13365 used in more than one place, factor it here.
13367 * driver.cs: Track the errors at the bottom of the file, we kept
13370 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
13371 instance if the method we are calling is static!
13373 2002-05-24 Miguel de Icaza <miguel@ximian.com>
13375 * attribute.cs (ApplyAttributes): Make this function filter out
13376 the IndexerName attribute (as that attribute in reality is never
13377 applied) and return the string constant for the IndexerName
13380 * class.cs (TypeContainer.Emit): Validate that all the indexers
13381 have the same IndexerName attribute, and if so, set the
13382 DefaultName attribute on the class.
13384 * typemanager.cs: The return value might contain other stuff (not
13385 only methods). For instance, consider a method with an "Item"
13386 property and an Item method.
13388 * class.cs: If there is a problem with the parameter types,
13391 2002-05-24 Ravi Pratap <ravi@ximian.com>
13393 * ecore.cs (ImplicitConversionExists): Wrapper function which also
13394 looks at user defined conversion after making a call to
13395 StandardConversionExists - we need this for overload resolution.
13397 * expression.cs : Update accordingly the various method calls.
13399 This fixes 2 bugs filed against implicit user defined conversions
13401 2002-05-22 Miguel de Icaza <miguel@ximian.com>
13403 * statement.cs: Track the result of the assignment.
13405 2002-05-21 Miguel de Icaza <miguel@ximian.com>
13407 * expression.cs (MemberAccess): Improved error reporting for
13408 inaccessible members.
13410 2002-05-22 Martin Baulig <martin@gnome.org>
13412 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
13413 itself with debugging support.
13415 2002-05-22 Martin Baulig <martin@gnome.org>
13417 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
13418 Removed, this isn't needed anymore.
13420 2002-05-20 Martin Baulig <martin@gnome.org>
13422 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
13423 be underlying type for an enum.
13425 2002-05-20 Miguel de Icaza <miguel@ximian.com>
13427 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
13428 that splits out the loading of just the core types.
13430 * rootcontext.cs (ResolveCore): Split the struct resolution in
13431 two, so we can load the enumeration underlying types before any
13434 * expression.cs (Is): Bandaid until we fix properly Switch (see
13435 bug #24985 for details).
13437 * typemanager.cs (ImplementsInterface): The hashtable will contain
13438 a null if there are no interfaces implemented.
13440 2002-05-18 Miguel de Icaza <miguel@ximian.com>
13442 * cs-parser.jay (indexer_declarator): It is fine to have array
13445 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13447 * typemanager.cs: (RegisterBuilder): New function used to register
13448 TypeBuilders that implement interfaces. Since
13449 TypeBuilder.GetInterfaces (as usual) does not work with lame
13451 (AddUserType): register interfaces.
13453 (ImplementsInterface): Use the builder_to_ifaces hash if we are
13454 dealing with TypeBuilder. Also, arrays are showing up as
13455 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
13456 methods can not be invoked on them!
13458 * ecore.cs (ExplicitReferenceConversionExists): Made public.
13459 (ImplicitReferenceConversionExists): Split out from
13460 StandardConversionExists.
13462 * expression.cs (As): We were only implementing one of the three
13463 cases for the as operator. We now implement them all.
13464 (Is): Implement the various other cases for Is as well.
13466 * typemanager.cs (CACHE): New define used to control if we want or
13467 not the FindMembers cache. Seems to have a negative impact on
13468 performance currently
13470 (MemberLookup): Nested types have full acess to
13471 enclosing type members
13473 Remove code that coped with instance/static returns for events, we
13474 now catch this in RealFindMembers.
13476 (RealFindMembers): only perform static lookup if the instance
13477 lookup did not return a type or an event.
13479 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13481 * assign.cs (CompoundAssign): We pass more semantic information
13482 now to Compound Assignments than we did before: now we have all
13483 the information at hand, and now we resolve the target *before* we
13484 do the expression expansion, which allows the "CacheValue" method
13485 to have the effect we intended (before, a [x] += 1 would generate
13486 two differen ArrayAccess expressions from the ElementAccess,
13487 during the resolution process).
13489 (CompoundAssign.DoResolve): Resolve target and original_source here.
13491 2002-05-16 Miguel de Icaza <miguel@ximian.com>
13493 * expression.cs (ArrayAccess): dropped debugging information.
13495 * typemanager.cs: Small bug fix: I was always returning i_members,
13496 instead of one of i_members or s_members (depending on which had
13499 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
13500 method is invoked before any code generation takes place, and it
13501 is a mechanism to inform that the expression will be invoked more
13502 than once, and that the method should use temporary values to
13503 avoid having side effects
13505 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
13507 * ecore.cs (Expression.CacheTemporaries): Provide empty default
13510 * expression.cs (Indirection, ArrayAccess): Add support for
13511 CacheTemporaries in these two bad boys.
13513 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
13514 ldobj or ldind_ref.
13515 (StoreFromPtr): Handle stobj as well.
13517 * expression.cs (UnaryMutator): Share more code.
13519 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
13520 down: I was not tracking the Filter function as well, which
13521 was affecting the results of the cache.
13523 2002-05-15 Miguel de Icaza <miguel@ximian.com>
13525 * attribute.cs: Remove the hack to handle the CharSet property on
13528 2002-05-14 Miguel de Icaza <miguel@ximian.com>
13530 * attribute.cs (DoResolve): More uglyness, we now only try to
13531 resolve the attribute partially, to extract the CharSet
13532 information (only if we are a StructLayout attribute). Otherwise
13534 (GetExtraTypeInfo): Add some code to conditionally kill in the
13535 future this. I am more and more convinced that the .NET
13536 framework has special code to handle the attribute setting on
13539 * expression.cs (IsParamsMethodApplicable): Revert my previous
13540 foreach change here, it was wrong.
13542 2002-05-13 Miguel de Icaza <miguel@ximian.com>
13544 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
13545 (pp_expr): do not abort on unknown input, just return.
13546 (eval): abort if there are pending chars.
13548 * attribute.cs (Attribute.Resolve): Positional parameters are
13549 optional. Deal with that case.
13551 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
13552 the Ansi/Unicode/Auto information for the type.
13554 (TypeContainer.DefineType): instantiate the EmitContext here, as
13555 we will be using it during the type definition (to resolve
13556 attributes) and during the emit phase.
13558 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
13559 to pull type information out of the attributes
13561 (Attribute.Resolve): track the constructor builder, and allow for
13562 multiple invocations (structs and classes will use this).
13564 * ecore.cs (MemberLookupFinal): new version with all the
13565 parameters customizable.
13567 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
13568 constructors. Return if the result value is null (as the error
13569 would have been flagged already by MemberLookupFinal)
13571 Do not allow instances of abstract classes or interfaces to be
13574 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
13575 We have to compare the assembly property here when dealing with
13576 FamANDAssem and Assembly access modifiers, because we might be
13577 creating an assembly from *modules* (that means that we are not
13578 getting TypeBuilders for types defined in other modules that are
13579 part of this assembly).
13581 (Method.Emit): If the method is marked abstract and has a body,
13584 (TypeContainer.DefineMembers): If both the defined member and the
13585 parent name match are methods, then do not emit any warnings: let
13586 the Method.Define routine take care of flagging warnings. But if
13587 there is a mismatch (method overrides something else, or method is
13588 overriwritten by something, then emit warning).
13590 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
13591 set to null, this means `do not check for the return type on the
13594 (Method.Define): set the return type for the method signature to
13595 null, so that we get methods with the same name and parameters and
13596 different return types. This is used to flag warning 114 (you are
13597 hiding a method, and you probably want to use the new/override
13600 * typemanager.cs (MemberLookup): Implemented proper access
13601 control, closing a long standing set of bug reports. The problem
13602 was that the Framework only has two bits: Public and NonPublic,
13603 and NonPublic includes private and protected methods, but we need
13604 to enforce the FamANDAssem, FamOrAssem and Family.
13606 2002-05-11 Miguel de Icaza <miguel@ximian.com>
13608 * statement.cs (GotoCase): Return true: Ammounts to giving up
13609 knowledge on whether we return or not, and letting the other case
13610 be responsible for it.
13612 2002-05-10 Miguel de Icaza <miguel@ximian.com>
13614 * driver.cs: Do not load directories for each file processed, only
13615 do it if there is a pattern.
13617 * ecore.cs: Report readonly assigns here as well, as we might have
13618 been resolved only by MemberAccess.
13620 (SimpleName.SimpleNameResolve): Also be useful for LValue
13621 resolution. We need this to propagate assign to local readonly variables
13623 * typemanager.cs: Use a ptrhashtable for the criteria, because we
13624 do not want to reuse potential criteria memory.
13626 * class.cs (MyEventBuilder): Set reflected_type;
13628 * ecore.cs (Constantify): Added support for constifying bools.
13630 (RootContext.LookupType): Added a cache for values looked up in
13631 the declaration space.
13633 * typemanager.cs (FindMembers): Now is a front-end to
13634 RealFindMembers, and provides a two-level hashtable-based cache to
13637 15% performance improvement: from 22.5 to 19.2 seconds.
13639 * expression.cs (IsParamsMethodApplicable): use foreach.
13640 (Invocation.DoResolve): ditto.
13641 (New.DoResolve): ditto.
13642 (ArrayCreation.DoResolve): ditto.
13644 * ecore.cs (FindMostEncompassingType): use foreach.
13646 * delegate.cs (NewDelegate.DoResolve): Use foreach
13648 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13649 (RemoveMethods): use foreach.
13651 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13652 nested foreach statements instead of for, and also break out of
13653 the inner loop once a match is found.
13655 (Invocation.OverloadResolve): Use foreach, simplify the code.
13657 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13659 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13660 we actually unwrap the expression to allow for extra information
13663 * expression.cs: Use Shr_Un on unsigned operations.
13665 2002-05-08 Ravi Pratap <ravi@ximian.com>
13667 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13668 applicable operators was not being considered correctly. This closes
13669 the bug Miguel reported.
13671 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13673 * attribute.cs: check that the type derives from System.Attribute
13674 and report the correct error in that case (moved the duplicate code to
13675 its own method, too).
13677 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13679 * attribute.cs: lookup attribute type name as the spec says: first the
13680 bare attribute name and then name + "Attribute" (nant compiles with
13681 mcs after this fix).
13683 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13685 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13686 Because of the way we parse things, we should try to see if a
13687 UIntConstant can fit in an integer.
13689 2002-05-07 Ravi Pratap <ravi@ximian.com>
13691 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13692 when we are in an explicit context.
13694 (ConvertReferenceExplicit): When converting from Iface type S to Class
13695 T make sure the rules are implemented as an OR.
13697 * parameter.cs (ParameterType): Make it a property for now although the
13698 purpose really isn't anything immediate.
13700 * expression.cs (Is*Applicable): Do better checking on the parameter type
13701 of a ref/out parameter. The ones from the system assemblies are already
13702 marked with the correct type so we don't need to do any correction.
13704 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13705 the object type is standard too so include that.
13707 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13709 * ecore.cs (StandardConversionExists): Augment with missing code:
13710 deal with IntConstant, LongConstants and Enumerations.
13712 * assign.cs: Report the error, instead of failing silently
13714 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13715 typecontainer that they are declared, because the
13716 typecontainer/namespace will have the list of using clauses that
13717 need to be applied.
13719 Assembly Attributes were escaping the normal registration
13722 (EmitCode): Apply attributes within an EmitContext that represents
13723 the container they were declared on.
13725 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13727 2002-05-06 Ravi Pratap <ravi@ximian.com>
13729 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13730 Revamp completely - make much cleaner as we now operate only
13733 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13734 to implement the logic detailed in the spec more correctly.
13736 (UserDefinedConversion): Update accordingly.
13738 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13740 * statement.cs: Return flow analysis information up.
13742 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13745 (token): Do not consume an extra character before calling
13748 2002-05-06 Piers Haken <piersh@friskit.com>
13750 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13752 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13754 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13755 EmitContext during the instance constructor initializer
13756 resolution, to stop access to instance variables.
13758 This is mandated by the spec, last paragraph of the `constructor
13759 initializers' section.
13761 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13763 * cs-parser.jay, class.cs (Accessor): new class used to represent
13764 an accessor (get or set). In the past we used `null' to represent
13765 a missing accessor. But this is ambiguous because there was no
13766 way to tell in abstract indexers/properties if one of them was
13769 Now there is a way of addressing that.
13771 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13772 instead of FindMembers.
13774 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13775 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13777 * attribute.cs: Treat indexers and properties as the same in terms
13778 of applying attributes
13780 * ecore.cs (FindMostEncompassedType): Use statically initialized
13781 EmptyExpressions()s like we do elsewhere to avoid creating useless
13782 objects (and we take this out of the tight loop).
13784 (GetConversionOperators): Move the code to extract the actual
13785 operators to a separate routine to clean things up.
13787 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13789 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13790 events are always registered FieldBuilders.
13792 * class.cs (FieldBase): New class shared by Fields
13794 * delegate.cs: If we are a toplevel delegate, use our full name.
13795 If we are a nested delegate, then only use our tail name.
13797 2002-05-02 Ravi Pratap <ravi@ximian.com>
13799 * expression.cs (IsApplicable): Ensure that we add the "&" to
13800 ref/out types before comparing it with the type of the argument.
13802 (IsParamsMethodApplicable): Ditto.
13804 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13807 * delegate.cs : Handle the case when we have more than one applicable
13808 method. Flag an error only when we finish checking all.
13810 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13812 * expression.cs: Add support for boolean static initializers.
13814 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13816 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13818 * parameter.cs (ComputeParameterTypes,
13819 ComputeAndDefineParameterTypes): Better error handling: now we
13820 clear the `types' cache if we fail during any of the type lookups.
13821 We also return the status code correctly to our caller
13823 * delegate.cs: If we fail to define a delegate, abort the extra
13826 * expression.cs (Binary.ResolveOperator): for
13827 operator==(object,object) and operator !=(object, object) we also
13828 have to verify that there is an implicit conversion from one to
13831 (ArrayAccess.DoResolve): Array Access can operate on
13834 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13836 * assign.cs (CompoundAssign): A new class used as a "flag" that
13837 the assignment actually is happening as part of a compound
13838 assignment operator.
13840 During compound assignment, a few new rules exist to enable things
13847 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13848 to the type of x) if y is implicitly convertible to the type of x,
13849 and the operator is a builtin operator and the return type of the
13850 operator is explicitly convertible to the type of x.
13852 * rootcontext.cs: Reset warning level to 2. 4 catches various
13853 "interesting" features in mcs, we must clean this up at some
13854 point, but currently am trying to kill other bugs ;-)
13856 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13857 in container classes as well.
13859 * expression.cs (Binary.ResolveOperator): Handle string case
13860 before anything else (as operator overloading does emit an error
13861 before doing anything else).
13863 This code could go away when we move to a table driven model, but
13864 i could not come up with a good plan last night.
13866 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13868 * typemanager.cs (CSharpName): reimplementation using regex.
13869 * class.cs: added null check for fields in Emit
13870 * rootcontext.cs: set warninglevel to 4
13872 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13874 * typemanager.cs (CSharpName): reimplemented with Lupus
13877 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13879 * statement.cs (If): correclty implement Resolve, because we were
13880 not catching sem errors in there. The same process is needed
13882 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13885 (Statement.Warning_DeadCodeFound): Factorize code.
13886 (While): Report dead code here too.
13888 (Statement): Added Resolve virtual method to allow
13889 for resolution split from the emit code.
13891 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13893 * statement.cs (EmitBoolExpression): No longer try to resolve the
13895 (MakeBoolean): New utility function that resolve, implicitly
13896 converts to boolean and tags the expression.
13899 (If, Do): Implement dead code elimination.
13900 (While): Implement loop inversion
13902 (Do, While, For, If): Resolve the expression prior to calling our
13905 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13908 - added method Report28 (warning: program has more than one entry point)
13909 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13910 - modified method Method.Define, the part at the end of the method
13912 * rootcontext.cs: added static public Location EntryPointLocation;
13914 * ../errors/cs0028.cs : Add test case for the above warning.
13917 - modified method CSharpName to allow arrays of primitive type to
13918 be printed nicely (e.g. instead of System.Int32[][] it now prints
13920 - added method CSharpSignature: returns the signature of a method
13921 in string format to be used in reporting errors, warnings, etc.
13923 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13926 2002-04-26 Ravi Pratap <ravi@ximian.com>
13928 * delegate.cs (Define): Fix extremely silly bug where I was
13929 setting the type of the 'object' parameter of the BeginInvoke
13930 method to System.IAsyncResult instead of System.Object ;-)
13932 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13934 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13937 (Constructor.Emit): return if we fail to initialize the
13938 constructor. Another door closed!
13940 * expression.cs (New.DoResolve): Improve error message (from -6 to
13941 1501). Use DeclaredOnly lookup to find the exact constructor.
13943 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13944 loop. This is useful.
13946 * cs-parser.jay: Adjust the default parameters so that destructors
13947 have the proper signature.
13949 2002-04-26 Martin Baulig <martin@gnome.org>
13951 * driver.cs (LoadAssembly): If `assembly' contains any characters
13952 which are only valid in path names and not in assembly names
13953 (currently slash, backslash and point), use Assembly.LoadFrom ()
13954 instead of Assembly.Load () on the `assembly' (before iteration
13955 over the link_paths).
13957 2002-04-26 Martin Baulig <martin@gnome.org>
13959 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13961 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13963 * class.cs (Property): use the new typemanager.MemberLookup
13965 (TypeContainer.MemberLookup): Implement using the
13966 TypeManager.MemberLookup now.
13968 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13969 and return MemberInfos, so that these can be used without an
13970 EmitContext (what we had before).
13972 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13974 * expression.cs: Fix the case where the argument to params if the
13975 type of the params. I omitted handling this before. Fixed
13977 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13979 * driver.cs: Call BootCorlib_PopulateCoreType
13981 * class.cs (Property.CheckBase): Check for properties only, not
13984 * interface.cs: Temporary hack: try/catch around the
13985 CustomAttributeBuilder, because I am getting an exception that I
13988 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13989 types whose definitions are required to be there (attributes are
13990 defined before standard types).
13992 Compute definitions as we boot the various types, as they are used
13993 immediately (value_type class will need object_type, but if we do
13994 not initialize object_type, we will pass a null, which will let
13995 the runtime pick the System.Object from the existing corlib, which
13996 is not what we want).
13998 2002-04-22 Patrik Torstensson <totte@labs2.com>
14000 * cs-tokenizer.cs: fixed a number of trim() issues.
14002 2002-04-22 Ravi Pratap <ravi@ximian.com>
14004 * expression.cs (Argument.Type): Ensure that we return the correct
14005 type when we have out or ref parameters [in which case we
14008 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14010 * class.cs (Property, Indexer): Allow extern modifier in there.
14012 * typemanager.cs (InitBaseTypes): Initializes object_type and
14013 value_type, since those will be used early on during the bootstrap
14014 process to compile corlib.
14016 (InitCoreTypes): Move code from here to InitBaseTypes.
14018 2002-04-21 Miguel de Icaza <miguel@ximian.com>
14020 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
14021 single-dimension arrays as using the ldlen opcode.
14023 Daniel Lewis discovered this optimization.
14025 * typemanager.cs: Add signature for System.Array::get_Length
14027 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14029 * statement.cs: report the error when the foreach does not apply to an
14030 array nor a collection.
14032 2002-04-19 Miguel de Icaza <miguel@ximian.com>
14034 * expression.cs: Add implicit conversions to the operator ~.
14036 * constant.cs (DecimalConstant.Emit): Emit decimal value.
14038 * typemanager.cs: Locate the decimal constructor.
14040 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14042 * attribute.cs: use the new property of TypeOf.
14043 * expression.cs: added 'get' property around typearg.
14045 These changes fix a build breaker reported by NickD. Is this the
14046 correct way to fix? If not, please, revert my changes and make it
14049 2002-04-17 Miguel de Icaza <miguel@ximian.com>
14051 * attribute.cs: Add support for typeof in attribute invocations.
14052 I am not sure that this is right though.
14054 2002-04-14 Duncan Mak <duncan@ximian.com>
14056 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
14057 Binary.Operator.Division case.
14059 2002-04-13 Ravi Pratap <ravi@ximian.com>
14061 * class.cs (DefineType): Ensure that we do a proper check on
14062 attribute types and also register it with the TypeManager.
14064 (TypeContainer.Targets): The default for attribute types is
14065 AttributeTargets.All.
14067 * attribute.cs (ApplyAttributes): Registering the attribute type
14068 is done elsewhere, not when we discover we have a Usage attribute.
14070 2002-04-12 Ravi Pratap <ravi@ximian.com>
14072 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
14073 and get rid of is_delegate parameter.
14075 * everywhere : update.
14077 2002-04-12 Ravi Pratap <ravi@ximian.com>
14079 * cs-parser.jay (compilation_unit): Revamp completely to use
14080 some new ideas that I got from Rhys' grammar to solve the problems
14081 with assembly level attributes.
14083 (outer_declaration): New grammar production.
14085 (attribute_sections): Add.
14087 (opt_attributes): Base on attribute_sections
14089 (namespace_declaration): Allow opt_attributes to tackle the case
14090 when we have assembly level attributes - we are clever in this
14093 * attribute.cs (ApplyAttributes): Do not worry about assembly
14094 attributes in the non-global context.
14096 * rootcontext.cs (AddGlobalAttributes): Go back to using this
14097 instead of SetGlobalAttributes.
14099 * class.cs, rootcontext.cs : Ensure we define and generate
14100 attribute types before anything else.
14102 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
14103 and flag the new error -20 for the case when the attribute type
14104 does not have valid targets specified. csc does not catch this.
14106 * ../errors/errors.txt : update for error # -20
14108 2002-04-11 Ravi Pratap <ravi@ximian.com>
14110 * support.cs (InternalParameters.ParameterModifier): Do some null
14111 checking and return sane values.
14113 * class.cs (Method.Define): If we are a PInvoke method, ensure
14114 that we are static and extern. Report error # 601
14116 * ../errors/cs0601.cs : Add test case for the above error.
14118 2002-04-07 Ravi Pratap <ravi@ximian.com>
14120 * rootcontext.cs (attribute_types): We need to keep type of
14121 all attribute types separately and emit code for them first.
14123 (RegisterAttribute) : Implement.
14125 * class.cs (DefineType): Check if the current Type is a custom
14126 attribute type and register it accordingly.
14128 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
14129 adding the first attribute twice and rename to
14131 (SetGlobalAttributes): this.
14133 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
14136 * attribute.cs (ApplyAttributes): Take an additional argument telling us
14137 if we are processing global arguments. Hmm, I am unsure of this.
14139 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14141 * expression.cs: added static array of strings to avoid calling
14142 Enum.ToString () for Operator in Binary. Significant recover of
14145 2002-04-10 Miguel de Icaza <miguel@ximian.com>
14147 * class.cs (FindMembers): Allow the Builders of the various
14148 members to be null. If they are skip them. This only happens
14149 during the PInvoke declaration.
14151 2002-04-09 Miguel de Icaza <miguel@ximian.com>
14153 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
14154 failure, so we do not keep going afterwards.
14156 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
14157 wanted to pass `false' as the `is_delegate' argument. If this is
14158 the case, why not use delegate_type == null to mean `is_delegate =
14159 false' and anything else as is_delegate = true.
14161 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
14163 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
14164 code for the section, not the beginning of the tests.
14166 2002-04-08 Miguel de Icaza <miguel@ximian.com>
14168 * cfold.cs: Handle operator + (Enum x, Underlying x)
14170 * expression.cs (Binary): same. Warn about errors where we have
14171 Enum/Enum in operator + as well.
14173 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
14176 - added support for switch(bool)
14177 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
14178 - add TableSwitchEmit() to handle table-based switch statements
14180 2002-04-05 Ravi Pratap <ravi@ximian.com>
14182 * expression.cs (Invocation.OverloadResolve): Factor out code which
14183 does parameter compatibility checking with arguments so that we can
14184 re-use the code even from Delegate.VerifyApplicability
14186 (VerifyArgumentsCompat): Move above code here.
14188 * delegate.cs (VerifyApplicability): Get rid of duplicate code
14189 and instead make a call to the above method.
14191 2002-03-31 Ravi Pratap <ravi@ximian.com>
14193 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
14194 We use it to keep track of classes which are attribute types.
14196 2002-04-02 Miguel de Icaza <miguel@ximian.com>
14198 * delegate.cs (Delegate.Define): Correctly define the types in the
14199 presence of fixed and array parameters.
14201 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
14204 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
14205 include NonPublic after the first iteration.
14207 * class.cs (Indexer.CheckBase): Only check if both parents are
14210 * cs-parser.jay (accessor_body): If empty, set to null.
14212 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
14213 same code path here to resolve constants names that we did have in
14214 MemberAccess.DoResolve. There is too much code duplicated here.
14216 2002-04-01 Miguel de Icaza <miguel@ximian.com>
14218 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
14220 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
14223 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
14224 tokens, numbers and strings.
14226 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
14229 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
14230 asyncronous parameters and the regular parameters.
14232 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
14233 specify the target directory.
14235 * expression.cs: (This.DoResolve): Simplify
14236 (As.Emit): Optimize, do not generate IsInst if the expression is
14237 always of the given type.
14239 (Is.DoResolve): Bug fix, we were reporting both always/never for
14242 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
14243 creating too many unnecessary arrays.
14245 2002-03-31 Miguel de Icaza <miguel@ximian.com>
14247 * class.cs (EmitFieldInitializer): Use Assign expression to assign
14248 fields instead of rolling our own initializer. Takes care of all
14249 implicit conversions, and drops unnecessary static checks/argument.
14251 2002-03-31 Dick Porter <dick@ximian.com>
14253 * driver.cs: use the GetDirectories() return values properly, and
14254 use "/" as path separator.
14256 2002-03-30 Miguel de Icaza <miguel@ximian.com>
14258 * expression.cs (Unary): Optimize - - expr into expr.
14259 (Binary): Optimize a + (-b) into a -b.
14261 * codegen.cs (CodeGen): Made all methods static.
14263 2002-03-29 Miguel de Icaza <miguel@ximian.com>
14267 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
14268 TypeBuilder property.
14270 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
14273 * tree.cs: Removed the various RecordXXXX, and replaced with a
14274 single RecordDecl. Removed all the accessor methods, and just
14275 left a single access point Type
14277 * enum.cs: Rename DefineEnum to DefineType.
14279 * decl.cs: New abstract method `DefineType' used to unify the
14280 Defines for Enumerations, Interfaces, TypeContainers and
14283 (FindType): Moved LookupInterfaceOrClass here. Moved the
14284 LookupBaseClasses method that used to live in class.cs and
14285 interface.cs here, and renamed to FindType.
14287 * delegate.cs: Implement DefineType. Take advantage of the
14288 refactored pattern for locating the parent builder without taking
14289 the parent_builder argument (which we know does not work if we are
14290 nested, and triggering a toplevel definition).
14292 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14294 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
14295 accessibility of a member has changed during override and report
14298 * class.cs (Method.Define, Property.Define): Only complain on
14299 overrides if the method is private, any other accessibility is
14300 fine (and since we just checked the permission is the same, we are
14303 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
14304 and elif are processed always. The other pre-processing
14305 directives are only processed if we are "taking" the path
14307 2002-03-29 Martin Baulig <martin@gnome.org>
14309 * class.cs (Method.Emit): Only emit symbolic debugging info if the
14310 current location is not Null.
14312 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
14313 a separate method so we can profile it.
14315 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
14316 `span.Seconds' are just seconds, but no minutes or hours.
14317 (MainDriver): Profile the CodeGen.SaveSymbols calls.
14319 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14321 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
14322 Remove the gratuitous set of Final:
14324 // If an interface implementation, then we can set Final.
14325 if (((flags & MethodAttributes.Abstract) == 0) &&
14326 implementing.DeclaringType.IsInterface)
14327 flags |= MethodAttributes.Final;
14329 I do not know what I was smoking when I used that.
14332 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
14333 step into fixing the name resolution issues for delegates and
14334 unifying the toplevel name resolution.
14336 2002-03-28 Martin Baulig <martin@gnome.org>
14338 * class.cs (Method.Emit): If we have a symbol writer, call its
14339 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
14340 tell it about the current method.
14342 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
14343 writer that we're going to emit the first byte of IL code for a new
14344 statement (a new source line).
14345 (EmitContext.EmitTopBlock): If we have a symbol writer, call
14346 EmitContext.Mark() before emitting any code.
14348 * location.cs (SymbolDocument): Return null when we're Null.
14350 * statement.cs (Statement): Moved the `Location loc' variable here.
14351 (Statement.EmitBoolExpression): If we have a symbol writer, call
14352 ec.Mark() before emitting any code to tell it that we're at the
14353 beginning of a new statement.
14354 (StatementExpression): Added `Location' argument to the constructor.
14355 (Block): Added public readonly variable `StartLocation' and public
14356 variable `EndLocation'. The latter is to be set using SetEndLocation().
14357 (Block): Added constructor which takes a start and end location.
14358 (Block.SetEndLocation): New method. This sets the end location.
14359 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
14360 local variables we create.
14361 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
14362 each statement and do also mark the begin and end of the block.
14364 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
14365 tell it the current lexer.Location, use Location.Null for the end of the
14367 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
14368 current block, set its end location using SetEndLocation().
14369 (statement_expression): StatementExpression constructor now takes the
14370 lexer.Location as additional argument.
14371 (for_statement, declare_local_variables): Likewise.
14372 (declare_local_variables): When creating a new implicit block, use the
14373 new Block constructor and pass it the lexer.Location.
14375 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14377 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
14378 members also on the parent interfaces recursively.
14380 2002-03-27 Miguel de Icaza <miguel@ximian.com>
14382 * report.cs: Use new formats, since Gonzalo finished the missing
14385 * expression.cs (Binary.ResolveOperator): added missing operator|
14386 operator& and operator^ for bool/bool.
14388 * cs-parser.jay: CheckDef now takes a Location argument that is
14389 used to report errors more precisly (instead of reporting the end
14390 of a definition, we try to track something which is a lot closer
14391 to the source of the problem).
14393 * cs-tokenizer.cs: Track global token use, so we can properly flag
14394 the use of #define/#undef after the first token has been seen.
14396 Also, rename the reportXXXX to Error_DescriptiveName
14398 * decl.cs (DeclSpace.IsTopLevel): Move property here from
14399 TypeContainer, so that Enum and Interface can use this too.
14401 * class.cs (TypeContainer.LookupInterfaceOrClass,
14402 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
14403 `builder' argument. Typically this was used to pass the parent
14404 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
14407 The problem is that a nested class could trigger the definition of
14408 a toplevel class, and the builder would be obviously wrong in that
14411 So we drop this argument, and we compute dynamically the
14412 TypeBuilder/ModuleBuilder (the correct information was available
14413 to us anyways from DeclSpace.Parent)
14415 * interface.cs (Interface.DefineInterface): Drop builder
14416 parameter cleanup like class.cs
14418 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
14421 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
14424 (Try.Emit): Propagate the returns value from the statement.
14426 (Return.Emit): Even if we are leavning
14428 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
14430 * modifiers.cs: Fix the computation of MethodAttributes flags.
14432 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
14434 * driver.cs: allow compilation of files that start with '/'.
14435 Add a default case when checking the argument of --target.
14437 2002-03-25 Miguel de Icaza <miguel@ximian.com>
14439 * interface.cs: Implement the same search algorithm for types in
14440 the interface code.
14442 * delegate.cs: Do not allow multiple definition.
14444 * Recovered ChangeLog that got accidentally amputated
14446 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
14448 * rootcontext.cs: Load manually enum to allow core classes to
14449 contain enumerations.
14451 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
14452 Update to new static methods in TypeManager.
14454 * typemanager.cs (GetMethod, GetConstructor): Use our
14455 implementation of FindMembers to find the members, since during
14456 corlib compilation, the types are TypeBuilders and GetMethod and
14457 GetConstructor do not work.
14459 Make all methods in TypeManager static.
14461 (InitCodeHelpers): Split the functionality from
14462 the InitCodeTypes function.
14464 * driver.cs: Call InitCodeHelpers after we have populated the
14467 * cs-parser.jay (delegate_declaration): we did not used to compute
14468 the delegate name correctly for void delegates.
14470 2002-03-24 Miguel de Icaza <miguel@ximian.com>
14472 * rootcontext.cs (RootContext): Init the interface_resolve_order
14473 and type_container_resolve_order always.
14475 (ResolveCore, BootstrapCorlib_ResolveClass,
14476 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
14477 compiler when compiling with --nostdlib
14479 * class.cs (TypeContainer.DefineType): Check that our parent is
14480 not null. This test is most important when we are bootstraping
14483 * codegen.cs: Split out the symbol writing code.
14485 2002-03-25 Martin Baulig <martin@gnome.org>
14487 * driver.cs (-g): Made -g an alias for --debug.
14489 2002-03-24 Martin Baulig <martin@gnome.org>
14491 * codegen.cs (SymbolWriter): New public variable. Returns the
14492 current symbol writer.
14493 (CodeGen): Added `bool want_debugging_support' argument to the
14494 constructor. If true, tell the ModuleBuild that we want debugging
14495 support and ask it for the ISymbolWriter.
14496 (Save): If we have a symbol writer, call it's Close() method after
14497 saving the assembly.
14499 * driver.c (--debug): New command line argument to create a
14500 debugger information file.
14502 * location.cs (SymbolDocument): New public property. Returns an
14503 ISymbolDocumentWriter object for the current source file or null
14504 if we don't have a symbol writer.
14506 2002-03-21 Miguel de Icaza <miguel@ximian.com>
14508 * driver.cs (LoadAssembly): Correctly return when all the paths
14509 have been tried and not before.
14511 * statement.cs (Switch.Emit): return the actual coverage for this
14512 statement (returns/not-returns)
14514 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
14515 switch of the statement if we are the last switch section. That
14516 kills two problems: try/catch problems (we used to emit an empty
14517 nop at the end) and switch statements where all branches would
14520 2002-03-19 Miguel de Icaza <miguel@ximian.com>
14522 * driver.cs: Add default assemblies (the equivalent to the
14523 Microsoft CSC.RSP file)
14525 * cs-tokenizer.cs: When updating `cols and setting it to zero,
14526 also update tokens_seen and set it to false.
14528 * driver.cs: Implement --recurse for Mike.
14530 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
14531 correctly splitting out the paths.
14533 2002-03-18 Miguel de Icaza <miguel@ximian.com>
14535 * interface.cs (Interface.PopulateProperty): Instead of using
14536 `parent' as the declaration space for the set parameters, use
14539 * support.cs (InternalParameters): InternalParameters constructor
14540 takes a DeclSpace instead of a TypeContainer.
14542 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
14543 types are being initialized, load the address of it before calling
14546 (New): Provide a mechanism to disable the generation of local
14547 value type temporaries when the caller will be providing us with
14548 an address to store it.
14550 (ArrayCreation.EmitDynamicInitializers): Use it.
14552 2002-03-17 Miguel de Icaza <miguel@ximian.com>
14554 * expression.cs (Invocation.EmitArguments): Only probe for array
14555 property if there is more than one argument. Sorry about that.
14557 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
14558 empty param arrays.
14560 * class.cs (Method.LabelParameters): Fix incorrect code path that
14561 prevented the `ParamArrayAttribute' from being applied to the
14564 2002-03-16 Miguel de Icaza <miguel@ximian.com>
14566 * support.cs (ReflectionParameters): Correctly compute whether the
14567 last argument is a params array. Fixes the problem with
14570 * typemanager.cs: Make the assemblies array always be non-null
14571 (empty, but non-null)
14573 * tree.cs (RecordDecl): New function that abstracts the recording
14574 of names. This reports error 101, and provides a pointer to the
14575 previous declaration. Fixes a crash in the compiler.
14577 * cs-parser.jay (constructor_declaration): Update to new grammar,
14578 and provide a constructor_body that can be empty.
14580 2002-03-15 Miguel de Icaza <miguel@ximian.com>
14582 * driver.cs: Add support for --resources.
14584 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
14585 Make all types for the various array helper methods be integer.
14587 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
14588 CheckState to ConvCast.
14590 (ConvCast): Now it takes a `checked' state argument, to avoid
14591 depending on the emit context for the conversion, and just using
14592 the resolve time setting.
14594 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
14595 instead of Invocation.EmitArguments. We do not emit the original
14596 arguments, instead we emit those which have been converted to
14597 unsigned int expressions.
14599 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
14601 * codegen.cs: ditto.
14603 * expression.cs (LocalVariableReference): Drop the use of the
14604 Store function that depended on the variable index.
14606 * statement.cs (VariableInfo): Drop the `Idx' property from this
14607 class, as this is not taking into account the indexes for
14608 temporaries tat we generate during the execution, getting the
14611 * class.cs: First emit class initializers, then call the parent
14614 * expression.cs (Binary): Fix opcode emision.
14615 (UnaryMutator.EmitCode): Support checked code generation
14617 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
14618 matches for events for both the Static and Instance scans,
14619 pointing to the same element. Fix that.
14621 2002-03-14 Miguel de Icaza <miguel@ximian.com>
14623 * rootcontext.cs (ResolveTree): Always set the
14624 interface_resolve_order, because nested interfaces will be calling
14627 * class.cs (GetInterfaceOrClass): Track the same resolution
14628 process used by TypeManager.LookupType. This fixes the nested
14629 type lookups in class declarations (separate path from
14632 (TypeContainer.DefineType): Also define nested interfaces.
14633 (TypeContainer.RegisterOrder): New public function used to
14634 register the order in which child interfaces need to be closed.
14636 Nested interfaces need to be closed after their parents have been
14639 * interface.cs (InterfaceAttr): Put all the logic for computing
14640 the interface attribute here.
14642 (DefineInterface): Register our interface order with the
14643 RootContext or with the TypeContainer depending on the case.
14645 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14647 * cs-parser.jay: rework foreach statement to work with the new
14648 changes to the policy on SimpleNames.
14650 * report.cs: support Stacktrace on warnings as well.
14652 * makefile: drop --unsafe and /unsafe from the compile.
14654 2002-03-13 Ravi Pratap <ravi@ximian.com>
14656 * ecore.cs (StandardConversionExists): Modify to take an Expression
14657 as the first parameter. Ensure we do null -> reference type conversion
14660 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14661 temporary Expression objects.
14663 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14665 * interface.cs: workaround bug in method overloading resolution
14666 (there is already a bugzilla bug for it).
14668 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14670 We could also solve this problem by having a separate path for
14671 performing type lookups, instead of DoResolve, we could have a
14672 ResolveType entry point, and only participating pieces of the
14673 production (simplename, deref, array) would implement this.
14675 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14676 signal SimpleName to only resolve type names and not attempt to
14677 resolve anything else.
14679 * expression.cs (Cast): Set the flag.
14681 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14683 * class.cs: Only report 108 if there is no `new' modifier.
14685 * cs-parser.jay: rework foreach statement to work with the new
14686 changes to the policy on SimpleNames.
14688 * report.cs: support Stacktrace on warnings as well.
14690 * makefile: drop --unsafe and /unsafe from the compile.
14692 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14694 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14695 lookups here, instead of doing that at parse time. This means
14696 that our grammar will not introduce `LocalVariableReferences' as
14697 expressions at this point. That solves the problem of code like
14701 static void Main ()
14705 This is only half the fix. The full fix requires parameters to
14706 also be handled in this way.
14708 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14709 makes the use more obvious of the DeclSpace. The
14710 ec.TypeContainer.TypeBuilder is now only used to pull the
14711 TypeBuilder for it.
14713 My theory is that I can get rid of the TypeBuilder completely from
14714 the EmitContext, and have typecasts where it is used (from
14715 DeclSpace to where it matters).
14717 The only pending problem is that the code that implements Aliases
14718 is on TypeContainer, and probably should go in DeclSpace.
14720 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14721 lookups here, instead of doing that at parse time. This means
14722 that our grammar will not introduce `LocalVariableReferences' as
14723 expressions at this point. That solves the problem of code like
14727 static void Main ()
14731 This is only half the fix. The full fix requires parameters to
14732 also be handled in this way.
14734 * class.cs (Property.DefineMethod): When implementing an interface
14735 method, set newslot, when implementing an abstract method, do not
14736 set the flag (before we tried never setting it, or always setting
14737 it, which is the difference).
14738 (Indexer.DefineMethod): same.
14739 (Method.DefineMethod): same.
14741 * ecore.cs: Only set the status used flag if we get back a Field.
14743 * attribute.cs: Temporary hack, so Paolo can keep working.
14745 2002-03-08 Ravi Pratap <ravi@ximian.com>
14747 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14748 the unmanaged type in the case we have a MarshalAs attribute.
14750 (Resolve): Handle the case when we are parsing the special MarshalAs
14751 attribute [we need to store the unmanaged type to use later]
14753 * typemanager.cs (marshal_as_attr_type): Built in type for the
14754 MarshalAs Attribute.
14756 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14757 on parameters and accordingly set the marshalling info.
14759 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14761 * class.cs: Optimizing slightly by removing redundant code after
14762 we switched to the `NoTypes' return value.
14763 (Property.DefineMethod): use NoTypes here too.
14765 This fixes the bug I introduced in my last batch of changes.
14767 2002-03-05 Ravi Pratap <ravi@ximian.com>
14769 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14771 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14772 Enums since those are types too.
14774 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14776 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14777 thanks to a call during the lookup process.
14779 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14781 * statement.cs (Foreach): Lots of work to accomodate a particular
14782 kind of foreach statement that I had not kept in mind. It is
14783 possible to have foreachs on classes that provide a GetEnumerator
14784 method that return objects that implement the "pattern" for using
14785 a foreach, there is no need to support GetEnumerator
14788 This is needed to compile nant.
14790 * decl.cs: Only report 114 if the member is not `Finalize' and if
14791 the warning level is at least 2.
14793 * class.cs: Moved the compare function from Method to
14796 (MethodSignature.InheritableMemberSignatureCompare): Add new
14797 filter function that is used to extract inheritable methods from a
14800 (Method.Define): Use the new `inheritable_method_signature_filter'
14803 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14806 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14808 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14810 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14812 * expression.cs: Pass location information to
14813 ConvertImplicitStandard.
14815 * class.cs: Added debugging code to track return values from
14818 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14820 * expression.cs (Is.DoResolve): If either side of the `is' is an
14821 interface, do not flag the warning.
14823 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14826 * report.cs: Allow for --fatal to be used with --probe.
14828 * typemanager.cs (NoTypes): Move the definition for the empty Type
14831 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14833 (TypeContainer.DefineProxy): New function used to proxy to parent
14834 implementations when implementing interfaces.
14835 (TypeContainer.ParentImplements): used to lookup if our parent
14836 implements a public function that is required by an interface.
14837 (TypeContainer.VerifyPendingMethods): Hook this up.
14839 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14840 `modules' and `assemblies' arraylists into arrays. We only grow
14841 these are the very early start up of the program, so this improves
14842 the speedof LookupType (nicely measured).
14844 * expression.cs (MakeByteBlob): Replaced unsafe code with
14845 BitConverter, as suggested by Paolo.
14847 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14848 folding of string concatenation, but if either side is a string,
14849 and the other is not, then return null, and let the runtime use
14850 the concatenation on the string plus the object (using
14851 `Object.ToString').
14853 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14855 Constant Folding has been implemented now.
14857 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14858 the error instead on types that are not supported in one's
14861 * constant.cs (Constant and all children): New set of functions to
14862 perform implict and explicit conversions.
14864 * ecore.cs (EnumConstant): Implement the new functions to perform
14865 conversion by proxying to the child expression.
14867 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14868 own separate setting that can not be turned off from the command
14869 line using --unchecked or --checked and is only controlled using
14870 the checked/unchecked statements and expressions. This setting is
14871 used by the constant folder to flag errors.
14873 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14874 ConstantCheckState as well.
14876 During Resolve, they also have to flag the state, because the
14877 constant folder runs completely in the Resolve phase.
14879 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14882 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14884 * cfold.cs: New file, this file contains the constant folder.
14886 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14887 argument to track whether we are using the resulting address to
14888 load or store a value and provide better error messages.
14890 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14891 new AddressOf arguments.
14893 * statement.cs (Foreach.EmitCollectionForeach): Update
14895 * expression.cs (Argument.Emit): Call AddressOf with proper
14896 arguments to track usage.
14898 (New.DoEmit): Call AddressOf with new arguments.
14900 (Unary.Emit): Adjust AddressOf call.
14902 2002-03-01 Ravi Pratap <ravi@ximian.com>
14904 * cs-parser.jay (member_access): Change the case for pre-defined types
14905 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14908 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14911 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14912 essentially like methods and apply attributes like MethodImplOptions to them too.
14914 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14917 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14918 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14921 * Update code everywhere accordingly.
14923 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14925 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14927 2002-02-28 Ravi Pratap <ravi@ximian.com>
14929 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14930 try performing lookups against those instead of jumping straight into using
14931 the 'using' clauses.
14933 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14935 (LookupType): Perform lookups in implicit parents too.
14937 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14938 sequence as RootContext.LookupType.
14940 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14941 the various cases of namespace lookups into this method.
14943 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14945 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14946 in positional arguments)
14948 * class.cs (Operator): Update the AllowedModifiers to contain
14951 * cs-parser.jay: Update operator declaration to allow for the
14952 operator body to be empty.
14954 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14957 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14959 * class.cs (Method.Emit): Label parameters.
14961 * driver.cs: Return 1 or 0 as the program exit code.
14963 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14965 * expression.cs: Special case the `null' object when trying to
14966 auto-compute the type, as anything can be explicitly converted to
14969 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14970 spotting this Paolo.
14972 (Expression.ImplicitNumericConversion): Perform comparissions of
14973 the type using the underlying type in the case of an enumeration
14974 rather than using the enumeration type for the compare.
14976 Cope with the underlying == type case, which is not possible to
14979 (Expression.ConvertNumericExplicit): Perform comparissions of
14980 the type using the underlying type in the case of an enumeration
14981 rather than using the enumeration type for the compare.
14983 * driver.cs: If the user does not supply an extension, assume .exe
14985 * cs-parser.jay (if_statement): Rewrote so that we can track the
14986 location for the if statement.
14988 * expression.cs (Binary.ConstantFold): Only concat strings when
14989 the operation is "+", not everything ;-)
14991 * statement.cs (Statement.EmitBoolExpression): Take a location
14993 (If, While, Do): Track location.
14995 * expression.cs (Binary.ResolveOperator): In the object + string
14996 case, I was missing a call to ConvertImplicit
14998 2002-02-25 Ravi Pratap <ravi@ximian.com>
15000 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
15001 Location arguments. Ensure we use RootContext.LookupType to do our work
15002 and not try to do a direct Type.GetType and ModuleBuilder.GetType
15004 * interface.cs (PopulateMethod): Handle the type of the parameter being
15007 * expression.cs (Invocation.BetterFunction): Handle the case when we
15008 have a params method with no fixed arguments and a call is made with no
15011 2002-02-25 Miguel de Icaza <miguel@ximian.com>
15013 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
15014 the verbatim-string-literal
15016 * support.cs (InternalParameters.ParameterModifier): handle null
15018 (InternalParameters.ParameterType): ditto.
15020 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
15021 duplicating the name of the variable parameter.
15022 (GetParameterByName): Fix bug where we were not looking up array
15023 paramters if they were the only present (thanks Paolo!).
15024 (GetParameterInfo): We only have an empty set of types if both
15025 fixed and array are set to null.
15026 (GetParameterInfo-idx): Handle FixedParameter == null
15028 * cs-parser.jay: Handle the case where there is no catch
15029 statements (missing null test).
15031 2002-02-22 Miguel de Icaza <miguel@ximian.com>
15033 * driver.cs (MainDriver): Be conservative on our command line
15036 Catch DirectoryNotFoundException when calling GetFiles.
15038 (SplitPathAndPattern): Used to split the input specification into
15039 a path and a pattern that we can feed to Directory.GetFiles.
15041 2002-02-21 Miguel de Icaza <miguel@ximian.com>
15043 * statement.cs (Fixed): Implement the last case of the Fixed
15044 statement (string handling).
15046 * expression.cs (StringPtr): New class used to return a char * to
15047 a string; Used by the Fixed statement.
15049 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
15051 * expression.cs (Binary.ResolveOperator): Remove redundant
15052 MemberLookup pn parent type.
15053 Optimize union call, we do not need a union if the types are the same.
15054 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
15057 Specialize the use of MemberLookup everywhere, instead of using
15058 the default settings.
15060 (StackAlloc): Implement stackalloc keyword.
15062 * cs-parser.jay: Add rule to parse stackalloc.
15064 * driver.cs: Handle /h, /help, /?
15066 * expression.cs (MakeByteBlob): Removed the hacks we had in place
15067 before we supported unsafe code.
15069 * makefile: add --unsafe to the self compilation of mcs.
15071 2002-02-20 Miguel de Icaza <miguel@ximian.com>
15073 * expression.cs (PointerArithmetic): New class that is used to
15074 perform pointer arithmetic.
15075 (Binary.Resolve): Handle pointer arithmetic
15076 Handle pointer comparission.
15077 (ArrayPtr): Utility expression class that is used to take the
15078 address of an array.
15080 (ElementAccess): Implement array access for pointers
15082 * statement.cs (Fixed): Implement fixed statement for arrays, we
15083 are missing one more case before we are done.
15085 * expression.cs (Indirection): Implement EmitAssign and set the
15086 ExprClass to Variable. This allows pointer dereferences to be
15087 treated as variables, and to have values assigned to them.
15089 * ecore.cs (Expression.StoreFromPtr): New utility function to
15090 store values dereferencing.
15092 2002-02-20 Ravi Pratap <ravi@ximian.com>
15094 * expression.cs (Binary.ResolveOperator): Ensure that we are
15095 not trying to operate on a void type - this fixes the reported
15098 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
15099 the parent implementation is sealed.
15101 * ../errors/cs0239.cs : Add.
15103 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
15105 * typemanager.cs (unverifiable_code_type): Corresponds to
15106 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
15107 which have unsafe code in them.
15109 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
15112 2002-02-19 Miguel de Icaza <miguel@ximian.com>
15114 * cs-tokenizer.cs: Add support for @"litreal strings"
15116 Make tokenizer accept pre-processor directives
15117 on any column (remove the old C-like limitation).
15119 * rootcontext.cs (EmitCode): Emit any global attributes.
15120 (AddGlobalAttributes): Used to keep track of assembly attributes.
15122 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
15124 * cs-parser.jay: Add support for global attributes.
15126 2002-02-17 Miguel de Icaza <miguel@ximian.com>
15128 * expression.cs (Indirection): New helper class. Unary will
15129 create Indirection classes to be able to implement the
15130 IMemoryLocation interface on it.
15132 2002-02-16 Miguel de Icaza <miguel@ximian.com>
15134 * cs-parser.jay (fixed_statement): reference the right statement.
15136 * statement.cs (Fixed.Emit): Finish implementing the fixed
15137 statement for the &x case.
15139 2002-02-14 Miguel de Icaza <miguel@ximian.com>
15141 * class.cs (Property.Define, Method.Define): Remove newslot when
15144 * modifiers.cs: My use of NewSlot when `Abstract' was set was
15145 wrong. NewSlot should only be used if the `new' keyword is present.
15147 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
15148 locating our system dir. Sorry about this.
15150 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15152 * driver.cs (GetSystemDir): Compute correctly the location of our
15153 system assemblies. I was using the compiler directory instead of
15154 the library directory.
15156 2002-02-13 Ravi Pratap <ravi@ximian.com>
15158 * expression.cs (BetterFunction): Put back in what Miguel commented out
15159 since it is the correct fix. The problem is elsewhere ;-)
15161 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
15162 parameters of the parms method are themselves compatible or not !
15164 (StandardConversionExists): Fix very dangerous bug where we were forgetting
15165 to check that a class implements an interface before saying that an implicit
15166 conversion was allowed. Use ImplementsInterface to do the checking.
15168 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15170 * class.cs (Method.Define): Track whether we are an explicit
15171 implementation or not. And only call DefineMethodOverride if we
15172 are an explicit implementation.
15174 (Property.DefineMethod): Ditto.
15176 2002-02-11 Ravi Pratap <ravi@ximian.com>
15178 * expression.cs (BetterFunction): Catch hideous bug which was
15179 preventing us from detecting ambiguous calls due to implicit casts i.e
15182 2002-01-29 Miguel de Icaza <miguel@ximian.com>
15184 * support.cs (Pair): Remove un-needed method. I figured why I was
15185 getting the error in cs-parser.jay, the variable in a foreach loop
15186 is readonly, and the compiler does not really treat this as a variable.
15188 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
15189 instead of EQUALS in grammar.
15191 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
15193 * expression.cs (Unary.DoResolve): Check whether the argument is
15196 2002-01-28 Miguel de Icaza <miguel@ximian.com>
15198 * support.cs: Api for Pair to set a value. Despite the fact that
15199 the variables are public the MS C# compiler refuses to compile
15200 code that accesses the field if the variable is part of a foreach
15203 * statement.cs (Fixed): Begin implementation of the fixed
15206 (Block.AddVariable): Return the VariableInfo on success and null
15207 on failure instead of true/false.
15209 * cs-parser.jay (foreach): Catch errors on variables already
15210 defined (we were ignoring this value before) and properly unwind
15211 the block hierarchy
15213 (fixed_statement): grammar for the fixed statement.
15215 2002-01-25 Miguel de Icaza <miguel@ximian.com>
15217 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
15218 pointer types to be incretemented.
15220 (SizeOf): Implement.
15222 * cs-parser.jay (pointer_member_access): Implement
15223 expr->IDENTIFIER production.
15225 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
15226 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
15229 (Unary): Implement indirection.
15231 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
15232 use in non-unsafe context).
15234 (SimpleName.DoResolve): Check for pointers in field access on safe
15237 (Expression.LoadFromPtr): Factor the load-indirect code in this
15238 function. This was duplicated in UnboxCast and ParameterReference
15240 2002-01-24 Miguel de Icaza <miguel@ximian.com>
15242 * expression.cs (ComposedCast): report an error if a pointer cast
15243 is used in a safe region.
15245 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
15246 pointer type casts in unsafe context.
15248 * codegen.cs (EmitContext): Set up IsUnsafe.
15250 * cs-parser.jay (non_expression_type): Add productions for pointer
15253 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
15254 code. We should not use force into static mode if the method is
15255 not virtual. Fixes bug in MIS
15257 * statement.cs (Do.Emit, While.Emit, For.Emit,
15258 Statement.EmitBoolExpression): Add support to Do and While to
15259 propagate infinite loop as `I do return' semantics.
15261 Improve the For case to also test for boolean constants.
15263 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
15264 to the list of attributes we can add.
15266 Remove `EmitContext' argument.
15268 * class.cs (Method.Define): Apply parameter attributes.
15269 (Constructor.Define): Apply parameter attributes.
15270 (MethodCore.LabelParameters): Move here the core of labeling
15273 * support.cs (ReflectionParameters.ParameterModifier,
15274 InternalParameters.ParameterModifier): Use IsByRef on the type and
15275 only return the OUT bit for these parameters instead of in/out/ref
15278 This is because I miss-understood things. The ParameterInfo.IsIn
15279 and IsOut represent whether the parameter has the [In] and [Out]
15282 2002-01-22 Miguel de Icaza <miguel@ximian.com>
15284 * ecore.cs (FieldExpr.Emit): Release temporaries.
15286 * assign.cs (LocalTemporary.Release): new function.
15288 * codegen.cs (EmitContext.GetTemporaryStorage,
15289 EmitContext.FreeTemporaryStorage): Rework the way we deal with
15290 temporary storage. Now we can "put back" localbuilders when we
15293 2002-01-21 Miguel de Icaza <miguel@ximian.com>
15295 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
15296 need to make a copy of the variable to generate verifiable code.
15298 2002-01-19 Miguel de Icaza <miguel@ximian.com>
15300 * driver.cs: Compute dynamically the system directory.
15302 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
15303 Slower, but more generally useful. Used by the abstract
15304 registering implementation.
15306 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
15307 the rules for the special rule on Type/instances. First check if
15308 we have the same name, and if so, try that special static path
15309 rather than the instance path.
15311 2002-01-18 Miguel de Icaza <miguel@ximian.com>
15313 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
15316 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
15317 Enum, ValueType, Delegate or Array for non-corlib compiles.
15319 * cs-tokenizer.cs: Catch long identifiers (645)
15321 * typemanager.cs (IndexerPropetyName): Ravi never tested this
15324 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
15325 fix, we were returning too early, so we were not registering
15326 pending methods from abstract classes.
15328 Do not register pending methods if the class is abstract.
15330 * expression.cs (Conditional.DoResolve): Report circular implicit
15331 conversions when we neecd to compute it for conditional
15334 (Is.DoResolve): If the expression is always of the provided type,
15335 flag warning 183. If the expression can not ever be of the
15336 provided type flag warning 184.
15338 * class.cs: Catch 169 as well.
15340 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
15343 2002-01-18 Nick Drochak <ndrochak@gol.com>
15345 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
15347 2002-01-17 Miguel de Icaza <miguel@ximian.com>
15349 * interface.cs: (PopulateMethod): Check for pointers being defined
15350 only if the unsafe context is active.
15351 (PopulateProperty): ditto.
15352 (PopulateIndexer): ditto.
15354 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
15355 specified. If pointers are present, make sure that they are
15356 present in an unsafe context.
15357 (Constructor, Constructor.Define): ditto.
15358 (Field, Field.Define): ditto.
15359 (Property, Property.Define): ditto.
15360 (Event, Event.Define): ditto.
15362 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
15363 hashtable if there are classes or structs defined.
15365 * expression.cs (LocalVariableReference.DoResolve): Simplify this
15366 code, as the constant resolution moved.
15368 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
15369 the metadata, so we can flag error 133.
15371 * decl.cs (MemberCore.UnsafeOK): New function to test that a
15372 pointer is being declared in an unsafe context.
15374 2002-01-16 Miguel de Icaza <miguel@ximian.com>
15376 * modifiers.cs (Modifiers.Check): Require a Location argument.
15377 Report error 227 for Unsafe use.
15379 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
15381 * statement.cs (For.Emit): If the test is null, then report that
15382 we do `return', as we wont reach anything afterwards.
15384 (Switch.SwitchGoverningType): Track the expression that matched
15387 * driver.cs: Allow negative numbers as an error code to flag.
15389 * cs-parser.jay: Handle 1551.
15391 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
15393 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15395 * cs-parser.jay: Report 1518 (type declaration can only contain
15396 class, struct, interface, enum or delegate)
15398 (switch_label): Report 1523 (keywords `case' or `default' must
15401 (opt_switch_sections): Report 1522 (empty switch)
15403 * driver.cs: Report 1515 (response file specified multiple times)
15404 Report 1516 (Source file specified multiple times).
15406 * expression.cs (Argument.Resolve): Signal 1510
15408 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
15409 access not allowed in static code)
15411 2002-01-11 Ravi Pratap <ravi@ximian.com>
15413 * typemanager.cs (IsPointerType): Utility method which we are going
15416 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
15417 the object type, so we take care of that.
15419 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
15421 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
15422 added to non-params parameters :-)
15424 * typemanager.cs (CSharpName): Include 'void' type too.
15426 (void_ptr_type): Include in the set of core types.
15428 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
15431 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
15434 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
15435 completely forgotten about it.
15437 2002-01-10 Ravi Pratap <ravi@ximian.com>
15439 * cs-parser.jay (pointer_type): Add. This begins our implementation
15440 of parsing rules for unsafe code.
15442 (unsafe_statement): Implement.
15444 (embedded_statement): Modify to include the above.
15446 * statement.cs (Unsafe): Implement new class for unsafe blocks.
15448 * codegen.cs (EmitContext.InUnsafe): Add. This determines
15449 if the current context is an unsafe one.
15451 * cs-parser.jay (local_variable_pointer_type): Since local variable types
15452 are handled differently, we need separate rules for them.
15454 (local_variable_declaration): Update to use local_variable_pointer_type
15455 to allow variable declarations of unmanaged pointer types.
15457 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
15458 in unsafe contexts.
15460 * ../errors/cs0214.cs : Add.
15462 2002-01-16 Nick Drochak <ndrochak@gol.com>
15464 * makefile: remove 'response' file when cleaning.
15466 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15468 * cs-parser.jay: Report 1524.
15470 2002-01-14 Miguel de Icaza <miguel@ximian.com>
15472 * typemanager.cs (RegisterMethod): drop checking if we have
15473 registered this from here
15475 2002-01-12 Miguel de Icaza <miguel@ximian.com>
15477 * class.cs (Method.EmitDestructor): Implement calling our base
15480 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
15481 value of InFinally.
15483 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
15484 this routine and will wrap the call in a try/catch block. Deal
15487 2002-01-11 Miguel de Icaza <miguel@ximian.com>
15489 * ecore.cs (Expression.MemberLookup): instead of taking a
15490 parameter `same_type' that was used to tell whether we could
15491 access private members we compute our containing type from the
15494 (FieldExpr): Added partial support for volatile fields. This does
15495 not work for volatile fields exposed from assemblies, as I can not
15496 figure out how to extract the modreq from it.
15498 Updated all the source files to use this.
15500 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
15501 because it is referenced by MemberLookup very often.
15503 2002-01-09 Ravi Pratap <ravi@ximian.com>
15505 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
15506 TypeBuilder.GetCustomAttributes to retrieve what we need.
15508 Get rid of redundant default_member_attr_type as this is the same as
15509 default_member_type which already exists.
15511 * interface.cs, attribute.cs : Update accordingly.
15513 2002-01-08 Miguel de Icaza <miguel@ximian.com>
15515 * typemanager.cs: Enable IndexerPropertyName again. It does not
15516 work for TYpeBuilders though. Ravi, can you please fix this?
15518 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
15520 * expression.cs (Argument.Emit): Handle the case of ref objects
15521 being passed to ref functions;
15523 (ParameterReference.EmitLoad): Loads the content of the pointer
15524 without dereferencing.
15526 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15528 * cs-tokenizer.cs: Implemented the pre-processing expressions.
15530 2002-01-08 Ravi Pratap <ravi@ximian.com>
15532 * class.cs (Indexer.DefineMethod): Incorporate the interface
15533 type in the name of the method if we are doing explicit interface
15536 * expression.cs (ConversionExists): Remove as it is completely obsolete.
15538 (BetterConversion): Fix extremely trivial bug where we were referring to
15539 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
15542 * ../errors/bug16.cs : Add although we have fixed it.
15544 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15546 * expression.cs (BaseIndexer): Begin implementation.
15548 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
15550 * cs-parser.jay (indexer_declarator): Use qualified_identifier
15551 production directly to remove a shift/reduce, and implement
15552 explicit interface implementation.
15554 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
15555 after a floating point suffix.
15557 * expression.cs (DoNumericPromotions): Improved the conversion for
15558 uint/uint. If we have a constant, we avoid doing a typecast to a
15561 * class.cs (Indexer): Implement explicit interface implementation
15564 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
15566 * class.cs: make the default instance constructor public and hidebysig.
15568 2001-01-03 Ravi Pratap <ravi@ximian.com>
15570 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
15571 so we can call it from elsewhere.
15573 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
15574 we emit it internally if the class has a defined indexer; otherwise the user
15575 emits it by decorating the class definition with the DefaultMemberAttribute.
15577 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
15578 attribute is not used on a type which defines an indexer.
15580 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
15581 character when we skip whitespace.
15583 * ../errors/cs0646.cs : Add.
15585 2002-01-03 Miguel de Icaza <miguel@ximian.com>
15587 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
15590 * makefile: Add practical target `mcs3.exe' which builds the third
15591 generation compiler.
15593 * expression.cs (New): Fix structures constructor calling.
15595 * class.cs (Property, Method, Indexer): Emit Final flag on the
15596 method if we are an interface implementation and we are not
15599 * ecore.cs (PropertyExpr): New public field `IsBase', tells
15600 whether this property is referencing a `base' method.
15602 * expression.cs (Invocation.EmitCall): take an extra argument:
15603 is_base, this is used to determine whether the `call' or
15604 `callvirt' opcode should be used.
15607 * delegate.cs: update EmitCall.
15609 * class.cs (Method.Define): Set NewSlot for the cases where we are
15610 not implementing an interface method.
15612 (Property.Define): ditto.
15614 2002-01-02 Miguel de Icaza <miguel@ximian.com>
15616 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
15617 'r'. Allows mcs to parse itself fully.
15619 2002-01-02 Ravi Pratap <ravi@ximian.com>
15621 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
15622 of the number of initializers that require the InitializeArray method.
15624 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15625 update the above field where necessary.
15627 (MakeByteBlob): Update accordingly.
15629 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15632 (EmitDynamicInitializers): Update in accordance with the new optimization.
15634 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15635 same OpCode applies.
15637 * cs-parser.jay : Fix some glaring errors I introduced.
15639 2002-01-01 Ravi Pratap <ravi@ximian.com>
15641 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15642 so that we can check for name clashes there too.
15644 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15645 for interface indexers.
15647 * interfaces.cs (Define): Emit the default member attribute.
15649 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15650 variable was being referred to while setting the value ;-)
15652 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15654 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15655 byte-by-byte information when we know the data is zero.
15657 Make the block always a multiple of 4, because
15658 DefineInitializedData has a bug.
15660 * assign.cs: Fix, we should assign from the temporary, not from
15663 * expression.cs (MakeByteBlob): Fix my incorrect code.
15665 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15667 * typemanager.cs (EnumToUnderlying): This function is used to get
15668 the underlying type from an enumeration, because it does not
15671 * constant.cs: Use the I4_S form for values between -128 and 127.
15673 * statement.cs (Block.LookupLabel): Looks up a label.
15674 (Block): Drop support for labeled blocks.
15676 (LabeledStatement): New kind of statement that represents a label
15679 (Goto): Finally implement this bad boy.
15681 * cs-parser.jay: Update to reflect new mechanism to implement
15684 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15686 * codegen.cs (EmitContext.This): a codegen property that keeps the
15687 a single instance of this instead of creating many different this
15690 * delegate.cs (Delegate.DoResolve): Update to use the property;
15692 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15694 * expression.cs (BaseAccess.DoResolve): Ditto.
15696 2001-12-29 Ravi Pratap <ravi@ximian.com>
15698 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15699 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15701 (InitCoreTypes): Update accordingly.
15703 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15704 so we can quickly store the state.
15706 (ApplyAttributes): Set the correct implementation flags
15707 for InternalCall methods.
15709 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15711 * expression.cs (EmitCall): if a method is not virtual, then do
15712 not use callvirt on it.
15714 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15715 user defined stuff) requires the use of stobj, which takes an
15716 address on the stack instead of an array and an index. So emit
15717 the Ldelema operation for it.
15719 (EmitStoreOpcode): Use stobj for valuetypes.
15721 (UnaryMutator.EmitCode): Use the right 1 value depending on
15722 whether we are dealing with int64/uint64, float or doubles.
15724 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15725 constructors that I implemented last night.
15727 (Constructor.IsDefault): Fix to work properly for static
15730 * cs-parser.jay (CheckDef): report method signature errors.
15731 Update error number 103 to be 132.
15733 * decl.cs: New AdditionResult enumeration value: MethodExists.
15734 Although we do this check for methods later on in the semantic
15735 analysis, catching repeated default constructors is so easy that
15736 we catch these here.
15738 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15741 (ParameterReference.EmitAssign, Emit): handle
15744 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15745 (ArrayAccess.EmitStoreOpcode): ditto.
15747 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15749 * expression.cs (MakeByteBlob): Complete all the missing types
15750 (uint, short, ushort, byte, sbyte)
15752 * class.cs: Only init instance field initializers on instance
15755 Rename `constructors' to instance_constructors.
15757 (TypeContainer.AddConstructor): Only add constructors to the list
15758 if it is not static.
15760 Make sure that we handle default_static_constructor independently
15761 everywhere where we handle instance_constructors
15763 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15765 * class.cs: Do not lookup or create a base initializer for a
15766 static constructor.
15768 (ConstructorInitializer.Resolve): use the proper type to lookup
15771 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15773 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15776 * decl.cs: CloseType is now an virtual method, the default
15777 implementation just closes this type.
15779 2001-12-28 Ravi Pratap <ravi@ximian.com>
15781 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15782 to PreserveSig by default. Also emit HideBySig on such methods.
15784 Basically, set the defaults to standard values.
15786 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15787 argument, if candidate is better, it can't be worse than the best !
15789 (Invocation): Re-write bits to differentiate between methods being
15790 applicable in their expanded form and their normal form - for params
15793 Get rid of use_standard everywhere as only standard conversions are allowed
15794 in overload resolution.
15796 More spec conformance.
15798 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15800 * driver.cs: Add --timestamp, to see where the compiler spends
15803 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15804 `this' in static code.
15806 (SimpleName.DoResolve): Implement in terms of a helper function
15807 that allows static-references to be passed upstream to
15810 (Expression.ResolveWithSimpleName): Resolve specially simple
15811 names when called by MemberAccess to implement the special
15814 (Expression.ImplicitReferenceConversion): Handle conversions from
15815 Null to reference types before others, as Null's type is
15818 * expression.cs (Invocation.EmitCall): Handle the special case of
15819 calling methods declared on a reference type from a ValueType
15820 (Base classes System.Object and System.Enum)
15822 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15823 the left hand side is a TypeExpr, not on every enumeration.
15825 (Binary.Resolve): If types are reference types, then do a cast to
15826 object on operators != and == of both arguments.
15828 * typemanager.cs (FindMembers): Extract instance and static
15829 members if requested.
15831 * interface.cs (PopulateProperty): Use void_type instead of null
15832 as the return type for the setter method.
15834 (PopulateIndexer): ditto.
15836 2001-12-27 Ravi Pratap <ravi@ximian.com>
15838 * support.cs (ReflectionParameters): Fix minor bug where we
15839 were examining the wrong parameter for the ParamArray attribute.
15841 Cope with requests for the type of the parameter at position
15842 greater than the params parameter's. We now return the element
15843 type of the params array as that makes more sense.
15845 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15846 accordingly as we no longer have to extract the element type
15849 (Invocation.OverloadResolve): Update.
15851 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15853 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15854 against IEnumerator, test whether the return value is a descendant
15855 of the IEnumerator interface.
15857 * class.cs (Indexer.Define): Use an auxiliary method to implement
15858 the other bits of the method definition. Begin support for
15859 explicit interface implementation.
15861 (Property.DefineMethod): Use TypeManager.void_type instead of null
15862 for an empty return value.
15864 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15866 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15867 dealing with a FieldExpr which is composed of a FieldBuilder, in
15868 the code path we did extract the constant, but we should have
15869 obtained the underlying value to be able to cast it (otherwise we
15870 end up in an infinite loop, this is what Ravi was running into).
15872 (ArrayCreation.UpdateIndices): Arrays might be empty.
15874 (MemberAccess.ResolveMemberAccess): Add support for section
15875 14.5.4.1 that deals with the special case of E.I when E is a type
15876 and something else, that I can be a reference to a static member.
15878 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15879 handle a particular array type to create byte blobs, it is just
15880 something we dont generate byteblobs for.
15882 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15885 * location.cs (Push): remove the key from the hashtable that we
15886 are about to add. This happens for empty files.
15888 * driver.cs: Dispose files after we have parsed them.
15890 (tokenize): new function that only runs the tokenizer on its
15891 input, for speed testing.
15893 2001-12-26 Ravi Pratap <ravi@ximian.com>
15895 * class.cs (Event.Define): Define the private field only if there
15896 are no accessors defined.
15898 * expression.cs (ResolveMemberAccess): If there is no associated
15899 field with the event, that means we have an event defined with its
15900 own accessors and we should flag error cs0070 since transforming
15901 ourselves into a field is not valid in that case.
15903 * ecore.cs (SimpleName.DoResolve): Same as above.
15905 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15906 and charset to sane values.
15908 2001-12-25 Ravi Pratap <ravi@ximian.com>
15910 * assign.cs (DoResolve): Perform check on events only if they
15911 are being accessed outside the declaring type.
15913 * cs-parser.jay (event_declarations): Update rules to correctly
15914 set the type of the implicit parameter etc.
15916 (add_accessor, remove_accessor): Set current local parameters.
15918 * expression.cs (Binary): For delegate addition and subtraction,
15919 cast the return value from the method into the appropriate delegate
15922 2001-12-24 Ravi Pratap <ravi@ximian.com>
15924 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15925 of these as the workaround is unnecessary.
15927 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15928 delegate data - none of that is needed at all.
15930 Re-write bits to extract the instance expression and the delegate method
15933 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15936 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15937 of attaching attributes instead of duplicating code everywhere.
15939 * everywhere : Update code to do attribute emission using the above method.
15941 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15943 * expression.cs (IsParamsMethodApplicable): if there are not
15944 parameters, return immediately.
15946 * ecore.cs: The 0 literal can be implicity converted to an enum
15949 (SimpleName.DoResolve): First lookup the type, then lookup the
15952 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15953 want to get its address. If the InstanceExpression is not
15954 addressable, store the result in a temporary variable, then get
15957 * codegen.cs: Only display 219 errors on warning level or above.
15959 * expression.cs (ArrayAccess): Make it implement the
15960 IMemoryLocation interface.
15962 (Binary.DoResolve): handle the operator == (object a, object b)
15963 and operator != (object a, object b) without incurring into a
15964 BoxedCast (because 5 != o should never be performed).
15966 Handle binary enumerator operators.
15968 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15969 value type, otherwise use Ldelem_ref.
15971 Use precomputed names;
15973 (AddressOf): Implement address of
15975 * cs-parser.jay (labeled_statement): Fix recursive block
15976 addition by reworking the production.
15978 * expression.cs (New.DoEmit): New has a special case:
15980 If we are dealing with a ValueType, we have a few
15981 situations to deal with:
15983 * The target of New is a ValueType variable, that is
15984 easy, we just pass this as the variable reference
15986 * The target of New is being passed as an argument,
15987 to a boxing operation or a function that takes a
15990 In this case, we need to create a temporary variable
15991 that is the argument of New.
15994 2001-12-23 Ravi Pratap <ravi@ximian.com>
15996 * rootcontext.cs (LookupType): Check that current_type is not null before
15997 going about looking at nested types.
15999 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
16000 not implement the IAssignMethod interface any more.
16002 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
16003 where we tranform them into FieldExprs if they are being resolved from within
16004 the declaring type.
16006 * ecore.cs (SimpleName.DoResolve): Do the same here.
16008 * assign.cs (DoResolve, Emit): Clean up code considerably.
16010 * ../errors/bug10.cs : Add.
16012 * ../errors/cs0070.cs : Add.
16014 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
16016 * assign.cs : Get rid of EventIsLocal everywhere.
16018 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16020 * ecore.cs (ConvertIntLiteral): finished the implementation.
16022 * statement.cs (SwitchLabel): Convert the value we are using as a
16023 key before looking up the table.
16025 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16027 * codegen.cs (EmitTopBlock): Require a Location argument now.
16029 * cs-parser.jay (constructor_declarator): We need to setup
16030 current_local_parameters before we parse the
16031 opt_constructor_initializer, to allow the variables to be bound
16032 to the constructor arguments.
16034 * rootcontext.cs (LookupType): First lookup nested classes in our
16035 class and our parents before we go looking outside our class.
16037 * expression.cs (ConstantFold): Extract/debox the values at the
16040 * rootcontext.cs (EmitCode): Resolve the constants first before we
16041 resolve the types. This is not really needed, but it helps debugging.
16043 * statement.cs: report location.
16045 * cs-parser.jay: pass location to throw statement.
16047 * driver.cs: Small bug fix.
16049 * report.cs: Updated format to be 4-zero filled digits.
16051 2001-12-22 Ravi Pratap <ravi@ximian.com>
16053 * expression.cs (CheckIndices): Fix minor bug where the wrong
16054 variable was being referred to ;-)
16056 (DoEmit): Do not call EmitStaticInitializers when the
16057 underlying type is System.Object.
16059 2001-12-21 Ravi Pratap <ravi@ximian.com>
16061 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
16062 and do the usual workaround for SRE.
16064 * class.cs (MyEventBuilder.EventType): New member to get at the type
16065 of the event, quickly.
16067 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
16069 * assign.cs (Assign.DoResolve): Handle the case when the target
16070 is an EventExpr and perform the necessary checks.
16072 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
16075 (SimpleName.MemberStaticCheck): Include check for EventExpr.
16077 (EventExpr): Set the type in the constructor itself since we
16078 are meant to be born fully resolved.
16080 (EventExpr.Define): Revert code I wrote earlier.
16082 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
16083 instance expression is null. The instance expression is a This in that case
16084 or a null, depending on whether it is a static method or not.
16086 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
16087 refers to more than one method.
16089 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
16090 and accordingly flag errors.
16092 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16094 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
16096 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16098 * location.cs (ToString): Provide useful rutine.
16100 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16102 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
16103 objects, return the actual integral boxed.
16105 * statement.cs (SwitchLabel): define an ILLabel for each
16108 (Switch.CheckSwitch): If the value is a Literal, extract
16109 the underlying literal.
16111 Also in the unused hashtable we had, add the SwitchLabel so we can
16112 quickly look this value up.
16114 * constant.cs: Implement a bunch of new constants. Rewrite
16115 Literal based on this. Made changes everywhere to adapt to this.
16117 * expression.cs (Expression.MakeByteBlob): Optimize routine by
16118 dereferencing array only once, and also copes with enumrations.
16120 bytes are two bytes wide, not one.
16122 (Cast): Perform constant conversions.
16124 * ecore.cs (TryImplicitIntConversion): Return literals instead of
16125 wrappers to the literals here.
16127 * expression.cs (DoNumericPromotions): long literals can converted
16128 to ulong implicity (this is taken care of elsewhere, but I was
16129 missing this spot).
16131 * ecore.cs (Expression.Literalize): Make the return type Literal,
16132 to improve type checking.
16134 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
16136 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16138 * literal.cs: Revert code from ravi that checked the bounds. The
16139 bounds are sane by the definition of the type itself.
16141 * typemanager.cs: Fix implementation of ImplementsInterface. We
16142 need to actually look up in our parent hierarchy for interfaces
16145 * const.cs: Use the underlying type for enumerations
16147 * delegate.cs: Compute the basename for the delegate creation,
16148 that should fix the delegate test case, and restore the correct
16149 Type Lookup semantics in rootcontext
16151 * rootcontext.cs: Revert Ravi's last patch. The correct way of
16152 referencing a nested type with the Reflection API is using the "+"
16155 * cs-parser.jay: Do not require EOF token at the end.
16157 2001-12-20 Ravi Pratap <ravi@ximian.com>
16159 * rootcontext.cs (LookupType): Concatenate type names with
16160 a '.' instead of a '+' The test suite passes again.
16162 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
16163 field of the enumeration.
16165 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
16166 the case when the member is an EventExpr.
16168 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
16169 static has an associated instance expression.
16171 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
16173 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
16175 * class.cs (Event.Define): Register event and perform appropriate checks
16178 We define the Add and Remove methods even if the use provides none because
16179 in that case, we provide default implementations ourselves.
16181 Define a private field of the type of the event. This is done by the CSC compiler
16182 and we should be doing it too ;-)
16184 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
16185 More methods we use in code we generate.
16187 (multicast_delegate_type, delegate_type): Two separate types since the distinction
16190 (InitCoreTypes): Update accordingly for the above.
16192 * class.cs (Event.Emit): Generate code for default accessors that we provide
16194 (EmitDefaultMethod): Do the job in the above.
16196 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
16199 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16201 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
16202 builders even if we were missing one.
16204 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
16205 pass the Basename as our class name instead of the Name. The
16206 basename will be correctly composed for us.
16208 * parameter.cs (Paramters): Now takes a Location argument.
16210 * decl.cs (DeclSpace.LookupType): Removed convenience function and
16211 make all the code call directly LookupType in RootContext and take
16212 this chance to pass the Location information everywhere.
16214 * Everywhere: pass Location information.
16216 2001-12-19 Miguel de Icaza <miguel@ximian.com>
16218 * class.cs (Constructor.Define): Updated way of detecting the
16219 length of the parameters.
16221 (TypeContainer.DefineType): Use basename as the type name for
16224 (TypeContainer.Define): Do not recursively define types here, as
16225 definition is taken care in order by the RootContext.
16227 * tree.cs: Keep track of namespaces in a per-file basis.
16229 * parameter.cs (Parameter.ComputeSignature): Update to use
16232 (Parameters.GetSignature): ditto.
16234 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
16235 instead of a TypeContainer.
16237 (Interface.SemanticAnalysis): Use `this' instead of our parent to
16238 resolve names. Because we need to be resolve in our context, not
16241 * driver.cs: Implement response files.
16243 * class.cs (TypeContainer.DefineType): If we are defined, do not
16244 redefine ourselves.
16246 (Event.Emit): Emit the code for add/remove handlers.
16247 (Event.Define): Save the MethodBuilders for add/remove.
16249 * typemanager.cs: Use pair here too.
16251 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
16252 DictionaryEntry requires the first argument to be non-null.
16254 (enum_declaration): Compute full name for registering the
16257 (delegate_declaration): Instead of using
16258 formal_parameter_list, use opt_formal_parameter_list as the list
16261 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
16262 (EventParsing): New property that controls whether `add' and
16263 `remove' are returned as tokens or identifiers (for events);
16265 2001-12-19 Ravi Pratap <ravi@ximian.com>
16267 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
16268 use MyEventBuilder only and let it wrap the real builder for us.
16270 (MyEventBuilder): Revamp constructor etc.
16272 Implement all operations that we perform on EventBuilder in precisely the same
16275 (FindMembers): Update to use the EventBuilder member.
16277 (Event.Emit): Update accordingly.
16279 2001-12-18 Ravi Pratap <ravi@ximian.com>
16281 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
16282 by calling the appropriate methods.
16284 (GetCustomAttributes): Make stubs as they cannot possibly do anything
16287 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
16289 2001-12-17 Ravi Pratap <ravi@ximian.com>
16291 * delegate.cs (Delegate.Populate): Check that the return type
16292 and various parameters types are indeed accessible.
16294 * class.cs (Constructor.Define): Same here.
16296 (Field.Define): Ditto.
16298 (Event.Define): Ditto.
16300 (Operator.Define): Check that the underlying Method defined itself
16301 correctly - so it's MethodBuilder should not be null.
16303 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
16304 expression happens to be null.
16306 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
16307 members but as of now we don't seem to be able to do anything really useful with it.
16309 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
16310 not the EventBuilder.
16312 2001-12-18 Miguel de Icaza <miguel@ximian.com>
16314 * cs-tokenizer.cs: Add support for defines.
16315 Add support for #if, #elif, #else, #endif
16317 (eval_var): evaluates a variable.
16318 (eval): stubbed for evaluating functions.
16320 * cs-parser.jay: Pass the defines information
16322 * driver.cs: Add --define command line option.
16324 * decl.cs: Move MemberCore here.
16326 Make it the base class for DeclSpace. This allows us to catch and
16327 report 108 and 109 for everything now.
16329 * class.cs (TypeContainer.Define): Extract all the members
16330 before populating and emit the warning 108 (new keyword required
16331 to override) instead of having each member implement this.
16333 (MemberCore.Define): New abstract method, we will be using this in
16334 the warning reporting engine in Populate.
16336 (Operator.Define): Adjust to new MemberCore protocol.
16338 * const.cs (Const): This does not derive from Expression, it is a
16339 temporary object we use to create fields, it is a MemberCore.
16341 * class.cs (Method.Define): Allow the entry point to be in a
16344 * driver.cs: Rewrite the argument handler to clean it up a bit.
16346 * rootcontext.cs: Made it just an auxiliary namespace feature by
16347 making everything static.
16349 * driver.cs: Adapt code to use RootContext type name instead of
16352 * delegate.cs: Remove RootContext argument.
16354 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
16357 * class.cs (Event.Define): The lookup can fail.
16359 * cs-tokenizer.cs: Begin implementation of pre-procesor.
16361 * expression.cs: Resolve the this instance before invoking the code.
16363 2001-12-17 Miguel de Icaza <miguel@ximian.com>
16365 * cs-parser.jay: Add a production in element_access that allows
16366 the thing to become a "type" reference. This way we can parse
16367 things like "(string [])" as a type.
16369 Note that this still does not handle the more complex rules of
16373 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
16375 * ecore.cs: (CopyNewMethods): new utility function used to
16376 assemble the list of methods from running FindMembers.
16378 (MemberLookup): Rework FindMembers so that
16380 2001-12-16 Miguel de Icaza <miguel@ximian.com>
16382 * class.cs (TypeContainer): Remove Delegates who fail to be
16385 * delegate.cs (Populate): Verify that we dont get null return
16386 values. TODO: Check for AsAccessible.
16388 * cs-parser.jay: Use basename to emit error 574 (destructor should
16389 have the same name as container class), not the full name.
16391 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
16392 possible representation.
16394 Also implements integer type suffixes U and L.
16396 2001-12-15 Miguel de Icaza <miguel@ximian.com>
16398 * expression.cs (ArrayCreation.DoResolve): We need to do the
16399 argument resolution *always*.
16401 * decl.cs: Make this hold the namespace. Hold the root context as
16403 (LookupType): Move here.
16405 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
16407 * location.cs (Row, Name): Fixed the code, it was always returning
16408 references to the first file.
16410 * interface.cs: Register properties defined through interfaces.
16412 * driver.cs: Add support for globbing on the command line
16414 * class.cs (Field): Make it derive from MemberCore as well.
16417 2001-12-15 Ravi Pratap <ravi@ximian.com>
16419 * class.cs (Event::Define): Check that the type of the event is a delegate
16420 type else flag error #66.
16422 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
16425 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
16426 values of EntryPoint, CharSet etc etc.
16428 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
16430 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
16431 be null and we should ignore this. I am not sure if this is really clean. Apparently,
16432 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
16433 which needs this to do its work.
16435 * ../errors/cs0066.cs : Add.
16437 2001-12-14 Miguel de Icaza <miguel@ximian.com>
16439 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
16442 * class.cs: (MethodSignature.MethodSignature): Removed hack that
16443 clears out the parameters field.
16444 (MemberSignatureCompare): Cleanup
16446 (MemberCore): New base class used to share code between MethodCore
16449 (RegisterRequiredImplementations) BindingFlags.Public requires
16450 either BindingFlags.Instace or Static. Use instance here.
16452 (Property): Refactored code to cope better with the full spec.
16454 * parameter.cs (GetParameterInfo): Return an empty array instead
16457 * class.cs (Property): Abstract or extern properties have no bodies.
16459 * parameter.cs (GetParameterInfo): return a zero-sized array.
16461 * class.cs (TypeContainer.MethodModifiersValid): Move all the
16462 method modifier validation to the typecontainer so we can reuse
16463 this on properties.
16465 (MethodCore.ParameterTypes): return an empty sized array of types.
16467 (Property.Define): Test property modifier validity.
16469 Add tests for sealed/override too.
16471 (Method.Emit): abstract or extern methods have no bodies.
16473 2001-12-14 Ravi Pratap <ravi@ximian.com>
16475 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
16478 (Method::Define, ::Emit): Modify accordingly.
16480 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
16482 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
16484 * makefile: Pass in /unsafe.
16486 2001-12-13 Miguel de Icaza <miguel@ximian.com>
16488 * class.cs (MakeKey): Kill routine.
16490 * class.cs (TypeContainer.Define): Correctly define explicit
16491 method implementations (they require the full interface name plus
16494 * typemanager.cs: Deply the PtrHashtable here and stop using the
16495 lame keys. Things work so much better.
16497 This of course broke everyone who depended on `RegisterMethod' to
16498 do the `test for existance' test. This has to be done elsewhere.
16500 * support.cs (PtrHashtable): A hashtable that avoid comparing with
16501 the object stupid Equals method (because, that like fails all over
16502 the place). We still do not use it.
16504 * class.cs (TypeContainer.SetRequiredInterface,
16505 TypeContainer.RequireMethods): Killed these two routines and moved
16506 all the functionality to RegisterRequiredImplementations.
16508 (TypeContainer.RegisterRequiredImplementations): This routine now
16509 registers all the implementations required in an array for the
16510 interfaces and abstract methods. We use an array of structures
16511 which can be computed ahead of time to reduce memory usage and we
16512 also assume that lookups are cheap as most classes will not
16513 implement too many interfaces.
16515 We also avoid creating too many MethodSignatures.
16517 (TypeContainer.IsInterfaceMethod): Update and optionally does not
16518 clear the "pending" bit if we find that there are problems with
16521 (TypeContainer.VerifyPendingMethods): Update to report errors of
16522 methods that look like implementations but are not.
16524 (TypeContainer.Define): Add support for explicit interface method
16527 2001-12-12 Miguel de Icaza <miguel@ximian.com>
16529 * typemanager.cs: Keep track of the parameters here instead of
16530 being a feature of the TypeContainer.
16532 * class.cs: Drop the registration of parameters here, as
16533 InterfaceMethods are also interface declarations.
16535 * delegate.cs: Register methods with the TypeManager not only with
16536 the TypeContainer. This code was buggy.
16538 * interface.cs: Full registation here.
16540 2001-12-11 Miguel de Icaza <miguel@ximian.com>
16542 * expression.cs: Remove reducer for binary expressions, it can not
16545 * const.cs: Put here the code that used to go into constant.cs
16547 * constant.cs: Put here the code for constants, this is a new base
16548 class for Literals.
16550 * literal.cs: Make Literal derive from Constant.
16552 2001-12-09 Miguel de Icaza <miguel@ximian.com>
16554 * statement.cs (Return.Emit): Report error 157 if the user
16555 attempts to return from a finally block.
16557 (Return.Emit): Instead of emitting a return, jump to the end of
16560 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
16561 LocalBuilder to store the result of the function. ReturnLabel is
16562 the target where we jump.
16565 2001-12-09 Radek Doulik <rodo@ximian.com>
16567 * cs-parser.jay: remember alias in current namespace
16569 * ecore.cs (SimpleName::DoResolve): use aliases for types or
16572 * class.cs (LookupAlias): lookup alias in my_namespace
16574 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
16576 (LookupAlias): lookup alias in this and if needed in parent
16579 2001-12-08 Miguel de Icaza <miguel@ximian.com>
16583 * rootcontext.cs: (ModuleBuilder) Made static, first step into
16584 making things static. I need this to avoid passing the
16585 TypeContainer when calling ParameterType.
16587 * support.cs (InternalParameters.ParameterType): Remove ugly hack
16588 that did string manipulation to compute the type and then call
16589 GetType. Use Parameter.ParameterType instead.
16591 * cs-tokenizer.cs: Consume the suffix for floating values.
16593 * expression.cs (ParameterReference): figure out whether this is a
16594 reference parameter or not. Kill an extra variable by computing
16595 the arg_idx during emission.
16597 * parameter.cs (Parameters.GetParameterInfo): New overloaded
16598 function that returns whether a parameter is an out/ref value or not.
16600 (Parameter.ParameterType): The type of the parameter (base,
16601 without ref/out applied).
16603 (Parameter.Resolve): Perform resolution here.
16604 (Parameter.ExternalType): The full type (with ref/out applied).
16606 * statement.cs (Using.Emit, Using.EmitExpression): Implement
16607 support for expressions on the using statement.
16609 2001-12-07 Miguel de Icaza <miguel@ximian.com>
16611 * statement.cs (Using.EmitLocalVariableDecls): Split the
16612 localvariable handling of the using statement.
16614 (Block.EmitMeta): Keep track of variable count across blocks. We
16615 were reusing slots on separate branches of blocks.
16617 (Try.Emit): Emit the general code block, we were not emitting it.
16619 Check the type of the declaration to be an IDisposable or
16620 something that can be implicity converted to it.
16622 Emit conversions if required.
16624 * ecore.cs (EmptyExpression): New utility class.
16625 (Expression.ImplicitConversionExists): New utility function.
16627 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16629 * statement.cs (Using): Implement.
16631 * expression.cs (LocalVariableReference): Support read only variables.
16633 * statement.cs: Remove the explicit emit for the Leave opcode.
16634 (VariableInfo): Add a readonly field.
16636 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16638 * ecore.cs (ConvCast): new class used to encapsulate the various
16639 explicit integer conversions that works in both checked and
16640 unchecked contexts.
16642 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16643 properly generate the overflow opcodes.
16645 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16647 * statement.cs: The correct type for the EmptyExpression is the
16648 element_type, not the variable type. Ravi pointed this out.
16650 2001-12-04 Ravi Pratap <ravi@ximian.com>
16652 * class.cs (Method::Define): Handle PInvoke methods specially
16653 by using DefinePInvokeMethod instead of the usual one.
16655 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16656 above to do the task of extracting information and defining the method.
16658 2001-12-04 Ravi Pratap <ravi@ximian.com>
16660 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16661 of the condition for string type.
16663 (Emit): Move that here.
16665 (ArrayCreation::CheckIndices): Keep string literals in their expression
16668 (EmitDynamicInitializers): Handle strings appropriately.
16670 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16672 * codegen.cs (EmitContext): Replace multiple variables with a
16673 single pointer to the current Switch statement.
16675 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16678 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16682 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16685 (Foreach.Emit): Foreach on arrays was not setting
16686 up the loop variables (for break/continue).
16688 (GotoCase): Semi-implented.
16690 2001-12-03 Ravi Pratap <ravi@ximian.com>
16692 * attribute.cs (CheckAttribute): Handle system attributes by using
16693 Attribute.GetAttributes to examine information we need.
16695 (GetValidPlaces): Same here.
16697 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16699 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16701 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16703 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16705 (Method::Emit): Handle the case when we are a PInvoke method.
16707 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16709 * expression.cs: Use ResolveWithSimpleName on compound names.
16711 2001-12-02 Ravi Pratap <ravi@ximian.com>
16713 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16714 before trying to reduce it.
16716 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16718 * constant.cs (LookupConstantValue): Implement.
16720 (EmitConstant): Use the above in emitting the constant.
16722 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16723 that are user-defined by doing a LookupConstantValue on them.
16725 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16728 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16730 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16732 (BaseAccess.DoResolve): Implement.
16734 (MemberAccess.DoResolve): Split this routine into a
16735 ResolveMemberAccess routine that can be used independently
16737 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16739 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16740 As that share bits of the implementation. Is returns a boolean,
16741 while As returns the Type that is being probed.
16743 2001-12-01 Ravi Pratap <ravi@ximian.com>
16745 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16746 instead of a Literal - much easier.
16748 (EnumInTransit): Remove - utterly useless :-)
16750 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16752 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16754 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16755 chain when we have no associated expression.
16757 2001-11-30 Ravi Pratap <ravi@ximian.com>
16759 * constant.cs (Define): Use Location while reporting the errror.
16761 Also emit a warning when 'new' is used and there is no inherited
16764 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16767 (LookupEnumValue): Implement to lookup an enum member's value and define it
16770 (Populate): Re-write accordingly to use the above routine.
16772 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16774 * expression.cs (This): Fix prototype for DoResolveLValue to
16775 override the base class DoResolveLValue.
16777 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16780 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16781 (we need to load the address of the field here). This fixes
16784 (FieldExpr.DoResolveLValue): Call the DoResolve
16785 function to initialize the Instance expression.
16787 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16788 correctly the GetEnumerator operation on a value type.
16790 * cs-parser.jay: Add more simple parsing error catches.
16792 * statement.cs (Switch): Add support for string switches.
16793 Handle null specially.
16795 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16797 2001-11-28 Ravi Pratap <ravi@ximian.com>
16799 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16801 (declare_local_constant): New helper function.
16803 * statement.cs (AddConstant): Keep a separate record of constants
16805 (IsConstant): Implement to determine if a variable is a constant.
16807 (GetConstantExpression): Implement.
16809 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16811 * statement.cs (IsVariableDefined): Re-write.
16813 2001-11-27 Ravi Pratap <ravi@ximian.com>
16815 * class.cs (TypeContainer::FindMembers): Look for constants
16816 in the case when we are looking for MemberTypes.Field
16818 * expression.cs (MemberAccess::DoResolve): Check that in the
16819 case we are a FieldExpr and a Literal, we are not being accessed
16820 by an instance reference.
16822 * cs-parser.jay (local_constant_declaration): Implement.
16824 (declaration_statement): Implement for constant declarations.
16826 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16828 * statement.cs (Switch): Catch double defaults.
16830 (Switch): More work on the switch() statement
16831 implementation. It works for integral values now, need to finish
16835 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16837 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16838 integer literals into other integer literals. To be used by
16841 2001-11-24 Ravi Pratap <ravi@ximian.com>
16843 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16846 (EmitDynamicInitializers): Cope with the above since we extract data
16847 directly from ArrayData now.
16849 (ExpectInitializers): Keep track of whether initializers are mandatory
16852 (Bounds): Make it a hashtable to prevent the same dimension being
16853 recorded for every element in that dimension.
16855 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16858 Also fix bug which was causing the indices to be emitted in the reverse
16861 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16863 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16864 unfinished. They do not work, because the underlying code is
16867 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16869 * cs-parser.jay: Remove bogus fixme.
16871 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16872 on Switch statement.
16874 2001-11-23 Ravi Pratap <ravi@ximian.com>
16876 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16879 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16880 parameter. Apparently, any expression is allowed.
16882 (ValidateInitializers): Update accordingly.
16884 (CheckIndices): Fix some tricky bugs thanks to recursion.
16886 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16887 I was being completely brain-dead.
16889 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16890 and re-write acordingly.
16892 (DelegateInvocation): Re-write accordingly.
16894 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16896 (MakeByteBlob): Handle types more correctly.
16898 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16899 initialization from expressions but it is incomplete because I am a complete
16902 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16904 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16905 on If. Basically, we have to return `true' (ie, we do return to
16906 our caller) only if both branches of the if return.
16908 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16909 short-circuit operators, handle them as short circuit operators.
16911 (Cast.DoResolve): Resolve type.
16912 (Cast.Cast): Take an expression as the target type.
16914 * cs-parser.jay (cast_expression): Remove old hack that only
16915 allowed a limited set of types to be handled. Now we take a
16916 unary_expression and we resolve to a type during semantic
16919 Use the grammar productions from Rhys to handle casts (this is
16920 not complete like Rhys syntax yet, we fail to handle that corner
16921 case that C# has regarding (-x), but we will get there.
16923 2001-11-22 Ravi Pratap <ravi@ximian.com>
16925 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16926 field which is an array type.
16928 * cs-parser.jay (declare_local_variables): Support array initialization too.
16930 * typemanager.cs (MakeKey): Implement.
16932 (everywhere): Use the above appropriately.
16934 * cs-parser.jay (for_statement): Update for array initialization while
16935 declaring variables.
16937 * ecore.cs : The error message was correct, it's the variable's names that
16938 were misleading ;-) Make the code more readable.
16940 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16941 the correct type etc.
16943 (ConvertExplicit): Handle Enum types by examining the underlying type.
16945 2001-11-21 Ravi Pratap <ravi@ximian.com>
16947 * parameter.cs (GetCallingConvention): Always return
16948 CallingConventions.Standard for now.
16950 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16952 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16953 and `r' after calling DoNumericPromotions.
16955 * ecore.cs: Fix error message (the types were in the wrong order).
16957 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16958 BindingFlags.Instance as well
16960 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16961 implicit int literal conversion in an empty cast so that we
16962 propagate the right type upstream.
16964 (UnboxCast): new class used to unbox value types.
16965 (Expression.ConvertExplicit): Add explicit type conversions done
16968 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16969 the target type before applying the implicit LongLiterals to ULong
16972 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16974 * cs-parser.jay (for_statement): Reworked the way For works: now
16975 we declare manually any variables that are introduced in
16976 for_initializer to solve the problem of having out-of-band code
16977 emition (that is what got for broken).
16979 (declaration_statement): Perform the actual variable declaration
16980 that used to be done in local_variable_declaration here.
16982 (local_variable_declaration): Do not declare anything, just pass
16983 the information on a DictionaryEntry
16985 2001-11-20 Ravi Pratap <ravi@ximian.com>
16987 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16988 re-write of the logic to now make it recursive.
16990 (UpdateIndices): Re-write accordingly.
16992 Store element data in a separate ArrayData list in the above methods.
16994 (MakeByteBlob): Implement to dump the array data into a byte array.
16996 2001-11-19 Ravi Pratap <ravi@ximian.com>
16998 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
17001 * constant.cs (Define): Implement.
17003 (EmitConstant): Re-write fully.
17005 Pass in location info.
17007 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
17010 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
17011 DictionaryEntry since we need location info too.
17013 (constant_declaration): Update accordingly.
17015 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
17016 code into another method : UpdateIndices.
17018 2001-11-18 Ravi Pratap <ravi@ximian.com>
17020 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
17021 some type checking etc.
17023 2001-11-17 Ravi Pratap <ravi@ximian.com>
17025 * expression.cs (ArrayCreation::ValidateInitializers): Implement
17026 bits to provide dimension info if the user skips doing that.
17028 Update second constructor to store the rank correctly.
17030 2001-11-16 Ravi Pratap <ravi@ximian.com>
17032 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
17033 and try to implement.
17035 * ../errors/cs0150.cs : Add.
17037 * ../errors/cs0178.cs : Add.
17039 2001-11-16 Miguel de Icaza <miguel@ximian.com>
17041 * statement.cs: Implement foreach on multi-dimensional arrays.
17043 * parameter.cs (Parameters.GetParameterByName): Also lookup the
17044 name of the params argument.
17046 * expression.cs: Use EmitStoreOpcode to get the right opcode while
17047 initializing the array.
17049 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
17050 we can use this elsewhere.
17052 * statement.cs: Finish implementation of foreach for single
17055 * cs-parser.jay: Use an out-of-band stack to pass information
17056 around, I wonder why I need this.
17058 foreach_block: Make the new foreach_block the current_block.
17060 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
17061 function used to return a static Parameters structure. Used for
17062 empty parameters, as those are created very frequently.
17064 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
17066 2001-11-15 Ravi Pratap <ravi@ximian.com>
17068 * interface.cs : Default modifier is private, not public. The
17069 make verify test passes again.
17071 2001-11-15 Ravi Pratap <ravi@ximian.com>
17073 * support.cs (ReflectionParameters): Fix logic to determine
17074 whether the last parameter is a params one. Test 9 passes again.
17076 * delegate.cs (Populate): Register the builders we define with
17077 RegisterParameterForBuilder. Test 19 passes again.
17079 * cs-parser.jay (property_declaration): Reference $6 instead
17080 of $$ to get at the location.
17082 (indexer_declaration): Similar stuff.
17084 (attribute): Ditto.
17086 * class.cs (Property): Register parameters for the Get and Set methods
17087 if they exist. Test 23 passes again.
17089 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
17090 call to EmitArguments as we are sure there aren't any params arguments.
17091 Test 32 passes again.
17093 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
17094 IndexOutOfRangeException.
17096 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
17097 Test 33 now passes again.
17099 2001-11-15 Miguel de Icaza <miguel@ximian.com>
17101 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
17102 broke a bunch of things. Will have to come up with a better way
17103 of tracking locations.
17105 * statement.cs: Implemented foreach for single dimension arrays.
17107 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17109 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
17110 an error. This removes the lookup from the critical path.
17112 * cs-parser.jay: Removed use of temporary_loc, which is completely
17115 2001-11-14 Miguel de Icaza <miguel@ximian.com>
17117 * support.cs (ReflectionParameters.ParameterModifier): Report
17118 whether the argument is a PARAMS argument or not.
17120 * class.cs: Set the attribute `ParamArrayAttribute' on the
17121 parameter argument.
17123 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
17124 and cons_param_array_attribute (ConstructorInfo for
17125 ParamArrayAttribute).,
17127 * codegen.cs: Emit the return using the `Return' statement, that
17128 way we can report the error correctly for missing return values.
17130 * class.cs (Method.Emit): Clean up.
17132 * expression.cs (Argument.Resolve): Take another argument: the
17133 location where this argument is used. Notice that this is not
17134 part of the "Argument" class as to reduce the size of the
17135 structure (we know the approximate location anyways).
17137 Test if the argument is a variable-reference, if not, then
17138 complain with a 206.
17140 (Argument.Emit): Emit addresses of variables.
17142 (Argument.FullDesc): Simplify.
17144 (Invocation.DoResolve): Update for Argument.Resolve.
17146 (ElementAccess.DoResolve): ditto.
17148 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
17149 method should be virtual, as this method is always virtual.
17151 (NewDelegate.DoResolve): Update for Argument.Resolve.
17153 * class.cs (ConstructorInitializer.DoResolve): ditto.
17155 * attribute.cs (Attribute.Resolve): ditto.
17157 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17159 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
17161 * expression.cs (ParameterReference): Drop IStackStorage and implement
17162 IAssignMethod instead.
17164 (LocalVariableReference): ditto.
17166 * ecore.cs (FieldExpr): Drop IStackStorage and implement
17167 IAssignMethod instead.
17169 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17171 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
17172 enumerations that are used in heavily used structures derive from
17173 byte in a laughable and pathetic attempt to reduce memory usage.
17174 This is the kind of pre-optimzations that you should not do at
17175 home without adult supervision.
17177 * expression.cs (UnaryMutator): New class, used to handle ++ and
17178 -- separatedly from the other unary operators. Cleans up the
17179 code, and kills the ExpressionStatement dependency in Unary.
17181 (Unary): Removed `method' and `Arguments' from this class, making
17182 it smaller, and moving it all to SimpleCall, so I can reuse this
17183 code in other locations and avoid creating a lot of transient data
17184 strucutres when not required.
17186 * cs-parser.jay: Adjust for new changes.
17188 2001-11-11 Miguel de Icaza <miguel@ximian.com>
17190 * enum.cs (Enum.Populate): If there is a failure during
17193 * cs-parser.jay (opt_enum_base): we used to catch type errors
17194 here, but this is really incorrect. The type error should be
17195 catched during semantic analysis.
17197 2001-12-11 Ravi Pratap <ravi@ximian.com>
17199 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
17200 current_local_parameters as expected since I, in my stupidity, had forgotten
17203 * attribute.cs (GetValidPlaces): Fix stupid bug.
17205 * class.cs (Method::Emit): Perform check on applicability of attributes.
17207 (Constructor::Emit): Ditto.
17209 (Field::Emit): Ditto.
17211 (Field.Location): Store location information.
17213 (Property, Event, Indexer, Operator): Ditto.
17215 * cs-parser.jay (field_declaration): Pass in location for each field.
17217 * ../errors/cs0592.cs : Add.
17219 2001-11-12 Ravi Pratap <ravi@ximian.com>
17221 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
17223 (InitCoreTypes): Update accordingly.
17225 (RegisterAttrType, LookupAttr): Implement.
17227 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
17228 info about the same.
17230 (Resolve): Update to populate the above as necessary.
17232 (Error592): Helper.
17234 (GetValidPlaces): Helper to the above.
17236 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
17238 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
17240 2001-11-12 Ravi Pratap <ravi@ximian.com>
17242 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
17244 * ../errors/cs0617.cs : Add.
17246 2001-11-11 Ravi Pratap <ravi@ximian.com>
17248 * enum.cs (Emit): Rename to Populate to be more consistent with what
17249 we expect it to do and when exactly it is called.
17251 * class.cs, rootcontext.cs : Update accordingly.
17253 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
17254 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
17256 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
17258 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
17259 of a fieldinfo using the above, when dealing with a FieldBuilder.
17261 2001-11-10 Ravi Pratap <ravi@ximian.com>
17263 * ../errors/cs0031.cs : Add.
17265 * ../errors/cs1008.cs : Add.
17267 * ../errrors/cs0543.cs : Add.
17269 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
17272 (FindMembers): Implement.
17274 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
17275 enums and delegates too.
17277 (enum_types): Rename to builder_to_enum.
17279 (delegate_types): Rename to builder_to_delegate.
17281 * delegate.cs (FindMembers): Implement.
17283 2001-11-09 Ravi Pratap <ravi@ximian.com>
17285 * typemanager.cs (IsEnumType): Implement.
17287 * enum.cs (Emit): Re-write parts to account for the underlying type
17288 better and perform checking etc.
17290 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
17291 of the underlying type.
17293 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
17296 * enum.cs (error31): Helper to report error #31.
17298 * cs-parser.jay (enum_declaration): Store location of each member too.
17300 * enum.cs (member_to_location): New hashtable.
17302 (AddEnumMember): Update location hashtable.
17304 (Emit): Use the location of each member while reporting errors.
17306 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17308 * cs-parser.jay: A for_initializer if is a
17309 local_variable_declaration really ammount to have an implicit
17310 block with the variable declaration and no initializer for for.
17312 * statement.cs (For.Emit): Cope with null initializers.
17314 This fixes the infinite loop on for initializers.
17316 2001-11-08 Miguel de Icaza <miguel@ximian.com>
17318 * enum.cs: More cleanup.
17320 * ecore.cs: Remove dead code.
17322 * class.cs (Property.Emit): More simplification.
17323 (Event.Emit): ditto.
17325 Reworked to have less levels of indentation.
17327 2001-11-08 Ravi Pratap <ravi@ximian.com>
17329 * class.cs (Property): Emit attributes.
17339 * enum.cs (Emit): Ditto.
17341 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
17344 * class.cs (Field, Event, etc.): Move attribute generation into the
17345 Emit method everywhere.
17347 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
17348 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
17349 as we had no way of defining nested enums !
17351 * rootcontext.cs : Adjust code accordingly.
17353 * typemanager.cs (AddEnumType): To keep track of enum types separately.
17355 2001-11-07 Ravi Pratap <ravi@ximian.com>
17357 * expression.cs (EvalConstantExpression): Move into ecore.cs
17359 * enum.cs (Enum): Rename some members and make them public and readonly
17360 according to our convention.
17362 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
17365 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
17367 (Enum::Emit): Write a simple version for now which doesn't try to compute
17368 expressions. I shall modify this to be more robust in just a while.
17370 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
17372 (TypeContainer::CloseType): Create the Enum types too.
17374 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
17376 * expression.cs (EvalConstantExpression): Get rid of completely.
17378 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
17379 user-defined values and other cases.
17381 (IsValidEnumLiteral): Helper function.
17383 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
17384 out there in the case we had a literal FieldExpr.
17386 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
17388 (Literalize): Revamp a bit to take two arguments.
17390 (EnumLiteral): New class which derives from Literal to wrap enum literals.
17392 2001-11-06 Ravi Pratap <ravi@ximian.com>
17394 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
17396 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
17398 (Resolve): Use the above to ensure we have proper initializers.
17400 2001-11-05 Ravi Pratap <ravi@ximian.com>
17402 * expression.cs (Expression::EvalConstantExpression): New method to
17403 evaluate constant expressions.
17405 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
17407 2001-11-07 Miguel de Icaza <miguel@ximian.com>
17409 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
17412 (Binary.ResolveOperator): Handle operator != (object a, object b)
17413 and operator == (object a, object b);
17415 (Binary.DoNumericPromotions): Indicate whether the numeric
17416 promotion was possible.
17418 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
17421 Made the ArrayAccess implement interface IAssignMethod instead of
17422 IStackStore as the order in which arguments are passed reflects
17425 * assign.cs: Instead of using expr.ExprClass to select the way of
17426 assinging, probe for the IStackStore/IAssignMethod interfaces.
17428 * typemanager.cs: Load InitializeArray definition.
17430 * rootcontext.cs (RootContext.MakeStaticData): Used to define
17431 static data that can be used to initialize arrays.
17433 2001-11-05 Miguel de Icaza <miguel@ximian.com>
17435 * expression.cs: Handle operator== and operator!= for booleans.
17437 (Conditioal.Reduce): Implement reducer for the ?: operator.
17439 (Conditional.Resolve): Implement dead code elimination.
17441 (Binary.Resolve): Catch string literals and return a new
17442 concatenated string.
17444 (Unary.Reduce): Implement reduction of unary expressions.
17446 * ecore.cs: Split out the expression core handling here.
17448 (Expression.Reduce): New method used to perform constant folding
17449 and CSE. This is needed to support constant-expressions.
17451 * statement.cs (Statement.EmitBoolExpression): Pass true and false
17452 targets, and optimize for !x.
17454 2001-11-04 Ravi Pratap <ravi@ximian.com>
17456 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
17457 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
17458 set custom atttributes.
17460 * literal.cs (Literal::GetValue): New abstract method to return the actual
17461 value of the literal, cast as an object.
17463 (*Literal): Implement GetValue method.
17465 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
17466 expressions to the arraylist but objects of type Argument.
17468 * class.cs (TypeContainer::Emit): Emit our attributes too.
17470 (Method::Emit, Constructor::Emit): Ditto.
17472 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
17473 to be ignoring earlier.
17475 2001-11-03 Ravi Pratap <ravi@ximian.com>
17477 * attribute.cs (AttributeSection::Define): Implement to do the business
17478 of constructing a CustomAttributeBuilder.
17480 (Attribute): New trivial class. Increases readability of code.
17482 * cs-parser.jay : Update accordingly.
17484 (positional_argument_list, named_argument_list, named_argument): New rules
17486 (attribute_arguments): Use the above so that we are more correct.
17488 2001-11-02 Ravi Pratap <ravi@ximian.com>
17490 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
17491 to perform all checks for a method with a params parameter.
17493 (Invocation::OverloadResolve): Update to use the above method and therefore
17494 cope correctly with params method invocations.
17496 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
17499 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
17500 constructors in our parent too because we can't afford to miss out on
17503 * attribute.cs (AttributeSection): New name for the class Attribute
17505 Other trivial changes to improve readability.
17507 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
17508 use the new class names.
17510 2001-11-01 Ravi Pratap <ravi@ximian.com>
17512 * class.cs (Method::Define): Complete definition for params types too
17514 (Indexer::Define): Ditto.
17516 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
17517 Cope everywhere with a request for info about the array parameter.
17519 2001-11-01 Ravi Pratap <ravi@ximian.com>
17521 * tree.cs (RecordNamespace): Fix up to check for the correct key.
17523 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
17524 local_variable_type to extract the string corresponding to the type.
17526 (local_variable_type): Fixup the action to use the new helper method.
17528 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
17531 * expression.cs : Clean out code which uses the above.
17533 2001-10-31 Ravi Pratap <ravi@ximian.com>
17535 * typemanager.cs (RegisterMethod): Check if we already have an existing key
17536 and bale out if necessary by returning a false.
17538 (RegisterProperty): Ditto.
17540 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
17541 and print out appropriate error messages.
17543 * interface.cs (everywhere): Ditto.
17545 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
17546 location to constructor.
17548 * class.cs (Property, Event, Indexer): Update accordingly.
17550 * ../errors/cs111.cs : Added.
17552 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
17553 of a method, as laid down by the spec.
17555 (Invocation::OverloadResolve): Use the above method.
17557 2001-10-31 Ravi Pratap <ravi@ximian.com>
17559 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
17560 now take a TypeContainer and a Parameters object.
17562 (ParameterData): Modify return type of ParameterModifier method to be
17563 Parameter.Modifier and not a string.
17565 (ReflectionParameters, InternalParameters): Update accordingly.
17567 * expression.cs (Argument::GetParameterModifier): Same here.
17569 * support.cs (InternalParameters::ParameterType): Find a better way of determining
17570 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
17571 symbol in it at all so maybe this is only for now.
17573 2001-10-30 Ravi Pratap <ravi@ximian.com>
17575 * support.cs (InternalParameters): Constructor now takes an extra argument
17576 which is the actual Parameters class.
17578 (ParameterDesc): Update to provide info on ref/out modifiers.
17580 * class.cs (everywhere): Update call to InternalParameters to pass in
17581 the second argument too.
17583 * support.cs (ParameterData): Add ParameterModifier, which is a method
17584 to return the modifier info [ref/out etc]
17586 (InternalParameters, ReflectionParameters): Implement the above.
17588 * expression.cs (Argument::ParameterModifier): Similar function to return
17589 info about the argument's modifiers.
17591 (Invocation::OverloadResolve): Update to take into account matching modifiers
17594 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
17595 a new SetFormalParameters object which we pass to InternalParameters.
17597 2001-10-30 Ravi Pratap <ravi@ximian.com>
17599 * expression.cs (NewArray): Merge into the ArrayCreation class.
17601 2001-10-29 Ravi Pratap <ravi@ximian.com>
17603 * expression.cs (NewArray): Merge classes NewBuiltinArray and
17604 NewUserdefinedArray into one as there wasn't much of a use in having
17607 * expression.cs (Argument): Change field's name to ArgType from Type.
17609 (Type): New readonly property which returns the proper type, taking into
17610 account ref/out modifiers.
17612 (everywhere): Adjust code accordingly for the above.
17614 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
17615 whether we are emitting for a ref or out parameter.
17617 * expression.cs (Argument::Emit): Use the above field to set the state.
17619 (LocalVariableReference::Emit): Update to honour the flag and emit the
17622 * parameter.cs (Attributes): Set the correct flags for ref parameters.
17624 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17626 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17628 (ReflectionParameters, InternalParameters): Implement the above method.
17630 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17633 (Invocation::FullMethodDesc): Ditto.
17635 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17637 * cs-parser.jay: Add extra production for the second form of array
17640 * expression.cs (ArrayCreation): Update to reflect the above
17643 * Small changes to prepare for Array initialization.
17645 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17647 * typemanager.cs (ImplementsInterface): interface might be null;
17648 Deal with this problem;
17650 Also, we do store negative hits on the cache (null values), so use
17651 this instead of calling t.GetInterfaces on the type everytime.
17653 2001-10-28 Ravi Pratap <ravi@ximian.com>
17655 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17657 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17658 split functionality out into different classes.
17660 (New::FormArrayType): Move into NewBuiltinArray.
17662 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17665 (NewBuiltinArray): New class to handle creation of built-in arrays.
17667 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17668 account creation of one-dimensional arrays.
17670 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17672 (NewUserdefinedArray::DoResolve): Implement.
17674 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17676 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17677 we maintain inside the TypeManager. This is necessary to perform lookups on the
17680 (LookupType): Update to perform GetType on the module builders too.
17682 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17684 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17686 2001-10-23 Ravi Pratap <ravi@ximian.com>
17688 * expression.cs (New::DoResolve): Implement guts of array creation.
17690 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17692 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17694 * expression.cs: Fix bug I introduced lsat night that broke
17697 (Expression.Resolve): Report a 246 error (can not resolve name)
17698 if we find a SimpleName in the stream.
17700 (Expression.ResolveLValue): Ditto.
17702 (Expression.ResolveWithSimpleName): This function is a variant of
17703 ResolveName, this one allows SimpleNames to be returned without a
17704 warning. The only consumer of SimpleNames is MemberAccess
17706 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17708 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17709 might arrive here. I have my doubts that this is correct.
17711 * statement.cs (Lock): Implement lock statement.
17713 * cs-parser.jay: Small fixes to support `lock' and `using'
17715 * cs-tokenizer.cs: Remove extra space
17717 * driver.cs: New flag --checked, allows to turn on integer math
17720 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17721 Threading.Monitor.Exit
17723 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17725 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17726 Expression Class to be IndexerAccess.
17728 Notice that Indexer::DoResolve sets the eclass to Value.
17730 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17732 * class.cs (TypeContainer::Emit): Emit code for indexers.
17734 * assign.cs (IAssignMethod): New interface implemented by Indexers
17735 and Properties for handling assignment.
17737 (Assign::Emit): Simplify and reuse code.
17739 * expression.cs (IndexerAccess, PropertyExpr): Implement
17740 IAssignMethod, clean up old code.
17742 2001-10-22 Ravi Pratap <ravi@ximian.com>
17744 * typemanager.cs (ImplementsInterface): New method to determine if a type
17745 implements a given interface. Provides a nice cache too.
17747 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17750 (ConvertReferenceExplicit): Ditto.
17752 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17753 various methods, with correct names etc.
17755 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17756 Operator.UnaryNegation.
17758 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17759 we have a unary plus or minus operator.
17761 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17764 * everywhere : update accordingly.
17766 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17769 * class.cs (Method::Define): For the case where we are implementing a method
17770 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17771 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17773 2001-10-21 Ravi Pratap <ravi@ximian.com>
17775 * interface.cs (FindMembers): Implement to work around S.R.E
17778 * typemanager.cs (IsInterfaceType): Implement.
17780 (FindMembers): Update to handle interface types too.
17782 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17783 use IsAssignableFrom as that is not correct - it doesn't work.
17785 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17786 and accordingly override EmitStatement.
17788 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17789 using the correct logic :-)
17791 2001-10-19 Ravi Pratap <ravi@ximian.com>
17793 * ../errors/cs-11.cs : Add to demonstrate error -11
17795 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17797 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17798 then pass this as a hint to ResolveLValue.
17800 * expression.cs (FieldExpr): Add Location information
17802 (FieldExpr::LValueResolve): Report assignment to readonly
17805 (Expression::ExprClassFromMemberInfo): Pass location information.
17807 (Expression::ResolveLValue): Add new method that resolves an
17810 (Expression::DoResolveLValue): Default invocation calls
17813 (Indexers): New class used to keep track of indexers in a given
17816 (IStackStore): Renamed from LValue, as it did not really describe
17817 what this did. Also ResolveLValue is gone from this interface and
17818 now is part of Expression.
17820 (ElementAccess): Depending on the element access type
17822 * typemanager.cs: Add `indexer_name_type' as a Core type
17823 (System.Runtime.CompilerServices.IndexerNameAttribute)
17825 * statement.cs (Goto): Take a location.
17827 2001-10-18 Ravi Pratap <ravi@ximian.com>
17829 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17830 if two delegates are compatible.
17832 (NewDelegate::DoResolve): Update to take care of the case when
17833 we instantiate a delegate from another delegate.
17835 * typemanager.cs (FindMembers): Don't even try to look up members
17836 of Delegate types for now.
17838 2001-10-18 Ravi Pratap <ravi@ximian.com>
17840 * delegate.cs (NewDelegate): New class to take care of delegate
17843 * expression.cs (New): Split the delegate related code out into
17844 the NewDelegate class.
17846 * delegate.cs (DelegateInvocation): New class to handle delegate
17849 * expression.cs (Invocation): Split out delegate related code into
17850 the DelegateInvocation class.
17852 2001-10-17 Ravi Pratap <ravi@ximian.com>
17854 * expression.cs (New::DoResolve): Implement delegate creation fully
17855 and according to the spec.
17857 (New::DoEmit): Update to handle delegates differently.
17859 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17860 because of which we were printing out arguments in reverse order !
17862 * delegate.cs (VerifyMethod): Implement to check if the given method
17863 matches the delegate.
17865 (FullDelegateDesc): Implement.
17867 (VerifyApplicability): Implement.
17869 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17870 delegate invocations too.
17872 (Invocation::Emit): Ditto.
17874 * ../errors/cs1593.cs : Added.
17876 * ../errors/cs1594.cs : Added.
17878 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17880 2001-10-16 Ravi Pratap <ravi@ximian.com>
17882 * typemanager.cs (intptr_type): Core type for System.IntPtr
17884 (InitCoreTypes): Update for the same.
17886 (iasyncresult_type, asynccallback_type): Ditto.
17888 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17891 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17894 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17895 the builders for the 4 members of a delegate type :-)
17897 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17900 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17902 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17904 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17906 * statement.cs (Break::Emit): Implement.
17907 (Continue::Emit): Implement.
17909 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17910 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17911 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17912 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17915 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17916 properties that track the label for the current loop (begin of the
17917 loop and end of the loop).
17919 2001-10-15 Ravi Pratap <ravi@ximian.com>
17921 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17922 use of emitting anything at all.
17924 * class.cs, rootcontext.cs : Get rid of calls to the same.
17926 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17928 (Populate): Define the constructor correctly and set the implementation
17931 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17934 (AddDelegateType): Implement.
17936 (IsDelegateType): Implement helper method.
17938 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17940 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17941 and accordingly handle it.
17943 * delegate.cs (Populate): Take TypeContainer argument.
17944 Implement bits to define the Invoke method. However, I still haven't figured out
17945 how to take care of the native int bit :-(
17947 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17948 Qualify the name of the delegate, not its return type !
17950 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17953 (StandardConversionExists): Checking for array types turns out to be recursive.
17955 (ConvertReferenceExplicit): Implement array conversion.
17957 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17959 2001-10-12 Ravi Pratap <ravi@ximian.com>
17961 * cs-parser.jay (delegate_declaration): Store the fully qualified
17962 name as it is a type declaration.
17964 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17967 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17968 as TypeContainer::DefineType.
17970 (Populate): Method in which all the definition of the various methods (Invoke)
17973 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17976 (CloseDelegate): Finally creates the delegate.
17978 * class.cs (TypeContainer::DefineType): Update to define delegates.
17979 (Populate, Emit and CloseType): Do the same thing here too.
17981 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17982 delegates in all these operations.
17984 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17986 * expression.cs: LocalTemporary: a new expression used to
17987 reference a temporary that has been created.
17989 * assign.cs: Handle PropertyAccess back here, so that we can
17990 provide the proper semantic access to properties.
17992 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17993 a few more explicit conversions.
17995 * modifiers.cs: `NEW' modifier maps to HideBySig.
17997 * expression.cs (PropertyExpr): Make this into an
17998 ExpressionStatement, and support the EmitStatement code path.
18000 Perform get/set error checking, clean up the interface.
18002 * assign.cs: recognize PropertyExprs as targets, and if so, turn
18003 them into toplevel access objects.
18005 2001-10-12 Miguel de Icaza <miguel@ximian.com>
18007 * expression.cs: PropertyExpr::PropertyExpr: use work around the
18010 * typemanager.cs: Keep track here of our PropertyBuilders again to
18011 work around lameness in SRE.
18013 2001-10-11 Miguel de Icaza <miguel@ximian.com>
18015 * expression.cs (LValue::LValueResolve): New method in the
18016 interface, used to perform a second resolution pass for LValues.
18018 (This::DoResolve): Catch the use of this in static methods.
18020 (This::LValueResolve): Implement.
18022 (This::Store): Remove warning, assigning to `this' in structures
18025 (Invocation::Emit): Deal with invocation of
18026 methods on value types. We need to pass the address to structure
18027 methods rather than the object itself. (The equivalent code to
18028 emit "this" for structures leaves the entire structure on the
18029 stack instead of a pointer to it).
18031 (ParameterReference::DoResolve): Compute the real index for the
18032 argument based on whether the method takes or not a `this' pointer
18033 (ie, the method is static).
18035 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
18036 value types returned from functions when we need to invoke a
18037 method on the sturcture.
18040 2001-10-11 Ravi Pratap <ravi@ximian.com>
18042 * class.cs (TypeContainer::DefineType): Method to actually do the business of
18043 defining the type in the Modulebuilder or Typebuilder. This is to take
18044 care of nested types which need to be defined on the TypeBuilder using
18045 DefineNestedMethod.
18047 (TypeContainer::GetClassBases): Implement. Essentially the code from the
18048 methods in RootContext, only ported to be part of TypeContainer.
18050 (TypeContainer::GetInterfaceOrClass): Ditto.
18052 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
18054 * interface.cs (Interface::DefineInterface): New method. Does exactly
18055 what RootContext.CreateInterface did earlier, only it takes care of nested types
18058 (Interface::GetInterfaces): Move from RootContext here and port.
18060 (Interface::GetInterfaceByName): Same here.
18062 * rootcontext.cs (ResolveTree): Re-write.
18064 (PopulateTypes): Re-write.
18066 * class.cs (TypeContainer::Populate): Populate nested types too.
18067 (TypeContainer::Emit): Emit nested members too.
18069 * typemanager.cs (AddUserType): Do not make use of the FullName property,
18070 instead just use the name argument passed in as it is already fully
18073 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
18074 to TypeContainer mapping to see if a type is user-defined.
18076 * class.cs (TypeContainer::CloseType): Implement.
18078 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
18079 the default constructor.
18081 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
18084 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
18086 * interface.cs (CloseType): Create the type here.
18088 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
18091 Remove all the methods which are now in TypeContainer.
18093 2001-10-10 Ravi Pratap <ravi@ximian.com>
18095 * delegate.cs (Define): Re-write bits to define the delegate
18098 2001-10-10 Miguel de Icaza <miguel@ximian.com>
18100 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
18102 * expression.cs (ImplicitReferenceConversion): handle null as well
18103 as a source to convert to any reference type.
18105 * statement.cs (Return): Perform any implicit conversions to
18106 expected return type.
18108 Validate use of return statement.
18110 * codegen.cs (EmitContext): Pass the expected return type here.
18112 * class.cs (Method, Constructor, Property): Pass expected return
18113 type to EmitContext.
18115 2001-10-09 Miguel de Icaza <miguel@ximian.com>
18117 * expression.cs: Make DoResolve take an EmitContext instead of a
18120 Replaced `l' and `location' for `loc', for consistency.
18122 (Error, Warning): Remove unneeded Tc argument.
18124 * assign.cs, literal.cs, constant.cs: Update to new calling
18127 * codegen.cs: EmitContext now contains a flag indicating whether
18128 code is being generated in a static method or not.
18130 * cs-parser.jay: DecomposeQI, new function that replaces the old
18131 QualifiedIdentifier. Now we always decompose the assembled
18132 strings from qualified_identifier productions into a group of
18135 2001-10-08 Miguel de Icaza <miguel@ximian.com>
18137 * rootcontext.cs: Deal with field-less struct types correctly now
18138 by passing the size option to Define Type.
18140 * class.cs: Removed hack that created one static field.
18142 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18144 * statement.cs: Moved most of the code generation here.
18146 2001-10-09 Ravi Pratap <ravi@ximian.com>
18148 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
18151 (ElementAccess): Remove useless bits for now - keep checks as the spec
18154 2001-10-08 Ravi Pratap <ravi@ximian.com>
18156 * expression.cs (ElementAccess::DoResolve): Remove my crap code
18157 and start performing checks according to the spec.
18159 2001-10-07 Ravi Pratap <ravi@ximian.com>
18161 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
18162 rank_specifiers instead.
18164 (rank_specifiers): Change the order in which the rank specifiers are stored
18166 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
18168 * expression.cs (ElementAccess): Implement the LValue interface too.
18170 2001-10-06 Ravi Pratap <ravi@ximian.com>
18172 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
18173 except that user defined conversions are not included.
18175 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
18176 perform the conversion of the return type, if necessary.
18178 (New::DoResolve): Check whether we are creating an array or an object
18179 and accordingly do the needful.
18181 (New::Emit): Same here.
18183 (New::DoResolve): Implement guts of array creation.
18185 (New::FormLookupType): Helper function.
18187 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18189 * codegen.cs: Removed most of the code generation here, and move the
18190 corresponding code generation bits to the statement classes.
18192 Added support for try/catch/finalize and throw.
18194 * cs-parser.jay: Added support for try/catch/finalize.
18196 * class.cs: Catch static methods having the flags override,
18197 virtual or abstract.
18199 * expression.cs (UserCast): This user cast was not really doing
18200 what it was supposed to do. Which is to be born in fully resolved
18201 state. Parts of the resolution were being performed at Emit time!
18205 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18207 * expression.cs: Implicity convert the result from UserCast.
18209 2001-10-05 Ravi Pratap <ravi@ximian.com>
18211 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
18212 prevented it from working correctly.
18214 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
18215 merely ConvertImplicit.
18217 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18219 * typemanager.cs: Make the LookupTypeContainer function static,
18220 and not per-instance.
18222 * class.cs: Make static FindMembers (the one that takes a Type
18225 * codegen.cs: Add EmitForeach here.
18227 * cs-parser.jay: Make foreach a toplevel object instead of the
18228 inline expansion, as we need to perform semantic analysis on it.
18230 2001-10-05 Ravi Pratap <ravi@ximian.com>
18232 * expression.cs (Expression::ImplicitUserConversion): Rename to
18233 UserDefinedConversion.
18235 (Expression::UserDefinedConversion): Take an extra argument specifying
18236 whether we look for explicit user conversions too.
18238 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
18240 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
18242 (ExplicitUserConversion): Make it a call to UserDefinedConversion
18243 with the appropriate arguments.
18245 * cs-parser.jay (cast_expression): Record location too.
18247 * expression.cs (Cast): Record location info.
18249 (Expression::ConvertExplicit): Take location argument.
18251 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
18252 to determine if we are doing explicit conversions.
18254 (UserCast::Emit): Update accordingly.
18256 (Expression::ConvertExplicit): Report an error if everything fails.
18258 * ../errors/cs0030.cs : Add.
18260 2001-10-04 Miguel de Icaza <miguel@ximian.com>
18262 * modifiers.cs: If the ABSTRACT keyword is present, also set the
18263 virtual and newslot bits.
18265 * class.cs (TypeContainer::RegisterRequiredImplementations):
18266 Record methods we need.
18268 (TypeContainer::MakeKey): Helper function to make keys for
18269 MethodBases, since the Methodbase key is useless.
18271 (TypeContainer::Populate): Call RegisterRequiredImplementations
18272 before defining the methods.
18274 Create a mapping for method_builders_to_methods ahead of time
18275 instead of inside a tight loop.
18277 (::RequireMethods): Accept an object as the data to set into the
18278 hashtable so we can report interface vs abstract method mismatch.
18280 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18282 * report.cs: Make all of it static.
18284 * rootcontext.cs: Drop object_type and value_type computations, as
18285 we have those in the TypeManager anyways.
18287 Drop report instance variable too, now it is a global.
18289 * driver.cs: Use try/catch on command line handling.
18291 Add --probe option to debug the error reporting system with a test
18294 * report.cs: Add support for exiting program when a probe
18295 condition is reached.
18297 2001-10-03 Ravi Pratap <ravi@ximian.com>
18299 * expression.cs (Binary::DoNumericPromotions): Fix the case when
18300 we do a forcible conversion regardless of type, to check if
18301 ForceConversion returns a null.
18303 (Binary::error19): Use location to report error.
18305 (Unary::error23): Use location here too.
18307 * ../errors/cs0019.cs : Check in.
18309 * ../errors/cs0023.cs : Check in.
18311 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
18312 case of a non-null MethodInfo object with a length of 0 !
18314 (Binary::ResolveOperator): Flag error if overload resolution fails to find
18315 an applicable member - according to the spec :-)
18316 Also fix logic to find members in base types.
18318 (Unary::ResolveOperator): Same here.
18320 (Unary::report23): Change name to error23 and make first argument a TypeContainer
18321 as I was getting thoroughly confused between this and error19 :-)
18323 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
18324 (::FindMostEncompassedType): Implement.
18325 (::FindMostEncompassingType): Implement.
18326 (::StandardConversionExists): Implement.
18328 (UserImplicitCast): Re-vamp. We now need info about most specific
18329 source and target types so that we can do the necessary conversions.
18331 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
18332 mathematical union with no duplicates.
18334 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18336 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
18337 in order from base classes to child classes, so that we can in
18338 child classes look up in our parent for method names and
18339 attributes (required for handling abstract, virtual, new, override
18340 constructs: we need to instrospect our base class, and if we dont
18341 populate the classes in order, the introspection might be
18342 incorrect. For example, a method could query its parent before
18343 the parent has any methods and would determine that the parent has
18344 no abstract methods (while it could have had them)).
18346 (RootContext::CreateType): Record the order in which we define the
18349 2001-10-02 Miguel de Icaza <miguel@ximian.com>
18351 * class.cs (TypeContainer::Populate): Also method definitions can
18352 fail now, keep track of this.
18354 (TypeContainer::FindMembers): Implement support for
18355 DeclaredOnly/noDeclaredOnly flag.
18357 (Constructor::Emit) Return the ConstructorBuilder.
18359 (Method::Emit) Return the MethodBuilder.
18360 Check for abstract or virtual methods to be public.
18362 * rootcontext.cs (RootContext::CreateType): Register all the
18363 abstract methods required for the class to be complete and the
18364 interface methods that must be implemented.
18366 * cs-parser.jay: Report error 501 (method requires body if it is
18367 not marked abstract or extern).
18369 * expression.cs (TypeOf::Emit): Implement.
18371 * typemanager.cs: runtime_handle_type, new global type.
18373 * class.cs (Property::Emit): Generate code for properties.
18375 2001-10-02 Ravi Pratap <ravi@ximian.com>
18377 * expression.cs (Unary::ResolveOperator): Find operators on base type
18378 too - we now conform exactly to the spec.
18380 (Binary::ResolveOperator): Same here.
18382 * class.cs (Operator::Define): Fix minor quirk in the tests.
18384 * ../errors/cs0215.cs : Added.
18386 * ../errors/cs0556.cs : Added.
18388 * ../errors/cs0555.cs : Added.
18390 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18392 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
18393 single integer which is really efficient
18395 2001-10-01 Ravi Pratap <ravi@ximian.com>
18397 * expression.cs (Expression::ImplicitUserConversion): Use location
18398 even in the case when we are examining True operators.
18400 * class.cs (Operator::Define): Perform extensive checks to conform
18401 with the rules for operator overloading in the spec.
18403 * expression.cs (Expression::ImplicitReferenceConversion): Implement
18404 some of the other conversions mentioned in the spec.
18406 * typemanager.cs (array_type): New static member for the System.Array built-in
18409 (cloneable_interface): For System.ICloneable interface.
18411 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
18412 we start resolving the tree and populating types.
18414 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
18416 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18418 * expression.cs (Expression::ExprClassFromMemberInfo,
18419 Expression::Literalize): Create literal expressions from
18420 FieldInfos which are literals.
18422 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
18423 type casts, because they were wrong. The test suite in tests
18426 (ImplicitNumericConversion): ushort to ulong requires a widening
18429 Int32 constant to long requires widening cast as well.
18431 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
18432 for integers because the type on the stack is not i4.
18434 2001-09-30 Miguel de Icaza <miguel@ximian.com>
18436 * expression.cs (report118): require location argument.
18438 * parameter.cs: Do not dereference potential null value.
18440 * class.cs: Catch methods that lack the `new' keyword when
18441 overriding a name. Report warnings when `new' is used without
18442 anything being there to override.
18444 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
18446 * class.cs: Only add constructor to hashtable if it is non-null
18447 (as now constructors can fail on define).
18449 (TypeManager, Class, Struct): Take location arguments.
18451 Catch field instance initialization in structs as errors.
18453 accepting_filter: a new filter for FindMembers that is static so
18454 that we dont create an instance per invocation.
18456 (Constructor::Define): Catch errors where a struct constructor is
18459 * cs-parser.jay: Pass location information for various new
18462 * delegate.cs (Delegate): take a location argument.
18464 * driver.cs: Do not call EmitCode if there were problesm in the
18465 Definition of the types, as many Builders wont be there.
18467 * decl.cs (Decl::Decl): Require a location argument.
18469 * cs-tokenizer.cs: Handle properly hex constants that can not fit
18470 into integers, and find the most appropiate integer for it.
18472 * literal.cs: Implement ULongLiteral.
18474 * rootcontext.cs: Provide better information about the location of
18475 failure when CreateType fails.
18477 2001-09-29 Miguel de Icaza <miguel@ximian.com>
18479 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
18482 * expression.cs (Binary::CheckShiftArguments): Add missing type
18484 (Binary::ResolveOperator): Add type to the logical and and logical
18485 or, Bitwise And/Or and Exclusive Or code paths, it was missing
18488 (Binary::DoNumericPromotions): In the case where either argument
18489 is ulong (and most signed types combined with ulong cause an
18490 error) perform implicit integer constant conversions as well.
18492 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18494 * expression.cs (UserImplicitCast): Method should always be
18496 (Invocation::BetterConversion): Simplified test for IntLiteral.
18498 (Expression::ImplicitNumericConversion): Split this routine out.
18499 Put the code that performs implicit constant integer conversions
18502 (Expression::Resolve): Become a wrapper around DoResolve so we can
18503 check eclass and type being set after resolve.
18505 (Invocation::Badness): Remove this dead function
18507 (Binary::ResolveOperator): Do not compute the expensive argumnets
18508 unless we have a union for it.
18510 (Probe::Emit): Is needs to do an isinst and then
18511 compare against null.
18513 (::CanConvert): Added Location argument. If the Location argument
18514 is null (Location.Null), then we do not report errors. This is
18515 used by the `probe' mechanism of the Explicit conversion. We do
18516 not want to generate an error for something that the user
18517 explicitly requested to be casted. But the pipeline for an
18518 explicit cast first tests for potential implicit casts.
18520 So for now, if the Location is null, it means `Probe only' to
18521 avoid adding another argument. Might have to revise this
18524 (ClassCast): New class used to type cast objects into arbitrary
18525 classes (used in Explicit Reference Conversions).
18527 Implement `as' as well.
18529 Reverted all the patches from Ravi below: they were broken:
18531 * The use of `level' as a mechanism to stop recursive
18532 invocations is wrong. That was there just to catch the
18533 bug with a strack trace but not as a way of addressing
18536 To fix the problem we have to *understand* what is going
18537 on and the interactions and come up with a plan, not
18538 just get things going.
18540 * The use of the type conversion cache that I proposed
18541 last night had an open topic: How does this work across
18542 protection domains. A user defined conversion might not
18543 be public in the location where we are applying the
18544 conversion, a different conversion might be selected
18545 (ie, private A->B (better) but public B->A (worse),
18546 inside A, A->B applies, but outside it, B->A will
18549 * On top of that (ie, even if the above is solved),
18550 conversions in a cache need to be abstract. Ie, `To
18551 convert from an Int to a Short use an OpcodeCast', not
18552 `To convert from an Int to a Short use the OpcodeCast on
18553 the variable 5' (which is what this patch was doing).
18555 2001-09-28 Ravi Pratap <ravi@ximian.com>
18557 * expression.cs (Invocation::ConversionExists): Re-write to use
18558 the conversion cache
18560 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
18561 cache all conversions done, not just user-defined ones.
18563 (Invocation::BetterConversion): The real culprit. Use ConversionExists
18564 to determine if a conversion exists instead of acutually trying to
18565 perform the conversion. It's faster too.
18567 (Expression::ConvertExplicit): Modify to use ConversionExists to check
18568 and only then attempt the implicit conversion.
18570 2001-09-28 Ravi Pratap <ravi@ximian.com>
18572 * expression.cs (ConvertImplicit): Use a cache for conversions
18573 already found. Check level of recursion and bail out if necessary.
18575 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18577 * typemanager.cs (string_concat_string_string, string_concat_object_object):
18578 Export standard methods that we expect for string operations.
18580 * statement.cs (Block::UsageWarning): Track usage of variables and
18581 report the errors for not used variables.
18583 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
18586 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18588 * codegen.cs: remove unnneded code
18590 * expression.cs: Removed BuiltinTypeAccess class
18592 Fix the order in which implicit conversions are
18595 The previous fixed dropped support for boxed conversions (adding a
18596 test to the test suite now)
18598 (UserImplicitCast::CanConvert): Remove test for source being null,
18599 that code is broken. We should not feed a null to begin with, if
18600 we do, then we should track the bug where the problem originates
18601 and not try to cover it up here.
18603 Return a resolved expression of type UserImplicitCast on success
18604 rather than true/false. Ravi: this is what I was talking about,
18605 the pattern is to use a static method as a "constructor" for
18608 Also, do not create arguments until the very last minute,
18609 otherwise we always create the arguments even for lookups that
18610 will never be performed.
18612 (UserImplicitCast::Resolve): Eliminate, objects of type
18613 UserImplicitCast are born in a fully resolved state.
18615 * typemanager.cs (InitCoreTypes): Init also value_type
18616 (System.ValueType).
18618 * expression.cs (Cast::Resolve): First resolve the child expression.
18620 (LValue): Add new method AddressOf to be used by
18623 Change the argument of Store to take an EmitContext instead of an
18624 ILGenerator, because things like FieldExpr need to be able to call
18625 their children expression to generate the instance code.
18627 (Expression::Error, Expression::Warning): Sugar functions for
18630 (Expression::MemberLookup): Accept a TypeContainer instead of a
18631 Report as the first argument.
18633 (Expression::ResolvePrimary): Killed. I still want to improve
18634 this as currently the code is just not right.
18636 (Expression::ResolveMemberAccess): Simplify, but it is still
18639 (Unary::Resolve): Catch errors in AddressOf operators.
18641 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18642 index to a byte for the short-version, or the compiler will choose
18643 the wrong Emit call, which generates the wrong data.
18645 (ParameterReference::Emit, ::Store): same.
18647 (FieldExpr::AddressOf): Implement.
18649 * typemanager.cs: TypeManager: made public variable instead of
18652 * driver.cs: document --fatal.
18654 * report.cs (ErrorMessage, WarningMessage): new names for the old
18655 Error and Warning classes.
18657 * cs-parser.jay (member_access): Turn built-in access to types
18658 into a normal simplename
18660 2001-09-27 Ravi Pratap <ravi@ximian.com>
18662 * expression.cs (Invocation::BetterConversion): Fix to cope
18663 with q being null, since this was introducing a bug.
18665 * expression.cs (ConvertImplicit): Do built-in conversions first.
18667 2001-09-27 Ravi Pratap <ravi@ximian.com>
18669 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18671 2001-09-27 Ravi Pratap <ravi@ximian.com>
18673 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18674 I had introduced long ago (what's new ?).
18676 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18677 the work of all the checking.
18678 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18679 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18681 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18682 that is the right way.
18684 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18685 overloading resolution. Use everywhere instead of cutting and pasting code.
18687 (Binary::ResolveOperator): Use MakeUnionSet.
18689 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18690 we have to convert to bool types. Not complete yet.
18692 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18694 * typemanager.cs (TypeManager::CSharpName): support ushort.
18696 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18697 to provide an expression that performsn an implicit constant int
18698 conversion (section 6.1.6).
18699 (Expression::ConvertImplicitRequired): Reworked to include
18700 implicit constant expression conversions.
18702 (Expression::ConvertNumericExplicit): Finished.
18704 (Invocation::Emit): If InstanceExpression is null, then it means
18705 that we perform a call on this.
18707 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18709 * expression.cs (Unary::Emit): Remove some dead code.
18710 (Probe): Implement Resolve and Emit for `is'.
18711 (Expression::ConvertImplicitRequired): Attempt to do constant
18712 expression conversions here. Maybe should be moved to
18713 ConvertImplicit, but I am not sure.
18714 (Expression::ImplicitLongConstantConversionPossible,
18715 Expression::ImplicitIntConstantConversionPossible): New functions
18716 that tell whether is it possible to apply an implicit constant
18717 expression conversion.
18719 (ConvertNumericExplicit): Started work on explicit numeric
18722 * cs-parser.jay: Update operator constants.
18724 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18725 (Parameters::GetSignature): Hook up VerifyArgs here.
18726 (Parameters::VerifyArgs): Verifies that no two arguments have the
18729 * class.cs (Operator): Update the operator names to reflect the
18730 ones that the spec expects (as we are just stringizing the
18733 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18734 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18735 previous usage did only work for our methods.
18736 (Expression::ConvertImplicit): Handle decimal implicit numeric
18737 conversions as well.
18738 (Expression::InternalTypeConstructor): Used to invoke constructors
18739 on internal types for default promotions.
18741 (Unary::Emit): Implement special handling for the pre/post
18742 increment/decrement for overloaded operators, as they need to have
18743 the same semantics as the other operators.
18745 (Binary::ResolveOperator): ditto.
18746 (Invocation::ConversionExists): ditto.
18747 (UserImplicitCast::Resolve): ditto.
18749 2001-09-26 Ravi Pratap <ravi@ximian.com>
18751 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18752 operator, return after emitting body. Regression tests pass again !
18754 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18755 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18756 (Invocation::OverloadResolve): Ditto.
18757 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18759 * everywhere : update calls to the above methods accordingly.
18761 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18763 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18765 * expression.cs (ExpressionStatement): New base class used for
18766 expressions that can appear in statements, so that we can provide
18767 an alternate path to generate expression that do not leave a value
18770 (Expression::Emit, and all the derivatives): We no longer return
18771 whether a value is left on the stack or not. Every expression
18772 after being emitted leaves a single value on the stack.
18774 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18775 facilties of ExpressionStatement if possible.
18777 * cs-parser.jay: Update statement_expression.
18779 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18781 * driver.cs: Change the wording of message
18783 2001-09-25 Ravi Pratap <ravi@ximian.com>
18785 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18786 the type of the expression to the return type of the method if
18787 we have an overloaded operator match ! The regression tests pass again !
18788 (Unary::ResolveOperator): Ditto.
18790 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18791 to find "op_Implicit", not "implicit" ;-)
18792 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18793 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18795 * everywhere : Correct calls to the above accordingly.
18797 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18798 (ConvertImplicit): Do user-defined conversion if it exists.
18800 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18802 * assign.cs: track location.
18803 (Resolve): Use implicit conversions on assignment.
18805 * literal.cs: Oops. Not good, Emit of short access values should
18806 pass (Bytes) or the wrong argument will be selected.
18808 * expression.cs (Unary::Emit): Emit code for -expr.
18810 (Unary::ResolveOperator): Handle `Substract' for non-constants
18811 (substract from zero from the non-constants).
18812 Deal with Doubles as well.
18814 (Expression::ConvertImplicitRequired): New routine that reports an
18815 error if no implicit conversion exists.
18817 (Invocation::OverloadResolve): Store the converted implicit
18818 expressions if we make them
18820 2001-09-24 Ravi Pratap <ravi@ximian.com>
18822 * class.cs (ConstructorInitializer): Take a Location argument.
18823 (ConstructorBaseInitializer): Same here.
18824 (ConstructorThisInitializer): Same here.
18826 * cs-parser.jay : Update all calls accordingly.
18828 * expression.cs (Unary, Binary, New): Take location argument.
18829 Update accordingly everywhere.
18831 * cs-parser.jay : Update all calls to the above to take a location
18834 * class.cs : Ditto.
18836 2001-09-24 Ravi Pratap <ravi@ximian.com>
18838 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18839 (Invocation::BetterConversion): Same here
18840 (Invocation::ConversionExists): Ditto.
18842 (Invocation::ConversionExists): Implement.
18844 2001-09-22 Ravi Pratap <ravi@ximian.com>
18846 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18847 Also take an additional TypeContainer argument.
18849 * All over : Pass in TypeContainer as argument to OverloadResolve.
18851 * typemanager.cs (CSharpName): Update to check for the string type and return
18854 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18857 2001-09-21 Ravi Pratap <ravi@ximian.com>
18859 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18860 (Invocation::BetterFunction): Implement.
18861 (Invocation::BetterConversion): Implement.
18862 (Invocation::ConversionExists): Skeleton, no implementation yet.
18864 Okay, things work fine !
18866 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18868 * typemanager.cs: declare and load enum_type, delegate_type and
18871 * expression.cs (Expression::Emit): Now emit returns a value that
18872 tells whether a value is left on the stack or not. This strategy
18873 might be reveted tomorrow with a mechanism that would address
18874 multiple assignments.
18875 (Expression::report118): Utility routine to report mismatches on
18878 (Unary::Report23): Report impossible type/operator combination
18881 (Unary::IsIncrementableNumber): Whether the type can be
18882 incremented or decremented with add.
18883 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18885 (Unary::ResolveOperator): Implement ++, !, ~,
18887 (Invocation::Emit): Deal with new Emit convetion.
18889 * All Expression derivatives: Updated their Emit method to return
18890 whether they leave values on the stack or not.
18892 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18893 stack for expressions that are statements.
18895 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18897 * expression.cs (LValue): New interface. Must be implemented by
18899 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18902 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18903 interface for generating code, simplifies the code.
18905 2001-09-20 Ravi Pratap <ravi@ximian.com>
18907 * expression.cs (everywhere): Comment out return statements in ::Resolve
18908 methods to avoid the warnings.
18910 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18912 * driver.cs (parse): Report error 2001 if we can not open the
18915 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18918 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18921 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18922 otherwise nested blocks end up with the same index.
18924 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18926 * expression.cs: Instead of having FIXMEs in the Resolve
18927 functions, throw exceptions so it is obvious that we are facing a
18930 * cs-parser.jay (invocation_expression): Pass Location information.
18932 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18933 Use a basename for those routines because .NET does not like paths
18936 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18939 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18941 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18942 are loading the correct data types (throws an exception if not).
18943 (TypeManager::InitCoreTypes): Use CoreLookupType
18945 * expression.cs (Unary::ResolveOperator): return the child
18946 expression for expressions which are just +expr.
18947 (Unary::ResolveOperator): Return negative literals for -LITERAL
18948 expressions (otherwise they are Unary {Literal}).
18949 (Invocation::Badness): Take into account `Implicit constant
18950 expression conversions'.
18952 * literal.cs (LongLiteral): Implement long literal class.
18953 (IntLiteral): export the `Value' of the intliteral.
18955 2001-09-19 Ravi Pratap <ravi@ximian.com>
18957 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18959 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18960 instead of 'Operator'
18962 * expression.cs (Binary::ResolveOperator): Update accordingly.
18963 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18966 * cs-parser.jay (unary_expression): Update to use the new names.
18968 * gen-treedump.cs (GetUnary): Same here.
18970 * expression.cs (Unary::Resolve): Implement.
18971 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18972 operators are found instead of making noise ;-)
18973 (Unary::ResolveOperator): New method to do precisely the same thing which
18974 Binary::ResolveOperator does for Binary expressions.
18975 (Unary.method, .Arguments): Add.
18976 (Unary::OperName): Implement.
18977 (Unary::ForceConversion): Copy and Paste !
18979 * class.cs (Operator::Define): Fix a small bug for the case when we have
18982 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18983 for the inbuilt operators. Only overloading works for now ;-)
18985 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18987 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18988 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18990 * expression.cs (This::Emit): Implement.
18991 (This::Resolve): Implement.
18992 (TypeOf:Resolve): Implement.
18993 (Expression::ResolveSimpleName): Add an implicit this to instance
18995 (MemberAccess::Resolve): Deal with Parameters and Fields.
18996 Bind instance variable to Field expressions.
18997 (FieldExpr::Instance): New field used to track the expression that
18998 represents the object instance.
18999 (FieldExpr::Resolve): Track potential errors from MemberLookup not
19001 (FieldExpr::Emit): Implement.
19003 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
19004 the last instruction contains a return opcode to avoid generating
19005 the last `ret' instruction (this generates correct code, and it is
19006 nice to pass the peverify output).
19008 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
19009 initializer for static and instance variables.
19010 (Constructor::Emit): Allow initializer to be null in the case of
19011 static constructors. Only emit initializer for instance
19014 (TypeContainer::FindMembers): Return a null array if there are no
19017 Also fix the code for the MemberTypes.Method branch, as it was not
19018 scanning that for operators (or tried to access null variables before).
19020 * assign.cs (Assign::Emit): Handle instance and static fields.
19024 * driver.cs: Stop compilation if there are parse errors.
19026 * cs-parser.jay (constructor_declaration): Provide default base
19027 initializer for non-static constructors.
19028 (constructor_declarator): Do not provide a default base
19029 initializers if none was specified.
19030 Catch the fact that constructors should not have parameters.
19032 * class.cs: Do not emit parent class initializers for static
19033 constructors, that should be flagged as an error.
19035 2001-09-18 Ravi Pratap <ravi@ximian.com>
19037 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
19038 Move back code into TypeContainer::Populate.
19040 2001-09-18 Ravi Pratap <ravi@ximian.com>
19042 * class.cs (TypeContainer::AddConstructor): Fix the check to
19043 compare against Name, not Basename.
19044 (Operator::OpType): Change Plus and Minus to Add and Subtract.
19046 * cs-parser.jay : Update accordingly.
19048 * class.cs (TypeContainer::FindMembers): For the case where we are searching
19049 for methods, don't forget to look into the operators too.
19050 (RegisterMethodBuilder): Helper method to take care of this for
19051 methods, constructors and operators.
19052 (Operator::Define): Completely revamp.
19053 (Operator.OperatorMethod, MethodName): New fields.
19054 (TypeContainer::Populate): Move the registering of builders into
19055 RegisterMethodBuilder.
19056 (Operator::Emit): Re-write.
19058 * expression.cs (Binary::Emit): Comment out code path to emit method
19059 invocation stuff for the case when we have a user defined operator. I am
19060 just not able to get it right !
19062 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19064 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
19067 (Expression::MemberLookup): Provide a version that allows to
19068 specify the MemberTypes and BindingFlags.
19070 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
19071 so it was not fetching variable information from outer blocks.
19073 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
19074 Beforefieldinit as it was buggy.
19076 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
19077 that Ravi put here.
19079 * class.cs (Constructor::Emit): Only emit if block is not null.
19080 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
19081 deal with this by semantically definining it as if the user had
19084 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
19085 constructors as we now "emit" them at a higher level.
19087 (TypeContainer::DefineDefaultConstructor): Used to define the
19088 default constructors if none was provided.
19090 (ConstructorInitializer): Add methods Resolve and Emit.
19092 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
19094 2001-09-17 Ravi Pratap <ravi@ximian.com>
19096 * class.cs (TypeContainer::EmitDefaultConstructor): Register
19097 the default constructor builder with our hashtable for methodbuilders
19100 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
19101 and argument_count is 0 in which case we have a match.
19102 (Binary::ResolveOperator): More null checking and miscellaneous coding
19105 2001-09-17 Ravi Pratap <ravi@ximian.com>
19107 * rootcontext.cs (IsNameSpace): Compare against null.
19109 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
19111 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
19112 and Unary::Operator.
19114 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
19117 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
19118 we have overloaded operators.
19119 (Binary::ResolveOperator): Implement the part which does the operator overload
19122 * class.cs (Operator::Emit): Implement.
19123 (TypeContainer::Emit): Emit the operators we have too.
19125 * expression.cs (Binary::Emit): Update to emit the appropriate code for
19126 the case when we have a user-defined operator.
19128 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19130 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
19132 2001-09-16 Ravi Pratap <ravi@ximian.com>
19134 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
19135 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
19136 (Constructor::Emit): Implement.
19137 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
19138 if we have no work to do.
19139 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
19142 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
19143 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
19145 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
19148 2001-09-15 Ravi Pratap <ravi@ximian.com>
19150 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
19152 (Tree::RecordNamespace): Method to do what the name says ;-)
19153 (Tree::Namespaces): Property to get at the namespaces hashtable.
19155 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
19158 * rootcontext.cs (IsNamespace): Fixed it :-)
19160 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19162 * class.cs (TypeContainer::FindMembers): Add support for
19164 (MethodCore): New class that encapsulates both the shared aspects
19165 of a Constructor and a Method.
19166 (Method, Constructor): Factored pieces into MethodCore.
19168 * driver.cs: Added --fatal which makes errors throw exceptions.
19169 Load System assembly as well as part of the standard library.
19171 * report.cs: Allow throwing exceptions on errors for debugging.
19173 * modifiers.cs: Do not use `parent', instead use the real type
19174 container to evaluate permission settings.
19176 * class.cs: Put Ravi's patch back in. He is right, and we will
19177 have to cope with the
19179 2001-09-14 Ravi Pratap <ravi@ximian.com>
19181 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
19182 FamORAssem, not FamANDAssem.
19184 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19186 * driver.cs: Added --parse option that only parses its input files
19189 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
19190 incorrect. IsTopLevel is not used to tell whether an object is
19191 root_types or not (that can be achieved by testing this ==
19192 root_types). But to see if this is a top-level *class* (not
19193 necessarly our "toplevel" container).
19195 2001-09-14 Ravi Pratap <ravi@ximian.com>
19197 * enum.cs (Enum::Define): Modify to call the Lookup method on the
19198 parent instead of a direct call to GetType.
19200 2001-09-14 Ravi Pratap <ravi@ximian.com>
19202 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
19203 Modifiers.TypeAttr. This should just be a call to that method.
19205 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
19206 object so that we can determine if we are top-level or not.
19208 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
19211 * enum.cs (Enum::Define): Ditto.
19213 * modifiers.cs (FieldAttr): Re-write.
19215 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
19216 (TypeContainer::HaveStaticConstructor): New property to provide access
19217 to precisely that info.
19219 * modifiers.cs (MethodAttr): Re-write.
19220 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
19222 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
19223 of top-level types as claimed.
19225 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19227 * expression.cs (MemberLookup): Fruitless attempt to lookup
19228 constructors. Maybe I need to emit default constructors? That
19229 might be it (currently .NET emits this for me automatically).
19230 (Invocation::OverloadResolve): Cope with Arguments == null.
19231 (Invocation::EmitArguments): new function, shared by the new
19232 constructor and us.
19233 (Invocation::Emit): Handle static and instance methods. Emit
19234 proper call instruction for virtual or non-virtual invocations.
19235 (New::Emit): Implement.
19236 (New::Resolve): Implement.
19237 (MemberAccess:Resolve): Implement.
19238 (MethodGroupExpr::InstanceExpression): used conforming to the spec
19239 to track instances.
19240 (FieldExpr::Resolve): Set type.
19242 * support.cs: Handle empty arguments.
19244 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
19245 SimpleLookup): Auxiliary routines to help parse a qualifier
19248 Update qualifier_identifier rule.
19250 * codegen.cs: Removed debugging messages.
19252 * class.cs: Make this a global thing, this acts just as a "key" to
19253 objects that we might have around.
19255 (Populate): Only initialize method_builders_to_methods once.
19257 * expression.cs (PropertyExpr): Initialize type from the
19260 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
19261 Resolve pattern. Attempt to implicitly convert value to boolean.
19264 * expression.cs: Set the type for the int32/int32 argument case.
19265 (Binary::ResolveOperator): Set the return type to boolean for
19266 comparission operators
19268 * typemanager.cs: Remove debugging print code.
19270 (Invocation::Resolve): resolve type.
19272 * class.cs: Allocate a MemberInfo of the correct size, as the code
19273 elsewhere depends on the test to reflect the correct contents.
19275 (Method::) Keep track of parameters, due to System.Reflection holes
19277 (TypeContainer::Populate): Keep track of MethodBuilders to Method
19280 (TypeContainer::FindMembers): Use ArrayList and then copy an array
19281 of the exact size and return that.
19283 (Class::LookupMethodByBuilder): New function that maps
19284 MethodBuilders to its methods. Required to locate the information
19285 on methods because System.Reflection bit us again.
19287 * support.cs: New file, contains an interface ParameterData and
19288 two implementations: ReflectionParameters and InternalParameters
19289 used to access Parameter information. We will need to grow this
19292 * expression.cs (Invocation::GetParameterData): implement a cache
19293 and a wrapper around the ParameterData creation for methods.
19294 (Invocation::OverloadResolve): Use new code.
19296 2001-09-13 Ravi Pratap <ravi@ximian.com>
19298 * class.cs (TypeContainer::EmitField): Remove and move into
19299 (Field::Define): here and modify accordingly.
19300 (Field.FieldBuilder): New member.
19301 (TypeContainer::Populate): Update accordingly.
19302 (TypeContainer::FindMembers): Implement.
19304 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19306 * statement.cs: (VariableInfo::VariableType): New field to be
19307 initialized with the full type once it is resolved.
19309 2001-09-12 Miguel de Icaza <miguel@ximian.com>
19311 * parameter.cs (GetParameterInfo): Use a type cache to compute
19312 things only once, and to reuse this information
19314 * expression.cs (LocalVariableReference::Emit): Implement.
19315 (OpcodeCast::Emit): fix.
19317 (ParameterReference::Resolve): Implement.
19318 (ParameterReference::Emit): Implement.
19320 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
19321 that are expressions need to stay as Expressions.
19323 * typemanager.cs (CSharpName): Returns the C# name of a type if
19326 * expression.cs (Expression::ConvertImplicit): New function that
19327 implements implicit type conversions.
19329 (Expression::ImplicitReferenceConversion): Implements implicit
19330 reference conversions.
19332 (EmptyCast): New type for transparent casts.
19334 (OpcodeCast): New type for casts of types that are performed with
19335 a sequence of bytecodes.
19337 (BoxedCast): New type used for casting value types into reference
19338 types. Emits a box opcode.
19340 (Binary::DoNumericPromotions): Implements numeric promotions of
19341 and computation of the Binary::Type.
19343 (Binary::EmitBranchable): Optimization.
19345 (Binary::Emit): Implement code emission for expressions.
19347 * typemanager.cs (TypeManager): Added two new core types: sbyte
19350 2001-09-12 Ravi Pratap <ravi@ximian.com>
19352 * class.cs (TypeContainer::FindMembers): Method which does exactly
19353 what Type.FindMembers does, only we don't have to use reflection. No
19354 implementation yet.
19356 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
19357 typecontainer objects as we need to get at them.
19358 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
19360 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
19361 typecontainer object.
19363 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
19364 of just a Report object.
19366 2001-09-11 Ravi Pratap <ravi@ximian.com>
19368 * class.cs (Event::Define): Go back to using the prefixes "add_" and
19370 (TypeContainer::Populate): Now define the delegates of the type too.
19371 (TypeContainer.Delegates): Property to access the list of delegates defined
19374 * delegates.cs (Delegate::Define): Implement partially.
19376 * modifiers.cs (TypeAttr): Handle more flags.
19378 2001-09-11 Ravi Pratap <ravi@ximian.com>
19380 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
19382 (Operator::Define): Re-write logic to get types by using the LookupType method
19383 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
19384 (Indexer::Define): Ditto.
19385 (Event::Define): Ditto.
19386 (Property::Define): Ditto.
19388 2001-09-10 Ravi Pratap <ravi@ximian.com>
19390 * class.cs (TypeContainer::Populate): Now define operators too.
19391 (TypeContainer.Operators): New property to access the list of operators
19393 (Operator.OperatorMethodBuilder): New member to hold the method builder
19394 for the operator we are defining.
19395 (Operator::Define): Implement.
19397 2001-09-10 Ravi Pratap <ravi@ximian.com>
19399 * class.cs (Event::Define): Make the prefixes of the accessor methods
19400 addOn_ and removeOn_
19402 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
19403 of the location being passed in too. Ideally, this should go later since all
19404 error reporting should be done through the Report object.
19406 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
19407 (Populate): Iterate thru the indexers we have and define them too.
19408 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
19409 for the get and set accessors.
19410 (Indexer::Define): Implement.
19412 2001-09-09 Miguel de Icaza <miguel@ximian.com>
19414 * expression.cs (Binary::Resolve): Beginning of it. I scratched
19415 my previous implementation, did not work.
19417 * typemanager.cs: Add a couple of missing types (the longs).
19419 * literal.cs: Use TypeManager.bool_type instead of getting it.
19421 * expression.cs (EventExpr): New kind of expressions.
19422 (Expressio::ExprClassFromMemberInfo): finish
19424 2001-09-08 Miguel de Icaza <miguel@ximian.com>
19426 * assign.cs: Emit stores to static fields differently.
19428 2001-09-08 Ravi Pratap <ravi@ximian.com>
19430 * Merge in changes and adjust code to tackle conflicts. Backed out my
19431 code in Assign::Resolve ;-)
19433 2001-09-08 Ravi Pratap <ravi@ximian.com>
19435 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
19436 instead Report.Error and also pass in the location.
19437 (CSharpParser::Lexer): New readonly property to return the reference
19438 to the Tokenizer object.
19439 (declare_local_variables): Use Report.Error with location instead of plain
19443 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
19444 (Operator.CheckBinaryOperator): Ditto.
19446 * cs-parser.jay (operator_declarator): Update accordingly.
19448 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
19449 (CheckBinaryOperator): Same here.
19451 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
19452 on the name without any prefixes of namespace names etc. This is because we
19453 already might have something already fully qualified like
19454 'System.Console.WriteLine'
19456 * assign.cs (Resolve): Begin implementation. Stuck ;-)
19458 2001-09-07 Ravi Pratap <ravi@ximian.com>
19460 * cs-tokenizer.cs (location): Return a string which also contains
19463 * expression.cs (ElementAccess): New class for expressions of the
19464 type 'element access.'
19465 (BaseAccess): New class for expressions of the type 'base access.'
19466 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
19469 * cs-parser.jay (element_access): Implement action.
19470 (base_access): Implement actions.
19471 (checked_expression, unchecked_expression): Implement.
19473 * cs-parser.jay (local_variable_type): Correct and implement.
19474 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
19476 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
19478 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
19479 name and the specifiers.
19481 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
19483 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
19484 making them all public ;-)
19486 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
19489 2001-09-07 Miguel de Icaza <miguel@ximian.com>
19491 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
19493 (FieldExpr, PropertyExprs): New resolved expressions.
19494 (SimpleName::MemberStaticCheck): Perform static checks for access
19495 to non-static fields on static methods. Maybe this should be
19496 generalized for MemberAccesses.
19497 (SimpleName::ResolveSimpleName): More work on simple name
19500 * cs-parser.jay (primary_expression/qualified_identifier): track
19501 the parameter index.
19503 * codegen.cs (CodeGen::Save): Catch save exception, report error.
19504 (EmitContext::EmitBoolExpression): Chain to expression generation
19505 instead of temporary hack.
19506 (::EmitStatementExpression): Put generic expression code generation.
19508 * assign.cs (Assign::Emit): Implement variable assignments to
19509 local variables, parameters and fields.
19511 2001-09-06 Miguel de Icaza <miguel@ximian.com>
19513 * statement.cs (Block::GetVariableInfo): New method, returns the
19514 VariableInfo for a variable name in a block.
19515 (Block::GetVariableType): Implement in terms of GetVariableInfo
19517 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
19518 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
19520 2001-09-06 Ravi Pratap <ravi@ximian.com>
19522 * cs-parser.jay (operator_declaration): Continue on my quest : update
19523 to take attributes argument.
19524 (event_declaration): Ditto.
19525 (enum_declaration): Ditto.
19526 (indexer_declaration): Ditto.
19528 * class.cs (Operator::Operator): Update constructor accordingly.
19529 (Event::Event): Ditto.
19531 * delegate.cs (Delegate::Delegate): Same here.
19533 * enum.cs (Enum::Enum): Same here.
19535 2001-09-05 Ravi Pratap <ravi@ximian.com>
19537 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
19539 * ../tests/cs0658.cs : New file to demonstrate error 0658.
19541 * attribute.cs (Attributes): New class to encapsulate all attributes which were
19542 being passed around as an arraylist.
19543 (Attributes::AddAttribute): Method to add attribute sections.
19545 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
19546 (struct_declaration): Update accordingly.
19547 (constant_declaration): Update.
19548 (field_declaration): Update.
19549 (method_header): Update.
19550 (fixed_parameter): Update.
19551 (parameter_array): Ditto.
19552 (property_declaration): Ditto.
19553 (destructor_declaration): Ditto.
19555 * class.cs (Struct::Struct): Update constructors accordingly.
19556 (Class::Class): Ditto.
19557 (Field::Field): Ditto.
19558 (Method::Method): Ditto.
19559 (Property::Property): Ditto.
19560 (TypeContainer::OptAttribute): update property's return type.
19562 * interface.cs (Interface.opt_attributes): New member.
19563 (Interface::Interface): Update to take the extra Attributes argument.
19565 * parameter.cs (Parameter::Parameter): Ditto.
19567 * constant.cs (Constant::Constant): Ditto.
19569 * interface.cs (InterfaceMemberBase): New OptAttributes field.
19570 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
19571 the attributes as a parameter.
19572 (InterfaceProperty): Update constructor call.
19573 (InterfaceEvent): Ditto.
19574 (InterfaceMethod): Ditto.
19575 (InterfaceIndexer): Ditto.
19577 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
19578 pass the attributes too.
19579 (interface_event_declaration): Ditto.
19580 (interface_property_declaration): Ditto.
19581 (interface_method_declaration): Ditto.
19582 (interface_declaration): Ditto.
19584 2001-09-05 Miguel de Icaza <miguel@ximian.com>
19586 * class.cs (Method::Define): Track the "static Main" definition to
19587 create an entry point.
19589 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
19590 EntryPoint if we find it.
19592 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
19593 (EmitContext::ig): Make this variable public.
19595 * driver.cs: Make the default output file be the first file name
19596 with the .exe extension.
19598 Detect empty compilations
19600 Handle various kinds of output targets. Handle --target and
19601 rename -t to --dumper.
19603 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
19604 methods inherited from Expression return now an Expression. This
19605 will is used during the tree rewriting as we resolve them during
19608 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
19609 the spec. Missing entirely is the information about
19610 accessability of elements of it.
19612 (Expression::ExprClassFromMemberInfo): New constructor for
19613 Expressions that creates a fully initialized Expression based on
19614 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
19617 (Invocation::Resolve): Begin implementing resolution of invocations.
19619 * literal.cs (StringLiteral): Implement Emit.
19621 2001-09-05 Ravi Pratap <ravi@ximian.com>
19623 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19626 2001-09-04 Ravi Pratap <ravi@ximian.com>
19628 * cs-parser.jay (attribute_arguments): Implement actions.
19629 (attribute): Fix bug in production. Implement action.
19630 (attribute_list): Implement.
19631 (attribute_target): Implement.
19632 (attribute_target_specifier, opt_target_specifier): Implement
19633 (CheckAttributeTarget): New method to check if the attribute target
19635 (attribute_section): Implement.
19636 (opt_attributes): Implement.
19638 * attribute.cs : New file to handle attributes.
19639 (Attribute): Class to hold attribute info.
19641 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19642 (attribute_section): Modify production to use 2 different rules to
19643 achieve the same thing. 1 s/r conflict down !
19644 Clean out commented, useless, non-reducing dimension_separator rules.
19646 * class.cs (TypeContainer.attributes): New member to hold list
19647 of attributes for a type.
19648 (Struct::Struct): Modify to take one more argument, the attribute list.
19649 (Class::Class): Ditto.
19650 (Field::Field): Ditto.
19651 (Method::Method): Ditto.
19652 (Property::Property): Ditto.
19654 * cs-parser.jay (struct_declaration): Update constructor call to
19655 pass in the attributes too.
19656 (class_declaration): Ditto.
19657 (constant_declaration): Ditto.
19658 (field_declaration): Ditto.
19659 (method_header): Ditto.
19660 (fixed_parameter): Ditto.
19661 (parameter_array): Ditto.
19662 (property_declaration): Ditto.
19664 * constant.cs (Constant::Constant): Update constructor similarly.
19665 Use System.Collections.
19667 * parameter.cs (Parameter::Parameter): Update as above.
19669 2001-09-02 Ravi Pratap <ravi@ximian.com>
19671 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19672 (TypeContainer.delegates): New member to hold list of delegates.
19674 * cs-parser.jay (delegate_declaration): Implement the action correctly
19675 this time as I seem to be on crack ;-)
19677 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19679 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19680 tell whether an identifier represents a namespace.
19682 * expression.cs (NamespaceExpr): A namespace expression, used only
19683 temporarly during expression resolution.
19684 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19685 utility functions to resolve names on expressions.
19687 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19689 * codegen.cs: Add hook for StatementExpressions.
19691 * class.cs: Fix inverted test for static flag in methods.
19693 2001-09-02 Ravi Pratap <ravi@ximian.com>
19695 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19696 to make it coincide with MS' number.
19697 (Operator::CheckBinaryOperator): Ditto.
19699 * ../errors/errors.txt : Remove error numbers added earlier.
19701 * ../errors/cs1019.cs : Test case for error # 1019
19703 * ../errros/cs1020.cs : Test case for error # 1020
19705 * cs-parser.jay : Clean out commented cruft.
19706 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19707 used anywhere - non-reducing rule.
19708 (namespace_declarations): Non-reducing rule - comment out.
19710 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19711 with TypeContainer::AddEnum.
19713 * delegate.cs : New file for delegate handling classes.
19714 (Delegate): Class for declaring delegates.
19716 * makefile : Update.
19718 * cs-parser.jay (delegate_declaration): Implement.
19720 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19722 * class.cs (Event::Define): Implement.
19723 (Event.EventBuilder): New member.
19725 * class.cs (TypeContainer::Populate): Update to define all enums and events
19727 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19728 readonly fields for all these cases ?
19730 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19732 * class.cs (Property): Revamp to use the convention of making fields readonly.
19733 Accordingly modify code elsewhere.
19735 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19736 the Define method of the Property class.
19738 * class.cs : Clean up applied patch and update references to variables etc. Fix
19740 (TypeContainer::Populate): Update to define all the properties we have. Also
19741 define all enumerations.
19743 * enum.cs (Define): Implement.
19745 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19747 * cs-parser.jay (overloadable_operator): The semantic value is an
19748 enum of the Operator class.
19749 (operator_declarator): Implement actions.
19750 (operator_declaration): Implement.
19752 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19753 validity of definitions.
19754 (Operator::CheckBinaryOperator): Static method to check for binary operators
19755 (TypeContainer::AddOperator): New method to add an operator to a type.
19757 * cs-parser.jay (indexer_declaration): Added line to actually call the
19758 AddIndexer method so it gets added ;-)
19760 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19761 already taken care of by the MS compiler ?
19763 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19765 * class.cs (Operator): New class for operator declarations.
19766 (Operator::OpType): Enum for the various operators.
19768 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19770 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19771 ostensibly handle this in semantic analysis.
19773 * cs-parser.jay (general_catch_clause): Comment out
19774 (specific_catch_clauses, specific_catch_clause): Ditto.
19775 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19776 (catch_args, opt_catch_args): New productions.
19777 (catch_clause): Rewrite to use the new productions above
19778 (catch_clauses): Modify accordingly.
19779 (opt_catch_clauses): New production to use in try_statement
19780 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19781 and re-write the code in the actions to extract the specific and
19782 general catch clauses by being a little smart ;-)
19784 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19785 Hooray, try and catch statements parse fine !
19787 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19789 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19790 string from the hashtable of variables.
19792 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19793 I end up making that mistake ;-)
19794 (catch_clauses): Fixed gross error which made Key and Value of the
19795 DictionaryEntry the same : $1 !!
19797 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19799 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19801 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19802 when the add and remove accessors are specified.
19804 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19806 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19807 information about indexer_declarator.
19808 (indexer_declarator): Implement actions.
19809 (parsing_indexer): New local boolean used to keep track of whether
19810 we are parsing indexers or properties. This is necessary because
19811 implicit_parameters come into picture even for the get accessor in the
19812 case of an indexer.
19813 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19815 * class.cs (Indexer): New class for indexer declarations.
19816 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19817 (TypeContainer::indexers): New member to hold list of indexers for the
19820 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19822 * cs-parser.jay (add_accessor_declaration): Implement action.
19823 (remove_accessor_declaration): Implement action.
19824 (event_accessors_declaration): Implement
19825 (variable_declarators): swap statements for first rule - trivial.
19827 * class.cs (Event): New class to hold information about event
19829 (TypeContainer::AddEvent): New method to add an event to a type
19830 (TypeContainer::events): New member to hold list of events.
19832 * cs-parser.jay (event_declaration): Implement actions.
19834 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19836 * cs-parser.jay (dim_separators): Implement. Make it a string
19837 concatenating all the commas together, just as they appear.
19838 (opt_dim_separators): Modify accordingly
19839 (rank_specifiers): Update accordingly. Basically do the same
19840 thing - instead, collect the brackets here.
19841 (opt_rank_sepcifiers): Modify accordingly.
19842 (array_type): Modify to actually return the complete type string
19843 instead of ignoring the rank_specifiers.
19844 (expression_list): Implement to collect the expressions
19845 (variable_initializer): Implement. We make it a list of expressions
19846 essentially so that we can handle the array_initializer case neatly too.
19847 (variable_initializer_list): Implement.
19848 (array_initializer): Make it a list of variable_initializers
19849 (opt_array_initializer): Modify accordingly.
19851 * expression.cs (New::NType): Add enumeration to help us
19852 keep track of whether we have an object/delegate creation
19853 or an array creation.
19854 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19855 members to hold data about array creation.
19856 (New:New): Modify to update NewType
19857 (New:New): New Overloaded contructor for the array creation
19860 * cs-parser.jay (array_creation_expression): Implement to call
19861 the overloaded New constructor.
19863 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19865 * class.cs (TypeContainer::Constructors): Return member
19866 constructors instead of returning null.
19868 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19870 * typemanager.cs (InitCoreTypes): Initialize the various core
19871 types after we have populated the type manager with the user
19872 defined types (this distinction will be important later while
19873 compiling corlib.dll)
19875 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19876 on Expression Classification. Now all expressions have a method
19877 `Resolve' and a method `Emit'.
19879 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19880 generation from working. Also add some temporary debugging
19883 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19885 * codegen.cs: Lots of code generation pieces. This is only the
19886 beginning, will continue tomorrow with more touches of polish. We
19887 handle the fundamentals of if, while, do, for, return. Others are
19888 trickier and I need to start working on invocations soon.
19890 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19893 * codegen.cs (EmitContext): New struct, used during code
19894 emission to keep a context. Most of the code generation will be
19897 * cs-parser.jay: Add embedded blocks to the list of statements of
19898 this block. So code generation proceeds in a top down fashion.
19900 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19902 * statement.cs: Add support for multiple child blocks.
19904 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19906 * codegen.cs (EmitCode): New function, will emit the code for a
19907 Block of code given a TypeContainer and its ILGenerator.
19909 * statement.cs (Block): Standard public readonly optimization.
19910 (Block::Block constructors): Link children.
19911 (Block::Child): Child Linker.
19912 (Block::EmitVariables): Emits IL variable declarations.
19914 * class.cs: Drop support for MethodGroups here, delay until
19916 (Method::): Applied the same simplification that I did before, and
19917 move from Properties to public readonly fields.
19918 (Method::ParameterTypes): Returns the parameter types for the
19919 function, and implements a cache that will be useful later when I
19920 do error checking and the semantic analysis on the methods is
19922 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19923 and made a method, optional argument tells whether this is a class
19924 or a structure to apply the `has-this' bit.
19925 (Method::GetCallingConvention): Implement, returns the calling
19927 (Method::Define): Defines the type, a second pass is performed
19928 later to populate the methods.
19930 (Constructor::ParameterTypes): implement a cache similar to the
19931 one on Method::ParameterTypes, useful later when we do semantic
19934 (TypeContainer::EmitMethod): New method. Emits methods.
19936 * expression.cs: Removed MethodGroup class from here.
19938 * parameter.cs (Parameters::GetCallingConvention): new method.
19940 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19942 * class.cs (TypeContainer::Populate): Drop RootContext from the
19945 (Constructor::CallingConvention): Returns the calling convention.
19946 (Constructor::ParameterTypes): Returns the constructor parameter
19949 (TypeContainer::AddConstructor): Keep track of default constructor
19950 and the default static constructor.
19952 (Constructor::) Another class that starts using `public readonly'
19953 instead of properties.
19955 (Constructor::IsDefault): Whether this is a default constructor.
19957 (Field::) use readonly public fields instead of properties also.
19959 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19960 track of static constructors; If none is used, turn on
19961 BeforeFieldInit in the TypeAttributes.
19963 * cs-parser.jay (opt_argument_list): now the return can be null
19964 for the cases where there are no arguments.
19966 (constructor_declarator): If there is no implicit `base' or
19967 `this', then invoke the default parent constructor.
19969 * modifiers.cs (MethodAttr): New static function maps a set of
19970 modifiers flags into a MethodAttributes enum
19971 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19972 MethodAttr, TypeAttr to represent the various mappings where the
19973 modifiers are used.
19974 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19976 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19978 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19981 * interface.cs (PopulateIndexer): Implemented the code generator
19982 for interface indexers.
19984 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19986 * interface.cs (InterfaceMemberBase): Now we track the new status
19989 (PopulateProperty): Implement property population. Woohoo! Got
19990 Methods and Properties going today.
19992 Removed all the properties for interfaces, and replaced them with
19993 `public readonly' fields.
19995 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19997 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19998 initialize their hashtables/arraylists only when they are needed
19999 instead of doing this always.
20001 * parameter.cs: Handle refs and out parameters.
20003 * cs-parser.jay: Use an ArrayList to construct the arguments
20004 instead of the ParameterCollection, and then cast that to a
20007 * parameter.cs: Drop the use of ParameterCollection and use
20008 instead arrays of Parameters.
20010 (GetParameterInfo): Use the Type, not the Name when resolving
20013 2001-08-13 Miguel de Icaza <miguel@ximian.com>
20015 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
20016 and instead use public readonly fields.
20018 * class.cs: Put back walking code for type containers.
20020 2001-08-11 Miguel de Icaza <miguel@ximian.com>
20022 * class.cs (MakeConstant): Code to define constants.
20024 * rootcontext.cs (LookupType): New function. Used to locate types
20027 2001-08-08 Miguel de Icaza <miguel@ximian.com>
20029 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
20030 this System.Reflection code is. Kudos to Microsoft
20032 * typemanager.cs: Implement a type cache and avoid loading all
20033 types at boot time. Wrap in LookupType the internals. This made
20034 the compiler so much faster. Wow. I rule!
20036 * driver.cs: Make sure we always load mscorlib first (for
20037 debugging purposes, nothing really important).
20039 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
20040 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
20042 * rootcontext.cs: Lookup types on their namespace; Lookup types
20043 on namespaces that have been imported using the `using' keyword.
20045 * class.cs (TypeContainer::TypeAttr): Virtualize.
20046 (Class::TypeAttr): Return attributes suitable for this bad boy.
20047 (Struct::TypeAttr): ditto.
20048 Handle nested classes.
20049 (TypeContainer::) Remove all the type visiting code, it is now
20050 replaced with the rootcontext.cs code
20052 * rootcontext.cs (GetClassBases): Added support for structs.
20054 2001-08-06 Miguel de Icaza <miguel@ximian.com>
20056 * interface.cs, statement.cs, class.cs, parameter.cs,
20057 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
20058 Drop use of TypeRefs, and use strings instead.
20060 2001-08-04 Miguel de Icaza <miguel@ximian.com>
20064 * class.cs (Struct::Struct): set the SEALED flags after
20065 checking the modifiers.
20066 (TypeContainer::TypeAttr): new property, returns the
20067 TypeAttributes for a class.
20069 * cs-parser.jay (type_list): Oops, list production was creating a
20070 new list of base types.
20072 * rootcontext.cs (StdLib): New property.
20073 (GetInterfaceTypeByName): returns an interface by type name, and
20074 encapsulates error handling here.
20075 (GetInterfaces): simplified.
20076 (ResolveTree): Encapsulated all the tree resolution here.
20077 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
20080 * driver.cs: Add support for --nostdlib, to avoid loading the
20081 default assemblies.
20082 (Main): Do not put tree resolution here.
20084 * rootcontext.cs: Beginning of the class resolution.
20086 2001-08-03 Miguel de Icaza <miguel@ximian.com>
20088 * rootcontext.cs: Provide better error reporting.
20090 * cs-parser.jay (interface_base): set our $$ to be interfaces.
20092 * rootcontext.cs (CreateInterface): Handle the case where there
20093 are no parent interfaces.
20095 (CloseTypes): Routine to flush types at the end.
20096 (CreateInterface): Track types.
20097 (GetInterfaces): Returns an array of Types from the list of
20098 defined interfaces.
20100 * typemanager.c (AddUserType): Mechanism to track user types (puts
20101 the type on the global type hash, and allows us to close it at the
20104 2001-08-02 Miguel de Icaza <miguel@ximian.com>
20106 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
20107 RecordInterface instead.
20109 * cs-parser.jay: Updated to reflect changes above.
20111 * decl.cs (Definition): Keep track of the TypeBuilder type that
20112 represents this type here. Not sure we will use it in the long
20113 run, but wont hurt for now.
20115 * driver.cs: Smaller changes to accomodate the new code.
20117 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
20120 * rootcontext.cs (CreateInterface): New method, used to create
20121 the System.TypeBuilder type for interfaces.
20122 (ResolveInterfaces): new entry point to resolve the interface
20124 (CodeGen): Property, used to keep track of the code generator.
20126 2001-07-26 Miguel de Icaza <miguel@ximian.com>
20128 * cs-parser.jay: Add a second production for delegate_declaration
20131 (enum_body): Put an opt_comma here instead of putting it on
20132 enum_body or enum_member_declarations so we can handle trailing
20133 commas on enumeration members. Gets rid of a shift/reduce.
20135 (type_list): Need a COMMA in the middle.
20137 (indexer_declaration): Tell tokenizer to recognize get/set
20139 * Remove old targets.
20141 * Re-add the parser target.
20143 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20145 * cs-parser.jay: Add precendence rules for a number of operators
20146 ot reduce the number of shift/reduce conflicts in the grammar.
20148 2001-07-17 Miguel de Icaza <miguel@ximian.com>
20150 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
20153 Get rid of old crufty code.
20155 * rootcontext.cs: Use this to keep track of the parsed
20156 representation and the defined types available to the program.
20158 * gen-treedump.cs: adjust for new convention.
20160 * type.cs: Split out the type manager, and the assembly builder
20163 * typemanager.cs: the type manager will live here now.
20165 * cil-codegen.cs: And the code generator here.
20167 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
20169 * makefile: Fixed up for easy making.
20171 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20173 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
20176 (unary_expression): Expand pre_increment_expression and
20177 post_decrement_expression to reduce a shift/reduce.
20179 2001-07-11 Simon Cozens
20181 * cs-tokenizer.cs: Hex numbers should begin with a 0.
20183 Improve allow_keyword_as_indent name.
20185 2001-06-19 Miguel de Icaza <miguel@ximian.com>
20187 * Adjustments for Beta2.
20189 2001-06-13 Miguel de Icaza <miguel@ximian.com>
20191 * decl.cs: Added `Define' abstract method.
20192 (InTransit): new property, used to catch recursive definitions.
20194 * interface.cs: Implement `Define'.
20196 * modifiers.cs: Map Modifiers.constants to
20197 System.Reflection.TypeAttribute flags.
20199 * class.cs: Keep track of types and user-defined types.
20200 (BuilderInit): New method for creating an assembly
20201 (ResolveType): New function to launch the resolution process, only
20202 used by interfaces for now.
20204 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
20205 that are inserted into the name space.
20207 2001-06-08 Miguel de Icaza <miguel@ximian.com>
20209 * ARGH. I have screwed up my tree so many times due to the use of
20210 rsync rather than using CVS. Going to fix this at once.
20212 * driver.cs: Objetify driver. Load assemblies, use assemblies to
20215 2001-06-07 Miguel de Icaza <miguel@ximian.com>
20217 * Experiment successful: Use System.Type rather that our own
20220 2001-05-25 Miguel de Icaza <miguel@ximian.com>
20222 * cs-parser.jay: Removed nsAliases from here.
20224 Use new namespaces, handle `using XXX;'
20226 * namespace.cs: Reimplemented namespace handling, use a recursive
20227 definition of the class. Now we can keep track of using clauses
20228 and catch invalid using clauses.
20230 2001-05-24 Miguel de Icaza <miguel@ximian.com>
20232 * gen-treedump.cs: Adapted for all the renaming.
20234 * expression.cs (Expression): this class now has a Type property
20235 which returns an expression Type.
20237 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
20238 `Type', as this has a different meaning now in the base
20240 2001-05-22 Miguel de Icaza <miguel@ximian.com>
20242 * interface.cs, class.cs: Removed from all the sources the
20243 references to signature computation, as we can not do method
20244 signature computation during the parsing time, as we are not
20245 trying to solve at that point distinguishing:
20249 void a (NS.Blah x) {}
20252 Which depending on the context might be valid or not, as we do not
20253 know if Blah is the same thing as NS.Blah at that point.
20255 * Redid everything so the code uses TypeRefs now instead of
20256 Types. TypeRefs are just temporary type placeholders, that need
20257 to be resolved. They initially have a pointer to a string and the
20258 current scope in which they are used. This is used later by the
20259 compiler to resolve the reference to an actual Type.
20261 * DeclSpace is no longer a CIR.Type, and neither are
20262 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
20263 are all DeclSpaces, but no Types.
20265 * type.cs (TypeRefManager): This implements the TypeRef manager,
20266 which keeps track of all the types that need to be resolved after
20267 the parsing has finished.
20269 2001-05-13 Miguel de Icaza <miguel@ximian.com>
20271 * ARGH. We are going to have to store `foreach' as a class rather
20272 than resolving it, as we need to verify error 1579 after name
20273 resolution. *OR* we could keep a flag that says `This request to
20274 IEnumerator comes from a foreach statement' which we can then use
20275 to generate the error.
20277 2001-05-10 Miguel de Icaza <miguel@ximian.com>
20279 * class.cs (TypeContainer.AddMethod): we now add methods to the
20280 MethodGroup instead of the method hashtable.
20282 * expression.cs: Add MethodGroup abstraction, which gets us one
20283 step closer to the specification in the way we handle method
20286 * cs-parser.jay (primary_expression): qualified_identifier now
20287 tried to match up an identifier to a local variable reference or
20288 to a parameter reference.
20290 current_local_parameters is now a parser global variable that
20291 points to the current parameters for the block, used during name
20294 (property_declaration): Now creates an implicit `value' argument to
20297 2001-05-09 Miguel de Icaza <miguel@ximian.com>
20299 * parameter.cs: Do not use `param' arguments as part of the
20300 signature, per the spec.
20302 2001-05-08 Miguel de Icaza <miguel@ximian.com>
20304 * decl.cs: Base class for classes, structs and interfaces. This
20305 is the "Declaration Space"
20307 * cs-parser.jay: Use CheckDef for checking declaration errors
20308 instead of having one on each function.
20310 * class.cs: Factor out some code for handling error handling in
20311 accordance to the "Declarations" section in the "Basic Concepts"
20312 chapter in the ECMA C# spec.
20314 * interface.cs: Make all interface member classes derive from
20315 InterfaceMemberBase.
20317 2001-05-07 Miguel de Icaza <miguel@ximian.com>
20319 * Many things: all interfaces are parsed and generated in
20320 gen-treedump. Support for member variables, constructors,
20321 destructors, properties, constants is there.
20323 Beginning of the IL backend, but very little done, just there for
20326 2001-04-29 Miguel de Icaza <miguel@ximian.com>
20328 * cs-parser.jay: Fix labeled statement.
20330 * cs-tokenizer.cs (escape): Escape " and ' always.
20331 ref_line, ref_name: keep track of the line/filename as instructed
20332 by #line by the compiler.
20335 2001-04-27 Miguel de Icaza <miguel@ximian.com>
20337 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
20338 to match the values in System.CodeDOM.
20340 Divid renamed to Divide.
20342 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
20344 (Statements.set): remove.
20346 * System.CodeDOM/CodeCatchClause.cs: always have a valid
20349 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
20350 falseStatements always have valid values.
20352 * cs-parser.jay: Use System.CodeDOM now.