1 2005-03-02 Martin Baulig <martin@ximian.com>
3 * class.cs (TypeContainer.DoDefineMembers): We also need a default
4 static constructor in static classes.
6 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
8 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
9 sizeParamIndex is not specified.
11 2005-03-01 Marek Safar <marek.safar@seznam.cz>
14 * report.cs (WarningMessage.IsEnabled): Missing null check.
16 2005-02-28 Marek Safar <marek.safar@seznam.cz>
18 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
19 in the fields and not in the properties.
21 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
23 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
26 2005-02-28 Marek Safar <marek.safar@seznam.cz>
28 * attribute.cs: Small refactoring (improved robustness).
29 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
30 (ValidateGuid): Removed.
31 (Resolve): Removed referenced to above mentioned.
32 (GetAttributeUsage): Made private and changed to work without
34 (GetIndexerAttributeValue): Don't crash.
35 (GetConditionalAttributeValue): Ditto.
36 (GetClsCompliantAttributeValue): Ditto.
37 (ExtractSecurityPermissionSet): All attributes exceptions are
39 (GetPropertyValue): New helper.
40 (GetMethodImplOptions): New method.
41 (DefinePInvokeMethod): Reuse common code. Implemented handling of
42 some missing properties.
44 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
45 (Method.ApplyAttributeBuilder): Updated.
47 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
50 2005-02-28 Raja R Harinath <rharinath@novell.com>
53 * report.cs (Report.SymbolRelatedToPreviousError): Handle
54 non-simple types (array, pointer, reference).
56 2005-02-28 Marek Safar <marek.safar@seznam.cz>
58 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
60 * class.cs (MethodCore.IsDuplicateImplementation): Special error
62 (Method.CheckBase): Catch wrong destructor here.
63 (MethodData.Define): Add errors 550, 668.
65 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
67 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
69 * pending.cs (VerifyPendingMethods): Add error 551.
71 * typemanager.cs (CSharpName): Next error report helper.
73 2005-02-25 Marek Safar <marek.safar@seznam.cz>
75 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
76 attributes. Removed useless attribute double check.
77 It saves almost 2MBs for corlib.
79 2005-02-25 Raja R Harinath <rharinath@novell.com>
82 * statement.cs (ExpressionStatement.Resolve): Make robust to being
83 called twice in case of error.
85 2005-02-23 Chris Toshok <toshok@ximian.com>
87 Fix compiler portions of #72827.
88 * statement.cs (Block.Emit): call Begin/EndScope on the
89 EmitContext instead of the ILGenerator.
91 * codegen.cs (EmitContext.BeginScope): new method, call
92 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
94 (EmitContext.BeginScope): same, but EndScope and CloseScope
96 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
97 offset and call the superclass's OpenScope(int) with it.
98 (SymbolWriter.CloseScope): get the current il
99 offset and call superclass's CloseScope(int) with it.
101 2005-02-23 Marek Safar <marek.safar@seznam.cz>
103 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
104 CS1677 for out and ref as well.
106 * class.cs (Method.Define): Add error CS1599 detection.
108 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
110 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
112 * delegate.cs (Delegate.Define): Add error CS1599 detection.
114 * support.cs.cs (ModifierDesc): New helper method.
116 2005-02-23 Raja R Harinath <rharinath@novell.com>
117 Abin Thomas <projectmonokochi@rediffmail.com>
118 Anoob V E <projectmonokochi@rediffmail.com>
119 Harilal P R <projectmonokochi@rediffmail.com>
122 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
123 MemberLookup (used for error reporting) actually returns a result.
124 Fix error report number (122, not 112).
126 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
127 Anoob V E <projectmonokochi@rediffmail.com>
128 Harilal P R <projectmonokochi@rediffmail.com>
131 * pending.cs (PendingImplementation.GetAbstractMethods):
132 Find NonPublic members too.
134 2005-02-22 Marek Safar <marek.safar@seznam.cz>
136 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
139 * class.cs (MethodCore.CheckMethodAgainstBase):
140 Add error 239 report.
142 2005-02-21 Marek Safar <marek.safar@seznam.cz>
144 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
146 * class.cs (Operator.Define): Add error 217 report.
148 2005-02-21 Raja R Harinath <rharinath@novell.com>
151 * expression.cs (Invocation.IsApplicable): Make public.
152 (Invocation.IsParamsMethodApplicable): Likewise.
153 * delegate.cs (Delegate.VerifyApplicability): Don't use
154 Invocation.VerifyArgumentCompat for parameter applicability
155 testing. Use Invocation.IsApplicable and
156 Invocation.IsParamsMethodApplicable.
158 2005-02-21 Marek Safar <marek.safar@seznam.cz>
160 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
162 * class.cs (Operator.Define): Add error 217 report.
164 2005-02-21 Raja R Harinath <rharinath@novell.com>
166 * namespace.cs (UsingEntry.Resolve): Undo change below.
168 2005-02-21 Raja R Harinath <rharinath@novell.com>
171 * ecore.cs (Expression.MemberLookupFailed): Add argument to
172 disable the error message when the extended MemberLookup also
174 (Expression.MemberLookupFinal): Update.
175 (SimpleName.DoSimpleNameResolve): Update.
176 * expression.cs (MemberAccess.ResolveNamespaceOrType):
177 Don't use MemberLookupFinal.
178 (New.DoResolve): Update.
179 (BaseAccess.CommonResolve): Update.
181 2005-02-21 Raja R Harinath <rharinath@novell.com>
184 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
185 occured previously, don't resolve again.
187 2005-02-21 Marek Safar <marek.safar@seznam.cz>
190 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
191 argument. Call ResolveAttributeUsage for unresolved.
192 when types doesn't match ctor arguments.
194 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
195 for nested attribute classes.
196 (Class.attribute_usage): Removed.
197 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
200 * ecore.cs (IsAttribute): Removed.
202 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
204 * rootcontext.cs (RegisterAttribute): Removed, attributes are
206 (attribute_types): Removed.
207 (EmitCode): Global attributes are emited as the latest.
209 2005-02-18 Marek Safar <marek.safar@seznam.cz>
211 * class.cs (EmitFieldInitializers): Don't emit field initializer
212 for default values when optimilization is on.
214 * constant.cs (Constant.IsDefaultValue): New property.
216 * driver.cs: Add /optimize handling.
220 * literal.cs: Implement new IsDefaultValue property.
222 * rootcontext.cs (Optimize): New field, holds /optimize option.
224 2005-02-18 Raja R Harinath <rharinath@novell.com>
226 Fix crasher in re-opened #72347.
227 * namespace.cs (Namespace.Lookup): Return null if
228 DeclSpace.DefineType returns null.
231 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
233 2005-02-18 Raja R Harinath <rharinath@novell.com>
235 Fix remainder of #63202. Change semantics of DoResolveLValue: it
236 now returns null if it cannot resolve to an lvalue.
237 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
238 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
239 returned null. Remove check for SimpleName.
240 (EventExpr.DoResolveLValue): New.
241 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
242 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
244 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
246 (Unary.ResolveOperator): Move CS0211 check ...
247 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
249 (Unary.DoResolveLValue): Simplify.
250 (AddressOf.DoResolveLValue): New.
251 (ArrayAccess.DoResolveLValue): New.
253 2005-02-16 Marek Safar <marek.safar@seznam.cz>
255 * attribute.cs (Attribute.Resolve): Add arguments casting for
256 when types doesn't match ctor arguments.
258 2005-02-16 Raja R Harinath <rharinath@novell.com>
261 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
262 lookup of operator in base type. Ensure that all checks happen
263 when the operator resolves to an "op_..." method.
265 2005-02-15 Raja R Harinath <rharinath@novell.com>
268 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
269 'ignore_cs0104' parameter. Pass it to ...
270 (NamespaceEntry.Lookup): ... this.
271 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
272 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
273 (TypeLookupExpression.DoResolveAsTypeStep): Update.
274 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
275 Update. Request that cs0104 errors be ignored.
276 (ComposedCast.ResolveAsTypeStep): Update.
278 2005-02-14 Raja R Harinath <rharinath@novell.com>
281 * expression.cs (Invocation.BetterFunction): Remove support for
282 comparing virtual functions and their overrides.
283 (Invocation.IsOverride): New.
284 (Invocation.OverloadResolve): Don't consider 'override' functions
285 during candidate selection. Store them in a lookaside list.
286 If the selected method is a 'virtual' function, use the list to
287 find any overrides that are closer to the LHS type.
289 2005-02-14 Marek Safar <marek.safar@seznam.cz>
291 * expression.cs (New.DoResolve): Add complex core type reduction.
292 (New.Constantify): Converts complex core type syntax like 'new int ()'
295 2005-02-14 Raja R Harinath <rharinath@novell.com>
297 * decl.cs (EntryType.EntryType): New constructor to create an
298 updated copy of a cache entry.
299 (MemberCache.AddMethods): Use it.
300 (MemberCache.ClearDeclaredOnly): Remove.
301 (MemberCache.MemberCache): Update.
303 2005-02-11 Miguel de Icaza <miguel@novell.com>
305 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
306 variable. This one is represents the actual low-level declaration
307 of the method, as opposed to the semantic level `IsStatic'.
309 An anonymous method which is hosted into a static method might be
310 actually an instance method. IsStatic would reflect the
311 container, while MethodIsStatic represents the actual code
314 * expression.cs (ParameterReference): Use the new MethodIsStatic
317 * anonymous.cs (AnonymousMethod.Compatible): Pass the
318 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
319 set on the current EmitContext.
321 * expression.cs (Cast): Overload DoResolveLValue so we can pass
322 resolve our casted expression as an LValue. This triggers the
323 proper LValue processing that is later required by Assign.
327 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
329 2005-02-11 Marek Safar <marek.safar@seznam.cz>
331 C# 2.0 Fixed buffer implementation
333 * anonymous.cs: Update after RegisterHelperClass renaming.
335 * attribute.cs (AttributeTester.fixed_buffer_cache):
336 Cache of external fixed buffers.
337 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
338 implementation if field is fixed buffer else null.
341 (TypeContainer.AddField): Accept FieldMember instead of Field.
342 (FieldBase.IsFieldClsCompliant): Extracted code from
343 VerifyClsCompliance descendant customization.
344 (FixedField): New class handles fixed buffer fields.
345 (FixedFieldExternal): Keeps information about imported fixed
347 (IFixedField): Make access to internal or external fixed buffer
350 * cs-parser.jay: Add fixed buffer parsing.
352 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
355 * expression.cs (Indirection): Extended implementation to accept
357 (PointerArithmetic.Emit): Get element from fixed buffer as well.
358 (ElementAccess.MakePointerAccess): Get type as parameter.
359 (DoResolve): Add fixed buffer field expression conversion.
360 (DoResolveLValue): Ditto.
361 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
362 (ArrayPtr): Derives from FixedBufferPtr.
363 (ArrayPtr.Emit): Add extra emit for array elements.
365 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
367 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
368 for compiler generated types.
369 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
371 * statement.cs (Fixed): Refactored to be easier add fixed buffer
372 and consume less memory.
373 (Fixed.Resolve): Add fixed buffer case.
375 * typemanager.cs (compiler_generated_attr_ctor,
376 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
377 (HasElementType): Add our own implementation to work on every
380 2005-02-11 Miguel de Icaza <miguel@novell.com>
382 * anonymous.cs (CaptureContext): Track whether `this' has been
385 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
386 only captured `this' if it was implicitly done (instance
387 methods/variables were used).
389 * codegen.cs (EmitContext.CaptureThis): New method to flag that
390 `this' must be captured.
392 2005-01-30 Miguel de Icaza <miguel@novell.com>
394 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
395 is null it means that there has been no need to capture anything,
396 so we just create a sibling.
398 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
400 Just a partial fix. The other half is fairly elusive.
402 2005-02-10 Raja R Harinath <rharinath@novell.com>
404 Fix #52586, cs0121-4.cs.
405 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
406 and return a hashtable.
407 (MemberCache.ClearDeclaredOnly): New.
408 (MemberCache.MemberCache): Update to change. Make a deep copy of
409 the method_hash of a base type too.
410 (MemberCache.AddMethods): Adapt to having a deep copy of the base
411 type methods. Overwrite entries with the same MethodHandle so
412 that the ReflectedType is correct. The process leaves in base
413 virtual functions and their overrides as distinct entries.
414 (CacheEntry): Now a class instead of a struct. It shouldn't alter
415 matters since it was boxed in a ArrayList before.
416 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
418 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
419 case of a virtual function and its override (choose the overload
421 (Invocation.OverloadResolve): Avoid 'override' members during
422 'applicable_type' calculation.
424 2005-03-28 Raja R Harinath <rharinath@novell.com>
426 * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer.
427 (TypeHandle.TypeHandle): Use LookupMemberCache rather than
428 GetTypeHandle. It is possible for a reflected type to derive from
429 a TypeBuilder (e.g., int[] derives from the TypeBuilder
430 System.Array during mscorlib compilation).
431 * decl.cs (MemberCache.MemberCache): If the base cache doesn't
432 contain a method_hash, don't create one either. Don't create a
433 deep copy of the base cache's method_hash.
434 (MemberCache.SetupCache): Rename back from DeepCopy.
435 (MemberCache.AddMethods): Rewrite, now that method_hash isn't
436 already initialized. If we see an override function, add its
437 underlying base virtual function to the member_hash too.
439 2005-02-09 Raja R Harinath <rharinath@novell.com>
441 Combine two near-redundant caches.
442 * typemanager.cs (method_params): Rename from method_internal_params.
443 (TypeManager.GetParameterData): New. Replace
444 Invocation.GetParameterData.
445 (TypeManager.LookupParametersByBuilder): Remove.
446 * expression.cs (Invocation.method_parameter_cache): Remove.
447 (Invocation.GetParameterData): Remove.
449 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
452 2005-02-08 Raja R Harinath <rharinath@novell.com>
455 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
456 TypeManager.multicast_delegate_type is null, resolve it by looking
457 up "System.MulticastDelegate".
458 * rootcontext.cs (RootContext.ResolveCore): Simplify.
460 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
461 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
462 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
465 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
466 (LabeledStatement.AddReference): New. Set 'referenced'.
467 (Goto.Resolve): Use it.
469 2005-02-05 John Luke <john.luke@gmail.com>
471 * driver.cs: remove duplicate -doc line in Usage ()
473 2005-02-04 Raja R Harinath <rharinath@novell.com>
475 * location.cs (Location.AddFile): Fix CS2002 error report.
477 2005-02-02 Martin Baulig <martin@ximian.com>
479 * delegate.cs (Delegate.DefineType): Report an internal error if
480 TypeManager.multicast_delegate_type is null. See bug #72015 for
483 2005-02-02 Raja R Harinath <rharinath@novell.com>
485 Fix a crasher in a variant of #31984.
486 * const.cs (Constant.CheckBase): New override that defers the
487 new-or-override check in case the base type hasn't been populated
489 (Constant.Define): Ensure the new-or-override check is performed.
491 2005-02-01 Duncan Mak <duncan@ximian.com>
493 * const.cs (LookupConstantValue): Check that `ce' is not null
494 before calling GetValue ().
496 2005-02-01 Raja R Harinath <rharinath@novell.com>
498 Fix test-334.cs (#69519).
499 * cs-parser.jay (using_alias_directive): Pass in an expression to
500 NamespaceEntry.UsingAlias.
501 (using_namespace_directive): Pass in an expression to
502 NamespaceEntry.Using.
503 (namespace_name): Don't flatten to a string.
504 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
505 (NamespaceEntry.AliasEntry.Resolve): Lookup using
507 (NamespaceEntry.UsingEntry): Likewise.
508 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
510 (NamespaceEntry.LookupForUsing): Remove.
511 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
513 (NamespaceEntry.Lookup): Remove support for dotted names.
515 2005-02-01 Raja R Harinath <rharinath@novell.com>
517 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
519 (NamespaceEntry.ImplicitParent): Compute on demand.
520 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
521 parallels the current.
522 (NamespaceEntry.LookupForUsing): Use it.
523 (NamespaceEntry.Lookup): If the current namespace-entry is
524 implicit, don't search aliases and using tables.
526 2005-02-01 Raja R Harinath <rharinath@novell.com>
529 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
531 (TypeContainer.BaseCache): Compute on demand.
532 (TypeContainer.FindMembers): Define constants and types if they're
534 (FieldMember.Define): Move resetting of ec.InUnsafe before error
536 * const.cs (Constant.Define): Make idempotent.
538 2005-01-29 Miguel de Icaza <miguel@novell.com>
540 * pending.cs: Produce better code (no nops produced by using Ldarg
543 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
544 i - 1' it should be arg + 1.
548 2005-01-28 Raja R Harinath <rharinath@novell.com>
550 * attribute.cs (Attribute.CheckAttributeType): Make private
552 (Attribute.ResolveType): Make virtual.
553 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
554 handling of RootContext.Tree.Types.
556 2005-01-27 Raja R Harinath <rharinath@novell.com>
558 Update attribute-handling to use the SimpleName/MemberAccess
560 * cs-parser.jay (attribute): Pass in an expression to the
561 constructors of Attribute and GlobalAttribute.
562 * attribute.cs (Attribute): Take an expression for the name.
563 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
564 passed in attribute name expression.
565 (Attribute.CheckAttributeType): Use it.
566 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
567 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
568 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
569 argument to prevent error messages if the lookup fails.
571 2005-01-27 Marek Safar <marek.safar@seznam.cz>
573 * expression.cs (Indirection): Implemented IVariable interface
574 to support indirection in AddressOf operator.
575 (PointerArithmetic.Emit): Add optimalization for case where
576 result can be precomputed.
578 2005-01-26 Martin Baulig <martin@ximian.com>
580 * class.cs (TypeContainer.AttributeTargets): Return the correct
581 AttributeTargets depending on our `Kind' instead of throwing an
582 exception; fixes #71632.
584 2005-01-26 Marek Safar <marek.safar@seznam.cz>
587 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
590 2005-03-17 Martin Baulig <martin@ximian.com>
592 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
593 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
595 2005-03-17 Martin Baulig <martin@ximian.com>
597 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
598 to bool so we can return an error condition.
599 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
602 2005-03-17 Martin Baulig <martin@ximian.com>
604 * generic.cs (TypeMananager.IsIEnumerable): New public method.
606 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
607 converting from an array-type of T to `IEnumerable<T>'.
609 2005-03-16 Martin Baulig <martin@ximian.com>
611 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
612 (Nullable.LiftedUnaryMutator): New public class.
614 * expression.cs (UnaryMutator.DoResolve): Added support for
617 2005-03-14 Martin Baulig <martin@ximian.com>
619 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
621 2005-03-14 Martin Baulig <martin@ximian.com>
623 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
624 the comparision operators `<', `>', `<=' and `>='.
626 2005-03-13 Martin Baulig <martin@ximian.com>
629 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
630 avoid confusion with the `NullLiteral'.
631 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
633 2005-03-13 Martin Baulig <martin@ximian.com>
635 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
636 comparing arbitrary types with the null literal.
638 2005-03-13 Martin Baulig <martin@ximian.com>
640 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
641 boolean operators '&&', '||', '&' and '|'.
642 (Nullable.OperatorTrueOrFalse): New public class.
644 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
645 instead of a `StaticCallExpr'; added support for nullables.
647 2005-03-10 Martin Baulig <martin@ximian.com>
650 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
651 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
653 2005-03-07 Martin Baulig <martin@ximian.com>
655 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
656 it work if `expr' is not an IMemoryLocation.
657 (Nullable.Lifted): Implement IMemoryLocation.
658 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
661 2005-03-05 Martin Baulig <martin@ximian.com>
663 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
664 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
665 (Nullable): Added support for lifted unary and binary operators.
667 * expression.cs (Unary.DoResolve): Added support for nullable types.
668 (Binary.DoResolve): Likewise.
669 (Conditional.DoResolve): Likewise.
671 2005-03-02 Martin Baulig <martin@ximian.com>
673 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
675 * class.cs (ClassPart.SetParameterInfo): Override this.
676 (PartialContainer.SetParameterInfo): Override this.
677 (TypeContainer.CheckConstraints): New protected method.
678 (PartialContainer.CheckConstraints): Override this and check
679 whether the same contraints were specified in all parts of a
680 partial generic type definition.
681 (PartialContainer.UpdateConstraints): New public method.
683 * generic.cs (TypeParameter.UpdateConstraints): New public method.
685 2005-03-02 Martin Baulig <martin@ximian.com>
687 Committing a patch from Carlos Alberto Cortez to fix #72887.
689 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
690 casts from `T []' to `int []'.
692 2005-03-02 Martin Baulig <martin@ximian.com>
694 * generic.cs (TypeManager.IsEqual): Make this symmetric.
696 * expression.cs (Binary.ResolveOperator): When resolving a
697 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
698 `=='. Fixes #71866. See gen-127.cs.
700 2005-03-02 Martin Baulig <martin@ximian.com>
702 * class.cs (TypeContainer.DoDefineMembers): We also need a default
703 static constructor in static classes.
705 2005-03-02 Martin Baulig <martin@ximian.com>
708 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
709 (Nullable.LiftedConversion): Added support for user-defined
712 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
714 * cs-parser.jay: Use ComposedCast everywhere instead of
715 NullableType, so we don't need to check for NullableType
717 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
718 case where we'll be resolved into a `parenthesized_expression_0'
722 (Convert.UserDefinedConversion): Added nullable conversions.
724 2005-02-28 Martin Baulig <martin@ximian.com>
726 * generic.cs (TypeManager.IsNullableType): New static method.
727 (Nullable): New abstract class.
728 (Nullable.NullLiteral): New public class.
729 (Nullable.LiftedConversion): New public class.
731 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
732 `builtin_types opt_nullable'.
735 (Convert.ImplicitConversionStandard): Added nullable conversions.
736 (Convert.ExplicitConversionStandard): Likewise.
737 (Convert.ExplicitConversion): Likewise.
739 2005-02-26 Martin Baulig <martin@ximian.com>
741 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
742 begin with a "?", for instance "?[]". Don't do a type lookup if
745 2005-02-25 Martin Baulig <martin@ximian.com>
747 The first part of Nullable Types :-)
749 * generic.cs (NullableType): New public class.
750 (NullCoalescingOperator): New public class.
751 (TypeArguments.Resolve): Add a CS0306 check.
753 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
754 (opt_nullable): New rule.
755 (type): Added `opt_nullable' to `namespace_or_type_name',
756 `builtin_types' and `pointer_type'.
757 (array_type): Added `opt_nullable'.
758 (opt_rank_specifier_or_nullable): New rule; this is the
759 combination of `opt_rank_specifier' and `opt_nullable'.
760 (opt_error): New rule; catch errors here.
761 (nullable_type_or_conditional): New rule; we use this to check for
762 nullable and still detect the conditional operator.
763 (local_variable_type): Use `opt_rank_specifier_or_nullable'
764 instead `opt_rank_specifier'.
766 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
769 2005-02-24 Martin Baulig <martin@ximian.com>
771 * README, README.Changes: Removed; they're old and obsolete.
773 2005-02-22 Martin Baulig <martin@ximian.com>
775 * generic.cs (TypeParameter.Resolve): If resolving the constraints
776 returned an error, set `constraints' to null to avoid a crash
778 (TypeParameter.ResolveType): Likewise.
780 2005-02-22 Martin Baulig <martin@ximian.com>
783 (Constraints.ResolveTypes): Protect against being called twice.
784 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
785 (TypeParameter.ResolveType): New public method; calls
786 constraints.ResolveTypes().
787 (TypeParameter.DefineType): Moved constraints.ResolveType() out
788 into the new ResolveType().
789 (GenericMethod.Define): Call ResolveType() on all our
792 2005-02-21 Martin Baulig <martin@ximian.com>
795 (TypeManager.generic_nullable_type): New static public field.
796 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
799 (RootContext.ResolveCore): Resolve "System.Nullable`1".
801 2005-02-15 Martin Baulig <martin@ximian.com>
803 * generic.cs (ConstructedType.Constraints): Correctly check
804 constraints if the argument type is a type parameter; fixes
807 2005-02-02 Martin Baulig <martin@ximian.com>
809 * delegate.cs (Delegate.DefineType): Report an internal error if
810 TypeManager.multicast_delegate_type is null. See bug #72015 for
813 2005-01-29 Miguel de Icaza <miguel@novell.com>
815 * pending.cs: Produce better code (no nops produced by using Ldarg
818 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
819 i - 1' it should be arg + 1.
823 2005-01-26 Martin Baulig <martin@ximian.com>
825 * cs-parser.jay (indexer_declarator): Don't report an error if we
826 have type parameters since we can be an explicit interface
827 implementation; fixes #71449.
829 2005-01-26 Martin Baulig <martin@ximian.com>
831 * class.cs (TypeContainer.AttributeTargets): Return the correct
832 AttributeTargets depending on our `Kind' instead of throwing an
833 exception; fixes #71632.
835 2005-01-26 Martin Baulig <martin@ximian.com>
837 * delegate.cs (Delegate.DefineType): Correctly define our type
838 parameters. Fixes #71483.
840 2005-01-25 Raja R Harinath <rharinath@novell.com>
843 * expression.cs (MemberAccess.DoResolve): Don't complain with
844 cs0572 when the LHS of a member access has identical name and type
847 2005-01-25 Marek Safar <marek.safar@seznam.cz>
850 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
852 Create custom PermissionSet only for PermissionSetAttribute.
854 2005-01-24 Marek Safar <marek.safar@seznam.cz>
857 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
858 delegates in static class.
860 2005-01-24 Martin Baulig <martin@ximian.com>
862 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
863 merging an implicit block, just use its reachability.
865 * statement.cs (Block.Resolve): Make the unreachable code check
866 work wrt. implicit blocks; see test-337 from #63842.
868 2005-01-21 Alp Toker <alp@atoker.com>
870 * cs-parser.jay: destructor_declaration's container is PartialContainer
871 not Class when partial types are used, so use Kind prop instead of
874 2005-01-22 Miguel de Icaza <miguel@ximian.com>
876 * cs-parser.jay: Improve error reporting when an interface
879 2005-01-20 Dick Porter <dick@ximian.com>
881 * support.cs: SeekableStreamReader fix from Sandor Dobos
882 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
883 chars are read. Fixes bug 70369.
885 2005-01-20 Raja R Harinath <rharinath@novell.com>
887 * cs-parser.jay (catch_clause): Simplify current_block handling
890 2005-01-17 Miguel de Icaza <miguel@ximian.com>
892 * convert.cs (ImplicitStandardConversionExists): Synchronize the
893 code with ImplicitStandardConversion to handle the implicit
894 conversion of method groups into valid delegate invocations.
896 The problem is that in parameter handling we were using this code
897 path. Fixes bug #64698
899 2005-01-19 Raja R Harinath <rharinath@novell.com>
901 * cs-parser.jay: Fix several infelicities.
902 - Avoid assigning to the parser value stack. Code like
903 '$3 = null' is unclean. Synthesize a value for the code block
905 - Avoid using oob_stack for storing location information. Use ...
906 (_mark_): ... this. New (empty) rule. Saves the current location
908 (foreach_statement): Avoid using oob_stack for current_block
909 handling. Use technique used in for_statement and
910 using_statement. Synthesize a value for the code block to store
911 additional intermediate information.
913 2005-01-13 Miguel de Icaza <miguel@ximian.com>
915 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
916 of a different type is only allowed to private fields of a
917 containing type, not on fields of a base class.
919 See test-174.cs and error cs0122-9.cs
921 2005-01-13 Raja R Harinath <rharinath@novell.com>
923 Fix test-335.cs (bug #58126).
924 * cs-parser.jay (argument): Split out non-expression parts of the
925 rule into 'non_simple_argument'.
926 (invocation_expression): Support parenthesized invocations with
927 multiple arguments, and with single non-simple arguments.
929 2005-01-13 Raja R Harinath <rharinath@novell.com>
931 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
934 2005-01-12 Raja R Harinath <rharinath@novell.com>
936 Fix cs0038-1.cs, cs1640-6.cs.
937 * ecore.cs (Expression.Resolve): Remove special-case for
938 SimpleName in error-handling.
939 (Expression.almostMatchedMembers): Relax access permission to
941 (Expression.MemberLookupFailed): Handle duplicates in
942 almostMatchedMembers list.
943 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
944 * expression.cs (New.DoResolve): Report CS1540 for more cases.
945 * typemanager.cs (GetFullNameSignature): Use the MethodBase
946 overload if the passed in MemberInfo is a MethodBase.
948 2005-01-25 Martin Baulig <martin@ximian.com>
951 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
953 2005-01-12 Marek Safar <marek.safar@seznam.cz>
956 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
957 for non-CAS & merge permission sets properly.
959 2005-01-11 Raja R Harinath <rharinath@novell.com>
961 Improve standard-compliance of simple name and member access
962 resolution. Fixes bugs #52697, #57200, #67520, #69519.
963 * ecore.cs (FullNamedExpression): New abstract base class
964 for Namespaces and TypeExpressions.
965 (ResolveFlags.SimpleName): Remove.
966 (SimpleName): Remove support for dotted names.
967 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
968 DeclSpace.FindType and DeclSpace.LookupType.
969 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
970 (Expression.ExprClassName): Make member function.
971 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
972 a namespace. Remove creation of dotted "SimpleName"s.
973 (MemberAccess.DoResolve): Likewise.
974 * decl.cs (DeclSpace.Cache): Make private.
975 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
976 (DeclSpace.FindType): Update.
977 (DeclSpace.LookupType): Move here from RootContext. Return a
979 * namespace.cs (Namespace): Derive from FullNamedExpression
980 so that it can be part of expression resolution.
981 (Namespace.Lookup): Return an FullNamedExpression.
982 (NamespaceEntry.LookupAlias): Lookup aliases only in current
984 * rootcontext.cs (NamespaceLookup): Remove.
985 (LookupType): Move to DeclSpace.
986 * attribute.cs (CheckAttributeType): Update.
987 * doc.cs (FindDocumentedType): Remove allowAlias argument.
988 (FindDocumentedTypeNonArray): Likewise.
990 2005-01-11 Raja R Harinath <rharinath@novell.com>
992 Fix cs0509.cs, cs1632.cs.
993 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
994 is the same as IsInterface.
995 (TypeContainer.GetClassBases): Likewise.
996 * statement.cs (LabeledStatement.ig): New field.
997 (LabeledStatement.LabelTarget): Save ILGenerator which created the
999 (LabeledStatement.DoEmit): Check that the label was created with
1000 the same ILGenerator.
1002 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1005 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
1006 accessors to its properties.
1008 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
1009 from accessors to property.
1011 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1014 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
1017 2005-01-08 Miguel de Icaza <miguel@ximian.com>
1019 * attribute.cs: Check for null and empty strings.
1021 I have lost another battle to Paolo.
1023 2005-01-07 Marek Safar <marek.safar@seznam.cz>
1026 * class.cs (PropertyMethod): Set Parent field in ctors.
1027 (SetMethod.InternalParameters): Add unsafe switch hack.
1028 Override MarkForDuplicationCheck where it is appropriate.
1030 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
1031 It says whether container allows members with the same name.
1033 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
1034 Removed is_method parameter.
1036 2005-01-06 Duncan Mak <duncan@ximian.com>
1038 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
1039 because the previous change led to incorrect reporting of CS1032
1040 ("Cannot define/undefine preprocessor symbols after first token in
1041 file"). Instead of using `tokens_seen' as the only flag that
1042 triggers CS1040, introduce `comments_seen'. This new flag is used
1043 to signify having seen comments on the current line, so it is
1044 unset after a newline.
1046 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1048 * doc.cs : When searching for a type, find nested type too.
1049 This fixes bug #71040.
1051 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1054 - Warn missing member comment on those classes which also does not
1055 have doc comments. Fixed bug #71041.
1056 - Don't warn missing doc comment on default constructor.
1059 2005-01-06 Duncan Mak <duncan@ximian.com>
1061 * cs-tokenizer.cs (xtoken): After handling traditional C-style
1062 comments, set `tokens_seen' to true. This allows us to detect
1063 misplaced preprocessor directives (i.e. not at the beginning of
1064 the a line, nor after whitespaces). In that case, report error
1065 CS1040. This fixes bug #56460.
1067 * cs-parser.jay (interface_member_declaration): Add checks for
1068 IsExplicitImpl, and report CS0541 error if an interface member is
1069 defined as an explicit interface declaration.
1071 2005-01-06 Marek Safar <marek.safar@seznam.cz>
1074 * class.cs (PropertyMethod): Set Parent field in ctors.
1075 (SetMethod.InternalParameters): Add unsafe switch hack.
1077 * decl.cs (MemberCore.Parent): Cannot be readonly.
1079 2005-01-06 Raja R Harinath <rharinath@novell.com>
1081 * decl.cs (DeclSpace.ResolveType): Remove.
1082 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
1083 Merge in code from ...
1084 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
1085 * class.cs, enum.cs: Update to changes.
1087 2005-01-06 Miguel de Icaza <miguel@ximian.com>
1089 * anonymous.cs: Ensure that we init the scope of our parent if it
1090 has not been initialized yet.
1092 2004-12-30 Duncan Mak <duncan@ximian.com>
1094 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
1095 if field.FieldBuilder is null. Fixes #70758.
1097 * convert.cs: Fixed some typos and updated some of the comments.
1098 (ImplicitStandardConversionExists):
1099 (TryImplicitIntConversion): If `target_type' is an interface and
1100 the type of `ic' implements this interface, return true or a new
1101 BoxedCast instead of null. This fixes #70468.
1103 2004-12-29 Duncan Mak <duncan@ximian.com>
1105 * expression.cs (Argument.Emit): Check that Expr is
1106 IMemoryLocation before casting to it, and report CS1510 otherwise.
1110 2004-12-21 Ben Maurer <bmaurer@ximian.com>
1112 * statement.cs (Block.ThisVariable): remove the recursion here, to
1113 make the --profile more sane.
1115 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
1117 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
1118 assembly, by JB Evain.
1120 2004-12-17 Raja R Harinath <rharinath@novell.com>
1122 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
1123 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
1124 "parent" refers to enclosing type/class. "base" refers to superclass.
1126 2004-12-17 Raja R Harinath <rharinath@novell.com>
1128 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1129 Ensure that we only have GlobalAttributes.
1130 * attribute.cs (Attribute.Emit): Make non-virtual.
1131 (GlobalAttribute.Emit): Remove.
1132 (Attribute.Resolve): Make virtual.
1133 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
1134 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
1135 the argument. Don't create one.
1136 (Attribute.GetObsoleteAttribute): Likewise.
1137 (Attribute.GetClsCompliantAttributeValue): Likewise.
1138 * class.cs, decl.cs: Update to changes.
1140 2004-12-17 Marek Safar <marek.safar@seznam.cz>
1142 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
1144 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
1146 * statement.cs (Foreach.Resolve): Add error 186 report.
1148 2004-12-16 Marek Safar <marek.safar@seznam.cz>
1150 * expression.cs (Conditional.DoResolve): Add warning 429.
1152 * statement.cs (If.Resolve): Add warning 665.
1154 2004-12-16 Raja R Harinath <rharinath@novell.com>
1156 New invariant: RootContext.Tree.Types.NamespaceEntry == null
1157 except when in the parser, and in GlobalAttribute.
1158 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
1159 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
1160 RootContext.Tree.Types.NamespaceEntry once work is done.
1161 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
1162 and resets RootContext.Tree.Types.NamespaceEntry.
1164 2004-12-15 Marek Safar <marek.safar@seznam.cz>
1166 * cs-parser.jay: Don't create a block for every variable.
1168 2004-12-14 Miguel de Icaza <miguel@ximian.com>
1170 * location.cs: Provide extra information.
1172 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
1173 variables from the captured environment, it is the ldarg_0.
1175 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1177 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
1180 * class.cs: Changed warning level for 169 to avoid developer
1181 displeasure from warning flooding. It will be changed back when they
1182 fix most of current BCL warnings.
1184 * RootContext.cs: Pushed default WarningLevel to 3.
1186 * statement.cs: Removed unused variable.
1188 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1190 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
1191 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
1192 Add error 502 report.
1193 (StaticClass.DefineType): Add error 441 report.
1194 (Class.AllowedModifiersProp): New virtual property as temporary
1195 extension to AllowedModifiers.
1196 (Class.DefineType): Add error 418 report. Moved ModFlags check here
1197 to share implementation with StaticClass and don't call virtual
1200 * driver.cs (MainDriver): Add error 1558 test.
1202 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
1203 report. Moved error 36 test here.
1205 * statement.cs (Throw.Resolve): Add error 724 report.
1207 * typemanager.cs: Add out_attribute_type core type.
1209 2004-12-13 Marek Safar <marek.safar@seznam.cz>
1211 * class.cs (TypeContainer.VerifyClsCompliance): Add error
1213 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
1215 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
1218 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
1220 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
1221 Add error 3023 report.
1222 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
1224 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
1227 2004-12-12 John Luke <john.luke@gmail.com>
1229 * driver.cs (AddArgs): take -- into account when
1230 adding arguments, fixes bug 65710
1232 2004-12-12 Martin Baulig <martin@ximian.com>
1234 * expression.cs (Unary.TryReduceNegative): Added support for
1235 SByteConstant and ByteConstant.
1236 (Unary.Reduce): Check error values from TryReduceNegative().
1238 2004-12-10 Marek Safar <marek.safar@seznam.cz>
1240 * attributes.cs (Attribute.Resolve): Avoid multiple error report
1241 and report exception as error 182.
1243 2004-12-10 Raja R Harinath <rharinath@novell.com>
1245 * driver.cs (Main): Fix message when there are warnings.
1247 2004-12-09 Miguel de Icaza <miguel@ximian.com>
1249 * delegate.cs: Fixed my fix from yesterday, sorry about that.
1251 2004-12-09 Marek Safar <marek.safar@seznam.cz>
1253 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
1254 Reduced number of warnings.
1256 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
1258 2004-12-08 Miguel de Icaza <miguel@ximian.com>
1260 * driver.cs: Removed message.
1262 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
1264 2004-12-08 <vargaz@freemail.hu>
1266 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
1268 2004-12-08 Martin Baulig <martin@ximian.com>
1270 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1271 instead of a CS3002 for properties and indexer.
1273 2004-12-08 Martin Baulig <martin@ximian.com>
1275 * decl.cs (MemberName.ToString): Make this work again.
1277 2004-12-08 Marek Safar <marek.safar@seznam.cz>
1279 * attribute.cs (Resolve): Add error 591 detection.
1281 * class.cs (FieldMember.Define): Add error 1547 detection.
1282 (Indexer.Define): Add error 620 detection.
1283 (Operator.Define): Add error 590 detection.
1285 * ecore.cs: Missing argument for error 79.
1287 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
1290 2004-12-07 Marek Safar <marek.safar@seznam.cz>
1293 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
1296 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1298 * cs-parser.jay : handle doc comments on implicit/explicit operators.
1299 Some operator comments were suppressed.
1300 * doc.cs : Implicit/explicit operator name in doc comments are like
1301 "op_Explicit(type)~returnType", so added suffix handling.
1303 2005-01-21 Alp Toker <alp@atoker.com>
1305 * cs-parser.jay: destructor_declaration's container is PartialContainer
1306 not Class when partial types are used, so use Kind prop instead of 'is'.
1308 2004-12-12 Martin Baulig <martin@ximian.com>
1310 * expression.cs (Unary.TryReduceNegative): Added support for
1311 SByteConstant and ByteConstant.
1312 (Unary.Reduce): Check error values from TryReduceNegative().
1314 2004-12-11 Martin Baulig <martin@ximian.com>
1316 * support.cs (ReflectionParameters.ParameterName): If we have a
1317 `gpd', call `ParameterName' on it.
1319 * parameter.cs (Parameter.GetParameterAttributes): New static method.
1321 * pending.cs (PendingImplementation.DefineProxy): Call
1322 DefineParameter() for all of the MethodBuilder's arguments.
1324 2004-12-09 Martin Baulig <martin@ximian.com>
1326 * doc.cs (DocUtil): Make this a static class.
1328 2004-12-09 Martin Baulig <martin@ximian.com>
1330 * expression.cs (Invocation.InferType): Moved the type inference
1331 implementation into TypeManager.
1333 * generics.cs (TypeManager): Moved the type inference
1334 implementation here.
1336 2004-12-09 Martin Baulig <martin@ximian.com>
1338 * typemanager.cs (TypeManager): Make this a partial class.
1341 (TypeManager): Move the generics part of `TypeManager' here.
1343 2004-12-08 Martin Baulig <martin@ximian.com>
1345 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1346 instead of a CS3002 for properties and indexer. Added CS3024
1347 check for generic interfaces.
1349 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
1350 instances are not CLS-compliant.
1352 2004-12-08 Martin Baulig <martin@ximian.com>
1355 (void_pointer_expression): New rule for `void*', `void**' etc.
1356 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
1358 2004-12-08 Martin Baulig <martin@ximian.com>
1360 * expression.cs (Invocation.InferType): Removed the hack for
1361 MethodCore.MayUnify().
1363 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
1366 * class.cs (MethodCore.MayUnify): Use
1367 TypeManager.MayBecomeEqualGenericTypes().
1369 2004-12-08 Martin Baulig <martin@ximian.com>
1371 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
1372 parameter, box it. Fixes #69233.
1374 2004-12-08 Martin Baulig <martin@ximian.com>
1376 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
1377 have the ctor constraint. Fixes #68326.
1379 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1381 * cs-parser.jay : interface comment was not consumed because of
1382 extra opt_semicolon before doc handling.
1384 2004-12-03 Raja R Harinath <rharinath@novell.com>
1386 Fix test-327.cs, test-328.cs, and put in early infrastructure
1387 for eventually fixing #52697.
1388 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
1389 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
1391 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
1392 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
1393 (VerifyUsing, error246): Update.
1394 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1395 'NamespaceEntry.LookupNamespaceOrType'.
1397 2004-12-07 Martin Baulig <martin@ximian.com>
1399 * driver.cs: Call it "BETA SOFTWARE" :-)
1401 2004-12-06 Raja R Harinath <rharinath@novell.com>
1403 Fix crash on cs0657-17.cs.
1404 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1405 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1406 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1407 the case where the NamespaceEntry gets overwritten.
1409 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1411 Fixed #69195, #56821
1412 * ecore.cs (ResolveBoolean): Tiny refactoring.
1414 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1415 of right expression resolving when left is false constant and
1416 operator is LogicalAnd OR true constant and operator is LogicalOr.
1418 * statement.cs (ResolveUnreachable): Always reports warning.
1420 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1422 * class.cs: Distinguish between 1721 and 1722 (just a little help
1423 for the programmer).
1425 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1427 * delegate.cs: Only allow this on new versions of the language.
1429 2004-12-02 Duncan Mak <duncan@ximian.com>
1431 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1433 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1434 here as a static method. Take an additional bool out parameter
1435 `must_do_cs1540_check' for signaling to InstanceResolve.
1436 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1437 member field from PropertyExpr class and made it an argument of
1439 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1440 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1441 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1442 and `remove_accessor' as well as InstanceResolve: report CS0122
1447 2004-12-07 Martin Baulig <martin@ximian.com>
1449 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
1450 and CS0692 where appropriate.
1452 2004-12-06 Martin Baulig <martin@ximian.com>
1454 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
1455 IsDuplicateImplementation() and improved it.
1457 * expression.cs (Invocation.InferTypeArguments): Added
1458 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
1459 and removed the "ref" modifier from `infered_types'.
1461 * decl.cs (MemberName.ToString): Removed the exception.
1463 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1465 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1466 comments are allowed.
1468 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1470 * delegate.cs: Add checks for subtypes in paramaters and return values
1471 in VerifyMethod () to add support for Covariance/Contravariance
1474 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1476 * report.cs: Remove extra closing parenthesis.
1478 * convert.cs (Error_CannotImplicitConversion): If the name of the
1479 types are the same, provide some extra information.
1481 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1484 * attribute.cs (Resolve): Improved implementation of params
1485 attribute arguments.
1487 * support.cs (ParameterData): Add HasParams to be faster.
1489 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1491 all things are for /doc support:
1493 * doc.cs: new file that supports XML documentation generation.
1494 * mcs.exe.sources: added doc.cs.
1496 Handle /doc command line option.
1497 Report error 2006 instead of 5 for missing file name for /doc.
1498 Generate XML documentation when required, after type resolution.
1500 Added support for picking up documentation (/// and /** ... */),
1501 including a new XmlCommentState enumeration.
1503 Added lines to fill Documentation element for field, constant,
1504 property, indexer, method, constructor, destructor, operator, event
1505 and class, struct, interface, delegate, enum.
1506 Added lines to warn incorrect comment.
1508 Added Documentation field (passed only when /doc was specified).
1510 Added DocComment, DocCommentHeader, GenerateDocComment() and
1511 OnGenerateDocComment() and some supporting private members for
1512 /doc feature to MemberCore.
1514 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1516 Added overriden DocCommentHeader.
1518 Added overriden DocCommentHeader and GenerateDocComment().
1520 2004-12-01 Miguel de Icaza <miguel@ximian.com>
1522 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
1523 unwrapping the enumeration values, chain to
1524 DoConstantNumericPromotions again, so we can promote things to the
1525 fundamental types (takes care of enums that are bytes, sbytes).
1529 2004-12-01 Raja R Harinath <rharinath@novell.com>
1531 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
1532 Fix long-standing bug in type-lookup. Use FindType instead of
1533 LookupType when ec.ResolvingTypeTree.
1534 (Attribute.ResolveType, Attribute.Resolve)
1535 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
1537 (Attributes.Search): Remove internal version. Update.
1538 (Attributes.SearchMulti): Update.
1539 (Attributes.GetClsCompliantAttribute): Remove.
1540 (Attributes.GetIndexerNameAttribute): Remove.
1541 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
1542 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
1543 * class.cs (Indexer.Define): Likewise.
1545 2004-12-01 Marek Safar <marek.safar@seznam.cz>
1548 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
1549 MarshallByReference members access.
1551 * expression.cs: Use CheckMarshallByRefAccess;
1552 Better error CS0197 message.
1554 * report.cs: Print whole related error message.
1556 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1558 * class (GetClassBases): Better error 60 report.
1559 (EventProperty): Disabled warning 67 detection.
1561 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1564 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
1566 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
1569 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1572 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
1574 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
1576 2004-11-26 Miguel de Icaza <miguel@ximian.com>
1578 * attribute.cs (Attribute.Resolve): Refine error reporting and
1579 report a cs0117 if the identifier does not exist, to distinguish
1580 from 0617 which is a miss-use of the actual identifier.
1582 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
1583 between cs0070 and cs0079.
1585 * class.cs (MemberBase.DoDefine): When reporting a wrong
1586 accessibility level, we use MethodCore to compare instead of
1587 Method (this was a regression in some refactoring effort).
1589 So now we correctly report cs0056 again.
1591 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
1592 testing the target_type (which was known to be object_type) and
1593 not the source type (which is anonymous_method).
1595 Fixed reporting of error cs1660.
1597 * expression.cs (UserCast.Source): Expose the underlying cast.
1599 * statement.cs (Switch.SwitchGoverningType): Sort the list of
1600 allowed types to find a match to int32 first (most common).
1602 In addition, it ignores any ImplicitUserConversions that did an
1603 internal implicit conversion (as the switch statement allows only
1604 one integral conversion to exist).
1606 * class.cs (PartialContainer.Create): rename `name' to
1607 `member_name' for clarity. Then replace the string calls with a
1608 call to MemberName.GetPartialName, as now using
1609 MemberName.ToString is an error (this is due to the side effects
1610 it had, that were fixed in the past).
1612 This will restore the error reporting on a number of partial class
1613 errors that were missusing this (and getting an exception as a
1614 results, which is now just a plain textual warning, because
1615 yyparse debug output would crash otherwise).
1617 2004-11-26 Raja R Harinath <rharinath@novell.com>
1619 * Makefile (PROGRAM_INSTALL_DIR): Remove.
1621 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1623 * rootcontext.cs (LookupType): Make sure to cache lookups that
1624 don't give us a negative result. This saves about 5% of corlib
1627 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1629 * report.cs (AbstractMessage.Print): messages are sent to stderr
1631 * class.cs (TypeContainer.GetClassBases): It is an error to have a
1632 non-interface in the list of interfaces (at this point, either
1633 parent was properly set, or a base class is being listed in the
1634 interfaces section).
1636 This flags error 1722, and resolves the crash from bug 69259.
1638 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1640 * statement.cs (Using.EmitExpressionFinally): make this work right
1641 for valuetypes. Fixes 69926.
1643 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1645 * const.cs (Const.ChangeType): Cope with the "0 literal can be
1646 converted to an enum" here, before we try to change the underlying
1647 type. This code exists, but it is a different code path than the
1648 one used while encoding constants.
1650 (ImplicitReferenceConversionExists): In addition, resynchronized
1651 the code here, so it matches the same code in
1652 ImplicitReferenceConversionExists for the `from any class-type S
1653 to any interface-type T'.
1655 2004-11-25 Marek Safar <marek.safar@seznam.cz>
1657 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
1659 2004-11-24 Miguel de Icaza <miguel@ximian.com>
1661 * cs-parser.jay: Use verbosity accordingly.
1663 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1665 * expression.cs (Unary.ResolveOperator): Do not report warning;
1666 AddressOf reads from variable.
1668 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
1670 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1674 * attribute.cs (Attributable): Removed CheckTargets.
1675 (Attributes.Emit): Explicit attribute targets are tested here.
1677 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1678 not enabled for interfaces.
1680 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1681 (GetAssemblyName): Ouch next bug there.
1683 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1685 * expression.cs: Error 275 added.
1687 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1689 Fix bug #69177 (Implemented decimal constant support)
1691 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1692 (BinaryFold): Add DecimalConstant.
1694 * const.cs (Define): Decimal constant
1696 (ChangeType): Add decimal type handling.
1697 (LookupConstantValue): Don't set value for decimal type but
1698 emit DecimalConstantAttribute. Needed for constant optimization.
1700 * constant.cs (ToDecimal): New method.
1701 (ConvertToDecimal): New method.
1702 (IntConstant): Implemented ConvertToDecimal.
1703 (DecimalConstant.Emit): Emit optimized version for decimals in
1706 * expression.cs (ResolveOperator): Changed order of constant
1707 reduction to work correctly with native types which have
1708 overloaded operators.
1709 (ResolveMemberAccess): Extract constant value from attribute
1712 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1714 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1715 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1716 (ChangeType): Decimal is special.
1717 (TypeToCoreType): Add decimal type.
1719 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1721 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1724 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1726 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1729 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1731 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1733 * pending.cs (PendingImplementation): Grab only interfaces.
1735 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1737 * statement.cs (ForeachHelperMethods): Add location member and
1738 error 202 detection.
1740 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1742 * expression.cs (DoResolveBase): Fixed wrong warning for out
1745 2004-12-04 Martin Baulig <martin@ximian.com>
1747 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
1748 to check whether the conversion is ok.
1750 * typemanager.cs (TypeManager.GetTypeArguments): Just return
1751 `Type.EmptyTypes' if we're not a generic TypeContainer.
1753 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1755 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1756 old bug: when converting from the null literal to a pointer,
1757 return an EmptyCast, not the NullLiteral.
1759 This fixes #69921, the recent null_type changes probably made this
1762 2004-12-03 Martin Baulig <martin@ximian.com>
1764 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1765 method as our child, call AnonymousMethod.Compatible() on it.
1767 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1769 * class.cs (FieldBase): Use an unused bit field from the field to
1770 encode the `has_offset' property from the FieldMember. This saves
1771 a couple of Ks on bootstrap compilation.
1773 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1774 method as our child, return the AnonymousMethod resolved
1777 * expression.cs (New.DoResolve): Allow return values from
1778 NewDelegate to also include AnonymousMethods.
1782 2004-11-29 Raja R Harinath <rharinath@novell.com>
1784 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
1786 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
1787 System.Runtime.InteropServices._Exception, since it's a base
1788 interface of the core type System.Exception in the net_2_0 profile.
1790 2004-11-27 Martin Baulig <martin@ximian.com>
1792 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
1794 2004-11-26 Raja R Harinath <rharinath@novell.com>
1796 * Makefile: Convert to use executable.make.
1797 * gmcs.exe.sources: New.
1799 2004-11-25 Martin Baulig <martin@ximian.com>
1801 * expression.cs (Invocation.InferType): Added support for byref types.
1803 2004-11-25 Martin Baulig <martin@ximian.com>
1805 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
1806 in TypeManager.TypeToCoreType().
1808 2004-11-25 Martin Baulig <martin@ximian.com>
1810 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
1811 "Dispose" method from the `current_type'.
1812 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
1813 DoDefineMembers() instead of using the MethodBuilder; this is
1814 required for generic iterators.
1816 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
1818 2004-11-24 Martin Baulig <martin@ximian.com>
1820 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
1822 2004-11-20 Martin Baulig <martin@ximian.com>
1824 * expression.cs (Invocation.InferType): Correctly infer generic
1825 instances; see gen-103.cs.
1826 (Invocation.InferTypeArguments): If a generic method doesn't have
1827 any unbound type parameters, we don't need to infer anything.
1829 2004-11-19 Raja R Harinath <rharinath@novell.com>
1831 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1833 2004-11-17 Raja R Harinath <rharinath@novell.com>
1835 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1836 (TypeHandle.GetMemberCache): New.
1837 (TypeHandle.TypeHandle): Update.
1838 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1839 (TypeManager.LookupParentInterfacesCache):
1840 Rename from LookupInterfaceCache. Optimize slightly.
1841 (TypeManager.MemberLookup_FindMembers): Update.
1842 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1844 (AddCacheContents): Rename from AddHashtable.
1845 * class.cs (TypeContainer.parent_container): Remove.
1846 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1847 (TypeContainer.DoDefineMembers): Don't initialize it.
1848 Update to name changes.
1850 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1852 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1853 that factors the code to check access modifiers on override.
1855 (PropertyBase): Use the code here.
1857 Patch from Lluis S'anchez, fixes bug #69361.
1859 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1861 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1862 routine that is used to report the use of a captured variable
1863 whose address has been taken.
1865 There are two checks: one when variables are being captured and
1866 the other check is when the address of a variable is taken.
1868 (because an anonymous methods might be resolved before *or* after
1869 the address has been taken) and
1871 * expression.cs (Conditional.DoResolve): Remove the special
1872 casing that Martin added to trueExpr and falseExpr being both
1873 NullLiteral. We get the right behavior now just by introducing
1874 the null_type into the compiler.
1876 * convert.cs (ExplicitConversion): Change the code to use
1877 null_type instead of testing `expr is NullLiteral'.
1878 (ImplicitConversionStandard): use null_type too.
1879 (ImplicitReferenceConversionExists): use null_type too.
1880 (ImplicitReferenceConversion): use null_type too.
1882 * literal.cs: The type of `NullLiteral' is now null_type instead
1884 (Resolve): Set the type here.
1886 * typemanager.cs: Introduce null_type.
1888 2004-11-18 Martin Baulig <martin@ximian.com>
1891 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1893 2004-11-18 Martin Baulig <martin@ximian.com>
1895 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1897 2004-11-18 Martin Baulig <martin@ximian.com>
1899 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1900 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1901 call ResolveConstructedType() on it to resolve it without checking
1903 (Constraints.ResolveTypes): Check them here.
1904 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1905 but don't check constraints.
1906 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1907 check constraints here.
1908 (ConstructedType.ResolveConstructedType): New public method. This
1909 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1910 resolve ourselves without checking constraints.
1912 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1914 2004-11-18 Martin Baulig <martin@ximian.com>
1917 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1919 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1921 2004-11-18 Martin Baulig <martin@ximian.com>
1923 * ecore.cs (TypeExpr.ResolveType): Removed.
1924 (Expression.ResolveAsTypeTerminal): We always return a fully
1925 resolved `TypeExpr', so we can just access its `Type'.
1927 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1929 2004-11-17 Martin Baulig <martin@ximian.com>
1931 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1932 sure we don't return any unresolved TypeExpr's.
1933 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1935 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1937 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1938 unresolved `ConstructedType's.
1940 2004-11-17 Martin Baulig <martin@ximian.com>
1942 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1944 2004-11-17 Martin Baulig <martin@ximian.com>
1947 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1949 * decl.cs (DeclSpace.ResolveType): Removed.
1950 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1952 2004-11-17 Martin Baulig <martin@ximian.com>
1954 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1955 direction, like FindMembers() does. Fixes #69546, testcase is in
1958 2004-11-16 Martin Baulig <martin@ximian.com>
1960 This is based on a patch from Marek Safar, see bug #69082.
1961 Fixes bugs #63705 and #67130.
1963 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1964 method; create a MemberCache for an interface type and cache the
1967 * decl.cs (IMemberContainer.ParentContainer): Removed.
1968 (IMemberContainer.ParentCache): New property.
1969 (MemberCache.SetupCacheForInterface): Removed.
1970 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1971 to create a cache for an interface's "parent".
1973 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1976 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1978 * statement.cs: Avoid adding bools to a hashtable.
1980 2004-11-15 Martin Baulig <martin@ximian.com>
1982 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1984 2004-11-11 Martin Baulig <martin@ximian.com>
1986 * typemanager.cs (TypeManager.GetMethodName): New method.
1988 * class.cs (MethodData.Define): Include the generic arity in the
1989 name of an explicit interface; also add it to the method name.
1991 * pending.cs (PendingImplementation.InterfaceMethod): The method
1992 name now includes the generic arity.
1994 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1996 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1997 calling an unsafe method from a safe location.
1999 2004-11-06 Marek Safar <marek.safar@seznam.cz>
2002 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
2004 2004-11-06 Miguel de Icaza <miguel@ximian.com>
2006 * namespace.cs (VerifyUsing): use GetPartialName instead of
2009 2004-11-05 Miguel de Icaza <miguel@ximian.com>
2011 * statement.cs (Return.Resolve): Fix regression in typo: if
2012 `in_exc', we have to request a NeedReturnLabel, this was a typo
2013 introduced in the anonymous method check-in. Fixes #69131.
2015 * Indexers were using the ShortName when defining themselves,
2016 causing a regression in the compiler bootstrap when applying the
2017 patch from 2004-11-02 (first part), now they use their full name
2018 and the bug is gone.
2020 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
2022 * driver.cs: Strip the path from the names of embedded resources. Fixes
2025 2004-11-04 Raja R Harinath <rharinath@novell.com>
2027 Fix error message regression: cs0104-2.cs.
2028 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
2029 (AliasEntry.Resolve): Update.
2030 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
2032 (RootContext.LookupType): Update.
2034 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
2036 * cs-parser.jay: Add support for handling accessor modifiers
2037 * class: Add support port accessor modifiers and error checking,
2038 define PropertyMethod.Define as virtual (not abstract anymore)
2039 * ecore.cs: Add checking for proeprties access with access modifiers
2040 * iterators.cs: Modify Accessor constructor call based in the modified
2042 2004-11-02 Ben Maurer <bmaurer@ximian.com>
2044 * expression.cs (StringConcat): Handle being called twice,
2045 as when we have a concat in a field init with more than two
2048 2004-11-02 Miguel de Icaza <miguel@ximian.com>
2050 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
2051 special case explicit implementations, we should always produce
2052 the .property or .event declaration.
2054 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
2055 since it will not return correct data if people use this
2056 unresolved in the presence of using statements (see test-313).
2058 * class.cs (MethodData.Define): If we are an explicit interface
2059 implementation, set the method name to the full name of the
2060 interface plus the name of the method.
2062 Notice that using the method.MethodName.GetFullName() does not
2063 work, as it will only contain the name as declared on the source
2064 file (it can be a shorthand in the presence of using statements)
2065 and not the fully qualifed type name, for example:
2069 class D : ICloneable {
2070 object ICloneable.Clone () {
2074 Would produce a method called `ICloneable.Clone' instead of
2075 `System.ICloneable.Clone'.
2077 * namespace.cs (Alias.Resolve): Use GetPartialName.
2079 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2081 * cs-parser.jay: Add error 1055 report.
2083 2004-11-01 Miguel de Icaza <miguel@ximian.com>
2085 * assign.cs (Assign.DoResolve): Only do the transform of
2086 assignment into a New if the types are compatible, if not, fall
2087 through and let the implicit code deal with the errors and with
2088 the necessary conversions.
2090 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2092 * cs-parser.jay: Add error 1031 report.
2094 * cs-tokenizer.cs: Add location for error 1038.
2096 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2098 * cs-parser.jay: Add error 1016 report.
2100 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2102 * cs-parser.jay: Add errors 1575,1611 report.
2104 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2106 * cs-parser.jay: Add error 1001 report.
2108 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2111 * attribute.cs (GetMarshal): Add method argument for
2112 caller identification.
2114 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
2115 agument for GetMarshal and RuntimeMissingSupport.
2117 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2119 * attribute.cs (ExtractSecurityPermissionSet): Removed
2120 TypeManager.code_access_permission_type.
2122 * typemanager.cs: Removed TypeManager.code_access_permission_type.
2124 2004-10-27 Miguel de Icaza <miguel@ximian.com>
2126 * expression.cs (LocalVariableReference.DoResolveLValue): Check
2127 for obsolete use of a variable here. Fixes regression on errors
2128 cs0619-25 and cs0619-26.
2130 2004-10-27 Marek Safar <marek.safar@seznam.cz>
2132 Fix #62358, implemented security attribute encoding.
2134 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
2135 Tests permitted SecurityAction for assembly or other types.
2136 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
2137 data from SecurityPermissionAttribute to PermisionSet class.
2139 * class.cs (ApplyAttributeBuilder): Added special handling
2140 for System.Security.Permissions.SecurityAttribute based types.
2142 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
2143 special handling for System.Security.Permissions.SecurityAttribute
2146 * enum.cs (ApplyAttributeBuilder): Added special handling
2147 for System.Security.Permissions.SecurityAttribute based types.
2149 * parameter.cs (ApplyAttributeBuilder): Added special handling
2150 for System.Security.Permissions.SecurityAttribute based types.
2152 * rootcontext.cs: Next 2 core types.
2154 * typemanager.cs (TypeManager.security_permission_attr_type):
2155 Built in type for the SecurityPermission Attribute.
2156 (code_access_permission_type): Build in type.
2158 2004-10-17 Miguel de Icaza <miguel@ximian.com>
2160 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
2161 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
2162 all of this information into
2163 EmitContext.EmitCapturedVariableInstance.
2165 * codegen.cs (EmitCapturedVariableInstance): move here the
2166 funcionality of emitting an ldarg.0 in the presence of a
2167 remapping. This centralizes the instance emit code.
2169 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
2170 then emit a load of this: it means that we have reached the
2171 topmost ScopeInfo: the one that contains the pointer to the
2172 instance of the class hosting the anonymous method.
2174 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
2175 captures to the topmost CaptureContext.
2177 2004-10-12 Miguel de Icaza <miguel@ximian.com>
2179 * expression.cs (LocalVariableReference): Move the knowledge about
2180 the iterators into codegen's EmitCapturedVariableInstance.
2182 2004-10-11 Miguel de Icaza <miguel@ximian.com>
2184 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
2185 all code paths return a value from an anonymous method (it is the
2186 same as the 161 error, but for anonymous methods).
2188 2004-10-08 Miguel de Icaza <miguel@ximian.com>
2190 The introduction of anonymous methods in the compiler changed
2191 various ways of doing things in the compiler. The most
2192 significant one is the hard split between the resolution phase
2193 and the emission phases of the compiler.
2195 For instance, routines that referenced local variables no
2196 longer can safely create temporary variables during the
2197 resolution phase: they must do so from the emission phase,
2198 since the variable might have been "captured", hence access to
2199 it can not be done with the local-variable operations from the runtime.
2203 (Block.Flags): New flag `IsTopLevel' to indicate that this block
2204 is a toplevel block.
2206 (ToplevelBlock): A new kind of Block, these are the blocks that
2207 are created by the parser for all toplevel method bodies. These
2208 include methods, accessors and anonymous methods.
2210 These contain some extra information not found in regular blocks:
2211 A pointer to an optional CaptureContext (for tracking captured
2212 local variables and parameters). A pointer to the parent
2215 (Return.Resolve): Catch missmatches when returning a value from an
2216 anonymous method (error 1662).
2217 Invoke NeedReturnLabel from the Resolve phase instead of the emit
2220 (Break.Resolve): ditto.
2222 (SwitchLabel): instead of defining the labels during the
2223 resolution phase, we now turned the public ILLabel and ILLabelCode
2224 labels into methods called GetILLabelCode() and GetILLabel() that
2225 only define the label during the Emit phase.
2227 (GotoCase): Track the SwitchLabel instead of the computed label
2228 (its contained therein). Emit the code by using
2229 SwitchLabel.GetILLabelCode ().
2231 (LocalInfo.Flags.Captured): A new flag has been introduce to track
2232 whether the Local has been captured or not.
2234 (LocalInfo.IsCaptured): New property, used to tell whether the
2235 local has been captured.
2237 * anonymous.cs: Vastly updated to contain the anonymous method
2240 The main classes here are: CaptureContext which tracks any
2241 captured information for a toplevel block and ScopeInfo used to
2242 track the activation frames for various local variables.
2244 Each toplevel block has an optional capture context associated
2245 with it. When a method contains an anonymous method both the
2246 toplevel method and the anonymous method will create a capture
2247 context. When variables or parameters are captured, they are
2248 recorded on the CaptureContext that owns them, for example:
2252 MyDelegate d = delegate {
2257 Here `a' will be recorded as captured on the toplevel
2258 CapturedContext, the inner captured context will not have anything
2259 (it will only have data if local variables or parameters from it
2260 are captured in a nested anonymous method.
2262 The ScopeInfo is used to track the activation frames for local
2263 variables, for example:
2265 for (int i = 0; i < 10; i++)
2266 for (int j = 0; j < 10; j++){
2267 MyDelegate d = delegate {
2272 At runtime this captures a single captured variable `i', but it
2273 captures 10 different versions of the variable `j'. The variable
2274 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
2275 recorded on a child.
2277 The toplevel ScopeInfo will also track information like the `this'
2278 pointer if instance variables were referenced (this is necessary
2279 as the anonymous method lives inside a nested class in the host
2280 type of the method).
2282 (AnonymousMethod): Expanded to track the Toplevel, implement
2283 `AnonymousMethod.Compatible' to tell whether an anonymous method
2284 can be converted to a target delegate type.
2286 The routine now also produces the anonymous method content
2288 (AnonymousDelegate): A helper class that derives from
2289 DelegateCreation, this is used to generate the code necessary to
2290 produce the delegate for the anonymous method that was created.
2292 * assign.cs: API adjustments for new changes in
2293 Convert.ImplicitStandardConversionExists.
2295 * class.cs: Adjustments to cope with the fact that now toplevel
2296 blocks are of type `ToplevelBlock'.
2298 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
2299 insteda of standard blocks.
2301 Flag errors if params arguments are passed to anonymous methods.
2303 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
2304 `CurrentAnonymousMethod' which points to the current Anonymous
2305 Method. The variable points to the AnonymousMethod class that
2306 holds the code being compiled. It is set in the new EmitContext
2307 created for the anonymous method.
2309 (EmitContext.Phase): Introduce a variable and an enumeration to
2310 assist in enforcing some rules about when and where we are allowed
2311 to invoke certain methods (EmitContext.NeedsReturnLabel is the
2312 only one that enfonces this right now).
2314 (EmitContext.HaveCaptureInfo): new helper method that returns
2315 whether we have a CapturedContext initialized.
2317 (EmitContext.CaptureVariable): New method used to register that a
2318 LocalInfo must be flagged for capturing.
2320 (EmitContext.CapturedParameter): New method used to register that a
2321 parameters must be flagged for capturing.
2323 (EmitContext.CapturedField): New method used to register that a
2324 field must be flagged for capturing.
2326 (EmitContext.HaveCapturedVariables,
2327 EmitContext.HaveCapturedFields): Return whether there are captured
2328 variables or fields.
2330 (EmitContext.EmitMethodHostInstance): This is used to emit the
2331 instance for the anonymous method. The instance might be null
2332 (static methods), this (for anonymous methods that capture nothing
2333 and happen to live side-by-side with the current method body) or a
2334 more complicated expression if the method has a CaptureContext.
2336 (EmitContext.EmitTopBlock): Routine that drives the emission of
2337 code: it will first resolve the top block, then emit any metadata
2338 and then emit the code. The split is done so that we can extract
2339 any anonymous methods and flag any captured variables/parameters.
2341 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
2342 during this phase, the ILGenerator should not be used as labels
2343 and local variables declared here might not be accessible to any
2344 code that is part of an anonymous method.
2346 Exceptions to this include the temporary variables that are
2347 created by some statements internally for holding temporary
2350 (EmitContext.EmitMeta): New routine, in charge of emitting all the
2353 (EmitContext.TemporaryReturn): This method is typically called
2354 from the Emit phase, and its the only place where we allow the
2355 ReturnLabel to be defined other than the EmitMeta. The reason is
2356 that otherwise we would have to duplicate a lot of logic in the
2357 Resolve phases of various methods that today is on the Emit
2360 (EmitContext.NeedReturnLabel): This no longer creates the label,
2361 as the ILGenerator is not valid during the resolve phase.
2363 (EmitContext.EmitThis): Extended the knowledge in this class to
2364 work in anonymous methods in addition to iterators.
2366 (EmitContext.EmitCapturedVariableInstance): This emits whatever
2367 code is necessary on the stack to access the instance to a local
2368 variable (the variable will be accessed as a field).
2370 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
2371 EmitContext.EmitAddressOfParameter): Routines to support
2372 parameters (not completed at this point).
2374 Removals: Removed RemapLocal and RemapLocalLValue. We probably
2375 will also remove the parameters.
2377 * convert.cs (Convert): Define a `ConstantEC' which points to a
2378 null. This is just to prefity some code that uses
2379 ImplicitStandardConversion code and do not have an EmitContext
2382 The idea is to flag explicitly that at that point in time, it is
2383 known that the conversion will not trigger the delegate checking
2384 code in implicit conversions (which requires a valid
2387 Everywhere: pass new EmitContext parameter since
2388 ImplicitStandardConversionExists now requires it to check for
2389 anonymous method conversions.
2391 (Convert.ImplicitStandardConversionExists): If the type of an
2392 expression is the anonymous_method_type, and the type is a
2393 delegate, we invoke the AnonymousMethod.Compatible method to check
2394 whether an implicit conversion is possible.
2396 (Convert.ImplicitConversionStandard): Only do implicit method
2397 group conversions if the language level is not ISO_1.
2399 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2400 MethodInfo for the Invoke method. used by Delegate and
2403 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2404 method conversions if the target type is a delegate.
2406 Removed extra debugging nops.
2408 (LocalVariableReference): Turn the `local_info' into a public
2411 Add `prepared' field, the same hack used for FieldExprs to cope
2412 with composed assignments, as Local variables do not necessarily
2413 operate purely on the stack as they used to: they can be captured
2416 Add `temp' for a temporary result, like fields.
2418 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2420 It now copes with Local variables that are captured and emits the
2421 proper instance variable to load it from a field in the captured
2424 (ParameterReference.DoResolveBase): During the resolve phase,
2425 capture parameters if we are in an anonymous method.
2427 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2428 anonymous method, use the EmitContext helper routines to emit the
2429 parameter reference.
2431 * iterators.cs: Set RemapToProxy to true/false during the
2434 * parameters.cs (GetParameterByName): New helper method.
2436 * typemanager.cs (anonymous_method_type) a new type that
2437 represents an anonyous method. This is always an internal type,
2438 used as a fencepost to test against the anonymous-methodness of an
2441 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2443 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2445 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2447 2004-11-10 Martin Baulig <martin@ximian.com>
2449 * expression.cs (Invocation.BetterFunction): If two methods have
2450 equal parameter types, but only one of them is generic, the
2451 non-generic one wins.
2452 (New.DoResolve): Don't set `is_struct' to false if we're a generic
2453 instance; just use `Type.IsValueType' to determine whether
2454 something is a struct or not.
2455 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
2456 so we can be called multiple times.
2458 2004-11-10 Martin Baulig <martin@ximian.com>
2460 * generic.cs (TypeParameter.DefineConstraints): New public method.
2461 (TypeParameter.CheckAccessLevel): Override this and return true.
2462 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
2463 override ResolveType() anymore.
2464 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
2466 2004-11-10 Martin Baulig <martin@ximian.com>
2468 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
2469 call DeclSpace.ResolveNestedType() on it.
2471 2004-11-10 Martin Baulig <martin@ximian.com>
2473 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
2474 non-null, call ParameterModifier() on it.
2476 2004-11-10 Martin Baulig <martin@ximian.com>
2479 (Iterators): Added `current_type' and `this_type' fields.
2480 (Iterators.DefineIterator): Create a new EmitContext and store it
2481 in `ec'; compute `this_type'.
2483 2004-11-10 Martin Baulig <martin@ximian.com>
2486 (TypeManager.IsPrivateAccessible): New public method.
2487 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
2489 2004-11-10 Martin Baulig <martin@ximian.com>
2491 * class.cs (TypeContainer.DefineType): Call
2492 TypeBuilder.DefineGenericParameters() before resolving the type
2494 (MethodData.parent_method): New protected field.
2495 (MethodData..ctor): Added `MethodInfo parent_method' argument.
2496 (MethodData.Define): Compute `parent_method'.
2499 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
2500 (MemberCore.GetClsCompliantAttributeValue): Likewise.
2501 (DeclSpace.ec): New protected field; store the EmitContext here.
2502 (DeclSpace.EmitContext): New public property.
2503 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
2504 (DeclSpace.ResolveNestedType): New public method.
2505 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
2506 (DeclSpace.NestedAccessible): Added `Type tb' argument.
2507 (DeclSpace.FamilyAccessible): Likewise.
2508 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
2509 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
2512 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
2515 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
2516 (Enum.Emit): Don't create a new EmitContext.
2518 2004-10-18 Martin Baulig <martin@ximian.com>
2520 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2521 `Type' directly, but call ResolveType() on it.
2522 (Catch.Resolve): Likewise.
2523 (Foreach.Resolve): Likewise.
2525 2004-10-18 Martin Baulig <martin@ximian.com>
2527 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2528 `Type' directly, but call ResolveType() on it.
2529 (Probe.DoResolve): Likewise.
2530 (ArrayCreation.LookupType): Likewise.
2531 (TypeOf.DoResolve): Likewise.
2532 (SizeOf.DoResolve): Likewise.
2534 2004-10-18 Raja R Harinath <rharinath@novell.com>
2536 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2539 2004-10-17 John Luke <john.luke@gmail.com>
2541 * class.cs (Operator.GetSignatureForError): use CSharpName
2543 * parameter.cs (Parameter.GetSignatureForError): Returns
2544 correct name even if was not defined.
2546 2004-10-13 Raja R Harinath <rharinath@novell.com>
2549 * class.cs (TypeContainer.EmitContext): New property.
2550 (DefineNestedTypes): Create an emitcontext for each part.
2551 (MethodCore.DoDefineParameters): Use container's emitcontext.
2552 Pass type array to InternalParameters.
2553 (MemberBase.DoDefine): Use container's emitcontext.
2554 (FieldMember.Define): Likewise.
2555 (Event.Define): Likewise.
2556 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2557 Pass type array to InternalParameters.
2558 (SetIndexerMethod.GetParameterInfo): Likewise.
2559 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2560 * delegate.cs (Define): Pass emitcontext to
2561 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2562 array to InternalParameters.
2563 * expression.cs (ParameterReference.DoResolveBase): Pass
2564 emitcontext to GetParameterInfo.
2565 (ComposedCast.DoResolveAsTypeStep): Remove check on
2566 ec.ResolvingTypeTree.
2567 * parameter.cs (Parameter.Resolve): Change argument to
2568 EmitContext. Use ResolveAsTypeTerminal.
2569 (Parameter.GetSignature): Change argument to EmitContext.
2570 (Parameters.ComputeSignature): Likewise.
2571 (Parameters.ComputeParameterTypes): Likewise.
2572 (Parameters.GetParameterInfo): Likewise.
2573 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2574 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2575 * support.cs (InternalParameters..ctor): Remove variant that takes
2577 * typemanager.cs (system_intptr_expr): New.
2578 (InitExpressionTypes): Initialize it.
2580 2004-10-12 Chris Toshok <toshok@ximian.com>
2582 * cs-parser.jay: fix location for try_statement and catch_clause.
2584 2004-10-18 Martin Baulig <martin@ximian.com>
2586 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2587 `Type' directly, but call ResolveType() on it.
2588 (MemberBase.DoDefine): Likewise.
2590 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2591 `Type' directly, but call ResolveType() on it.
2592 (ComposedCast.DoResolveAsTypeStep): Likewise.
2594 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2595 `Type' directly, but call ResolveType() on it.
2597 2004-10-17 John Luke <john.luke@gmail.com>
2599 * class.cs (Operator.GetSignatureForError): use CSharpName
2601 * parameter.cs (Parameter.GetSignatureForError): Returns
2602 correct name even if was not defined.
2604 2004-10-13 Raja R Harinath <rharinath@novell.com>
2607 * class.cs (TypeContainer.EmitContext): New property.
2608 (DefineNestedTypes): Create an emitcontext for each part.
2609 (MethodCore.DoDefineParameters): Use container's emitcontext.
2610 Pass type array to InternalParameters.
2611 (MemberBase.DoDefine): Use container's emitcontext.
2612 (FieldMember.Define): Likewise.
2613 (Event.Define): Likewise.
2614 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2615 Pass type array to InternalParameters.
2616 (SetIndexerMethod.GetParameterInfo): Likewise.
2617 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2618 * delegate.cs (Define): Pass emitcontext to
2619 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2620 array to InternalParameters.
2621 * expression.cs (ParameterReference.DoResolveBase): Pass
2622 emitcontext to GetParameterInfo.
2623 (ComposedCast.DoResolveAsTypeStep): Remove check on
2624 ec.ResolvingTypeTree.
2625 * parameter.cs (Parameter.Resolve): Change argument to
2626 EmitContext. Use ResolveAsTypeTerminal.
2627 (Parameter.GetSignature): Change argument to EmitContext.
2628 (Parameters.ComputeSignature): Likewise.
2629 (Parameters.ComputeParameterTypes): Likewise.
2630 (Parameters.GetParameterInfo): Likewise.
2631 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2632 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2633 * support.cs (InternalParameters..ctor): Remove variant that takes
2635 * typemanager.cs (system_intptr_expr): New.
2636 (InitExpressionTypes): Initialize it.
2638 2004-10-12 Chris Toshok <toshok@ximian.com>
2640 * cs-parser.jay: fix location for try_statement and catch_clause.
2642 2004-10-07 Raja R Harinath <rharinath@novell.com>
2644 More DeclSpace.ResolveType avoidance.
2645 * decl.cs (MemberCore.InUnsafe): New property.
2646 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2647 with newly created EmitContext.
2648 (FieldMember.Define): Likewise.
2649 * delegate.cs (Delegate.Define): Likewise.
2650 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2651 only if normal name-lookup fails.
2652 (TypeExpr.DoResolve): Enable error-checking.
2653 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2654 (SizeOf.DoResolve): Likewise.
2655 (ComposedCast.DoResolveAsTypeStep): Likewise.
2656 (StackAlloc.DoResolve): Likewise.
2657 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2658 (Block.Unsafe): New property.
2659 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2660 (Unsafe): Set 'unsafe' flag of contained block.
2661 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2662 (Fixed.Resolve): Likewise.
2663 (Catch.Resolve): Likewise.
2664 (Using.ResolveLocalVariableDecls): Likewise.
2665 (Foreach.Resolve): Likewise.
2667 2004-10-05 John Luke <john.luke@gmail.com>
2669 * cs-parser.jay: add location to error CS0175
2671 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2673 * ecore.cs (Expression.Constantity): Add support for turning null
2676 * const.cs (Const.Define): Allow constants to be reference types
2677 as long as the value is Null.
2679 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2681 * namespace.cs (NamespaceEntry.Using): No matter which warning
2682 level is set, check if this namespace name has already been added.
2684 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2686 * expression.cs: reftype [!=]= null should always use br[true,false].
2689 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2692 * attribute.cs: Enum conversion moved to
2693 GetAttributeArgumentExpression to be applied to the all
2696 2004-10-01 Raja R Harinath <rharinath@novell.com>
2698 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2699 * class.c (TypeContainer.DefineType): Flag error if
2700 base types aren't accessible due to access permissions.
2701 * decl.cs (DeclSpace.ResolveType): Move logic to
2702 Expression.ResolveAsTypeTerminal.
2703 (DeclSpace.ResolveTypeExpr): Thin layer over
2704 Expression.ResolveAsTypeTerminal.
2705 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2706 Refactor code into NestedAccess. Use it.
2707 (DeclSpace.NestedAccess): New.
2708 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2709 argument to silence errors. Check access permissions.
2710 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2711 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2712 (Cast.DoResolve): Likewise.
2713 (New.DoResolve): Likewise.
2714 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2715 (TypeOf.DoResolve): Likewise.
2717 * expression.cs (Invocation.BetterConversion): Return the Type of
2718 the better conversion. Implement section 14.4.2.3 more faithfully.
2719 (Invocation.BetterFunction): Make boolean. Make correspondence to
2720 section 14.4.2.2 explicit.
2721 (Invocation.OverloadResolve): Update.
2722 (Invocation): Remove is_base field.
2723 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2724 (Invocation.Emit): Likewise.
2726 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2728 * cs-parser.jay: Reverted 642 warning fix.
2730 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2733 * decl.cs (FindMemberWithSameName): Indexer can have more than
2736 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2738 * expression.cs (LocalVariableReference.DoResolveLValue):
2739 Do not report warning 219 for out values.
2740 (EmptyExpression.Null): New member to avoid extra allocations.
2742 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2744 * cs-parser.jay: Fix wrong warning 642 report.
2746 * cs-tokenizer.cs (CheckNextToken): New helper;
2747 Inspect next character if is same as expected.
2749 2004-09-23 Martin Baulig <martin@ximian.com>
2751 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2752 (Convert.ImplicitReferenceConversionExists): Likewise.
2754 2004-11-09 Raja R Harinath <rharinath@novell.com>
2756 * Makefile (DISTFILES): Comment out a few missing files.
2758 2004-10-29 Raja R Harinath <rharinath@novell.com>
2760 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
2761 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
2762 (gmcs.exe): Invoke bootstrap-libs.
2763 (clean-local): Clean the net_2_0_bootstrap profile too.
2764 (PROGRAM_INSTALL_DIR): New.
2765 (install-local): Use it.
2767 2004-10-13 Martin Baulig <martin@ximian.com>
2769 * generic.cs (TypeManager.InflatedConstraints): New nested class.
2770 (TypeParameter.DefineType): If we're a method type parameter and
2771 that method is overriding something, "inflate" its constraints.
2773 2004-10-12 Martin Baulig <martin@ximian.com>
2775 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
2776 and have type arguments, create and resolve a ConstructedType.
2778 2004-10-12 Martin Baulig <martin@ximian.com>
2780 * decl.cs (MemberCache.FindMemberToOverride): Use
2781 TypeManager.IsEqual() to compare the parameters and Type.Equals()
2782 to compare the invocationType.
2784 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
2785 When comparing two type parameters, only do the signature-only
2786 comparision for method type parameters.
2788 2004-10-11 Martin Baulig <martin@ximian.com>
2790 * report.cs: Don't make --fatal abort on warnings, we have
2791 -warnaserror for that.
2793 2004-10-11 Martin Baulig <martin@ximian.com>
2796 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
2797 (TypeManager.IsEqual): Call ourself recursively instead of using
2800 2004-10-11 Martin Baulig <martin@ximian.com>
2802 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
2803 on our own type parameters, not on the ones we inherit from a containing
2806 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
2809 * generic.cs (TypeParameter.Define): We may only be called once.
2811 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
2812 instead of TypeManager.IsEqual().
2814 2004-09-28 Martin Baulig <martin@ximian.com>
2817 (GenericConstraints.EffectiveBaseClass): New public property.
2818 (TypeParameter.GenericConstraints): New public property.
2819 (ConstructedType.CheckConstraints): Improved.
2821 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
2822 (Convert.TypeParameterConversion): New private method; use this in
2823 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
2824 for all conversions related to type parameters.
2826 2004-09-24 Martin Baulig <martin@ximian.com>
2828 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2829 type parameter conversions for type parameters which are known to
2832 2004-09-24 Martin Baulig <martin@ximian.com>
2834 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2835 `IsValueType' properties.
2837 * support.cs (ReflectionConstraints): Use
2838 Type.GetGenericParameterConstraints() instead of the old hack.
2840 2004-09-24 Martin Baulig <martin@ximian.com>
2842 * generic.cs (GenericConstraints): Moved here and made it an
2845 * support.cs (GenericConstraints): Moved to generic.cs.
2847 2004-09-24 Martin Baulig <martin@ximian.com>
2850 (ReflectionConstraints): Un-nested this class and made it public.
2853 (TypeManager.GetTypeParameterConstraints): New public method.
2854 (TypeManager.HasConstructorConstraint): Use the attributes.
2856 2004-09-24 Martin Baulig <martin@ximian.com>
2858 * support.cs (GenericConstraints): Replaced `HasConstructor',
2859 `IsReferenceType' and `IsValueType' with `Attributes'.
2860 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2861 method and made the .ctor public.
2863 * generic.cs (Constraints.Attributes): New public property.
2864 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2865 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2866 `IsValueType' -> `HasValueTypeConstraint'.
2868 2004-09-23 Martin Baulig <martin@ximian.com>
2870 * generic.cs (Constraints): Reflect latest runtime changes.
2872 2004-09-23 Martin Baulig <martin@ximian.com>
2874 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2875 (Convert.ImplicitReferenceConversionExists): Likewise.
2877 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2879 * class.cs (Operator.Define): Add error 448 and 559 report.
2881 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2883 * class.cs (MemberBase.IsTypePermitted): New protected
2884 method for checking error CS0610.
2886 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2888 * class.cs (TypeContainer.HasExplicitLayout): New property
2889 Returns whether container has StructLayout attribute set Explicit.
2890 (FieldMember): New abstract class for consts and fields.
2891 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2892 (Field): Reuse FieldMember.
2894 * const.cs (Const): Reuse FieldMember.
2896 * rootcontext.cs: EmitConstants call moved to class.
2898 2004-09-22 Martin Baulig <martin@ximian.com>
2900 Marek and me just fixed one of our oldest bugs: #28562 :-)
2902 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2904 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2905 we're an EnumConstant, just return that.
2906 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2907 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2908 to get the value which'll actually be written into the attribute.
2909 However, we have to use GetValue() to access the attribute's value
2912 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2914 * constant.cs (Constant.IsNegative): New abstract property
2917 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2918 (StackAlloc.DoResolve): Reused IsNegative.
2920 2004-09-22 Martin Baulig <martin@ximian.com>
2922 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2923 public method; like LookupTypeContainer, but also works for
2926 * report.cs (Report.SymbolRelatedToPreviousError): Use
2927 TypeManager.LookupGenericTypeContainer().
2929 2004-09-22 Martin Baulig <martin@ximian.com>
2931 Thanks to Peter Sestoft for this bug report.
2933 * expression.cs (Conditional): If both the `trueExpr' and the
2934 `falseExpr' is a NullLiteral, return a NullLiteral.
2936 2004-09-22 Martin Baulig <martin@ximian.com>
2938 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2939 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2940 for the "get_Current" call.
2942 2004-09-21 Martin Baulig <martin@ximian.com>
2944 * convert.cs (Convert.ImplicitReferenceConversion): When
2945 converting to an interface type, first check whether we're
2946 converting from a reference type.
2948 2004-09-14 Martin Baulig <martin@ximian.com>
2950 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2952 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2955 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2956 called and is obsolete then this member suppress message
2957 when call is inside next [Obsolete] method or type.
2959 * expression.cs: Use TestObsoleteMethodUsage member.
2961 2004-09-14 Martin Baulig <martin@ximian.com>
2963 * genericparser.cs: Removed.
2965 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2967 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2969 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2971 * attribute.cs (Attribute.Resolve): Add error 653 report.
2973 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2975 (Method.ApplyAttributeBuilder): Add error 685 report.
2976 (Operator.Define): Add error 564 report.
2978 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2980 * expression.cs (Invocation.DoResolve): Add error
2983 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2986 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2988 * class.cs (ConstructorInitializer.Resolve):
2989 Wrong error number (515->516).
2991 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2993 * class.cs (Indexer.Define): Add error 631 report.
2995 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2997 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2999 2004-09-11 Marek Safar <marek.safar@seznam.cz>
3001 * expression.cs (Probe.DoResolve): Add error CS0241 report.
3003 2004-09-10 Marek Safar <marek.safar@seznam.cz>
3005 * cs-parser.jay: Added error CS0241 report.
3007 2004-09-10 Raja R Harinath <rharinath@novell.com>
3009 * cs-parser.jay (fixed_statement): Introduce a scope for the
3010 declaration in the 'fixed' statement.
3012 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3014 * cs-parser.jay: Added CS0230 error report.
3016 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3018 * cs-parser.jay: Added errors CS0231 and CS0257 report.
3020 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3022 * expression.cs (Argument.Resolve): Added error CS0192 and
3025 2004-09-09 Marek Safar <marek.safar@seznam.cz>
3027 C# 2.0 #pragma warning feature
3029 * cs-tokenizer.cs (PreProcessPragma): New method;
3030 Handles #pragma directive.
3032 * report.cs (WarningRegions): New class; Support
3033 class for #pragma warning directive. It tests whether
3034 warning is enabled for a given line.
3036 2004-09-08 Miguel de Icaza <miguel@ximian.com>
3038 * const.cs: Add more descriptive error report, tahnks to
3041 2004-09-08 Marek Safar <marek.safar@seznam.cz>
3043 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
3045 2004-09-07 Miguel de Icaza <miguel@ximian.com>
3047 * expression.cs: Apply patch from Ben: Remove dead code from
3048 ArrayCreation, and remove the TurnintoConstant call in const.cs,
3049 as that code just threw an exception anwyays.
3051 * const.cs: Remove the call to the turnintoconstant, for details
3054 * literal.cs: The type of the null-literal is the null type; So
3055 we use a placeholder type (literal.cs:System.Null, defined here)
3058 * expression.cs (Conditional.DoResolve): Remove some old code that
3059 is no longer needed, conversions have been fixed.
3061 (ArrayCreationExpression.DoResolve): Return false if we fail to
3062 resolve the inner expression.
3064 2004-09-07 Raja R Harinath <rharinath@novell.com>
3067 * cs-parser.jay (delegate_declaration): Record a delegate
3068 declaration as a type declaration.
3069 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
3071 2004-09-06 Miguel de Icaza <miguel@ximian.com>
3073 * parameter.cs: Do not crash if the type can not be resolved.
3075 * expression.cs: Report errors with unsafe pointers, fixes #64896
3077 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
3079 * expression.cs: Pointer arith always needs to do a conv.i
3080 if the operand is a long. fix 65320
3082 2004-09-04 Marek Safar <marek.safar@seznam.cz>
3084 Fixed cs0619-37.cs, cs0619-38.cs
3086 * enum.cs (GetObsoleteAttribute): Removed.
3088 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
3089 on Enum member is double staged. The first is tested member
3092 2004-09-04 Marek Safar <marek.safar@seznam.cz>
3094 Fixed #56986, #63631, #65231
3096 * class.cs: (TypeContainer.AddToMemberContainer): New method,
3097 adds member to name container.
3098 (TypeContainer.AddToTypeContainer): New method, adds type to
3100 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
3101 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
3102 AddOperator): Simplified by reusing AddToMemberContainer.
3103 (TypeContainer.UserDefinedStaticConstructor): Changed to property
3105 (Method.CheckForDuplications): Fixed implementation to test all
3107 (MemberBase): Detection whether member is explicit interface
3108 implementation is now in constructor.
3109 (MemberBase.UpdateMemberName): Handles IndexerName.
3110 (Accessor): Changed to keep also location information.
3111 (AbstractPropertyEventMethod): Is derived from MemberCore.
3112 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
3113 will be emited or not.
3114 (PropertyBase.AreAccessorsDuplicateImplementation):
3115 Tests whether accessors are not in collision with some method.
3116 (Operator): Is derived from MethodCore to simplify common
3119 * decl.cs (Flags.TestMethodDuplication): Test for duplication
3121 (DeclSpace.AddToContainer): Adds the member to defined_names
3122 table. It tests for duplications and enclosing name conflicts.
3124 * enum.cs (EnumMember): Clean up to reuse the base structures
3126 2004-09-03 Martin Baulig <martin@ximian.com>
3128 Merged latest changes into gmcs. Please keep this comment in
3129 here, it makes it easier for me to see what changed in MCS since
3130 the last time I merged.
3132 2004-09-03 Martin Baulig <martin@ximian.com>
3134 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
3135 into TypeContainer, to make partial classes work again.
3137 2004-09-03 Martin Baulig <martin@ximian.com>
3139 * rootcontext.cs (RootContext.V2): Removed.
3141 2004-03-23 Martin Baulig <martin@ximian.com>
3143 * expression.cs (Invocation.OverloadResolve): Added `bool
3144 may_fail' argument and use it instead of the Location.IsNull() hack.
3146 2004-09-09 Martin Baulig <martin@ximian.com>
3148 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
3150 2004-09-09 Martin Baulig <martin@ximian.com>
3152 * generic.cs (TypeParameter.DefineType): Added support for
3153 explicit interface methods.
3155 2004-09-09 Martin Baulig <martin@ximian.com>
3157 * README.Changes: New document. Started to list important changes
3158 between MCS and GMCS here.
3160 2004-09-08 Martin Baulig <martin@ximian.com>
3163 (TypeContainer.CheckRecursiveDefinition): New protected method.
3164 (TypeContainer.DefineType): Move the CS0146 check into
3165 CheckRecursiveDefinition().
3167 2004-09-06 Martin Baulig <martin@ximian.com>
3169 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
3170 types for the constructor constraint.
3172 2004-09-03 Martin Baulig <martin@ximian.com>
3174 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
3175 into TypeContainer, to make partial classes work again.
3177 2004-09-03 Martin Baulig <martin@ximian.com>
3179 * rootcontext.cs (RootContext.V2): Removed.
3181 2004-03-23 Martin Baulig <martin@ximian.com>
3183 * expression.cs (Invocation.OverloadResolve): Added `bool
3184 may_fail' argument and use it instead of the Location.IsNull() hack.
3186 2004-09-03 Martin Baulig <martin@ximian.com>
3188 Merged latest changes into gmcs. Please keep this comment in
3189 here, it makes it easier for me to see what changed in MCS since
3190 the last time I merged.
3192 2004-09-03 Raja R Harinath <rharinath@novell.com>
3195 * expression.cs (BetterConversion): Don't allow either conversion
3196 to be null. Remove redundant implicit conversion test when 'q ==
3197 null' -- when this function is invoked, we already know that the
3198 implicit conversion exists.
3199 (BetterFunction): Assume that 'best' is non-null. Remove
3200 redundant reimplementation of IsApplicable when 'best' is null.
3201 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
3202 number of arguments.
3203 (IsAncestralType): Extract from OverloadResolve.
3204 (OverloadResolve): Make robust to the MethodGroupExpr being
3205 unsorted. Implement all the logic of Section 14.5.5.1, and
3206 support overloading of methods from multiple applicable types.
3207 Clean up logic somewhat. Don't pass null methods to BetterFunction.
3209 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
3210 (RealError, Warning): Append type of report to related symbol.
3212 2004-09-03 Marek Safar <marek.safar@seznam.cz>
3214 * enum.cs: Fixed CLS-Compliance checks for enum members.
3215 Error tests cs3008-8.cs, cs3014-8.cs
3217 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3219 Fixed bug #62342, #63102
3220 * class.cs: ImplementIndexer uses member.IsExplicitImpl
3221 like ImplementMethod.
3223 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3225 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3228 2004-09-02 Martin Baulig <martin@ximian.com>
3230 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3231 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3234 2004-09-01 Marek Safar <marek.safar@seznam.cz>
3236 C# 2.0 Static classes implemented
3238 * class.cs (TypeContainer): instance_constructors,
3239 initialized_fields, initialized_static_fields,
3240 default_constructor, base_inteface_types are protected to be
3241 accessible from StaticClass.
3242 (TypeContainer.DefineDefaultConstructor): New virtual method
3243 for custom default constructor generating
3244 (StaticClass): New class to handle "Static classes" feature.
3246 * cs-parser.jay: Handle static keyword on class like instance
3249 * driver.cs: Added "/langversion" command line switch with two
3250 options (iso-1, default).
3252 2004-08-31 Marek Safar <marek.safar@seznam.cz>
3254 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
3256 2004-08-31 Miguel de Icaza <miguel@ximian.com>
3258 * delegate.cs: Style.
3260 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
3262 * delegate.cs: Add seperate instance expr field for miguel.
3264 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3266 * PointerArithmetic (Resolve): make sure we are not doing
3267 pointer arith on void*. Also, make sure we are resolved
3268 by not setting eclass until resolve.
3270 All callers: Make sure that PointerArithmetic gets resolved.
3272 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3274 * ArrayCreation (LookupType): If the type does not resolve
3275 to an array, give an error.
3277 2004-08-27 Marek Safar <marek.safar@seznam.cz>
3279 * statement.cs (Try.Resolve): Fixed bug #64222
3281 2004-08-27 Martin Baulig <martin@ximian.com>
3284 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3287 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3289 * ecore.cs (Constantify): Get underlying type via
3290 System.Enum.GetUnderlyingType to avoid StackOverflow on the
3291 Windows in special cases.
3293 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3295 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
3296 for obtaining also private methods.
3297 (GetRemoveMethod): Used GetRemoveMethod (true)
3298 for obtaining also private methods.
3300 2004-09-02 Martin Baulig <martin@ximian.com>
3302 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3303 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3306 2004-08-27 Martin Baulig <martin@ximian.com>
3309 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3312 2004-08-25 Martin Baulig <martin@ximian.com>
3314 * support.cs (ReflectionParameters..ctor): If this is a generic
3315 method, retrieve and store its type parameters.
3316 (InternalParameters..ctor): Added `TypeParameter[]' argument.
3317 (ReflectionParameters.GenericConstraints): The argument specifies
3318 the type parameter, not the method parameter.
3319 (InternalParameters.GenericConstraints): Likewise.
3321 * generic.cs (TypeParameter.DefineType): Correctly handle
3322 constraints wrt. generic methods in interfaces and their
3325 2004-08-24 Martin Baulig <martin@ximian.com>
3327 * generic.cs (TypeParameter.IsSubclassOf): New public method.
3328 (Constraints.IsSubclassOf): New internal method.
3330 * typemanager.cs (TypeManager.FindMembers): Added special support
3331 for GenericTypeParameterBuilder's.
3332 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
3335 2004-08-24 Martin Baulig <martin@ximian.com>
3338 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
3339 this for accessibility checks.
3340 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
3341 IsNestedFamilyAccessible.
3342 (TypeManager.IsSubclassOf): New method, do what the name actually
3345 2004-08-24 Martin Baulig <martin@ximian.com>
3347 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
3348 as a SimpleName, include the generic arity.
3350 2004-08-24 Martin Baulig <martin@ximian.com>
3352 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
3353 MethodAttributes.HideBySig for operators.
3355 2004-08-23 Martin Baulig <martin@ximian.com>
3357 Back to the old error reporting system :-)
3359 * report.cs (Message): Removed.
3360 (Report.MessageData, ErrorData, WarningData): Removed.
3361 (Report.Error, Warning): Back to the old system.
3363 2004-08-23 Martin Baulig <martin@ximian.com>
3365 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
3367 * class.cs (TypeContainer.ParentContainer): New public virtual
3368 method; replaces the explicit interface implementation.
3369 (ClassPart.ParentContainer): Override.
3371 2004-08-23 Martin Baulig <martin@ximian.com>
3373 * statement.cs (Switch): Added support for constant switches; see
3374 #59428 or test-285.cs.
3376 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3379 * statement.cs (GetEnumeratorFilter): Removed useless
3380 logic because C# specs is strict. GetEnumerator must be
3383 2004-08-22 Martin Baulig <martin@ximian.com>
3385 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3386 a switch and may break, reset the barrier. Fixes #59867.
3388 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3390 CLS-Compliance speed up (~5% for corlib)
3392 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
3393 New method. Tests container for CLS-Compliant names
3395 * class.cs (TypeContainer.VerifyClsName): New method.
3396 Checks whether container name is CLS Compliant.
3397 (Constructor): Implements IMethodData.
3399 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3400 low-case table for CLS Compliance test.
3401 (MemberCache.VerifyClsParameterConflict): New method.
3402 Checks method parameters for CS3006 error.
3404 * enum.cs (EnumMember): Is derived from MemberCore.
3405 (Enum.VerifyClsName): Optimized for better performance.
3407 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3409 * report.cs: Renamed Error_T to Error and changed all
3412 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3414 * class.cs (TypeContainer.IndexerArrayList): New inner class
3415 container for indexers.
3416 (TypeContainer.DefaultIndexerName): New constant for default
3417 indexer name. Replaced all "Item" with this constant.
3418 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3420 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3421 DefaultMemberAttribute constructor.
3423 2004-08-05 Martin Baulig <martin@ximian.com>
3425 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3428 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3430 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3431 multi platforms problem.
3433 * compiler.csproj: Included shared files.
3435 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3437 Fix bug 60333, 55971 in the more general way
3438 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3439 Added arg_type argument for constant conversion.
3440 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3442 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3445 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3446 OperatorArrayList, MethodCoreArrayList for typecontainer
3447 containers. Changed class member types to these new types.
3448 (MethodArrayList.DefineMembers): Added test for CS0659.
3450 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3452 * cfold.cs: Synchronize the folding with the code in expression.cs
3453 Binary.DoNumericPromotions for uint operands.
3455 * attribute.cs: Revert patch from Raja, it introduced a regression
3456 while building Blam-1.2.1 (hard to isolate a test case).
3458 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3462 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3464 (MethodCore.parent_method): New member. The method we're overriding
3465 if this is an override method.
3466 (MethodCore.CheckBase): Moved from Method class and made common.
3467 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3469 (MethodCore.CheckForDuplications): New abstract method. For custom
3470 member duplication search in a container
3471 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3472 method and its return type.
3473 (Event.conflict_symbol): New member. Symbol with same name in the
3477 (MemberCache.FindMemberWithSameName): New method. The method
3478 is looking for conflict with inherited symbols.
3480 2004-08-04 Martin Baulig <martin@ximian.com>
3482 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3484 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3486 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3488 * report.cs (Message): New enum for better error, warning reference in
3490 (MessageData): New inner abstract class. It generally handles printing of
3491 error and warning messages.
3492 Removed unused Error, Warning, Message methods.
3494 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3496 Fix for cs0592-8.cs test
3498 (Attributable.ValidAttributeTargets): Made public.
3499 (Attribute.ExplicitTarget): New member for explicit target value.
3500 (Attribute.CheckTargets): Now we translate explicit attribute
3501 target to Target here.
3503 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3505 * ecore.cs (MethodGroupExpr): new IsBase property.
3507 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3509 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3510 rather than an instance expr.
3512 (DelegateCreation.Emit): Use the method group rather than
3513 the instance expression. Also, if you have base.Foo as the
3514 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3516 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3518 (NewDelegate.DoResolve): Only check for the existance of Invoke
3519 if the method is going to be needed. Use MethodGroupExpr.
3521 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3523 * expression.cs: For pointer arith., make sure to use
3524 the size of the type, not the size of the pointer to
3527 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3530 * class.cs (Class): Added error CS0502 test.
3532 2004-08-03 John Luke <jluke@cfl.rr.com>
3533 Raja R Harinath <rharinath@novell.com>
3536 * attribute.cs (Attribute.complained_before): New flag.
3537 (Attribute.ResolveType, Attribute.Resolve),
3538 (Attribute.DefinePInvokeMethod): Set it.
3539 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3541 2004-08-03 Martin Baulig <martin@ximian.com>
3543 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3544 use a user-defined operator; we still need to do numeric
3545 promotions in case one argument is a builtin type and the other
3546 one has an implicit conversion to that type. Fixes #62322.
3548 2004-08-18 Martin Baulig <martin@ximian.com>
3550 * class.cs (Method.Define): Use the correct method name when
3551 creating the MethodBuilder for a generic method.
3553 2004-08-17 Martin Baulig <martin@ximian.com>
3555 * generic.cs (Constraints): Support type parameter constraints.
3557 2004-08-16 Martin Baulig <martin@ximian.com>
3559 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
3560 (Token.GENERIC_DIMENSION): New token; this is returned if we
3561 encounter an unbound generic type in a typeof() expression.
3563 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
3564 this token is only generated while parsing a typeof() expression.
3565 (typeof_expression): Removed the old unbound_type hack.
3567 * generic.cs (TypeArguments.IsUnbound): New public property.
3569 * decl.cs (MemberName): Added support for unbound types.
3571 2004-08-14 Martin Baulig <martin@ximian.com>
3574 (TypeManager.IsEqualGenericInstance): New static method.
3575 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
3576 just used to check accessibility, so follow the rules of 26.1.6.
3578 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
3579 ConstructedType instead of a TypeExpression if we have type arguments.
3581 * cs-parser.jay (typeof_expression): Support unbound generic types.
3583 * ecore.cs (UnboundTypeExpression): New public class.
3585 2004-08-12 Martin Baulig <martin@ximian.com>
3587 * typemanager.cs (TypeManager.IsNestedChildOf): Use
3588 TypeManager.IsEqual() rather than `=='.
3590 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
3591 generic instances as well.
3593 2004-08-12 Martin Baulig <martin@ximian.com>
3595 * expression.cs (Invocation.InferType): We can only infer method
3596 type parameters. Fixes #62647.
3598 2004-08-11 Martin Baulig <martin@ximian.com>
3600 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
3601 before resolving the base classes.
3603 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3605 * Makefile: install .mdb file too.
3607 2004-08-05 Martin Baulig <martin@ximian.com>
3609 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
3610 initializer, the current type is just the TypeBuilder, not the
3611 instantiated generic type.
3612 (FieldExpr.IsFieldInitializer): New public property.
3614 2004-08-04 Martin Baulig <martin@ximian.com>
3616 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3618 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3620 2004-08-03 Martin Baulig <martin@ximian.com>
3622 * class.cs (MethodData.Define): If we're an explicit
3623 implementation, remove the generic arity from the type name.
3625 2004-08-03 Martin Baulig <martin@ximian.com>
3627 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3628 use a user-defined operator; we still need to do numeric
3629 promotions in case one argument is a builtin type and the other
3630 one has an implicit conversion to that type. Fixes #62322.
3632 2004-08-02 Martin Baulig <martin@ximian.com>
3634 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
3636 (TypeContainer.GetClassBases): Return the unexpanded list of
3637 interfaces; we expand them later.
3638 (TypeContainer.DefineType): After creating the TypeBuilder, call
3639 TypeManager.ExpandInterfaces() to get an expanded and resolved
3642 * ecore.cs (TypeExpr.GetInterfaces): Removed
3644 * generics.cs (Constraints.InterfaceConstraints): Remove.
3645 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
3646 register the interface constraints.
3649 (TypeManager.AddUserType): Removed the `ifaces' argument.
3650 (TypeManager.AddTypeParameter): Likewise.
3651 (TypeManager.AddUserInterface): Removed, was unused.
3652 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
3653 `TypeExpr[]' array for the interfaces.
3654 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
3655 has been defined, returns a list of the resolved interfaces types.
3656 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
3657 (TypeManager.GetExplicitInterfaces): Likewise.
3659 2004-08-02 Martin Baulig <martin@ximian.com>
3661 * expression.cs (Invocation.EmitCall): If we're invoking a method
3662 on a type parameter, use the new `Constrained' prefix opcode.
3664 2004-08-02 Martin Baulig <martin@ximian.com>
3666 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3667 (LocalInfo.IsThis): New public property.
3668 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3670 2004-08-01 Martin Baulig <martin@ximian.com>
3672 * class.cs (TypeContainer.GetClassBases): Don't set the default
3673 here since we may get called from GetPartialBases().
3674 (TypeContainer.DefineType): If GetClassBases() didn't return a
3675 parent, use the default one.
3677 2004-07-30 Martin Baulig <martin@ximian.com>
3679 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3681 * class.cs (SourceMethod): New public class, derive from the
3682 symbol writer's ISourceMethod.
3683 (Method): Use the new symbol writer API.
3685 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3686 as argument and use the new symbol writer.
3689 (SourceFile): Implement the symbol writer's ISourceFile.
3690 (Location.SymbolDocument): Removed.
3691 (Location.SourceFile): New public property.
3693 * symbolwriter.cs: Use the new symbol writer API.
3695 2004-07-30 Raja R Harinath <rharinath@novell.com>
3697 * Makefile (install-local): Remove. Functionality moved to
3700 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3702 * Makefile: Install mcs.exe.config file together with mcs.exe.
3703 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3704 correct runtime version.
3706 2004-07-25 Martin Baulig <martin@ximian.com>
3709 (TypeContainer.RegisterOrder): Removed, this was unused.
3710 (TypeContainer, interface_order): Removed.
3711 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3712 TypeContainer as argument since we can also be called with a
3713 `PartialContainer' for a partial class/struct/interface.
3714 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3715 of checking whether we're an `Interface' - we could be a
3717 (PartialContainer.Register): Override; call
3718 AddClass()/AddStruct()/AddInterface() on our parent.
3720 * cs-parser.jay (interface_member_declaration): Add things to the
3721 `current_container', not the `current_class'.
3723 * rootcontext.cs (RegisterOrder): The overloaded version which
3724 takes an `Interface' was unused, removed.
3726 * typemanager.cs (TypeManager.LookupInterface): Return a
3727 `TypeContainer', not an `Interface'.
3728 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3729 contain a `PartialContainer' for an interface, so check it's
3730 `Kind' to figure out what it is.
3732 2004-07-25 Martin Baulig <martin@ximian.com>
3734 * class.cs (Class.DefaultTypeAttributes): New public constant.
3735 (Struct.DefaultTypeAttributes): Likewise.
3736 (Interface.DefaultTypeAttributes): Likewise.
3737 (PartialContainer.TypeAttr): Override this and add the
3738 DefaultTypeAttributes.
3740 2004-07-25 Martin Baulig <martin@ximian.com>
3742 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3743 we can just use the `Parent' field instead.
3745 2004-07-25 Martin Baulig <martin@ximian.com>
3747 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3749 2004-07-25 Martin Baulig <martin@ximian.com>
3751 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3752 our parts before defining any methods.
3753 (TypeContainer.VerifyImplements): Make this virtual.
3754 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3755 on our PartialContainer.
3757 2004-07-25 Martin Baulig <martin@ximian.com>
3759 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3761 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3762 argument, we can just use the `Parent' field instead.
3765 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3766 (MemberBase.DoDefine): Likewise.
3768 2004-07-24 Martin Baulig <martin@ximian.com>
3770 * decl.cs (MemberCore.Parent): New public field.
3771 (DeclSpace.Parent): Moved to MemberCore.
3773 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3774 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3776 (FieldBase, Field, Operator): Likewise.
3777 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3778 (EventField, Event): Likewise.
3780 2004-07-23 Martin Baulig <martin@ximian.com>
3782 * class.cs (PartialContainer): New public class.
3783 (ClassPart): New public class.
3784 (TypeContainer): Added support for partial classes.
3785 (TypeContainer.GetClassBases): Splitted some of the functionality
3786 out into GetNormalBases() and GetPartialBases().
3788 * cs-tokenizer.cs (Token.PARTIAL): New token.
3789 (Tokenizer.consume_identifier): Added some hacks to recognize
3790 `partial', but only if it's immediately followed by `class',
3791 `struct' or `interface'.
3793 * cs-parser.jay: Added support for partial clases.
3795 2004-07-23 Martin Baulig <martin@ximian.com>
3797 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3798 a `DeclSpace' and also made it readonly.
3799 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3800 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3801 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3803 * cs-parser.jay: Pass the `current_class', not the
3804 `current_container' (at the moment, this is still the same thing)
3805 to a new Method, Property, Event, Indexer or Constructor.
3807 2004-07-23 Martin Baulig <martin@ximian.com>
3809 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3810 and removed the `current_interface' one.
3811 (struct_declaration, class_declaration, interface_declaration):
3812 Set `current_class' to the newly created class/struct/interface;
3813 set their `Bases' and call Register() before parsing their body.
3815 2004-07-23 Martin Baulig <martin@ximian.com>
3817 * class.cs (Kind): New public enum.
3818 (TypeContainer): Made this class abstract.
3819 (TypeContainer.Kind): New public readonly field.
3820 (TypeContainer.CheckDef): New public method; moved here from
3822 (TypeContainer.Register): New public abstract method.
3823 (TypeContainer.GetPendingImplementations): New public abstract
3825 (TypeContainer.GetClassBases): Removed the `is_class' and
3826 `is_iface' parameters.
3827 (TypeContainer.DefineNestedTypes): Formerly known as
3829 (ClassOrStruct): Made this class abstract.
3831 * tree.cs (RootTypes): New public type.
3833 2004-07-20 Martin Baulig <martin@ximian.com>
3835 * tree.cs (Tree.RecordNamespace): Removed.
3836 (Tree.Namespaces): Removed.
3838 * rootcontext.cs (RootContext.IsNamespace): Removed.
3840 * cs-parser.jay (namespace_declaration): Just create a new
3841 NamespaceEntry here.
3843 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3845 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3846 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3847 entry to make sure it runs in the correct runtime version.
3849 2004-07-18 Martin Baulig <martin@ximian.com>
3851 * generic.cs (ConstructedType.CheckConstraints): Improved
3852 constraints checking.
3854 2004-07-18 Martin Baulig <martin@ximian.com>
3856 * expression.cs (Invocation.BetterMethod): Call
3857 TypeManager.TypeToCoreType() on all types and removed my previous
3858 hack; we're already doig the right thing here.
3860 2004-07-17 Martin Baulig <martin@ximian.com>
3862 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3864 2004-07-16 Martin Baulig <martin@ximian.com>
3866 * iterators.cs: Added generics support.
3868 2004-07-16 Martin Baulig <martin@ximian.com>
3870 * iterators.cs: Rewrote this. We're now using one single Proxy
3871 class for both the IEnumerable and the IEnumerator interface and
3872 `Iterator' derives from Class so we can use the high-level API.
3874 * class.cs (TypeContainer.AddIterator): New method.
3875 (TypeContainer.DoDefineType): New protected virtual method, which
3876 is called from DefineType().
3877 (TypeContainer.DoDefineMembers): Call DefineType() and
3878 DefineMembers() on all our iterators.
3879 (TypeContainer.Emit): Call Emit() on all our iterators.
3880 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3882 * codegen.cs (EmitContext.CurrentIterator): New public field.
3884 2004-07-15 Martin Baulig <martin@ximian.com>
3887 (TypeManager.not_supported_exception_type): New type.
3889 2004-07-14 Martin Baulig <martin@ximian.com>
3892 (TypeManager.generic_ienumerable_type): New type.
3893 (TypeManager.generic_ienumerator_type): New type.
3896 (RootContext.interfaces_first_stage): Added
3897 "System.Collections.Generic.IEnumerator`1" and
3898 "System.Collections.Generic.IEnumerable`1".
3900 2004-07-14 Martin Baulig <martin@ximian.com>
3902 * iterators.cs: Use real error numbers.
3904 2004-07-14 Martin Baulig <martin@ximian.com>
3906 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3907 requires this to be a System.Collection.IEnumerable and not a
3908 class implementing that interface.
3909 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3911 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3913 * class.cs: Fixed previous fix, it broke some error tests.
3915 2004-07-12 Martin Baulig <martin@ximian.com>
3917 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3920 2004-07-14 Martin Baulig <martin@ximian.com>
3922 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3923 an exclamation mark (!) for the generic arity to reflect the
3924 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3926 2004-07-13 Martin Baulig <martin@ximian.com>
3928 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3929 specifiers being part of a type argument.
3931 2004-07-13 Martin Baulig <martin@ximian.com>
3933 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3934 name for generic types.
3936 2004-07-13 Martin Baulig <martin@ximian.com>
3938 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3941 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3943 * assign.cs (LocalTemporary): Add new argument: is_address,If
3944 `is_address' is true, then the value that we store is the address
3945 to the real value, and not the value itself.
3947 * ecore.cs (PropertyExpr): use the new local temporary
3948 stuff to allow us to handle X.Y += z (where X is a struct)
3950 2004-07-08 Martin Baulig <martin@ximian.com>
3952 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3953 not always return, just like we're doing in Using.Resolve().
3955 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3957 * cs-parser.jay (fixed_statement): flag this as Pinned.
3959 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3961 * typemanager.cs (TypeManager): Removed MakePinned method, this
3962 mechanism is replaced with the .NET 2.x compatible mechanism of
3963 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3965 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3966 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3967 `IsFixed' property which has a different meaning.
3969 2004-07-02 Raja R Harinath <rharinath@novell.com>
3971 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3972 visible from inside a nested class, not just the names of the
3973 immediately enclosing class.
3976 2004-06-24 Raja R Harinath <rharinath@novell.com>
3978 * expression.cs (BetterConversion): Remove buggy special-case
3979 handling of "implicit constant expression conversions". At this
3980 point, we already know that the conversion is possible -- we're
3981 only checking to see which is better.
3983 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3985 * cs-parser.jay: Added error CS0210 test.
3987 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3989 * cs-parser.jay: Added error CS0134 test.
3991 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3994 * cs-parser.jay: Added error CS0145 test.
3996 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3998 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
4000 2004-06-23 Ben Maurer <bmaurer@ximian.com>
4002 * expression.cs (StackAlloc.Resolve): The argument may not
4003 be a constant; deal with this case.
4005 2004-06-23 Marek Safar <marek.safar@seznam.cz>
4007 * attribute.cs (IndexerName_GetIndexerName): Renamed to
4008 GetIndexerAttributeValue.
4009 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
4011 * class.cs (Indexer.Define): Added error tests for CS0415,
4014 2004-06-23 Miguel de Icaza <miguel@ximian.com>
4016 * attribute.cs (Attribute.Resolve): Keep field code in sync with
4019 2004-06-23 Martin Baulig <martin@ximian.com>
4021 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
4022 neither return nor throw, reset the barrier as well. Fixes #60457.
4024 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
4026 * class.cs : EventAttributes is now set to None by default.
4027 This fixes bug #60459.
4029 2004-06-18 Marek Safar <marek.safar@seznam.cz>
4032 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4033 Don't throw exception but return null (it's sufficient now).
4035 2004-06-18 Marek Safar <marek.safar@seznam.cz>
4037 * typemanager.cs (GetArgumentTypes): Faster implementation.
4039 2004-06-18 Martin Baulig <martin@ximian.com>
4041 * attribute.cs (Attribute.Resolve): Check whether we're an
4042 EmptyCast which a Constant child. Fixes #60333.
4044 2004-06-17 Ben Maurer <bmaurer@ximian.com>
4046 * statement.cs (EmitCollectionForeach): Account for the fact that
4047 not all valuetypes are in areas which we can take the address of.
4048 For these variables, we store to a temporary variable. Also, make
4049 sure that we dont emit a `callvirt' on a valuetype method.
4051 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4053 * expression.cs (StackAlloc.DoReSolve): Added test for
4054 negative parameter (CS0247).
4056 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4059 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
4061 2004-06-15 Marek Safar <marek.safar@seznam.cz>
4064 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
4067 2004-06-14 Marek Safar <marek.safar@seznam.cz>
4069 Fix bug #58254 & cs1555.cs, cs1556.cs
4070 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
4072 2004-06-14 Marek Safar <marek.safar@seznam.cz>
4074 * cs-parser.jay: Added error CS1669 test for indexers.
4076 2004-06-18 Martin Baulig <martin@ximian.com>
4078 * generics.cs (GenericMethod.ctor): Don't take an Attributes
4079 argument. Fixes #60441.
4081 2004-06-16 Ben Maurer <bmaurer@ximian.com>
4082 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
4083 The name needs to have the actual name of the method in order
4084 for other tests (such as the one in OverloadResolve for Invoke
4085 on a delegate) to work. As well, it does not really help
4086 error reporting because the method group had multiple methods.
4087 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
4088 Make profiling work.
4090 2004-06-13 Martin Baulig <martin@ximian.com>
4092 * cs-parser.jay: Don't allow generic attributes.
4094 2004-06-13 Martin Baulig <martin@ximian.com>
4096 * class.cs (MemberBase.DoDefineBase): New protected method.
4097 (MemberBase.DoDefine): Compute the `flags' in the new
4098 DoDefineBase() which must be called first.
4099 (Method.Define): Call DoDefineBase() first so we have the flags
4100 when defining the generic method.
4102 * cs-parser.jay (interface_method_declaration): Support generic methods.
4104 2004-06-13 Martin Baulig <martin@ximian.com>
4106 * decl.cs (TypeName): Removed.
4107 (MemberName): Removed TypeName and MemberNow; now we just have
4110 * cs-parser.jay: Don't distinguish between type arguments and type
4111 parameters in the grammar and simplified the rules a bit. The
4112 reduce/reduce conflicts are now gone (except the one we inherited
4115 2004-06-11 Martin Baulig <martin@ximian.com>
4117 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
4118 call this twice: for params and varargs methods.
4120 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4123 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
4125 2004-06-11 Marek Safar <marek.safar@seznam.cz>
4127 * attribute.cs (Attribute.GetValidTargets): Made public.
4130 (AbstractPropertyEventMethod): New class for better code sharing.
4131 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
4133 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
4135 2004-06-09 Martin Baulig <martin@ximian.com>
4137 * cs-parser.jay: Removed a reduce/reduce conflict.
4139 2004-06-03 Martin Baulig <martin@ximian.com>
4141 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
4142 GetSimpleName() and return a SimpleName.
4144 * ecore.cs (SimpleName.Arguments): New public field.
4145 (SimpleName): Added overloaded ctor which takes an additional
4146 TypeArguments argument.
4147 (SimpleName.SimpleNameResolve): Added support for generic methods.
4148 (MethodGroupExpr.ResolveGeneric): New public method. The code was
4149 formerly in MemberAccess.DoResolve(), but we also need it in
4150 SimpleNameResolve().
4152 * expression.cs (MemberAccess.DoResolve): Use the new
4153 MethodGroupExpr.ResolveGeneric().
4155 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4157 * decl.cs: If possible, use lookuptypedirect here. We can only do
4158 this if there is no `.' after the namespace. Avoids using
4159 LookupType, which does lots of slow processing.
4160 (FindNestedType) New method, does what it says :-).
4161 * namespace.cs: use LookupTypeDirect.
4162 * rootcontext.cs: use membercache, if possible.
4163 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
4165 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4168 According to the spec,
4170 In a member access of the form E.I, if E is a single identifier,
4171 and if the meaning of E as a simple-name (§7.5.2) is a constant,
4172 field, property, localvariable, or parameter with the same type as
4173 the meaning of E as a type-name (§3.8), then both possible
4174 meanings of E are permitted.
4176 We did not check that E as a simple-name had the same type as E as
4179 This trivial check gives us 5-7% on bootstrap time.
4181 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4183 * expression.cs (Invocation.OverloadResolve): Avoid the
4184 use of hashtables and boxing here by allocating on demand.
4186 2004-05-30 Martin Baulig <martin@ximian.com>
4188 * rootcontext.cs (RootContext.LookupType): Don't cache things if
4189 we're doing a silent lookup. Don't try to lookup nested types in
4190 TypeManager.object_type (thanks to Ben Maurer).
4192 2004-05-30 Martin Baulig <martin@ximian.com>
4194 Committing a patch from Ben Maurer.
4196 * rootcontext.cs (RootContext.LookupType): Cache negative results.
4198 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4200 * convert.cs: add a trivial cache for overload operator resolution.
4202 2004-05-31 Marek Safar <marek.safar@seznam.cz>
4205 (AttributeTester.GetObsoleteAttribute): Returns instance of
4206 ObsoleteAttribute when type is obsolete.
4209 (TypeContainer.VerifyObsoleteAttribute): Override.
4210 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
4211 (MethodCode.VerifyObsoleteAttribute): Override.
4212 (MemberBase.VerifyObsoleteAttribute): Override.
4215 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
4216 and report proper error.
4219 (Delegate.VerifyObsoleteAttribute): Override.
4222 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
4223 and report proper error.
4224 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
4227 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
4231 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
4232 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
4233 Added test for ObsoleteAttribute.
4236 (Catch): Derived from Statement.
4238 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4240 * decl.cs: If possible, use lookuptypedirect here. We can only do
4241 this if there is no `.' after the namespace. Avoids using
4242 LookupType, which does lots of slow processing.
4243 (FindNestedType) New method, does what it says :-).
4244 * namespace.cs: use LookupTypeDirect.
4245 * rootcontext.cs: use membercache, if possible.
4246 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
4248 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4251 According to the spec,
4253 In a member access of the form E.I, if E is a single identifier,
4254 and if the meaning of E as a simple-name (§7.5.2) is a constant,
4255 field, property, localvariable, or parameter with the same type as
4256 the meaning of E as a type-name (§3.8), then both possible
4257 meanings of E are permitted.
4259 We did not check that E as a simple-name had the same type as E as
4262 This trivial check gives us 5-7% on bootstrap time.
4264 2004-05-30 Marek Safar <marek.safar@seznam.cz>
4266 Fixed bug #59071 & cs0160.cs
4267 * statement.cs (Try.Resolve): Check here whether order of catch
4268 clauses matches their dependencies.
4270 2004-05-30 Marek Safar <marek.safar@seznam.cz>
4273 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
4276 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4278 * expression.cs (Invocation.OverloadResolve): Avoid the
4279 use of hashtables and boxing here by allocating on demand.
4281 2004-05-30 Martin Baulig <martin@ximian.com>
4283 * rootcontext.cs (RootContext.LookupType): Don't cache things if
4284 we're doing a silent lookup. Don't try to lookup nested types in
4285 TypeManager.object_type (thanks to Ben Maurer).
4287 2004-05-30 Martin Baulig <martin@ximian.com>
4289 Committing a patch from Ben Maurer.
4291 * rootcontext.cs (RootContext.LookupType): Cache negative results.
4293 2004-05-29 Martin Baulig <martin@ximian.com>
4295 * class.cs (IMethodData.ShouldIgnore): New method.
4297 * typemanager.cs (TypeManager.MethodFlags): Don't take a
4298 `Location' argument, we don't need it anywhere. Use
4299 `IMethodData.ShouldIgnore ()' instead of
4300 `MethodData.GetMethodFlags ()'.
4301 (TypeManager.AddMethod): Removed.
4302 (TypeManager.AddMethod2): Renamed to AddMethod.
4304 2004-05-29 Martin Baulig <martin@ximian.com>
4306 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
4308 * convert.cs (Convert.ImplicitReferenceConversion): If we're
4309 converting from a class type S to an interface type and we already
4310 have an object on the stack, don't box it again. Fixes #52578.
4312 2004-05-29 Martin Baulig <martin@ximian.com>
4314 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4315 Added support for `params' parameters. Fixes #59267.
4317 2004-05-29 Martin Baulig <martin@ximian.com>
4319 * literal.cs (NullPointer): Provide a private .ctor which sets
4320 `type' to TypeManager.object_type. Fixes #59048.
4322 2004-05-29 Martin Baulig <martin@ximian.com>
4324 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
4325 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
4327 * ecore.cs (EventExpr.instance_expr): Make the field private.
4329 2004-05-26 Marek Safar <marek.safar@seznam.cz>
4331 Fixed bug #50080 & cs0214-2.cs
4332 * expression.cs (Cast.DoResolve): Check unsafe context here.
4334 * statement.cs (Resolve.DoResolve): Likewise.
4336 2004-05-26 Martin Baulig <martin@ximian.com>
4338 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
4340 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
4341 (RootContext.LookupType): Pass down the `silent' flag.
4343 2004-05-25 Martin Baulig <martin@ximian.com>
4346 (MethodGroupExpr.IdenticalTypeName): New public property.
4347 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
4348 expression actually refers to a type.
4350 2004-05-25 Martin Baulig <martin@ximian.com>
4352 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
4353 for #56176 and made it actually work.
4355 2004-05-25 Martin Baulig <martin@ximian.com>
4357 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
4358 (FieldExpr, PropertyExpr): Override and implement
4359 CacheTemporaries. Fixes #52279.
4361 2004-05-25 Miguel de Icaza <miguel@ximian.com>
4363 * location.cs: In the new compiler listing a file twice is a
4364 warning, not an error.
4366 2004-05-24 Martin Baulig <martin@ximian.com>
4368 * enum.cs (Enum.DefineType): For the `BaseType' to be a
4369 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
4371 2004-05-24 Martin Baulig <martin@ximian.com>
4373 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
4374 walking the `using' list. Fixes #53921.
4376 2004-05-24 Martin Baulig <martin@ximian.com>
4378 * const.cs (Const.LookupConstantValue): Added support for
4379 EmptyCast's; fixes #55251.
4381 2004-05-24 Martin Baulig <martin@ximian.com>
4383 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
4384 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
4385 which does the CS0135 check. The reason is that we first need to
4386 check whether the variable actually exists.
4388 2004-05-24 Martin Baulig <martin@ximian.com>
4390 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
4391 than RootContext.LookupType() to find the explicit interface
4394 2004-05-24 Raja R Harinath <rharinath@novell.com>
4396 * Makefile: Simplify. Use executable.make.
4397 * mcs.exe.sources: New file. List of sources of mcs.exe.
4399 2004-05-24 Anders Carlsson <andersca@gnome.org>
4403 Use the invariant culture when doing String.Compare for CLS case
4406 2004-05-23 Martin Baulig <martin@ximian.com>
4408 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4409 don't have any dots. Fixes #52622, added cs0246-8.cs.
4411 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4413 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4415 * class.cs (MemberBase.Define): Reuse MemberType member for
4416 resolved type. Other methods can use it too.
4418 2004-05-23 Martin Baulig <martin@ximian.com>
4420 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4421 the variable also exists in the current block (otherwise, we need
4422 to report a CS0103). Fixes #58670.
4424 2004-05-23 Martin Baulig <martin@ximian.com>
4426 * flowanalysis.cs (Reachability.Reachable): Compute this
4427 on-the-fly rather than storing it as a field.
4429 2004-05-23 Martin Baulig <martin@ximian.com>
4431 * flowanalysis.cs (Reachability.And): Manually compute the
4432 resulting `barrier' from the reachability.
4434 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4437 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4438 instance of ObsoleteAttribute when symbol is obsolete.
4441 (IMethodData): Extended interface for ObsoleteAttribute support.
4443 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4445 * attribute.cs: Fix bug #55970
4447 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4451 (GetObsoleteAttribute): New method. Creates the instance of
4453 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4454 ObsoleteAttribute when member is obsolete.
4455 (AttributeTester.Report_ObsoleteMessage): Common method for
4456 Obsolete error/warning reporting.
4459 (TypeContainer.base_classs_type): New member for storing parent type.
4462 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4463 for this MemberCore.
4465 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4467 * attribute.cs, const.cs: Fix bug #58590
4469 2004-05-21 Martin Baulig <martin@ximian.com>
4471 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4472 out parameters if the end of the method is unreachable. Fixes
4475 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4477 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4478 Hari was right, why extra method.
4480 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4482 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4484 2004-05-20 Martin Baulig <martin@ximian.com>
4486 * delegate.cs: Convert this file to Unix mode - like the original
4489 2004-05-20 Martin Baulig <martin@ximian.com>
4491 * attribute.cs: Convert this file to Unix mode - like the original
4494 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4496 Fix bug #58688 (MCS does not report error when the same attribute
4499 * attribute.cs (Attribute.Emit): Distinction between null and default.
4501 2004-05-19 Raja R Harinath <rharinath@novell.com>
4503 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4504 of a top-level attribute without an attribute target.
4505 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4507 (Attribute.Conditional_GetConditionName),
4508 (Attribute.Obsolete_GetObsoleteMessage): Update.
4509 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4510 part of ScanForIndexerName.
4511 (Attribute.CanIgnoreInvalidAttribute): New function.
4512 (Attribute.ScanForIndexerName): Move to ...
4513 (Attributes.ScanForIndexerName): ... here.
4514 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4515 (Attributes.Search): New internal variant that can choose not to
4516 complain if types aren't resolved. The original signature now
4518 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4519 complaints suppressed.
4520 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4521 only if it not useful.
4522 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4523 top-level for attributes that are shared between the assembly
4524 and a top-level class.
4525 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4526 * class.cs: Update to reflect changes.
4527 (DefineIndexers): Fuse loops.
4528 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4529 a couple more variants of attribute names.
4531 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4533 Fix bug #52585 (Implemented explicit attribute declaration)
4536 (Attributable.ValidAttributeTargets): New abstract method. It gets
4537 list of valid attribute targets for explicit target declaration.
4538 (Attribute.Target): It holds target itself.
4539 (AttributeSection): Removed.
4540 (Attribute.CheckTargets): New method. It checks whether attribute
4541 target is valid for the current element.
4544 (EventProperty): New class. For events that are declared like
4545 property (with add and remove accessors).
4546 (EventField): New class. For events that are declared like field.
4549 * cs-parser.jay: Implemented explicit attribute target declaration.
4551 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4552 Override ValidAttributeTargets.
4555 (ReturnParameter): Class for applying custom attributes on
4557 (ParameterAtribute): New class. Class for applying custom
4558 attributes on the parameter type.
4560 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4562 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4565 (Method): Allow UNSAFE here.
4567 * modifiers.cs: Support unsafe reporting.
4569 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4571 * decl.cs: Fix bug #58478.
4573 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4575 * statement.cs: When checking for unreachable code on an EmptyStatement,
4576 set the location. Fixes bug #58488.
4578 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4580 * driver.cs: Add -pkg handling.
4582 From Gonzalo: UseShelLExecute=false
4584 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4587 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4589 (Attribute.IsClsCompliaceRequired): Moved to base for better
4591 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4592 when attribute is AttributeUsageAttribute.
4593 (Attribute.GetValidTargets): Simplified.
4594 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4595 attribute for this type.
4596 (Attribute.ApplyAttributes): Method renamed to Emit and make
4598 (GlobalAttributeSection): New class for special handling of global
4599 attributes (assembly, module).
4600 (AttributeSection.Emit): New method.
4602 * class.cs: Implemented Attributable abstract methods.
4603 (MethodCore.LabelParameters): Moved to Parameter class.
4604 (Accessor): Is back simple class.
4605 (PropertyMethod): Implemented Attributable abstract class.
4606 (DelegateMethod): Implemented Attributable abstract class.
4607 (Event): New constructor for disctintion between normal Event
4608 and Event with accessors.
4610 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4612 * codegen.cs, const.cs, decl.cs, delegate.cs:
4613 (CommonAssemblyModulClass): Implemented Attributable abstract class
4616 * enum.cs: Implement IAttributeSupport interface.
4617 (EnumMember): New class for emum members. Implemented Attributable
4621 (ParameterBase): Is abstract.
4622 (ReturnParameter): New class for easier [return:] attribute handling.
4624 * typemanager.cs: Removed builder_to_attr.
4626 2004-05-11 Raja R Harinath <rharinath@novell.com>
4629 * attribute.cs (Attribute.GetPositionalValue): New function.
4630 * class.cs (TypeContainer.VerifyMembers): New function.
4631 (TypeContainer.Emit): Use it.
4632 (ClassOrStruct): New base class for Class and Struct.
4633 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4634 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4636 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4637 then each non-static field should have a FieldOffset attribute.
4638 Otherwise, none of the fields should have a FieldOffset attribute.
4639 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4640 and FieldOffset attributes.
4641 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4642 (TypeManager.field_offset_attribute_type): New core types.
4643 (TypeManager.InitCoreTypes): Initialize them.
4645 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4647 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4648 Return correct type.
4651 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4653 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4654 be implicitly converted to ulong.
4656 * expression.cs: The logic for allowing operator &, | and ^ worked
4657 was wrong, it worked before because we did not report an error in
4658 an else branch. Fixes 57895.
4660 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4661 allow volatile fields to be reference types.
4663 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4665 * driver.cs: Add support for /debug-
4667 2004-05-07 Raja R Harinath <rharinath@novell.com>
4669 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4670 Add a 'complain' parameter to silence errors.
4671 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4672 silently overlooked type-resolutions.
4673 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4675 (Attributes.Search): New function.
4676 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4677 (Attributes.GetAttributeFullName): Remove hack.
4678 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4679 Update to reflect changes.
4680 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4681 Use Attributes.Search instead of nested loops.
4683 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4686 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4687 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4688 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4690 * report.cs: (Report.Warning): Renamed to Warning_T because of
4691 parameter collision.
4693 2004-05-05 Raja R Harinath <rharinath@novell.com>
4695 * expression.cs (MemberAccess.ResolveMemberAccess):
4696 Exit with non-zero status after Report.Error.
4697 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4699 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4701 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4703 * support.cs: Don't hang when the file is empty.
4705 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4707 * support.cs: In SeekableStreamReader, compute the preamble size of the
4708 underlying stream. Position changes should take into account that initial
4711 2004-05-03 Todd Berman <tberman@sevenl.net>
4713 * driver.cs: remove unused GetSysVersion function.
4715 2004-05-03 Todd Berman <tberman@sevenl.net>
4717 * driver.cs: Remove the hack from saturday, as well as the hack
4718 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4719 link_paths to get that bit proper.
4721 2004-05-01 Todd Berman <tberman@sevenl.net>
4723 * driver.cs: Try a LoadFrom before a Load, this checks the current
4724 path. This is currently a bug in mono that is be fixed, however, this
4725 provides a workaround for now. This will be removed when the bug
4728 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4730 * CryptoConvert.cs: Updated to latest version. Fix issue with
4731 incomplete key pairs (#57941).
4733 2004-05-01 Todd Berman <tberman@sevenl.net>
4735 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4738 2004-04-30 Jackson Harper <jackson@ximian.com>
4740 * codegen.cs: Open keys readonly.
4742 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4744 * typemanager.cs: don't report cyclic struct layout when a struct
4745 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4746 which has 2 Pango.Rectangle fields.
4748 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4750 * expression.cs: Handle IntPtr comparisons with IL code
4751 rather than a method call.
4753 2004-04-29 Martin Baulig <martin@ximian.com>
4755 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4756 the list of PropertyInfo's in class hierarchy and find the
4757 accessor. Fixes #56013.
4759 2004-04-29 Martin Baulig <martin@ximian.com>
4761 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4763 2004-04-29 Martin Baulig <martin@ximian.com>
4765 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4767 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4769 2004-04-29 Martin Baulig <martin@ximian.com>
4771 * class.cs (ConstructorInitializer.Resolve): Check whether the
4772 parent .ctor is accessible. Fixes #52146.
4774 2004-04-29 Martin Baulig <martin@ximian.com>
4776 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4778 * statement.cs (Using.EmitLocalVariableDecls): Use
4779 TypeManager.idisposable_type, not typeof (IDisposable).
4780 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4782 2004-04-29 Martin Baulig <martin@ximian.com>
4784 * class.cs (Event.Define): Don't emit the field and don't set
4785 RTSpecialName and SpecialName for events on interfaces. Fixes
4788 2004-04-29 Raja R Harinath <rharinath@novell.com>
4790 Refactor Attribute.ApplyAttributes.
4791 * attribute.cs (Attributable): New base class for objects that can
4792 have Attributes applied on them.
4793 (Attribute): Make AttributeUsage fields public.
4794 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4795 (Attribute.IsInternalCall): New property.
4796 (Attribute.UsageAttr): Convert to a public read-only property.
4797 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4798 (Attribute.ResolveType, Attribute.Resolve)
4799 (Attribute.ScanForIndexerName): Update to reflect changes.
4800 (Attribute.CheckAttributeTarget): Re-format.
4801 (Attribute.ApplyAttributes): Refactor, to various
4802 Attributable.ApplyAttributeBuilder methods.
4803 * decl.cs (MemberCore): Make Attributable.
4804 * class.cs (Accessor): Make Attributable.
4805 (MethodData.ApplyAttributes): Use proper attribute types, not
4807 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4808 (TypeContainer.ApplyAttributeBuilder)
4809 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4810 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4811 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4812 (Operator.ApplyAttributeBuilder): New factored-out methods.
4813 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4814 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4815 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4816 * parameter.cs (ParameterBase): New Attributable base class
4817 that can also represent Return types.
4818 (Parameter): Update to the changes.
4820 2004-04-29 Jackson Harper <jackson@ximian.com>
4822 * driver.cs: Prefer the corlib system version when looking for
4823 assemblies in the GAC. This is still a hack, but its a better hack
4826 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4828 * decl.cs, enum.cs: Improved error 3005 reporting.
4830 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4831 (related_symbols): New private member for list of symbols
4832 related to reported error/warning.
4834 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4836 2004-04-29 Martin Baulig <martin@ximian.com>
4838 * ecore.cs (Expression.Constantify): If we're an enum and
4839 TypeManager.TypeToCoreType() doesn't give us another type, use
4840 t.UnderlyingSystemType. Fixes #56178.
4842 2004-04-29 Martin Baulig <martin@ximian.com>
4844 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4845 interfaces and for each interface, only add members directly
4846 declared in that interface. Fixes #53255.
4848 2004-04-28 Martin Baulig <martin@ximian.com>
4850 * expression.cs (ConditionalLogicalOperator): Use a temporary
4851 variable for `left' to avoid that we evaluate it more than once;
4854 2004-04-28 Martin Baulig <martin@ximian.com>
4856 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4859 2004-04-28 Martin Baulig <martin@ximian.com>
4861 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4864 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4865 whether the type is not void (CS1547).
4867 2004-04-28 Martin Baulig <martin@ximian.com>
4869 * expression.cs (Unary.DoResolveLValue): Override this and report
4870 CS0131 for anything but Operator.Indirection.
4872 2004-04-28 Martin Baulig <martin@ximian.com>
4874 Committing a patch from Ben Maurer; see bug #50820.
4876 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4879 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4882 2004-04-28 Martin Baulig <martin@ximian.com>
4884 Committing a patch from Ben Maurer; see bug #50820.
4886 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4889 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4892 2004-04-28 Martin Baulig <martin@ximian.com>
4894 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4895 (Block.AddLabel): Call DoLookupLabel() to only search in the
4898 2004-04-28 Martin Baulig <martin@ximian.com>
4900 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4901 comparing StringConstants and NullLiterals in Equality and Inequality.
4903 2004-04-28 Jackson Harper <jackson@ximian.com>
4905 * driver.cs: Attempt to load referenced assemblies from the
4906 GAC. This is the quick and dirty version of this method that
4907 doesnt take into account versions and just takes the first
4908 canidate found. Will be good enough for now as we will not have more
4909 then one version installed into the GAC until I update this method.
4911 2004-04-28 Martin Baulig <martin@ximian.com>
4913 * typemanager.cs (TypeManager.CheckStructCycles): New public
4914 static method to check for cycles in the struct layout.
4916 * rootcontext.cs (RootContext.PopulateTypes): Call
4917 TypeManager.CheckStructCycles() for each TypeContainer.
4918 [Note: We only need to visit each type once.]
4920 2004-04-28 Martin Baulig <martin@ximian.com>
4922 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4924 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4925 success and added `out object value'. Use a `bool resolved' field
4926 to check whether we've already been called rather than
4927 `ConstantValue != null' since this breaks for NullLiterals.
4929 2004-04-28 Raja R Harinath <rharinath@novell.com>
4931 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4932 setting of this flag, since the 'set' method may be non-public.
4934 2004-04-28 Raja R Harinath <rharinath@novell.com>
4936 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4937 check on current_vector.Block.
4939 2004-04-27 Martin Baulig <martin@ximian.com>
4941 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4942 a field initializer. Fixes #56459.
4944 2004-04-27 Martin Baulig <martin@ximian.com>
4946 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4947 we're not attempting to use an indexer. Fixes #52154.
4949 2004-04-27 Martin Baulig <martin@ximian.com>
4951 * statement.cs (Return): Don't create a return label if we don't
4952 need it; reverts my change from January 20th. Thanks to Ben
4955 2004-04-27 Martin Baulig <martin@ximian.com>
4957 According to the spec, `goto' can only leave a nested scope, but
4960 * statement.cs (Block.LookupLabel): Only lookup in the current
4961 block, don't recurse into parent or child blocks.
4962 (Block.AddLabel): Check in parent and child blocks, report
4963 CS0140/CS0158 if we find a duplicate.
4964 (Block): Removed this indexer for label lookups.
4965 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4966 this already does the error reporting for us.
4969 (FlowBranching.UsageVector.Block): New public variable; may be null.
4970 (FlowBranching.CreateSibling): Added `Block' argument.
4971 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4972 label for the target of a `goto' and check whether we're not
4973 leaving a `finally'.
4975 2004-04-27 Martin Baulig <martin@ximian.com>
4977 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4978 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4981 2004-04-27 Martin Baulig <martin@ximian.com>
4983 * statement.cs (Block.AddLabel): Also check for implicit blocks
4984 and added a CS0158 check.
4986 2004-04-27 Martin Baulig <martin@ximian.com>
4988 * flowanalysis.cs (FlowBranchingLoop): New class.
4989 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4990 UsageVector's instead of an ArrayList.
4991 (FlowBranching.Label): Likewise.
4992 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4993 (FlowBranching.AddBreakVector): New method.
4995 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4997 * attribute.cs: Small regression fix: only convert the type if we
4998 the type is different, fixes System.Drawing build.
5000 2004-04-27 Martin Baulig <martin@ximian.com>
5002 * attribute.cs (Attribute.Resolve): If we have a constant value
5003 for a named field or property, implicity convert it to the correct
5006 2004-04-27 Raja R Harinath <rharinath@novell.com>
5008 * statement.cs (Block.Block): Implicit blocks share
5009 'child_variable_names' fields with parent blocks.
5010 (Block.AddChildVariableNames): Remove.
5011 (Block.AddVariable): Mark variable as "used by a child block" in
5012 every surrounding block.
5013 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
5014 been used in a child block, complain about violation of "Invariant
5015 meaning in blocks" rule.
5016 * cs-parser.jay (declare_local_variables): Don't use
5017 AddChildVariableNames.
5018 (foreach_statement): Don't create an implicit block: 'foreach'
5021 2004-04-23 Miguel de Icaza <miguel@ximian.com>
5023 * convert.cs (ImplicitNumericConversion): 0 is also positive when
5024 converting from 0L to ulong. Fixes 57522.
5026 2004-04-22 Marek Safar <marek.safar@seznam.cz>
5028 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
5029 derived class hides via 'new' keyword field from base class (test-242.cs).
5030 TODO: Handle this in the more general way.
5032 * class.cs (CheckBase): Ditto.
5034 2004-04-22 Marek Safar <marek.safar@seznam.cz>
5036 * decl.cs (caching_flags): New member for storing cached values
5038 (MemberCore.Flags): New enum where bit flags for caching_flags
5040 (MemberCore.cls_compliance): Moved to caching_flags.
5041 (DeclSpace.Created): Moved to caching_flags.
5043 * class.cs: Use caching_flags instead of DeclSpace.Created
5045 2004-04-21 Miguel de Icaza <miguel@ximian.com>
5047 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
5048 if we are only a derived class, not a nested class.
5050 * typemanager.cs: Same as above, but do this at the MemberLookup
5051 level (used by field and methods, properties are handled in
5052 PropertyExpr). Allow for the qualified access if we are a nested
5055 2004-04-21 Marek Safar <marek.safar@seznam.cz>
5057 * class.cs: Refactoring.
5058 (IMethodData): New inteface; Holds links to parent members
5059 to avoid member duplication (reduced memory allocation).
5060 (Method): Implemented IMethodData interface.
5061 (PropertyBase): New inner classes for get/set methods.
5062 (PropertyBase.PropertyMethod): Implemented IMethodData interface
5063 (Event): New inner classes for add/remove methods.
5064 (Event.DelegateMethod): Implemented IMethodData interface.
5066 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
5067 EmitContext (related to class.cs refactoring).
5069 2004-04-21 Raja R Harinath <rharinath@novell.com>
5071 * delegate.cs (Delegate.VerifyApplicability): If the number of
5072 arguments are the same as the number of parameters, first try to
5073 verify applicability ignoring any 'params' modifier on the last
5077 2004-04-08 Martin Baulig <martin@ximian.com>
5079 Merged latest changes into gmcs. Please keep this comment in
5080 here, it makes it easier for me to see what changed in MCS since
5081 the last time I merged.
5083 2004-04-16 Raja R Harinath <rharinath@novell.com>
5085 * class.cs (TypeContainer.AddIndexer): Use
5086 'ExplicitInterfaceName' to determine if interface name was
5087 explicitly specified. 'InterfaceType' is not initialized at this time.
5088 (TypeContainer.DefineIndexers): Remove use of temporary list. The
5089 Indexers array is already in the required order. Initialize
5090 'IndexerName' only if there are normal indexers.
5091 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
5092 (TypeContainer.Emit): Emit DefaultMember attribute only if
5093 IndexerName is initialized.
5096 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
5098 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
5101 2004-04-15 Raja R Harinath <rharinath@novell.com>
5103 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
5107 * attribute.cs (Attribute.Resolve): Check for duplicate named
5111 2004-04-15 Miguel de Icaza <miguel@ximian.com>
5113 * iterators.cs (MarkYield): track whether we are in an exception,
5114 and generate code accordingly. Use a temporary value to store the
5115 result for our state.
5117 I had ignored a bit the interaction of try/catch with iterators
5118 since their behavior was not entirely obvious, but now it is
5119 possible to verify that our behavior is the same as MS .NET 2.0
5123 2004-04-14 Miguel de Icaza <miguel@ximian.com>
5125 * iterators.cs: Avoid creating temporaries if there is no work to
5128 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
5129 Enumerations, use TypeManager.EnumToUnderlying and call
5132 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
5135 (This.Emit): Use EmitContext.EmitThis to emit our
5138 (This.EmitAssign): Ditto.
5140 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
5141 codepaths, we will move all the functionality into
5144 (FieldExpr.EmitAssign): Ditto.
5146 This fixes several hidden bugs that I uncovered while doing a code
5147 review of this today.
5149 * codegen.cs (EmitThis): reworked so the semantics are more clear
5150 and also support value types "this" instances.
5152 * iterators.cs: Changed so that for iterators in value types, we
5153 do not pass the value type as a parameter.
5155 Initialization of the enumerator helpers is now done in the caller
5156 instead of passing the parameters to the constructors and having
5157 the constructor set the fields.
5159 The fields have now `assembly' visibility instead of private.
5161 2004-04-11 Miguel de Icaza <miguel@ximian.com>
5163 * expression.cs (Argument.Resolve): Check if fields passed as ref
5164 or out are contained in a MarshalByRefObject.
5166 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
5167 another compiler type.
5169 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
5171 * class.cs (Indexer.Define): use the new name checking method.
5172 Also, return false on an error.
5173 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
5174 (is_identifier_[start/part]_character): make static.
5176 2004-04-10 Miguel de Icaza <miguel@ximian.com>
5178 * expression.cs (Binary.ResolveOperator): Do no append strings
5179 twice: since we can be invoked more than once (array evaluation)
5180 on the same concatenation, take care of this here. Based on a fix
5181 from Ben (bug #56454)
5183 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
5185 * codegen.cs: Fix another case where CS1548 must be reported (when
5186 delay-sign isn't specified and no private is available #56564). Fix
5187 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
5188 error when MCS is used on the MS runtime and we need to delay-sign
5189 (which seems unsupported by AssemblyBuilder - see #56621).
5191 2004-04-08 Marek Safar <marek.safar@seznam.cz>
5193 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
5194 (TypeManager.ComputeNamespaces): Faster implementation for
5197 * compiler.csproj: Updated AssemblyName to mcs.
5199 2004-05-11 Jackson Harper <jackson@ximian.com>
5201 * Makefile: Preserve MONO_PATH
5203 2004-05-11 Jackson Harper <jackson@ximian.com>
5205 * Makefile: Use mono and mcs to build gmcs
5207 2004-05-03 Miguel de Icaza <miguel@ximian.com>
5209 * codegen.cs: Add patch from Robert Shade
5210 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
5213 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
5215 * CryptoConvert.cs: Updated to latest version. Fix issue with
5216 incomplete key pairs (#57941).
5218 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
5220 * codegen.cs: Fix another case where CS1548 must be reported (when
5221 delay-sign isn't specified and no private is available #56564). Fix
5222 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
5223 error when MCS is used on the MS runtime and we need to delay-sign
5224 (which seems unsupported by AssemblyBuilder - see #56621).
5226 2004-04-29 Jackson Harper <jackson@ximian.com>
5228 * Makefile: Set MONO_PATH to use the bootstrap corlib
5229 * driver.cs: Check the GAC for referenced assemblies.
5231 2004-04-29 Martin Baulig <martin@ximian.com>
5233 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
5235 2004-04-07 Martin Baulig <martin@ximian.com>
5237 * expression.cs (Binary.ResolveOperator): Added special case for
5238 Equality/Inequality between a type parameter and a null literal.
5240 2004-04-07 Martin Baulig <martin@ximian.com>
5242 * convert.cs: Check null literal -> type parameter conversions.
5244 2004-04-07 Martin Baulig <martin@ximian.com>
5246 * generic.cs (ConstructedType.CheckConstraints): Enforce the
5247 `class' and `struct' constraints.
5249 2004-04-07 Martin Baulig <martin@ximian.com>
5251 * generic.cs (SpecialConstraint): New public enum.
5252 (Constraints.Resolve): Added support for the `class' and `struct'
5255 * cs-parser.jay (type_parameter_constraint): Added support for the
5256 `class' and `struct' constraints.
5258 2004-04-07 Martin Baulig <martin@ximian.com>
5260 * support.cs (GenericConstraints): Replaced `Types' by
5261 `ClassConstraint' and `InterfaceConstraints'; added
5262 `HasClassConstraint'.
5264 2004-04-07 Martin Baulig <martin@ximian.com>
5267 (Constraints.InterfaceConstraints): New public property.
5268 (Constraints.Types): Make this property public
5269 (TypeParameter): Implement IMemberContainer.
5270 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
5271 instead of a TypeBuilder/MethodBuilder; pass the interface
5272 constraints to TypeManager.AddTypeParameter().
5273 (TypeParameter.DefineType): Just take an EmitContext and no
5274 TypeBuilder/MethodBuilder. Use the new public API.
5276 * typemanager.cs (TypeManager.AddTypeParameter): Added
5277 `TypeExpr[]' argument; add the interfaces to the
5278 `builder_to_ifaces' hash.
5279 (TypeManager.LookupMemberContainer): For
5280 GenericTypeParameterBuilders, get the TypeParameter from the
5281 `builder_to_type_param'.
5282 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
5283 the TypeParameter and call FindMembers on it.
5285 2004-04-07 Martin Baulig <martin@ximian.com>
5288 (MethodCore.GenericMethod): Moved this field here from Method.
5289 (MethodCore.IsDuplicateImplementation): Take the number of type
5290 parameters into account if we're a generic method.
5292 * expression.cs (Invocation.InferTypeArguments): Don't return true
5293 if `arguments' is null; we still need to check whether we actually
5294 don't need to infer anything in this case.
5295 (MemberAccess): Merged the functionality from GenericMemberAccess
5298 * generic.cs (GenericMemberAccess): Removed.
5300 2004-04-05 Martin Baulig <martin@ximian.com>
5302 * decl.cs (MemberCore): For generic classes, interfaces and
5303 structs, `Name' now includes the number of type parameters
5305 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
5306 encode the number of type arguments in the type name.
5308 * expression.cs (Expression.MemberLookup): Removed the
5309 `num_type_args' argument; we now encode the number of type
5310 arguments in the type name.
5312 * ecore.cs (SimpleName): Encode the number of type arguments in
5313 the type name itself.
5315 * generic.cs (ConstructedType): Likewise.
5317 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
5318 `MemberName'; we now include the number of type parameters in the
5321 * typemanager.cs (TypeManager.CheckGeneric): Removed.
5322 (TypeManager.MemberLookup): Removed the
5323 `num_type_args' argument; we now encode the number of type
5324 arguments in the type name.
5326 2004-04-03 Martin Baulig <martin@ximian.com>
5328 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
5329 (MemberCore.MemberName): Moved here from MemberBase.
5330 (DeclSpace.SetParameterInfo): Just take the constraints as an
5331 ArrayList; we already have the type parameters in our
5332 `MemberName'; also do the CS0080 reporting here.
5334 * cs-parser.jay (struct_declaration): Use `member_name' instead of
5335 `IDENTIFIER opt_type_parameter_list'; when constructing our
5336 `MemberName', it'll already include our type parameters.
5337 (class_declaration, interface_declaration): Likewise.
5338 (delegate_declaration): Likewise.
5339 (MakeName): Take a MemberName and return a MemberName.
5340 The following two changes are required to avoid shift/reduce conflicts:
5341 (member_name): Don't include a TypeName anymore; ie. this is now
5342 just 'IDENTIFIER opt_type_parameter_list'.
5343 (property_declaration, event_declaration): Use a
5344 `namespace_or_type_name' instead of a `member_name'.
5346 2004-04-03 Martin Baulig <martin@ximian.com>
5348 * decl.cs (MemberName): Renamed to `TypeName' and created a new
5350 (TypeName): Formerly known as MemberName.
5352 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
5353 instead of a `MemberName'.
5355 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
5356 (member_name): New rule; create a MemberName.
5358 2004-04-02 Martin Baulig <martin@ximian.com>
5360 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
5361 (CS0305 and CS0308).
5363 2004-04-02 Martin Baulig <martin@ximian.com>
5365 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
5366 support for nested types.
5368 2004-04-02 Martin Baulig <martin@ximian.com>
5370 * ecore.cs (IAlias): New public interface.
5371 (TypeExpr, TypeExpression): Implement IAlias.
5372 (TypeAliasExpression): New public class.
5374 * namespace.cs (Namespace): Implement IAlias.
5375 (Namespace.Lookup): Return an IAlias instead on an object.
5376 (Namespace.DefineName): Take an IAlias instead of an object.
5377 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
5379 (NamespaceEntry.UsingAlias): Take a Membername instead of an
5381 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
5383 (NamespaceEntry.Lookup): Likewise.
5385 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
5388 * decl.cs (DeclSpace): Implement IAlias.
5389 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
5391 * generic.cs (ConstructedType): Improved error checking.
5393 2004-04-02 Martin Baulig <martin@ximian.com>
5395 * convert.cs: Added type parameter conversions.
5398 (UnboxCast.Emit): Emit an `unbox.any' for type params.
5399 (ClassCast.Emit): If the source type is a type parameter, box it.
5400 If the target type is a type parameter, emit an `unbox.any'
5401 instead of a `classcast'.1
5403 2004-04-01 Martin Baulig <martin@ximian.com>
5405 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
5407 2004-04-01 Martin Baulig <martin@ximian.com>
5409 * generic.cs (ConstructedType.CheckConstraints): Use
5410 Convert.ImplicitStandardConversionExists(); user-defined implicit
5411 conversions are not allowed according to the spec.
5413 2004-03-30 Martin Baulig <martin@ximian.com>
5415 * expression.cs (New): Added support for type parameters.
5418 (TypeManager.activator_type): New public static field.
5419 (TypeManager.activator_create_instance): Likewise.
5421 2004-03-30 Martin Baulig <martin@ximian.com>
5423 * typemanager.cs (TypeManager.HasConstructorConstraint): New
5426 2004-03-30 Martin Baulig <martin@ximian.com>
5428 * generic.cs (ConstructedType.CheckConstraints): Actually follow
5429 the spec here: the argument type must be convertible to the
5432 2004-03-30 Martin Baulig <martin@ximian.com>
5435 (TypeParameter.Define, TypeParameter.DefineMethod): Call
5436 TypeManager.AddTypeParameter().
5437 (ConstructedType.CheckConstraints): Re-enable this and actually
5438 check whether we have a constructor constraint.
5441 (TypeManager.builder_to_type_param): New static field.
5442 (TypeManager.AddTypeParameter): New static method.
5443 (TypeManager.LookupTypeParameter): New public method.
5445 2004-03-30 Martin Baulig <martin@ximian.com>
5447 * generic.cs (TypeParameter.DefineType): Return a boolean and use
5448 the new API to actually define the constructor constraint.
5451 (TypeManager.new_constraint_attr_type): New static field.
5452 (TypeManager.InitCoreTypes): Initialize it.
5454 2004-03-30 Martin Baulig <martin@ximian.com>
5456 * generic.cs (Constraints): Completed error checking, use correct
5459 2004-03-29 Martin Baulig <martin@ximian.com>
5461 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
5463 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5464 public version which takes a `ParameterData pd' instead of an
5467 2004-03-29 Martin Baulig <martin@ximian.com>
5469 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
5472 2004-03-29 Martin Baulig <martin@ximian.com>
5474 * expression.cs (Argument.ResolveMethodGroup): If we're a
5475 ConstructedType, call GetMemberAccess() on it.
5477 2004-03-29 Martin Baulig <martin@ximian.com>
5479 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
5480 (MethodCore.CheckGenericOverride): When overriding a generic
5481 method, check whether the constraints match.
5483 * support.cs (GenericConstraints): New public interface.
5484 (ParameterData.GenericConstraints): New public method.
5486 * parameter.cs (Parameter.Resolve): Check whether we're a generic
5487 method parameter and compute our constraints if appropriate.
5488 (Parameter.GenericConstraints): New public property.
5490 * generic.cs (Constraints): Implement GenericConstraints.
5492 2004-03-29 Martin Baulig <martin@ximian.com>
5494 * decl.cs (MemberCache.FindMemberToOverride): Use
5495 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
5497 2004-03-29 Martin Baulig <martin@ximian.com>
5499 * generic.cs (GenericMethod.Define): Resolve our type parameters.
5501 2004-03-29 Martin Baulig <martin@ximian.com>
5503 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
5504 not allowed on non-generic declarations").
5506 2004-03-29 Martin Baulig <martin@ximian.com>
5508 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5509 public version of this method.
5511 * class.cs (MethodCore.IsDuplicateImplementation): Use
5512 Invocation.InferTypeArguments() to check this.
5514 2004-03-29 Martin Baulig <martin@ximian.com>
5516 * convert.cs: Use TypeManager.IsDelegateType() instead of
5517 comparing types correctly.
5519 2004-03-29 Martin Baulig <martin@ximian.com>
5521 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
5522 types directly to make it work for generic instances.
5524 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
5526 2004-03-29 Martin Baulig <martin@ximian.com>
5528 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
5531 2004-03-24 Martin Baulig <martin@ximian.com>
5533 * decl.cs (DeclSpace.FindType): Also use
5534 TypeManager.CheckGeneric() for types from the using clauses.
5536 2004-03-23 Martin Baulig <martin@ximian.com>
5538 * expression.cs (Invocation.OverloadResolve): Added `bool
5539 may_fail' argument and use it instead of the Location.IsNull() hack.
5541 2004-03-23 Martin Baulig <martin@ximian.com>
5543 * expression.cs (Invocation.InferType): Use correct type inference
5546 2004-03-23 Martin Baulig <martin@ximian.com>
5548 * ecore.cs (MethodGroupExpr.Name): Use
5549 TypeManager.CSharpSignature() instead of just the name.
5551 * expression.cs (Invocation.OverloadResolve): Provide better error
5553 (Invocation.DoResolve): OverloadResolve() never returns null
5554 without reporting an error, so removed the error -6 reporting here.
5556 2004-03-23 Martin Baulig <martin@ximian.com>
5558 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
5561 * cs-parser.jay (delegate_declaration): Support generic delegates.
5563 * delegate.cs: Support generic delegates.
5565 2004-03-22 Martin Baulig <martin@ximian.com>
5567 * expression.cs (Invocation.InferParamsTypeArguments): New static
5568 method; does type inference for params arguments.
5570 2004-03-21 Martin Baulig <martin@ximian.com>
5572 * typemanager.cs (TypeManager.IsGenericMethod): New public static
5573 method; checks whether a method is a generic method.
5575 * expression.cs (Invocation.InferTypeArguments): New static method;
5576 infer type arguments for generic method invocation.
5578 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
5579 property; we set this to true if we're resolving a generic method
5580 invocation and the user specified type arguments, ie. we're not
5581 doing type inference.
5583 2004-03-20 Martin Baulig <martin@ximian.com>
5585 * class.cs (MethodData.DeclaringType): New public property.
5586 (MethodData.Define): Set DeclaringType here.
5587 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
5588 instead of OperatorMethodBuilder.DeclaringType.
5590 2004-03-20 Martin Baulig <martin@ximian.com>
5592 * cs-tokenizer.cs (xtoken): Return a special
5593 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
5595 * cs-parser.jay (default_value_expression): Switch to the new
5598 2004-03-19 Martin Baulig <martin@ximian.com>
5600 * decl.cs (MemberName): New class. We use this to "construct"
5601 namespace_or_type_name's.
5603 * generics.cs (TypeArguments.GetDeclarations): New public method;
5604 returns the type arguments as a string[] and reports a CS0081 if
5605 one of them is not an identifier.
5607 * class.cs (MemberBase): The .ctor now takes the name as a
5608 MemberName instead of a string.
5609 (MemberBase.ExplicitInterfaceName): Changed type from string to
5611 (MemberBase.DoDefine): If we're an explicit implementation, the
5612 InterfaceType may be a generic instance.
5614 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
5615 (namespace_name): Call MemberName.GetName () to transform the
5616 MemberName into a string and ensure we don't have any type
5618 (type_name): Call MemberName.GetTypeExpression() to transfrom the
5619 MemberName into an expression.
5620 (method_header): Use namespace_or_type_name instead of member_name.
5622 2004-04-07 Miguel de Icaza <miguel@ximian.com>
5624 * rootcontext.cs: Add new types to the boot resolution.
5626 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
5627 MulticastDelegate is not allowed.
5629 * typemanager.cs: Add new types to lookup: System.TypedReference
5632 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
5633 check for TypedReference or ArgIterator, they are not allowed.
5635 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
5636 makes us properly catch 1510 in some conditions (see bug 56016 for
5639 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
5641 * CryptoConvert.cs: update from corlib version
5644 2004-04-05 Miguel de Icaza <miguel@ximian.com>
5646 * class.cs (Indexer.Define): Check indexername declaration
5648 2004-04-05 Marek Safar <marek.safar@seznam.cz>
5650 * attribute.cs (IsClsCompliant): Fixed problem with handling
5651 all three states (compliant, not-compliant, undetected).
5653 2004-03-30 Marek Safar <marek.safar@seznam.cz>
5655 * attribute.cs (Attribute): Location is now public.
5656 (Resolve): Store resolved arguments (pos_values) in attribute class.
5657 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
5658 (GetClsCompliantAttributeValue): New method that gets
5659 CLSCompliantAttribute value.
5660 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
5661 if exists else null.
5662 (AttributeTester): New class for CLS-Compliant verification routines.
5664 * class.cs (Emit): Add CLS-Compliant verification.
5665 (Method.GetSignatureForError): Implemented.
5666 (Constructor.GetSignatureForError): Implemented
5667 (Constructor.HasCompliantArgs): Returns if constructor has
5668 CLS-Compliant arguments.
5669 (Constructor.Emit): Override.
5670 (Construcor.IsIdentifierClsCompliant): New method; For constructors
5671 is needed to test only parameters.
5672 (FieldBase.GetSignatureForError): Implemented.
5673 (TypeContainer): New member for storing base interfaces.
5674 (TypeContainer.FindMembers): Search in base interfaces too.
5676 * codegen.cs (GetClsComplianceAttribute): New method that gets
5677 assembly or module CLSCompliantAttribute value.
5678 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5680 (ModuleClass.Emit): Add error 3012 test.
5682 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5684 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5685 state for all decl types.
5686 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5687 if CLS-Compliant tests are required.
5688 (IsClsCompliaceRequired): New method. Analyze whether code
5689 must be CLS-Compliant.
5690 (IsExposedFromAssembly): New method. Returns true when MemberCore
5691 is exposed from assembly.
5692 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5693 value or gets cached value.
5694 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5695 is explicitly marked with CLSCompliantAttribute.
5696 (IsIdentifierClsCompliant): New abstract method. This method is
5697 used to testing error 3005.
5698 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5699 for identifier and parameters CLS-Compliant testing.
5700 (VerifyClsCompliance): New method. The main virtual method for
5701 CLS-Compliant verifications.
5702 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5703 null. I don't know why is null (too many public members !).
5704 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5705 and get value of first CLSCompliantAttribute that found.
5707 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5708 (VerifyClsCompliance): Override and add extra tests.
5710 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5711 clscheck- disable CLS-Compliant verification event if assembly is has
5712 CLSCompliantAttribute(true).
5714 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5715 ApllyAttribute is now called in emit section as in the other cases.
5716 Possible future Emit integration.
5717 (IsIdentifierClsCompliant): New override.
5718 (VerifyClsCompliance): New override.
5719 (GetEnumeratorName): Returns full enum name.
5721 * parameter.cs (GetSignatureForError): Implemented.
5723 * report.cs (WarningData): New struct for Warning message information.
5724 (LocationOfPreviousError): New method.
5725 (Warning): New method. Reports warning based on the warning table.
5726 (Error_T): New method. Reports error based on the error table.
5728 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5729 verifications are done here.
5731 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5733 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5734 CLSCompliantAttribute.
5735 (all_imported_types): New member holds all imported types from other
5737 (LoadAllImportedTypes): New method fills static table with exported types
5738 from all referenced assemblies.
5739 (Modules): New property returns all assembly modules.
5741 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5743 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5744 throwing a parser error.
5746 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5747 which removes the hardcoded get_/set_ prefixes for properties, as
5748 IL allows for the properties to be named something else.
5752 * expression.cs: Do not override operand before we know if it is
5755 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5757 * typemanager.cs: support for pinned variables.
5759 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5761 * decl.cs, typemanager.cs: Avoid using an arraylist
5762 as a buffer if there is only one result set.
5764 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5766 * expression.cs: Make sure you cant call a static method
5767 with an instance expression, bug #56174.
5769 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5771 * class.cs (IsDuplicateImplementation): Improve error reporting to
5772 flag 663 (method only differs in parameter modifier).
5774 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5775 in preprocessor directives.
5777 * location.cs (LookupFile): Allow for the empty path.
5779 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5780 better approach for some of that patch, but its failing with the
5781 CharSet enumeration. For now try/catch will do.
5783 * typemanager.cs: Do not crash if a struct does not have fields.
5786 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5788 * expression.cs: cs0213, cant fix a fixed expression.
5791 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5793 * cs-parser.jay: detect invalid embeded statements gracefully.
5796 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5798 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5801 the invocation type may not be a subclass of the tye of the item/
5802 The type of the item must be a subclass of the invocation item.
5807 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5809 * attribute.cs: Added methods to get a string and a bool from an
5810 attribute. Required to information from AssemblyKeyFileAttribute,
5811 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5812 * codegen.cs: Modified AssemblyName creation to include support for
5813 strongnames. Catch additional exceptions to report them as CS1548.
5814 * compiler.csproj: Updated include CryptoConvert.cs.
5815 * compiler.csproj.user: Removed file - user specific configuration.
5816 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5817 Mono.Security assembly. The original class is maintained and tested in
5818 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5819 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5820 like CSC 8.0 (C# v2) supports.
5821 * Makefile: Added CryptoConvert.cs to mcs sources.
5822 * rootcontext.cs: Added new options for strongnames.
5824 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5826 * driver.cs: For --expect-error, report error code `2'
5827 if the program compiled with no errors, error code `1' if
5828 it compiled with an error other than the one expected.
5830 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5832 * compiler.csproj: Updated for Visual Studio .NET 2003.
5833 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5834 * compiler.sln: Updated for Visual Studio .NET 2003.
5836 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5838 * expression.cs: Fix bug #47234. We basically need to apply the
5839 rule that we prefer the conversion of null to a reference type
5840 when faced with a conversion to 'object' (csc behaviour).
5842 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5844 * statement.cs: Shorter form for foreach, eliminates
5845 a local variable. r=Martin.
5847 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5849 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5850 checks if we can use brtrue/brfalse to test for 0.
5851 * expression.cs: use the above in the test for using brtrue/brfalse.
5854 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5856 * expression.cs: Rewrite string concat stuff. Benefits:
5858 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5859 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5860 rather than a concat chain.
5862 * typemanager.cs: Add lookups for more concat overloads.
5864 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5866 * expression.cs: Emit shorter il code for array init.
5883 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5885 * statement.cs: Before, two switch blocks would be merged if the
5886 total size of the blocks (end_item - begin_item + 1) was less than
5887 two times the combined sizes of the blocks.
5889 Now, it will only merge if after the merge at least half of the
5894 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5896 * class.cs : csc build fix for GetMethods(). See bug #52503.
5898 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5900 * expression.cs: Make sure fp comparisons work with NaN.
5901 This fixes bug #54303. Mig approved this patch a long
5902 time ago, but we were not able to test b/c the runtime
5905 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5907 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5909 2004-03-19 Martin Baulig <martin@ximian.com>
5911 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5912 two overloads may unify for some type parameter substitutions and
5913 report a CS0408 if appropriate.
5915 2004-03-19 Martin Baulig <martin@ximian.com>
5917 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5918 error here and not in our caller.
5920 2004-03-19 Martin Baulig <martin@ximian.com>
5922 * interface.cs: Completely killed this file.
5923 (Interface): We're now a TypeContainer and live in class.cs.
5925 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5926 argument; we're now also called for interfaces.
5927 (TypeContainer.DefineMembers): Allow this method being called
5929 (TypeContainer.GetMethods): New public method; formerly known as
5930 Interface.GetMethod(). This is used by PendingImplementation.
5931 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5932 it's now private and non-static.
5933 (Interface): Moved this here; it's now implemented similar to
5935 (Method, Property, Event, Indexer): Added `bool is_interface'
5936 argument to their .ctor's.
5937 (MemberBase.IsInterface): New public field.
5939 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5940 instances instead of InterfaceMethod, InterfaceProperty, etc.
5941 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5942 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5944 2004-03-19 Martin Baulig <martin@ximian.com>
5946 * class.cs (MethodCore.IsDuplicateImplementation): New private
5947 method which does the CS0111 checking.
5948 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5949 Use IsDuplicateImplementation().
5951 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5953 * decl.cs (FindMemberToOverride): New method to find the correct
5954 method or property to override in the base class.
5956 - Make Method/Property use the above method to find the
5957 version in the base class.
5958 - Remove the InheritableMemberSignatureCompare as it is now
5961 This patch makes large code bases much faster to compile, as it is
5962 O(n) rather than O(n^2) to do this validation.
5964 Also, it fixes bug 52458 which is that nested classes are not
5965 taken into account when finding the base class member.
5967 Reviewed/Approved by Martin.
5969 2004-03-17 Martin Baulig <martin@ximian.com>
5971 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5972 of type arguments into account; use the `real_num_type_args'
5973 approach like in DoResolveAsTypeStep().
5975 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5978 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5980 * interface.cs: In all interface classes removed redundant
5981 member initialization.
5983 2004-03-16 Martin Baulig <martin@ximian.com>
5985 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5987 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5989 * decl.cs (DefineTypeAndParents): New helper method to define a
5990 type's containers before the type itself is defined; This is a
5991 bug exposed by the recent changes to Windows.Forms when an
5992 implemented interface was defined inside a class that had not been
5995 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5997 (Check): Loop correctly to report errors modifiers
5998 (UNSAFE was not in the loop, since it was the same as TOP).
6000 * interface.cs: Every interface member now takes a ModFlags,
6001 instead of a "is_new" bool, which we set on the base MemberCore.
6003 Every place where we called "UnsafeOk" in the interface, now we
6004 call the proper member (InterfaceMethod.UnsafeOK) instead to get
6005 the unsafe settings from the member declaration instead of the
6006 container interface.
6008 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
6010 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
6011 `set_indexer_name' to the pending bits (one per type).
6013 We fixed a bug today that was picking the wrong method to
6014 override, since for properties the existing InterfaceMethod code
6015 basically ignored the method name. Now we make sure that the
6016 method name is one of the valid indexer names.
6018 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
6020 * support.cs (SeekableStreamReader): Keep track of stream byte
6021 positions and don't mix them with character offsets to the buffer.
6023 Patch from Gustavo Giráldez
6025 2004-03-15 Marek Safar <marek.safar@seznam.cz>
6027 * interface.cs (InterfaceSetGetBase): Removed double member
6028 initialization, base class does it as well.
6030 2004-03-13 Martin Baulig <martin@ximian.com>
6032 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
6033 when compiling corlib.
6035 2004-03-13 Miguel de Icaza <miguel@ximian.com>
6037 * convert.cs (ExplicitConversion): We were reporting an error on
6038 certain conversions (object_type source to a value type, when the
6039 expression was `null') before we had a chance to pass it through
6040 the user defined conversions.
6042 * driver.cs: Replace / and \ in resource specifications to dots.
6045 * class.cs: Add check for duplicate operators. Fixes 52477
6047 2004-03-11 Miguel de Icaza <miguel@ximian.com>
6049 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
6050 that are in the middle of the statements, not only at the end.
6053 * class.cs (TypeContainer.AddField): No longer set the
6054 `HaveStaticConstructor' flag, now we call it
6055 `UserDefineStaticConstructor' to diferentiate the slightly
6056 semantic difference.
6058 The situation is that we were not adding BeforeFieldInit (from
6059 Modifiers.TypeAttr) to classes that could have it.
6060 BeforeFieldInit should be set to classes that have no static
6065 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
6067 And most importantly Zoltan's comment:
6069 http://bugzilla.ximian.com/show_bug.cgi?id=44229
6071 "I think beforefieldinit means 'it's ok to initialize the type sometime
6072 before its static fields are used', i.e. initialization does not need
6073 to be triggered by the first access to the type. Setting this flag
6074 helps the JIT to compile better code, since it can run the static
6075 constructor at JIT time, and does not need to generate code to call it
6076 (possibly lots of times) at runtime. Unfortunately, mcs does not set
6077 this flag for lots of classes like String.
6079 csc sets this flag if the type does not have an explicit static
6080 constructor. The reasoning seems to be that if there are only static
6081 initalizers for a type, and no static constructor, then the programmer
6082 does not care when this initialization happens, so beforefieldinit
6085 This bug prevents the AOT compiler from being usable, since it
6086 generates so many calls to mono_runtime_class_init that the AOT code
6087 is much slower than the JITted code. The JITted code is faster,
6088 because it does not generate these calls if the vtable is type is
6089 already initialized, which is true in the majority of cases. But the
6090 AOT compiler can't do this."
6092 2004-03-10 Miguel de Icaza <miguel@ximian.com>
6094 * class.cs (MethodData.Emit): Refactor the code so symbolic
6095 information is generated for destructors; For some reasons we
6096 were taking a code path that did not generate symbolic information
6099 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
6101 * class.cs: Create a Constructor.CheckBase method that
6102 takes care of all validation type code. The method
6103 contains some code that was moved from Define.
6105 It also includes new code that checks for duplicate ctors.
6106 This fixes bug #55148.
6108 2004-03-09 Joshua Tauberer <tauberer@for.net>
6110 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
6111 a { ... }-style array creation invokes EmitStaticInitializers
6112 which is not good for reference-type arrays. String, decimal
6113 and now null constants (NullCast) are not counted toward
6114 static initializers.
6116 2004-03-05 Martin Baulig <martin@ximian.com>
6118 * location.cs (SourceFile.HasLineDirective): New public field;
6119 specifies whether the file contains or is referenced by a "#line"
6121 (Location.DefineSymbolDocuments): Ignore source files which
6122 either contain or are referenced by a "#line" directive.
6124 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
6126 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
6127 direct access to our parent, so check the method inline there.
6129 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
6131 * expression.cs (Invocation.EmitCall): Miguel's last commit
6132 caused a regression. If you had:
6137 In Foo the implict this would be null.
6139 2004-02-27 Miguel de Icaza <miguel@ximian.com>
6141 * expression.cs (Invocation.EmitCall): If the method is not
6142 virtual, do not emit a CallVirt to it, use Call.
6144 * typemanager.cs (GetFullNameSignature): Improve the method to
6145 cope with ".ctor" and replace it with the type name.
6147 * class.cs (ConstructorInitializer.Resolve): Now the method takes
6148 as an argument the ConstructorBuilder where it is being defined,
6149 to catch the recursive constructor invocations.
6151 2004-03-16 Martin Baulig <martin@ximian.com>
6153 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
6154 ConstructedType, call ResolveType() on it to get the type rather
6155 than just using `expr.Type'.
6157 2004-03-16 Martin Baulig <martin@ximian.com>
6159 * generics.cs (ConstructedType.GetMemberAccess): Take the
6160 EmitContext instead on the TypeExpr and use
6161 ec.TypeContainer.CurrentType/ec.ContainerType.
6163 2004-03-16 Martin Baulig <martin@ximian.com>
6165 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
6166 parameters before aliases.
6168 2004-03-16 Martin Baulig <martin@ximian.com>
6170 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
6171 New oublic function; checks whether two generic instances may become
6172 equal under some instantiations (26.3.1).
6174 * class.cs (TypeContainer.Define): Call
6175 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
6178 2004-03-16 Martin Baulig <martin@ximian.com>
6180 * class.cs (TypeContainer.GetClassBases): Moved
6181 Error_TypeParameterAsBase() here and also check whether the base
6182 class is not an attribute.
6184 2004-03-16 Martin Baulig <martin@ximian.com>
6186 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
6188 2004-03-16 Martin Baulig <martin@ximian.com>
6190 * class.cs (Error_TypeParameterAsBase): Use correct error number
6193 2004-03-16 Martin Baulig <martin@ximian.com>
6195 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
6198 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
6201 2004-03-15 Martin Baulig <martin@ximian.com>
6203 * typemanager.cs (TypeManager.GetFullName): New public method.
6204 (TypeManager.MemberLookup): Added `int_num_type_arguments'
6205 argument; only return members with the correct number of type
6207 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
6208 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
6209 whether the number of type arguments matches.
6211 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
6212 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
6214 * expression.cs (MemberAccess): Added public `NumTypeArguments'
6215 field; it's set by the protected .ctor when we're actually a
6216 GenericMemberAccess.
6217 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
6218 arguments and pass it to MemberLookupFinal ().
6220 * ecore.cs (Expression.MemberLookup): Added `int
6221 num_type_arguments' argument; only return members with the correct
6222 number of type arguments.
6223 (Expression.MemberLookupFailed): Check whether the MemberLookup
6224 failed because we did not have the correct number of type
6225 arguments; report CS0305 in this case.
6227 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
6228 `e.ResolveAsTypeTerminal()' already did so.
6230 2004-03-15 Martin Baulig <martin@ximian.com>
6232 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
6233 we're a ConstructedType; in this case, the caller must report an
6234 error (for instance CS0131).
6236 * generic.cs (TypeArguments): Added Location argument to the .ctor.
6237 (TypeArguments.Resolve): Actually report errors here.
6239 2004-03-15 Miguel de Icaza <miguel@ximian.com>
6241 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
6242 `set_indexer_name' to the pending bits (one per type).
6244 We fixed a bug today that was picking the wrong method to
6245 override, since for properties the existing InterfaceMethod code
6246 basically ignored the method name. Now we make sure that the
6247 method name is one of the valid indexer names.
6249 2004-03-15 Martin Baulig <martin@ximian.com>
6251 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
6252 for generic instances.
6254 2004-03-13 Martin Baulig <martin@ximian.com>
6256 * class.cs (TypeContainer.DefineType): Call
6257 TypeManager.AddUserType() immediately after creating the
6258 TypeBuilder; pass all type parameters when creating the
6261 * decl.cs (DeclSpace.FindNestedType): New public method.
6262 (DeclSpace.FindType): Added `int num_type_args' argument; only
6263 return types with the correct number of type parameters.
6264 (DeclSpace.CountTypeParams): New public property.
6266 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
6267 the number of type parameters; defaults to zero.
6269 * generic.cs (TypeArguments.Count): New public property.
6270 (ConstructedType.DoResolveAsTypeStep): First call
6271 ds.FindNestedType() to find out whether we're nested in the
6272 current generic type; in this case, we inherit all type parameters
6273 from the current class.
6275 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
6276 num_type_args' argument.
6277 (RootContext.LookupType): Added overloaded version which takes the
6278 number of type arguments; only return types with the correct
6279 number of type arguments.
6281 * typemanager.cs (TypeManager.CheckGeneric): New public function;
6282 checks whether `Type t' has `int num_type_args'.
6284 2004-03-13 Martin Baulig <martin@ximian.com>
6286 * generic.cs (GenericMethod.DefineType): New method; calls
6287 DefineType() on all the type parameters.
6289 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
6290 (MethodData.Define): If we're a generic method, call
6291 GenericMethod.DefineType() to define the type parameters.
6293 2004-03-10 Martin Baulig <martin@ximian.com>
6295 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
6296 instead of IsAssignableFrom.
6298 2004-03-10 Martin Baulig <martin@ximian.com>
6300 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
6302 * support.cs (ParameterData.HasArrayParameter): New property.
6303 (ReflectionParameters.ctor): Take a MethodBase instead of a
6304 ParameterInfo[]. If we have any type parameters, get the generic
6305 method definition and ask it whether we have variable arguments.
6307 2004-02-26 Miguel de Icaza <miguel@ximian.com>
6309 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
6310 routines to check if a type is an enumerable/enumerator allow
6311 classes that implement the IEnumerable or IEnumerator interfaces.
6313 * class.cs (Property, Operator): Implement IIteratorContainer, and
6314 implement SetYields.
6316 (Property.Define): Do the block swapping for get_methods in the
6317 context of iterators. We need to check if Properties also
6318 include indexers or not.
6320 (Operator): Assign the Block before invoking the
6321 OperatorMethod.Define, so we can trigger the Iterator code
6324 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
6325 Property and Operator classes are not created when we parse the
6326 declarator but until we have the block completed, so we use a
6327 singleton SimpleIteratorContainer.Simple to flag whether the
6328 SetYields has been invoked.
6330 We propagate this setting then to the Property or the Operator to
6331 allow the `yield' to function.
6333 2004-02-25 Marek Safar <marek.safar@seznam.cz>
6335 * codegen.cs: Implemented attribute support for modules.
6336 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
6337 Assembly/Module functionality.
6339 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
6340 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
6341 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
6343 2004-02-16 Marek Safar <marek.safar@seznam.cz>
6345 * interface.cs (FindMembers): The operation is performed on all base
6346 interfaces and not only on the first. It is required for future CLS Compliance patch.
6348 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
6350 * statement.cs, codegen.cs:
6351 This patch deals with patterns such as:
6353 public class List : IEnumerable {
6355 public MyEnumerator GetEnumerator () {
6356 return new MyEnumerator(this);
6359 IEnumerator IEnumerable.GetEnumerator () {
6363 public struct MyEnumerator : IEnumerator {
6368 Before, there were a few things we did wrong:
6369 1) we would emit callvirt on a struct, which is illegal
6370 2) we emited ldarg when we needed to emit ldarga
6371 3) we would mistakenly call the interface methods on an enumerator
6372 type that derived from IEnumerator and was in another assembly. For example:
6374 public class MyEnumerator : IEnumerator
6376 Would have the interface methods called, even if there were public impls of the
6377 method. In a struct, this lead to invalid IL code.
6379 2004-02-11 Marek Safar <marek.safar@seznam.cz>
6381 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
6384 * delegate.cs (Define): Fixed crash when delegate type is undefined.
6386 2004-02-11 Miguel de Icaza <miguel@ximian.com>
6388 * cs-parser.jay: Fix small regression: we were not testing V2
6389 compiler features correctly.
6391 * interface.cs: If the emit context is null, then create one
6393 2004-02-09 Marek Safar <marek.safar@seznam.cz>
6395 * decl.cs (GetSignatureForError): New virtual method to get full name
6398 * attribute.cs (IAttributeSupport): New interface for attribute setting.
6399 Now it is possible to rewrite ApplyAttributes method to be less if/else.
6401 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
6402 Duplicated members and code in these classes has been removed.
6403 Better encapsulation in these classes.
6405 2004-02-07 Miguel de Icaza <miguel@ximian.com>
6407 * assign.cs (Assign.DoResolve): When dealing with compound
6408 assignments, there is a new rule in ECMA C# 2.4 (might have been
6409 there before, but it is documented here) that states that in:
6413 If b is of type int, and the `op' is a shift-operator, then the
6414 above is evaluated as:
6418 * expression.cs (Binary.ResolveOperator): Instead of testing for
6419 int/uint/long/ulong, try to implicitly convert to any of those
6420 types and use that in pointer arithmetic.
6422 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
6423 method to print information for from the type, not from the
6424 null-method we were given.
6426 2004-02-01 Duncan Mak <duncan@ximian.com>
6428 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
6429 parsing for cmd, fixes bug #53694.
6431 2004-02-04 Marek Safar <marek.safar@seznam.cz>
6433 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
6434 in the member name duplication tests. Property and operator name duplication
6435 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
6437 2004-02-03 Marek Safar <marek.safar@seznam.cz>
6439 * interface.cs (PopulateMethod): Fixed crash when interface method
6440 returns not existing type (error test cs0246-3.cs).
6442 2004-02-02 Ravi Pratap M <ravi@ximian.com>
6444 * cs-parser.jay (interface_accessors): Re-write actions to also
6445 store attributes attached to get and set methods. Fix spelling
6448 (inteface_property_declaration): Modify accordingly.
6450 (InterfaceAccessorInfo): New helper class to store information to pass
6451 around between rules that use interface_accessors.
6453 * interface.cs (Emit): Apply attributes on the get and set
6454 accessors of properties and indexers too.
6456 * attribute.cs (ApplyAttributes): Modify accordingly to use the
6457 right MethodBuilder when applying attributes to the get and set accessors.
6459 2004-01-31 Miguel de Icaza <miguel@ximian.com>
6461 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
6463 2004-01-26 Miguel de Icaza <miguel@ximian.com>
6465 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
6467 2004-01-25 Miguel de Icaza <miguel@ximian.com>
6469 * cs-parser.jay: Remove YIELD token, instead use the new grammar
6470 changes that treat `yield' specially when present before `break'
6473 * cs-tokenizer.cs: yield is no longer a keyword.
6475 2004-01-23 Marek Safar <marek.safar@seznam.cz>
6477 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
6478 setting for default constructors.
6479 For default constructors are almost every time set wrong Modifier. The
6480 generated IL code has been alright. But inside mcs this values was
6481 wrong and this was reason why several of my CLS Compliance tests
6484 2004-02-27 Martin Baulig <martin@ximian.com>
6486 * generics.cs (ConstructedType.ResolveType): Make the nested type
6487 stuff actually work.
6489 2004-02-25 Martin Baulig <martin@ximian.com>
6491 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
6492 property; returns the type parameters just from the current type,
6493 ie. with the ones from outer classes.
6494 (DeclSpace.LookupGeneric): First search in the current class, then
6496 (DeclSpace.initialize_type_params): When hiding a type parameter
6497 from an outer class, put it into the `type_param_list' anyways.
6499 * expression.cs (MemberAccess.expr): Made this field protected.
6501 * class.cs (TypeContainer.Define): The `CurrentType' just contains
6502 the type parameters from the current class.
6504 * generic.cs (ConstructedType.ResolveType): Support nested generic
6505 types by taking the type parameters which we inherit from outer
6506 classes into account.
6507 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
6508 support for nested generic types.
6510 2004-02-23 Martin Baulig <martin@ximian.com>
6512 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
6513 field and check whether we're nested inside a generic type.
6514 (DeclSpace.ResolveType): If we're resolving to a generic type
6515 definition, create a ConstructedType and return its resolved type.
6516 (DeclSpace.initialize_type_params): New private method;
6517 initializes the `type_param_list' field from the type parameters
6518 from this and all enclosing classes.
6519 (DeclSpace.TypeParameters): Call initialize_type_params() unless
6520 we're already initialized.
6522 2004-02-23 Martin Baulig <martin@ximian.com>
6524 * class.cs (Method.Define): Create the generic method before
6526 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
6527 the TypeContainer one); we use this for generic methods.
6529 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
6530 parent's TypeBuilder.
6532 2004-02-18 Martin Baulig <martin@ximian.com>
6534 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
6535 to check for equality.
6537 2004-02-05 Martin Baulig <martin@ximian.com>
6539 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
6540 `ec.TypeContainer.CurrentType', use it instead of
6541 `ec.ContainerType' to check whether we're in the type's ctor.
6543 2004-01-29 Martin Baulig <martin@ximian.com>
6545 * expression.cs (Invocation.DoResolve): If we're a
6546 `ConstructedType', then we're actually a generic method, so
6547 rewrite the expr as a GenericMemberAccess.
6549 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
6550 here; manually parse it into a string.
6552 2004-01-28 Martin Baulig <martin@ximian.com>
6554 * typemanager.cs (TypeManager.IsEqual): New static method.
6555 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
6556 check for equality instead of using `=='.
6558 2004-01-26 Martin Baulig <martin@ximian.com>
6560 * decl.cs (DeclSpace.CurrentType): New public field.
6562 * expression.cs (This.ResolveBase): If we have an
6563 `ec.TypeContainer.CurrentType', use it instead of
6566 * class.cs (TypeContainer.DefineType): If we're a generic type,
6567 create the `CurrentType' (unresolved).
6568 (TypeContainer.GenericType): New private field.
6569 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
6570 it and store it in `GenericType' before creating the MemberCache.
6571 (TypeContainer.GetMembers): If we have a `GenericType', call
6572 TypeManager.FindMembers() on it.
6574 * interface.cs (Interface.GenericType): New private field.
6575 (Interface.DefineType): If we're a generic type, create the
6576 `CurrentType' (unresolved).
6577 (Interface.DefineMembers): If we have a `CurrentType', resolve it
6578 and store it in `GenericType' before creating the MemberCache.
6579 (Interface.GetMembers): If we have a `GenericType', call
6580 TypeManager.FindMembers() on it.
6582 2004-01-22 Martin Baulig <martin@ximian.com>
6584 * cs-parser.jay (namespace_or_type_name): Return an Expression,
6585 not a QualifiedIdentifier. This is what `type_name_expression'
6586 was previously doing.
6587 (type_name_expression): Removed; the code is now in
6588 `namespace_or_type_name'.
6589 (qualified_identifier): Removed, use `namespace_or_type_name'
6591 (QualifiedIdentifier): Removed this class.
6593 2004-01-22 Martin Baulig <martin@ximian.com>
6595 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
6596 not a string as alias name.
6598 2004-01-21 Miguel de Icaza <miguel@ximian.com>
6600 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
6601 #52730 bug, and instead compute correctly the need to use a
6602 temporary variable when requesting an address based on the
6603 static/instace modified of the field and the constructor.
6605 2004-01-21 Martin Baulig <martin@ximian.com>
6607 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
6608 class and namespace before looking up aliases. Fixes #52517.
6610 2004-01-21 Martin Baulig <martin@ximian.com>
6612 * flowanalysis.cs (UsageVector.Merge): Allow variables being
6613 assinged in a 'try'; fixes exception4.cs.
6615 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6616 * class.cs : Implemented parameter-less constructor for TypeContainer
6618 * decl.cs: Attributes are now stored here. New property OptAttributes
6620 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
6622 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
6624 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6626 * typemanager.cs (CSharpSignature): Now reports also inner class name.
6627 (CSharpSignature): New method for indexer and property signature.
6629 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6631 * pending.cs (IsVirtualFilter): Faster implementation.
6633 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6635 * typemanager.cs: Avoid inclusion of same assembly more than once.
6637 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6639 * cs-parser.jay: Fixed problem where the last assembly attribute
6640 has been applied also to following declaration (class, struct, etc.)
6642 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6644 * class.cs: Added error CS0538, CS0539 reporting.
6645 Fixed crash on Microsoft runtime when field type is void.
6647 * cs-parser.jay: Added error CS0537 reporting.
6649 * pending.cs: Added error CS0535 reporting.
6650 Improved error report for errors CS0536, CS0534.
6652 2004-01-20 Miguel de Icaza <miguel@ximian.com>
6654 Merge a few bits from the Anonymous Method MCS tree.
6656 * statement.cs (ToplevelBlock): New class for toplevel methods,
6657 will hold anonymous methods, lifted variables.
6659 * cs-parser.jay: Create toplevel blocks for delegates and for
6660 regular blocks of code.
6662 2004-01-20 Martin Baulig <martin@ximian.com>
6664 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
6665 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
6666 and `NeedExplicitReturn'; added `IsLastStatement'.
6667 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
6668 have a `ReturnLabel' or we're not unreachable.
6670 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
6671 child's reachability; don't just override ours with it. Fixes
6672 #58058 (lluis's example).
6673 (FlowBranching): Added public InTryOrCatch(), InCatch(),
6674 InFinally(), InLoop(), InSwitch() and
6675 BreakCrossesTryCatchBoundary() methods.
6677 * statement.cs (Return): Do all error checking in Resolve().
6678 Unless we are the last statement in a top-level block, always
6679 create a return label and jump to it.
6680 (Break, Continue): Do all error checking in Resolve(); also make
6681 sure we aren't leaving a `finally'.
6682 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
6683 statement in a top-level block.
6684 (Block.Flags): Added `IsDestructor'.
6685 (Block.IsDestructor): New public property.
6687 2004-01-20 Martin Baulig <martin@ximian.com>
6689 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
6691 2004-01-20 Martin Baulig <martin@ximian.com>
6693 * statement.cs (Statement.ResolveUnreachable): New public method.
6694 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
6695 (Block.Resolve): Resolve unreachable statements.
6697 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6699 * expression.cs: We need to fix the case where we do
6700 not have a temp variable here.
6702 * assign.cs: Only expression compound assignments need
6703 temporary variables.
6705 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6707 * flowanalysis.cs: Reduce memory allocation in a few ways:
6708 - A block with no variables should not allocate a bit
6710 - A method with no out parameters does not need any tracking
6711 for assignment of the parameters, so we need not allocate
6714 public readonly Type[] VariableTypes;
6715 public readonly string[] VariableNames;
6716 Are redundant. The data is already stored in the variable
6717 map, so we need not allocate another array for it.
6718 - We need to add alot of checks for if (params | locals) == null
6719 due to the first two changes.
6721 2004-01-18 Miguel de Icaza <miguel@ximian.com>
6723 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
6724 implement IMemoryLocation, we store a copy on a local variable and
6725 take the address of it. Patch from Benjamin Jemlich
6727 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
6728 to use a special "type_name_expression" rule which reduces the
6729 number of "QualifiedIdentifier" classes created, and instead
6730 directly creates MemberAccess expressions.
6732 2004-01-17 Miguel de Icaza <miguel@ximian.com>
6734 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
6735 that fixes #52853. Null literal assignment to ValueType
6737 * class.cs (MethodData.Emit): Instead of checking the name of the
6738 method to determine if its a destructor, create a new derived
6739 class from Method called Destructor, and test for that.
6741 * cs-parser.jay: Create a Destructor object instead of a Method.
6743 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
6747 2004-01-16 Miguel de Icaza <miguel@ximian.com>
6749 * expression.cs (Binary.ResolveOperator): Perform an implicit
6750 conversion from MethodGroups to their delegate types on the
6753 * delegate.cs: Introduce a new class DelegateCreation that is the
6754 base class for `NewDelegate' and `ImplicitDelegateCreation',
6755 factor some code in here.
6757 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
6758 conversion from MethodGroups to compatible delegate types.
6760 * ecore.cs (Expression.Resolve): Do not flag error 654
6761 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
6762 we allow conversions from MethodGroups to delegate types now.
6764 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
6765 assignments in v2 either.
6767 2004-01-10 Miguel de Icaza <miguel@ximian.com>
6769 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
6770 static read-only fields in ctors.
6772 Applied patch from Benjamin Jemlich
6774 * expression.cs (UnaryMutator): Avoid leaking local variables.
6776 2004-01-09 Miguel de Icaza <miguel@ximian.com>
6778 * cs-tokenizer.cs (IsCastToken): Allow the various native types
6779 here to return true, as they can be used like this:
6783 Fixed 49836 and all the other dups
6785 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
6787 * driver.cs: Implement /win32res and /win32icon.
6789 2004-01-08 Miguel de Icaza <miguel@ximian.com>
6791 * cs-parser.jay: Add a rule to improve error handling for the
6792 common mistake of placing modifiers after the type.
6794 2004-01-07 Miguel de Icaza <miguel@ximian.com>
6796 * cs-parser.jay (interface_event_declaration): Catch
6797 initialization of events on interfaces, and report cs0068
6799 * cs-parser.jay (interface_event_declaration): Catch
6800 initialization of events.
6802 * ecore.cs: Better report missing constructors.
6804 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6805 the error reporting done in the wrong place. Fix.
6807 * expression.cs (Binary.ResolveOperator): Catch the
6808 operator + (E x, E y) error earlier, and later allow for implicit
6809 conversions in operator +/- (E e, U x) from U to the underlying
6812 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6813 52596, if the container class is abstract, the default constructor
6814 is protected otherwise its public (before, we were always public).
6816 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6819 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6820 Jemlich that fixes bug #52597, MCS was generating invalid code for
6821 idisposable structs. Thanks to Ben for following up with this
6824 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6826 * driver.cs: Allow assemblies without code to be generated, fixes
6829 2004-01-07 Nick Drochak <ndrochak@gol.com>
6831 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6833 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6835 * cs-parser.jay: Add rules to improve error reporting if fields or
6836 methods are declared at the namespace level (error 116)
6838 * Add rules to catch event add/remove
6840 2004-01-04 David Sheldon <dave-mono@earth.li>
6842 * expression.cs: Added matching ")" to error message for
6845 2004-01-03 Todd Berman <tberman@gentoo.org>
6847 * ecore.cs, attribute.cs:
6848 Applying fix from #52429.
6850 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6852 * ecore.cs, expression.cs, statement.cs:
6853 Total rewrite of how we handle branching. We
6854 now handle complex boolean expressions with fewer
6855 jumps. As well if (x == 0) no longer emits a ceq.
6857 if (x is Foo) is much faster now, because we generate
6860 Overall, we get a pretty big improvement on our benchmark
6861 tests. The code we generate is smaller and more readable.
6863 I did a full two-stage bootstrap. The patch was reviewed
6864 by Martin and Miguel.
6866 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6868 * cs-parser.jay: Make primary_expression not take a QI.
6869 we dont need this because the member_access rule covers
6870 us here. So we replace the rule with just IDENTIFIER.
6872 This has two good effects. First, we remove a s/r conflict.
6873 Second, we allocate many fewer QualifiedIdentifier objects.
6875 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6877 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6878 set the correct information via SRE. This prevents
6879 hanging on the MS runtime. Fixes #29374.
6881 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6883 * convert.cs: correctly handle conversions to value types
6884 from Enum and ValueType as unboxing conversions.
6886 Fixes bug #52569. Patch by Benjamin Jemlich.
6888 2004-01-02 Ravi Pratap <ravi@ximian.com>
6890 * expression.cs (BetterConversion): Prefer int -> uint
6891 over int -> ulong (csc's behaviour). This fixed bug #52046.
6893 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6895 * decl.cs (MemberCache.FindMembers): now returns a
6898 * typemanager.cs: In general, go with with ^^.
6899 (CopyNewMethods): take an IList.
6900 (RealMemberLookup): Only allocate an arraylist
6901 if we copy from two sets of methods.
6903 This change basically does two things:
6904 1) Fewer array lists allocated due to CopyNewMethods.
6905 2) the explicit cast in MemberList costed ALOT.
6907 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6909 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6910 a hashtable to avoid needless string allocations when an identifier is
6911 used more than once (the common case).
6913 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6915 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6916 is broken, it will not return anything. So, we
6917 have to use the information we have in mcs to
6920 * typemanager.cs: Add a cache for GetInterfaces,
6921 since this will now be used more often (due to ^^)
6923 (GetExplicitInterfaces) New method that gets the
6924 declared, not effective, interfaces on a type
6925 builder (eg, if you have interface IFoo, interface
6926 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6929 This patch makes MCS able to bootstrap itself on
6932 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6934 * expression.cs: Remove the Nop's that Miguel put
6937 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6939 * report.cs, codegen.cs: Give the real stack trace to
6940 the error when an exception is thrown.
6942 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6944 * decl.cs: only allocate hashtables for ifaces if
6947 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6949 * expression.cs: fix the error from cs0121-2.cs
6950 (a parent interface has two child interfaces that
6951 have a function with the same name and 0 params
6952 and the function is called through the parent).
6954 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6956 * class.cs, rootcontext.cs, typmanager.cs: do not
6959 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6961 * codegen.cs: remove stack for the ec flow branching.
6962 It is already a linked list, so no need.
6964 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6966 * Makefile: Allow custom profiler here.
6968 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6970 * typemanager.cs (LookupType):
6971 - Use a static char [], because split takes
6972 a param array for args, so it was allocating
6974 - Do not store true in a hashtable, it boxes.
6976 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6978 * flowanalysis.cs: bytify common enums.
6980 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6982 * modifiers.cs: Add a new set of flags for the
6983 flags allowed on explicit interface impls.
6984 * cs-parser.jay: catch the use of modifiers in
6985 interfaces correctly.
6986 * class.cs: catch private void IFoo.Blah ().
6988 All related to bug #50572.
6990 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6992 * decl.cs: Rewrite the consistant accessability checking.
6993 Accessability is not linear, it must be implemented in
6994 a tableish way. Fixes #49704.
6996 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6998 * expression.cs: Handle negation in a checked context.
6999 We must use subtraction from zero. Fixes #38674.
7001 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
7003 * class.cs: Ignore static void main in DLLs.
7004 * rootcontext.cs: Handle the target type here,
7005 since we are have to access it from class.cs
7006 * driver.cs: account for the above.
7008 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
7010 * report.cs: Give line numbers and files if available.
7012 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
7014 * driver.cs: Implement /addmodule.
7016 * typemanager.cs: Change 'modules' field so it now contains Modules not
7019 2003-12-20 Martin Baulig <martin@ximian.com>
7021 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
7022 (FieldBase.IsAssigned): Removed this field.
7023 (FieldBase.SetAssigned): New public method.
7024 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
7026 2003-12-20 Martin Baulig <martin@ximian.com>
7028 * expression.cs (LocalVariableReference.DoResolve): Don't set
7029 `vi.Used' if we're called from DoResolveLValue().
7031 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
7032 returns the usage vector it just merged into the current one -
7033 pass this one to UsageWarning().
7034 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
7035 of the `EmitContext', don't call this recursively on our children.
7037 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
7039 * driver.cs: Implement /target:module.
7041 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
7043 * support.cs (CharArrayHashtable): New helper class.
7045 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
7046 char arrays, not strings, so we can avoid creating a string in
7047 consume_identifier if the identifier is a keyword.
7049 2003-12-16 Martin Baulig <martin@ximian.com>
7051 * statement.cs (LocalInfo.Assigned): Removed this property.
7052 (LocalInfo.Flags): Removed `Assigned'.
7053 (LocalInfo.IsAssigned): New public method; takes the EmitContext
7054 and uses flow analysis.
7055 (Block.UsageWarning): Made this method private.
7056 (Block.Resolve): Call UsageWarning() if appropriate.
7058 * expression.cs (LocalVariableReference.DoResolve): Always set
7059 LocalInfo.Used here.
7061 2003-12-13 Martin Baulig <martin@ximian.com>
7063 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
7064 any value here; we're now using flow analysis to figure out
7065 whether a statement/block returns a value.
7067 2003-12-13 Martin Baulig <martin@ximian.com>
7069 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
7071 (FlowBranching.MergeFinally): Don't call
7072 `branching.CheckOutParameters()' here, this is called in
7074 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
7075 when adding the `finally' vector.
7077 2003-12-13 Martin Baulig <martin@ximian.com>
7080 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
7081 actually work and also fix #48962.
7083 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
7085 * decl.cs: Do not check System.Object for nested types,
7086 since we know it does not have any. Big bang for buck:
7091 corlib: 17.99 seconds
7095 corlib: 17.39 seconds
7097 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
7099 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
7100 time we are returning 0 members, so we save alot here.
7102 2003-12-11 Martin Baulig <martin@ximian.com>
7104 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
7105 `MergeChild()', also just take the `FlowBranching' as argument;
7106 call Merge() on it and return the result.
7107 (FlowBranching.Merge): We don't need to do anything if we just
7110 2003-12-11 Martin Baulig <martin@ximian.com>
7112 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
7113 them in an `ArrayList' to reduce memory usage. Thanks to Ben
7114 Maurer for this idea.
7116 2003-12-11 Martin Baulig <martin@ximian.com>
7118 * flowanalysis.cs (MergeResult): This class is now gone; we now
7119 use the `UsageVector' for this. The reason for this is that if a
7120 branching just has one sibling, we don't need to "merge" them at
7121 all - that's the next step to do.
7122 (FlowBranching.Merge): We now return a `UsageVector' instead of a
7125 2003-12-11 Martin Baulig <martin@ximian.com>
7127 Reworked flow analyis and made it more precise and bug-free. The
7128 most important change is that we're now using a special `Reachability'
7129 class instead of having "magic" meanings of `FlowReturns'. I'll
7130 do some more cleanups and optimizations and also add some more
7131 documentation this week.
7133 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
7134 largely reworked this class.
7135 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
7136 the new `Reachability' class instead of having "magic" values here.
7137 (FlowBranching): We're now using an instance of `Reachability'
7138 instead of having separate `Returns', `Breaks' etc. fields.
7140 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
7141 based on flow analysis; ignore the return value of block.Emit ().
7143 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
7145 * driver.cs typemanager.cs: Find the mono extensions to corlib even
7146 if they are private.
7148 2003-12-09 Martin Baulig <martin@ximian.com>
7150 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
7151 call them directly on the UsageVector.
7153 2003-12-09 Martin Baulig <martin@ximian.com>
7155 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
7156 Changed return type from `FlowReturns' to `Reachability'.
7158 2003-12-09 Martin Baulig <martin@ximian.com>
7160 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
7161 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
7162 `Reachable' fields with a single `Reachability' one.
7164 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7166 * class.cs (FindMembers): Remove foreach's.
7179 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7184 This patch does a few things:
7185 1. EmptyStatement is now a singleton, so it is never reallocated.
7186 2. All blah is EmptyStatement constructs have been changed to
7187 blah == EmptyStatement.Value, which is much faster and valid
7188 now that EmptyStatement is a singleton.
7189 3. When resolving a block, rather than allocating a new array for
7190 the non-empty statements, empty statements are replaced with
7191 EmptyStatement.Value
7192 4. Some recursive functions have been made non-recursive.
7193 Mainly the performance impact is from (3), however (1) and (2) are needed for
7194 this to work. (4) does not make a big difference in normal situations, however
7195 it makes the profile look saner.
7200 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
7201 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
7202 Total memory allocated: 56397 KB
7205 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
7206 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
7207 Total memory allocated: 55666 KB
7209 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7211 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
7212 than the hashtable in a hashtable version
7214 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
7215 we always end up concating a string. This results in a huge perf
7216 loss, because many strings have to be tracked by the GC. In this
7217 patch, we first use a hashtable that works with two keys, so that
7218 the strings do not need to be concat'ed.
7229 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
7231 * Makefile: Add a new target `do-time' that does a quick and simple
7232 profile, leaving easy to parse output.
7234 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
7236 * codegen.cs (Init): Create the dynamic assembly with
7237 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
7239 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
7241 * support.cs: Make the PtrHashtable use only one
7242 instance of its comparer.
7244 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
7246 * typemanager.cs: Fix lookup of GetNamespaces.
7248 2003-11-29 Miguel de Icaza <miguel@ximian.com>
7250 * expression.cs: Removed redundant line.
7252 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
7253 ArrayLists, use for loops with bounds.
7255 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
7258 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
7259 arraylists, use for loop with bounds.
7261 The above three changes give us a 0.071 second performance
7262 improvement out of 3.294 seconds down to 3.223. On my machine
7263 the above changes reduced the memory usage by 1,387 KB during
7266 * cs-parser.jay (QualifiedIdentifier): New class used to represent
7267 QualifiedIdentifiers. Before we created a new string through
7268 concatenation, and mostly later on, the result would be
7269 manipulated by DecomposeQI through string manipulation.
7271 This reduced the compiler memory usage for bootstrapping from
7272 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
7273 compile times in 0.05 seconds.
7275 2003-11-28 Dick Porter <dick@ximian.com>
7277 * support.cs: Do string compares with the Invariant culture.
7285 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
7286 the comparison is done with the Invariant culture.
7288 2003-11-27 Miguel de Icaza <miguel@ximian.com>
7290 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
7291 GetEnumerator method.
7293 (ProbeCollectionType): Iterate starting at the most specific type
7294 upwards looking for a GetEnumerator
7296 * expression.cs: Shift count can be up to 31 for int/uint and 63
7299 2003-11-26 Miguel de Icaza <miguel@ximian.com>
7301 * statement.cs (Block.LookupLabel): Also look for the label on the
7302 children blocks. Use a hash table to keep track of visited
7305 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
7306 we actually did transform the other operand, otherwise fall back
7307 to the common codepath that casts to long.
7309 * cs-tokenizer.cs: Use the same code pattern as the int case.
7310 Maybe I should do the parsing myself, and avoid depending on the
7311 Parse routines to get this done.
7313 2003-11-25 Miguel de Icaza <miguel@ximian.com>
7315 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
7316 which fixes bug 51347. This time test it.
7318 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
7319 attributes for example can not tell the difference between these.
7320 The difference was only a syntax feature of the language.
7322 * attribute.cs: Apply attributes to delegates.
7324 * delegate.cs: Call the apply attributes method.
7326 2003-11-24 Miguel de Icaza <miguel@ximian.com>
7328 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
7329 comparing 0 vs Byte.MinValue, not the value
7331 (ImplicitConversionRequired): When reporting a conversion error,
7332 use error 31 to print out the constant error instead of the
7335 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
7336 which fixes bug 51347.
7338 2003-11-22 Miguel de Icaza <miguel@ximian.com>
7340 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
7341 which fixes the -warnaserror command line option.
7343 2003-11-21 Miguel de Icaza <miguel@ximian.com>
7345 * cfold.cs (DoNumericPromotions): During constant folding of
7346 additions on UIntConstant, special case intconstants with
7347 IntConstants like we do on the expression binary operator.
7349 2003-11-12 Miguel de Icaza <miguel@ximian.com>
7351 * convert.cs (ImplicitReferenceConversion): We were missing a case
7352 (System.Enum are not value types or class types, so we need to
7353 classify them separatedly).
7355 * driver.cs: We do not support error 2007.
7357 2003-11-12 Jackson Harper <jackson@ximian.com>
7359 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
7360 system directory. Also use the full file name so users can
7361 libraries names mscorlib-o-tron.dll in a non system dir.
7363 2004-01-04 David Sheldon <dave-mono@earth.li>
7365 * expression.cs: Added matching ")" to error message for CS0077.
7367 2003-12-19 Martin Baulig <martin@ximian.com>
7369 * typemanager.cs (TypeManager.IsEqualGenericType): New public
7370 static method; see documentation in the method.
7371 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
7373 * convert.cs (Convert.ImplicitReferenceConversion,
7374 Convert.ImplicitReferenceConversionExists): Add support for
7375 generic type declarations; see gen-36.cs.
7377 2003-12-19 Martin Baulig <martin@ximian.com>
7379 * pending.cs (Pending.InterfaceMethod): Use
7380 `Type.IsAssignableFrom()' instead of `=='.
7382 2003-12-18 Martin Baulig <martin@ximian.com>
7384 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
7387 * convert.cs (Convert.ImplicitStandardConversionExists): Use
7388 `expr_type.Equals (target_type)' instead of `=='.
7390 2003-12-08 Martin Baulig <martin@ximian.com>
7392 * generics.cs (Constraints.Types): Removed.
7393 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
7395 (Constraints.ResolveTypes): New public method; resolves the
7396 TypeExpr's to Type's.
7397 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
7398 longer takes the constraints.
7399 (TypeParameter.DefineMethod): Likewise.
7400 (TypeParameter.DefineType): New public method. Calls
7401 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
7404 2003-12-08 Martin Baulig <martin@ximian.com>
7406 * convert.cs (Convert.ImplicitConversionStandard): Use
7407 `expr_type.Equals (target_type)' instead of `=='.
7409 2003-12-08 Martin Baulig <martin@ximian.com>
7411 * typemanager.cs (TypeManager.GetReferenceType): Call
7412 `Type.MakeByRefType ()'.
7414 2003-12-08 Martin Baulig <martin@ximian.com>
7416 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
7417 just has some special meaning in some situations. For instance,
7418 it is allowed to use `where' as the name of a variable etc.
7420 2003-12-04 Martin Baulig <martin@ximian.com>
7422 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
7423 `Type.MakeArrayType()' for array types.
7425 2003-11-18 Miguel de Icaza <miguel@ximian.com>
7427 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
7430 (SizeOf.DoResolve): assign the `type_queried' field. This gets
7433 2003-11-16 Martin Baulig <martin@ximian.com>
7435 * codegen.cs (EmitContext.IsGeneric): Removed.
7437 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
7438 ResolveGeneric() on the DeclSpace.
7440 2003-11-16 Martin Baulig <martin@ximian.com>
7442 * generic.cs (TypeArguments.Resolve):
7443 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
7444 `ResolveType()' on it to get the Type.
7446 2003-11-15 Martin Baulig <martin@ximian.com>
7448 * generic.cs (ConstructedType.GetInterfaces): Override this.
7450 2003-11-14 Martin Baulig <martin@ximian.com>
7452 * interface.cs (Interface.DefineType): Define all type parameters
7453 before adding the interfaces we inherit.
7455 2003-11-11 Martin Baulig <martin@ximian.com>
7457 * generic.cs (ConstructedType.ResolveType): Always call
7458 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
7460 2003-11-10 Martin Baulig <martin@ximian.com>
7462 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
7463 (TypeManager.InitCoreTypes): Initialize them here, but instead of
7464 calling `ResolveType()' on them, directly assign their `Type'.
7466 2003-11-08 Martin Baulig <martin@ximian.com>
7468 * generic.cs (ConstructedType): Override `IsClass' etc.
7470 2003-11-08 Martin Baulig <martin@ximian.com>
7472 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
7473 return value and the `out parent' parameter.
7474 (TypeContainer.DefineType): Moved the CS0644 check into
7475 GetClassBases(). Don't pass the interface types to the
7476 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
7477 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
7479 * ecore.cs (TypeExpr.IsAttribute): New property.
7480 (TypeExpr.GetInterfaces): New method.
7482 * interface.cs (Interface.GetInterfaceTypeByName): Return a
7483 TypeExpr instead of a Type.
7484 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
7485 (Interface.DefineType): Don't pass the interface types to the
7486 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
7487 them later and then call `TypeBulider.AddInterfaceImplementation()'.
7489 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
7490 instead of a `Type[]'.
7491 (TypeManager.RegisterBuilder): Likewise.
7492 (TypeManager.AddUserInterface): Likewise.
7493 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
7494 `Type[]' and also return a `TypeExpr[]'.
7495 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
7497 2003-11-08 Martin Baulig <martin@ximian.com>
7499 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
7502 2003-11-08 Martin Baulig <martin@ximian.com>
7504 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
7505 TypeManager.ResolveExpressionTypes().
7507 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
7508 instead of an Expression.
7509 (TypeExpr): This is now an abstract base class for `TypeExpression'.
7510 (TypeExpression): New public class; formerly known as `TypeExpr'.
7512 * expression.cs (ComposedCast): Derive from TypeExpr.
7514 * typemanager.cs (TypeManager.system_*_expr): These are now
7515 TypExpr's instead of Expression's.
7516 (TypeManager.ResolveExpressionTypes): New public static function;
7517 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
7520 2003-11-06 Miguel de Icaza <miguel@ximian.com>
7522 * expression.cs (New.DoResolve): Do not dereference value that
7523 might be a null return.
7525 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
7526 sure that the constant value has the right type. Fixes an
7527 unreported bug, similar to 50425.
7529 * const.cs (Const.LookupConstantValue): Call
7530 ImplicitStandardConversionExists before doing a conversion to
7531 avoid havng the TypeManager.ChangeType do conversions.
7533 Reduced the number of casts used
7535 (Const.ChangeType): New routine to enable reuse of the constant
7536 type changing code from statement.
7538 * typemanager.cs (ChangeType): Move common initialization to
7539 static global variables.
7543 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
7544 every value type to go through, even if it was void. Fix that.
7546 * cs-tokenizer.cs: Use is_identifier_start_character on the start
7547 character of the define, and the is_identifier_part_character for
7548 the rest of the string.
7550 2003-11-05 Miguel de Icaza <miguel@ximian.com>
7552 * expression.cs (UnaryMutator.EmitCode): When I updated
7553 LocalVariableReference.DoResolve, I overdid it, and dropped an
7554 optimization done on local variable references.
7556 2003-11-04 Miguel de Icaza <miguel@ximian.com>
7558 * ecore.cs: Convert the return from Ldlen into an int.
7560 2003-10-20 Miguel de Icaza <miguel@ximian.com>
7562 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
7563 the accessibility, this is a special case for toplevel non-public
7564 classes (internal for instance).
7566 2003-10-20 Nick Drochak <ndrochak@gol.com>
7568 * ecore.cs: Fix typo and build. Needed another right paren.
7570 2003-10-19 Miguel de Icaza <miguel@ximian.com>
7572 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
7573 `internal' case regular and protected, but not allowing protected
7574 to be evaluated later. Bug 49840
7576 2003-10-15 Miguel de Icaza <miguel@ximian.com>
7578 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
7579 to kb.Nlast, and not the kb.nFirst to isolate the switch
7582 Extract the underlying type, so enumerations of long/ulong are
7583 treated like long/ulong.
7585 2003-10-14 Miguel de Icaza <miguel@ximian.com>
7587 * expression.cs (New): Overload the meaning of RequestedType to
7588 track the possible creation of the NewDelegate type, since
7589 DoResolve is invoked more than once for new constructors on field
7592 See bugs: #48800 and #37014
7594 * cs-parser.jay (declare_local_constants): Take an arraylist
7595 instead of a single constant.
7597 (local_constant_declaration): It should take a
7598 constant_declarators, not a constant_declarator. Fixes 49487
7600 * convert.cs: Fix error report.
7602 2003-10-13 Jackson Harper <jackson@ximian.com>
7604 * typemanager.cs (TypeToCoreType): Add float and double this fixes
7607 2003-11-03 Martin Baulig <martin@ximian.com>
7609 * expression.cs (ArrayAccess.GetStoreOpcode): Added
7610 `out bool has_type_arg'; if set, we need to pass the type to
7612 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
7613 Stelem_Any/Ldelem_Any for generic parameters.
7615 2003-11-02 Martin Baulig <martin@ximian.com>
7617 * expression.cs (Invocation.EmitCall): Use
7618 `TypeManager.IsValueType()' to check whether it's a value type.
7619 Don't set `struct_call' when calling a method on a type parameter.
7621 2003-11-02 Martin Baulig <martin@ximian.com>
7623 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
7624 and removed the TypeBuilder argument.
7626 * typemanager.cs (TypeManager.IsValueType): Return
7627 `t.IsGenericParameter || t.IsValueType'.
7629 2003-10-25 Martin Baulig <martin@ximian.com>
7631 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
7632 call ConstructedType.Resolve() on it.
7634 * generic.cs (ConstructedType.Resolve): Set `type' on success.
7636 2003-10-25 Martin Baulig <martin@ximian.com>
7638 * class.cs (TypeContainer.GetClassBases): Changed
7639 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
7640 CS8214 reporting here.
7641 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
7642 instead of a `Type' for our parent. In case of a recursive
7643 declaration (see tests/gen-23.cs for an example), our parent is a
7644 ConstructedType and it doesn't have its type set. So, first
7645 create our own TypeBuilder, then call constructed.Resolve() to get
7646 the parent's type and finally TypeBuilder.SetParent() it.
7648 * ecore.cs (TypeExpr.Name): New public virtual property.
7651 (ConstructedType): We're now a TypeExpr and not just an Expression.
7652 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
7653 arguments here; this is done later.
7654 (ConstructedType.Resolve): New public method to resolve the type
7655 arguments and bind them.
7657 2003-10-21 Martin Baulig <martin@ximian.com>
7659 * convert.cs: Use `TypeManager.IsValueType' instead of
7660 'type.IsValueType' everywhere.
7662 * typemanager.cs (TypeManager.IsValueType): Return true for type
7663 parameters. The reason for this is that we need to box a type
7664 parameter when converting it to a reference type.
7666 * cs-parser.jay: Added support for default value expressions.
7668 * generics.cs (DefaultValueExpression): New public class.
7670 2003-10-17 Martin Baulig <martin@ximian.com>
7672 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
7673 TypeContainer so we can also use this for Interfaces.
7674 (TypeParameter.Resolve): Likewise.
7676 * interface.cs (Interface.DefineType): Added support for generic
7679 * cs-parser.jay: Added support for generic structs and interfaces.
7681 2003-10-17 Martin Baulig <martin@ximian.com>
7683 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
7684 call generic methods :-)
7686 2003-10-16 Martin Baulig <martin@ximian.com>
7688 * cs-parser.jay (namespace_or_type_name): Only create a
7689 GenericMemberAccess if we actually have type arguments.
7691 2003-10-13 Martin Baulig <martin@ximian.com>
7693 * class.cs (Method.Define): If we're a generic method, call
7694 TypeBuilder.DefineGenericMethod () before resolving
7696 (MethodData): Added .ctor which takes an additional MethodBuilder
7697 argument; this is used for generic methods.
7698 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
7699 we already have a MethodBuilder.
7701 2003-10-10 Martin Baulig <martin@ximian.com>
7703 * class.cs (Method): Added .ctor which takes a `GenericMethod'
7704 instead of a `DeclSpace'. This is used for generic methods.
7706 * cs-parser.jay (method_header): Added support for generic
7707 methods; create a `GenericMethod' instance and pass it to the
7708 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
7709 parameters and locals.
7711 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
7712 since we already have the location. Check whether we're a generic
7713 type declaration or a generic method and create the correct type
7716 * generic.cs (TypeParameter.DefineMethod): New public method.
7717 (GenericMethod): New public class; derives from DeclSpace and is
7718 used for generic methods.
7720 2003-10-09 Martin Baulig <martin@ximian.com>
7722 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
7724 (MethodCore.DoDefineParameters): Removed the TypeContainer
7725 argument; use the DeclSpace which was passed to the .ctor instead.
7726 (MethodCore.CheckParameter): Take a DeclSpace instead of a
7727 TypeContainer; we only need a DeclSpace here.
7729 2003-10-09 Martin Baulig <martin@ximian.com>
7731 * class.cs (MethodData): Added additional `DeclSpace ds' argument
7733 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
7734 EmitContext's .ctor.
7736 2003-10-09 Martin Baulig <martin@ximian.com>
7738 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
7739 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
7740 AsAccessible(), moved them as well.
7742 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
7744 2003-10-07 Miguel de Icaza <miguel@ximian.com>
7746 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
7747 generation for >=, as spotted by Paolo, bug 48679.
7748 Patch from David Waite.
7750 * cs-tokenizer.cs: Add handling for #pragma.
7752 * cs-parser.jay: Allow for both yield and yield return in the
7753 syntax. The anti-cobolization of C# fight will go on!
7755 * class.cs (TypeBuilder.DefineType): Catch error condition here
7756 (Parent.DefineType erroring out and returning null).
7758 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7759 coping with enumerations variables, we were mistakenly processing
7760 them as a regular value type instead of built-in types. Fixes the
7763 * typemanager.cs (IsBuiltinOrEnum): New method.
7765 2003-09-30 Miguel de Icaza <miguel@ximian.com>
7767 * cs-parser.jay: Upgrade: yield now needs the return clause.
7769 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7771 * cs-parser.jay : Renamed yyName to yyNames related to jay.
7773 2003-09-29 Martin Baulig <martin@ximian.com>
7775 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
7776 inflated generic methods.
7778 * generics.cs (ConstructedType): Distinguish between open and
7779 closed constructed types; correctly resolve the arguments.
7781 2003-09-22 Martin Baulig <martin@ximian.com>
7783 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
7784 all type arguments meet their constraints.
7786 2003-09-19 Martin Baulig <martin@ximian.com>
7788 * decl.cs (MemberCache.SetupCacheForInterface): Take a
7789 `MemberCache parent' argument. Normally, an interface doesn't
7790 have a parent type except System.Object, but we use this in gmcs
7791 for generic type parameters.
7793 2003-09-18 Martin Baulig <martin@ximian.com>
7795 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
7796 on `type.IsInterface'; don't check whether the type has a parent
7797 to determine whether it's an interface.
7799 2003-09-17 Martin Baulig <martin@ximian.com>
7801 * generic.cs (ConstructedType.ToString): Always use `name' as the
7804 2003-09-15 Martin Baulig <martin@ximian.com>
7806 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
7808 * generic.cs (Constraints.Resolve): New public method; this is
7809 called to resolve the constraint types and to check whether all
7810 the constraints are correct.
7811 (Constraints.Types): New public property.
7812 (TypeParameter.Resolve): New public method; resolves all the
7815 * class.cs (TypeContainer.DefineType): Call
7816 TypeParameter.Resolve() before actually defining the type.
7818 2003-09-15 Martin Baulig <martin@ximian.com>
7820 * class.cs (TypeContainer.DefineType): Added an error flag to
7821 avoid reporting duplicate CS0146's ("class definition is
7824 * driver.cs (Driver.MainDriver): Abort if
7825 RootContext.ResolveTree() reported any errors.
7827 2003-09-07 Martin Baulig <martin@ximian.com>
7829 * report.cs (Error, Warning): Added overloaded versions which take
7830 a `params object[] args' and call String.Format().
7832 2003-09-07 Martin Baulig <martin@ximian.com>
7834 * decl.cs (DeclSpace..ctor): Don't call
7835 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7836 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7837 (DeclSpace.RecordDecl): New method.
7839 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7841 2003-09-02 Ravi Pratap <ravi@ximian.com>
7843 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7844 value attributes to be applied to ParameterBuilders.
7846 * class.cs (MethodCore.LabelParameters): Make static and more
7847 generic so that it can be used from other places - like interface
7848 methods, for instance.
7850 * interface.cs (Interface.Emit): Call LabelParameters before
7851 emitting attributes on the InterfaceMethod.
7853 2003-09-07 Martin Baulig <martin@ximian.com>
7855 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7856 if the number of type parameters doesn't match.
7858 2003-09-04 Martin Baulig <martin@ximian.com>
7860 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7861 for arrays of generic type params (ie. `!0[]').
7863 2003-09-04 Martin Baulig <martin@ximian.com>
7865 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7868 2003-09-04 Martin Baulig <martin@ximian.com>
7870 * decl.cs (DeclSpace.LookupGeneric): New method.
7871 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7874 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7875 argument, not just a string.
7876 (TypeParameter.Define): New public method; this is called to
7877 actually define the generic parameter; after this, you can use the
7878 new `Type' property to get the type.
7880 2003-09-04 Martin Baulig <martin@ximian.com>
7882 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7883 is now an ArrayList; initialize the result of the `TypeParameters'
7885 (DeclSpace.GetGenericData): Removed.
7886 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7887 implement this in a different way.
7888 (DeclSpace.GetTypeParameters): Removed; there's now a
7889 `TypeParameters' property.
7890 (DeclSpace.TypeParameters): New public property.
7892 * generic.cs (Constraints): Make this class public.
7893 (TypeParameter): New public class.
7895 2003-09-04 Martin Baulig <martin@ximian.com>
7897 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7900 * class.cs (TypeContainer.DefineType): Call
7901 TypeBuilder.DefineGenericParameter () on all generic parameters if
7902 this is a generic type.
7904 2003-08-28 Martin Baulig <martin@ximian.com>
7906 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7909 * sample-hello.cs: Compile this with gmcs: "gmcs
7910 /r:sample-stack.dll sample-hello.cs".
7912 2003-08-28 Martin Baulig <martin@ximian.com>
7914 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7915 the parameters to the generic type.
7917 2003-08-28 Martin Baulig <martin@ximian.com>
7919 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7921 2003-08-28 Martin Baulig <martin@ximian.com>
7923 * cs-parser.jay (opt_type_argument_list): Use
7924 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7925 (primary_expression): Replace `qualified_identifier' with `type_name'.
7926 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7928 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7929 parser to check whether it is syntactically a type parameter list;
7930 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7933 2003-08-26 Martin Baulig <martin@ximian.com>
7935 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7936 resolving aliases; fixes #47927.
7938 2003-08-26 Martin Baulig <martin@ximian.com>
7940 * statement.cs (Using.DoResolve): This is internally emitting a
7941 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7942 do not always return. Fixes #47681.
7944 2003-08-26 Martin Baulig <martin@ximian.com>
7946 * decl.cs (MemberCore): Moved WarningNotHiding(),
7947 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7949 (AdditionResult): Make this nested in DeclSpace.
7950 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7951 argument; call NamespaceEntry.Define() unless we're nested in a
7954 * namespace.cs (Namespace.DefineName): New public function. This
7955 is called from DeclSpace's .ctor to add
7956 (Namespace.Lookup): Include DeclSpaces in the lookup.
7958 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7960 * const.cs (Const): Derive from MemberBase, not MemberCore.
7962 2003-08-25 Martin Baulig <martin@ximian.com>
7964 * convert.cs (Convert.ExplicitReferenceConversion): When
7965 converting from an interface type to a class, unbox if the target
7966 type is a struct type. Fixes #47822.
7968 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7970 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7973 2003-08-22 Martin Baulig <martin@ximian.com>
7975 * class.cs (TypeManager.DefineType): When defining a nested type,
7976 call DefineType() on our parent; fixes #47801.
7978 2003-08-22 Martin Baulig <martin@ximian.com>
7980 * class.cs (MethodData.Define): While checking if a method is an
7981 interface implementation, improve the test a bit more to fix #47654.
7983 2003-08-22 Martin Baulig <martin@ximian.com>
7985 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7986 correctly; fixes #47722.
7988 2003-08-22 Martin Baulig <martin@ximian.com>
7990 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7991 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7993 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7995 2003-08-22 Martin Baulig <martin@ximian.com>
7997 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7998 can only be assigned in static constructors. Fixes #47161.
8000 2003-08-22 Martin Baulig <martin@ximian.com>
8002 Rewrote and improved the flow analysis code.
8004 * flowbranching.cs (FlowBranching): Make this class abstract.
8005 (FlowBranching.CreateBranching): New static function to create a
8007 (FlowBranchingBlock, FlowBranchingException): New classes.
8008 (FlowBranching.UsageVector.Type): New public readonly field.
8009 (FlowBranching.UsageVector.Breaks): Removed the setter.
8010 (FlowBranching.UsageVector.Returns): Removed the setter.
8011 (FlowBranching.UsageVector): Added Break(), Return(),
8012 NeverReachable() and Throw() methods to modify the reachability.
8013 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
8014 done by FlowBranching.Merge().
8015 (FlowBranching.UsageVector.MergeChild): New method; merges the
8016 merge result into the current vector.
8017 (FlowBranching.Merge): New abstract method to merge a branching.
8019 2003-08-12 Martin Baulig <martin@ximian.com>
8021 * expression.cs (Indirection.CacheTemporaries): Create the
8022 LocalTemporary with the pointer type, not its element type.
8024 2003-08-10 Miguel de Icaza <miguel@ximian.com>
8026 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
8027 token was a keyword or not.
8029 Add `error' options where an IDENTIFIER was expected; Provide
8030 CheckToken and CheckIdentifierToken convenience error reporting
8033 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
8035 * decl.cs: Rename `NamespaceEntry Namespace' public field into
8036 NameSpaceEntry NameSpaceEntry.
8038 (LookupInterfaceOrClass): Avoid creating a full qualified name
8039 from namespace and name: avoid doing lookups when we know the
8040 namespace is non-existant. Use new Tree.LookupByNamespace which
8041 looks up DeclSpaces based on their namespace, name pair.
8043 * driver.cs: Provide a new `parser verbose' to display the
8044 exception thrown during parsing. This is turned off by default
8045 now, so the output of a failure from mcs is more graceful.
8047 * namespace.cs: Track all the namespaces defined in a hashtable
8050 (IsNamespace): New method
8052 2003-08-09 Miguel de Icaza <miguel@ximian.com>
8054 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
8055 we know that we need to concatenate (full typename can never be
8060 * statement.cs: Use a bitfield; Do not initialize to null things
8061 which are done by the constructor by default.
8063 * cs-parser.jay: bug fix, parameter was 4, not 3.
8065 * expression.cs: Just use the property;
8067 * statement.cs: No need for GetVariableInfo method.
8069 2003-08-08 Martin Baulig <martin@ximian.com>
8071 * flowanalysis.cs (FlowReturns): This is now nested in the
8072 `FlowBranching' class.
8073 (MyBitVector): Moved this here from statement.cs.
8074 (FlowBranching.SiblingType): New enum type.
8075 (FlowBranching.CreateSibling): Added `SiblingType' argument.
8077 2003-08-07 Martin Baulig <martin@ximian.com>
8079 * flowanalysis.cs (FlowBranchingType): This is now nested in the
8080 `FlowBranching' class and called `BranchingType'.
8082 2003-08-07 Martin Baulig <martin@ximian.com>
8084 * flowanalysis.cs: Moved all the control flow analysis code into
8087 2003-08-07 Martin Baulig <martin@ximian.com>
8089 * assign.cs (Assign.DoResolve): `target' must either be an
8090 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
8093 2003-08-07 Miguel de Icaza <miguel@ximian.com>
8095 * expression.cs (BinaryMethod): This kind of expression is created by the
8096 Binary class if it determines that the operator has to be handled
8099 (BinaryDelegate): This kind of expression is created if we are
8100 dealing with a + or - operator on delegates.
8102 (Binary): remove method, argumetns, and DelegateOperator: when
8103 dealing with methods,
8105 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
8107 * statement.cs (Block): use bitfields for the three extra booleans
8108 we had in use. Remove unused topblock parameter.
8110 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
8112 * assign.cs: Drop extra unneeded tests.
8114 2003-08-06 Miguel de Icaza <miguel@ximian.com>
8116 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
8118 * statement.cs (Foreach): Use VariableStorage instead of
8121 * codegen.cs (VariableStorage): New class used by clients that
8122 require a variable stored: locals or fields for variables that
8123 need to live across yield.
8125 Maybe provide a convenience api for EmitThis+EmitLoad?
8127 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
8130 2003-08-05 Miguel de Icaza <miguel@ximian.com>
8132 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
8133 RemapParameterLValue): New methods that are used to turn a
8134 precomputed FieldInfo into an expression like this:
8138 The idea is to use this instead of making LocalVariableReference
8139 have more than one meaning.
8141 * cs-parser.jay: Add error production to BASE.
8143 * ecore.cs: Deal with TypeManager.GetField returning null, which
8144 is now a valid return value.
8146 (FieldExprNoAddress): New expression for Fields whose address can
8149 * expression.cs (LocalVariableReference): During the resolve
8150 phases, create new expressions if we are in a remapping context.
8151 Remove code that dealt with remapping here.
8153 (ParameterReference): same.
8155 (ProxyInstance): New expression, like the `This' expression, but
8156 it is born fully resolved. We know what we are doing, so remove
8157 the errors that are targeted to user-provided uses of `this'.
8159 * statement.cs (Foreach): our variable is now stored as an
8160 Expression; During resolution, follow the protocol, dont just
8161 assume it will return this.
8163 2003-08-06 Martin Baulig <martin@ximian.com>
8165 * support.cs (SeekableStreamReader.cs): New public class.
8167 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
8168 SeekableStreamReader instead of the normal StreamReader.
8170 2003-08-04 Martin Baulig <martin@ximian.com>
8172 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
8173 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
8174 deambiguate casts and delegate invocations.
8175 (parenthesized_expression): Use the new tokens to ensure this is
8176 not a cast of method invocation.
8178 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
8179 when reading a `)' and Deambiguate_CloseParens () was previously
8182 * expression.cs (ParenthesizedExpression): New class. This is
8183 just used for the CS0075 test.
8184 (Binary.DoResolve): Check for CS0075.
8186 2003-07-29 Ravi Pratap <ravi@ximian.com>
8188 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
8189 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
8190 reference comparison.
8192 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
8193 examine the ReturnType for equality - this is necessary in the
8194 cases of implicit and explicit operators whose signature also
8195 includes the return type.
8197 2003-07-26 Miguel de Icaza <miguel@ximian.com>
8199 * namespace.cs: Cache the result of the namespace computation,
8200 instead of computing it every time.
8202 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8204 * decl.cs: Use a global arraylist that we reuse over invocations
8205 to avoid excesive memory consumption. Reduces memory usage on an
8206 mcs compile by one meg (45 average).
8208 * typemanager.cs (LookupTypeReflection): In .NET pointers are
8209 private, work around that.
8211 2003-07-23 Miguel de Icaza <miguel@ximian.com>
8213 * literal.cs (IntLiteral): Define Zero and One static literals.
8215 * cs-parser.jay (integer_literal): use static literals to reduce
8216 memory usage for the most used literals (0, 1 and -1). 211kb
8217 reduced in memory usage.
8219 Replace all calls to `new ArrayList' with `new
8220 ArrayList(4)' which is a good average number for most allocations,
8221 and also requires only 16 bytes of memory for its buffer by
8224 This reduced MCS memory usage in seven megabytes for the RSS after
8227 2003-07-28 Ravi Pratap <ravi@ximian.com>
8229 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
8230 handle params methods the correct way by forming only one
8231 applicable set with params and normal methods in them. Earlier we
8232 were looking at params methods only if we found no normal methods
8233 which was not the correct thing to do.
8235 (Invocation.BetterFunction): Take separate arguments indicating
8236 when candidate and the best method are params methods in their
8239 This fixes bugs #43367 and #46199.
8241 * attribute.cs: Documentation updates.
8243 (CheckAttribute): Rename to CheckAttributeTarget.
8244 (GetValidPlaces): Rename to GetValidTargets.
8246 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
8247 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
8251 2003-07-28 Miguel de Icaza <miguel@ximian.com>
8253 * codegen.cs: Compute IsGeneric correctly.
8255 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
8258 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
8259 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
8260 regressions, and I was chasing more bugs than I required.
8262 * interface.cs: Use expressions for base type names (like classes
8263 and structs have been doing for a while now), and resolve that.
8264 This patch should probably go into head as well.
8266 This makes it one less user of FindType.
8268 2003-07-24 Miguel de Icaza <miguel@ximian.com>
8270 This compiler can not self host currently. Need to fix that.
8272 * Makefile: compile to `gmcs.exe'
8274 * driver.cs: Turn on v2 by default on gmcs.
8276 * generic.cs (ConstructedType): Does no longer take a container
8277 type argument; That will be taken care of later.
8279 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
8280 Use SimpleName to resolve for now, so we can continue the work on
8281 the parser, until we get Type.GetType that understands generics.
8283 (ConstructedType.ToString): Implement
8285 (TypeArguments.Resolve): Resolve the child expressions as types.
8287 * cs-parser.jay: Rename interface_constraints to
8288 type_parameter_constraints
8290 (namespace_or_type_name): Only use constructed types for the basic
8291 construction, we will deal with identifier<...> later.
8293 (type/type_name): No longer call DecomposeQI, as
8294 namespace_or_type_name is always decoded now.
8296 2003-07-22 Ravi Pratap <ravi@ximian.com>
8298 * expression.cs (Invocation.OverloadResolve): Follow the spec more
8299 closely: we eliminate methods in base types when we have an
8300 applicable method in a top-level type.
8302 Please see section 14.5.5.1 for an exact description of what goes
8305 This fixes bug #45127 and a host of other related to corlib compilation.
8307 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
8308 array is the method corresponding to the top-level type (this is
8309 because of the changes made to icall.c) so we change this
8312 (MethodGroupExpr.Name): This too.
8314 * typemanager.cs (GetElementType): New method which does the right
8315 thing when compiling corlib.
8317 * everywhere: Make use of the above in the relevant places.
8319 2003-07-22 Martin Baulig <martin@ximian.com>
8321 * cs-parser.jay (invocation_expression): Moved
8322 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
8323 `cast_expression', but create a InvocationOrCast which later
8324 resolves to either an Invocation or a Cast.
8326 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
8327 method; call this before EmitStatement() to make sure that this
8328 expression can be used as a statement.
8330 * expression.cs (InvocationOrCast): New class; resolves to either
8331 an Invocation or a Cast.
8333 * statement.cs (StatementExpression): Call ResolveStatement() on
8334 the ExpressionStatement before emitting it.
8336 2003-07-21 Martin Baulig <martin@ximian.com>
8338 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
8339 `ref' and `out' attributes match; fixes #46220.
8340 (MemberAccess.ResolveMemberAccess): You can't reference a type
8341 through an expression; fixes #33180.
8342 (Indexers.GetIndexersForType): Don't return the indexers from
8343 interfaces the class implements; fixes #46502.
8345 2003-07-21 Martin Baulig <martin@ximian.com>
8347 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
8348 CS0661 checks; fixes bug #30442.
8350 2003-07-21 Martin Baulig <martin@ximian.com>
8352 * decl.cs (AdditionResult): Added `Error'.
8354 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
8356 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
8357 cs0031.cs actually work.
8359 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8361 * cs-parser.jay (namespace_name): do not use
8362 namespace_or_type_name, use qualified_identifier, because
8363 namespace_or_type_name will soon return a composed expression
8364 instead of a string.
8366 (namespace_or_type_name): Instead of returning a string, now this
8367 production returns an expression.
8369 * codegen.cs (EmitContext): Setup IsGeneric property based on
8370 whether our DeclSpace is generic, our the method is generic.
8372 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
8373 the method is generic.
8375 * cs-parser.jay (type_arguments, opt_type_argument_list,
8376 type_parameters, type_parameter_list, opt_type_parameter_list,
8377 type_parameter,, opt_type_parameter_constraints_clauses,
8378 type_parameter_constraints_clauses,
8379 type_parameter_constraint_clause, type_parameter_constraint,
8380 interface_constraints): Add new production
8382 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
8383 DeclSpace is generic or not.
8385 (DeclSpace.SetParameterInfo): New routine, used to set the
8386 parameter info for a type.
8388 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
8389 returns a GenericTypeExpr
8391 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
8392 generic, lookup the generic argument.
8394 * attribute.cs: Do not allow TypeParameterExpressions in
8397 * class.cs: Do not allow the Main method to be defined in a
8400 * expression.cs (SizeOf): Do not allow generic types to be used as
8401 arguments to sizeof.
8403 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
8404 it: whether a type is generic or not. Only works for types we are
8405 currently building for now.
8407 2003-07-20 Martin Baulig <martin@ximian.com>
8409 * namespace.cs: Fixed that bug which caused a crash when compiling
8412 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8414 * typemanager.cs (LookupTypeReflection): Never expose types which
8415 are NotPublic, NestedPrivate, NestedAssembly, or
8416 NestedFamANDAssem. We used to return these, and later do a check
8417 that would report a meaningful error, but the problem is that we
8418 would not get the real match, if there was a name override.
8420 2003-07-18 Miguel de Icaza <miguel@ximian.com>
8422 * namespace.cs (Namespace, Name): Do not compute the namespace
8423 name dynamically, compute it in the constructor. This reduced
8424 memory usage by 1697 KB.
8426 * driver.cs: Use --pause to pause at the end.
8428 2003-07-17 Peter Williams <peter@newton.cx>
8430 * Makefile: Change the name of the test target so that it doesn't
8431 conflict with the recursive test target.
8433 2003-07-17 Miguel de Icaza <miguel@ximian.com>
8435 * expression.cs (LocalVariableReference.Emit, EmitAssign,
8436 AddressOf): Do not use EmitThis, that was wrong, use the actual
8439 2003-07-15 Miguel de Icaza <miguel@ximian.com>
8441 * class.cs (MethodData.Define): While checking if a method is an
8442 interface implementation, improve the test: If we are not public
8443 (use new test here: use the computed MethodAttributes directly,
8444 instead of the parsed modifier flags) check if the `implementing'
8445 method comes from an interface or not.
8447 * pending.cs (VerifyPendingMethods): Slightly better error
8450 * makefile: add test target that does the mcs bootstrap.
8452 2003-07-16 Ravi Pratap <ravi@ximian.com>
8454 * interface.cs (Define): Do nothing here since there are no
8455 members to populate etc. Move the attribute emission out of here
8456 since this was just totally the wrong place to put it. Attribute
8457 application happens during the 'Emit' phase, not in the 'Define'
8460 (Emit): Add this method and move the attribute emission here
8462 * rootcontext.cs (EmitCode): Call the Emit method on interface
8465 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8467 * expression.cs (OverloadResolve): Report error only if Location
8468 is not 'Null' which means that there was a probe going on.
8470 2003-07-14 Martin Baulig <martin@ximian.com>
8472 * expression.cs (ConditionalLogicalOperator): New public class to
8473 implement user defined conditional logical operators.
8474 This is section 14.11.2 in the spec and bug #40505.
8476 2003-07-14 Martin Baulig <martin@ximian.com>
8478 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
8480 2003-07-14 Martin Baulig <martin@ximian.com>
8482 * codegen.cs (EmitContext.InFixedInitializer): New public field.
8484 * ecore.cs (IVariable.VerifyFixed): New interface method.
8486 * expression.cs (Unary.ResolveOperator): When resolving the `&'
8487 operator, check whether the variable is actually fixed. Fixes bug
8488 #36055. Set a variable definitely assigned when taking its
8489 address as required by the spec.
8491 * statement.cs (LocalInfo.IsFixed): New field.
8492 (LocalInfo.MakePinned): Set `IsFixed' to true.
8494 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8496 * attribute.cs (Attribute.Resolve): While doing a Member lookup
8497 for .ctors, ensure that we only ask for members declared in the
8498 attribute type (BindingFlags.DeclaredOnly).
8502 * expression.cs (Error_WrongNumArguments): Report error 1501
8503 correctly the way CSC does.
8505 2003-07-13 Martin Baulig <martin@ximian.com>
8507 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
8508 lookup on the fully qualified name, to make things like "X.X" work
8509 where "X.X" is a fully qualified type name, but we also have a
8510 namespace "X" in the using list. Fixes #41975.
8512 2003-07-13 Martin Baulig <martin@ximian.com>
8514 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
8515 function. If we're a CompoundAssign, we need to create an embedded
8516 CompoundAssign, not an embedded Assign.
8517 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
8520 2003-07-13 Martin Baulig <martin@ximian.com>
8522 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
8523 work to fix bug #46088.
8525 2003-07-13 Ravi Pratap <ravi@ximian.com>
8527 * class.cs (Operator.Emit): Do not emit attributes here - it is
8528 taken care of by the Method class that we delegate too. This takes
8531 2003-07-10 Martin Baulig <martin@ximian.com>
8533 * expression.cs (TypeOfVoid): New class.
8534 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
8536 2003-07-10 Martin Baulig <martin@ximian.com>
8538 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
8541 2003-07-10 Martin Baulig <martin@ximian.com>
8543 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
8544 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
8546 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
8548 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
8550 2003-07-10 Martin Baulig <martin@ximian.com>
8552 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
8553 of decimal. Fixes #42850.
8555 NOTE: I also fixed the created byte blob, but this doesn't work on
8556 the MS runtime and csc never produces any byte blobs for decimal
8559 2003-07-10 Martin Baulig <martin@ximian.com>
8561 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
8562 structs; fixes #32068.
8563 (Block.AddChildVariableNames): Fixed #44302.
8565 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8567 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
8569 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8571 * attribute.cs: And this test is onger needed.
8573 2003-07-08 Martin Baulig <martin@ximian.com>
8575 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
8576 inaccessible types. Fixes #36313.
8578 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
8580 * namespace.cs (NamespaceEntry): Create implicit entries for all
8581 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
8582 implicit entries for N1.N2 and N1.
8584 2003-07-08 Martin Baulig <martin@ximian.com>
8586 Rewrote the handling of namespaces to fix a lot of the issues
8587 wrt. `using' aliases etc.
8589 * namespace.cs (Namespace): Splitted this class into a
8590 per-assembly `Namespace' and a per-file `NamespaceEntry'.
8592 * typemanager.cs (TypeManager.IsNamespace): Removed.
8593 (TypeManager.ComputeNamespaces): Only compute namespaces from
8594 loaded assemblies here, not the namespaces from the assembly we're
8595 currently compiling.
8597 2003-07-08 Martin Baulig <martin@ximian.com>
8599 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
8601 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8603 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
8606 I thought about the memory savings here, but LookupTypeReflection
8607 is used under already very constrained scenarios. Compiling
8608 corlib or mcs only exposes one hit, so it would not really reduce
8609 any memory consumption.
8611 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8613 * typemanager.cs: fixes bug #45889 by only adding public types from
8614 other assemblies to the list of known types.
8616 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8618 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
8619 on the type we resolved.
8621 2003-07-05 Martin Baulig <martin@ximian.com>
8623 * pending.cs (PendingImplementation.ParentImplements): Don't
8624 create the proxy if the parent is abstract.
8626 * class.cs (TypeContainer.DefineIndexers): Process explicit
8627 interface implementations first. Fixes #37714.
8629 2003-07-04 Miguel de Icaza <miguel@ximian.com>
8631 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
8632 defined recursively; but since we modify the input parameters
8633 (left is set to `this' temporarily), we reset this value if the
8634 left_is_explicit is false, which gives the original semantics to
8637 * literal.cs (NullPointer): new class used to represent a null
8638 literal in a pointer context.
8640 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
8641 type is a pointer, use a NullPointer object instead of a
8642 NullLiteral. Closes 43687
8644 (ExplicitConversion): Convert pointer values using
8645 the conv opcode to the proper type.
8647 * ecore.cs (New): change ValueTypeVariable property into a method,
8648 that returns whether the valuetype is suitable for being used.
8650 * expression.cs (Binary.DoNumericPromotions): Only return if we
8651 the int constant was a valid uint, and we can return both left and
8652 right as uints. If not, we continue processing, to trigger the
8653 type conversion. This fixes 39018.
8655 * statement.cs (Block.EmitMeta): During constant resolution, set
8656 the CurrentBlock property on the emitcontext, so that we resolve
8657 constants propertly.
8659 2003-07-02 Martin Baulig <martin@ximian.com>
8661 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
8662 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
8664 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
8665 than emitting it here.
8667 * statement.cs: Fixed some more flow analysis bugs.
8669 2003-07-02 Martin Baulig <martin@ximian.com>
8671 * class.cs (MethodData.Define): When implementing interface
8672 methods, set Final unless we're Virtual.
8674 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
8675 check work for interface methods.
8677 2003-07-01 Martin Baulig <martin@ximian.com>
8679 * ecore.cs (EmitContext.This): Replaced this property with a
8680 GetThis() method which takes a Location argument. This ensures
8681 that we get the correct error location for a CS0188.
8683 2003-07-01 Miguel de Icaza <miguel@ximian.com>
8685 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
8686 ImplicitStandardConversion.
8688 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
8690 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
8692 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
8695 2003-06-30 Miguel de Icaza <miguel@ximian.com>
8697 * class.cs (Constructor.Define): Turn off initlocals for unsafe
8700 (MethodData.Define): Turn off initlocals for unsafe methods.
8702 2003-06-29 Miguel de Icaza <miguel@ximian.com>
8704 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
8705 complete; Fixes #37521.
8707 * delegate.cs: Use Modifiers.TypeAttr to compute the
8708 TypeAttributes, instead of rolling our own. This makes the flags
8709 correct for the delegates.
8711 2003-06-28 Miguel de Icaza <miguel@ximian.com>
8713 * class.cs (Constructor.Define): Set the private flag for static
8714 constructors as well.
8716 * cs-parser.jay (statement_expression): Set the return value to
8717 null, to avoid a crash when we catch an error.
8719 2003-06-24 Miguel de Icaza <miguel@ximian.com>
8721 * cs-parser.jay: Applied patch from Jackson that adds support for
8722 extern and unsafe modifiers to destructor declarations.
8724 * expression.cs: Report error 21 if the user is trying to index a
8727 * driver.cs: Add an error message, suggested by the bug report.
8729 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
8730 if we do not have a ": this ()" constructor initializer. Fixes 45149
8732 2003-06-14 Miguel de Icaza <miguel@ximian.com>
8734 * namespace.cs: Add some information to reduce FAQs.
8736 2003-06-13 Miguel de Icaza <miguel@ximian.com>
8738 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
8739 underlying enumeration types. Fixes #43915.
8741 * expression.cs: Treat ushort/short as legal values to be used in
8744 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
8746 * delegate.cs: transfer custom attributes for paramenters from
8747 the delegate declaration to Invoke and BeginInvoke.
8749 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
8751 * attribute.cs: handle custom marshalers and emit marshal info
8754 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
8756 * makefile.gnu: Added anonymous.cs to the compiler sources.
8758 2003-05-28 Miguel de Icaza <miguel@ximian.com>
8760 * iterators.cs: Change the name of the proxy class to include two
8763 * cs-parser.jay: Update grammar to include anonymous methods.
8765 * anonymous.cs: new file.
8767 2003-05-27 Miguel de Icaza <miguel@ximian.com>
8769 * class.cs (Field.Define): Add missing test for pointers and
8772 2003-05-27 Ravi Pratap <ravi@ximian.com>
8774 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
8775 we use the stobj opcode.
8777 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
8778 since it wasn't the correct fix.
8780 It still is puzzling that we are required to use stobj for IntPtr
8781 which seems to be a ValueType.
8783 2003-05-26 Miguel de Icaza <miguel@ximian.com>
8785 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
8786 during regular simple name resolution. Now, the trick is that
8787 instead of returning for processing the simplename, we do a
8788 TypeManager.LookupType (ie, a rooted lookup as opposed to a
8789 contextual lookup type). If a match is found, return that, if
8790 not, return for further composition.
8792 This fixes long-standing 30485.
8794 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8795 using the address to initialize an object, do an Stobj instead of
8796 using the regular Stelem.
8798 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
8799 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
8800 Because if we are a BaseIndexerAccess that value will be true.
8803 * statement.cs (GotoCase.Resolve): Return after reporting an
8804 error, do not attempt to continue.
8806 * expression.cs (PointerArithmetic.Emit): If our operand is a
8807 long, convert our constants to match the operand before
8808 multiplying. Convert to I type before adding. Fixes 43670.
8810 2003-05-14 Ravi Pratap <ravi@ximian.com>
8812 * enum.cs (ImplicitConversionExists) : Rename to
8813 ImplicitEnumConversionExists to remove ambiguity.
8815 * ecore.cs (NullCast): New type of cast expression class which
8816 basically is very similar to EmptyCast with the difference being
8817 it still is a constant since it is used only to cast a null to
8821 * convert.cs (ImplicitReferenceConversion): When casting a null
8822 literal, we return a NullCast.
8824 * literal.cs (NullLiteralTyped): Remove - I don't see why this
8825 should be around anymore.
8827 The renaming (reported was slightly wrong). Corrections:
8829 ConvertImplicitStandard -> ImplicitConversionStandard
8830 ConvertExplicitStandard -> ExplicitConversionStandard
8832 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8833 before passing them in !
8835 * convert.cs (ImplicitConversionStandard): When comparing for
8836 equal expr and target types, ensure that expr is not a
8839 In general, we must not be checking (expr_type ==
8840 target_type) in the top level conversion methods
8841 (ImplicitConversion, ExplicitConversion etc). This checking is
8842 done in the methods that they delegate to.
8844 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8846 * convert.cs: Move Error_CannotConvertType,
8847 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8848 ImplicitNumericConversion, ImplicitConversionExists,
8849 ImplicitUserConversionExists, StandardConversionExists,
8850 FindMostEncompassedType, FindMostSpecificSource,
8851 FindMostSpecificTarget, ImplicitUserConversion,
8852 ExplicitUserConversion, GetConversionOperators,
8853 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8854 TryImplicitIntConversion, Error_CannotConvertImplicit,
8855 ConvertImplicitRequired, ConvertNumericExplicit,
8856 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8857 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8860 Perform the following renames:
8862 StandardConversionExists -> ImplicitStandardConversionExists
8863 ConvertImplicit -> ImplicitConversion
8864 ConvertImplicitStandard -> ImplicitStandardConversion
8865 TryImplicitIntConversion -> ImplicitIntConversion
8866 ConvertImplicitRequired -> ImplicitConversionRequired
8867 ConvertNumericExplicit -> ExplicitNumericConversion
8868 ConvertReferenceExplicit -> ExplicitReferenceConversion
8869 ConvertExplicit -> ExplicitConversion
8870 ConvertExplicitStandard -> ExplicitStandardConversion
8872 2003-05-19 Martin Baulig <martin@ximian.com>
8874 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8875 (TypeInfo): Added support for structs having structs as fields.
8877 * ecore.cs (FieldExpr): Implement IVariable.
8878 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8879 VariableInfo for the field.
8881 2003-05-18 Martin Baulig <martin@ximian.com>
8883 * expression.cs (This.DoResolve): Report a CS0027 if we're
8884 emitting a field initializer.
8886 2003-05-18 Martin Baulig <martin@ximian.com>
8888 * expression.cs (This.ResolveBase): New public function.
8889 (This.DoResolve): Check for CS0188.
8891 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8894 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8895 `instance_expression' to null if we don't have any non-static
8898 2003-05-18 Martin Baulig <martin@ximian.com>
8900 Reworked the way how local variables and parameters are handled by
8901 the flow analysis code.
8903 * statement.cs (TypeInfo, VariableMap): New public classes.
8904 (VariableInfo): New public class. This is now responsible for
8905 checking whether a variable has been assigned. It is used for
8906 parameters and local variables.
8907 (Block.EmitMeta): Take the InternalParameters as argument; compute
8908 the layout of the flow vectors here.
8909 (Block.LocalMap, Block.ParameterMap): New public properties.
8910 (FlowBranching): The .ctor doesn't get the InternalParameters
8911 anymore since Block.EmitMeta() now computes the layout of the flow
8913 (MyStructInfo): This class is now known as `StructInfo' and nested
8914 in `TypeInfo'; we don't access this directly anymore.
8916 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8917 property and removed IsAssigned(), IsFieldAssigned(),
8918 SetAssigned() and SetFieldAssigned(); we now call them on the
8919 VariableInfo so we don't need to duplicate this code everywhere.
8921 * expression.cs (ParameterReference): Added `Block block' argument
8923 (LocalVariableReference, ParameterReference, This): The new
8924 VariableInfo class is now responsible for all the definite
8927 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8928 IsParameterAssigned, SetParameterAssigned): Removed.
8930 2003-05-18 Martin Baulig <martin@ximian.com>
8932 * typemanager.cs (InitCoreTypes): Try calling
8933 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8934 the 3-args-version. Corlib now also needs our `void_type'.
8935 (GetMethod): Added overloaded version which takes an optional
8936 `bool report_errors' to allow lookups of optional methods.
8938 2003-05-12 Martin Baulig <martin@ximian.com>
8940 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8941 only used for locals and not for parameters.
8943 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8945 * support.cs (InternalParameters.ParameterType): Return the
8946 ExternalType of the parameter.
8948 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8951 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8953 * class.cs (MethodData.Define): Do not set the `newslot' on
8954 interface members, if they are also flagged as "override".
8956 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8957 better code for ++i and i++. This only works for static fields
8958 and local variables.
8960 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8961 want to pull the DeclSpace out of the builder_to_declspace instead
8962 of the TypeBuilder (like in TypeContainer.FindMembers).
8964 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8965 instead of LookupTypeContainer. Fixes the crash on .NET for
8966 looking up interface members.
8968 * const.cs: Create our own emit context during the Definition
8969 stage, so that constants are evaluated in the proper context, when
8970 a recursive definition happens.
8972 2003-05-11 Martin Baulig <martin@ximian.com>
8974 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8975 new block for a switch section.
8976 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8977 the adding/lookup in the switch block. Fixes #39828.
8979 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8981 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8982 functionality: I needed to convert the data after I had performed
8983 the add/sub operation into the operands type size.
8985 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8986 pass the type for the box operation, otherwise the resulting
8987 object would have been of type object.
8989 (BoxedCast): Add constructor to specify the type to box as.
8991 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8993 * iterators.cs: I was reusing the `count' variable inadvertently,
8994 take steps to not allow this to happen.
8996 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8998 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8999 by creating an array at the point where the params starts and
9000 putting all those arguments there, then adjusting the size of the
9003 2003-05-05 Miguel de Icaza <miguel@ximian.com>
9005 * expression.cs (New.AddressOf): Implement interface
9006 IMemoryLocation. This is used when the `new' operator is used in
9007 the context of an invocation to a method on a value type.
9009 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
9012 * namespace.cs: Also check the using aliases here.
9014 * driver.cs: Move the test for using validity after the types have
9015 been entered, so we do a single pass that also includes the using
9018 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
9019 in the regular case. CreateSiblingForFinally is doing extra
9022 * attribute.cs (GetAttributeArgumentExpression): Store the result
9023 on an out value, and use the return value to indicate failure
9024 instead of using null (which is a valid return for Constant.GetValue).
9026 * statement.cs: Perform the analysis flow for the increment
9027 portion after the statement, because this will be the real flow of
9028 execution. Fixes #42385
9030 * codegen.cs (EmitContext.EmitArgument,
9031 EmitContext.EmitStoreArgument): New helper functions when the
9032 RemapToProxy flag is set.
9034 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
9037 Add support for remapping parameters.
9039 * iterators.cs: Propagate parameter values; Store parameter
9040 values in the proxy classes.
9042 2003-05-04 Miguel de Icaza <miguel@ximian.com>
9044 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
9045 need a proxy reference; I do not know what I was thinking
9047 * cs-parser.jay (constructor_initializer): catch another error,
9048 and display nice message.
9050 (field_declaration): catch void field declaration
9051 to flag a better error.
9053 * class.cs (MemberBase.CheckBase): Report an error instead of a
9054 warning if a new protected member is declared in a struct.
9055 (Field.Define): catch the error of readonly/volatile.
9057 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
9059 (FieldExpr.AddressOf): ditto. Catch error where the address of a
9060 volatile variable is taken
9062 2003-05-02 Miguel de Icaza <miguel@ximian.com>
9064 * statement.cs (Fixed.Resolve): Report an error if we are not in
9067 2003-05-01 Miguel de Icaza <miguel@ximian.com>
9069 * typemanager.cs: reuse the code that handles type clashes for
9070 delegates and enumerations.
9072 * class.cs (Report28): Always report.
9074 * expression.cs (EncodeAsAttribute): Allow nulls here.
9076 2003-04-28 Miguel de Icaza <miguel@ximian.com>
9078 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
9079 the functionality for testing whether an expression is valid for
9080 an attribute here. Also handle the case of arrays of elements
9083 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
9084 encoding a linear array into an array of objects that are suitable
9085 to be passed to an CustomAttributeBuilder.
9087 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
9089 * ecore.cs: (FieldExpr): Handle field remapping here.
9091 * iteratators.cs: Pass the instance variable (if the method is an
9092 instance method) to the constructors, so we can access the field
9093 variables on the class.
9095 TODO: Test this with structs. I think the THIS variable on
9096 structs might have to be a pointer, and not a refenrece
9098 2003-04-27 Miguel de Icaza <miguel@ximian.com>
9100 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
9101 local variables to fields in a proxy class.
9103 * iterators.cs (PopulateProxy): Rename our internal fields to
9105 Create a <THIS> field if we are an instance method, so we can
9106 reference our parent container variables.
9107 (MapVariable): Called back from the EmitContext code to enter a
9108 new variable to field mapping into the proxy class (we just create
9112 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
9113 for using the remapped locals to fields.
9115 I placed the code here, because that gives the same semantics to
9116 local variables, and only changes the Emit code.
9118 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
9119 statements inside iterators.
9120 (VariableInfo): Add a FieldBuilder for the cases when we are
9121 remapping local variables to fields in a proxy class
9123 * ecore.cs (SimpleNameResolve): Avoid testing two times for
9124 current_block != null.
9126 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
9127 not cope with strings, as it has been moved to the
9128 TableSwitchEmit. Fixed bug in switch generation.
9130 * expression.cs (New.DoResolve): Provide more context for the user
9131 when reporting an error.
9133 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
9136 * expression.cs (MemberAccess.DoResolve): When we get a type back,
9137 check the permissions for it. Note than in a type-resolution
9138 context the check was already present in DeclSpace.ResolveType,
9139 but was missing from the MemberAccess.
9141 (ArrayCreation.CheckIndices): warn if the user has
9142 more nested levels of expressions, but there are no more
9143 dimensions specified. Avoids crash on bug 41906.
9145 2003-04-26 Miguel de Icaza <miguel@ximian.com>
9147 * statement.cs (Block): replace Implicit bool, for a generic
9149 New flag: `Unchecked'. This is used during the EmitMeta phase
9150 (which is out-of-line with the regular Resolve/Emit process for a
9151 statement, as this is done ahead of time, but still gets a chance
9152 to call constant resolve).
9154 (Block.Flags): new enum for adding a new flag.
9156 (Block.EmitMeta): track the state of unchecked.
9158 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
9159 to enable constant resolution to work there as well.
9161 2003-04-22 Miguel de Icaza <miguel@ximian.com>
9163 * typemanager.cs (ienumerable_type): Also look up
9164 System.Collections.IEnumerable.
9166 2003-04-21 Miguel de Icaza <miguel@ximian.com>
9168 TODO: Test more than one conditional per method.
9170 * class.cs (Indexer.Define): Report the location where the user is
9171 referencing the unsupported feature.
9173 (MethodData): Overload the use of `conditionals' to
9174 minimize the creation of needless ArrayLists. This saves roughly
9175 212kb on my machine.
9177 (Method): Implement the new IIteratorContainer interface.
9178 (Method.SetYields): Implement the method by setting the ModFlags
9179 to contain METHOD_YIELDS.
9181 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
9182 which just got set to null.
9184 * iterators.cs: New file.
9186 (Yield, YieldBreak): New statements.
9188 * statement.cs (Return.Resolve): Flag an error if we are used in
9191 * codegen.cs (InIterator): New flag set if the code is being
9192 compiled in an iterator method.
9194 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
9195 internal modifier, and we just use it to avoid adding extra
9196 fields, as this is seldom used.
9198 * cs-parser.jay: Add yield_statement (yield and yield break).
9200 * driver.cs: New flag -v2 to turn on version 2 features.
9202 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
9203 hashtable when v2 is enabled.
9205 2003-04-20 Miguel de Icaza <miguel@ximian.com>
9207 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
9208 there is already a namespace defined with this name.
9210 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
9211 people upgraded their corlibs.
9213 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
9214 always use fully qualified types, no need to use the compiler
9217 (TypeManager.IsNamespace): Use binarysearch.
9219 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
9220 AddDelegate): I did not quite use the new IsValid API properly: I
9221 have to pass the short-name and the fullname. I was passing only
9222 the basename instead of the fullname sometimes.
9224 (TypeContainer.DefineType): call NamespaceClash.
9226 * interface.cs (Interface.DefineType): use NamespaceClash before
9229 * delegate.cs (Delegate.DefineType): use NamespaceClash before
9232 * enum.cs: (Enum.DefineType): use NamespaceClash before
9235 * typemanager.cs (: 3-line patch that gives us some tasty 11%
9236 speed increase. First, use the negative_hits cache when we get a
9237 negative. Second, add the type with its full original name
9238 instead of the new . and + encoded name (reflection uses + to
9239 separate type from a nested type). Use LookupTypeReflection
9240 directly which bypasses the type->name hashtable (that we already
9241 know does not contain the type.
9243 * decl.cs (DeclSpace.ResolveTypeExpr): track the
9244 location/container type.
9246 * driver.cs: When passing utf8, use directly the UTF8Encoding.
9248 2003-04-19 Miguel de Icaza <miguel@ximian.com>
9250 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
9252 * delegate.cs (NewDelegate.Resolve): Test whether an instance
9253 method is being referenced in the method group from a static
9254 context, and report error 120 if so.
9256 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
9259 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
9260 is created, we create the A namespace).
9262 * cs-parser.jay: A namespace also introduces a DeclarationFound.
9265 2003-04-18 Miguel de Icaza <miguel@ximian.com>
9267 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
9268 invocation to ModuleBuilder.GetType with the same values will
9269 return a new type instance, so we need to cache its return
9272 * expression.cs (Binary.ResolveOperator): Only allow the compare
9273 operators on enums if they are of the same type.
9275 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
9276 types of ValueType on their own case. Before we were giving them
9277 the same treatment as objects.
9279 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
9280 fullname. Short name is used to compare against container name.
9281 Fullname is used to check against defined namespace names.
9283 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
9284 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
9286 (Method.CheckBase): Call parent.
9287 (MemberBase.CheckBase): Check for protected members on sealed
9289 (PropertyBase.CheckBase): Call parent.
9290 (Field.Define): Call parent.
9292 * report.cs: Negative error codes are now mapped to 8000 - code,
9293 so that the display is render more nicely.
9295 * typemanager.cs: Do not use try/catch, instead report a regular
9298 (GetPointerType, GetReferenceType): These methods provide
9299 mechanisms to obtain the T* and T& from a T. We had the code
9300 previously scattered around the code base, and it also used
9301 TypeManager.LookupType that would go through plenty of caches.
9302 This one goes directly to the type source.
9304 In some places we did the Type.GetType followed by
9305 ModuleBuilder.GetType, but not in others, so this unifies the
9308 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
9309 statements now that we have namespace information.
9311 * typemanager.cs (IsNamespace): New method, returns whether the
9312 string presented is a namespace or not.
9314 (ComputeNamespaces): New public entry point, computes the list of
9315 available namespaces, using the GetNamespaces API call in Mono, or
9316 the slower version in MS.NET.
9318 Now before we start the semantic analysis phase, we have a
9319 complete list of namespaces including everything that the user has
9322 Deleted old code to cache namespaces in .nsc files.
9324 2003-04-17 Miguel de Icaza <miguel@ximian.com>
9326 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
9327 class/struct location definition Location for the implicit
9328 constructor location.
9330 (Operator.Define): Use the location of the operator for the
9331 implicit Method definition.
9333 (Constructor.Emit): use the constructor location for the implicit
9334 base initializer constructor.
9336 * ecore.cs: Remove ITypeExpression. This interface is now gone,
9337 and the Expression class now contains two new methods:
9339 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
9340 isolate type lookup from the rest of the resolution process.
9342 Since we use Expressions to hold type definitions due to the way
9343 we parse the input we have historically overloaded Resolve to
9344 perform the Type lookups if a special flag is passed. Now this is
9345 eliminated and two methods take their place.
9347 The differences in the two methods between xStep and xTerminal is
9348 that xStep is involved in our current lookup system that uses
9349 SimpleNames to compose a name, while xTerminal is used just to
9350 catch the case where the simplename lookup failed.
9352 2003-04-16 Miguel de Icaza <miguel@ximian.com>
9354 * expression.cs (ResolveMemberAccess): Remove redundant code.
9355 TypeExpr expressions are always born fully resolved.
9357 * interface.cs (PopulateMethod): Do not lookup the types twice.
9358 We were doing it once during SemanticAnalysis and once during
9361 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
9362 in local variable type definitions, were being returned as a
9363 SimpleName (we decomposed everything into a string), that is
9364 because primary_expression was being used instead of a type in the
9365 grammar (reduce/reduce conflicts).
9367 The part that was wrong is that we converted the expression into a
9368 string (an oversimplification in one hand, compounded with primary
9369 expressions doing string concatenation).
9375 Would return "A.B.C[]" as a SimpleName. This stopped things like
9376 using clauses from working on this particular context. And a type
9377 was being matched directly against "A.B.C[]".
9379 We now use the correct approach, and allow for ComposedCast to be
9380 part of the unary expression. So the "A.B.C []" become a composed
9381 cast of "A.B.C" (as a nested group of MemberAccess with a
9382 SimpleName at the end) plus the rank composition "[]".
9386 2003-04-10 Miguel de Icaza <miguel@ximian.com>
9388 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
9389 for the access level checking.
9391 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
9392 `TypeContainer container', because I kept getting confused when I
9393 was debugging this code.
9395 * expression.cs (Indexers): Instead of tracking getters/setters,
9396 we now track them in parallel. We create one arraylist less, but
9397 most importantly it is possible now for the LValue code to find a
9398 matching get for a set.
9400 (IndexerAccess.DoResolveLValue): Update the code.
9401 GetIndexersForType has been modified already to extract all the
9402 indexers from a type. The code assumed it did not.
9404 Also make the code set the correct return type for the indexer.
9405 This was fixed a long time ago for properties, but was missing for
9406 indexers. It used to be void_type.
9408 (Binary.Emit): Test first for doubles instead of
9409 floats, as they are more common.
9411 (Binary.EmitBranchable): Use the .un version of the branch opcodes
9412 when dealing with floats and the <=, >= operators. This fixes bug
9415 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
9416 to load the array value by emitting a load on the foreach variable
9417 type. This was incorrect.
9419 We now emit the code to load an element using the the array
9420 variable type, and then we emit the conversion operator.
9424 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
9426 * attribute.cs: Avoid allocation of ArrayLists in the common case.
9428 2003-04-09 Miguel de Icaza <miguel@ximian.com>
9430 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
9431 test for protection before we test for signatures.
9433 (MethodSignature.ToString): implement.
9435 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
9436 to the case where we reduced into a LongConstant.
9438 * decl.cs (CheckAccessLevel): If the type is an array, we can not
9439 depend on whether the information is acurrate, because the
9440 Microsoft runtime will always claim that the array type is public,
9441 regardless of the real state.
9443 If the type is a pointer, another problem happens: the type is
9444 reported as non-public in Microsoft.
9446 In both cases we have to call CheckAccessLevel recursively with
9447 the underlying type as the argument to be tested.
9449 2003-04-08 Miguel de Icaza <miguel@ximian.com>
9451 * assign.cs (Assign.Emit): If we are dealing with a compound
9452 assignment expression, we should use the code path that stores the
9453 intermediate result in a temporary value. This fixes #40903.
9455 *expression.cs (Indirection.ToString): Provide ToString method for
9458 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
9460 * class.cs: Null out fields holding references to Block objects so
9461 they can be garbage collected.
9463 * expression.cs (OverloadResolve): Remove unused local.
9465 2003-04-07 Martin Baulig <martin@ximian.com>
9467 * codegen.cs (EmitContext.CurrentFile): New public field.
9468 (EmitContext.Mark): Use the CurrentFile to check whether the
9469 location is in the correct file.
9470 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
9472 2003-04-07 Martin Baulig <martin@ximian.com>
9474 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
9476 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
9477 location. [FIXME: The location argument which gets passed to this
9478 method is sometimes wrong!]
9480 2003-04-07 Nick Drochak <ndrochak@gol.com>
9482 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
9484 2003-04-07 Miguel de Icaza <miguel@ximian.com>
9486 * expression.cs (Indirection.EmitAssign): We were using the
9487 temporary, but returning immediately instead of continuing the
9490 2003-04-06 Martin Baulig <martin@ximian.com>
9492 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
9493 if it's a nested child, but also deriving from the outer class.
9496 * typemanager.cs (IsNestedChildOf): Make this work if it's a
9497 nested child, but also deriving from the outer class. See
9499 (FilterWithClosure): We may access private members of the outer
9500 class if we're a nested child and deriving from the outer class.
9501 (RealMemberLookup): Only set `closure_private_ok' if the
9502 `original_bf' contained BindingFlags.NonPublic.
9504 2003-04-05 Martin Baulig <martin@ximian.com>
9506 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
9507 probe if its a type parameter, and if so, flag an error.
9509 * decl.cs: Move here the SetParameterInfo code from class.cs.
9510 Handle IsGeneric here.
9512 Handle a variety of errors in the parameter info definition.
9514 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
9515 type parameters here.
9517 * cs-parser.jay (class_declaration): report errors for parameters
9520 2003-01-21 Miguel de Icaza <miguel@ximian.com>
9522 * generic.cs: New file, contains support code for generics.
9524 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
9525 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
9527 Update parser for the above removals.
9529 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
9530 now taken care of in the parser.
9532 2003-04-02 Miguel de Icaza <miguel@ximian.com>
9534 * class.cs (Event.Define): Do not allow abstract events to have
9537 2003-04-01 Miguel de Icaza <miguel@ximian.com>
9539 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
9540 block in event declarations.
9542 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
9543 value type, get its address.
9545 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
9546 leaving a class on the stack instead of a boolean value (int
9547 0/1). Change the code so we compare against null, and then the
9548 result against zero.
9550 * class.cs (TypeContainer.GetClassBases): We were checking for the
9551 parent class being sealed too late.
9553 * expression.cs (Binary.Emit): For <= and >= when dealing with
9554 floating point values, use cgt.un and clt.un instead of cgt and
9557 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
9559 * statement.cs: Apply the same optimization as MS: skip the
9560 GetEnumerator returning an IEnumerator, and use the one returning a
9561 CharEnumerator instead. This allows us to avoid the try-finally block
9564 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
9566 * cs-parser.jay: Attributes cannot be applied to
9567 namespaces. Fixes #40473
9569 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9572 (Add*): check if the name is valid using the full name for constants,
9573 fields, properties and events.
9575 2003-03-28 Miguel de Icaza <miguel@ximian.com>
9577 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
9578 char constants to be part of the enumeration.
9580 * expression.cs (Conditional.DoResolve): Add support for operator
9581 true. Implements the missing functionality from 14.12
9583 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
9584 operator true/false as required by the spec.
9586 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
9587 implicit conversion to boolean.
9589 * statement.cs (Statement.ResolveBoolean): A boolean expression is
9590 also one where the type implements `operator true'.
9592 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
9593 get an expression that will invoke operator true based on an
9596 (GetConversionOperators): Removed the hack that called op_True
9599 (Expression.ResolveBoolean): Move this from Statement.
9601 2003-03-17 Miguel de Icaza <miguel@ximian.com>
9603 * ecore.cs (FieldExpr): do not allow initialization of initonly
9604 fields on derived classes
9606 2003-03-13 Martin Baulig <martin@ximian.com>
9608 * statement.cs (Block.Emit): Call ig.BeginScope() and
9609 ig.EndScope() when compiling with debugging info; call
9610 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
9612 2003-03-08 Miguel de Icaza <miguel@ximian.com>
9614 * expression.cs (Indexers): Do not construct immediately, allow
9615 for new members to be appended as we go. Fixes 38143
9617 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9619 * expression.cs: save/restore context when resolving an unchecked
9622 2003-03-05 Miguel de Icaza <miguel@ximian.com>
9624 * cfold.cs: Catch division by zero in modulus operator during
9627 2003-03-03 Miguel de Icaza <miguel@ximian.com>
9629 * interface.cs (Interface.DefineMembers): Avoid defining members
9632 2003-02-27 Miguel de Icaza <miguel@ximian.com>
9634 * driver.cs: handle the +/- options for -noconfig
9636 * statement.cs (Unckeched.Resolve): Also track the state of
9637 unchecked in the Resolve phase.
9639 2003-02-27 Martin Baulig <martin@ximian.com>
9641 * ecore.cs (Expression.MemberLookup): Don't create a
9642 MethodGroupExpr for something which is not a method. Fixes #38291.
9644 2003-02-25 Miguel de Icaza <miguel@ximian.com>
9646 * class.cs (MemberBase.CheckParameters): Also check that the type
9647 is unmanaged if it is a pointer.
9649 * expression.cs (SizeOf.Resolve): Add location information.
9651 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
9652 a managed type is declared.
9654 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
9655 parameter modifiers as well. Fixes bug 38606
9657 * class.cs: Very sad. Am backing out the speed up changes
9658 introduced by the ArrayList -> Array in the TypeContainer, as they
9659 were not actually that much faster, and introduced a bug (no error
9660 reports on duplicated methods).
9662 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
9663 source first, this will guarantee that we have a valid expression
9664 before calling in lower levels functions that will require a
9665 resolved object. Then use this original_source in the
9666 target.ResolveLValue instead of the original source that was
9669 Another change. Use target.Resolve instead of LValueResolve.
9670 Although we are resolving for LValues, we will let the Assign code
9671 take care of that (it will be called again from Resolve). This
9672 basically allows code like this:
9674 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
9675 class Y { void A (X x) { x [0] += o; }
9677 The problem was that the indexer was trying to resolve for
9678 set_Item (idx, object o) and never finding one. The real set_Item
9679 was set_Item (idx, X). By delaying the process we get the right
9684 2003-02-23 Martin Baulig <martin@ximian.com>
9686 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
9687 while calling DoEmit ().
9689 * codegen.cs (EmitContext.Mark): Don't mark locations in other
9690 source files; if you use the #line directive inside a method, the
9691 compiler stops emitting line numbers for the debugger until it
9692 reaches the end of the method or another #line directive which
9693 restores the original file.
9695 2003-02-23 Martin Baulig <martin@ximian.com>
9697 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
9699 2003-02-23 Martin Baulig <martin@ximian.com>
9701 * statement.cs (Block.AddChildVariableNames): We need to call this
9702 recursively, not just for our immediate children.
9704 2003-02-23 Martin Baulig <martin@ximian.com>
9706 * class.cs (Event.Define): Always make the field private, like csc does.
9708 * typemanager.cs (TypeManager.RealMemberLookup): Make events
9709 actually work, fixes bug #37521.
9711 2003-02-23 Miguel de Icaza <miguel@ximian.com>
9713 * delegate.cs: When creating the various temporary "Parameters"
9714 classes, make sure that we call the ComputeAndDefineParameterTypes
9715 on those new parameters (just like we do with the formal ones), to
9716 allow them to be resolved in the context of the DeclSpace.
9718 This fixes the bug that Dick observed in Bugzilla #38530.
9720 2003-02-22 Miguel de Icaza <miguel@ximian.com>
9722 * expression.cs (ResolveMemberAccess): When resolving a constant,
9723 do not attempt to pull a constant if the value was not able to
9724 generate a valid constant.
9726 * const.cs (LookupConstantValue): Do not report more errors than required.
9728 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9730 * expression.cs: fixes bug #38328.
9732 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9734 * class.cs: Changed all the various members that can be part of a
9735 class from being an ArrayList to be an Array of the right type.
9736 During the DefineType type_list, interface_list, delegate_list and
9737 enum_list are turned into types, interfaces, delegates and enums
9740 And during the member population, indexer_list, event_list,
9741 constant_list, field_list, instance_constructor_list, method_list,
9742 operator_list and property_list are turned into their real arrays.
9744 Although we could probably perform this operation earlier, for
9745 good error reporting we need to keep the lists and remove the
9746 lists for longer than required.
9748 This optimization was triggered by Paolo profiling the compiler
9749 speed on the output of `gen-sample-program.pl' perl script.
9751 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
9752 not crash in methods like MemberLookupFailed that use this field.
9754 This problem arises when the compiler fails to resolve a type
9755 during interface type definition for example.
9757 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9759 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
9760 inherit from System.Object, so we have to stop at null, not only
9761 when reaching System.Object.
9763 2003-02-17 Miguel de Icaza <miguel@ximian.com>
9765 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
9766 DeclaredOnly because the parent indexer might have had a different
9767 name, but did not loop until the top of the hierarchy was reached.
9769 The problem this one fixes is 35492: when a class implemented an
9770 indexer from an interface, we were getting the interface method
9771 (which was abstract) and we were flagging an error (can not invoke
9774 This also keeps bug 33089 functioning, and test-148 functioning.
9776 * typemanager.cs (IsSpecialMethod): The correct way of figuring
9777 out if a method is special is to see if it is declared in a
9778 property or event, or whether it is one of the predefined operator
9779 names. This should fix correctly #36804.
9781 2003-02-15 Miguel de Icaza <miguel@ximian.com>
9783 The goal here is to remove the dependency on EmptyCast.Peel ().
9784 Killing it completely.
9786 The problem is that currently in a number of places where
9787 constants are expected, we have to "probe" for an EmptyCast, and
9788 Peel, which is not the correct thing to do, as this will be
9789 repetitive and will likely lead to errors.
9791 The idea is to remove any EmptyCasts that are used in casts that
9792 can be reduced to constants, so we only have to cope with
9795 This bug hunt was triggered by Bug 37363 and the desire to remove
9796 the duplicate pattern where we were "peeling" emptycasts to check
9797 whether they were constants. Now constants will always be
9800 * ecore.cs: Use an enumconstant here instead of wrapping with
9803 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
9804 throwing me off. By handling this we can get rid of a few hacks.
9806 * statement.cs (Switch): Removed Peel() code.
9808 2003-02-14 Miguel de Icaza <miguel@ximian.com>
9810 * class.cs: Location information for error 508
9812 * expression.cs (New.DoResolve): Add a guard against double
9813 resolution of an expression.
9815 The New DoResolve might be called twice when initializing field
9816 expressions (see EmitFieldInitializers, the call to
9817 GetInitializerExpression will perform a resolve on the expression,
9818 and later the assign will trigger another resolution
9820 This leads to bugs (#37014)
9822 * delegate.cs: The signature for EndInvoke should contain any ref
9823 or out parameters as well. We were not doing this in the past.
9825 * class.cs (Field.Define): Do not overwrite the type definition
9826 inside the `volatile' group. Turns out that volatile enumerations
9827 were changing the type here to perform a validity test, which
9830 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9832 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9833 and structs, we do not want to load the instance variable
9835 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9836 enum_type has to be handled like an object reference (implicit
9837 conversions exists from this to object), but the regular IsClass
9838 and IsValueType tests will never return true for this one.
9840 Also we use TypeManager.IsValueType instead of type.IsValueType,
9841 just for consistency with the rest of the code (this is only
9842 needed if we ever use the construct exposed by test-180.cs inside
9843 corlib, which we dont today).
9845 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9847 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9850 2003-02-09 Martin Baulig <martin@ximian.com>
9852 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9853 (Namespace.DefineNamespaces): New static public method; this is
9854 called when we're compiling with debugging to add all namespaces
9857 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9858 pass it to the Namespace's .ctor.
9860 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9861 and MethodBase arguments; pass the namespace ID to the symwriter;
9862 pass the MethodBase instead of the token to the symwriter.
9863 (SymbolWriter.DefineNamespace): New method to add a namespace to
9866 2003-02-09 Martin Baulig <martin@ximian.com>
9868 * symbolwriter.cs: New file. This is a wrapper around
9869 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9870 methods here in near future.
9872 2003-02-09 Martin Baulig <martin@ximian.com>
9874 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9875 ILGenerator.MarkSequencePoint() which are actually used by the
9878 2003-02-09 Martin Baulig <martin@ximian.com>
9880 * location.cs (SourceFile): New public sealed class. This
9881 contains the name and an index which is used in the location's token.
9882 (Location): Reserve an appropriate number of bits in the token for
9883 the source file instead of walking over that list, this gives us a
9884 really huge performance improvement when compiling with debugging.
9886 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9887 `SourceFile' argument instead of a string.
9888 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9889 but don't parse/tokenize here, we need to generate the list of all
9890 source files before we do that.
9891 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9894 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9895 instead of a string.
9897 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9900 2003-02-09 Martin Baulig <martin@ximian.com>
9902 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9903 filename on `#line default'.
9905 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9907 * statement.cs: don't clear the pinned var when the fixed statement
9908 returns from the method (fixes bug#37752).
9910 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9912 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9915 2003-02-07 Martin Baulig <martin@ximian.com>
9917 * driver.cs: Removed the `--debug-args' command line argument.
9919 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9920 automatically by the AsssemblyBuilder.
9921 (CodeGen.InitializeSymbolWriter): We don't need to call any
9922 initialization function on the symbol writer anymore. This method
9923 doesn't take any arguments.
9925 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9927 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9928 from referenced assemblies as well.
9930 2003-02-02 Martin Baulig <martin@ximian.com>
9932 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9934 2003-02-02 Martin Baulig <martin@ximian.com>
9936 * class.cs (Constructor.Emit): Open the symbol writer before
9937 emitting the constructor initializer.
9938 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9939 single-stepping through constructor initializers.
9941 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9943 * class.cs: Handle error 549: do not allow virtual methods in
9946 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9948 * decl.cs: Check access levels when resolving types
9950 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9952 * statement.cs: Add parameters and locals set in catch blocks that might
9953 return to set vector
9955 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9957 * class.cs (Operator): Set the SpecialName flags for operators.
9959 * expression.cs (Invocation.DoResolve): Only block calls to
9960 accessors and operators on SpecialName methods.
9962 (Cast.TryReduce): Handle conversions from char constants.
9965 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9967 * statement.cs: small memory and time optimization in FlowBranching.
9969 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9971 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9972 problem that the last fix but in the other sid (Set).
9974 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9975 access when there is no indexer in the hierarchy.
9977 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9979 * class.cs: Combine some if statements.
9981 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9983 * driver.cs: fixed bug #37187.
9985 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9987 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9988 any indexer, it's needed to build a list with all the indexers in the
9989 hierarchy (AllGetters), else we have problems. Fixes #35653.
9991 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9993 * class.cs (MethodData.Define): It is wrong for an interface
9994 implementation to be static in both cases: explicit and implicit.
9995 We were only handling this in one case.
9997 Improve the if situation there to not have negations.
9999 * class.cs (Field.Define): Turns out that we do not need to check
10000 the unsafe bit on field definition, only on usage. Remove the test.
10002 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10004 * driver.cs: use assembly.Location instead of Codebase (the latest
10005 patch made mcs fail when using MS assemblies).
10007 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
10009 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
10010 get the path to *corlib.dll.
10012 2003-01-21 Nick Drochak <ndrochak@gol.com>
10016 * typemanager.cs: Remove compiler warnings
10018 2003-01-20 Duncan Mak <duncan@ximian.com>
10020 * AssemblyInfo.cs: Bump the version number to 0.19.
10022 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10024 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
10026 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
10028 * class.cs (Constructor::Emit): Emit debugging info for constructors.
10030 2003-01-17 Miguel de Icaza <miguel@ximian.com>
10032 * cs-parser.jay: Small fix: we were not comparing the constructor
10033 name correctly. Thanks to Zoltan for the initial pointer.
10035 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
10037 * cs-tokenizer.cs: Set file name when specified with #line
10039 2003-01-15 Miguel de Icaza <miguel@ximian.com>
10041 * cs-parser.jay: Only perform the constructor checks here if we
10042 are named like the class; This will help provider a better
10043 error. The constructor path is taken when a type definition is
10044 not found, but most likely the user forgot to add the type, so
10045 report that rather than the constructor error.
10047 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
10049 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
10052 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10054 * cs-parser.jay: Add cleanup call.
10056 2003-01-13 Duncan Mak <duncan@ximian.com>
10058 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
10059 consistent with other methods.
10061 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
10063 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
10065 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
10067 * attribute.cs: only set GuidAttr to true when we have a
10070 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10074 * typemanager.cs: fixes to allow mcs compile corlib with the new
10075 Type.IsSubclassOf fix.
10077 2003-01-08 Miguel de Icaza <miguel@ximian.com>
10079 * expression.cs (LocalVariableReference.DoResolve): Classify a
10080 constant as a value, not as a variable. Also, set the type for
10083 * cs-parser.jay (fixed_statement): take a type instead of a
10084 pointer_type, so we can produce a better error message later.
10086 * statement.cs (Fixed.Resolve): Flag types that are not pointers
10089 (For.DoEmit): Make inifinite loops have a
10090 non-conditional branch back.
10092 (Fixed.DoEmit): First populate the pinned variables, then emit the
10093 statement, then clear the variables. Before I was emitting the
10094 code once for each fixed piece.
10097 2003-01-08 Martin Baulig <martin@ximian.com>
10099 * statement.cs (FlowBranching.MergeChild): A break in a
10100 SWITCH_SECTION does not leave a loop. Fixes #36155.
10102 2003-01-08 Martin Baulig <martin@ximian.com>
10104 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
10105 lives in the same number space than `param_map'. Fixes #36154.
10107 2003-01-07 Miguel de Icaza <miguel@ximian.com>
10109 * cs-parser.jay (constructor_declaration): Set the
10110 Constructor.ModFlags before probing for it. This makes the
10111 compiler report 514, 515 and 132 (the code was there, but got
10114 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
10115 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
10116 (GotoCase.Resolve): Set `Returns' to ALWAYS.
10118 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
10120 * enum.cs: create the enum static fields using the enum type.
10122 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
10124 * class.cs: don't try to create the ParamBuilder for the return
10125 type if it's not needed (and handle it breaking for the ms runtime
10128 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
10130 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
10132 2002-12-29 Miguel de Icaza <miguel@ximian.com>
10134 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
10135 the command. This showed up while compiling the JANET source
10136 code, which used \r as its only newline separator.
10138 2002-12-28 Miguel de Icaza <miguel@ximian.com>
10140 * class.cs (Method.Define): If we are an operator (because it
10141 reuses our code), then set the SpecialName and HideBySig. #36128
10143 2002-12-22 Miguel de Icaza <miguel@ximian.com>
10145 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
10146 exception, report error 120 `object reference required'.
10148 * driver.cs: Add --pause option, used during to measure the size
10149 of the process as it goes with --timestamp.
10151 * expression.cs (Invocation.DoResolve): Do not allow methods with
10152 SpecialName to be invoked.
10154 2002-12-21 Miguel de Icaza <miguel@ximian.com>
10156 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
10157 number before adding it.
10159 2002-12-21 Ravi Pratap <ravi@ximian.com>
10161 * ecore.cs (StandardImplicitConversion): When in an unsafe
10162 context, we allow conversion between void * to any other pointer
10163 type. This fixes bug #35973.
10165 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
10167 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
10168 is not thrown when extensionless outputs are used
10170 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10172 * rootcontext.cs: fixed compilation of corlib.
10174 2002-12-19 Miguel de Icaza <miguel@ximian.com>
10176 * attribute.cs (Attributes.Contains): Add new method.
10178 * class.cs (MethodCore.LabelParameters): if the parameter is an
10179 `out' parameter, check that no attribute `[In]' has been passed.
10181 * enum.cs: Handle the `value__' name in an enumeration.
10183 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
10185 * decl.cs: Added special case to allow overrides on "protected
10188 2002-12-18 Ravi Pratap <ravi@ximian.com>
10190 * attribute.cs (Attributes.AddAttributeSection): Rename to this
10191 since it makes much more sense.
10193 (Attributes.ctor): Don't require a Location parameter.
10195 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
10197 * attribute.cs (ApplyAttributes): Remove extra Location parameters
10198 since we already have that information per attribute.
10200 * everywhere : make appropriate changes.
10202 * class.cs (LabelParameters): Write the code which actually
10203 applies attributes to the return type. We can't do this on the MS
10204 .NET runtime so we flag a warning in the case an exception is
10207 2002-12-18 Miguel de Icaza <miguel@ximian.com>
10209 * const.cs: Handle implicit null conversions here too.
10211 2002-12-17 Ravi Pratap <ravi@ximian.com>
10213 * class.cs (MethodCore.LabelParameters): Remove the extra
10214 Type [] parameter since it is completely unnecessary. Instead
10215 pass in the method's attributes so that we can extract
10216 the "return" attribute.
10218 2002-12-17 Miguel de Icaza <miguel@ximian.com>
10220 * cs-parser.jay (parse): Use Report.Error to flag errors instead
10221 of ignoring it and letting the compile continue.
10223 * typemanager.cs (ChangeType): use an extra argument to return an
10224 error condition instead of throwing an exception.
10226 2002-12-15 Miguel de Icaza <miguel@ximian.com>
10228 * expression.cs (Unary.TryReduce): mimic the code for the regular
10229 code path. Perform an implicit cast in the cases where we can
10230 implicitly convert to one of the integral types, and then reduce
10231 based on that constant. This fixes bug #35483.
10233 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10235 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
10237 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10239 * namespace.cs: fixed bug #35489.
10241 2002-12-12 Miguel de Icaza <miguel@ximian.com>
10243 * class.cs: Remove some dead code.
10245 * cs-parser.jay: Estimate the number of methods needed
10246 (RootContext.MethodCount);
10248 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
10249 numbers instead of StringBuilders.
10251 * support.cs (PtrHashtable): Add constructor with initial size;
10252 We can now reduce reallocations of the method table.
10254 2002-12-10 Ravi Pratap <ravi@ximian.com>
10256 * attribute.cs (ApplyAttributes): Keep track of the emitted
10257 attributes on a per-target basis. This fixes bug #35413.
10259 2002-12-10 Miguel de Icaza <miguel@ximian.com>
10261 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
10262 default to the Windows 1252 encoding.
10264 (UnixParseOption): Support version, thanks to Alp for the missing
10267 * AssemblyInfo.cs: Add nice assembly information.
10269 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
10272 * cs-parser.jay: Allow a trailing comma before the close bracked
10273 in the attribute_section production.
10275 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
10276 address of the instance was being taken, I will take this out,
10277 because we take the address of the object immediately here.
10279 2002-12-09 Ravi Pratap <ravi@ximian.com>
10281 * typemanager.cs (AreMultipleAllowed): Take care of the most
10282 obvious case where attribute type is not in the current assembly -
10285 2002-12-08 Miguel de Icaza <miguel@ximian.com>
10287 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
10288 definitions, instead of doing that afterwards.
10290 Also we use a nice little hack, depending on the constructor, we
10291 know if we are a "composed" name or a simple name. Hence, we
10292 avoid the IndexOf test, and we avoid
10294 * codegen.cs: Add code to assist in a bug reporter to track down
10295 the source of a compiler crash.
10297 2002-12-07 Ravi Pratap <ravi@ximian.com>
10299 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
10300 types have been emitted for a given element and flag an error
10301 if something which does not have AllowMultiple set is used more
10304 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
10305 attribute types and their corresponding AllowMultiple properties
10307 (AreMultipleAllowed): Check the property for a given type.
10309 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
10310 property in the case we have a TypeContainer.
10312 (Attributes.AddAttribute): Detect duplicates and just skip on
10313 adding them. This trivial fix catches a pretty gross error in our
10314 attribute emission - global attributes were being emitted twice!
10316 Bugzilla bug #33187 is now fixed.
10318 2002-12-06 Miguel de Icaza <miguel@ximian.com>
10320 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
10321 instead of pp_and).
10323 * expression.cs (Binary.ResolveOperator): I can only use the
10324 Concat (string, string, string) and Concat (string, string,
10325 string, string) if the child is actually a concatenation of
10328 2002-12-04 Miguel de Icaza <miguel@ximian.com>
10330 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
10331 context where we need a 2-character lookahead.
10333 * pending.cs (PendingImplementation): Rework so we can keep track
10334 of interface types all the time, and flag those which were
10335 implemented by parents as optional.
10337 2002-12-03 Miguel de Icaza <miguel@ximian.com>
10339 * expression.cs (Binary.ResolveOperator): Use
10340 String.Concat(string,string,string) or
10341 String.Concat(string,string,string,string) when possible.
10343 * typemanager: More helper methods.
10346 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
10348 * pending.cs: remove the bogus return from GetMissingInterfaces()
10349 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
10351 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10353 * namespace.cs: avoid duplicated 'using xxx' being added to
10354 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
10355 when we get more than one 'using' statement for the same namespace.
10356 Report a CS0105 warning for it.
10358 2002-11-30 Miguel de Icaza <miguel@ximian.com>
10360 * cs-tokenizer.cs (consume_identifier): use read directly, instead
10361 of calling getChar/putback, uses internal knowledge of it.
10363 (xtoken): Reorder tokenizer so most common patterns are checked
10364 first. This reduces the compilation time in another 5% (from 8.11s
10365 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
10367 The parsing time is 22% of the compilation in mcs, and from that
10368 64% is spent on the tokenization process.
10370 I tried using a binary search for keywords, but this is slower
10371 than the hashtable. Another option would be to do a couple of
10374 * Not use a StringBuilder, instead use an array of chars,
10375 with a set value. Notice that this way we could catch
10376 the 645 error without having to do it *afterwards*.
10378 * We could write a hand-parser to avoid the hashtable
10379 compares altogether.
10381 The identifier consumption process takes 37% of the tokenization
10382 time. Another 15% is spent on is_number. 56% of the time spent
10383 on is_number is spent on Int64.Parse:
10385 * We could probably choose based on the string length to
10386 use Int32.Parse or Int64.Parse and avoid all the 64-bit
10389 Another 3% is spend on wrapping `xtoken' in the `token' function.
10391 Handle 0xa0 as whitespace (#34752)
10393 2002-11-26 Miguel de Icaza <miguel@ximian.com>
10395 * typemanager.cs (IsCLRType): New routine to tell whether a type
10396 is one of the builtin types.
10398 Maybe it needs to use TypeCodes to be faster. Maybe we could use
10399 typecode in more places instead of doing pointer comparissions.
10400 We could leverage some knowledge about the way the typecodes are
10403 New code to cache namespaces in assemblies, it is currently not
10404 invoked, to be used soon.
10406 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
10408 * expression.cs (Binary.ResolveOperator): specially handle
10409 strings, and do not perform user-defined operator overloading for
10412 2002-11-24 Miguel de Icaza <miguel@ximian.com>
10414 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
10415 internalcall as it is a pretty simple operation; Avoid whenever
10416 possible to call Char.IsLetter.
10418 (consume_identifier): Cut by half the number of
10419 hashtable calls by merging the is_keyword and GetKeyword behavior.
10421 Do not short-circuit, because if we do, we
10422 report errors (ie, #if false && true would produce an invalid
10426 2002-11-24 Martin Baulig <martin@ximian.com>
10428 * expression.cs (Cast.TryReduce): If we're in checked syntax,
10429 check constant ranges and report a CS0221. Fixes #33186.
10431 2002-11-24 Martin Baulig <martin@ximian.com>
10433 * cs-parser.jay: Make this work for uninitialized variable
10434 declarations in the `for' initializer. Fixes #32416.
10436 2002-11-24 Martin Baulig <martin@ximian.com>
10438 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
10439 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
10441 2002-11-24 Martin Baulig <martin@ximian.com>
10443 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
10444 argument; if true, we also check for user-defined conversions.
10445 This is only needed if both arguments are of a user-defined type.
10446 Fixes #30443, added test-175.cs.
10447 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
10449 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
10451 2002-11-24 Martin Baulig <martin@ximian.com>
10453 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
10454 function to get the store opcode.
10455 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
10456 only emit the Ldelema if the store opcode is Stobj. You must run
10457 both test-34 and test-167 to test this. Fixes #34529.
10459 2002-11-23 Martin Baulig <martin@ximian.com>
10461 * ecore.cs (Expression.MemberLookup): Added additional
10462 `qualifier_type' argument which is used when we're being called
10463 from MemberAccess.DoResolve() and null if we're called from a
10465 (Expression.MemberLookupFailed): New method to report errors; this
10466 does the CS1540 check and reports the correct error message.
10468 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
10469 argument for the CS1540 check and redone the way how we're dealing
10470 with private members. See the comment in the source code for details.
10471 (FilterWithClosure): Reverted this back to revision 1.197; renamed
10472 `closure_start_type' to `closure_qualifier_type' and check whether
10473 it's not null. It was not this filter being broken, it was just
10474 being called with the wrong arguments.
10476 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
10477 and pass it the correct `qualifier_type'; this also does the error
10480 2002-11-22 Miguel de Icaza <miguel@ximian.com>
10482 * expression.cs (Invocation.EmitParams): If the we are dealing
10483 with a non-built-in value type, load its address as well.
10485 (ArrayCreation): Use a a pretty constant instead
10486 of the hardcoded value 2. Use 6 instead of 2 for the number of
10487 static initializers.
10489 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
10490 because they are not really value types, just glorified integers.
10492 * driver.cs: Do not append .exe, the CSC compiler does not do it.
10494 * ecore.cs: Remove redundant code for enumerations, make them use
10495 the same code path as everything else, fixes the casting issue
10496 with enumerations in Windows.Forms.
10498 * attribute.cs: Do only cast to string if it is a string, the
10499 validation happens later.
10501 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
10502 people upgrade their corlibs.
10504 * ecore.cs: Oops, enumerations were not following the entire code path
10506 2002-11-21 Miguel de Icaza <miguel@ximian.com>
10508 * typemanager.cs (FilterWithClosure): Commented out the test for
10509 1540 in typemanager.cs, as it has problems when accessing
10510 protected methods from a parent class (see test-174.cs).
10512 * attribute.cs (Attribute.ValidateGuid): new method.
10513 (Attribute.Resolve): Use above.
10515 2002-11-19 Miguel de Icaza <miguel@ximian.com>
10517 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
10519 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
10520 handling for enumerations, as we only needed the TypeContainer
10521 functionality to begin with (this is required for the fix below to
10522 work for enums that reference constants in a container class for
10525 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
10527 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
10528 a valid TypeBuilder to perform lookups on.o
10530 * class.cs (InheritableMemberSignatureCompare): Use true in the
10531 call to GetGetMethod and GetSetMethod, because we are comparing
10532 the signature, and we need to get the methods *even* if they are
10535 (PropertyBase.CheckBase): ditto.
10537 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
10538 GotoCase.Resolve): Use Peel on EmpytCasts.
10540 * ecore.cs (EmptyCast): drop child, add Peel method.
10542 2002-11-17 Martin Baulig <martin@ximian.com>
10544 * ecore.cs (EmptyCast.Child): New public property.
10546 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
10547 label resolved to an EmptyCast. Fixes #34162.
10548 (GotoCase.Resolve): Likewise.
10549 (Block.EmitMeta): Likewise.
10551 2002-11-17 Martin Baulig <martin@ximian.com>
10553 * expression.cs (Invocation.BetterConversion): Prefer int over
10554 uint; short over ushort; long over ulong for integer literals.
10555 Use ImplicitConversionExists instead of StandardConversionExists
10556 since we also need to check for user-defined implicit conversions.
10557 Fixes #34165. Added test-173.cs.
10559 2002-11-16 Martin Baulig <martin@ximian.com>
10561 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
10562 with the `true' and `false' literals. Fixes #33151.
10564 2002-11-16 Martin Baulig <martin@ximian.com>
10566 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
10567 October 22nd; don't do the cs1540 check for static members.
10569 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
10570 now using our own filter here and doing the cs1540 check again.
10572 2002-11-16 Martin Baulig <martin@ximian.com>
10574 * support.cs (InternalParameters): Don't crash if we don't have
10575 any fixed parameters. Fixes #33532.
10577 2002-11-16 Martin Baulig <martin@ximian.com>
10579 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
10580 when looking up static methods to make this work on Windows.
10583 2002-11-16 Martin Baulig <martin@ximian.com>
10585 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
10586 a setter rather than using PropertyInfo.CanWrite.
10588 2002-11-15 Nick Drochak <ndrochak@gol.com>
10590 * class.cs: Allow acces to block member by subclasses. Fixes build
10593 2002-11-14 Martin Baulig <martin@ximian.com>
10595 * class.cs (Constructor.Emit): Added the extern/block check.
10598 2002-11-14 Martin Baulig <martin@ximian.com>
10600 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
10601 iteration while looking for indexers, this is needed because the
10602 indexer may have a different name in our base classes. Fixed the
10603 error reporting (no indexers at all, not get accessor, no
10604 overloaded match). Fixes bug #33089.
10605 (IndexerAccess.DoResolveLValue): Likewise.
10607 2002-11-14 Martin Baulig <martin@ximian.com>
10609 * class.cs (PropertyBase.CheckBase): Make this work for multiple
10610 indexers. Fixes the first part of bug #33089.
10611 (MethodSignature.InheritableMemberSignatureCompare): Added support
10614 2002-11-13 Ravi Pratap <ravi@ximian.com>
10616 * attribute.cs (Attribute.Resolve): Catch the
10617 NullReferenceException and report it since it isn't supposed to
10620 2002-11-12 Miguel de Icaza <miguel@ximian.com>
10622 * expression.cs (Binary.EmitBranchable): Also handle the cases for
10623 LogicalOr and LogicalAnd that can benefit from recursively
10624 handling EmitBranchable. The code now should be nice for Paolo.
10626 2002-11-08 Miguel de Icaza <miguel@ximian.com>
10628 * typemanager.cs (LookupType): Added a negative-hit hashtable for
10629 the Type lookups, as we perform quite a number of lookups on
10630 non-Types. This can be removed once we can deterministically tell
10631 whether we have a type or a namespace in advance.
10633 But this might require special hacks from our corlib.
10637 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
10638 and double which avoids a conversion from an integer to a double.
10640 * expression.cs: tiny optimization, avoid calling IsConstant,
10641 because it effectively performs the lookup twice.
10643 2002-11-06 Miguel de Icaza <miguel@ximian.com>
10645 But a bogus return here to keep the semantics of the old code
10646 until the Mono runtime is fixed.
10648 * pending.cs (GetMissingInterfaces): New method used to remove all
10649 the interfaces that are already implemented by our parent
10650 classes from the list of pending methods.
10652 * interface.cs: Add checks for calls after ResolveTypeExpr.
10654 2002-11-05 Miguel de Icaza <miguel@ximian.com>
10656 * class.cs (Class.Emit): Report warning 67: event not used if the
10657 warning level is beyond 3.
10659 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
10660 being a NullLiteral.
10662 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
10665 * class.cs (TypeContainer.GetClassBases): Cover a missing code
10666 path that might fail if a type can not be resolved.
10668 * expression.cs (Binary.Emit): Emit unsigned versions of the
10671 * driver.cs: use error 5.
10673 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
10675 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
10677 2002-11-01 Miguel de Icaza <miguel@ximian.com>
10679 * cs-parser.jay (switch_section): A beautiful patch from Martin
10680 Baulig that fixed 33094.
10682 2002-10-31 Miguel de Icaza <miguel@ximian.com>
10684 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
10685 Check whether the base is abstract and report an error if so.
10687 * expression.cs (IndexerAccess.DoResolveLValue,
10688 IndexerAccess.DoResolve): ditto.
10690 (Invocation.DoResolve): ditto.
10692 (Invocation.FullMethodDesc): Improve the report string.
10694 * statement.cs (Block): Eliminate IsVariableDefined as it is
10695 basically just a wrapper for GetVariableInfo.
10697 * ecore.cs (SimpleName): Use new
10699 * support.cs (ReflectionParamter.ParameterType): We unwrap the
10700 type, as we return the actual parameter ref/unref state on a
10703 2002-10-30 Miguel de Icaza <miguel@ximian.com>
10705 * support.cs: Return proper flags REF/OUT fixing the previous
10708 * expression.cs: Reverted last patch, that was wrong. Is_ref is
10709 not used to mean `ref' but `ref or out' in ParameterReference
10711 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
10712 full type signature instead of calling TypeManger.CSharpName
10715 * support.cs (InternalParameters.ParameterDesc): Do not compare
10716 directly to the modflags, because REF/OUT will actually be bitsets
10719 * delegate.cs (VerifyMethod): Check also the modifiers.
10721 * cs-tokenizer.cs: Fix bug where floating point values with an
10722 exponent where a sign was missing was ignored.
10724 * driver.cs: Allow multiple assemblies to be specified in a single
10727 2002-10-28 Miguel de Icaza <miguel@ximian.com>
10729 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
10730 because identifiers after a parenthesis would end up in this kind
10731 of production, and we needed to desamiguate it for having casts
10734 (UserDefinedType *) xxx
10736 2002-10-24 Miguel de Icaza <miguel@ximian.com>
10738 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
10739 we should set on the Bindingflags.NonPublic, but not turn on
10740 private_ok. private_ok controls whether a Private member is
10741 returned (this is chekced on the filter routine), while the
10742 BindingFlags.NonPublic just controls whether private/protected
10743 will be allowed. This fixes the problem part of the problem of
10744 private properties being allowed to be used in derived classes.
10746 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
10747 so we can call the children DoResolveLValue method (this will
10748 properly signal errors on lvalue assignments to base properties)
10750 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
10751 getter are null, and we have a property info, we know that this
10752 happened because the lookup failed, so we report an error 122 for
10753 protection level violation.
10755 We also silently return if setter and getter are null in the
10756 resolve functions, this condition only happens if we have flagged
10757 the error before. This is the other half of the problem.
10759 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
10760 not have accessibility information, that is why we were returning
10761 true in the filter function in typemanager.cs.
10763 To properly report 122 (property is inaccessible because of its
10764 protection level) correctly, we report this error in ResolveAccess
10765 by failing if both the setter and the getter are lacking (ie, the
10768 DoResolve and DoLResolve have been modified to check for both
10769 setter/getter being null and returning silently, the reason being
10770 that I did not want to put the knowledge about this error in upper
10773 int old = Report.Errors;
10774 x = new PropertyExpr (...);
10775 if (old != Report.Errors)
10780 So the property expr is returned, but it is invalid, so the error
10781 will be flagged during the resolve process.
10783 * class.cs: Remove InheritablePropertySignatureCompare from the
10784 class, as we no longer depend on the property signature to compute
10785 whether it is possible to implement a method or not.
10787 The reason is that calling PropertyInfo.GetGetMethod will return
10788 null (in .NET, in Mono it works, and we should change this), in
10789 cases where the Get Method does not exist in that particular
10794 class X { public virtual int A { get { return 1; } } }
10796 class Z : Y { public override int A { get { return 2; } } }
10798 Would fail in Z because the parent (Y) would not have the property
10799 defined. So we avoid this completely now (because the alternative
10800 fix was ugly and slow), and we now depend exclusively on the
10803 (PropertyBase.CheckBase): Use a method-base mechanism to find our
10804 reference method, instead of using the property.
10806 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
10807 routines are gone now.
10809 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
10810 names, they were incorrectly named.
10812 * cs-tokenizer.cs: Return are more gentle token on failure.
10814 * pending.cs (PendingImplementation.InterfaceMethod): This routine
10815 had an out-of-sync index variable, which caused it to remove from
10816 the list of pending methods the wrong method sometimes.
10818 2002-10-22 Miguel de Icaza <miguel@ximian.com>
10820 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
10821 CanWrite, because those refer to this particular instance of the
10822 property, and do not take into account the fact that we can
10823 override single members of a property.
10825 Constructor requires an EmitContext. The resolution process does
10826 not happen here, but we need to compute the accessors before,
10827 because the resolution does not always happen for properties.
10829 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10830 subclass, before we did not update this flag, but we did update
10833 (GetAccessors): Drop this routine, as it did not work in the
10834 presence of partially overwritten set/get methods.
10836 Notice that this broke the cs1540 detection, but that will require
10839 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10843 * driver.cs: issue a warning instead of an error if we don't support
10844 debugging for the platform. Also ignore a couple of errors that may
10845 arise when trying to write the symbols. Undo my previous patch.
10847 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10849 * driver.cs: ignore /debug switch except for Unix platforms.
10851 2002-10-23 Nick Drochak <ndrochak@gol.com>
10853 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10855 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10857 * driver.cs: Do not make mcs-debug conditional, so we do not break
10858 builds that use it.
10860 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10861 review this patch. But basically after all the children variables
10862 have been merged, the value of "Breaks" was not being set to
10863 new_breaks for Switch blocks. I think that it should be set after
10864 it has executed. Currently I set this to the value of new_breaks,
10865 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10866 conservative, but I do not understand this code very well.
10868 I did not break anything in the build, so that is good ;-)
10870 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10872 2002-10-20 Mark Crichton <crichton@gimp.org>
10874 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10876 2002-10-20 Nick Drochak <ndrochak@gol.com>
10878 * cfold.cs: Fixed compile blocker.
10880 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10882 * driver.cs: I was chekcing the key, not the file.
10884 2002-10-19 Ravi Pratap <ravi@ximian.com>
10886 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10887 message that we were generating - we just need to silently return
10890 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10892 * class.cs (Event.Define): Change my previous commit, as this
10893 breaks the debugger. This is a temporary hack, as it seems like
10894 the compiler is generating events incorrectly to begin with.
10896 * expression.cs (Binary.ResolveOperator): Added support for
10897 "U operator - (E x, E y)"
10899 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10902 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10903 init-only variables, but this path did not take into account that
10904 there might be also instance readonly variables. Correct this
10907 This fixes bug 32253
10909 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10912 * driver.cs: Change the extension for modules to `netmodule'
10914 * cs-parser.jay: Improved slightly the location tracking for
10915 the debugger symbols.
10917 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10918 modifiers that were specified instead of the hardcoded value
10919 (FamAndAssem). This was basically ignoring the static modifier,
10920 and others. Fixes 32429.
10922 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10923 fixed a bug in the process (32476)
10925 * expression.cs (ArrayAccess.EmitAssign): Patch from
10926 hwang_rob@yahoo.ca that fixes bug 31834.3
10928 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10930 * driver.cs: Make the module extension .netmodule.
10932 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10934 * driver.cs: Report an error if the resource file is not found
10935 instead of crashing.
10937 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10938 false, like Emit does.
10940 2002-10-16 Nick Drochak <ndrochak@gol.com>
10942 * typemanager.cs: Remove unused private member. Also reported mcs
10943 bug to report this as a warning like csc.
10945 2002-10-15 Martin Baulig <martin@gnome.org>
10947 * statement.cs (Statement.Emit): Made this a virtual method; emits
10948 the line number info and calls DoEmit().
10949 (Statement.DoEmit): New protected abstract method, formerly knows
10950 as Statement.Emit().
10952 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10954 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10956 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10957 have fixed a remaining problem: not every AddXXXX was adding a
10958 fully qualified name.
10960 Now everyone registers a fully qualified name in the DeclSpace as
10961 being defined instead of the partial name.
10963 Downsides: we are slower than we need to be due to the excess
10964 copies and the names being registered this way.
10966 The reason for this is that we currently depend (on the corlib
10967 bootstrap for instance) that types are fully qualified, because
10968 we dump all the types in the namespace, and we should really have
10969 types inserted into the proper namespace, so we can only store the
10970 basenames in the defined_names array.
10972 2002-10-10 Martin Baulig <martin@gnome.org>
10974 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10975 from bug #31834, see the bug report for a testcase which is
10978 2002-10-10 Martin Baulig <martin@gnome.org>
10980 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10981 flow analysis code for this.
10983 * statement.cs (Do, While, For): Tell the flow analysis code about
10985 (FlowBranching.UsageVector): Added support for infinite loops.
10986 (Block.Resolve): Moved the dead code elimination here and use flow
10989 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10991 * class.cs (Field.Define): Catch cycles on struct type
10994 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10995 fields if the fields are static. We only need to check instance
10998 * expression.cs (As.DoResolve): Test for reference type.
11000 * statement.cs (Using.ResolveExpression): Use
11001 ConvertImplicitRequired, not ConvertImplicit which reports an
11003 (Using.ResolveLocalVariableDecls): ditto.
11005 * expression.cs (Binary.ResolveOperator): Report errors in a few
11006 places where we had to.
11008 * typemanager.cs (IsUnmanagedtype): Finish implementation.
11010 2002-10-08 Miguel de Icaza <miguel@ximian.com>
11012 * expression.cs: Use StoreFromPtr instead of extracting the type
11013 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
11015 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
11016 an enumeration value to a System.Enum, but System.Enum is not a
11017 value type, but an class type, so we need to box.
11019 (Expression.ConvertExplicit): One codepath could return
11020 errors but not flag them. Fix this. Fixes #31853
11022 * parameter.cs (Resolve): Do not allow void as a parameter type.
11024 2002-10-06 Martin Baulig <martin@gnome.org>
11026 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
11027 if it's a class type and not a struct. Fixes #31815.
11029 2002-10-06 Martin Baulig <martin@gnome.org>
11031 * statement.cs: Reworked the flow analysis code a bit to make it
11032 usable for dead code elimination.
11034 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11036 * cs-parser.jay: allow empty source files. Fixes bug #31781.
11038 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11040 * expression.cs (ComposedCast.DoResolveType): A quick workaround
11041 to fix the test 165, will investigate deeper.
11043 2002-10-04 Martin Baulig <martin@gnome.org>
11045 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
11046 finally blocks actually work.
11047 (Try.Resolve): We don't need to create a sibling for `finally' if
11048 there is no finally block.
11050 2002-10-04 Martin Baulig <martin@gnome.org>
11052 * class.cs (Constructor.Define): The default accessibility for a
11053 non-default constructor is private, not public.
11055 2002-10-04 Miguel de Icaza <miguel@ximian.com>
11057 * class.cs (Constructor): Make AllowedModifiers public, add
11060 * cs-parser.jay: Perform the modifiers test here, as the
11061 constructor for the Constructor class usually receives a zero
11062 because of the way we create it (first we create, later we
11063 customize, and we were never checking the modifiers).
11065 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
11066 is a version of LookupTypeReflection that includes the type-name
11067 cache. This can be used as a fast path for functions that know
11068 the fully qualified name and are only calling into *.GetType() to
11069 obtain a composed type.
11071 This is also used by TypeManager.LookupType during its type
11074 (LookupType): We now also track the real type name, as sometimes
11075 we can get a quey for the real type name from things like
11076 ComposedCast. This fixes bug 31422.
11078 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
11079 complete type fullname, it does not have to go through the type
11080 resolution system to obtain the composed version of the type (for
11081 obtaining arrays or pointers).
11083 (Conditional.Emit): Use the EmitBoolExpression to
11084 generate nicer code, as requested by Paolo.
11086 (ArrayCreation.CheckIndices): Use the patch from
11087 hwang_rob@yahoo.ca to validate the array initializers.
11089 2002-10-03 Miguel de Icaza <miguel@ximian.com>
11091 * class.cs (ConstructorInitializer.Emit): simplify code by using
11092 Invocation.EmitCall, and at the same time, fix the bugs in calling
11093 parent constructors that took variable arguments.
11095 * ecore.cs (Expression.ConvertNumericExplicit,
11096 Expression.ImplicitNumericConversion): Remove the code that
11097 manually wrapped decimal (InternalTypeConstructor call is now gone
11100 * expression.cs (Cast.TryReduce): Also handle decimal types when
11101 trying to perform a constant fold on the type.
11103 * typemanager.cs (IsUnmanagedtype): Partially implemented.
11105 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
11106 that only turned off an error report, and did nothing else.
11108 2002-10-02 Miguel de Icaza <miguel@ximian.com>
11110 * driver.cs: Handle and ignore /fullpaths
11112 2002-10-01 Miguel de Icaza <miguel@ximian.com>
11114 * expression.cs (Binary.ResolveOperator): Catch the case where
11115 DoNumericPromotions returns true,
11117 (Binary.DoNumericPromotions): Simplify the code, and the tests.
11119 2002-09-27 Miguel de Icaza <miguel@ximian.com>
11121 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
11124 2002-09-26 Miguel de Icaza <miguel@ximian.com>
11126 * ecore.cs (ConvertNumericExplicit): It is not enough that the
11127 conversion exists, but it is also required that the conversion be
11128 performed. This manifested in "(Type64Enum) 2".
11130 * class.cs (TypeManager.AddMethod): The fix is not to change
11131 AddEnum, because that one was using a fully qualified name (every
11132 DeclSpace derivative does), but to change the AddMethod routine
11133 that was using an un-namespaced name. This now correctly reports
11134 the duplicated name.
11136 Revert patch until I can properly fix it. The issue
11137 is that we have a shared Type space across all namespaces
11138 currently, which is wrong.
11140 Options include making the Namespace a DeclSpace, and merge
11141 current_namespace/current_container in the parser.
11143 2002-09-25 Miguel de Icaza <miguel@ximian.com>
11145 * cs-parser.jay: Improve error reporting when we get a different
11146 kind of expression in local_variable_type and
11147 local_variable_pointer_type.
11149 Propagate this to avoid missleading errors being reported.
11151 * ecore.cs (ImplicitReferenceConversion): treat
11152 TypeManager.value_type as a target just like object_type. As
11157 Is valid, and needs to result in the int 1 being boxed before it
11158 is assigned to the value type v.
11160 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
11161 to validate the enumeration name.
11163 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
11164 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
11165 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
11167 * ecore.cs (TryImplicitIntConversion): When doing an
11168 implicit-enumeration-conversion, check if the type is 64-bits and
11169 perform a conversion before passing to EnumConstant.
11171 2002-09-23 Miguel de Icaza <miguel@ximian.com>
11173 * decl.cs (Error_AmbiguousTypeReference); New routine used to
11174 report ambiguous type references. Unlike the MS version, we
11175 report what the ambiguity is. Innovation at work ;-)
11177 (DeclSpace.FindType): Require a location argument to
11178 display when we display an ambiguous error.
11180 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
11182 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
11184 * expression.cs (EmitDynamicInitializers): Apply patch from
11185 hwang_rob@yahoo.ca that fixes the order in which we emit our
11188 2002-09-21 Martin Baulig <martin@gnome.org>
11190 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
11191 delegate takes no arguments.
11193 2002-09-20 Miguel de Icaza <miguel@ximian.com>
11195 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
11198 * expression.cs: Extract the underlying type.
11200 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
11202 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
11204 2002-09-19 Miguel de Icaza <miguel@ximian.com>
11206 * class.cs (TypeContainer.DefineType): We can not use the nice
11207 PackingSize with the size set to 1 DefineType method, because it
11208 will not allow us to define the interfaces that the struct
11211 This completes the fixing of bug 27287
11213 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
11214 means also structs. This fixes part of the problem.
11215 (Expresion.ImplicitReferenceConversionExists): ditto.
11217 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
11218 error if there were no errors reported during the type lookup
11219 process, to avoid duplicates or redundant errors. Without this
11220 you would get an ambiguous errors plus a type not found. We have
11221 beaten the user enough with the first error.
11223 (DeclSparce.FindType): Emit a warning if we have an ambiguous
11226 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
11227 during the resolution process, stop the lookup, this avoids
11228 repeated error reports (same error twice).
11230 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
11232 * typemanager.cs (LookupType): Redo the type lookup code to match
11233 the needs of System.Reflection.
11235 The issue is that System.Reflection requires references to nested
11236 types to begin with a "+" sign instead of a dot. So toplevel
11237 types look like: "NameSpace.TopLevelClass", and nested ones look
11238 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
11241 2002-09-19 Martin Baulig <martin@gnome.org>
11243 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
11244 says that a method always returns or always throws an exception,
11245 don't report the CS0161.
11247 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
11248 set `Returns = new_returns'.
11250 2002-09-19 Martin Baulig <martin@gnome.org>
11252 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
11253 to an enum constant, check for a CS0176.
11255 2002-09-18 Miguel de Icaza <miguel@ximian.com>
11257 * class.cs (TypeContainer.CheckPairedOperators): Now we check
11258 for operators that must be in pairs and report errors.
11260 * ecore.cs (SimpleName.DoResolveType): During the initial type
11261 resolution process, when we define types recursively, we must
11262 check first for types in our current scope before we perform
11263 lookups in the enclosing scopes.
11265 * expression.cs (MakeByteBlob): Handle Decimal blobs.
11267 (Invocation.VerifyArgumentsCompat): Call
11268 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
11269 I thought we were supposed to always call this, but there are a
11270 few places in the code where we dont do it.
11272 2002-09-17 Miguel de Icaza <miguel@ximian.com>
11274 * driver.cs: Add support in -linkres and -resource to specify the
11275 name of the identifier.
11277 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11279 * ecore.cs (StandardConversionExists): Sync with the conversion
11280 code: allow anything-* to void* conversions.
11282 (FindMostSpecificSource): Use an Expression argument
11283 instead of a Type, because we might be handed over a Literal which
11284 gets a few more implicit conversions that plain types do not. So
11285 this information was being lost.
11287 Also, we drop the temporary type-holder expression when not
11290 2002-09-17 Martin Baulig <martin@gnome.org>
11292 * class.cs (PropertyBase.CheckBase): Don't check the base class if
11293 this is an explicit interface implementation.
11295 2002-09-17 Martin Baulig <martin@gnome.org>
11297 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
11298 different `IndexerName' attributes.
11300 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
11301 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
11302 virtual CommonResolve().
11304 2002-09-16 Miguel de Icaza <miguel@ximian.com>
11306 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
11307 and convert that to the UnderlyingType.
11309 * statement.cs (Foreach.Resolve): Indexers are just like variables
11310 or PropertyAccesses.
11312 * cs-tokenizer.cs (consume_string): Track line numbers and columns
11313 inside quoted strings, we were not doing this before.
11315 2002-09-16 Martin Baulig <martin@gnome.org>
11317 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
11318 resolve it. This is needed for the definite assignment check of the
11319 instance expression, fixes bug #29846.
11320 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
11322 2002-09-16 Nick Drochak <ndrochak@gol.com>
11324 * parameter.cs: Fix compile error. Cannot reference static member
11325 from an instance object. Is this an mcs bug?
11327 2002-09-14 Martin Baulig <martin@gnome.org>
11329 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
11330 multiple times. Fixes bug #30295, added test-166.cs.
11332 2002-09-14 Martin Baulig <martin@gnome.org>
11334 * statement.cs (Block.Emit): Don't emit unreachable code.
11335 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
11336 `break' statements.
11337 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
11339 2002-09-14 Martin Baulig <martin@gnome.org>
11341 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
11344 2002-09-14 Martin Baulig <martin@gnome.org>
11346 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
11347 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
11348 be false on the ms runtime.
11350 2002-09-13 Martin Baulig <martin@gnome.org>
11352 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
11353 the CS0038 error message.
11355 2002-09-12 Miguel de Icaza <miguel@ximian.com>
11357 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
11358 constant inside, return it.
11360 2002-09-12 Martin Baulig <martin@gnome.org>
11362 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
11363 implicit conversion can be done between enum types.
11365 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
11366 check whether an implicit conversion to the current enum's UnderlyingType
11367 exists and report an error if not.
11369 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
11370 without debugging support.
11372 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
11373 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
11375 2002-09-12 Martin Baulig <martin@gnome.org>
11377 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
11379 * ecore.cs (IMemberExpr.DeclaringType): New property.
11380 (SimpleName.SimpleNameResolve): Check whether we're accessing a
11381 nonstatic member of an outer type (CS0038).
11383 2002-09-11 Miguel de Icaza <miguel@ximian.com>
11385 * driver.cs: Activate the using-error detector at warning level
11386 4 (at least for MS-compatible APIs).
11388 * namespace.cs (VerifyUsing): Small buglett fix.
11390 * pending.cs (PendingImplementation): pass the container pointer.
11392 * interface.cs (GetMethods): Allow for recursive definition. Long
11393 term, I would like to move every type to support recursive
11394 definitions, not the current ordering mechanism that we have right
11397 The situation is this: Attributes are handled before interfaces,
11398 so we can apply attributes to interfaces. But some attributes
11399 implement interfaces, we will now handle the simple cases
11400 (recursive definitions will just get an error).
11402 * parameter.cs: Only invalidate types at the end if we fail to
11405 2002-09-09 Martin Baulig <martin@gnome.org>
11407 * ecore.cs (PropertyExpr.Emit): Also check for
11408 TypeManager.system_int_array_get_length so this'll also work when
11409 compiling corlib. Fixes #30003.
11411 2002-09-09 Martin Baulig <martin@gnome.org>
11413 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
11414 and throw an exception if we can't get the type's size. Fixed #30040,
11417 2002-09-09 Martin Baulig <martin@gnome.org>
11419 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
11421 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
11422 context. Fixes bug #30027.
11424 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
11425 virtual functions. Fixes bug #30043, added test-164.cs.
11427 2002-09-08 Ravi Pratap <ravi@ximian.com>
11429 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
11431 2002-09-08 Nick Drochak <ndrochak@gol.com>
11433 * driver.cs: Use an object to get the windows codepage since it's not a
11436 2002-09-08 Miguel de Icaza <miguel@ximian.com>
11438 * statement.cs (For.Emit): for infinite loops (test == null)
11439 return whether there is a break inside, not always "true".
11441 * namespace.cs (UsingEntry): New struct to hold the name of the
11442 using definition, the location where it is defined, and whether it
11443 has been used in a successful type lookup.
11445 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
11450 2002-09-06 Ravi Pratap <ravi@ximian.com>
11452 * attribute.cs : Fix incorrect code which relied on catching
11453 a NullReferenceException to detect a null being passed in
11454 where an object was expected.
11456 2002-09-06 Miguel de Icaza <miguel@ximian.com>
11458 * statement.cs (Try): flag the catch variable as assigned
11460 * expression.cs (Cast): Simplified by using ResolveType instead of
11461 manually resolving.
11463 * statement.cs (Catch): Fix bug by using ResolveType.
11465 2002-09-06 Ravi Pratap <ravi@ximian.com>
11467 * expression.cs (BetterConversion): Special case for when we have
11468 a NullLiteral as the argument and we have to choose between string
11469 and object types - we choose string the way csc does.
11471 * attribute.cs (Attribute.Resolve): Catch the
11472 NullReferenceException and report error #182 since the Mono
11473 runtime no more has the bug and having this exception raised means
11474 we tried to select a constructor which takes an object and is
11477 2002-09-05 Ravi Pratap <ravi@ximian.com>
11479 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
11480 message (1502, 1503) when we can't locate a method after overload
11481 resolution. This is much more informative and closes the bug
11484 * interface.cs (PopulateMethod): Return if there are no argument
11485 types. Fixes a NullReferenceException bug.
11487 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
11488 expressions too. Previously we were checking only in one place for
11489 positional arguments leaving out named arguments.
11491 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
11492 type to the enum type is not allowed. Remove code corresponding to
11495 (ConvertNumericExplicit): Allow explicit conversions from
11496 the underlying type to enum type. This precisely follows the spec
11497 and closes a bug filed by Gonzalo.
11499 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11502 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
11504 2002-09-03 Miguel de Icaza <miguel@ximian.com>
11506 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
11507 it was important that we stored the right value after the
11508 reduction in `converted'.
11510 2002-09-04 Martin Baulig <martin@gnome.org>
11512 * location.cs (Location.SymbolDocument): Use full pathnames for the
11515 2002-08-30 Miguel de Icaza <miguel@ximian.com>
11517 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
11518 of the expression resolve mechanism, because that will catch the
11519 SimpleName error failures.
11521 (Conditional): If we can not resolve the
11522 expression, return, do not crash.
11524 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11527 (location): display token name instead of its number.
11529 2002-08-28 Martin Baulig <martin@gnome.org>
11531 * expression.cs (Binary.ResolveOperator): Don't silently return
11532 but return an error if an operator cannot be applied between two
11535 2002-08-28 Martin Baulig <martin@gnome.org>
11537 * class.cs (Constructor.Define): Set the permission attributes
11538 correctly instead of making all constructors public.
11540 2002-08-28 Martin Baulig <martin@gnome.org>
11542 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
11543 for private members before reporting a CS0103; if we find anything,
11546 2002-08-28 Martin Baulig <martin@gnome.org>
11548 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
11549 to check whether `closure_start_type == closure_invocation_type',
11550 we also need to check whether `m.DeclaringType == closure_invocation_type'
11551 before bypassing the permission checks. We might be accessing
11552 protected/private members from the base class.
11553 (TypeManager.RealMemberLookup): Only set private_ok if private
11554 members were requested via BindingFlags.NonPublic.
11556 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
11558 * expression.cs (MemberAccess.ResolveMemberAccess): Set
11559 MethodGroupExpr.IsExplicitImpl if appropriate.
11560 (Invocation.DoResolve): Don't report the CS0120 for explicit
11561 interface implementations.
11563 2002-08-27 Martin Baulig <martin@gnome.org>
11565 * expression.cs (Invocation.DoResolve): If this is a static
11566 method and we don't have an InstanceExpression, we must report
11569 2002-08-25 Martin Baulig <martin@gnome.org>
11571 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
11572 `==' between a valuetype and an object.
11574 2002-08-25 Miguel de Icaza <miguel@ximian.com>
11576 * ecore.cs (TypeExpr): Provide a ToString method.
11578 2002-08-24 Martin Baulig <martin@gnome.org>
11580 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
11581 now called proggie.dbg and it's a binary file.
11583 2002-08-23 Martin Baulig <martin@gnome.org>
11585 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
11587 2002-08-23 Martin Baulig <martin@gnome.org>
11589 * struct.cs (MyStructInfo.ctor): Make this work with empty
11590 structs; it's not allowed to use foreach() on null.
11592 2002-08-23 Martin Baulig <martin@gnome.org>
11594 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
11595 writer the full pathname of the generated assembly.
11597 2002-08-23 Martin Baulig <martin@gnome.org>
11599 * statements.cs (FlowBranching.UsageVector.MergeChildren):
11600 A `finally' block never returns or breaks; improved handling of
11603 2002-08-23 Martin Baulig <martin@gnome.org>
11605 * statement.cs (Throw.Resolve): Allow `throw null'.
11607 2002-08-23 Martin Baulig <martin@gnome.org>
11609 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
11610 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
11611 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
11612 MemberLookup would return a wrong event if this is an explicit
11613 interface implementation and the class has an event with the same
11616 2002-08-23 Martin Baulig <martin@gnome.org>
11618 * statement.cs (Block.AddChildVariableNames): New public method.
11619 (Block.AddChildVariableName): Likewise.
11620 (Block.IsVariableNameUsedInChildBlock): Likewise.
11621 (Block.AddVariable): Check whether a variable name has already
11622 been used in a child block.
11624 * cs-parser.jay (declare_local_variables): Mark all variable names
11625 from the current block as being used in a child block in the
11628 2002-08-23 Martin Baulig <martin@gnome.org>
11630 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
11631 find the symbol writer.
11633 * driver.cs: csc also allows the arguments to /define being
11634 separated by commas, not only by semicolons.
11636 2002-08-23 Martin Baulig <martin@gnome.org>
11638 * interface.cs (Interface.GetMembers): Added static check for events.
11640 2002-08-15 Martin Baulig <martin@gnome.org>
11642 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
11643 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
11645 * ecore.cs (Expression.MemberLookup): Added documentation and explained
11646 why the MethodData.EmitDestructor() change was necessary.
11648 2002-08-20 Martin Baulig <martin@gnome.org>
11650 * class.cs (TypeContainer.FindMembers): Added static check for events.
11652 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
11654 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
11655 use Type.GetEvents(), not Type.FindMembers().
11657 2002-08-20 Martin Baulig <martin@gnome.org>
11659 * decl.cs (MemberCache): Added a special method cache which will
11660 be used for method-only searched. This ensures that a method
11661 search will return a MethodInfo with the correct ReflectedType for
11664 2002-08-20 Martin Baulig <martin@gnome.org>
11666 * decl.cs (DeclSpace.FindMembers): Made this public.
11668 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11670 * delegate.cs: fixed build on windows.
11671 [FIXME: Filed as bug #29150: MCS must report these errors.]
11673 2002-08-19 Ravi Pratap <ravi@ximian.com>
11675 * ecore.cs (StandardConversionExists): Return a false
11676 if we are trying to convert the void type to anything else
11677 since that is not allowed.
11679 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
11680 we flag error 70 in the event an event is trying to be accessed
11681 directly from outside the declaring type.
11683 2002-08-20 Martin Baulig <martin@gnome.org>
11685 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
11686 MemberCache from typemanager.cs to decl.cs.
11688 2002-08-19 Martin Baulig <martin@gnome.org>
11690 * class.cs (TypeContainer): Implement IMemberContainer.
11691 (TypeContainer.DefineMembers): Create the MemberCache.
11692 (TypeContainer.FindMembers): Do better BindingFlags checking; only
11693 return public members if BindingFlags.Public was given, check
11694 whether members are static.
11696 2002-08-16 Martin Baulig <martin@gnome.org>
11698 * decl.cs (DeclSpace.Define): Splitted this in Define and
11699 DefineMembers. DefineMembers is called first and initializes the
11702 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
11703 DefineMembers() on all our DeclSpaces.
11705 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
11706 but call DefineMembers() on all nested interfaces. We call their
11707 Define() in our new Define() function.
11709 * interface.cs (Interface): Implement IMemberContainer.
11710 (Interface.Define): Moved all code except the attribute stuf to
11712 (Interface.DefineMembers): Initialize the member cache.
11714 * typemanager.cs (IMemberFinder): Removed this interface, we don't
11715 need this anymore since we can use MemberCache.FindMembers directly.
11717 2002-08-19 Martin Baulig <martin@gnome.org>
11719 * typemanager.cs (MemberCache): When creating the cache for an
11720 interface type, add all inherited members.
11721 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
11722 to `out bool used_cache' and documented it.
11723 (TypeManager.MemberLookup): If we already used the cache in the first
11724 iteration, we don't need to do the interfaces check.
11726 2002-08-19 Martin Baulig <martin@gnome.org>
11728 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
11729 here from IMemberFinder and don't implement this interface anymore.
11730 (DeclSpace.MemberCache): Moved here from IMemberFinder.
11732 * typemanager.cs (IMemberFinder): This interface is now only used by
11733 classes which actually support the member cache.
11734 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
11735 since we only put DeclSpaces into this Hashtable.
11736 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
11737 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
11739 2002-08-16 Martin Baulig <martin@gnome.org>
11741 * typemanager.cs (ICachingMemberFinder): Removed.
11742 (IMemberFinder.MemberCache): New property.
11743 (TypeManager.FindMembers): Merged this with RealFindMembers().
11744 This function will never be called from TypeManager.MemberLookup()
11745 so we can't use the cache here, just the IMemberFinder.
11746 (TypeManager.MemberLookup_FindMembers): Check whether the
11747 IMemberFinder has a MemberCache and call the cache's FindMembers
11749 (MemberCache): Rewrote larger parts of this yet another time and
11750 cleaned it up a bit.
11752 2002-08-15 Miguel de Icaza <miguel@ximian.com>
11754 * driver.cs (LoadArgs): Support quoting.
11756 (Usage): Show the CSC-like command line arguments.
11758 Improved a few error messages.
11760 2002-08-15 Martin Baulig <martin@gnome.org>
11762 * typemanager.cs (IMemberContainer.Type): New property.
11763 (IMemberContainer.IsInterface): New property.
11765 The following changes are conditional to BROKEN_RUNTIME, which is
11766 defined at the top of the file.
11768 * typemanager.cs (MemberCache.MemberCache): Don't add the base
11769 class'es members, but add all members from TypeHandle.ObjectType
11770 if we're an interface.
11771 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
11772 is the current type.
11773 (MemberCache.CacheEntry.Container): Removed this field.
11774 (TypeHandle.GetMembers): Include inherited members.
11776 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11778 * typemanager.cs: fixed compilation and added a comment on a field that
11781 2002-08-15 Martin Baulig <martin@gnome.org>
11783 * class.cs (ConstructorInitializer.Resolve): In the
11784 Expression.MemberLookup call, use the queried_type as
11787 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
11788 declared' attribute, it's always true.
11789 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
11790 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
11791 temporary wrapper for FindMembers which tells MemberLookup whether
11792 members from the base classes are included in the return value.
11793 This will go away soon.
11794 (TypeManager.MemberLookup): Use this temporary hack here; once the
11795 new MemberCache is completed, we don't need to do the DeclaredOnly
11796 looping here anymore since the MemberCache will take care of this.
11797 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
11798 (MemberCache): When creating the MemberCache for a class, get
11799 members from the current class and all its base classes.
11800 (MemberCache.CacheEntry.Container): New field. This is a
11801 temporary hack until the Mono runtime is fixed to distinguish
11802 between ReflectedType and DeclaringType. It allows us to use MCS
11803 with both the MS runtime and the unfixed Mono runtime without
11804 problems and without accecting performance.
11805 (MemberCache.SearchMembers): The DeclaredOnly looping from
11806 TypeManager.MemberLookup is now done here.
11808 2002-08-14 Martin Baulig <martin@gnome.org>
11810 * statement.cs (MyStructInfo.MyStructInfo): Don't call
11811 Type.GetFields on dynamic types but get the fields from the
11812 corresponding TypeContainer.
11813 (MyStructInfo.GetStructInfo): Added check for enum types.
11815 * typemanager.cs (MemberList.IsSynchronized): Implemented.
11816 (MemberList.SyncRoot): Implemented.
11817 (TypeManager.FilterWithClosure): No need to check permissions if
11818 closure_start_type == closure_invocation_type, don't crash if
11819 closure_invocation_type is null.
11821 2002-08-13 Martin Baulig <martin@gnome.org>
11823 Rewrote TypeContainer.FindMembers to use a member cache. This
11824 gives us a speed increase of about 35% for the self-hosting MCS
11825 build and of about 15-20% for the class libs (both on GNU/Linux).
11827 * report.cs (Timer): New class to get enhanced profiling. This
11828 whole class is "TIMER" conditional since it remarkably slows down
11831 * class.cs (MemberList): New class. This is an IList wrapper
11832 which we're now using instead of passing MemberInfo[]'s around to
11833 avoid copying this array unnecessarily.
11834 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11835 (ICachingMemberFinder, IMemberContainer): New interface.
11836 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11837 has already been checked, otherwise use it for the name comparision.
11838 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11839 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11840 if possible. Returns a MemberList, not a MemberInfo [].
11841 (TypeHandle): New class, implements IMemberContainer. We create
11842 one instance of this class per type, it contains a MemberCache
11843 which is used to do the member lookups.
11844 (MemberCache): New class. Each instance of this class contains
11845 all members of a type and a name-based hash table.
11846 (MemberCache.FindMembers): This is our new member lookup
11847 function. First, it looks up all members of the requested name in
11848 the hash table. Then, it walks this list and sorts out all
11849 applicable members and returns them.
11851 2002-08-13 Martin Baulig <martin@gnome.org>
11853 In addition to a nice code cleanup, this gives us a performance
11854 increase of about 1.4% on GNU/Linux - not much, but it's already
11855 half a second for the self-hosting MCS compilation.
11857 * typemanager.cs (IMemberFinder): New interface. It is used by
11858 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11859 Enum, Delegate or Interface.
11860 (TypeManager.finder_to_member_finder): New PtrHashtable.
11861 (TypeManager.finder_to_container): Removed.
11862 (TypeManager.finder_to_delegate): Removed.
11863 (TypeManager.finder_to_interface): Removed.
11864 (TypeManager.finder_to_enum): Removed.
11866 * interface.cs (Interface): Implement IMemberFinder.
11868 * delegate.cs (Delegate): Implement IMemberFinder.
11870 * enum.cs (Enum): Implement IMemberFinder.
11872 * class.cs (TypeContainer): Implement IMemberFinder.
11874 2002-08-12 Martin Baulig <martin@gnome.org>
11876 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11878 2002-08-12 Martin Baulig <martin@gnome.org>
11880 * ecore.cs (ITypeExpression): New interface for expressions which
11882 (TypeExpression): Renamed to TypeLookupExpression.
11883 (Expression.DoResolve): If we're doing a types-only lookup, the
11884 expression must implement the ITypeExpression interface and we
11885 call DoResolveType() on it.
11886 (SimpleName): Implement the new ITypeExpression interface.
11887 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11888 hack, the situation that we're only looking up types can't happen
11889 anymore when this method is called. Moved the type lookup code to
11890 DoResolveType() and call it.
11891 (SimpleName.DoResolveType): This ITypeExpression interface method
11892 is now doing the types-only lookup.
11893 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11894 (ResolveFlags): Added MaskExprClass.
11896 * expression.cs (MemberAccess): Implement the ITypeExpression
11898 (MemberAccess.DoResolve): Added support for a types-only lookup
11899 when we're called via ITypeExpression.DoResolveType().
11900 (ComposedCast): Implement the ITypeExpression interface.
11902 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11903 Expression.Resolve() with ResolveFlags.Type instead.
11905 2002-08-12 Martin Baulig <martin@gnome.org>
11907 * interface.cs (Interface.Define): Apply attributes.
11909 * attribute.cs (Attribute.ApplyAttributes): Added support for
11910 interface attributes.
11912 2002-08-11 Martin Baulig <martin@gnome.org>
11914 * statement.cs (Block.Emit): Only check the "this" variable if we
11915 do not always throw an exception.
11917 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11918 whether the property has a set accessor.
11920 2002-08-11 Martin Baulig <martin@gnome.org>
11922 Added control flow analysis support for structs.
11924 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11925 with control flow analysis turned off.
11926 (IVariable): New interface.
11927 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11928 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11929 (FieldExpr.DoResolve): Resolve the instance expression with flow
11930 analysis turned off and do the definite assignment check after the
11931 resolving when we know what the expression will resolve to.
11933 * expression.cs (LocalVariableReference, ParameterReference):
11934 Implement the new IVariable interface, only call the flow analysis
11935 code if ec.DoFlowAnalysis is true.
11936 (This): Added constructor which takes a Block argument. Implement
11937 the new IVariable interface.
11938 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11939 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11940 This does the definite assignment checks for struct members.
11942 * class.cs (Constructor.Emit): If this is a non-static `struct'
11943 constructor which doesn't have any initializer, call
11944 Block.AddThisVariable() to tell the flow analysis code that all
11945 struct elements must be initialized before control returns from
11948 * statement.cs (MyStructInfo): New public class.
11949 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11950 argument to this indexer. If non-zero, check an individual struct
11951 member, not the whole struct.
11952 (FlowBranching.CheckOutParameters): Check struct members.
11953 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11954 overloaded versions of these methods which take an additional
11955 `int field_idx' argument to check struct members.
11956 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11957 overloaded versions of these methods which take an additional
11958 `string field_name' argument to check struct member.s
11959 (VariableInfo): Implement the IVariable interface.
11960 (VariableInfo.StructInfo): New public property. Returns the
11961 MyStructInfo instance of the variable if it's a struct or null.
11962 (Block.AddThisVariable): New public method. This is called from
11963 Constructor.Emit() for non-static `struct' constructor which do
11964 not have any initializer. It creates a special variable for the
11965 "this" instance variable which will be checked by the flow
11966 analysis code to ensure that all of the struct's fields are
11967 initialized before control returns from the constructor.
11968 (UsageVector): Added support for struct members. If a
11969 variable/parameter is a struct with N members, we reserve a slot
11970 in the usage vector for each member. A struct is considered fully
11971 initialized if either the struct itself (slot 0) or all its
11972 members are initialized.
11974 2002-08-08 Martin Baulig <martin@gnome.org>
11976 * driver.cs (Driver.MainDriver): Only report an error CS5001
11977 if there were no compilation errors.
11979 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11980 `UnsafeContext' property to determine whether the parent is in
11981 unsafe context rather than checking the parent's ModFlags:
11982 classes nested in an unsafe class are unsafe as well.
11984 2002-08-08 Martin Baulig <martin@gnome.org>
11986 * statement.cs (UsageVector.MergeChildren): Distinguish between
11987 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11988 we return. Added test17() and test18() to test-154.cs.
11990 2002-08-08 Martin Baulig <martin@gnome.org>
11992 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11993 Family access, make sure the invoking type isn't a subclass of the
11994 queried type (that'd be a CS1540).
11996 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11997 this method which takes an additional `Type invocation_type'.
11999 * expression.cs (BaseAccess.DoResolve): Use the base type as
12000 invocation and query type.
12001 (MemberAccess.DoResolve): If the lookup failed and we're about to
12002 report a CS0122, try a lookup with the ec.ContainerType - if this
12003 succeeds, we must report a CS1540.
12005 2002-08-08 Martin Baulig <martin@gnome.org>
12007 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
12008 (MethodGroupExpr): Implement the IMemberExpr interface.
12010 * expression (MemberAccess.ResolveMemberAccess): No need to have
12011 any special code for MethodGroupExprs anymore, they're now
12014 2002-08-08 Martin Baulig <martin@gnome.org>
12016 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
12017 Family, FamANDAssem and FamORAssem permissions.
12018 (TypeManager.IsSubclassOrNestedChildOf): New public method.
12020 2002-08-08 Martin Baulig <martin@gnome.org>
12022 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
12023 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
12026 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
12028 * driver.cs: implemented /resource option to embed managed resources.
12030 2002-08-07 Martin Baulig <martin@gnome.org>
12032 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
12033 (FieldBase.HasFieldInitializer): New public property.
12034 (FieldBase.GetInitializerExpression): New public method. Resolves and
12035 returns the field initializer and makes sure it is only resolved once.
12036 (TypeContainer.EmitFieldInitializers): Call
12037 FieldBase.GetInitializerExpression to get the initializer, this ensures
12038 that it isn't resolved multiple times.
12040 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
12041 the resolving process (SimpleName/MemberLookup) that we're currently
12042 emitting a field initializer (which must not access any instance members,
12043 this is an error CS0236).
12045 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
12046 argument, if the `IsFieldInitializer' flag is set, we must report and
12047 error CS0236 and not an error CS0120.
12049 2002-08-07 Martin Baulig <martin@gnome.org>
12051 * ecore.cs (IMemberExpr): New public interface.
12052 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
12053 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
12054 if the expression is an IMemberExpr.
12056 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
12057 to be null, implicitly default to `this' if we're non-static in
12058 this case. Simplified the code a lot by using the new IMemberExpr
12059 interface. Also fixed bug #28176 here.
12061 2002-08-06 Martin Baulig <martin@gnome.org>
12063 * cs-parser.jay (SimpleLookup): Removed. We need to create
12064 ParameterReferences during semantic analysis so that we can do a
12065 type-only search when resolving Cast, TypeOf and SizeOf.
12066 (block): Pass the `current_local_parameters' to the Block's
12069 * class.cs (ConstructorInitializer): Added `Parameters parameters'
12070 argument to the constructor.
12071 (ConstructorInitializer.Resolve): Create a temporary implicit
12072 block with the parameters.
12074 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
12075 references here if we aren't doing a type-only search.
12077 * statement.cs (Block): Added constructor which takes a
12078 `Parameters parameters' argument.
12079 (Block.Parameters): New public property.
12081 * support.cs (InternalParameters.Parameters): Renamed `parameters'
12082 to `Parameters' and made it public readonly.
12084 2002-08-06 Martin Baulig <martin@gnome.org>
12086 * ecore.cs (Expression.Warning): Made this public as well.
12088 * report.cs (Report.Debug): Print the contents of collections.
12090 2002-08-06 Martin Baulig <martin@gnome.org>
12092 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
12093 used to tell Resolve() which kinds of expressions it may return.
12094 (Expression.Resolve): Added overloaded version of this method which
12095 takes a `ResolveFlags flags' argument. This can be used to tell
12096 Resolve() which kinds of expressions it may return. Reports a
12098 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
12099 ResolveFlags.SimpleName.
12100 (Expression.Error118): Added overloaded version of this method which
12101 takes a `ResolveFlags flags' argument. It uses the flags to determine
12102 which kinds of expressions are allowed.
12104 * expression.cs (Argument.ResolveMethodGroup): New public method.
12105 Resolves an argument, but allows a MethodGroup to be returned.
12106 This is used when invoking a delegate.
12108 * TODO: Updated a bit.
12110 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12112 Fixed compilation with csc.
12114 * ecore.cs: Expression.Error made public. Is this correct? Should
12115 Warning be made public too?
12117 * expression.cs: use ea.Location instead of ea.loc.
12118 [FIXME: Filed as bug #28607: MCS must report these errors.]
12120 2002-08-06 Martin Baulig <martin@gnome.org>
12122 * ecore.cs (Expression.loc): Moved the location here instead of
12123 duplicating it in all derived classes.
12124 (Expression.Location): New public property.
12125 (Expression.Error, Expression.Warning): Made them non-static and
12126 removed the location argument.
12127 (Expression.Warning): Added overloaded version which takes an
12128 `int level' argument.
12129 (Expression.Error118): Make this non-static and removed the
12130 expression and location arguments.
12131 (TypeExpr): Added location argument to the constructor.
12133 * expression.cs (StaticCallExpr): Added location argument to
12135 (Indirection, PointerArithmetic): Likewise.
12136 (CheckedExpr, UnCheckedExpr): Likewise.
12137 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
12138 (StringPtr): Likewise.
12141 2002-08-05 Martin Baulig <martin@gnome.org>
12143 * expression.cs (BaseAccess.DoResolve): Actually report errors.
12145 * assign.cs (Assign.DoResolve): Check whether the source
12146 expression is a value or variable.
12148 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
12149 while resolving the corresponding blocks.
12151 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
12152 an error, don't silently return null.
12154 * statement.cs (Block.AddVariable): Do the error reporting here
12155 and distinguish between CS0128 and CS0136.
12156 (Block.DoResolve): Report all unused labels (warning CS0164).
12157 (LabeledStatement): Pass the location to the constructor.
12158 (LabeledStatement.HasBeenReferenced): New property.
12159 (LabeledStatement.Resolve): Set it to true here.
12161 * statement.cs (Return.Emit): Return success even after reporting
12162 a type mismatch error (CS0126 or CS0127), this is what csc does and
12163 it avoids confusing the users with any consecutive errors.
12165 2002-08-05 Martin Baulig <martin@gnome.org>
12167 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
12169 * const.cs (Const.LookupConstantValue): Catch circular definitions.
12171 * expression.cs (MemberAccess.DoResolve): Silently return if an
12172 error has already been reported.
12174 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
12175 error has already been reported.
12177 2002-08-05 Martin Baulig <martin@gnome.org>
12179 * statement.cs (UsageVector): Only initialize the `parameters'
12180 vector if we actually have any "out" parameters.
12182 2002-08-05 Martin Baulig <martin@gnome.org>
12184 * expression.cs (Binary.ResolveOperator): When combining delegates,
12185 they must have the same type.
12187 2002-08-05 Martin Baulig <martin@gnome.org>
12189 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
12190 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
12191 work with the ms runtime and we also don't need it: if we're a
12192 PropertyBuilder and not in the `indexer_arguments' hash, then we
12193 are a property and not an indexer.
12195 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
12196 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
12197 since the latter one doesn't work with the ms runtime.
12199 2002-08-03 Martin Baulig <martin@gnome.org>
12201 Fixed bugs #27998 and #22735.
12203 * class.cs (Method.IsOperator): New public field.
12204 (Method.CheckBase): Report CS0111 if there's already a method
12205 with the same parameters in the current class. Report CS0508 when
12206 attempting to change the return type of an inherited method.
12207 (MethodData.Emit): Report CS0179 if a method doesn't have a body
12208 and it's not marked abstract or extern.
12209 (PropertyBase): New abstract base class for Property and Indexer.
12210 (PropertyBase.CheckBase): Moved here from Property and made it work
12212 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
12213 the same so we can reuse it there.
12214 (Property, Indexer): Derive from PropertyBase.
12215 (MethodSignature.inheritable_property_signature_filter): New delegate
12216 to find properties and indexers.
12218 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
12219 argument and improved error reporting.
12221 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
12222 EmptyReadOnlyParameters and made it a property.
12224 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
12225 version of this method which takes a `PropertyInfo indexer'.
12226 (TypeManager.RegisterIndexer): New method.
12228 * class.cs: Added myself as author of this file :-)
12230 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12232 * class.cs: fixed compilation on windoze.
12234 2002-08-03 Martin Baulig <martin@gnome.org>
12236 * interface.cs (Interface.GetInterfaceBases): Check whether all
12237 base interfaces are at least as accessible than the current one.
12239 * class.cs (TypeContainer.GetClassBases): Check whether base types
12240 are at least as accessible than the current type.
12241 (TypeContainer.AsAccessible): Implemented and made non-static.
12242 (MemberBase.CheckParameters): Report errors if the accessibility
12245 * delegate.cs (Delegate.Delegate): The default visibility is
12246 internal for top-level types and private for nested types.
12247 (Delegate.Define): Report errors if the accessibility checks fail.
12249 * enum.cs (Enum.Enum): The default visibility is internal for
12250 top-level types and private for nested types.
12251 (Enum.DefineType): Compute the correct visibility.
12253 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
12254 function which takes a `bool is_toplevel' instead of a TypeContainer.
12256 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
12259 2002-08-02 Martin Baulig <martin@gnome.org>
12261 * expression.cs (LocalVariableReferenc): Added constructor which
12262 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
12263 (LocalVariableReference.IsReadOnly): New property.
12264 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
12265 variable is readonly, use our own readonly flag to do this; you can
12266 use the new constructor to get a writable reference to a read-only
12269 * cs-parser.jay (foreach_statement, using_statement): Get a writable
12270 reference to the local variable.
12272 2002-08-01 Miguel de Icaza <miguel@ximian.com>
12274 * rootcontext.cs (ResolveCore): Also include System.Exception
12276 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
12277 we reach an EmptyStatement.
12279 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
12282 * expression.cs (Binary.ResolveOperator): Check error result in
12285 use brtrue/brfalse directly and avoid compares to null.
12287 2002-08-02 Martin Baulig <martin@gnome.org>
12289 * class.cs (TypeContainer.Define): Define all nested interfaces here.
12290 Fixes bug #28407, added test-155.cs.
12292 2002-08-01 Martin Baulig <martin@gnome.org>
12294 * class.cs (Event.EmitDefaultMethod): Make this work with static
12295 events. Fixes #28311, added verify-3.cs.
12297 2002-08-01 Martin Baulig <martin@gnome.org>
12299 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
12300 `is_disposable' fields.
12301 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
12302 `hm.is_disposable' if we're using the collection pattern.
12303 (Foreach.EmitCollectionForeach): Use the correct type for the
12304 enumerator's local variable, only emit the try/finally block if
12305 necessary (fixes #27713).
12307 2002-08-01 Martin Baulig <martin@gnome.org>
12309 * ecore.cs (Expression.report118): Renamed to Error118 and made
12312 * statement.cs (Throw.Resolve): Check whether the expression is of
12313 the correct type (CS0118) and whether the type derives from
12314 System.Exception (CS0155).
12315 (Catch.Resolve): New method. Do the type lookup here and check
12316 whether it derives from System.Exception (CS0155).
12317 (Catch.CatchType, Catch.IsGeneral): New public properties.
12319 * typemanager.cs (TypeManager.exception_type): Added.
12321 2002-07-31 Miguel de Icaza <miguel@ximian.com>
12323 * driver.cs: Updated About function.
12325 2002-07-31 Martin Baulig <martin@gnome.org>
12327 Implemented Control Flow Analysis.
12329 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
12330 (EmitContext.CurrentBranching): Added.
12331 (EmitContext.StartFlowBranching): Added.
12332 (EmitContext.EndFlowBranching): Added.
12333 (EmitContext.KillFlowBranching): Added.
12334 (EmitContext.IsVariableAssigned): Added.
12335 (EmitContext.SetVariableAssigned): Added.
12336 (EmitContext.IsParameterAssigned): Added.
12337 (EmitContext.SetParameterAssigned): Added.
12338 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
12339 Added control flow analysis stuff here.
12341 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
12342 resolve the expression as lvalue.
12343 (LocalVariableReference.DoResolve): Check whether the variable has
12344 already been assigned.
12345 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
12346 the parameter as assigned here.
12347 (ParameterReference.DoResolve): Check whether the parameter has already
12349 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
12350 expression as lvalue.
12352 * statement.cs (FlowBranching): New class for the flow analysis code.
12353 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
12354 (LabeledStatement.IsDefined): New public property.
12355 (LabeledStatement.AddUsageVector): New public method to tell flow
12356 analyis that the label may be reached via a forward jump.
12357 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
12359 (VariableInfo.Number): New public field. This is used by flow analysis
12360 to number all locals of a block.
12361 (Block.CountVariables): New public property. This is the number of
12362 local variables in this block (including the locals from all parent
12364 (Block.EmitMeta): Number all the variables.
12366 * statement.cs: Added flow analysis support to all classes.
12368 2002-07-31 Martin Baulig <martin@gnome.org>
12370 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
12371 To get debugging messages, compile mcs with /define:MCS_DEBUG and
12372 then use this argument.
12374 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
12376 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
12377 use this to specify /define options.
12379 2002-07-29 Martin Baulig <martin@gnome.org>
12381 * statement.cs (Fixed): Moved all code that does variable lookups
12382 and resolvings from Emit to Resolve.
12384 * statement.cs (For): Moved all code that does variable lookups
12385 and resolvings from Emit to Resolve.
12387 * statement.cs (Using): Moved all code that does variable lookups
12388 and resolvings from Emit to Resolve.
12390 2002-07-29 Martin Baulig <martin@gnome.org>
12392 * attribute.cs (Attribute.Resolve): Explicitly catch a
12393 System.NullReferenceException when creating the
12394 CustromAttributeBuilder and report a different warning message.
12396 2002-07-29 Martin Baulig <martin@gnome.org>
12398 * support.cs (ParameterData.ParameterName): Added method to
12399 get the name of a parameter.
12401 * typemanager.cs (TypeManager.IsValueType): New public method.
12403 2002-07-29 Martin Baulig <martin@gnome.org>
12405 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
12406 is a flag which specifies that it's either ref or out.
12407 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
12408 the out parameter to `out Parameter.Modifier mod', also set the
12409 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
12411 * support.cs (InternalParameters.ParameterModifier): Distinguish
12412 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12413 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12415 * expression.cs (Argument.GetParameterModifier): Distinguish
12416 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12417 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12419 2002-07-29 Martin Baulig <martin@gnome.org>
12421 * expression.cs (ParameterReference.ParameterReference): Added
12422 `Location loc' argument to the constructor.
12424 * cs-parser.jay: Pass location to ParameterReference.
12426 2002-07-28 Miguel de Icaza <miguel@ximian.com>
12428 * statement.cs (Try): Initialize the location.
12430 * cs-parser.jay: pass location to Try.
12432 * expression.cs (Unary.Reduce): Change the prototype to return
12433 whether a constant fold could be performed or not. The result is
12434 returned in an out parameters. In the case of Indirection and
12435 AddressOf, we want to perform the full tests.
12437 2002-07-26 Miguel de Icaza <miguel@ximian.com>
12439 * statement.cs (Statement.Emit): Flag dead code.
12441 2002-07-27 Andrew Birkett <andy@nobugs.org>
12443 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
12445 2002-07-27 Martin Baulig <martin@gnome.org>
12447 * class.cs (MethodData.Define): Put back call to
12448 TypeManager.AddMethod(), accidentally commented this out.
12450 * report.cs (Debug): New public method to print debugging information,
12451 this is `[Conditional ("DEBUG")]'.
12453 2002-07-26 Martin Baulig <martin@gnome.org>
12455 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
12456 (switch_statement): Push the current_block to the switch_stack and
12457 pop it again when we're done with the switch.
12458 (switch_section): The new block is a child of the current_block.
12459 Fixes bug #24007, added test-152.cs.
12461 2002-07-27 Martin Baulig <martin@gnome.org>
12463 * expression.cs (Invocation.EmitArguments): When calling a varargs
12464 function with only its fixed arguments, we need to pass an empty
12467 2002-07-27 Martin Baulig <martin@gnome.org>
12469 Mono 0.13 has been released.
12471 2002-07-25 Miguel de Icaza <miguel@ximian.com>
12473 * driver.cs: Rename --resource to --linkres, because that is what
12474 we do currently, we dont support --resource yet.
12476 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
12478 2002-07-25 Martin Baulig <martin@gnome.org>
12480 * class.cs (MethodData): New public class. This is a `method builder'
12481 class for a method or one accessor of a Property/Indexer/Event.
12482 (MethodData.GetMethodFlags): Moved here from MemberBase.
12483 (MethodData.ApplyAttributes): Likewise.
12484 (MethodData.ApplyObsoleteAttribute): Likewise.
12485 (MethodData.ApplyConditionalAttribute): Likewise.
12486 (MethodData.ApplyDllImportAttribute): Likewise.
12487 (MethodData.CheckAbstractAndExternal): Likewise.
12488 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
12489 (MethodData.Emit): Formerly known as Method.Emit().
12490 (MemberBase): Moved everything which was specific to a single
12491 accessor/method to MethodData.
12492 (Method): Create a new MethodData and call Define() and Emit() on it.
12493 (Property, Indexer, Event): Create a new MethodData objects for each
12494 accessor and call Define() and Emit() on them.
12496 2002-07-25 Martin Baulig <martin@gnome.org>
12498 Made MethodCore derive from MemberBase to reuse the code from there.
12499 MemberBase now also checks for attributes.
12501 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
12502 (MemberBase.GetMethodFlags): Moved here from class Method and marked
12504 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
12505 `CallingConventions cc' and `Attributes opt_attrs' arguments.
12506 (MemberBase.ApplyAttributes): New virtual method; applies the
12507 attributes to a method or accessor.
12508 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
12509 (MemberBase.ApplyConditionalAttribute): Likewise.
12510 (MemberBase.ApplyDllImportAttribute): Likewise.
12511 (MemberBase.CheckAbstractAndExternal): Likewise.
12512 (MethodCore.ParameterTypes): This is now a property instead of a
12513 method, it's initialized from DoDefineParameters().
12514 (MethodCore.ParameterInfo): Removed the set accessor.
12515 (MethodCore.DoDefineParameters): New protected virtual method to
12516 initialize ParameterTypes and ParameterInfo.
12517 (Method.GetReturnType): We can now simply return the MemberType.
12518 (Method.GetMethodFlags): Override the MemberBase version and add
12519 the conditional flags.
12520 (Method.CheckBase): Moved some code from Define() here, call
12521 DoDefineParameters() here.
12522 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
12523 here to avoid some larger code duplication.
12524 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
12525 ensure that abstract and external accessors don't declare a body.
12527 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
12528 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
12529 lookup in the attribute's parent classes, so we need to abort as soon
12530 as we found the first match.
12531 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
12532 the attribute has no arguments.
12534 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
12537 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12539 * cs-parser.jay: reverted previous patch.
12541 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12543 * cs-parser.jay: fixed bug #22119.
12545 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12547 * attribute.cs: fixed compilation. The error was:
12548 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
12549 be assigned to before control leaves the current method."
12550 [FIXME: Filed as bug #28186: MCS must report this error.]
12552 2002-07-25 Martin Baulig <martin@gnome.org>
12554 * attribute.cs (Attribute.Conditional_GetConditionName): New static
12555 method to pull the condition name ouf of a Conditional attribute.
12556 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
12557 the obsolete message and error flag out of an Obsolete attribute.
12559 * class.cs (Method.GetMethodFlags): New public method to get the
12560 TypeManager.MethodFlags for this method.
12561 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
12563 (Method.Define): Get and apply the Obsolete and Conditional attributes;
12564 if we're overriding a virtual function, set the new private variable
12565 `parent_method'; call the new TypeManager.AddMethod().
12567 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
12568 the MethodBuilder and the Method in a PtrHashtable.
12569 (TypeManager.builder_to_method): Added for this purpose.
12570 (TypeManager.MethodFlags): Added IsObsoleteError.
12571 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
12572 Obsolete and Conditional arguments in MethodBuilders. If we discover
12573 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
12574 the message from the attribute.
12576 2002-07-24 Martin Baulig <martin@gnome.org>
12578 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
12579 preprocessor directives, ensure that the argument to #define/#undef is
12580 exactly one identifier and that it's actually an identifier.
12582 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
12585 2002-07-24 Martin Baulig <martin@gnome.org>
12587 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
12588 initialize it to TypeManager.object_type in the constructor.
12589 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
12590 of the `hm.get_current' method if we're using the collection pattern.
12591 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
12592 for the explicit conversion to make it work when we're using the collection
12593 pattern and the `Current' property has a different return type than `object'.
12596 2002-07-24 Martin Baulig <martin@gnome.org>
12598 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
12599 does not match, but don't report any errors. This method is called in
12600 order for all methods in a MethodGroupExpr until a matching method is
12601 found, so we don't want to bail out if the first method doesn't match.
12602 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
12603 matches, report the 123. Fixes #28070.
12605 2002-07-24 Martin Baulig <martin@gnome.org>
12607 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
12608 TypeManager.TypeToCoreType() to the top of the method so the
12609 following equality checks will work. Fixes #28107.
12611 2002-07-24 Martin Baulig <martin@gnome.org>
12613 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
12614 operand is of type uint, and the other operand is of type sbyte,
12615 short or int, the operands are converted to type long." -
12616 Actually do what this comment already told us. Fixes bug #28106,
12619 2002-07-24 Martin Baulig <martin@gnome.org>
12621 * class.cs (MethodBase): New abstract class. This is now a base
12622 class for Property, Indexer and Event to avoid some code duplication
12623 in their Define() and DefineMethods() methods.
12624 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
12625 generic methods for Define() and DefineMethods().
12626 (FieldBase): Derive from MemberBase, not MemberCore.
12627 (Property): Derive from MemberBase, not MemberCore.
12628 (Property.DefineMethod): Moved all the code from this method to the
12629 new MethodBase.DefineAccessor(), just call it with appropriate
12631 (Property.Define): Call the new Property.DoDefine(), this does some
12632 sanity checks and we don't need to duplicate the code everywhere.
12633 (Event): Derive from MemberBase, not MemberCore.
12634 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
12635 accessors, this will also make them work with interface events.
12636 (Indexer): Derive from MemberBase, not MemberCore.
12637 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
12638 (Indexer.Define): Use the new MethodBase functions.
12640 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
12641 argument to the constructor.
12642 (Interface.FindMembers): Added support for interface events.
12643 (Interface.PopluateEvent): Implemented.
12645 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
12647 2002-07-22 Miguel de Icaza <miguel@ximian.com>
12649 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
12650 but this is required to check for a method name being the same as
12651 the containing class.
12655 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12657 * interface.cs: initialize variable.
12659 2002-07-23 Martin Baulig <martin@gnome.org>
12661 Implemented the IndexerName attribute in interfaces.
12663 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
12664 name if this is an explicit interface implementation.
12665 (Indexer.InterfaceIndexerName): New public variable. If we're
12666 implementing an interface indexer, this is the IndexerName in that
12667 interface. Otherwise, it's the IndexerName.
12668 (Indexer.DefineMethod): If we're implementing interface indexer,
12669 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
12670 and Pending.ImplementIndexer methods.
12671 (Indexer.Define): Also define the PropertyBuilder if we're
12672 implementing an interface indexer and this is neither an explicit
12673 interface implementation nor do the IndexerName match the one in
12676 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
12677 If a method is defined here, then we always need to create a proxy
12678 for it. This is used when implementing interface indexers.
12679 (Pending.IsInterfaceIndexer): New public method.
12680 (Pending.ImplementIndexer): New public method.
12681 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
12682 This is used when implementing interface indexers to define a proxy
12684 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
12685 define a proxy if necessary.
12687 * interface.cs (Interface.IndexerName): New public variable.
12688 (Interface.PopulateIndexer): Set the IndexerName.
12689 (Interface.DefineIndexers): New private method. Populate all the
12690 indexers and make sure their IndexerNames match.
12692 * typemanager.cs (IndexerPropertyName): Added support for interface
12695 2002-07-22 Martin Baulig <martin@gnome.org>
12697 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
12698 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
12699 ret if HasReturnLabel.
12700 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
12703 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
12704 and set the ec.LoopBeginTryCatchLevel.
12705 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
12706 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
12707 the current ec.TryCatchLevel, the branch goes out of an exception
12708 block. In this case, we need to use Leave and not Br.
12710 2002-07-22 Martin Baulig <martin@gnome.org>
12712 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
12713 block unless the block does not always return or it is contained in
12714 another try { ... } catch { ... } block. Fixes bug #26506.
12715 Added verify-1.cs to the test suite.
12717 2002-07-22 Martin Baulig <martin@gnome.org>
12719 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
12720 then we do not always return. Fixes bug #24985.
12722 2002-07-22 Martin Baulig <martin@gnome.org>
12724 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
12725 lookup on a per-class level; ie. walk up the class hierarchy until we
12726 found at least one applicable method, then choose the best among them.
12727 Fixes bug #24463 and test-29.cs.
12729 2002-07-22 Martin Baulig <martin@gnome.org>
12731 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
12732 return types of the methods. The return type is not part of the
12733 signature and we must not check it to make the `new' modifier work.
12734 Fixes bug #27999, also added test-147.cs.
12735 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
12737 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
12738 on the method's return type.
12740 2002-07-21 Martin Baulig <martin@gnome.org>
12742 * assign.cs: Make this work if the rightmost source is a constant and
12743 we need to do an implicit type conversion. Also adding a few more tests
12744 to test-38.cs which should have caught this.
12746 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
12747 target in the makefile for this. The makefile.gnu is primarily intended
12748 for end-users who don't want to debug the compiler.
12750 2002-07-21 Martin Baulig <martin@gnome.org>
12752 * assign.cs: Improved the Assign class so it can now handle embedded
12753 assignments (X = Y = Z = something). As a side-effect this'll now also
12754 consume less local variables. test-38.cs now passes with MCS, added
12755 a few new test cases to that test.
12757 2002-07-20 Martin Baulig <martin@gnome.org>
12759 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
12760 instructions. Fixes bug #27977, also added test-146.cs.
12762 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12764 * cs-tokenizer.cs: fixed getHex ().
12766 2002-07-19 Martin Baulig <martin@gnome.org>
12768 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
12769 not Type.GetType() to lookup the array type. This is needed when
12770 we're constructing an array of a user-defined type.
12771 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
12772 single-dimensional arrays, but also for single-dimensial arrays of
12775 2002-07-19 Martin Baulig <martin@gnome.org>
12777 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
12778 this function is called, it's not allowed to share LocalBuilders
12779 among ILGenerators.
12781 2002-07-19 Martin Baulig <martin@gnome.org>
12783 * expression.cs (Argument.Resolve): Report an error 118 when trying
12784 to pass a type as argument.
12786 2002-07-18 Martin Baulig <martin@gnome.org>
12788 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
12789 Conv_R_Un for the signed `long' type.
12791 2002-07-15 Miguel de Icaza <miguel@ximian.com>
12793 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
12794 `expr' for the temporary result, as that will fail if we do
12795 multiple resolves on the same expression.
12797 2002-07-05 Miguel de Icaza <miguel@ximian.com>
12799 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
12800 ec.TypeContainer for looking up aliases.
12802 * class.cs (TypeContainer): Remove LookupAlias from here.
12804 * decl.cs (DeclSpace); Move here.
12806 2002-07-01 Miguel de Icaza <miguel@ximian.com>
12808 * class.cs (FindMembers): Only call filter if the constructor
12809 bulider is not null.
12811 Also handle delegates in `NestedTypes' now. Now we will perform
12812 type lookups using the standard resolution process. This also
12815 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
12816 This uses Expressions (the limited kind that can be parsed by the
12817 tree) instead of strings.
12819 * expression.cs (ComposedCast.ToString): Implement, used to flag
12820 errors since now we have to render expressions.
12822 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
12825 * ecore.cs (SimpleName.ToString): ditto.
12827 * cs-parser.jay: Instead of using strings to assemble types, use
12828 Expressions to assemble the type (using SimpleName, ComposedCast,
12829 MemberAccess). This should fix the type lookups in declarations,
12830 because we were using a different code path for this.
12832 * statement.cs (Block.Resolve): Continue processing statements
12833 even when there is an error.
12835 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12837 * class.cs (Event.Define): Also remove the `remove' method from
12838 the list of pending items.
12840 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12841 generate more compact code.
12843 2002-07-17 Martin Baulig <martin@gnome.org>
12845 * const.cs (Const.LookupConstantValue): Add support for constant
12846 `unchecked' and `checked' expressions.
12847 Also adding test case test-140.cs for this.
12849 2002-07-17 Martin Baulig <martin@gnome.org>
12851 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12852 check whether mi.ReturnType implements the IEnumerator interface; the
12853 `==' and the IsAssignableFrom() will fail in this situation.
12855 2002-07-16 Ravi Pratap <ravi@ximian.com>
12857 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12860 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12862 * expression.cs: fixed bug #27811.
12864 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12866 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12867 Molaro: when we are a ref, the value already contains a pointer
12868 value, do not take the address of it.
12870 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12871 * removed mb-parser.jay and mb-tokenizer.cs
12873 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12875 * expression.cs: check against the building corlib void type.
12877 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12879 * ecore.cs: fix for valuetype static readonly fields: when
12880 initializing them, we need their address, not the address of a copy.
12882 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12884 * typemanager.cs: register also enum_type in corlib.
12886 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12888 * class.cs: allow calling this (but not base) initializers in structs.
12890 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12892 * ecore.cs: make sure we compare against the building base types
12895 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12897 * typemanager.cs: fix TypeToCoreType() to handle void and object
12898 (corlib gets no more typerefs after this change).
12900 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12902 * expression.cs (ArrayCreation.EmitArrayArguments): use
12903 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12905 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12906 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12907 array indexes, the runtime actually forbids them.
12909 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12910 for array arguments here.
12912 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12913 instead of the default for ValueTypes.
12915 (New.DoEmit): Use IsValueType instead of
12916 IsSubclassOf (value_type)
12917 (New.DoResolve): ditto.
12918 (Invocation.EmitCall): ditto.
12920 * assign.cs (Assign): ditto.
12922 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12923 Statements *are* currently doing part of their resolution during
12926 Expressions do always resolve during resolve, but statements are
12927 only required to propagate resolution to their children.
12929 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12931 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12933 (LoadAssembly): Do not add the dll if it is already specified
12935 (MainDriver): Add the System directory to the link path at the end,
12936 after all the other -L arguments.
12938 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12939 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12940 ldelem.u1) and using the opposite for sbytes.
12942 This fixes Digger, and we can finally run it.
12944 * driver.cs (UnixParseOption): Move the option parsing here.
12945 (CSCParseOption): Implement CSC-like parsing of options.
12947 We now support both modes of operation, the old Unix way, and the
12948 new CSC-like way. This should help those who wanted to make cross
12949 platform makefiles.
12951 The only thing broken is that /r:, /reference: and /lib: are not
12952 implemented, because I want to make those have the same semantics
12953 as the CSC compiler has, and kill once and for all the confussion
12954 around this. Will be doing this tomorrow.
12956 * statement.cs (Unsafe.Resolve): The state is checked during
12957 resolve, not emit, so we have to set the flags for IsUnsfe here.
12959 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12961 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12962 not catch the Error_ObjectRefRequired in SimpleName (as it is
12963 possible to have a class/instance variable name that later gets
12964 deambiguated), we have to check this here.
12966 2002-07-10 Ravi Pratap <ravi@ximian.com>
12968 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12969 make static and put into Expression.
12971 (Event.Define): Register the private field of the event with the
12972 TypeManager so that GetFieldFromEvent can get at it.
12974 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12975 keep track of the private field associated with an event which
12978 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12981 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12983 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12985 * expression.cs (Binary.EmitBranchable): this routine emits the
12986 Binary expression in a branchable context. This basically means:
12987 we need to branch somewhere, not just get the value on the stack.
12989 This works together with Statement.EmitBoolExpression.
12991 * statement.cs (Statement.EmitBoolExpression): Use
12994 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12996 * statement.cs (For): Reduce the number of jumps in loops.
12998 (For): Implement loop inversion for the For statement.
13000 (Break): We can be breaking out of a Try/Catch controlled section
13001 (foreach might have an implicit try/catch clause), so we need to
13002 use Leave instead of Br.
13004 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
13005 now). If the instace expression supports IMemoryLocation, we use
13006 the AddressOf method from the IMemoryLocation to extract the
13007 address instead of emitting the instance.
13009 This showed up with `This', as we were emitting the instance
13010 always (Emit) instead of the Address of This. Particularly
13011 interesting when This is a value type, as we dont want the Emit
13012 effect (which was to load the object).
13014 2002-07-08 Miguel de Icaza <miguel@ximian.com>
13016 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
13018 * statement.cs (Checked): Set the CheckedState during the resolve
13019 process too, as the ConvCast operations track the checked state on
13020 the resolve process, and not emit.
13022 * cs-parser.jay (namespace_member_declaration): Flag that we have
13023 found a declaration when we do. This is used to flag error 1529
13025 * driver.cs: Report ok when we display the help only.
13027 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
13029 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
13031 2002-07-04 Miguel de Icaza <miguel@ximian.com>
13033 * cs-tokenizer.cs (define): We also have to track locally the
13034 defines. AllDefines is just used for the Conditional Attribute,
13035 but we also need the local defines for the current source code.
13037 2002-07-03 Miguel de Icaza <miguel@ximian.com>
13039 * statement.cs (While, For, Do): These loops can exit through a
13040 Break statement, use this information to tell whether the
13041 statement is the last piece of code.
13043 (Break): Flag that we break.
13045 * codegen.cs (EmitContexts): New `Breaks' state variable.
13047 2002-07-03 Martin Baulig <martin@gnome.org>
13049 * class.cs (TypeContainer.MethodModifiersValid): Allow override
13050 modifiers in method declarations in structs. Otherwise, you won't
13051 be able to override things like Object.Equals().
13053 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13055 * class.cs (Method, Property, Indexer): Do not allow the public
13056 modifier to be used in explicit interface implementations.
13058 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
13059 override modifiers in method declarations in structs
13061 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
13063 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
13064 integer or real overflow, report an error
13066 2002-07-02 Martin Baulig <martin@gnome.org>
13068 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
13069 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
13070 to tell the runtime about our newly created System.Object and
13071 System.ValueType types.
13073 2002-07-02 Miguel de Icaza <miguel@ximian.com>
13075 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
13076 struct instead of Ldarg/Starg.
13078 2002-07-02 Martin Baulig <martin@gnome.org>
13080 * expression.cs (Indirection.Indirection): Call
13081 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
13083 2002-07-02 Martin Baulig <martin@gnome.org>
13085 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
13086 ValueType, call TypeManager.TypeToCoreType() on it.
13087 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
13088 the OpCodes.Newarr argument.
13090 2002-07-02 Martin Baulig <martin@gnome.org>
13092 * expression.cs (Invocation.EmitCall): When compiling corlib,
13093 replace all calls to the system's System.Array type to calls to
13094 the newly created one.
13096 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
13097 System.Array methods.
13098 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
13099 from the system's System.Array type which must be replaced.
13101 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
13103 * typemanager.cs: load unverifiable_code_ctor so we can build
13104 corlib using the correct type. Avoid using GetTypeCode() with
13106 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
13107 TypeManager.object_type to allow building corlib.
13109 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
13111 * ecore.cs: handle System.Enum separately in LoadFromPtr().
13113 2002-07-01 Martin Baulig <martin@gnome.org>
13115 * class.cs: Make the last change actually work, we need to check
13116 whether `ifaces != null' to avoid a crash.
13118 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
13120 * class.cs: when we build structs without fields that implement
13121 interfaces, we need to add the interfaces separately, since there is
13122 no API to both set the size and add the interfaces at type creation
13125 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
13127 * expression.cs: the dimension arguments to the array constructors
13128 need to be converted if they are a long.
13130 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
13132 * class.cs: don't emit ldarg.0 if there is no parent constructor
13133 (fixes showstopper for corlib).
13135 2002-06-29 Martin Baulig <martin@gnome.org>
13137 MCS now compiles corlib on GNU/Linux :-)
13139 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
13140 ie. check for MethodImplOptions.InternalCall.
13142 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
13143 and TypeManager.attribute_type are null, so we must explicitly check
13144 whether parent is not null to find out whether it's an attribute type.
13145 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
13146 and SetBuilder, not only if the property is neither abstract nor external.
13147 This is necessary to set the MethodImplOptions on the accessor methods.
13148 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
13149 SetBuilder, see Property.Emit().
13151 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
13152 populate "System.Object", "System.ValueType" and "System.Attribute" since
13153 they've already been populated from BootCorlib_PopulateCoreTypes().
13155 2002-06-29 Martin Baulig <martin@gnome.org>
13157 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
13158 is the NullLiteral, we also need to make sure that target_type is not
13161 2002-06-29 Martin Baulig <martin@gnome.org>
13163 * rootcontext.cs (RootContext.ResolveCore): We must initialize
13164 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
13165 before calling BootstrapCorlib_ResolveDelegate ().
13167 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13169 * statement.cs: fixed build-breaker. All tests passed ok.
13171 2002-06-27 Martin Baulig <martin@gnome.org>
13173 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
13174 for System.Decimal when compiling corlib.
13176 2002-06-27 Martin Baulig <martin@gnome.org>
13178 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
13179 switch blocks which contain nothing but a default clause.
13181 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
13183 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
13185 2002-06-27 Martin Baulig <martin@gnome.org>
13187 * ecore.cs (PropertyExpr.PropertyExpr): Call
13188 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
13190 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
13191 is already a TypeBuilder.
13193 2002-06-27 Martin Baulig <martin@gnome.org>
13195 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
13196 `target_type == TypeManager.array_type', not IsAssignableFrom() in
13197 the "from an array-type to System.Array" case. This makes it work
13198 when compiling corlib.
13200 2002-06-27 Martin Baulig <martin@gnome.org>
13202 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
13203 non-static PropertyExpr, set its InstanceExpression. This makes
13204 the `ICollection.Count' property work in System/Array.cs.
13206 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
13208 * driver.cs: Made error handling more consistent. Errors now
13209 tracked by Report class, so many methods which used to return int
13210 now return void. Main() now prints success/failure and
13211 errors/warnings message.
13213 Renamed '--probe' compiler argument to '--expect-error'. Removed
13214 the magic number return values (123 and 124). Now, if the
13215 expected error occurs, the compiler exits with success (exit value
13216 0). If the compilation completes without seeing that particular
13217 error, the compiler exits with failure (exit value 1). The
13218 makefile in mcs/errors has been changed to handle the new behaviour.
13220 * report.cs: Made 'expected error' number a property and renamed
13221 it from 'Probe' to 'ExpectedError'.
13223 * genericparser.cs: Removed error handling support, since it is
13224 now all done by Report class.
13226 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
13227 class, so parse() no longer returns an int.
13229 * namespace.cs: Use Report.Error instead of GenericParser.error
13231 2002-06-22 Miguel de Icaza <miguel@ximian.com>
13233 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
13234 TypeContainer.AddOperator): At the front of the list put the
13235 explicit implementations, so they get resolved/defined first.
13237 2002-06-21 Miguel de Icaza <miguel@ximian.com>
13239 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
13240 interface type is implemented by this TypeContainer. Used during
13241 explicit interface implementation.
13243 (Property.Define, Indexer.Define, Method.Define): Validate that
13244 the given interface in the explicit implementation is one of the
13245 base classes for the containing type.
13247 Also if we are explicitly implementing an interface, but there is
13248 no match in the pending implementation table, report an error.
13250 (Property.Define): Only define the property if we are
13251 not explicitly implementing a property from an interface. Use the
13252 correct name also for those properties (the same CSC uses,
13253 although that is really not needed).
13255 (Property.Emit): Do not emit attributes for explicitly implemented
13256 properties, as there is no TypeBuilder.
13258 (Indexer.Emit): ditto.
13260 Hiding then means that we do not really *implement* a pending
13261 implementation, which makes code fail.
13263 2002-06-22 Martin Baulig <martin@gnome.org>
13265 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
13266 the return value of Object.GetType(). [FIXME: we need to do this whenever
13267 we get a type back from the reflection library].
13269 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
13271 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
13273 2002-06-20 Miguel de Icaza <miguel@ximian.com>
13275 * attribute.cs: Return null if we can not look up the type.
13277 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
13278 the interface types found.
13280 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
13281 interface types found.
13283 * typemanager.cs (GetInterfaces): Make this routine returns alll
13284 the interfaces and work around the lame differences between
13285 System.Type and System.Reflection.Emit.TypeBuilder in the results
13286 result for GetInterfaces.
13288 (ExpandInterfaces): Given an array of interface types, expand and
13289 eliminate repeated ocurrences of an interface. This expands in
13290 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
13293 2002-06-21 Martin Baulig <martin@gnome.org>
13295 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
13298 2002-06-21 Martin Baulig <martin@gnome.org>
13300 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
13301 and called with one of the core types, return the corresponding typebuilder for
13304 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
13307 2002-06-21 Martin Baulig <martin@gnome.org>
13309 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
13310 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
13311 (Expression.ConvertReferenceExplicit): Likewise.
13313 * expression.cs (ElementAccess.DoResolve): Likewise.
13314 (ElementAccess.DoResolveLValue): Likewise.
13316 2002-06-10 Martin Baulig <martin@gnome.org>
13318 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
13319 add the "value" parameter to the parameter list.
13321 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
13324 2002-06-19 Miguel de Icaza <miguel@ximian.com>
13326 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
13327 the argument to an int, uint, long or ulong, per the spec. Also
13328 catch negative constants in array creation.
13330 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
13332 * class.cs: do not allow the same interface to appear twice in
13333 the definition list.
13335 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
13337 * ecore.cs: don't use ldlen with System.Array.
13339 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
13341 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
13343 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
13345 * modifiers.cs: produce correct field attributes for protected
13346 internal. Easy fix so miguel can work on ther harder stuff:-)
13348 2002-06-18 Miguel de Icaza <miguel@ximian.com>
13350 * pending.cs: New file. Move the code from class.cs here.
13351 Support clearning the pending flag for all methods (when not doing
13352 explicit interface implementation).
13354 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
13356 * rootcontext.cs: added a couple more types needed to bootstrap.
13358 2002-06-17 Miguel de Icaza <miguel@ximian.com>
13360 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
13361 constructor in the type, instead of any constructor in the type
13362 hierarchy. Thanks to Paolo for finding this bug (it showed up as
13363 a bug in the Mono runtime when applying the params attribute).
13365 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
13366 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
13368 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
13370 * expression.cs (Unary.ResolveOperator): Use TypeManager
13371 to resolve the type.
13373 2002-06-13 Ravi Pratap <ravi@ximian.com>
13375 * cs-parser.jay (enum_member_declaration): Pass in the attributes
13378 * enum.cs (AddEnumMember): Add support to store the attributes associated
13379 with each member too.
13381 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
13382 field builders too - this takes care of the enum member case.
13384 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
13386 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
13387 address-of operator on both value types and pointers.
13389 2002-06-10 Martin Baulig <martin@gnome.org>
13391 * interface.cs (Interface.PopulateIndexer): Add the indexer's
13392 PropertyBuilder to the `property_builders' list.
13394 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
13395 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
13396 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
13397 find any indexers which are inherited from an interface.
13399 2002-06-09 Martin Baulig <martin@gnome.org>
13401 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
13402 the same type as the constant if necessary. There's also a test-130.cs
13405 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
13407 * typemanager.cs (TypeManager.ChangeType): Previously known as
13408 Enum.ChangeEnumType().
13410 2002-06-09 Martin Baulig <martin@gnome.org>
13412 * expression.cs (Cast.TryReduce): Added support for consts.
13414 2002-06-08 Ravi Pratap <ravi@ximian.com>
13416 * class.cs (Accessor): Hold attributes information so we can pass
13419 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
13420 Modify to pass in attributes attached to the methods.
13422 (add_accessor_declaration, remove_accessor_declaration): Ditto.
13424 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
13425 to handle the Accessor kind :-)
13427 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
13429 2002-06-08 Martin Baulig <martin@gnome.org>
13431 * expression.cs (Unary.TryReduceNegative): Added support for
13434 2002-06-08 Martin Baulig <martin@gnome.org>
13436 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
13437 name can't be found in the `defined_names' - the caller will do a
13438 MemberLookup in this case and thus find methods in System.Enum
13439 such as Enum.IsDefined().
13441 2002-06-08 Martin Baulig <martin@gnome.org>
13443 * enum.cs (Enum.ChangeEnumType): This is a custom version of
13444 Convert.ChangeType() which works with TypeBuilder created types.
13445 (Enum.LookupEnumValue, Enum.Define): Use it here.
13447 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
13448 `TypeBuilder.BaseType != null' check.
13449 (TypeContainer.FindMembers): Only lookup parent members if we
13450 actually have a parent.
13451 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
13452 (ConstructorInitializer.Resolve): Likewise.
13454 * interface.cs (Interface.FindMembers): Added
13455 `TypeBuilder.BaseType != null' check.
13457 * rootcontext.cs (RootContext.ResolveCore): Added
13458 "System.Runtime.CompilerServices.IndexerNameAttribute" to
13459 classes_second_stage.
13461 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
13462 debug_type and trace_type when compiling with --nostdlib.
13464 2002-06-07 Martin Baulig <martin@gnome.org>
13466 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
13467 (AddField): Set it to true when adding a non-static field.
13468 (DefineType): Use `have_nonstatic_fields' to find out whether we
13469 have non-static fields, not `Fields != null'.
13471 2002-06-02 Miguel de Icaza <miguel@ximian.com>
13473 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
13474 dereferencing a null on the static-field code path)
13476 2002-05-30 Martin Baulig <martin@gnome.org>
13478 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
13479 to take command line arguments. Use reflection to call the new
13480 custom `Initialize' function on the symbol writer and pass it the
13481 command line arguments.
13483 * driver.cs (--debug-args): New command line argument to pass command
13484 line arguments to the symbol writer.
13486 2002-05-28 Miguel de Icaza <miguel@ximian.com>
13488 * assign.cs (DoResolve): Forgot to do the implicit conversion to
13489 the target type for indexers and properties. Thanks to Joe for
13492 2002-05-27 Miguel de Icaza <miguel@ximian.com>
13494 * typemanager.cs (MethodFlags): returns the method flags
13495 (Obsolete/ShouldIgnore) that control warning emission and whether
13496 the invocation should be made, or ignored.
13498 * expression.cs (Invocation.Emit): Remove previous hack, we should
13499 not do this on matching a base type, we should do this based on an attribute
13501 Only emit calls to System.Diagnostics.Debug and
13502 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
13503 on the command line.
13505 * rootcontext.cs: Global settings for tracing and debugging.
13507 * cs-tokenizer.cs (define): New utility function to track
13508 defines. Set the global settings for TRACE and DEBUG if found.
13510 2002-05-25 Ravi Pratap <ravi@ximian.com>
13512 * interface.cs (Populate*): Pass in the TypeContainer as well as
13513 the DeclSpace as parameters so that we can create EmitContexts and
13514 then use that to apply attributes etc.
13516 (PopulateMethod, PopulateEvent, PopulateProperty)
13517 (PopulateIndexer): Apply attributes everywhere.
13519 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
13522 (ApplyAttributes): Update accordingly.
13524 We now apply interface attributes for all members too.
13526 2002-05-26 Miguel de Icaza <miguel@ximian.com>
13528 * class.cs (Indexer.Define); Correctly check if we are explicit
13529 implementation (instead of checking the Name for a ".", we
13530 directly look up if the InterfaceType was specified).
13532 Delay the creation of the PropertyBuilder.
13534 Only create the PropertyBuilder if we are not an explicit
13535 interface implementation. This means that explicit interface
13536 implementation members do not participate in regular function
13537 lookups, and hence fixes another major ambiguity problem in
13538 overload resolution (that was the visible effect).
13540 (DefineMethod): Return whether we are doing an interface
13543 * typemanager.cs: Temporary hack until we get attributes in
13544 interfaces (Ravi is working on that) and we get IndexerName
13545 support in interfaces.
13547 * interface.cs: Register the indexers as properties.
13549 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
13550 warning, I have verified that this is a bug in the .NET runtime
13551 (JavaScript suffers of the same problem).
13553 * typemanager.cs (MemberLookup): When looking up members for
13554 interfaces, the parent of an interface is the implicit
13555 System.Object (so we succeed in searches of Object methods in an
13556 interface method invocation. Example: IEnumerable x; x.ToString
13559 2002-05-25 Miguel de Icaza <miguel@ximian.com>
13561 * class.cs (Event): Events should also register if they do
13562 implement the methods that an interface requires.
13564 * typemanager.cs (MemberLookup); use the new GetInterfaces
13567 (GetInterfaces): The code used to lookup interfaces for a type is
13568 used in more than one place, factor it here.
13570 * driver.cs: Track the errors at the bottom of the file, we kept
13573 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
13574 instance if the method we are calling is static!
13576 2002-05-24 Miguel de Icaza <miguel@ximian.com>
13578 * attribute.cs (ApplyAttributes): Make this function filter out
13579 the IndexerName attribute (as that attribute in reality is never
13580 applied) and return the string constant for the IndexerName
13583 * class.cs (TypeContainer.Emit): Validate that all the indexers
13584 have the same IndexerName attribute, and if so, set the
13585 DefaultName attribute on the class.
13587 * typemanager.cs: The return value might contain other stuff (not
13588 only methods). For instance, consider a method with an "Item"
13589 property and an Item method.
13591 * class.cs: If there is a problem with the parameter types,
13594 2002-05-24 Ravi Pratap <ravi@ximian.com>
13596 * ecore.cs (ImplicitConversionExists): Wrapper function which also
13597 looks at user defined conversion after making a call to
13598 StandardConversionExists - we need this for overload resolution.
13600 * expression.cs : Update accordingly the various method calls.
13602 This fixes 2 bugs filed against implicit user defined conversions
13604 2002-05-22 Miguel de Icaza <miguel@ximian.com>
13606 * statement.cs: Track the result of the assignment.
13608 2002-05-21 Miguel de Icaza <miguel@ximian.com>
13610 * expression.cs (MemberAccess): Improved error reporting for
13611 inaccessible members.
13613 2002-05-22 Martin Baulig <martin@gnome.org>
13615 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
13616 itself with debugging support.
13618 2002-05-22 Martin Baulig <martin@gnome.org>
13620 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
13621 Removed, this isn't needed anymore.
13623 2002-05-20 Martin Baulig <martin@gnome.org>
13625 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
13626 be underlying type for an enum.
13628 2002-05-20 Miguel de Icaza <miguel@ximian.com>
13630 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
13631 that splits out the loading of just the core types.
13633 * rootcontext.cs (ResolveCore): Split the struct resolution in
13634 two, so we can load the enumeration underlying types before any
13637 * expression.cs (Is): Bandaid until we fix properly Switch (see
13638 bug #24985 for details).
13640 * typemanager.cs (ImplementsInterface): The hashtable will contain
13641 a null if there are no interfaces implemented.
13643 2002-05-18 Miguel de Icaza <miguel@ximian.com>
13645 * cs-parser.jay (indexer_declarator): It is fine to have array
13648 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13650 * typemanager.cs: (RegisterBuilder): New function used to register
13651 TypeBuilders that implement interfaces. Since
13652 TypeBuilder.GetInterfaces (as usual) does not work with lame
13654 (AddUserType): register interfaces.
13656 (ImplementsInterface): Use the builder_to_ifaces hash if we are
13657 dealing with TypeBuilder. Also, arrays are showing up as
13658 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
13659 methods can not be invoked on them!
13661 * ecore.cs (ExplicitReferenceConversionExists): Made public.
13662 (ImplicitReferenceConversionExists): Split out from
13663 StandardConversionExists.
13665 * expression.cs (As): We were only implementing one of the three
13666 cases for the as operator. We now implement them all.
13667 (Is): Implement the various other cases for Is as well.
13669 * typemanager.cs (CACHE): New define used to control if we want or
13670 not the FindMembers cache. Seems to have a negative impact on
13671 performance currently
13673 (MemberLookup): Nested types have full acess to
13674 enclosing type members
13676 Remove code that coped with instance/static returns for events, we
13677 now catch this in RealFindMembers.
13679 (RealFindMembers): only perform static lookup if the instance
13680 lookup did not return a type or an event.
13682 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13684 * assign.cs (CompoundAssign): We pass more semantic information
13685 now to Compound Assignments than we did before: now we have all
13686 the information at hand, and now we resolve the target *before* we
13687 do the expression expansion, which allows the "CacheValue" method
13688 to have the effect we intended (before, a [x] += 1 would generate
13689 two differen ArrayAccess expressions from the ElementAccess,
13690 during the resolution process).
13692 (CompoundAssign.DoResolve): Resolve target and original_source here.
13694 2002-05-16 Miguel de Icaza <miguel@ximian.com>
13696 * expression.cs (ArrayAccess): dropped debugging information.
13698 * typemanager.cs: Small bug fix: I was always returning i_members,
13699 instead of one of i_members or s_members (depending on which had
13702 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
13703 method is invoked before any code generation takes place, and it
13704 is a mechanism to inform that the expression will be invoked more
13705 than once, and that the method should use temporary values to
13706 avoid having side effects
13708 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
13710 * ecore.cs (Expression.CacheTemporaries): Provide empty default
13713 * expression.cs (Indirection, ArrayAccess): Add support for
13714 CacheTemporaries in these two bad boys.
13716 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
13717 ldobj or ldind_ref.
13718 (StoreFromPtr): Handle stobj as well.
13720 * expression.cs (UnaryMutator): Share more code.
13722 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
13723 down: I was not tracking the Filter function as well, which
13724 was affecting the results of the cache.
13726 2002-05-15 Miguel de Icaza <miguel@ximian.com>
13728 * attribute.cs: Remove the hack to handle the CharSet property on
13731 2002-05-14 Miguel de Icaza <miguel@ximian.com>
13733 * attribute.cs (DoResolve): More uglyness, we now only try to
13734 resolve the attribute partially, to extract the CharSet
13735 information (only if we are a StructLayout attribute). Otherwise
13737 (GetExtraTypeInfo): Add some code to conditionally kill in the
13738 future this. I am more and more convinced that the .NET
13739 framework has special code to handle the attribute setting on
13742 * expression.cs (IsParamsMethodApplicable): Revert my previous
13743 foreach change here, it was wrong.
13745 2002-05-13 Miguel de Icaza <miguel@ximian.com>
13747 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
13748 (pp_expr): do not abort on unknown input, just return.
13749 (eval): abort if there are pending chars.
13751 * attribute.cs (Attribute.Resolve): Positional parameters are
13752 optional. Deal with that case.
13754 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
13755 the Ansi/Unicode/Auto information for the type.
13757 (TypeContainer.DefineType): instantiate the EmitContext here, as
13758 we will be using it during the type definition (to resolve
13759 attributes) and during the emit phase.
13761 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
13762 to pull type information out of the attributes
13764 (Attribute.Resolve): track the constructor builder, and allow for
13765 multiple invocations (structs and classes will use this).
13767 * ecore.cs (MemberLookupFinal): new version with all the
13768 parameters customizable.
13770 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
13771 constructors. Return if the result value is null (as the error
13772 would have been flagged already by MemberLookupFinal)
13774 Do not allow instances of abstract classes or interfaces to be
13777 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
13778 We have to compare the assembly property here when dealing with
13779 FamANDAssem and Assembly access modifiers, because we might be
13780 creating an assembly from *modules* (that means that we are not
13781 getting TypeBuilders for types defined in other modules that are
13782 part of this assembly).
13784 (Method.Emit): If the method is marked abstract and has a body,
13787 (TypeContainer.DefineMembers): If both the defined member and the
13788 parent name match are methods, then do not emit any warnings: let
13789 the Method.Define routine take care of flagging warnings. But if
13790 there is a mismatch (method overrides something else, or method is
13791 overriwritten by something, then emit warning).
13793 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
13794 set to null, this means `do not check for the return type on the
13797 (Method.Define): set the return type for the method signature to
13798 null, so that we get methods with the same name and parameters and
13799 different return types. This is used to flag warning 114 (you are
13800 hiding a method, and you probably want to use the new/override
13803 * typemanager.cs (MemberLookup): Implemented proper access
13804 control, closing a long standing set of bug reports. The problem
13805 was that the Framework only has two bits: Public and NonPublic,
13806 and NonPublic includes private and protected methods, but we need
13807 to enforce the FamANDAssem, FamOrAssem and Family.
13809 2002-05-11 Miguel de Icaza <miguel@ximian.com>
13811 * statement.cs (GotoCase): Return true: Ammounts to giving up
13812 knowledge on whether we return or not, and letting the other case
13813 be responsible for it.
13815 2002-05-10 Miguel de Icaza <miguel@ximian.com>
13817 * driver.cs: Do not load directories for each file processed, only
13818 do it if there is a pattern.
13820 * ecore.cs: Report readonly assigns here as well, as we might have
13821 been resolved only by MemberAccess.
13823 (SimpleName.SimpleNameResolve): Also be useful for LValue
13824 resolution. We need this to propagate assign to local readonly variables
13826 * typemanager.cs: Use a ptrhashtable for the criteria, because we
13827 do not want to reuse potential criteria memory.
13829 * class.cs (MyEventBuilder): Set reflected_type;
13831 * ecore.cs (Constantify): Added support for constifying bools.
13833 (RootContext.LookupType): Added a cache for values looked up in
13834 the declaration space.
13836 * typemanager.cs (FindMembers): Now is a front-end to
13837 RealFindMembers, and provides a two-level hashtable-based cache to
13840 15% performance improvement: from 22.5 to 19.2 seconds.
13842 * expression.cs (IsParamsMethodApplicable): use foreach.
13843 (Invocation.DoResolve): ditto.
13844 (New.DoResolve): ditto.
13845 (ArrayCreation.DoResolve): ditto.
13847 * ecore.cs (FindMostEncompassingType): use foreach.
13849 * delegate.cs (NewDelegate.DoResolve): Use foreach
13851 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13852 (RemoveMethods): use foreach.
13854 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13855 nested foreach statements instead of for, and also break out of
13856 the inner loop once a match is found.
13858 (Invocation.OverloadResolve): Use foreach, simplify the code.
13860 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13862 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13863 we actually unwrap the expression to allow for extra information
13866 * expression.cs: Use Shr_Un on unsigned operations.
13868 2002-05-08 Ravi Pratap <ravi@ximian.com>
13870 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13871 applicable operators was not being considered correctly. This closes
13872 the bug Miguel reported.
13874 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13876 * attribute.cs: check that the type derives from System.Attribute
13877 and report the correct error in that case (moved the duplicate code to
13878 its own method, too).
13880 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13882 * attribute.cs: lookup attribute type name as the spec says: first the
13883 bare attribute name and then name + "Attribute" (nant compiles with
13884 mcs after this fix).
13886 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13888 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13889 Because of the way we parse things, we should try to see if a
13890 UIntConstant can fit in an integer.
13892 2002-05-07 Ravi Pratap <ravi@ximian.com>
13894 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13895 when we are in an explicit context.
13897 (ConvertReferenceExplicit): When converting from Iface type S to Class
13898 T make sure the rules are implemented as an OR.
13900 * parameter.cs (ParameterType): Make it a property for now although the
13901 purpose really isn't anything immediate.
13903 * expression.cs (Is*Applicable): Do better checking on the parameter type
13904 of a ref/out parameter. The ones from the system assemblies are already
13905 marked with the correct type so we don't need to do any correction.
13907 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13908 the object type is standard too so include that.
13910 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13912 * ecore.cs (StandardConversionExists): Augment with missing code:
13913 deal with IntConstant, LongConstants and Enumerations.
13915 * assign.cs: Report the error, instead of failing silently
13917 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13918 typecontainer that they are declared, because the
13919 typecontainer/namespace will have the list of using clauses that
13920 need to be applied.
13922 Assembly Attributes were escaping the normal registration
13925 (EmitCode): Apply attributes within an EmitContext that represents
13926 the container they were declared on.
13928 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13930 2002-05-06 Ravi Pratap <ravi@ximian.com>
13932 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13933 Revamp completely - make much cleaner as we now operate only
13936 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13937 to implement the logic detailed in the spec more correctly.
13939 (UserDefinedConversion): Update accordingly.
13941 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13943 * statement.cs: Return flow analysis information up.
13945 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13948 (token): Do not consume an extra character before calling
13951 2002-05-06 Piers Haken <piersh@friskit.com>
13953 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13955 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13957 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13958 EmitContext during the instance constructor initializer
13959 resolution, to stop access to instance variables.
13961 This is mandated by the spec, last paragraph of the `constructor
13962 initializers' section.
13964 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13966 * cs-parser.jay, class.cs (Accessor): new class used to represent
13967 an accessor (get or set). In the past we used `null' to represent
13968 a missing accessor. But this is ambiguous because there was no
13969 way to tell in abstract indexers/properties if one of them was
13972 Now there is a way of addressing that.
13974 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13975 instead of FindMembers.
13977 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13978 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13980 * attribute.cs: Treat indexers and properties as the same in terms
13981 of applying attributes
13983 * ecore.cs (FindMostEncompassedType): Use statically initialized
13984 EmptyExpressions()s like we do elsewhere to avoid creating useless
13985 objects (and we take this out of the tight loop).
13987 (GetConversionOperators): Move the code to extract the actual
13988 operators to a separate routine to clean things up.
13990 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13992 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13993 events are always registered FieldBuilders.
13995 * class.cs (FieldBase): New class shared by Fields
13997 * delegate.cs: If we are a toplevel delegate, use our full name.
13998 If we are a nested delegate, then only use our tail name.
14000 2002-05-02 Ravi Pratap <ravi@ximian.com>
14002 * expression.cs (IsApplicable): Ensure that we add the "&" to
14003 ref/out types before comparing it with the type of the argument.
14005 (IsParamsMethodApplicable): Ditto.
14007 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
14010 * delegate.cs : Handle the case when we have more than one applicable
14011 method. Flag an error only when we finish checking all.
14013 2002-05-02 Miguel de Icaza <miguel@ximian.com>
14015 * expression.cs: Add support for boolean static initializers.
14017 2002-05-01 Miguel de Icaza <miguel@ximian.com>
14019 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
14021 * parameter.cs (ComputeParameterTypes,
14022 ComputeAndDefineParameterTypes): Better error handling: now we
14023 clear the `types' cache if we fail during any of the type lookups.
14024 We also return the status code correctly to our caller
14026 * delegate.cs: If we fail to define a delegate, abort the extra
14029 * expression.cs (Binary.ResolveOperator): for
14030 operator==(object,object) and operator !=(object, object) we also
14031 have to verify that there is an implicit conversion from one to
14034 (ArrayAccess.DoResolve): Array Access can operate on
14037 2002-04-30 Miguel de Icaza <miguel@ximian.com>
14039 * assign.cs (CompoundAssign): A new class used as a "flag" that
14040 the assignment actually is happening as part of a compound
14041 assignment operator.
14043 During compound assignment, a few new rules exist to enable things
14050 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
14051 to the type of x) if y is implicitly convertible to the type of x,
14052 and the operator is a builtin operator and the return type of the
14053 operator is explicitly convertible to the type of x.
14055 * rootcontext.cs: Reset warning level to 2. 4 catches various
14056 "interesting" features in mcs, we must clean this up at some
14057 point, but currently am trying to kill other bugs ;-)
14059 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
14060 in container classes as well.
14062 * expression.cs (Binary.ResolveOperator): Handle string case
14063 before anything else (as operator overloading does emit an error
14064 before doing anything else).
14066 This code could go away when we move to a table driven model, but
14067 i could not come up with a good plan last night.
14069 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
14071 * typemanager.cs (CSharpName): reimplementation using regex.
14072 * class.cs: added null check for fields in Emit
14073 * rootcontext.cs: set warninglevel to 4
14075 2002-04-29 Miguel de Icaza <miguel@ximian.com>
14077 * typemanager.cs (CSharpName): reimplemented with Lupus
14080 2002-04-28 Miguel de Icaza <miguel@ximian.com>
14082 * statement.cs (If): correclty implement Resolve, because we were
14083 not catching sem errors in there. The same process is needed
14085 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
14088 (Statement.Warning_DeadCodeFound): Factorize code.
14089 (While): Report dead code here too.
14091 (Statement): Added Resolve virtual method to allow
14092 for resolution split from the emit code.
14094 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14096 * statement.cs (EmitBoolExpression): No longer try to resolve the
14098 (MakeBoolean): New utility function that resolve, implicitly
14099 converts to boolean and tags the expression.
14102 (If, Do): Implement dead code elimination.
14103 (While): Implement loop inversion
14105 (Do, While, For, If): Resolve the expression prior to calling our
14108 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
14111 - added method Report28 (warning: program has more than one entry point)
14112 - added method IsEntryPoint, implements paragraph 10.1 of the spec
14113 - modified method Method.Define, the part at the end of the method
14115 * rootcontext.cs: added static public Location EntryPointLocation;
14117 * ../errors/cs0028.cs : Add test case for the above warning.
14120 - modified method CSharpName to allow arrays of primitive type to
14121 be printed nicely (e.g. instead of System.Int32[][] it now prints
14123 - added method CSharpSignature: returns the signature of a method
14124 in string format to be used in reporting errors, warnings, etc.
14126 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
14129 2002-04-26 Ravi Pratap <ravi@ximian.com>
14131 * delegate.cs (Define): Fix extremely silly bug where I was
14132 setting the type of the 'object' parameter of the BeginInvoke
14133 method to System.IAsyncResult instead of System.Object ;-)
14135 2002-04-26 Miguel de Icaza <miguel@ximian.com>
14137 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
14140 (Constructor.Emit): return if we fail to initialize the
14141 constructor. Another door closed!
14143 * expression.cs (New.DoResolve): Improve error message (from -6 to
14144 1501). Use DeclaredOnly lookup to find the exact constructor.
14146 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
14147 loop. This is useful.
14149 * cs-parser.jay: Adjust the default parameters so that destructors
14150 have the proper signature.
14152 2002-04-26 Martin Baulig <martin@gnome.org>
14154 * driver.cs (LoadAssembly): If `assembly' contains any characters
14155 which are only valid in path names and not in assembly names
14156 (currently slash, backslash and point), use Assembly.LoadFrom ()
14157 instead of Assembly.Load () on the `assembly' (before iteration
14158 over the link_paths).
14160 2002-04-26 Martin Baulig <martin@gnome.org>
14162 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
14164 2002-04-25 Miguel de Icaza <miguel@ximian.com>
14166 * class.cs (Property): use the new typemanager.MemberLookup
14168 (TypeContainer.MemberLookup): Implement using the
14169 TypeManager.MemberLookup now.
14171 * typemanager.cs: Make MemberLookup a function of the TypeManager,
14172 and return MemberInfos, so that these can be used without an
14173 EmitContext (what we had before).
14175 2002-04-24 Miguel de Icaza <miguel@ximian.com>
14177 * expression.cs: Fix the case where the argument to params if the
14178 type of the params. I omitted handling this before. Fixed
14180 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14182 * driver.cs: Call BootCorlib_PopulateCoreType
14184 * class.cs (Property.CheckBase): Check for properties only, not
14187 * interface.cs: Temporary hack: try/catch around the
14188 CustomAttributeBuilder, because I am getting an exception that I
14191 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
14192 types whose definitions are required to be there (attributes are
14193 defined before standard types).
14195 Compute definitions as we boot the various types, as they are used
14196 immediately (value_type class will need object_type, but if we do
14197 not initialize object_type, we will pass a null, which will let
14198 the runtime pick the System.Object from the existing corlib, which
14199 is not what we want).
14201 2002-04-22 Patrik Torstensson <totte@labs2.com>
14203 * cs-tokenizer.cs: fixed a number of trim() issues.
14205 2002-04-22 Ravi Pratap <ravi@ximian.com>
14207 * expression.cs (Argument.Type): Ensure that we return the correct
14208 type when we have out or ref parameters [in which case we
14211 2002-04-22 Miguel de Icaza <miguel@ximian.com>
14213 * class.cs (Property, Indexer): Allow extern modifier in there.
14215 * typemanager.cs (InitBaseTypes): Initializes object_type and
14216 value_type, since those will be used early on during the bootstrap
14217 process to compile corlib.
14219 (InitCoreTypes): Move code from here to InitBaseTypes.
14221 2002-04-21 Miguel de Icaza <miguel@ximian.com>
14223 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
14224 single-dimension arrays as using the ldlen opcode.
14226 Daniel Lewis discovered this optimization.
14228 * typemanager.cs: Add signature for System.Array::get_Length
14230 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14232 * statement.cs: report the error when the foreach does not apply to an
14233 array nor a collection.
14235 2002-04-19 Miguel de Icaza <miguel@ximian.com>
14237 * expression.cs: Add implicit conversions to the operator ~.
14239 * constant.cs (DecimalConstant.Emit): Emit decimal value.
14241 * typemanager.cs: Locate the decimal constructor.
14243 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14245 * attribute.cs: use the new property of TypeOf.
14246 * expression.cs: added 'get' property around typearg.
14248 These changes fix a build breaker reported by NickD. Is this the
14249 correct way to fix? If not, please, revert my changes and make it
14252 2002-04-17 Miguel de Icaza <miguel@ximian.com>
14254 * attribute.cs: Add support for typeof in attribute invocations.
14255 I am not sure that this is right though.
14257 2002-04-14 Duncan Mak <duncan@ximian.com>
14259 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
14260 Binary.Operator.Division case.
14262 2002-04-13 Ravi Pratap <ravi@ximian.com>
14264 * class.cs (DefineType): Ensure that we do a proper check on
14265 attribute types and also register it with the TypeManager.
14267 (TypeContainer.Targets): The default for attribute types is
14268 AttributeTargets.All.
14270 * attribute.cs (ApplyAttributes): Registering the attribute type
14271 is done elsewhere, not when we discover we have a Usage attribute.
14273 2002-04-12 Ravi Pratap <ravi@ximian.com>
14275 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
14276 and get rid of is_delegate parameter.
14278 * everywhere : update.
14280 2002-04-12 Ravi Pratap <ravi@ximian.com>
14282 * cs-parser.jay (compilation_unit): Revamp completely to use
14283 some new ideas that I got from Rhys' grammar to solve the problems
14284 with assembly level attributes.
14286 (outer_declaration): New grammar production.
14288 (attribute_sections): Add.
14290 (opt_attributes): Base on attribute_sections
14292 (namespace_declaration): Allow opt_attributes to tackle the case
14293 when we have assembly level attributes - we are clever in this
14296 * attribute.cs (ApplyAttributes): Do not worry about assembly
14297 attributes in the non-global context.
14299 * rootcontext.cs (AddGlobalAttributes): Go back to using this
14300 instead of SetGlobalAttributes.
14302 * class.cs, rootcontext.cs : Ensure we define and generate
14303 attribute types before anything else.
14305 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
14306 and flag the new error -20 for the case when the attribute type
14307 does not have valid targets specified. csc does not catch this.
14309 * ../errors/errors.txt : update for error # -20
14311 2002-04-11 Ravi Pratap <ravi@ximian.com>
14313 * support.cs (InternalParameters.ParameterModifier): Do some null
14314 checking and return sane values.
14316 * class.cs (Method.Define): If we are a PInvoke method, ensure
14317 that we are static and extern. Report error # 601
14319 * ../errors/cs0601.cs : Add test case for the above error.
14321 2002-04-07 Ravi Pratap <ravi@ximian.com>
14323 * rootcontext.cs (attribute_types): We need to keep type of
14324 all attribute types separately and emit code for them first.
14326 (RegisterAttribute) : Implement.
14328 * class.cs (DefineType): Check if the current Type is a custom
14329 attribute type and register it accordingly.
14331 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
14332 adding the first attribute twice and rename to
14334 (SetGlobalAttributes): this.
14336 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
14339 * attribute.cs (ApplyAttributes): Take an additional argument telling us
14340 if we are processing global arguments. Hmm, I am unsure of this.
14342 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
14344 * expression.cs: added static array of strings to avoid calling
14345 Enum.ToString () for Operator in Binary. Significant recover of
14348 2002-04-10 Miguel de Icaza <miguel@ximian.com>
14350 * class.cs (FindMembers): Allow the Builders of the various
14351 members to be null. If they are skip them. This only happens
14352 during the PInvoke declaration.
14354 2002-04-09 Miguel de Icaza <miguel@ximian.com>
14356 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
14357 failure, so we do not keep going afterwards.
14359 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
14360 wanted to pass `false' as the `is_delegate' argument. If this is
14361 the case, why not use delegate_type == null to mean `is_delegate =
14362 false' and anything else as is_delegate = true.
14364 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
14366 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
14367 code for the section, not the beginning of the tests.
14369 2002-04-08 Miguel de Icaza <miguel@ximian.com>
14371 * cfold.cs: Handle operator + (Enum x, Underlying x)
14373 * expression.cs (Binary): same. Warn about errors where we have
14374 Enum/Enum in operator + as well.
14376 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
14379 - added support for switch(bool)
14380 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
14381 - add TableSwitchEmit() to handle table-based switch statements
14383 2002-04-05 Ravi Pratap <ravi@ximian.com>
14385 * expression.cs (Invocation.OverloadResolve): Factor out code which
14386 does parameter compatibility checking with arguments so that we can
14387 re-use the code even from Delegate.VerifyApplicability
14389 (VerifyArgumentsCompat): Move above code here.
14391 * delegate.cs (VerifyApplicability): Get rid of duplicate code
14392 and instead make a call to the above method.
14394 2002-03-31 Ravi Pratap <ravi@ximian.com>
14396 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
14397 We use it to keep track of classes which are attribute types.
14399 2002-04-02 Miguel de Icaza <miguel@ximian.com>
14401 * delegate.cs (Delegate.Define): Correctly define the types in the
14402 presence of fixed and array parameters.
14404 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
14407 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
14408 include NonPublic after the first iteration.
14410 * class.cs (Indexer.CheckBase): Only check if both parents are
14413 * cs-parser.jay (accessor_body): If empty, set to null.
14415 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
14416 same code path here to resolve constants names that we did have in
14417 MemberAccess.DoResolve. There is too much code duplicated here.
14419 2002-04-01 Miguel de Icaza <miguel@ximian.com>
14421 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
14423 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
14426 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
14427 tokens, numbers and strings.
14429 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
14432 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
14433 asyncronous parameters and the regular parameters.
14435 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
14436 specify the target directory.
14438 * expression.cs: (This.DoResolve): Simplify
14439 (As.Emit): Optimize, do not generate IsInst if the expression is
14440 always of the given type.
14442 (Is.DoResolve): Bug fix, we were reporting both always/never for
14445 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
14446 creating too many unnecessary arrays.
14448 2002-03-31 Miguel de Icaza <miguel@ximian.com>
14450 * class.cs (EmitFieldInitializer): Use Assign expression to assign
14451 fields instead of rolling our own initializer. Takes care of all
14452 implicit conversions, and drops unnecessary static checks/argument.
14454 2002-03-31 Dick Porter <dick@ximian.com>
14456 * driver.cs: use the GetDirectories() return values properly, and
14457 use "/" as path separator.
14459 2002-03-30 Miguel de Icaza <miguel@ximian.com>
14461 * expression.cs (Unary): Optimize - - expr into expr.
14462 (Binary): Optimize a + (-b) into a -b.
14464 * codegen.cs (CodeGen): Made all methods static.
14466 2002-03-29 Miguel de Icaza <miguel@ximian.com>
14470 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
14471 TypeBuilder property.
14473 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
14476 * tree.cs: Removed the various RecordXXXX, and replaced with a
14477 single RecordDecl. Removed all the accessor methods, and just
14478 left a single access point Type
14480 * enum.cs: Rename DefineEnum to DefineType.
14482 * decl.cs: New abstract method `DefineType' used to unify the
14483 Defines for Enumerations, Interfaces, TypeContainers and
14486 (FindType): Moved LookupInterfaceOrClass here. Moved the
14487 LookupBaseClasses method that used to live in class.cs and
14488 interface.cs here, and renamed to FindType.
14490 * delegate.cs: Implement DefineType. Take advantage of the
14491 refactored pattern for locating the parent builder without taking
14492 the parent_builder argument (which we know does not work if we are
14493 nested, and triggering a toplevel definition).
14495 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14497 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
14498 accessibility of a member has changed during override and report
14501 * class.cs (Method.Define, Property.Define): Only complain on
14502 overrides if the method is private, any other accessibility is
14503 fine (and since we just checked the permission is the same, we are
14506 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
14507 and elif are processed always. The other pre-processing
14508 directives are only processed if we are "taking" the path
14510 2002-03-29 Martin Baulig <martin@gnome.org>
14512 * class.cs (Method.Emit): Only emit symbolic debugging info if the
14513 current location is not Null.
14515 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
14516 a separate method so we can profile it.
14518 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
14519 `span.Seconds' are just seconds, but no minutes or hours.
14520 (MainDriver): Profile the CodeGen.SaveSymbols calls.
14522 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14524 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
14525 Remove the gratuitous set of Final:
14527 // If an interface implementation, then we can set Final.
14528 if (((flags & MethodAttributes.Abstract) == 0) &&
14529 implementing.DeclaringType.IsInterface)
14530 flags |= MethodAttributes.Final;
14532 I do not know what I was smoking when I used that.
14535 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
14536 step into fixing the name resolution issues for delegates and
14537 unifying the toplevel name resolution.
14539 2002-03-28 Martin Baulig <martin@gnome.org>
14541 * class.cs (Method.Emit): If we have a symbol writer, call its
14542 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
14543 tell it about the current method.
14545 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
14546 writer that we're going to emit the first byte of IL code for a new
14547 statement (a new source line).
14548 (EmitContext.EmitTopBlock): If we have a symbol writer, call
14549 EmitContext.Mark() before emitting any code.
14551 * location.cs (SymbolDocument): Return null when we're Null.
14553 * statement.cs (Statement): Moved the `Location loc' variable here.
14554 (Statement.EmitBoolExpression): If we have a symbol writer, call
14555 ec.Mark() before emitting any code to tell it that we're at the
14556 beginning of a new statement.
14557 (StatementExpression): Added `Location' argument to the constructor.
14558 (Block): Added public readonly variable `StartLocation' and public
14559 variable `EndLocation'. The latter is to be set using SetEndLocation().
14560 (Block): Added constructor which takes a start and end location.
14561 (Block.SetEndLocation): New method. This sets the end location.
14562 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
14563 local variables we create.
14564 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
14565 each statement and do also mark the begin and end of the block.
14567 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
14568 tell it the current lexer.Location, use Location.Null for the end of the
14570 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
14571 current block, set its end location using SetEndLocation().
14572 (statement_expression): StatementExpression constructor now takes the
14573 lexer.Location as additional argument.
14574 (for_statement, declare_local_variables): Likewise.
14575 (declare_local_variables): When creating a new implicit block, use the
14576 new Block constructor and pass it the lexer.Location.
14578 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14580 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
14581 members also on the parent interfaces recursively.
14583 2002-03-27 Miguel de Icaza <miguel@ximian.com>
14585 * report.cs: Use new formats, since Gonzalo finished the missing
14588 * expression.cs (Binary.ResolveOperator): added missing operator|
14589 operator& and operator^ for bool/bool.
14591 * cs-parser.jay: CheckDef now takes a Location argument that is
14592 used to report errors more precisly (instead of reporting the end
14593 of a definition, we try to track something which is a lot closer
14594 to the source of the problem).
14596 * cs-tokenizer.cs: Track global token use, so we can properly flag
14597 the use of #define/#undef after the first token has been seen.
14599 Also, rename the reportXXXX to Error_DescriptiveName
14601 * decl.cs (DeclSpace.IsTopLevel): Move property here from
14602 TypeContainer, so that Enum and Interface can use this too.
14604 * class.cs (TypeContainer.LookupInterfaceOrClass,
14605 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
14606 `builder' argument. Typically this was used to pass the parent
14607 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
14610 The problem is that a nested class could trigger the definition of
14611 a toplevel class, and the builder would be obviously wrong in that
14614 So we drop this argument, and we compute dynamically the
14615 TypeBuilder/ModuleBuilder (the correct information was available
14616 to us anyways from DeclSpace.Parent)
14618 * interface.cs (Interface.DefineInterface): Drop builder
14619 parameter cleanup like class.cs
14621 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
14624 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
14627 (Try.Emit): Propagate the returns value from the statement.
14629 (Return.Emit): Even if we are leavning
14631 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
14633 * modifiers.cs: Fix the computation of MethodAttributes flags.
14635 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
14637 * driver.cs: allow compilation of files that start with '/'.
14638 Add a default case when checking the argument of --target.
14640 2002-03-25 Miguel de Icaza <miguel@ximian.com>
14642 * interface.cs: Implement the same search algorithm for types in
14643 the interface code.
14645 * delegate.cs: Do not allow multiple definition.
14647 * Recovered ChangeLog that got accidentally amputated
14649 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
14651 * rootcontext.cs: Load manually enum to allow core classes to
14652 contain enumerations.
14654 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
14655 Update to new static methods in TypeManager.
14657 * typemanager.cs (GetMethod, GetConstructor): Use our
14658 implementation of FindMembers to find the members, since during
14659 corlib compilation, the types are TypeBuilders and GetMethod and
14660 GetConstructor do not work.
14662 Make all methods in TypeManager static.
14664 (InitCodeHelpers): Split the functionality from
14665 the InitCodeTypes function.
14667 * driver.cs: Call InitCodeHelpers after we have populated the
14670 * cs-parser.jay (delegate_declaration): we did not used to compute
14671 the delegate name correctly for void delegates.
14673 2002-03-24 Miguel de Icaza <miguel@ximian.com>
14675 * rootcontext.cs (RootContext): Init the interface_resolve_order
14676 and type_container_resolve_order always.
14678 (ResolveCore, BootstrapCorlib_ResolveClass,
14679 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
14680 compiler when compiling with --nostdlib
14682 * class.cs (TypeContainer.DefineType): Check that our parent is
14683 not null. This test is most important when we are bootstraping
14686 * codegen.cs: Split out the symbol writing code.
14688 2002-03-25 Martin Baulig <martin@gnome.org>
14690 * driver.cs (-g): Made -g an alias for --debug.
14692 2002-03-24 Martin Baulig <martin@gnome.org>
14694 * codegen.cs (SymbolWriter): New public variable. Returns the
14695 current symbol writer.
14696 (CodeGen): Added `bool want_debugging_support' argument to the
14697 constructor. If true, tell the ModuleBuild that we want debugging
14698 support and ask it for the ISymbolWriter.
14699 (Save): If we have a symbol writer, call it's Close() method after
14700 saving the assembly.
14702 * driver.c (--debug): New command line argument to create a
14703 debugger information file.
14705 * location.cs (SymbolDocument): New public property. Returns an
14706 ISymbolDocumentWriter object for the current source file or null
14707 if we don't have a symbol writer.
14709 2002-03-21 Miguel de Icaza <miguel@ximian.com>
14711 * driver.cs (LoadAssembly): Correctly return when all the paths
14712 have been tried and not before.
14714 * statement.cs (Switch.Emit): return the actual coverage for this
14715 statement (returns/not-returns)
14717 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
14718 switch of the statement if we are the last switch section. That
14719 kills two problems: try/catch problems (we used to emit an empty
14720 nop at the end) and switch statements where all branches would
14723 2002-03-19 Miguel de Icaza <miguel@ximian.com>
14725 * driver.cs: Add default assemblies (the equivalent to the
14726 Microsoft CSC.RSP file)
14728 * cs-tokenizer.cs: When updating `cols and setting it to zero,
14729 also update tokens_seen and set it to false.
14731 * driver.cs: Implement --recurse for Mike.
14733 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
14734 correctly splitting out the paths.
14736 2002-03-18 Miguel de Icaza <miguel@ximian.com>
14738 * interface.cs (Interface.PopulateProperty): Instead of using
14739 `parent' as the declaration space for the set parameters, use
14742 * support.cs (InternalParameters): InternalParameters constructor
14743 takes a DeclSpace instead of a TypeContainer.
14745 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
14746 types are being initialized, load the address of it before calling
14749 (New): Provide a mechanism to disable the generation of local
14750 value type temporaries when the caller will be providing us with
14751 an address to store it.
14753 (ArrayCreation.EmitDynamicInitializers): Use it.
14755 2002-03-17 Miguel de Icaza <miguel@ximian.com>
14757 * expression.cs (Invocation.EmitArguments): Only probe for array
14758 property if there is more than one argument. Sorry about that.
14760 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
14761 empty param arrays.
14763 * class.cs (Method.LabelParameters): Fix incorrect code path that
14764 prevented the `ParamArrayAttribute' from being applied to the
14767 2002-03-16 Miguel de Icaza <miguel@ximian.com>
14769 * support.cs (ReflectionParameters): Correctly compute whether the
14770 last argument is a params array. Fixes the problem with
14773 * typemanager.cs: Make the assemblies array always be non-null
14774 (empty, but non-null)
14776 * tree.cs (RecordDecl): New function that abstracts the recording
14777 of names. This reports error 101, and provides a pointer to the
14778 previous declaration. Fixes a crash in the compiler.
14780 * cs-parser.jay (constructor_declaration): Update to new grammar,
14781 and provide a constructor_body that can be empty.
14783 2002-03-15 Miguel de Icaza <miguel@ximian.com>
14785 * driver.cs: Add support for --resources.
14787 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
14788 Make all types for the various array helper methods be integer.
14790 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
14791 CheckState to ConvCast.
14793 (ConvCast): Now it takes a `checked' state argument, to avoid
14794 depending on the emit context for the conversion, and just using
14795 the resolve time setting.
14797 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
14798 instead of Invocation.EmitArguments. We do not emit the original
14799 arguments, instead we emit those which have been converted to
14800 unsigned int expressions.
14802 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
14804 * codegen.cs: ditto.
14806 * expression.cs (LocalVariableReference): Drop the use of the
14807 Store function that depended on the variable index.
14809 * statement.cs (VariableInfo): Drop the `Idx' property from this
14810 class, as this is not taking into account the indexes for
14811 temporaries tat we generate during the execution, getting the
14814 * class.cs: First emit class initializers, then call the parent
14817 * expression.cs (Binary): Fix opcode emision.
14818 (UnaryMutator.EmitCode): Support checked code generation
14820 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
14821 matches for events for both the Static and Instance scans,
14822 pointing to the same element. Fix that.
14824 2002-03-14 Miguel de Icaza <miguel@ximian.com>
14826 * rootcontext.cs (ResolveTree): Always set the
14827 interface_resolve_order, because nested interfaces will be calling
14830 * class.cs (GetInterfaceOrClass): Track the same resolution
14831 process used by TypeManager.LookupType. This fixes the nested
14832 type lookups in class declarations (separate path from
14835 (TypeContainer.DefineType): Also define nested interfaces.
14836 (TypeContainer.RegisterOrder): New public function used to
14837 register the order in which child interfaces need to be closed.
14839 Nested interfaces need to be closed after their parents have been
14842 * interface.cs (InterfaceAttr): Put all the logic for computing
14843 the interface attribute here.
14845 (DefineInterface): Register our interface order with the
14846 RootContext or with the TypeContainer depending on the case.
14848 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14850 * cs-parser.jay: rework foreach statement to work with the new
14851 changes to the policy on SimpleNames.
14853 * report.cs: support Stacktrace on warnings as well.
14855 * makefile: drop --unsafe and /unsafe from the compile.
14857 2002-03-13 Ravi Pratap <ravi@ximian.com>
14859 * ecore.cs (StandardConversionExists): Modify to take an Expression
14860 as the first parameter. Ensure we do null -> reference type conversion
14863 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14864 temporary Expression objects.
14866 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14868 * interface.cs: workaround bug in method overloading resolution
14869 (there is already a bugzilla bug for it).
14871 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14873 We could also solve this problem by having a separate path for
14874 performing type lookups, instead of DoResolve, we could have a
14875 ResolveType entry point, and only participating pieces of the
14876 production (simplename, deref, array) would implement this.
14878 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14879 signal SimpleName to only resolve type names and not attempt to
14880 resolve anything else.
14882 * expression.cs (Cast): Set the flag.
14884 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14886 * class.cs: Only report 108 if there is no `new' modifier.
14888 * cs-parser.jay: rework foreach statement to work with the new
14889 changes to the policy on SimpleNames.
14891 * report.cs: support Stacktrace on warnings as well.
14893 * makefile: drop --unsafe and /unsafe from the compile.
14895 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14897 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14898 lookups here, instead of doing that at parse time. This means
14899 that our grammar will not introduce `LocalVariableReferences' as
14900 expressions at this point. That solves the problem of code like
14904 static void Main ()
14908 This is only half the fix. The full fix requires parameters to
14909 also be handled in this way.
14911 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14912 makes the use more obvious of the DeclSpace. The
14913 ec.TypeContainer.TypeBuilder is now only used to pull the
14914 TypeBuilder for it.
14916 My theory is that I can get rid of the TypeBuilder completely from
14917 the EmitContext, and have typecasts where it is used (from
14918 DeclSpace to where it matters).
14920 The only pending problem is that the code that implements Aliases
14921 is on TypeContainer, and probably should go in DeclSpace.
14923 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14924 lookups here, instead of doing that at parse time. This means
14925 that our grammar will not introduce `LocalVariableReferences' as
14926 expressions at this point. That solves the problem of code like
14930 static void Main ()
14934 This is only half the fix. The full fix requires parameters to
14935 also be handled in this way.
14937 * class.cs (Property.DefineMethod): When implementing an interface
14938 method, set newslot, when implementing an abstract method, do not
14939 set the flag (before we tried never setting it, or always setting
14940 it, which is the difference).
14941 (Indexer.DefineMethod): same.
14942 (Method.DefineMethod): same.
14944 * ecore.cs: Only set the status used flag if we get back a Field.
14946 * attribute.cs: Temporary hack, so Paolo can keep working.
14948 2002-03-08 Ravi Pratap <ravi@ximian.com>
14950 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14951 the unmanaged type in the case we have a MarshalAs attribute.
14953 (Resolve): Handle the case when we are parsing the special MarshalAs
14954 attribute [we need to store the unmanaged type to use later]
14956 * typemanager.cs (marshal_as_attr_type): Built in type for the
14957 MarshalAs Attribute.
14959 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14960 on parameters and accordingly set the marshalling info.
14962 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14964 * class.cs: Optimizing slightly by removing redundant code after
14965 we switched to the `NoTypes' return value.
14966 (Property.DefineMethod): use NoTypes here too.
14968 This fixes the bug I introduced in my last batch of changes.
14970 2002-03-05 Ravi Pratap <ravi@ximian.com>
14972 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14974 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14975 Enums since those are types too.
14977 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14979 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14980 thanks to a call during the lookup process.
14982 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14984 * statement.cs (Foreach): Lots of work to accomodate a particular
14985 kind of foreach statement that I had not kept in mind. It is
14986 possible to have foreachs on classes that provide a GetEnumerator
14987 method that return objects that implement the "pattern" for using
14988 a foreach, there is no need to support GetEnumerator
14991 This is needed to compile nant.
14993 * decl.cs: Only report 114 if the member is not `Finalize' and if
14994 the warning level is at least 2.
14996 * class.cs: Moved the compare function from Method to
14999 (MethodSignature.InheritableMemberSignatureCompare): Add new
15000 filter function that is used to extract inheritable methods from a
15003 (Method.Define): Use the new `inheritable_method_signature_filter'
15006 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
15009 2002-03-06 Miguel de Icaza <miguel@ximian.com>
15011 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
15013 * cs-parser.jay: Add opt_semicolon to the interface declaration.
15015 * expression.cs: Pass location information to
15016 ConvertImplicitStandard.
15018 * class.cs: Added debugging code to track return values from
15021 2002-03-05 Miguel de Icaza <miguel@ximian.com>
15023 * expression.cs (Is.DoResolve): If either side of the `is' is an
15024 interface, do not flag the warning.
15026 * ecore.cs (ImplicitReferenceConversion): We need a separate test
15029 * report.cs: Allow for --fatal to be used with --probe.
15031 * typemanager.cs (NoTypes): Move the definition for the empty Type
15034 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
15036 (TypeContainer.DefineProxy): New function used to proxy to parent
15037 implementations when implementing interfaces.
15038 (TypeContainer.ParentImplements): used to lookup if our parent
15039 implements a public function that is required by an interface.
15040 (TypeContainer.VerifyPendingMethods): Hook this up.
15042 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
15043 `modules' and `assemblies' arraylists into arrays. We only grow
15044 these are the very early start up of the program, so this improves
15045 the speedof LookupType (nicely measured).
15047 * expression.cs (MakeByteBlob): Replaced unsafe code with
15048 BitConverter, as suggested by Paolo.
15050 * cfold.cs (ConstantFold.Binary): Special case: perform constant
15051 folding of string concatenation, but if either side is a string,
15052 and the other is not, then return null, and let the runtime use
15053 the concatenation on the string plus the object (using
15054 `Object.ToString').
15056 2002-03-04 Miguel de Icaza <miguel@ximian.com>
15058 Constant Folding has been implemented now.
15060 * expression.cs (Unary.Reduce): Do not throw an exception, catch
15061 the error instead on types that are not supported in one's
15064 * constant.cs (Constant and all children): New set of functions to
15065 perform implict and explicit conversions.
15067 * ecore.cs (EnumConstant): Implement the new functions to perform
15068 conversion by proxying to the child expression.
15070 * codegen.cs: (ConstantCheckState): Constant evaluation has its
15071 own separate setting that can not be turned off from the command
15072 line using --unchecked or --checked and is only controlled using
15073 the checked/unchecked statements and expressions. This setting is
15074 used by the constant folder to flag errors.
15076 * expression.cs (CheckedExpr, UncheckedExpr): Set the
15077 ConstantCheckState as well.
15079 During Resolve, they also have to flag the state, because the
15080 constant folder runs completely in the Resolve phase.
15082 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
15085 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15087 * cfold.cs: New file, this file contains the constant folder.
15089 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
15090 argument to track whether we are using the resulting address to
15091 load or store a value and provide better error messages.
15093 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
15094 new AddressOf arguments.
15096 * statement.cs (Foreach.EmitCollectionForeach): Update
15098 * expression.cs (Argument.Emit): Call AddressOf with proper
15099 arguments to track usage.
15101 (New.DoEmit): Call AddressOf with new arguments.
15103 (Unary.Emit): Adjust AddressOf call.
15105 2002-03-01 Ravi Pratap <ravi@ximian.com>
15107 * cs-parser.jay (member_access): Change the case for pre-defined types
15108 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
15111 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
15114 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
15115 essentially like methods and apply attributes like MethodImplOptions to them too.
15117 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
15120 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
15121 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
15124 * Update code everywhere accordingly.
15126 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
15128 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
15130 2002-02-28 Ravi Pratap <ravi@ximian.com>
15132 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
15133 try performing lookups against those instead of jumping straight into using
15134 the 'using' clauses.
15136 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
15138 (LookupType): Perform lookups in implicit parents too.
15140 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
15141 sequence as RootContext.LookupType.
15143 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
15144 the various cases of namespace lookups into this method.
15146 2002-03-01 Miguel de Icaza <miguel@ximian.com>
15148 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
15149 in positional arguments)
15151 * class.cs (Operator): Update the AllowedModifiers to contain
15154 * cs-parser.jay: Update operator declaration to allow for the
15155 operator body to be empty.
15157 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
15160 2002-02-27 Miguel de Icaza <miguel@ximian.com>
15162 * class.cs (Method.Emit): Label parameters.
15164 * driver.cs: Return 1 or 0 as the program exit code.
15166 2002-02-26 Miguel de Icaza <miguel@ximian.com>
15168 * expression.cs: Special case the `null' object when trying to
15169 auto-compute the type, as anything can be explicitly converted to
15172 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
15173 spotting this Paolo.
15175 (Expression.ImplicitNumericConversion): Perform comparissions of
15176 the type using the underlying type in the case of an enumeration
15177 rather than using the enumeration type for the compare.
15179 Cope with the underlying == type case, which is not possible to
15182 (Expression.ConvertNumericExplicit): Perform comparissions of
15183 the type using the underlying type in the case of an enumeration
15184 rather than using the enumeration type for the compare.
15186 * driver.cs: If the user does not supply an extension, assume .exe
15188 * cs-parser.jay (if_statement): Rewrote so that we can track the
15189 location for the if statement.
15191 * expression.cs (Binary.ConstantFold): Only concat strings when
15192 the operation is "+", not everything ;-)
15194 * statement.cs (Statement.EmitBoolExpression): Take a location
15196 (If, While, Do): Track location.
15198 * expression.cs (Binary.ResolveOperator): In the object + string
15199 case, I was missing a call to ConvertImplicit
15201 2002-02-25 Ravi Pratap <ravi@ximian.com>
15203 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
15204 Location arguments. Ensure we use RootContext.LookupType to do our work
15205 and not try to do a direct Type.GetType and ModuleBuilder.GetType
15207 * interface.cs (PopulateMethod): Handle the type of the parameter being
15210 * expression.cs (Invocation.BetterFunction): Handle the case when we
15211 have a params method with no fixed arguments and a call is made with no
15214 2002-02-25 Miguel de Icaza <miguel@ximian.com>
15216 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
15217 the verbatim-string-literal
15219 * support.cs (InternalParameters.ParameterModifier): handle null
15221 (InternalParameters.ParameterType): ditto.
15223 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
15224 duplicating the name of the variable parameter.
15225 (GetParameterByName): Fix bug where we were not looking up array
15226 paramters if they were the only present (thanks Paolo!).
15227 (GetParameterInfo): We only have an empty set of types if both
15228 fixed and array are set to null.
15229 (GetParameterInfo-idx): Handle FixedParameter == null
15231 * cs-parser.jay: Handle the case where there is no catch
15232 statements (missing null test).
15234 2002-02-22 Miguel de Icaza <miguel@ximian.com>
15236 * driver.cs (MainDriver): Be conservative on our command line
15239 Catch DirectoryNotFoundException when calling GetFiles.
15241 (SplitPathAndPattern): Used to split the input specification into
15242 a path and a pattern that we can feed to Directory.GetFiles.
15244 2002-02-21 Miguel de Icaza <miguel@ximian.com>
15246 * statement.cs (Fixed): Implement the last case of the Fixed
15247 statement (string handling).
15249 * expression.cs (StringPtr): New class used to return a char * to
15250 a string; Used by the Fixed statement.
15252 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
15254 * expression.cs (Binary.ResolveOperator): Remove redundant
15255 MemberLookup pn parent type.
15256 Optimize union call, we do not need a union if the types are the same.
15257 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
15260 Specialize the use of MemberLookup everywhere, instead of using
15261 the default settings.
15263 (StackAlloc): Implement stackalloc keyword.
15265 * cs-parser.jay: Add rule to parse stackalloc.
15267 * driver.cs: Handle /h, /help, /?
15269 * expression.cs (MakeByteBlob): Removed the hacks we had in place
15270 before we supported unsafe code.
15272 * makefile: add --unsafe to the self compilation of mcs.
15274 2002-02-20 Miguel de Icaza <miguel@ximian.com>
15276 * expression.cs (PointerArithmetic): New class that is used to
15277 perform pointer arithmetic.
15278 (Binary.Resolve): Handle pointer arithmetic
15279 Handle pointer comparission.
15280 (ArrayPtr): Utility expression class that is used to take the
15281 address of an array.
15283 (ElementAccess): Implement array access for pointers
15285 * statement.cs (Fixed): Implement fixed statement for arrays, we
15286 are missing one more case before we are done.
15288 * expression.cs (Indirection): Implement EmitAssign and set the
15289 ExprClass to Variable. This allows pointer dereferences to be
15290 treated as variables, and to have values assigned to them.
15292 * ecore.cs (Expression.StoreFromPtr): New utility function to
15293 store values dereferencing.
15295 2002-02-20 Ravi Pratap <ravi@ximian.com>
15297 * expression.cs (Binary.ResolveOperator): Ensure that we are
15298 not trying to operate on a void type - this fixes the reported
15301 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
15302 the parent implementation is sealed.
15304 * ../errors/cs0239.cs : Add.
15306 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
15308 * typemanager.cs (unverifiable_code_type): Corresponds to
15309 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
15310 which have unsafe code in them.
15312 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
15315 2002-02-19 Miguel de Icaza <miguel@ximian.com>
15317 * cs-tokenizer.cs: Add support for @"litreal strings"
15319 Make tokenizer accept pre-processor directives
15320 on any column (remove the old C-like limitation).
15322 * rootcontext.cs (EmitCode): Emit any global attributes.
15323 (AddGlobalAttributes): Used to keep track of assembly attributes.
15325 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
15327 * cs-parser.jay: Add support for global attributes.
15329 2002-02-17 Miguel de Icaza <miguel@ximian.com>
15331 * expression.cs (Indirection): New helper class. Unary will
15332 create Indirection classes to be able to implement the
15333 IMemoryLocation interface on it.
15335 2002-02-16 Miguel de Icaza <miguel@ximian.com>
15337 * cs-parser.jay (fixed_statement): reference the right statement.
15339 * statement.cs (Fixed.Emit): Finish implementing the fixed
15340 statement for the &x case.
15342 2002-02-14 Miguel de Icaza <miguel@ximian.com>
15344 * class.cs (Property.Define, Method.Define): Remove newslot when
15347 * modifiers.cs: My use of NewSlot when `Abstract' was set was
15348 wrong. NewSlot should only be used if the `new' keyword is present.
15350 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
15351 locating our system dir. Sorry about this.
15353 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15355 * driver.cs (GetSystemDir): Compute correctly the location of our
15356 system assemblies. I was using the compiler directory instead of
15357 the library directory.
15359 2002-02-13 Ravi Pratap <ravi@ximian.com>
15361 * expression.cs (BetterFunction): Put back in what Miguel commented out
15362 since it is the correct fix. The problem is elsewhere ;-)
15364 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
15365 parameters of the parms method are themselves compatible or not !
15367 (StandardConversionExists): Fix very dangerous bug where we were forgetting
15368 to check that a class implements an interface before saying that an implicit
15369 conversion was allowed. Use ImplementsInterface to do the checking.
15371 2002-02-13 Miguel de Icaza <miguel@ximian.com>
15373 * class.cs (Method.Define): Track whether we are an explicit
15374 implementation or not. And only call DefineMethodOverride if we
15375 are an explicit implementation.
15377 (Property.DefineMethod): Ditto.
15379 2002-02-11 Ravi Pratap <ravi@ximian.com>
15381 * expression.cs (BetterFunction): Catch hideous bug which was
15382 preventing us from detecting ambiguous calls due to implicit casts i.e
15385 2002-01-29 Miguel de Icaza <miguel@ximian.com>
15387 * support.cs (Pair): Remove un-needed method. I figured why I was
15388 getting the error in cs-parser.jay, the variable in a foreach loop
15389 is readonly, and the compiler does not really treat this as a variable.
15391 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
15392 instead of EQUALS in grammar.
15394 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
15396 * expression.cs (Unary.DoResolve): Check whether the argument is
15399 2002-01-28 Miguel de Icaza <miguel@ximian.com>
15401 * support.cs: Api for Pair to set a value. Despite the fact that
15402 the variables are public the MS C# compiler refuses to compile
15403 code that accesses the field if the variable is part of a foreach
15406 * statement.cs (Fixed): Begin implementation of the fixed
15409 (Block.AddVariable): Return the VariableInfo on success and null
15410 on failure instead of true/false.
15412 * cs-parser.jay (foreach): Catch errors on variables already
15413 defined (we were ignoring this value before) and properly unwind
15414 the block hierarchy
15416 (fixed_statement): grammar for the fixed statement.
15418 2002-01-25 Miguel de Icaza <miguel@ximian.com>
15420 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
15421 pointer types to be incretemented.
15423 (SizeOf): Implement.
15425 * cs-parser.jay (pointer_member_access): Implement
15426 expr->IDENTIFIER production.
15428 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
15429 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
15432 (Unary): Implement indirection.
15434 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
15435 use in non-unsafe context).
15437 (SimpleName.DoResolve): Check for pointers in field access on safe
15440 (Expression.LoadFromPtr): Factor the load-indirect code in this
15441 function. This was duplicated in UnboxCast and ParameterReference
15443 2002-01-24 Miguel de Icaza <miguel@ximian.com>
15445 * expression.cs (ComposedCast): report an error if a pointer cast
15446 is used in a safe region.
15448 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
15449 pointer type casts in unsafe context.
15451 * codegen.cs (EmitContext): Set up IsUnsafe.
15453 * cs-parser.jay (non_expression_type): Add productions for pointer
15456 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
15457 code. We should not use force into static mode if the method is
15458 not virtual. Fixes bug in MIS
15460 * statement.cs (Do.Emit, While.Emit, For.Emit,
15461 Statement.EmitBoolExpression): Add support to Do and While to
15462 propagate infinite loop as `I do return' semantics.
15464 Improve the For case to also test for boolean constants.
15466 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
15467 to the list of attributes we can add.
15469 Remove `EmitContext' argument.
15471 * class.cs (Method.Define): Apply parameter attributes.
15472 (Constructor.Define): Apply parameter attributes.
15473 (MethodCore.LabelParameters): Move here the core of labeling
15476 * support.cs (ReflectionParameters.ParameterModifier,
15477 InternalParameters.ParameterModifier): Use IsByRef on the type and
15478 only return the OUT bit for these parameters instead of in/out/ref
15481 This is because I miss-understood things. The ParameterInfo.IsIn
15482 and IsOut represent whether the parameter has the [In] and [Out]
15485 2002-01-22 Miguel de Icaza <miguel@ximian.com>
15487 * ecore.cs (FieldExpr.Emit): Release temporaries.
15489 * assign.cs (LocalTemporary.Release): new function.
15491 * codegen.cs (EmitContext.GetTemporaryStorage,
15492 EmitContext.FreeTemporaryStorage): Rework the way we deal with
15493 temporary storage. Now we can "put back" localbuilders when we
15496 2002-01-21 Miguel de Icaza <miguel@ximian.com>
15498 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
15499 need to make a copy of the variable to generate verifiable code.
15501 2002-01-19 Miguel de Icaza <miguel@ximian.com>
15503 * driver.cs: Compute dynamically the system directory.
15505 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
15506 Slower, but more generally useful. Used by the abstract
15507 registering implementation.
15509 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
15510 the rules for the special rule on Type/instances. First check if
15511 we have the same name, and if so, try that special static path
15512 rather than the instance path.
15514 2002-01-18 Miguel de Icaza <miguel@ximian.com>
15516 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
15519 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
15520 Enum, ValueType, Delegate or Array for non-corlib compiles.
15522 * cs-tokenizer.cs: Catch long identifiers (645)
15524 * typemanager.cs (IndexerPropetyName): Ravi never tested this
15527 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
15528 fix, we were returning too early, so we were not registering
15529 pending methods from abstract classes.
15531 Do not register pending methods if the class is abstract.
15533 * expression.cs (Conditional.DoResolve): Report circular implicit
15534 conversions when we neecd to compute it for conditional
15537 (Is.DoResolve): If the expression is always of the provided type,
15538 flag warning 183. If the expression can not ever be of the
15539 provided type flag warning 184.
15541 * class.cs: Catch 169 as well.
15543 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
15546 2002-01-18 Nick Drochak <ndrochak@gol.com>
15548 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
15550 2002-01-17 Miguel de Icaza <miguel@ximian.com>
15552 * interface.cs: (PopulateMethod): Check for pointers being defined
15553 only if the unsafe context is active.
15554 (PopulateProperty): ditto.
15555 (PopulateIndexer): ditto.
15557 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
15558 specified. If pointers are present, make sure that they are
15559 present in an unsafe context.
15560 (Constructor, Constructor.Define): ditto.
15561 (Field, Field.Define): ditto.
15562 (Property, Property.Define): ditto.
15563 (Event, Event.Define): ditto.
15565 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
15566 hashtable if there are classes or structs defined.
15568 * expression.cs (LocalVariableReference.DoResolve): Simplify this
15569 code, as the constant resolution moved.
15571 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
15572 the metadata, so we can flag error 133.
15574 * decl.cs (MemberCore.UnsafeOK): New function to test that a
15575 pointer is being declared in an unsafe context.
15577 2002-01-16 Miguel de Icaza <miguel@ximian.com>
15579 * modifiers.cs (Modifiers.Check): Require a Location argument.
15580 Report error 227 for Unsafe use.
15582 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
15584 * statement.cs (For.Emit): If the test is null, then report that
15585 we do `return', as we wont reach anything afterwards.
15587 (Switch.SwitchGoverningType): Track the expression that matched
15590 * driver.cs: Allow negative numbers as an error code to flag.
15592 * cs-parser.jay: Handle 1551.
15594 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
15596 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15598 * cs-parser.jay: Report 1518 (type declaration can only contain
15599 class, struct, interface, enum or delegate)
15601 (switch_label): Report 1523 (keywords `case' or `default' must
15604 (opt_switch_sections): Report 1522 (empty switch)
15606 * driver.cs: Report 1515 (response file specified multiple times)
15607 Report 1516 (Source file specified multiple times).
15609 * expression.cs (Argument.Resolve): Signal 1510
15611 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
15612 access not allowed in static code)
15614 2002-01-11 Ravi Pratap <ravi@ximian.com>
15616 * typemanager.cs (IsPointerType): Utility method which we are going
15619 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
15620 the object type, so we take care of that.
15622 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
15624 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
15625 added to non-params parameters :-)
15627 * typemanager.cs (CSharpName): Include 'void' type too.
15629 (void_ptr_type): Include in the set of core types.
15631 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
15634 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
15637 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
15638 completely forgotten about it.
15640 2002-01-10 Ravi Pratap <ravi@ximian.com>
15642 * cs-parser.jay (pointer_type): Add. This begins our implementation
15643 of parsing rules for unsafe code.
15645 (unsafe_statement): Implement.
15647 (embedded_statement): Modify to include the above.
15649 * statement.cs (Unsafe): Implement new class for unsafe blocks.
15651 * codegen.cs (EmitContext.InUnsafe): Add. This determines
15652 if the current context is an unsafe one.
15654 * cs-parser.jay (local_variable_pointer_type): Since local variable types
15655 are handled differently, we need separate rules for them.
15657 (local_variable_declaration): Update to use local_variable_pointer_type
15658 to allow variable declarations of unmanaged pointer types.
15660 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
15661 in unsafe contexts.
15663 * ../errors/cs0214.cs : Add.
15665 2002-01-16 Nick Drochak <ndrochak@gol.com>
15667 * makefile: remove 'response' file when cleaning.
15669 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15671 * cs-parser.jay: Report 1524.
15673 2002-01-14 Miguel de Icaza <miguel@ximian.com>
15675 * typemanager.cs (RegisterMethod): drop checking if we have
15676 registered this from here
15678 2002-01-12 Miguel de Icaza <miguel@ximian.com>
15680 * class.cs (Method.EmitDestructor): Implement calling our base
15683 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
15684 value of InFinally.
15686 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
15687 this routine and will wrap the call in a try/catch block. Deal
15690 2002-01-11 Miguel de Icaza <miguel@ximian.com>
15692 * ecore.cs (Expression.MemberLookup): instead of taking a
15693 parameter `same_type' that was used to tell whether we could
15694 access private members we compute our containing type from the
15697 (FieldExpr): Added partial support for volatile fields. This does
15698 not work for volatile fields exposed from assemblies, as I can not
15699 figure out how to extract the modreq from it.
15701 Updated all the source files to use this.
15703 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
15704 because it is referenced by MemberLookup very often.
15706 2002-01-09 Ravi Pratap <ravi@ximian.com>
15708 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
15709 TypeBuilder.GetCustomAttributes to retrieve what we need.
15711 Get rid of redundant default_member_attr_type as this is the same as
15712 default_member_type which already exists.
15714 * interface.cs, attribute.cs : Update accordingly.
15716 2002-01-08 Miguel de Icaza <miguel@ximian.com>
15718 * typemanager.cs: Enable IndexerPropertyName again. It does not
15719 work for TYpeBuilders though. Ravi, can you please fix this?
15721 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
15723 * expression.cs (Argument.Emit): Handle the case of ref objects
15724 being passed to ref functions;
15726 (ParameterReference.EmitLoad): Loads the content of the pointer
15727 without dereferencing.
15729 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15731 * cs-tokenizer.cs: Implemented the pre-processing expressions.
15733 2002-01-08 Ravi Pratap <ravi@ximian.com>
15735 * class.cs (Indexer.DefineMethod): Incorporate the interface
15736 type in the name of the method if we are doing explicit interface
15739 * expression.cs (ConversionExists): Remove as it is completely obsolete.
15741 (BetterConversion): Fix extremely trivial bug where we were referring to
15742 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
15745 * ../errors/bug16.cs : Add although we have fixed it.
15747 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15749 * expression.cs (BaseIndexer): Begin implementation.
15751 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
15753 * cs-parser.jay (indexer_declarator): Use qualified_identifier
15754 production directly to remove a shift/reduce, and implement
15755 explicit interface implementation.
15757 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
15758 after a floating point suffix.
15760 * expression.cs (DoNumericPromotions): Improved the conversion for
15761 uint/uint. If we have a constant, we avoid doing a typecast to a
15764 * class.cs (Indexer): Implement explicit interface implementation
15767 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
15769 * class.cs: make the default instance constructor public and hidebysig.
15771 2001-01-03 Ravi Pratap <ravi@ximian.com>
15773 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
15774 so we can call it from elsewhere.
15776 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
15777 we emit it internally if the class has a defined indexer; otherwise the user
15778 emits it by decorating the class definition with the DefaultMemberAttribute.
15780 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
15781 attribute is not used on a type which defines an indexer.
15783 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
15784 character when we skip whitespace.
15786 * ../errors/cs0646.cs : Add.
15788 2002-01-03 Miguel de Icaza <miguel@ximian.com>
15790 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
15793 * makefile: Add practical target `mcs3.exe' which builds the third
15794 generation compiler.
15796 * expression.cs (New): Fix structures constructor calling.
15798 * class.cs (Property, Method, Indexer): Emit Final flag on the
15799 method if we are an interface implementation and we are not
15802 * ecore.cs (PropertyExpr): New public field `IsBase', tells
15803 whether this property is referencing a `base' method.
15805 * expression.cs (Invocation.EmitCall): take an extra argument:
15806 is_base, this is used to determine whether the `call' or
15807 `callvirt' opcode should be used.
15810 * delegate.cs: update EmitCall.
15812 * class.cs (Method.Define): Set NewSlot for the cases where we are
15813 not implementing an interface method.
15815 (Property.Define): ditto.
15817 2002-01-02 Miguel de Icaza <miguel@ximian.com>
15819 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
15820 'r'. Allows mcs to parse itself fully.
15822 2002-01-02 Ravi Pratap <ravi@ximian.com>
15824 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
15825 of the number of initializers that require the InitializeArray method.
15827 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15828 update the above field where necessary.
15830 (MakeByteBlob): Update accordingly.
15832 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15835 (EmitDynamicInitializers): Update in accordance with the new optimization.
15837 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15838 same OpCode applies.
15840 * cs-parser.jay : Fix some glaring errors I introduced.
15842 2002-01-01 Ravi Pratap <ravi@ximian.com>
15844 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15845 so that we can check for name clashes there too.
15847 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15848 for interface indexers.
15850 * interfaces.cs (Define): Emit the default member attribute.
15852 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15853 variable was being referred to while setting the value ;-)
15855 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15857 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15858 byte-by-byte information when we know the data is zero.
15860 Make the block always a multiple of 4, because
15861 DefineInitializedData has a bug.
15863 * assign.cs: Fix, we should assign from the temporary, not from
15866 * expression.cs (MakeByteBlob): Fix my incorrect code.
15868 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15870 * typemanager.cs (EnumToUnderlying): This function is used to get
15871 the underlying type from an enumeration, because it does not
15874 * constant.cs: Use the I4_S form for values between -128 and 127.
15876 * statement.cs (Block.LookupLabel): Looks up a label.
15877 (Block): Drop support for labeled blocks.
15879 (LabeledStatement): New kind of statement that represents a label
15882 (Goto): Finally implement this bad boy.
15884 * cs-parser.jay: Update to reflect new mechanism to implement
15887 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15889 * codegen.cs (EmitContext.This): a codegen property that keeps the
15890 a single instance of this instead of creating many different this
15893 * delegate.cs (Delegate.DoResolve): Update to use the property;
15895 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15897 * expression.cs (BaseAccess.DoResolve): Ditto.
15899 2001-12-29 Ravi Pratap <ravi@ximian.com>
15901 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15902 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15904 (InitCoreTypes): Update accordingly.
15906 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15907 so we can quickly store the state.
15909 (ApplyAttributes): Set the correct implementation flags
15910 for InternalCall methods.
15912 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15914 * expression.cs (EmitCall): if a method is not virtual, then do
15915 not use callvirt on it.
15917 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15918 user defined stuff) requires the use of stobj, which takes an
15919 address on the stack instead of an array and an index. So emit
15920 the Ldelema operation for it.
15922 (EmitStoreOpcode): Use stobj for valuetypes.
15924 (UnaryMutator.EmitCode): Use the right 1 value depending on
15925 whether we are dealing with int64/uint64, float or doubles.
15927 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15928 constructors that I implemented last night.
15930 (Constructor.IsDefault): Fix to work properly for static
15933 * cs-parser.jay (CheckDef): report method signature errors.
15934 Update error number 103 to be 132.
15936 * decl.cs: New AdditionResult enumeration value: MethodExists.
15937 Although we do this check for methods later on in the semantic
15938 analysis, catching repeated default constructors is so easy that
15939 we catch these here.
15941 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15944 (ParameterReference.EmitAssign, Emit): handle
15947 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15948 (ArrayAccess.EmitStoreOpcode): ditto.
15950 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15952 * expression.cs (MakeByteBlob): Complete all the missing types
15953 (uint, short, ushort, byte, sbyte)
15955 * class.cs: Only init instance field initializers on instance
15958 Rename `constructors' to instance_constructors.
15960 (TypeContainer.AddConstructor): Only add constructors to the list
15961 if it is not static.
15963 Make sure that we handle default_static_constructor independently
15964 everywhere where we handle instance_constructors
15966 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15968 * class.cs: Do not lookup or create a base initializer for a
15969 static constructor.
15971 (ConstructorInitializer.Resolve): use the proper type to lookup
15974 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15976 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15979 * decl.cs: CloseType is now an virtual method, the default
15980 implementation just closes this type.
15982 2001-12-28 Ravi Pratap <ravi@ximian.com>
15984 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15985 to PreserveSig by default. Also emit HideBySig on such methods.
15987 Basically, set the defaults to standard values.
15989 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15990 argument, if candidate is better, it can't be worse than the best !
15992 (Invocation): Re-write bits to differentiate between methods being
15993 applicable in their expanded form and their normal form - for params
15996 Get rid of use_standard everywhere as only standard conversions are allowed
15997 in overload resolution.
15999 More spec conformance.
16001 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16003 * driver.cs: Add --timestamp, to see where the compiler spends
16006 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
16007 `this' in static code.
16009 (SimpleName.DoResolve): Implement in terms of a helper function
16010 that allows static-references to be passed upstream to
16013 (Expression.ResolveWithSimpleName): Resolve specially simple
16014 names when called by MemberAccess to implement the special
16017 (Expression.ImplicitReferenceConversion): Handle conversions from
16018 Null to reference types before others, as Null's type is
16021 * expression.cs (Invocation.EmitCall): Handle the special case of
16022 calling methods declared on a reference type from a ValueType
16023 (Base classes System.Object and System.Enum)
16025 (MemberAccess.Resolve): Only perform lookups on Enumerations if
16026 the left hand side is a TypeExpr, not on every enumeration.
16028 (Binary.Resolve): If types are reference types, then do a cast to
16029 object on operators != and == of both arguments.
16031 * typemanager.cs (FindMembers): Extract instance and static
16032 members if requested.
16034 * interface.cs (PopulateProperty): Use void_type instead of null
16035 as the return type for the setter method.
16037 (PopulateIndexer): ditto.
16039 2001-12-27 Ravi Pratap <ravi@ximian.com>
16041 * support.cs (ReflectionParameters): Fix minor bug where we
16042 were examining the wrong parameter for the ParamArray attribute.
16044 Cope with requests for the type of the parameter at position
16045 greater than the params parameter's. We now return the element
16046 type of the params array as that makes more sense.
16048 * expression.cs (Invocation.IsParamsMethodApplicable): Update
16049 accordingly as we no longer have to extract the element type
16052 (Invocation.OverloadResolve): Update.
16054 2001-12-27 Miguel de Icaza <miguel@ximian.com>
16056 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
16057 against IEnumerator, test whether the return value is a descendant
16058 of the IEnumerator interface.
16060 * class.cs (Indexer.Define): Use an auxiliary method to implement
16061 the other bits of the method definition. Begin support for
16062 explicit interface implementation.
16064 (Property.DefineMethod): Use TypeManager.void_type instead of null
16065 for an empty return value.
16067 2001-12-26 Miguel de Icaza <miguel@ximian.com>
16069 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
16070 dealing with a FieldExpr which is composed of a FieldBuilder, in
16071 the code path we did extract the constant, but we should have
16072 obtained the underlying value to be able to cast it (otherwise we
16073 end up in an infinite loop, this is what Ravi was running into).
16075 (ArrayCreation.UpdateIndices): Arrays might be empty.
16077 (MemberAccess.ResolveMemberAccess): Add support for section
16078 14.5.4.1 that deals with the special case of E.I when E is a type
16079 and something else, that I can be a reference to a static member.
16081 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
16082 handle a particular array type to create byte blobs, it is just
16083 something we dont generate byteblobs for.
16085 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
16088 * location.cs (Push): remove the key from the hashtable that we
16089 are about to add. This happens for empty files.
16091 * driver.cs: Dispose files after we have parsed them.
16093 (tokenize): new function that only runs the tokenizer on its
16094 input, for speed testing.
16096 2001-12-26 Ravi Pratap <ravi@ximian.com>
16098 * class.cs (Event.Define): Define the private field only if there
16099 are no accessors defined.
16101 * expression.cs (ResolveMemberAccess): If there is no associated
16102 field with the event, that means we have an event defined with its
16103 own accessors and we should flag error cs0070 since transforming
16104 ourselves into a field is not valid in that case.
16106 * ecore.cs (SimpleName.DoResolve): Same as above.
16108 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
16109 and charset to sane values.
16111 2001-12-25 Ravi Pratap <ravi@ximian.com>
16113 * assign.cs (DoResolve): Perform check on events only if they
16114 are being accessed outside the declaring type.
16116 * cs-parser.jay (event_declarations): Update rules to correctly
16117 set the type of the implicit parameter etc.
16119 (add_accessor, remove_accessor): Set current local parameters.
16121 * expression.cs (Binary): For delegate addition and subtraction,
16122 cast the return value from the method into the appropriate delegate
16125 2001-12-24 Ravi Pratap <ravi@ximian.com>
16127 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
16128 of these as the workaround is unnecessary.
16130 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
16131 delegate data - none of that is needed at all.
16133 Re-write bits to extract the instance expression and the delegate method
16136 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
16139 * attribute.cs (ApplyAttributes): New method to take care of common tasks
16140 of attaching attributes instead of duplicating code everywhere.
16142 * everywhere : Update code to do attribute emission using the above method.
16144 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16146 * expression.cs (IsParamsMethodApplicable): if there are not
16147 parameters, return immediately.
16149 * ecore.cs: The 0 literal can be implicity converted to an enum
16152 (SimpleName.DoResolve): First lookup the type, then lookup the
16155 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
16156 want to get its address. If the InstanceExpression is not
16157 addressable, store the result in a temporary variable, then get
16160 * codegen.cs: Only display 219 errors on warning level or above.
16162 * expression.cs (ArrayAccess): Make it implement the
16163 IMemoryLocation interface.
16165 (Binary.DoResolve): handle the operator == (object a, object b)
16166 and operator != (object a, object b) without incurring into a
16167 BoxedCast (because 5 != o should never be performed).
16169 Handle binary enumerator operators.
16171 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
16172 value type, otherwise use Ldelem_ref.
16174 Use precomputed names;
16176 (AddressOf): Implement address of
16178 * cs-parser.jay (labeled_statement): Fix recursive block
16179 addition by reworking the production.
16181 * expression.cs (New.DoEmit): New has a special case:
16183 If we are dealing with a ValueType, we have a few
16184 situations to deal with:
16186 * The target of New is a ValueType variable, that is
16187 easy, we just pass this as the variable reference
16189 * The target of New is being passed as an argument,
16190 to a boxing operation or a function that takes a
16193 In this case, we need to create a temporary variable
16194 that is the argument of New.
16197 2001-12-23 Ravi Pratap <ravi@ximian.com>
16199 * rootcontext.cs (LookupType): Check that current_type is not null before
16200 going about looking at nested types.
16202 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
16203 not implement the IAssignMethod interface any more.
16205 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
16206 where we tranform them into FieldExprs if they are being resolved from within
16207 the declaring type.
16209 * ecore.cs (SimpleName.DoResolve): Do the same here.
16211 * assign.cs (DoResolve, Emit): Clean up code considerably.
16213 * ../errors/bug10.cs : Add.
16215 * ../errors/cs0070.cs : Add.
16217 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
16219 * assign.cs : Get rid of EventIsLocal everywhere.
16221 2001-12-23 Miguel de Icaza <miguel@ximian.com>
16223 * ecore.cs (ConvertIntLiteral): finished the implementation.
16225 * statement.cs (SwitchLabel): Convert the value we are using as a
16226 key before looking up the table.
16228 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16230 * codegen.cs (EmitTopBlock): Require a Location argument now.
16232 * cs-parser.jay (constructor_declarator): We need to setup
16233 current_local_parameters before we parse the
16234 opt_constructor_initializer, to allow the variables to be bound
16235 to the constructor arguments.
16237 * rootcontext.cs (LookupType): First lookup nested classes in our
16238 class and our parents before we go looking outside our class.
16240 * expression.cs (ConstantFold): Extract/debox the values at the
16243 * rootcontext.cs (EmitCode): Resolve the constants first before we
16244 resolve the types. This is not really needed, but it helps debugging.
16246 * statement.cs: report location.
16248 * cs-parser.jay: pass location to throw statement.
16250 * driver.cs: Small bug fix.
16252 * report.cs: Updated format to be 4-zero filled digits.
16254 2001-12-22 Ravi Pratap <ravi@ximian.com>
16256 * expression.cs (CheckIndices): Fix minor bug where the wrong
16257 variable was being referred to ;-)
16259 (DoEmit): Do not call EmitStaticInitializers when the
16260 underlying type is System.Object.
16262 2001-12-21 Ravi Pratap <ravi@ximian.com>
16264 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
16265 and do the usual workaround for SRE.
16267 * class.cs (MyEventBuilder.EventType): New member to get at the type
16268 of the event, quickly.
16270 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
16272 * assign.cs (Assign.DoResolve): Handle the case when the target
16273 is an EventExpr and perform the necessary checks.
16275 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
16278 (SimpleName.MemberStaticCheck): Include check for EventExpr.
16280 (EventExpr): Set the type in the constructor itself since we
16281 are meant to be born fully resolved.
16283 (EventExpr.Define): Revert code I wrote earlier.
16285 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
16286 instance expression is null. The instance expression is a This in that case
16287 or a null, depending on whether it is a static method or not.
16289 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
16290 refers to more than one method.
16292 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
16293 and accordingly flag errors.
16295 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16297 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
16299 2001-12-22 Miguel de Icaza <miguel@ximian.com>
16301 * location.cs (ToString): Provide useful rutine.
16303 2001-12-21 Miguel de Icaza <miguel@ximian.com>
16305 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
16306 objects, return the actual integral boxed.
16308 * statement.cs (SwitchLabel): define an ILLabel for each
16311 (Switch.CheckSwitch): If the value is a Literal, extract
16312 the underlying literal.
16314 Also in the unused hashtable we had, add the SwitchLabel so we can
16315 quickly look this value up.
16317 * constant.cs: Implement a bunch of new constants. Rewrite
16318 Literal based on this. Made changes everywhere to adapt to this.
16320 * expression.cs (Expression.MakeByteBlob): Optimize routine by
16321 dereferencing array only once, and also copes with enumrations.
16323 bytes are two bytes wide, not one.
16325 (Cast): Perform constant conversions.
16327 * ecore.cs (TryImplicitIntConversion): Return literals instead of
16328 wrappers to the literals here.
16330 * expression.cs (DoNumericPromotions): long literals can converted
16331 to ulong implicity (this is taken care of elsewhere, but I was
16332 missing this spot).
16334 * ecore.cs (Expression.Literalize): Make the return type Literal,
16335 to improve type checking.
16337 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
16339 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16341 * literal.cs: Revert code from ravi that checked the bounds. The
16342 bounds are sane by the definition of the type itself.
16344 * typemanager.cs: Fix implementation of ImplementsInterface. We
16345 need to actually look up in our parent hierarchy for interfaces
16348 * const.cs: Use the underlying type for enumerations
16350 * delegate.cs: Compute the basename for the delegate creation,
16351 that should fix the delegate test case, and restore the correct
16352 Type Lookup semantics in rootcontext
16354 * rootcontext.cs: Revert Ravi's last patch. The correct way of
16355 referencing a nested type with the Reflection API is using the "+"
16358 * cs-parser.jay: Do not require EOF token at the end.
16360 2001-12-20 Ravi Pratap <ravi@ximian.com>
16362 * rootcontext.cs (LookupType): Concatenate type names with
16363 a '.' instead of a '+' The test suite passes again.
16365 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
16366 field of the enumeration.
16368 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
16369 the case when the member is an EventExpr.
16371 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
16372 static has an associated instance expression.
16374 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
16376 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
16378 * class.cs (Event.Define): Register event and perform appropriate checks
16381 We define the Add and Remove methods even if the use provides none because
16382 in that case, we provide default implementations ourselves.
16384 Define a private field of the type of the event. This is done by the CSC compiler
16385 and we should be doing it too ;-)
16387 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
16388 More methods we use in code we generate.
16390 (multicast_delegate_type, delegate_type): Two separate types since the distinction
16393 (InitCoreTypes): Update accordingly for the above.
16395 * class.cs (Event.Emit): Generate code for default accessors that we provide
16397 (EmitDefaultMethod): Do the job in the above.
16399 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
16402 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16404 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
16405 builders even if we were missing one.
16407 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
16408 pass the Basename as our class name instead of the Name. The
16409 basename will be correctly composed for us.
16411 * parameter.cs (Paramters): Now takes a Location argument.
16413 * decl.cs (DeclSpace.LookupType): Removed convenience function and
16414 make all the code call directly LookupType in RootContext and take
16415 this chance to pass the Location information everywhere.
16417 * Everywhere: pass Location information.
16419 2001-12-19 Miguel de Icaza <miguel@ximian.com>
16421 * class.cs (Constructor.Define): Updated way of detecting the
16422 length of the parameters.
16424 (TypeContainer.DefineType): Use basename as the type name for
16427 (TypeContainer.Define): Do not recursively define types here, as
16428 definition is taken care in order by the RootContext.
16430 * tree.cs: Keep track of namespaces in a per-file basis.
16432 * parameter.cs (Parameter.ComputeSignature): Update to use
16435 (Parameters.GetSignature): ditto.
16437 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
16438 instead of a TypeContainer.
16440 (Interface.SemanticAnalysis): Use `this' instead of our parent to
16441 resolve names. Because we need to be resolve in our context, not
16444 * driver.cs: Implement response files.
16446 * class.cs (TypeContainer.DefineType): If we are defined, do not
16447 redefine ourselves.
16449 (Event.Emit): Emit the code for add/remove handlers.
16450 (Event.Define): Save the MethodBuilders for add/remove.
16452 * typemanager.cs: Use pair here too.
16454 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
16455 DictionaryEntry requires the first argument to be non-null.
16457 (enum_declaration): Compute full name for registering the
16460 (delegate_declaration): Instead of using
16461 formal_parameter_list, use opt_formal_parameter_list as the list
16464 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
16465 (EventParsing): New property that controls whether `add' and
16466 `remove' are returned as tokens or identifiers (for events);
16468 2001-12-19 Ravi Pratap <ravi@ximian.com>
16470 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
16471 use MyEventBuilder only and let it wrap the real builder for us.
16473 (MyEventBuilder): Revamp constructor etc.
16475 Implement all operations that we perform on EventBuilder in precisely the same
16478 (FindMembers): Update to use the EventBuilder member.
16480 (Event.Emit): Update accordingly.
16482 2001-12-18 Ravi Pratap <ravi@ximian.com>
16484 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
16485 by calling the appropriate methods.
16487 (GetCustomAttributes): Make stubs as they cannot possibly do anything
16490 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
16492 2001-12-17 Ravi Pratap <ravi@ximian.com>
16494 * delegate.cs (Delegate.Populate): Check that the return type
16495 and various parameters types are indeed accessible.
16497 * class.cs (Constructor.Define): Same here.
16499 (Field.Define): Ditto.
16501 (Event.Define): Ditto.
16503 (Operator.Define): Check that the underlying Method defined itself
16504 correctly - so it's MethodBuilder should not be null.
16506 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
16507 expression happens to be null.
16509 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
16510 members but as of now we don't seem to be able to do anything really useful with it.
16512 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
16513 not the EventBuilder.
16515 2001-12-18 Miguel de Icaza <miguel@ximian.com>
16517 * cs-tokenizer.cs: Add support for defines.
16518 Add support for #if, #elif, #else, #endif
16520 (eval_var): evaluates a variable.
16521 (eval): stubbed for evaluating functions.
16523 * cs-parser.jay: Pass the defines information
16525 * driver.cs: Add --define command line option.
16527 * decl.cs: Move MemberCore here.
16529 Make it the base class for DeclSpace. This allows us to catch and
16530 report 108 and 109 for everything now.
16532 * class.cs (TypeContainer.Define): Extract all the members
16533 before populating and emit the warning 108 (new keyword required
16534 to override) instead of having each member implement this.
16536 (MemberCore.Define): New abstract method, we will be using this in
16537 the warning reporting engine in Populate.
16539 (Operator.Define): Adjust to new MemberCore protocol.
16541 * const.cs (Const): This does not derive from Expression, it is a
16542 temporary object we use to create fields, it is a MemberCore.
16544 * class.cs (Method.Define): Allow the entry point to be in a
16547 * driver.cs: Rewrite the argument handler to clean it up a bit.
16549 * rootcontext.cs: Made it just an auxiliary namespace feature by
16550 making everything static.
16552 * driver.cs: Adapt code to use RootContext type name instead of
16555 * delegate.cs: Remove RootContext argument.
16557 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
16560 * class.cs (Event.Define): The lookup can fail.
16562 * cs-tokenizer.cs: Begin implementation of pre-procesor.
16564 * expression.cs: Resolve the this instance before invoking the code.
16566 2001-12-17 Miguel de Icaza <miguel@ximian.com>
16568 * cs-parser.jay: Add a production in element_access that allows
16569 the thing to become a "type" reference. This way we can parse
16570 things like "(string [])" as a type.
16572 Note that this still does not handle the more complex rules of
16576 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
16578 * ecore.cs: (CopyNewMethods): new utility function used to
16579 assemble the list of methods from running FindMembers.
16581 (MemberLookup): Rework FindMembers so that
16583 2001-12-16 Miguel de Icaza <miguel@ximian.com>
16585 * class.cs (TypeContainer): Remove Delegates who fail to be
16588 * delegate.cs (Populate): Verify that we dont get null return
16589 values. TODO: Check for AsAccessible.
16591 * cs-parser.jay: Use basename to emit error 574 (destructor should
16592 have the same name as container class), not the full name.
16594 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
16595 possible representation.
16597 Also implements integer type suffixes U and L.
16599 2001-12-15 Miguel de Icaza <miguel@ximian.com>
16601 * expression.cs (ArrayCreation.DoResolve): We need to do the
16602 argument resolution *always*.
16604 * decl.cs: Make this hold the namespace. Hold the root context as
16606 (LookupType): Move here.
16608 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
16610 * location.cs (Row, Name): Fixed the code, it was always returning
16611 references to the first file.
16613 * interface.cs: Register properties defined through interfaces.
16615 * driver.cs: Add support for globbing on the command line
16617 * class.cs (Field): Make it derive from MemberCore as well.
16620 2001-12-15 Ravi Pratap <ravi@ximian.com>
16622 * class.cs (Event::Define): Check that the type of the event is a delegate
16623 type else flag error #66.
16625 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
16628 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
16629 values of EntryPoint, CharSet etc etc.
16631 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
16633 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
16634 be null and we should ignore this. I am not sure if this is really clean. Apparently,
16635 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
16636 which needs this to do its work.
16638 * ../errors/cs0066.cs : Add.
16640 2001-12-14 Miguel de Icaza <miguel@ximian.com>
16642 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
16645 * class.cs: (MethodSignature.MethodSignature): Removed hack that
16646 clears out the parameters field.
16647 (MemberSignatureCompare): Cleanup
16649 (MemberCore): New base class used to share code between MethodCore
16652 (RegisterRequiredImplementations) BindingFlags.Public requires
16653 either BindingFlags.Instace or Static. Use instance here.
16655 (Property): Refactored code to cope better with the full spec.
16657 * parameter.cs (GetParameterInfo): Return an empty array instead
16660 * class.cs (Property): Abstract or extern properties have no bodies.
16662 * parameter.cs (GetParameterInfo): return a zero-sized array.
16664 * class.cs (TypeContainer.MethodModifiersValid): Move all the
16665 method modifier validation to the typecontainer so we can reuse
16666 this on properties.
16668 (MethodCore.ParameterTypes): return an empty sized array of types.
16670 (Property.Define): Test property modifier validity.
16672 Add tests for sealed/override too.
16674 (Method.Emit): abstract or extern methods have no bodies.
16676 2001-12-14 Ravi Pratap <ravi@ximian.com>
16678 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
16681 (Method::Define, ::Emit): Modify accordingly.
16683 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
16685 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
16687 * makefile: Pass in /unsafe.
16689 2001-12-13 Miguel de Icaza <miguel@ximian.com>
16691 * class.cs (MakeKey): Kill routine.
16693 * class.cs (TypeContainer.Define): Correctly define explicit
16694 method implementations (they require the full interface name plus
16697 * typemanager.cs: Deply the PtrHashtable here and stop using the
16698 lame keys. Things work so much better.
16700 This of course broke everyone who depended on `RegisterMethod' to
16701 do the `test for existance' test. This has to be done elsewhere.
16703 * support.cs (PtrHashtable): A hashtable that avoid comparing with
16704 the object stupid Equals method (because, that like fails all over
16705 the place). We still do not use it.
16707 * class.cs (TypeContainer.SetRequiredInterface,
16708 TypeContainer.RequireMethods): Killed these two routines and moved
16709 all the functionality to RegisterRequiredImplementations.
16711 (TypeContainer.RegisterRequiredImplementations): This routine now
16712 registers all the implementations required in an array for the
16713 interfaces and abstract methods. We use an array of structures
16714 which can be computed ahead of time to reduce memory usage and we
16715 also assume that lookups are cheap as most classes will not
16716 implement too many interfaces.
16718 We also avoid creating too many MethodSignatures.
16720 (TypeContainer.IsInterfaceMethod): Update and optionally does not
16721 clear the "pending" bit if we find that there are problems with
16724 (TypeContainer.VerifyPendingMethods): Update to report errors of
16725 methods that look like implementations but are not.
16727 (TypeContainer.Define): Add support for explicit interface method
16730 2001-12-12 Miguel de Icaza <miguel@ximian.com>
16732 * typemanager.cs: Keep track of the parameters here instead of
16733 being a feature of the TypeContainer.
16735 * class.cs: Drop the registration of parameters here, as
16736 InterfaceMethods are also interface declarations.
16738 * delegate.cs: Register methods with the TypeManager not only with
16739 the TypeContainer. This code was buggy.
16741 * interface.cs: Full registation here.
16743 2001-12-11 Miguel de Icaza <miguel@ximian.com>
16745 * expression.cs: Remove reducer for binary expressions, it can not
16748 * const.cs: Put here the code that used to go into constant.cs
16750 * constant.cs: Put here the code for constants, this is a new base
16751 class for Literals.
16753 * literal.cs: Make Literal derive from Constant.
16755 2001-12-09 Miguel de Icaza <miguel@ximian.com>
16757 * statement.cs (Return.Emit): Report error 157 if the user
16758 attempts to return from a finally block.
16760 (Return.Emit): Instead of emitting a return, jump to the end of
16763 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
16764 LocalBuilder to store the result of the function. ReturnLabel is
16765 the target where we jump.
16768 2001-12-09 Radek Doulik <rodo@ximian.com>
16770 * cs-parser.jay: remember alias in current namespace
16772 * ecore.cs (SimpleName::DoResolve): use aliases for types or
16775 * class.cs (LookupAlias): lookup alias in my_namespace
16777 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
16779 (LookupAlias): lookup alias in this and if needed in parent
16782 2001-12-08 Miguel de Icaza <miguel@ximian.com>
16786 * rootcontext.cs: (ModuleBuilder) Made static, first step into
16787 making things static. I need this to avoid passing the
16788 TypeContainer when calling ParameterType.
16790 * support.cs (InternalParameters.ParameterType): Remove ugly hack
16791 that did string manipulation to compute the type and then call
16792 GetType. Use Parameter.ParameterType instead.
16794 * cs-tokenizer.cs: Consume the suffix for floating values.
16796 * expression.cs (ParameterReference): figure out whether this is a
16797 reference parameter or not. Kill an extra variable by computing
16798 the arg_idx during emission.
16800 * parameter.cs (Parameters.GetParameterInfo): New overloaded
16801 function that returns whether a parameter is an out/ref value or not.
16803 (Parameter.ParameterType): The type of the parameter (base,
16804 without ref/out applied).
16806 (Parameter.Resolve): Perform resolution here.
16807 (Parameter.ExternalType): The full type (with ref/out applied).
16809 * statement.cs (Using.Emit, Using.EmitExpression): Implement
16810 support for expressions on the using statement.
16812 2001-12-07 Miguel de Icaza <miguel@ximian.com>
16814 * statement.cs (Using.EmitLocalVariableDecls): Split the
16815 localvariable handling of the using statement.
16817 (Block.EmitMeta): Keep track of variable count across blocks. We
16818 were reusing slots on separate branches of blocks.
16820 (Try.Emit): Emit the general code block, we were not emitting it.
16822 Check the type of the declaration to be an IDisposable or
16823 something that can be implicity converted to it.
16825 Emit conversions if required.
16827 * ecore.cs (EmptyExpression): New utility class.
16828 (Expression.ImplicitConversionExists): New utility function.
16830 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16832 * statement.cs (Using): Implement.
16834 * expression.cs (LocalVariableReference): Support read only variables.
16836 * statement.cs: Remove the explicit emit for the Leave opcode.
16837 (VariableInfo): Add a readonly field.
16839 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16841 * ecore.cs (ConvCast): new class used to encapsulate the various
16842 explicit integer conversions that works in both checked and
16843 unchecked contexts.
16845 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16846 properly generate the overflow opcodes.
16848 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16850 * statement.cs: The correct type for the EmptyExpression is the
16851 element_type, not the variable type. Ravi pointed this out.
16853 2001-12-04 Ravi Pratap <ravi@ximian.com>
16855 * class.cs (Method::Define): Handle PInvoke methods specially
16856 by using DefinePInvokeMethod instead of the usual one.
16858 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16859 above to do the task of extracting information and defining the method.
16861 2001-12-04 Ravi Pratap <ravi@ximian.com>
16863 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16864 of the condition for string type.
16866 (Emit): Move that here.
16868 (ArrayCreation::CheckIndices): Keep string literals in their expression
16871 (EmitDynamicInitializers): Handle strings appropriately.
16873 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16875 * codegen.cs (EmitContext): Replace multiple variables with a
16876 single pointer to the current Switch statement.
16878 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16881 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16885 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16888 (Foreach.Emit): Foreach on arrays was not setting
16889 up the loop variables (for break/continue).
16891 (GotoCase): Semi-implented.
16893 2001-12-03 Ravi Pratap <ravi@ximian.com>
16895 * attribute.cs (CheckAttribute): Handle system attributes by using
16896 Attribute.GetAttributes to examine information we need.
16898 (GetValidPlaces): Same here.
16900 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16902 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16904 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16906 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16908 (Method::Emit): Handle the case when we are a PInvoke method.
16910 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16912 * expression.cs: Use ResolveWithSimpleName on compound names.
16914 2001-12-02 Ravi Pratap <ravi@ximian.com>
16916 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16917 before trying to reduce it.
16919 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16921 * constant.cs (LookupConstantValue): Implement.
16923 (EmitConstant): Use the above in emitting the constant.
16925 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16926 that are user-defined by doing a LookupConstantValue on them.
16928 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16931 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16933 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16935 (BaseAccess.DoResolve): Implement.
16937 (MemberAccess.DoResolve): Split this routine into a
16938 ResolveMemberAccess routine that can be used independently
16940 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16942 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16943 As that share bits of the implementation. Is returns a boolean,
16944 while As returns the Type that is being probed.
16946 2001-12-01 Ravi Pratap <ravi@ximian.com>
16948 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16949 instead of a Literal - much easier.
16951 (EnumInTransit): Remove - utterly useless :-)
16953 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16955 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16957 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16958 chain when we have no associated expression.
16960 2001-11-30 Ravi Pratap <ravi@ximian.com>
16962 * constant.cs (Define): Use Location while reporting the errror.
16964 Also emit a warning when 'new' is used and there is no inherited
16967 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16970 (LookupEnumValue): Implement to lookup an enum member's value and define it
16973 (Populate): Re-write accordingly to use the above routine.
16975 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16977 * expression.cs (This): Fix prototype for DoResolveLValue to
16978 override the base class DoResolveLValue.
16980 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16983 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16984 (we need to load the address of the field here). This fixes
16987 (FieldExpr.DoResolveLValue): Call the DoResolve
16988 function to initialize the Instance expression.
16990 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16991 correctly the GetEnumerator operation on a value type.
16993 * cs-parser.jay: Add more simple parsing error catches.
16995 * statement.cs (Switch): Add support for string switches.
16996 Handle null specially.
16998 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
17000 2001-11-28 Ravi Pratap <ravi@ximian.com>
17002 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
17004 (declare_local_constant): New helper function.
17006 * statement.cs (AddConstant): Keep a separate record of constants
17008 (IsConstant): Implement to determine if a variable is a constant.
17010 (GetConstantExpression): Implement.
17012 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
17014 * statement.cs (IsVariableDefined): Re-write.
17016 2001-11-27 Ravi Pratap <ravi@ximian.com>
17018 * class.cs (TypeContainer::FindMembers): Look for constants
17019 in the case when we are looking for MemberTypes.Field
17021 * expression.cs (MemberAccess::DoResolve): Check that in the
17022 case we are a FieldExpr and a Literal, we are not being accessed
17023 by an instance reference.
17025 * cs-parser.jay (local_constant_declaration): Implement.
17027 (declaration_statement): Implement for constant declarations.
17029 2001-11-26 Miguel de Icaza <miguel@ximian.com>
17031 * statement.cs (Switch): Catch double defaults.
17033 (Switch): More work on the switch() statement
17034 implementation. It works for integral values now, need to finish
17038 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17040 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
17041 integer literals into other integer literals. To be used by
17044 2001-11-24 Ravi Pratap <ravi@ximian.com>
17046 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
17049 (EmitDynamicInitializers): Cope with the above since we extract data
17050 directly from ArrayData now.
17052 (ExpectInitializers): Keep track of whether initializers are mandatory
17055 (Bounds): Make it a hashtable to prevent the same dimension being
17056 recorded for every element in that dimension.
17058 (EmitDynamicInitializers): Fix bug which prevented the Set array method
17061 Also fix bug which was causing the indices to be emitted in the reverse
17064 2001-11-24 Miguel de Icaza <miguel@ximian.com>
17066 * expression.cs (ArrayCreation): Implement the bits that Ravi left
17067 unfinished. They do not work, because the underlying code is
17070 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17072 * cs-parser.jay: Remove bogus fixme.
17074 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
17075 on Switch statement.
17077 2001-11-23 Ravi Pratap <ravi@ximian.com>
17079 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
17082 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
17083 parameter. Apparently, any expression is allowed.
17085 (ValidateInitializers): Update accordingly.
17087 (CheckIndices): Fix some tricky bugs thanks to recursion.
17089 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
17090 I was being completely brain-dead.
17092 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
17093 and re-write acordingly.
17095 (DelegateInvocation): Re-write accordingly.
17097 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
17099 (MakeByteBlob): Handle types more correctly.
17101 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
17102 initialization from expressions but it is incomplete because I am a complete
17105 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17107 * statement.cs (If.Emit): Fix a bug that generated incorrect code
17108 on If. Basically, we have to return `true' (ie, we do return to
17109 our caller) only if both branches of the if return.
17111 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
17112 short-circuit operators, handle them as short circuit operators.
17114 (Cast.DoResolve): Resolve type.
17115 (Cast.Cast): Take an expression as the target type.
17117 * cs-parser.jay (cast_expression): Remove old hack that only
17118 allowed a limited set of types to be handled. Now we take a
17119 unary_expression and we resolve to a type during semantic
17122 Use the grammar productions from Rhys to handle casts (this is
17123 not complete like Rhys syntax yet, we fail to handle that corner
17124 case that C# has regarding (-x), but we will get there.
17126 2001-11-22 Ravi Pratap <ravi@ximian.com>
17128 * class.cs (EmitFieldInitializer): Take care of the case when we have a
17129 field which is an array type.
17131 * cs-parser.jay (declare_local_variables): Support array initialization too.
17133 * typemanager.cs (MakeKey): Implement.
17135 (everywhere): Use the above appropriately.
17137 * cs-parser.jay (for_statement): Update for array initialization while
17138 declaring variables.
17140 * ecore.cs : The error message was correct, it's the variable's names that
17141 were misleading ;-) Make the code more readable.
17143 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
17144 the correct type etc.
17146 (ConvertExplicit): Handle Enum types by examining the underlying type.
17148 2001-11-21 Ravi Pratap <ravi@ximian.com>
17150 * parameter.cs (GetCallingConvention): Always return
17151 CallingConventions.Standard for now.
17153 2001-11-22 Miguel de Icaza <miguel@ximian.com>
17155 * expression.cs (Binary.ResolveOperator): Update the values of `l'
17156 and `r' after calling DoNumericPromotions.
17158 * ecore.cs: Fix error message (the types were in the wrong order).
17160 * statement.cs (Foreach.ProbeCollectionType): Need to pass
17161 BindingFlags.Instance as well
17163 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
17164 implicit int literal conversion in an empty cast so that we
17165 propagate the right type upstream.
17167 (UnboxCast): new class used to unbox value types.
17168 (Expression.ConvertExplicit): Add explicit type conversions done
17171 (Expression.ImplicitNumericConversion): Oops, forgot to test for
17172 the target type before applying the implicit LongLiterals to ULong
17175 2001-11-21 Miguel de Icaza <miguel@ximian.com>
17177 * cs-parser.jay (for_statement): Reworked the way For works: now
17178 we declare manually any variables that are introduced in
17179 for_initializer to solve the problem of having out-of-band code
17180 emition (that is what got for broken).
17182 (declaration_statement): Perform the actual variable declaration
17183 that used to be done in local_variable_declaration here.
17185 (local_variable_declaration): Do not declare anything, just pass
17186 the information on a DictionaryEntry
17188 2001-11-20 Ravi Pratap <ravi@ximian.com>
17190 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
17191 re-write of the logic to now make it recursive.
17193 (UpdateIndices): Re-write accordingly.
17195 Store element data in a separate ArrayData list in the above methods.
17197 (MakeByteBlob): Implement to dump the array data into a byte array.
17199 2001-11-19 Ravi Pratap <ravi@ximian.com>
17201 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
17204 * constant.cs (Define): Implement.
17206 (EmitConstant): Re-write fully.
17208 Pass in location info.
17210 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
17213 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
17214 DictionaryEntry since we need location info too.
17216 (constant_declaration): Update accordingly.
17218 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
17219 code into another method : UpdateIndices.
17221 2001-11-18 Ravi Pratap <ravi@ximian.com>
17223 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
17224 some type checking etc.
17226 2001-11-17 Ravi Pratap <ravi@ximian.com>
17228 * expression.cs (ArrayCreation::ValidateInitializers): Implement
17229 bits to provide dimension info if the user skips doing that.
17231 Update second constructor to store the rank correctly.
17233 2001-11-16 Ravi Pratap <ravi@ximian.com>
17235 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
17236 and try to implement.
17238 * ../errors/cs0150.cs : Add.
17240 * ../errors/cs0178.cs : Add.
17242 2001-11-16 Miguel de Icaza <miguel@ximian.com>
17244 * statement.cs: Implement foreach on multi-dimensional arrays.
17246 * parameter.cs (Parameters.GetParameterByName): Also lookup the
17247 name of the params argument.
17249 * expression.cs: Use EmitStoreOpcode to get the right opcode while
17250 initializing the array.
17252 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
17253 we can use this elsewhere.
17255 * statement.cs: Finish implementation of foreach for single
17258 * cs-parser.jay: Use an out-of-band stack to pass information
17259 around, I wonder why I need this.
17261 foreach_block: Make the new foreach_block the current_block.
17263 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
17264 function used to return a static Parameters structure. Used for
17265 empty parameters, as those are created very frequently.
17267 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
17269 2001-11-15 Ravi Pratap <ravi@ximian.com>
17271 * interface.cs : Default modifier is private, not public. The
17272 make verify test passes again.
17274 2001-11-15 Ravi Pratap <ravi@ximian.com>
17276 * support.cs (ReflectionParameters): Fix logic to determine
17277 whether the last parameter is a params one. Test 9 passes again.
17279 * delegate.cs (Populate): Register the builders we define with
17280 RegisterParameterForBuilder. Test 19 passes again.
17282 * cs-parser.jay (property_declaration): Reference $6 instead
17283 of $$ to get at the location.
17285 (indexer_declaration): Similar stuff.
17287 (attribute): Ditto.
17289 * class.cs (Property): Register parameters for the Get and Set methods
17290 if they exist. Test 23 passes again.
17292 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
17293 call to EmitArguments as we are sure there aren't any params arguments.
17294 Test 32 passes again.
17296 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
17297 IndexOutOfRangeException.
17299 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
17300 Test 33 now passes again.
17302 2001-11-15 Miguel de Icaza <miguel@ximian.com>
17304 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
17305 broke a bunch of things. Will have to come up with a better way
17306 of tracking locations.
17308 * statement.cs: Implemented foreach for single dimension arrays.
17310 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17312 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
17313 an error. This removes the lookup from the critical path.
17315 * cs-parser.jay: Removed use of temporary_loc, which is completely
17318 2001-11-14 Miguel de Icaza <miguel@ximian.com>
17320 * support.cs (ReflectionParameters.ParameterModifier): Report
17321 whether the argument is a PARAMS argument or not.
17323 * class.cs: Set the attribute `ParamArrayAttribute' on the
17324 parameter argument.
17326 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
17327 and cons_param_array_attribute (ConstructorInfo for
17328 ParamArrayAttribute).,
17330 * codegen.cs: Emit the return using the `Return' statement, that
17331 way we can report the error correctly for missing return values.
17333 * class.cs (Method.Emit): Clean up.
17335 * expression.cs (Argument.Resolve): Take another argument: the
17336 location where this argument is used. Notice that this is not
17337 part of the "Argument" class as to reduce the size of the
17338 structure (we know the approximate location anyways).
17340 Test if the argument is a variable-reference, if not, then
17341 complain with a 206.
17343 (Argument.Emit): Emit addresses of variables.
17345 (Argument.FullDesc): Simplify.
17347 (Invocation.DoResolve): Update for Argument.Resolve.
17349 (ElementAccess.DoResolve): ditto.
17351 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
17352 method should be virtual, as this method is always virtual.
17354 (NewDelegate.DoResolve): Update for Argument.Resolve.
17356 * class.cs (ConstructorInitializer.DoResolve): ditto.
17358 * attribute.cs (Attribute.Resolve): ditto.
17360 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17362 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
17364 * expression.cs (ParameterReference): Drop IStackStorage and implement
17365 IAssignMethod instead.
17367 (LocalVariableReference): ditto.
17369 * ecore.cs (FieldExpr): Drop IStackStorage and implement
17370 IAssignMethod instead.
17372 2001-11-13 Miguel de Icaza <miguel@ximian.com>
17374 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
17375 enumerations that are used in heavily used structures derive from
17376 byte in a laughable and pathetic attempt to reduce memory usage.
17377 This is the kind of pre-optimzations that you should not do at
17378 home without adult supervision.
17380 * expression.cs (UnaryMutator): New class, used to handle ++ and
17381 -- separatedly from the other unary operators. Cleans up the
17382 code, and kills the ExpressionStatement dependency in Unary.
17384 (Unary): Removed `method' and `Arguments' from this class, making
17385 it smaller, and moving it all to SimpleCall, so I can reuse this
17386 code in other locations and avoid creating a lot of transient data
17387 strucutres when not required.
17389 * cs-parser.jay: Adjust for new changes.
17391 2001-11-11 Miguel de Icaza <miguel@ximian.com>
17393 * enum.cs (Enum.Populate): If there is a failure during
17396 * cs-parser.jay (opt_enum_base): we used to catch type errors
17397 here, but this is really incorrect. The type error should be
17398 catched during semantic analysis.
17400 2001-12-11 Ravi Pratap <ravi@ximian.com>
17402 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
17403 current_local_parameters as expected since I, in my stupidity, had forgotten
17406 * attribute.cs (GetValidPlaces): Fix stupid bug.
17408 * class.cs (Method::Emit): Perform check on applicability of attributes.
17410 (Constructor::Emit): Ditto.
17412 (Field::Emit): Ditto.
17414 (Field.Location): Store location information.
17416 (Property, Event, Indexer, Operator): Ditto.
17418 * cs-parser.jay (field_declaration): Pass in location for each field.
17420 * ../errors/cs0592.cs : Add.
17422 2001-11-12 Ravi Pratap <ravi@ximian.com>
17424 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
17426 (InitCoreTypes): Update accordingly.
17428 (RegisterAttrType, LookupAttr): Implement.
17430 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
17431 info about the same.
17433 (Resolve): Update to populate the above as necessary.
17435 (Error592): Helper.
17437 (GetValidPlaces): Helper to the above.
17439 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
17441 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
17443 2001-11-12 Ravi Pratap <ravi@ximian.com>
17445 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
17447 * ../errors/cs0617.cs : Add.
17449 2001-11-11 Ravi Pratap <ravi@ximian.com>
17451 * enum.cs (Emit): Rename to Populate to be more consistent with what
17452 we expect it to do and when exactly it is called.
17454 * class.cs, rootcontext.cs : Update accordingly.
17456 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
17457 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
17459 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
17461 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
17462 of a fieldinfo using the above, when dealing with a FieldBuilder.
17464 2001-11-10 Ravi Pratap <ravi@ximian.com>
17466 * ../errors/cs0031.cs : Add.
17468 * ../errors/cs1008.cs : Add.
17470 * ../errrors/cs0543.cs : Add.
17472 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
17475 (FindMembers): Implement.
17477 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
17478 enums and delegates too.
17480 (enum_types): Rename to builder_to_enum.
17482 (delegate_types): Rename to builder_to_delegate.
17484 * delegate.cs (FindMembers): Implement.
17486 2001-11-09 Ravi Pratap <ravi@ximian.com>
17488 * typemanager.cs (IsEnumType): Implement.
17490 * enum.cs (Emit): Re-write parts to account for the underlying type
17491 better and perform checking etc.
17493 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
17494 of the underlying type.
17496 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
17499 * enum.cs (error31): Helper to report error #31.
17501 * cs-parser.jay (enum_declaration): Store location of each member too.
17503 * enum.cs (member_to_location): New hashtable.
17505 (AddEnumMember): Update location hashtable.
17507 (Emit): Use the location of each member while reporting errors.
17509 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17511 * cs-parser.jay: A for_initializer if is a
17512 local_variable_declaration really ammount to have an implicit
17513 block with the variable declaration and no initializer for for.
17515 * statement.cs (For.Emit): Cope with null initializers.
17517 This fixes the infinite loop on for initializers.
17519 2001-11-08 Miguel de Icaza <miguel@ximian.com>
17521 * enum.cs: More cleanup.
17523 * ecore.cs: Remove dead code.
17525 * class.cs (Property.Emit): More simplification.
17526 (Event.Emit): ditto.
17528 Reworked to have less levels of indentation.
17530 2001-11-08 Ravi Pratap <ravi@ximian.com>
17532 * class.cs (Property): Emit attributes.
17542 * enum.cs (Emit): Ditto.
17544 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
17547 * class.cs (Field, Event, etc.): Move attribute generation into the
17548 Emit method everywhere.
17550 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
17551 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
17552 as we had no way of defining nested enums !
17554 * rootcontext.cs : Adjust code accordingly.
17556 * typemanager.cs (AddEnumType): To keep track of enum types separately.
17558 2001-11-07 Ravi Pratap <ravi@ximian.com>
17560 * expression.cs (EvalConstantExpression): Move into ecore.cs
17562 * enum.cs (Enum): Rename some members and make them public and readonly
17563 according to our convention.
17565 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
17568 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
17570 (Enum::Emit): Write a simple version for now which doesn't try to compute
17571 expressions. I shall modify this to be more robust in just a while.
17573 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
17575 (TypeContainer::CloseType): Create the Enum types too.
17577 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
17579 * expression.cs (EvalConstantExpression): Get rid of completely.
17581 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
17582 user-defined values and other cases.
17584 (IsValidEnumLiteral): Helper function.
17586 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
17587 out there in the case we had a literal FieldExpr.
17589 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
17591 (Literalize): Revamp a bit to take two arguments.
17593 (EnumLiteral): New class which derives from Literal to wrap enum literals.
17595 2001-11-06 Ravi Pratap <ravi@ximian.com>
17597 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
17599 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
17601 (Resolve): Use the above to ensure we have proper initializers.
17603 2001-11-05 Ravi Pratap <ravi@ximian.com>
17605 * expression.cs (Expression::EvalConstantExpression): New method to
17606 evaluate constant expressions.
17608 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
17610 2001-11-07 Miguel de Icaza <miguel@ximian.com>
17612 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
17615 (Binary.ResolveOperator): Handle operator != (object a, object b)
17616 and operator == (object a, object b);
17618 (Binary.DoNumericPromotions): Indicate whether the numeric
17619 promotion was possible.
17621 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
17624 Made the ArrayAccess implement interface IAssignMethod instead of
17625 IStackStore as the order in which arguments are passed reflects
17628 * assign.cs: Instead of using expr.ExprClass to select the way of
17629 assinging, probe for the IStackStore/IAssignMethod interfaces.
17631 * typemanager.cs: Load InitializeArray definition.
17633 * rootcontext.cs (RootContext.MakeStaticData): Used to define
17634 static data that can be used to initialize arrays.
17636 2001-11-05 Miguel de Icaza <miguel@ximian.com>
17638 * expression.cs: Handle operator== and operator!= for booleans.
17640 (Conditioal.Reduce): Implement reducer for the ?: operator.
17642 (Conditional.Resolve): Implement dead code elimination.
17644 (Binary.Resolve): Catch string literals and return a new
17645 concatenated string.
17647 (Unary.Reduce): Implement reduction of unary expressions.
17649 * ecore.cs: Split out the expression core handling here.
17651 (Expression.Reduce): New method used to perform constant folding
17652 and CSE. This is needed to support constant-expressions.
17654 * statement.cs (Statement.EmitBoolExpression): Pass true and false
17655 targets, and optimize for !x.
17657 2001-11-04 Ravi Pratap <ravi@ximian.com>
17659 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
17660 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
17661 set custom atttributes.
17663 * literal.cs (Literal::GetValue): New abstract method to return the actual
17664 value of the literal, cast as an object.
17666 (*Literal): Implement GetValue method.
17668 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
17669 expressions to the arraylist but objects of type Argument.
17671 * class.cs (TypeContainer::Emit): Emit our attributes too.
17673 (Method::Emit, Constructor::Emit): Ditto.
17675 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
17676 to be ignoring earlier.
17678 2001-11-03 Ravi Pratap <ravi@ximian.com>
17680 * attribute.cs (AttributeSection::Define): Implement to do the business
17681 of constructing a CustomAttributeBuilder.
17683 (Attribute): New trivial class. Increases readability of code.
17685 * cs-parser.jay : Update accordingly.
17687 (positional_argument_list, named_argument_list, named_argument): New rules
17689 (attribute_arguments): Use the above so that we are more correct.
17691 2001-11-02 Ravi Pratap <ravi@ximian.com>
17693 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
17694 to perform all checks for a method with a params parameter.
17696 (Invocation::OverloadResolve): Update to use the above method and therefore
17697 cope correctly with params method invocations.
17699 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
17702 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
17703 constructors in our parent too because we can't afford to miss out on
17706 * attribute.cs (AttributeSection): New name for the class Attribute
17708 Other trivial changes to improve readability.
17710 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
17711 use the new class names.
17713 2001-11-01 Ravi Pratap <ravi@ximian.com>
17715 * class.cs (Method::Define): Complete definition for params types too
17717 (Indexer::Define): Ditto.
17719 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
17720 Cope everywhere with a request for info about the array parameter.
17722 2001-11-01 Ravi Pratap <ravi@ximian.com>
17724 * tree.cs (RecordNamespace): Fix up to check for the correct key.
17726 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
17727 local_variable_type to extract the string corresponding to the type.
17729 (local_variable_type): Fixup the action to use the new helper method.
17731 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
17734 * expression.cs : Clean out code which uses the above.
17736 2001-10-31 Ravi Pratap <ravi@ximian.com>
17738 * typemanager.cs (RegisterMethod): Check if we already have an existing key
17739 and bale out if necessary by returning a false.
17741 (RegisterProperty): Ditto.
17743 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
17744 and print out appropriate error messages.
17746 * interface.cs (everywhere): Ditto.
17748 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
17749 location to constructor.
17751 * class.cs (Property, Event, Indexer): Update accordingly.
17753 * ../errors/cs111.cs : Added.
17755 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
17756 of a method, as laid down by the spec.
17758 (Invocation::OverloadResolve): Use the above method.
17760 2001-10-31 Ravi Pratap <ravi@ximian.com>
17762 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
17763 now take a TypeContainer and a Parameters object.
17765 (ParameterData): Modify return type of ParameterModifier method to be
17766 Parameter.Modifier and not a string.
17768 (ReflectionParameters, InternalParameters): Update accordingly.
17770 * expression.cs (Argument::GetParameterModifier): Same here.
17772 * support.cs (InternalParameters::ParameterType): Find a better way of determining
17773 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
17774 symbol in it at all so maybe this is only for now.
17776 2001-10-30 Ravi Pratap <ravi@ximian.com>
17778 * support.cs (InternalParameters): Constructor now takes an extra argument
17779 which is the actual Parameters class.
17781 (ParameterDesc): Update to provide info on ref/out modifiers.
17783 * class.cs (everywhere): Update call to InternalParameters to pass in
17784 the second argument too.
17786 * support.cs (ParameterData): Add ParameterModifier, which is a method
17787 to return the modifier info [ref/out etc]
17789 (InternalParameters, ReflectionParameters): Implement the above.
17791 * expression.cs (Argument::ParameterModifier): Similar function to return
17792 info about the argument's modifiers.
17794 (Invocation::OverloadResolve): Update to take into account matching modifiers
17797 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
17798 a new SetFormalParameters object which we pass to InternalParameters.
17800 2001-10-30 Ravi Pratap <ravi@ximian.com>
17802 * expression.cs (NewArray): Merge into the ArrayCreation class.
17804 2001-10-29 Ravi Pratap <ravi@ximian.com>
17806 * expression.cs (NewArray): Merge classes NewBuiltinArray and
17807 NewUserdefinedArray into one as there wasn't much of a use in having
17810 * expression.cs (Argument): Change field's name to ArgType from Type.
17812 (Type): New readonly property which returns the proper type, taking into
17813 account ref/out modifiers.
17815 (everywhere): Adjust code accordingly for the above.
17817 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
17818 whether we are emitting for a ref or out parameter.
17820 * expression.cs (Argument::Emit): Use the above field to set the state.
17822 (LocalVariableReference::Emit): Update to honour the flag and emit the
17825 * parameter.cs (Attributes): Set the correct flags for ref parameters.
17827 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17829 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17831 (ReflectionParameters, InternalParameters): Implement the above method.
17833 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17836 (Invocation::FullMethodDesc): Ditto.
17838 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17840 * cs-parser.jay: Add extra production for the second form of array
17843 * expression.cs (ArrayCreation): Update to reflect the above
17846 * Small changes to prepare for Array initialization.
17848 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17850 * typemanager.cs (ImplementsInterface): interface might be null;
17851 Deal with this problem;
17853 Also, we do store negative hits on the cache (null values), so use
17854 this instead of calling t.GetInterfaces on the type everytime.
17856 2001-10-28 Ravi Pratap <ravi@ximian.com>
17858 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17860 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17861 split functionality out into different classes.
17863 (New::FormArrayType): Move into NewBuiltinArray.
17865 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17868 (NewBuiltinArray): New class to handle creation of built-in arrays.
17870 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17871 account creation of one-dimensional arrays.
17873 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17875 (NewUserdefinedArray::DoResolve): Implement.
17877 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17879 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17880 we maintain inside the TypeManager. This is necessary to perform lookups on the
17883 (LookupType): Update to perform GetType on the module builders too.
17885 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17887 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17889 2001-10-23 Ravi Pratap <ravi@ximian.com>
17891 * expression.cs (New::DoResolve): Implement guts of array creation.
17893 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17895 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17897 * expression.cs: Fix bug I introduced lsat night that broke
17900 (Expression.Resolve): Report a 246 error (can not resolve name)
17901 if we find a SimpleName in the stream.
17903 (Expression.ResolveLValue): Ditto.
17905 (Expression.ResolveWithSimpleName): This function is a variant of
17906 ResolveName, this one allows SimpleNames to be returned without a
17907 warning. The only consumer of SimpleNames is MemberAccess
17909 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17911 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17912 might arrive here. I have my doubts that this is correct.
17914 * statement.cs (Lock): Implement lock statement.
17916 * cs-parser.jay: Small fixes to support `lock' and `using'
17918 * cs-tokenizer.cs: Remove extra space
17920 * driver.cs: New flag --checked, allows to turn on integer math
17923 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17924 Threading.Monitor.Exit
17926 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17928 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17929 Expression Class to be IndexerAccess.
17931 Notice that Indexer::DoResolve sets the eclass to Value.
17933 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17935 * class.cs (TypeContainer::Emit): Emit code for indexers.
17937 * assign.cs (IAssignMethod): New interface implemented by Indexers
17938 and Properties for handling assignment.
17940 (Assign::Emit): Simplify and reuse code.
17942 * expression.cs (IndexerAccess, PropertyExpr): Implement
17943 IAssignMethod, clean up old code.
17945 2001-10-22 Ravi Pratap <ravi@ximian.com>
17947 * typemanager.cs (ImplementsInterface): New method to determine if a type
17948 implements a given interface. Provides a nice cache too.
17950 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17953 (ConvertReferenceExplicit): Ditto.
17955 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17956 various methods, with correct names etc.
17958 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17959 Operator.UnaryNegation.
17961 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17962 we have a unary plus or minus operator.
17964 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17967 * everywhere : update accordingly.
17969 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17972 * class.cs (Method::Define): For the case where we are implementing a method
17973 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17974 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17976 2001-10-21 Ravi Pratap <ravi@ximian.com>
17978 * interface.cs (FindMembers): Implement to work around S.R.E
17981 * typemanager.cs (IsInterfaceType): Implement.
17983 (FindMembers): Update to handle interface types too.
17985 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17986 use IsAssignableFrom as that is not correct - it doesn't work.
17988 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17989 and accordingly override EmitStatement.
17991 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17992 using the correct logic :-)
17994 2001-10-19 Ravi Pratap <ravi@ximian.com>
17996 * ../errors/cs-11.cs : Add to demonstrate error -11
17998 2001-10-17 Miguel de Icaza <miguel@ximian.com>
18000 * assign.cs (Assign::Resolve): Resolve right hand side first, and
18001 then pass this as a hint to ResolveLValue.
18003 * expression.cs (FieldExpr): Add Location information
18005 (FieldExpr::LValueResolve): Report assignment to readonly
18008 (Expression::ExprClassFromMemberInfo): Pass location information.
18010 (Expression::ResolveLValue): Add new method that resolves an
18013 (Expression::DoResolveLValue): Default invocation calls
18016 (Indexers): New class used to keep track of indexers in a given
18019 (IStackStore): Renamed from LValue, as it did not really describe
18020 what this did. Also ResolveLValue is gone from this interface and
18021 now is part of Expression.
18023 (ElementAccess): Depending on the element access type
18025 * typemanager.cs: Add `indexer_name_type' as a Core type
18026 (System.Runtime.CompilerServices.IndexerNameAttribute)
18028 * statement.cs (Goto): Take a location.
18030 2001-10-18 Ravi Pratap <ravi@ximian.com>
18032 * delegate.cs (Delegate::VerifyDelegate): New method to verify
18033 if two delegates are compatible.
18035 (NewDelegate::DoResolve): Update to take care of the case when
18036 we instantiate a delegate from another delegate.
18038 * typemanager.cs (FindMembers): Don't even try to look up members
18039 of Delegate types for now.
18041 2001-10-18 Ravi Pratap <ravi@ximian.com>
18043 * delegate.cs (NewDelegate): New class to take care of delegate
18046 * expression.cs (New): Split the delegate related code out into
18047 the NewDelegate class.
18049 * delegate.cs (DelegateInvocation): New class to handle delegate
18052 * expression.cs (Invocation): Split out delegate related code into
18053 the DelegateInvocation class.
18055 2001-10-17 Ravi Pratap <ravi@ximian.com>
18057 * expression.cs (New::DoResolve): Implement delegate creation fully
18058 and according to the spec.
18060 (New::DoEmit): Update to handle delegates differently.
18062 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
18063 because of which we were printing out arguments in reverse order !
18065 * delegate.cs (VerifyMethod): Implement to check if the given method
18066 matches the delegate.
18068 (FullDelegateDesc): Implement.
18070 (VerifyApplicability): Implement.
18072 * expression.cs (Invocation::DoResolve): Update to accordingly handle
18073 delegate invocations too.
18075 (Invocation::Emit): Ditto.
18077 * ../errors/cs1593.cs : Added.
18079 * ../errors/cs1594.cs : Added.
18081 * delegate.cs (InstanceExpression, TargetMethod): New properties.
18083 2001-10-16 Ravi Pratap <ravi@ximian.com>
18085 * typemanager.cs (intptr_type): Core type for System.IntPtr
18087 (InitCoreTypes): Update for the same.
18089 (iasyncresult_type, asynccallback_type): Ditto.
18091 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
18094 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
18097 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
18098 the builders for the 4 members of a delegate type :-)
18100 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
18103 * expression.cs (New::DoResolve): Implement guts for delegate creation.
18105 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
18107 2001-10-15 Miguel de Icaza <miguel@ximian.com>
18109 * statement.cs (Break::Emit): Implement.
18110 (Continue::Emit): Implement.
18112 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
18113 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
18114 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
18115 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
18118 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
18119 properties that track the label for the current loop (begin of the
18120 loop and end of the loop).
18122 2001-10-15 Ravi Pratap <ravi@ximian.com>
18124 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
18125 use of emitting anything at all.
18127 * class.cs, rootcontext.cs : Get rid of calls to the same.
18129 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
18131 (Populate): Define the constructor correctly and set the implementation
18134 * typemanager.cs (delegate_types): New hashtable to hold delegates that
18137 (AddDelegateType): Implement.
18139 (IsDelegateType): Implement helper method.
18141 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
18143 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
18144 and accordingly handle it.
18146 * delegate.cs (Populate): Take TypeContainer argument.
18147 Implement bits to define the Invoke method. However, I still haven't figured out
18148 how to take care of the native int bit :-(
18150 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
18151 Qualify the name of the delegate, not its return type !
18153 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
18156 (StandardConversionExists): Checking for array types turns out to be recursive.
18158 (ConvertReferenceExplicit): Implement array conversion.
18160 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
18162 2001-10-12 Ravi Pratap <ravi@ximian.com>
18164 * cs-parser.jay (delegate_declaration): Store the fully qualified
18165 name as it is a type declaration.
18167 * delegate.cs (ReturnType, Name): Rename members to these. Make them
18170 (DefineDelegate): Renamed from Define. Does the same thing essentially,
18171 as TypeContainer::DefineType.
18173 (Populate): Method in which all the definition of the various methods (Invoke)
18176 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
18179 (CloseDelegate): Finally creates the delegate.
18181 * class.cs (TypeContainer::DefineType): Update to define delegates.
18182 (Populate, Emit and CloseType): Do the same thing here too.
18184 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
18185 delegates in all these operations.
18187 2001-10-14 Miguel de Icaza <miguel@ximian.com>
18189 * expression.cs: LocalTemporary: a new expression used to
18190 reference a temporary that has been created.
18192 * assign.cs: Handle PropertyAccess back here, so that we can
18193 provide the proper semantic access to properties.
18195 * expression.cs (Expression::ConvertReferenceExplicit): Implement
18196 a few more explicit conversions.
18198 * modifiers.cs: `NEW' modifier maps to HideBySig.
18200 * expression.cs (PropertyExpr): Make this into an
18201 ExpressionStatement, and support the EmitStatement code path.
18203 Perform get/set error checking, clean up the interface.
18205 * assign.cs: recognize PropertyExprs as targets, and if so, turn
18206 them into toplevel access objects.
18208 2001-10-12 Miguel de Icaza <miguel@ximian.com>
18210 * expression.cs: PropertyExpr::PropertyExpr: use work around the
18213 * typemanager.cs: Keep track here of our PropertyBuilders again to
18214 work around lameness in SRE.
18216 2001-10-11 Miguel de Icaza <miguel@ximian.com>
18218 * expression.cs (LValue::LValueResolve): New method in the
18219 interface, used to perform a second resolution pass for LValues.
18221 (This::DoResolve): Catch the use of this in static methods.
18223 (This::LValueResolve): Implement.
18225 (This::Store): Remove warning, assigning to `this' in structures
18228 (Invocation::Emit): Deal with invocation of
18229 methods on value types. We need to pass the address to structure
18230 methods rather than the object itself. (The equivalent code to
18231 emit "this" for structures leaves the entire structure on the
18232 stack instead of a pointer to it).
18234 (ParameterReference::DoResolve): Compute the real index for the
18235 argument based on whether the method takes or not a `this' pointer
18236 (ie, the method is static).
18238 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
18239 value types returned from functions when we need to invoke a
18240 method on the sturcture.
18243 2001-10-11 Ravi Pratap <ravi@ximian.com>
18245 * class.cs (TypeContainer::DefineType): Method to actually do the business of
18246 defining the type in the Modulebuilder or Typebuilder. This is to take
18247 care of nested types which need to be defined on the TypeBuilder using
18248 DefineNestedMethod.
18250 (TypeContainer::GetClassBases): Implement. Essentially the code from the
18251 methods in RootContext, only ported to be part of TypeContainer.
18253 (TypeContainer::GetInterfaceOrClass): Ditto.
18255 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
18257 * interface.cs (Interface::DefineInterface): New method. Does exactly
18258 what RootContext.CreateInterface did earlier, only it takes care of nested types
18261 (Interface::GetInterfaces): Move from RootContext here and port.
18263 (Interface::GetInterfaceByName): Same here.
18265 * rootcontext.cs (ResolveTree): Re-write.
18267 (PopulateTypes): Re-write.
18269 * class.cs (TypeContainer::Populate): Populate nested types too.
18270 (TypeContainer::Emit): Emit nested members too.
18272 * typemanager.cs (AddUserType): Do not make use of the FullName property,
18273 instead just use the name argument passed in as it is already fully
18276 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
18277 to TypeContainer mapping to see if a type is user-defined.
18279 * class.cs (TypeContainer::CloseType): Implement.
18281 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
18282 the default constructor.
18284 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
18287 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
18289 * interface.cs (CloseType): Create the type here.
18291 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
18294 Remove all the methods which are now in TypeContainer.
18296 2001-10-10 Ravi Pratap <ravi@ximian.com>
18298 * delegate.cs (Define): Re-write bits to define the delegate
18301 2001-10-10 Miguel de Icaza <miguel@ximian.com>
18303 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
18305 * expression.cs (ImplicitReferenceConversion): handle null as well
18306 as a source to convert to any reference type.
18308 * statement.cs (Return): Perform any implicit conversions to
18309 expected return type.
18311 Validate use of return statement.
18313 * codegen.cs (EmitContext): Pass the expected return type here.
18315 * class.cs (Method, Constructor, Property): Pass expected return
18316 type to EmitContext.
18318 2001-10-09 Miguel de Icaza <miguel@ximian.com>
18320 * expression.cs: Make DoResolve take an EmitContext instead of a
18323 Replaced `l' and `location' for `loc', for consistency.
18325 (Error, Warning): Remove unneeded Tc argument.
18327 * assign.cs, literal.cs, constant.cs: Update to new calling
18330 * codegen.cs: EmitContext now contains a flag indicating whether
18331 code is being generated in a static method or not.
18333 * cs-parser.jay: DecomposeQI, new function that replaces the old
18334 QualifiedIdentifier. Now we always decompose the assembled
18335 strings from qualified_identifier productions into a group of
18338 2001-10-08 Miguel de Icaza <miguel@ximian.com>
18340 * rootcontext.cs: Deal with field-less struct types correctly now
18341 by passing the size option to Define Type.
18343 * class.cs: Removed hack that created one static field.
18345 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18347 * statement.cs: Moved most of the code generation here.
18349 2001-10-09 Ravi Pratap <ravi@ximian.com>
18351 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
18354 (ElementAccess): Remove useless bits for now - keep checks as the spec
18357 2001-10-08 Ravi Pratap <ravi@ximian.com>
18359 * expression.cs (ElementAccess::DoResolve): Remove my crap code
18360 and start performing checks according to the spec.
18362 2001-10-07 Ravi Pratap <ravi@ximian.com>
18364 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
18365 rank_specifiers instead.
18367 (rank_specifiers): Change the order in which the rank specifiers are stored
18369 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
18371 * expression.cs (ElementAccess): Implement the LValue interface too.
18373 2001-10-06 Ravi Pratap <ravi@ximian.com>
18375 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
18376 except that user defined conversions are not included.
18378 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
18379 perform the conversion of the return type, if necessary.
18381 (New::DoResolve): Check whether we are creating an array or an object
18382 and accordingly do the needful.
18384 (New::Emit): Same here.
18386 (New::DoResolve): Implement guts of array creation.
18388 (New::FormLookupType): Helper function.
18390 2001-10-07 Miguel de Icaza <miguel@ximian.com>
18392 * codegen.cs: Removed most of the code generation here, and move the
18393 corresponding code generation bits to the statement classes.
18395 Added support for try/catch/finalize and throw.
18397 * cs-parser.jay: Added support for try/catch/finalize.
18399 * class.cs: Catch static methods having the flags override,
18400 virtual or abstract.
18402 * expression.cs (UserCast): This user cast was not really doing
18403 what it was supposed to do. Which is to be born in fully resolved
18404 state. Parts of the resolution were being performed at Emit time!
18408 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18410 * expression.cs: Implicity convert the result from UserCast.
18412 2001-10-05 Ravi Pratap <ravi@ximian.com>
18414 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
18415 prevented it from working correctly.
18417 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
18418 merely ConvertImplicit.
18420 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18422 * typemanager.cs: Make the LookupTypeContainer function static,
18423 and not per-instance.
18425 * class.cs: Make static FindMembers (the one that takes a Type
18428 * codegen.cs: Add EmitForeach here.
18430 * cs-parser.jay: Make foreach a toplevel object instead of the
18431 inline expansion, as we need to perform semantic analysis on it.
18433 2001-10-05 Ravi Pratap <ravi@ximian.com>
18435 * expression.cs (Expression::ImplicitUserConversion): Rename to
18436 UserDefinedConversion.
18438 (Expression::UserDefinedConversion): Take an extra argument specifying
18439 whether we look for explicit user conversions too.
18441 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
18443 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
18445 (ExplicitUserConversion): Make it a call to UserDefinedConversion
18446 with the appropriate arguments.
18448 * cs-parser.jay (cast_expression): Record location too.
18450 * expression.cs (Cast): Record location info.
18452 (Expression::ConvertExplicit): Take location argument.
18454 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
18455 to determine if we are doing explicit conversions.
18457 (UserCast::Emit): Update accordingly.
18459 (Expression::ConvertExplicit): Report an error if everything fails.
18461 * ../errors/cs0030.cs : Add.
18463 2001-10-04 Miguel de Icaza <miguel@ximian.com>
18465 * modifiers.cs: If the ABSTRACT keyword is present, also set the
18466 virtual and newslot bits.
18468 * class.cs (TypeContainer::RegisterRequiredImplementations):
18469 Record methods we need.
18471 (TypeContainer::MakeKey): Helper function to make keys for
18472 MethodBases, since the Methodbase key is useless.
18474 (TypeContainer::Populate): Call RegisterRequiredImplementations
18475 before defining the methods.
18477 Create a mapping for method_builders_to_methods ahead of time
18478 instead of inside a tight loop.
18480 (::RequireMethods): Accept an object as the data to set into the
18481 hashtable so we can report interface vs abstract method mismatch.
18483 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18485 * report.cs: Make all of it static.
18487 * rootcontext.cs: Drop object_type and value_type computations, as
18488 we have those in the TypeManager anyways.
18490 Drop report instance variable too, now it is a global.
18492 * driver.cs: Use try/catch on command line handling.
18494 Add --probe option to debug the error reporting system with a test
18497 * report.cs: Add support for exiting program when a probe
18498 condition is reached.
18500 2001-10-03 Ravi Pratap <ravi@ximian.com>
18502 * expression.cs (Binary::DoNumericPromotions): Fix the case when
18503 we do a forcible conversion regardless of type, to check if
18504 ForceConversion returns a null.
18506 (Binary::error19): Use location to report error.
18508 (Unary::error23): Use location here too.
18510 * ../errors/cs0019.cs : Check in.
18512 * ../errors/cs0023.cs : Check in.
18514 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
18515 case of a non-null MethodInfo object with a length of 0 !
18517 (Binary::ResolveOperator): Flag error if overload resolution fails to find
18518 an applicable member - according to the spec :-)
18519 Also fix logic to find members in base types.
18521 (Unary::ResolveOperator): Same here.
18523 (Unary::report23): Change name to error23 and make first argument a TypeContainer
18524 as I was getting thoroughly confused between this and error19 :-)
18526 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
18527 (::FindMostEncompassedType): Implement.
18528 (::FindMostEncompassingType): Implement.
18529 (::StandardConversionExists): Implement.
18531 (UserImplicitCast): Re-vamp. We now need info about most specific
18532 source and target types so that we can do the necessary conversions.
18534 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
18535 mathematical union with no duplicates.
18537 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18539 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
18540 in order from base classes to child classes, so that we can in
18541 child classes look up in our parent for method names and
18542 attributes (required for handling abstract, virtual, new, override
18543 constructs: we need to instrospect our base class, and if we dont
18544 populate the classes in order, the introspection might be
18545 incorrect. For example, a method could query its parent before
18546 the parent has any methods and would determine that the parent has
18547 no abstract methods (while it could have had them)).
18549 (RootContext::CreateType): Record the order in which we define the
18552 2001-10-02 Miguel de Icaza <miguel@ximian.com>
18554 * class.cs (TypeContainer::Populate): Also method definitions can
18555 fail now, keep track of this.
18557 (TypeContainer::FindMembers): Implement support for
18558 DeclaredOnly/noDeclaredOnly flag.
18560 (Constructor::Emit) Return the ConstructorBuilder.
18562 (Method::Emit) Return the MethodBuilder.
18563 Check for abstract or virtual methods to be public.
18565 * rootcontext.cs (RootContext::CreateType): Register all the
18566 abstract methods required for the class to be complete and the
18567 interface methods that must be implemented.
18569 * cs-parser.jay: Report error 501 (method requires body if it is
18570 not marked abstract or extern).
18572 * expression.cs (TypeOf::Emit): Implement.
18574 * typemanager.cs: runtime_handle_type, new global type.
18576 * class.cs (Property::Emit): Generate code for properties.
18578 2001-10-02 Ravi Pratap <ravi@ximian.com>
18580 * expression.cs (Unary::ResolveOperator): Find operators on base type
18581 too - we now conform exactly to the spec.
18583 (Binary::ResolveOperator): Same here.
18585 * class.cs (Operator::Define): Fix minor quirk in the tests.
18587 * ../errors/cs0215.cs : Added.
18589 * ../errors/cs0556.cs : Added.
18591 * ../errors/cs0555.cs : Added.
18593 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18595 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
18596 single integer which is really efficient
18598 2001-10-01 Ravi Pratap <ravi@ximian.com>
18600 * expression.cs (Expression::ImplicitUserConversion): Use location
18601 even in the case when we are examining True operators.
18603 * class.cs (Operator::Define): Perform extensive checks to conform
18604 with the rules for operator overloading in the spec.
18606 * expression.cs (Expression::ImplicitReferenceConversion): Implement
18607 some of the other conversions mentioned in the spec.
18609 * typemanager.cs (array_type): New static member for the System.Array built-in
18612 (cloneable_interface): For System.ICloneable interface.
18614 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
18615 we start resolving the tree and populating types.
18617 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
18619 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18621 * expression.cs (Expression::ExprClassFromMemberInfo,
18622 Expression::Literalize): Create literal expressions from
18623 FieldInfos which are literals.
18625 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
18626 type casts, because they were wrong. The test suite in tests
18629 (ImplicitNumericConversion): ushort to ulong requires a widening
18632 Int32 constant to long requires widening cast as well.
18634 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
18635 for integers because the type on the stack is not i4.
18637 2001-09-30 Miguel de Icaza <miguel@ximian.com>
18639 * expression.cs (report118): require location argument.
18641 * parameter.cs: Do not dereference potential null value.
18643 * class.cs: Catch methods that lack the `new' keyword when
18644 overriding a name. Report warnings when `new' is used without
18645 anything being there to override.
18647 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
18649 * class.cs: Only add constructor to hashtable if it is non-null
18650 (as now constructors can fail on define).
18652 (TypeManager, Class, Struct): Take location arguments.
18654 Catch field instance initialization in structs as errors.
18656 accepting_filter: a new filter for FindMembers that is static so
18657 that we dont create an instance per invocation.
18659 (Constructor::Define): Catch errors where a struct constructor is
18662 * cs-parser.jay: Pass location information for various new
18665 * delegate.cs (Delegate): take a location argument.
18667 * driver.cs: Do not call EmitCode if there were problesm in the
18668 Definition of the types, as many Builders wont be there.
18670 * decl.cs (Decl::Decl): Require a location argument.
18672 * cs-tokenizer.cs: Handle properly hex constants that can not fit
18673 into integers, and find the most appropiate integer for it.
18675 * literal.cs: Implement ULongLiteral.
18677 * rootcontext.cs: Provide better information about the location of
18678 failure when CreateType fails.
18680 2001-09-29 Miguel de Icaza <miguel@ximian.com>
18682 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
18685 * expression.cs (Binary::CheckShiftArguments): Add missing type
18687 (Binary::ResolveOperator): Add type to the logical and and logical
18688 or, Bitwise And/Or and Exclusive Or code paths, it was missing
18691 (Binary::DoNumericPromotions): In the case where either argument
18692 is ulong (and most signed types combined with ulong cause an
18693 error) perform implicit integer constant conversions as well.
18695 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18697 * expression.cs (UserImplicitCast): Method should always be
18699 (Invocation::BetterConversion): Simplified test for IntLiteral.
18701 (Expression::ImplicitNumericConversion): Split this routine out.
18702 Put the code that performs implicit constant integer conversions
18705 (Expression::Resolve): Become a wrapper around DoResolve so we can
18706 check eclass and type being set after resolve.
18708 (Invocation::Badness): Remove this dead function
18710 (Binary::ResolveOperator): Do not compute the expensive argumnets
18711 unless we have a union for it.
18713 (Probe::Emit): Is needs to do an isinst and then
18714 compare against null.
18716 (::CanConvert): Added Location argument. If the Location argument
18717 is null (Location.Null), then we do not report errors. This is
18718 used by the `probe' mechanism of the Explicit conversion. We do
18719 not want to generate an error for something that the user
18720 explicitly requested to be casted. But the pipeline for an
18721 explicit cast first tests for potential implicit casts.
18723 So for now, if the Location is null, it means `Probe only' to
18724 avoid adding another argument. Might have to revise this
18727 (ClassCast): New class used to type cast objects into arbitrary
18728 classes (used in Explicit Reference Conversions).
18730 Implement `as' as well.
18732 Reverted all the patches from Ravi below: they were broken:
18734 * The use of `level' as a mechanism to stop recursive
18735 invocations is wrong. That was there just to catch the
18736 bug with a strack trace but not as a way of addressing
18739 To fix the problem we have to *understand* what is going
18740 on and the interactions and come up with a plan, not
18741 just get things going.
18743 * The use of the type conversion cache that I proposed
18744 last night had an open topic: How does this work across
18745 protection domains. A user defined conversion might not
18746 be public in the location where we are applying the
18747 conversion, a different conversion might be selected
18748 (ie, private A->B (better) but public B->A (worse),
18749 inside A, A->B applies, but outside it, B->A will
18752 * On top of that (ie, even if the above is solved),
18753 conversions in a cache need to be abstract. Ie, `To
18754 convert from an Int to a Short use an OpcodeCast', not
18755 `To convert from an Int to a Short use the OpcodeCast on
18756 the variable 5' (which is what this patch was doing).
18758 2001-09-28 Ravi Pratap <ravi@ximian.com>
18760 * expression.cs (Invocation::ConversionExists): Re-write to use
18761 the conversion cache
18763 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
18764 cache all conversions done, not just user-defined ones.
18766 (Invocation::BetterConversion): The real culprit. Use ConversionExists
18767 to determine if a conversion exists instead of acutually trying to
18768 perform the conversion. It's faster too.
18770 (Expression::ConvertExplicit): Modify to use ConversionExists to check
18771 and only then attempt the implicit conversion.
18773 2001-09-28 Ravi Pratap <ravi@ximian.com>
18775 * expression.cs (ConvertImplicit): Use a cache for conversions
18776 already found. Check level of recursion and bail out if necessary.
18778 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18780 * typemanager.cs (string_concat_string_string, string_concat_object_object):
18781 Export standard methods that we expect for string operations.
18783 * statement.cs (Block::UsageWarning): Track usage of variables and
18784 report the errors for not used variables.
18786 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
18789 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18791 * codegen.cs: remove unnneded code
18793 * expression.cs: Removed BuiltinTypeAccess class
18795 Fix the order in which implicit conversions are
18798 The previous fixed dropped support for boxed conversions (adding a
18799 test to the test suite now)
18801 (UserImplicitCast::CanConvert): Remove test for source being null,
18802 that code is broken. We should not feed a null to begin with, if
18803 we do, then we should track the bug where the problem originates
18804 and not try to cover it up here.
18806 Return a resolved expression of type UserImplicitCast on success
18807 rather than true/false. Ravi: this is what I was talking about,
18808 the pattern is to use a static method as a "constructor" for
18811 Also, do not create arguments until the very last minute,
18812 otherwise we always create the arguments even for lookups that
18813 will never be performed.
18815 (UserImplicitCast::Resolve): Eliminate, objects of type
18816 UserImplicitCast are born in a fully resolved state.
18818 * typemanager.cs (InitCoreTypes): Init also value_type
18819 (System.ValueType).
18821 * expression.cs (Cast::Resolve): First resolve the child expression.
18823 (LValue): Add new method AddressOf to be used by
18826 Change the argument of Store to take an EmitContext instead of an
18827 ILGenerator, because things like FieldExpr need to be able to call
18828 their children expression to generate the instance code.
18830 (Expression::Error, Expression::Warning): Sugar functions for
18833 (Expression::MemberLookup): Accept a TypeContainer instead of a
18834 Report as the first argument.
18836 (Expression::ResolvePrimary): Killed. I still want to improve
18837 this as currently the code is just not right.
18839 (Expression::ResolveMemberAccess): Simplify, but it is still
18842 (Unary::Resolve): Catch errors in AddressOf operators.
18844 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18845 index to a byte for the short-version, or the compiler will choose
18846 the wrong Emit call, which generates the wrong data.
18848 (ParameterReference::Emit, ::Store): same.
18850 (FieldExpr::AddressOf): Implement.
18852 * typemanager.cs: TypeManager: made public variable instead of
18855 * driver.cs: document --fatal.
18857 * report.cs (ErrorMessage, WarningMessage): new names for the old
18858 Error and Warning classes.
18860 * cs-parser.jay (member_access): Turn built-in access to types
18861 into a normal simplename
18863 2001-09-27 Ravi Pratap <ravi@ximian.com>
18865 * expression.cs (Invocation::BetterConversion): Fix to cope
18866 with q being null, since this was introducing a bug.
18868 * expression.cs (ConvertImplicit): Do built-in conversions first.
18870 2001-09-27 Ravi Pratap <ravi@ximian.com>
18872 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18874 2001-09-27 Ravi Pratap <ravi@ximian.com>
18876 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18877 I had introduced long ago (what's new ?).
18879 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18880 the work of all the checking.
18881 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18882 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18884 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18885 that is the right way.
18887 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18888 overloading resolution. Use everywhere instead of cutting and pasting code.
18890 (Binary::ResolveOperator): Use MakeUnionSet.
18892 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18893 we have to convert to bool types. Not complete yet.
18895 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18897 * typemanager.cs (TypeManager::CSharpName): support ushort.
18899 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18900 to provide an expression that performsn an implicit constant int
18901 conversion (section 6.1.6).
18902 (Expression::ConvertImplicitRequired): Reworked to include
18903 implicit constant expression conversions.
18905 (Expression::ConvertNumericExplicit): Finished.
18907 (Invocation::Emit): If InstanceExpression is null, then it means
18908 that we perform a call on this.
18910 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18912 * expression.cs (Unary::Emit): Remove some dead code.
18913 (Probe): Implement Resolve and Emit for `is'.
18914 (Expression::ConvertImplicitRequired): Attempt to do constant
18915 expression conversions here. Maybe should be moved to
18916 ConvertImplicit, but I am not sure.
18917 (Expression::ImplicitLongConstantConversionPossible,
18918 Expression::ImplicitIntConstantConversionPossible): New functions
18919 that tell whether is it possible to apply an implicit constant
18920 expression conversion.
18922 (ConvertNumericExplicit): Started work on explicit numeric
18925 * cs-parser.jay: Update operator constants.
18927 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18928 (Parameters::GetSignature): Hook up VerifyArgs here.
18929 (Parameters::VerifyArgs): Verifies that no two arguments have the
18932 * class.cs (Operator): Update the operator names to reflect the
18933 ones that the spec expects (as we are just stringizing the
18936 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18937 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18938 previous usage did only work for our methods.
18939 (Expression::ConvertImplicit): Handle decimal implicit numeric
18940 conversions as well.
18941 (Expression::InternalTypeConstructor): Used to invoke constructors
18942 on internal types for default promotions.
18944 (Unary::Emit): Implement special handling for the pre/post
18945 increment/decrement for overloaded operators, as they need to have
18946 the same semantics as the other operators.
18948 (Binary::ResolveOperator): ditto.
18949 (Invocation::ConversionExists): ditto.
18950 (UserImplicitCast::Resolve): ditto.
18952 2001-09-26 Ravi Pratap <ravi@ximian.com>
18954 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18955 operator, return after emitting body. Regression tests pass again !
18957 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18958 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18959 (Invocation::OverloadResolve): Ditto.
18960 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18962 * everywhere : update calls to the above methods accordingly.
18964 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18966 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18968 * expression.cs (ExpressionStatement): New base class used for
18969 expressions that can appear in statements, so that we can provide
18970 an alternate path to generate expression that do not leave a value
18973 (Expression::Emit, and all the derivatives): We no longer return
18974 whether a value is left on the stack or not. Every expression
18975 after being emitted leaves a single value on the stack.
18977 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18978 facilties of ExpressionStatement if possible.
18980 * cs-parser.jay: Update statement_expression.
18982 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18984 * driver.cs: Change the wording of message
18986 2001-09-25 Ravi Pratap <ravi@ximian.com>
18988 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18989 the type of the expression to the return type of the method if
18990 we have an overloaded operator match ! The regression tests pass again !
18991 (Unary::ResolveOperator): Ditto.
18993 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18994 to find "op_Implicit", not "implicit" ;-)
18995 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18996 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18998 * everywhere : Correct calls to the above accordingly.
19000 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
19001 (ConvertImplicit): Do user-defined conversion if it exists.
19003 2001-09-24 Miguel de Icaza <miguel@ximian.com>
19005 * assign.cs: track location.
19006 (Resolve): Use implicit conversions on assignment.
19008 * literal.cs: Oops. Not good, Emit of short access values should
19009 pass (Bytes) or the wrong argument will be selected.
19011 * expression.cs (Unary::Emit): Emit code for -expr.
19013 (Unary::ResolveOperator): Handle `Substract' for non-constants
19014 (substract from zero from the non-constants).
19015 Deal with Doubles as well.
19017 (Expression::ConvertImplicitRequired): New routine that reports an
19018 error if no implicit conversion exists.
19020 (Invocation::OverloadResolve): Store the converted implicit
19021 expressions if we make them
19023 2001-09-24 Ravi Pratap <ravi@ximian.com>
19025 * class.cs (ConstructorInitializer): Take a Location argument.
19026 (ConstructorBaseInitializer): Same here.
19027 (ConstructorThisInitializer): Same here.
19029 * cs-parser.jay : Update all calls accordingly.
19031 * expression.cs (Unary, Binary, New): Take location argument.
19032 Update accordingly everywhere.
19034 * cs-parser.jay : Update all calls to the above to take a location
19037 * class.cs : Ditto.
19039 2001-09-24 Ravi Pratap <ravi@ximian.com>
19041 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
19042 (Invocation::BetterConversion): Same here
19043 (Invocation::ConversionExists): Ditto.
19045 (Invocation::ConversionExists): Implement.
19047 2001-09-22 Ravi Pratap <ravi@ximian.com>
19049 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
19050 Also take an additional TypeContainer argument.
19052 * All over : Pass in TypeContainer as argument to OverloadResolve.
19054 * typemanager.cs (CSharpName): Update to check for the string type and return
19057 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
19060 2001-09-21 Ravi Pratap <ravi@ximian.com>
19062 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
19063 (Invocation::BetterFunction): Implement.
19064 (Invocation::BetterConversion): Implement.
19065 (Invocation::ConversionExists): Skeleton, no implementation yet.
19067 Okay, things work fine !
19069 2001-09-21 Miguel de Icaza <miguel@ximian.com>
19071 * typemanager.cs: declare and load enum_type, delegate_type and
19074 * expression.cs (Expression::Emit): Now emit returns a value that
19075 tells whether a value is left on the stack or not. This strategy
19076 might be reveted tomorrow with a mechanism that would address
19077 multiple assignments.
19078 (Expression::report118): Utility routine to report mismatches on
19081 (Unary::Report23): Report impossible type/operator combination
19084 (Unary::IsIncrementableNumber): Whether the type can be
19085 incremented or decremented with add.
19086 (Unary::ResolveOperator): Also allow enumerations to be bitwise
19088 (Unary::ResolveOperator): Implement ++, !, ~,
19090 (Invocation::Emit): Deal with new Emit convetion.
19092 * All Expression derivatives: Updated their Emit method to return
19093 whether they leave values on the stack or not.
19095 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
19096 stack for expressions that are statements.
19098 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19100 * expression.cs (LValue): New interface. Must be implemented by
19102 (LocalVariableReference, ParameterReference, FieldExpr): Implement
19105 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
19106 interface for generating code, simplifies the code.
19108 2001-09-20 Ravi Pratap <ravi@ximian.com>
19110 * expression.cs (everywhere): Comment out return statements in ::Resolve
19111 methods to avoid the warnings.
19113 2001-09-20 Miguel de Icaza <miguel@ximian.com>
19115 * driver.cs (parse): Report error 2001 if we can not open the
19118 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
19121 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
19124 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
19125 otherwise nested blocks end up with the same index.
19127 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
19129 * expression.cs: Instead of having FIXMEs in the Resolve
19130 functions, throw exceptions so it is obvious that we are facing a
19133 * cs-parser.jay (invocation_expression): Pass Location information.
19135 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
19136 Use a basename for those routines because .NET does not like paths
19139 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
19142 2001-09-19 Miguel de Icaza <miguel@ximian.com>
19144 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
19145 are loading the correct data types (throws an exception if not).
19146 (TypeManager::InitCoreTypes): Use CoreLookupType
19148 * expression.cs (Unary::ResolveOperator): return the child
19149 expression for expressions which are just +expr.
19150 (Unary::ResolveOperator): Return negative literals for -LITERAL
19151 expressions (otherwise they are Unary {Literal}).
19152 (Invocation::Badness): Take into account `Implicit constant
19153 expression conversions'.
19155 * literal.cs (LongLiteral): Implement long literal class.
19156 (IntLiteral): export the `Value' of the intliteral.
19158 2001-09-19 Ravi Pratap <ravi@ximian.com>
19160 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
19162 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
19163 instead of 'Operator'
19165 * expression.cs (Binary::ResolveOperator): Update accordingly.
19166 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
19169 * cs-parser.jay (unary_expression): Update to use the new names.
19171 * gen-treedump.cs (GetUnary): Same here.
19173 * expression.cs (Unary::Resolve): Implement.
19174 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
19175 operators are found instead of making noise ;-)
19176 (Unary::ResolveOperator): New method to do precisely the same thing which
19177 Binary::ResolveOperator does for Binary expressions.
19178 (Unary.method, .Arguments): Add.
19179 (Unary::OperName): Implement.
19180 (Unary::ForceConversion): Copy and Paste !
19182 * class.cs (Operator::Define): Fix a small bug for the case when we have
19185 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
19186 for the inbuilt operators. Only overloading works for now ;-)
19188 2001-09-18 Miguel de Icaza <miguel@ximian.com>
19190 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
19191 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
19193 * expression.cs (This::Emit): Implement.
19194 (This::Resolve): Implement.
19195 (TypeOf:Resolve): Implement.
19196 (Expression::ResolveSimpleName): Add an implicit this to instance
19198 (MemberAccess::Resolve): Deal with Parameters and Fields.
19199 Bind instance variable to Field expressions.
19200 (FieldExpr::Instance): New field used to track the expression that
19201 represents the object instance.
19202 (FieldExpr::Resolve): Track potential errors from MemberLookup not
19204 (FieldExpr::Emit): Implement.
19206 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
19207 the last instruction contains a return opcode to avoid generating
19208 the last `ret' instruction (this generates correct code, and it is
19209 nice to pass the peverify output).
19211 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
19212 initializer for static and instance variables.
19213 (Constructor::Emit): Allow initializer to be null in the case of
19214 static constructors. Only emit initializer for instance
19217 (TypeContainer::FindMembers): Return a null array if there are no
19220 Also fix the code for the MemberTypes.Method branch, as it was not
19221 scanning that for operators (or tried to access null variables before).
19223 * assign.cs (Assign::Emit): Handle instance and static fields.
19227 * driver.cs: Stop compilation if there are parse errors.
19229 * cs-parser.jay (constructor_declaration): Provide default base
19230 initializer for non-static constructors.
19231 (constructor_declarator): Do not provide a default base
19232 initializers if none was specified.
19233 Catch the fact that constructors should not have parameters.
19235 * class.cs: Do not emit parent class initializers for static
19236 constructors, that should be flagged as an error.
19238 2001-09-18 Ravi Pratap <ravi@ximian.com>
19240 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
19241 Move back code into TypeContainer::Populate.
19243 2001-09-18 Ravi Pratap <ravi@ximian.com>
19245 * class.cs (TypeContainer::AddConstructor): Fix the check to
19246 compare against Name, not Basename.
19247 (Operator::OpType): Change Plus and Minus to Add and Subtract.
19249 * cs-parser.jay : Update accordingly.
19251 * class.cs (TypeContainer::FindMembers): For the case where we are searching
19252 for methods, don't forget to look into the operators too.
19253 (RegisterMethodBuilder): Helper method to take care of this for
19254 methods, constructors and operators.
19255 (Operator::Define): Completely revamp.
19256 (Operator.OperatorMethod, MethodName): New fields.
19257 (TypeContainer::Populate): Move the registering of builders into
19258 RegisterMethodBuilder.
19259 (Operator::Emit): Re-write.
19261 * expression.cs (Binary::Emit): Comment out code path to emit method
19262 invocation stuff for the case when we have a user defined operator. I am
19263 just not able to get it right !
19265 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19267 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
19270 (Expression::MemberLookup): Provide a version that allows to
19271 specify the MemberTypes and BindingFlags.
19273 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
19274 so it was not fetching variable information from outer blocks.
19276 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
19277 Beforefieldinit as it was buggy.
19279 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
19280 that Ravi put here.
19282 * class.cs (Constructor::Emit): Only emit if block is not null.
19283 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
19284 deal with this by semantically definining it as if the user had
19287 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
19288 constructors as we now "emit" them at a higher level.
19290 (TypeContainer::DefineDefaultConstructor): Used to define the
19291 default constructors if none was provided.
19293 (ConstructorInitializer): Add methods Resolve and Emit.
19295 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
19297 2001-09-17 Ravi Pratap <ravi@ximian.com>
19299 * class.cs (TypeContainer::EmitDefaultConstructor): Register
19300 the default constructor builder with our hashtable for methodbuilders
19303 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
19304 and argument_count is 0 in which case we have a match.
19305 (Binary::ResolveOperator): More null checking and miscellaneous coding
19308 2001-09-17 Ravi Pratap <ravi@ximian.com>
19310 * rootcontext.cs (IsNameSpace): Compare against null.
19312 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
19314 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
19315 and Unary::Operator.
19317 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
19320 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
19321 we have overloaded operators.
19322 (Binary::ResolveOperator): Implement the part which does the operator overload
19325 * class.cs (Operator::Emit): Implement.
19326 (TypeContainer::Emit): Emit the operators we have too.
19328 * expression.cs (Binary::Emit): Update to emit the appropriate code for
19329 the case when we have a user-defined operator.
19331 2001-09-17 Miguel de Icaza <miguel@ximian.com>
19333 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
19335 2001-09-16 Ravi Pratap <ravi@ximian.com>
19337 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
19338 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
19339 (Constructor::Emit): Implement.
19340 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
19341 if we have no work to do.
19342 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
19345 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
19346 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
19348 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
19351 2001-09-15 Ravi Pratap <ravi@ximian.com>
19353 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
19355 (Tree::RecordNamespace): Method to do what the name says ;-)
19356 (Tree::Namespaces): Property to get at the namespaces hashtable.
19358 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
19361 * rootcontext.cs (IsNamespace): Fixed it :-)
19363 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19365 * class.cs (TypeContainer::FindMembers): Add support for
19367 (MethodCore): New class that encapsulates both the shared aspects
19368 of a Constructor and a Method.
19369 (Method, Constructor): Factored pieces into MethodCore.
19371 * driver.cs: Added --fatal which makes errors throw exceptions.
19372 Load System assembly as well as part of the standard library.
19374 * report.cs: Allow throwing exceptions on errors for debugging.
19376 * modifiers.cs: Do not use `parent', instead use the real type
19377 container to evaluate permission settings.
19379 * class.cs: Put Ravi's patch back in. He is right, and we will
19380 have to cope with the
19382 2001-09-14 Ravi Pratap <ravi@ximian.com>
19384 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
19385 FamORAssem, not FamANDAssem.
19387 2001-09-14 Miguel de Icaza <miguel@ximian.com>
19389 * driver.cs: Added --parse option that only parses its input files
19392 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
19393 incorrect. IsTopLevel is not used to tell whether an object is
19394 root_types or not (that can be achieved by testing this ==
19395 root_types). But to see if this is a top-level *class* (not
19396 necessarly our "toplevel" container).
19398 2001-09-14 Ravi Pratap <ravi@ximian.com>
19400 * enum.cs (Enum::Define): Modify to call the Lookup method on the
19401 parent instead of a direct call to GetType.
19403 2001-09-14 Ravi Pratap <ravi@ximian.com>
19405 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
19406 Modifiers.TypeAttr. This should just be a call to that method.
19408 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
19409 object so that we can determine if we are top-level or not.
19411 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
19414 * enum.cs (Enum::Define): Ditto.
19416 * modifiers.cs (FieldAttr): Re-write.
19418 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
19419 (TypeContainer::HaveStaticConstructor): New property to provide access
19420 to precisely that info.
19422 * modifiers.cs (MethodAttr): Re-write.
19423 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
19425 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
19426 of top-level types as claimed.
19428 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19430 * expression.cs (MemberLookup): Fruitless attempt to lookup
19431 constructors. Maybe I need to emit default constructors? That
19432 might be it (currently .NET emits this for me automatically).
19433 (Invocation::OverloadResolve): Cope with Arguments == null.
19434 (Invocation::EmitArguments): new function, shared by the new
19435 constructor and us.
19436 (Invocation::Emit): Handle static and instance methods. Emit
19437 proper call instruction for virtual or non-virtual invocations.
19438 (New::Emit): Implement.
19439 (New::Resolve): Implement.
19440 (MemberAccess:Resolve): Implement.
19441 (MethodGroupExpr::InstanceExpression): used conforming to the spec
19442 to track instances.
19443 (FieldExpr::Resolve): Set type.
19445 * support.cs: Handle empty arguments.
19447 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
19448 SimpleLookup): Auxiliary routines to help parse a qualifier
19451 Update qualifier_identifier rule.
19453 * codegen.cs: Removed debugging messages.
19455 * class.cs: Make this a global thing, this acts just as a "key" to
19456 objects that we might have around.
19458 (Populate): Only initialize method_builders_to_methods once.
19460 * expression.cs (PropertyExpr): Initialize type from the
19463 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
19464 Resolve pattern. Attempt to implicitly convert value to boolean.
19467 * expression.cs: Set the type for the int32/int32 argument case.
19468 (Binary::ResolveOperator): Set the return type to boolean for
19469 comparission operators
19471 * typemanager.cs: Remove debugging print code.
19473 (Invocation::Resolve): resolve type.
19475 * class.cs: Allocate a MemberInfo of the correct size, as the code
19476 elsewhere depends on the test to reflect the correct contents.
19478 (Method::) Keep track of parameters, due to System.Reflection holes
19480 (TypeContainer::Populate): Keep track of MethodBuilders to Method
19483 (TypeContainer::FindMembers): Use ArrayList and then copy an array
19484 of the exact size and return that.
19486 (Class::LookupMethodByBuilder): New function that maps
19487 MethodBuilders to its methods. Required to locate the information
19488 on methods because System.Reflection bit us again.
19490 * support.cs: New file, contains an interface ParameterData and
19491 two implementations: ReflectionParameters and InternalParameters
19492 used to access Parameter information. We will need to grow this
19495 * expression.cs (Invocation::GetParameterData): implement a cache
19496 and a wrapper around the ParameterData creation for methods.
19497 (Invocation::OverloadResolve): Use new code.
19499 2001-09-13 Ravi Pratap <ravi@ximian.com>
19501 * class.cs (TypeContainer::EmitField): Remove and move into
19502 (Field::Define): here and modify accordingly.
19503 (Field.FieldBuilder): New member.
19504 (TypeContainer::Populate): Update accordingly.
19505 (TypeContainer::FindMembers): Implement.
19507 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19509 * statement.cs: (VariableInfo::VariableType): New field to be
19510 initialized with the full type once it is resolved.
19512 2001-09-12 Miguel de Icaza <miguel@ximian.com>
19514 * parameter.cs (GetParameterInfo): Use a type cache to compute
19515 things only once, and to reuse this information
19517 * expression.cs (LocalVariableReference::Emit): Implement.
19518 (OpcodeCast::Emit): fix.
19520 (ParameterReference::Resolve): Implement.
19521 (ParameterReference::Emit): Implement.
19523 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
19524 that are expressions need to stay as Expressions.
19526 * typemanager.cs (CSharpName): Returns the C# name of a type if
19529 * expression.cs (Expression::ConvertImplicit): New function that
19530 implements implicit type conversions.
19532 (Expression::ImplicitReferenceConversion): Implements implicit
19533 reference conversions.
19535 (EmptyCast): New type for transparent casts.
19537 (OpcodeCast): New type for casts of types that are performed with
19538 a sequence of bytecodes.
19540 (BoxedCast): New type used for casting value types into reference
19541 types. Emits a box opcode.
19543 (Binary::DoNumericPromotions): Implements numeric promotions of
19544 and computation of the Binary::Type.
19546 (Binary::EmitBranchable): Optimization.
19548 (Binary::Emit): Implement code emission for expressions.
19550 * typemanager.cs (TypeManager): Added two new core types: sbyte
19553 2001-09-12 Ravi Pratap <ravi@ximian.com>
19555 * class.cs (TypeContainer::FindMembers): Method which does exactly
19556 what Type.FindMembers does, only we don't have to use reflection. No
19557 implementation yet.
19559 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
19560 typecontainer objects as we need to get at them.
19561 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
19563 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
19564 typecontainer object.
19566 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
19567 of just a Report object.
19569 2001-09-11 Ravi Pratap <ravi@ximian.com>
19571 * class.cs (Event::Define): Go back to using the prefixes "add_" and
19573 (TypeContainer::Populate): Now define the delegates of the type too.
19574 (TypeContainer.Delegates): Property to access the list of delegates defined
19577 * delegates.cs (Delegate::Define): Implement partially.
19579 * modifiers.cs (TypeAttr): Handle more flags.
19581 2001-09-11 Ravi Pratap <ravi@ximian.com>
19583 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
19585 (Operator::Define): Re-write logic to get types by using the LookupType method
19586 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
19587 (Indexer::Define): Ditto.
19588 (Event::Define): Ditto.
19589 (Property::Define): Ditto.
19591 2001-09-10 Ravi Pratap <ravi@ximian.com>
19593 * class.cs (TypeContainer::Populate): Now define operators too.
19594 (TypeContainer.Operators): New property to access the list of operators
19596 (Operator.OperatorMethodBuilder): New member to hold the method builder
19597 for the operator we are defining.
19598 (Operator::Define): Implement.
19600 2001-09-10 Ravi Pratap <ravi@ximian.com>
19602 * class.cs (Event::Define): Make the prefixes of the accessor methods
19603 addOn_ and removeOn_
19605 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
19606 of the location being passed in too. Ideally, this should go later since all
19607 error reporting should be done through the Report object.
19609 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
19610 (Populate): Iterate thru the indexers we have and define them too.
19611 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
19612 for the get and set accessors.
19613 (Indexer::Define): Implement.
19615 2001-09-09 Miguel de Icaza <miguel@ximian.com>
19617 * expression.cs (Binary::Resolve): Beginning of it. I scratched
19618 my previous implementation, did not work.
19620 * typemanager.cs: Add a couple of missing types (the longs).
19622 * literal.cs: Use TypeManager.bool_type instead of getting it.
19624 * expression.cs (EventExpr): New kind of expressions.
19625 (Expressio::ExprClassFromMemberInfo): finish
19627 2001-09-08 Miguel de Icaza <miguel@ximian.com>
19629 * assign.cs: Emit stores to static fields differently.
19631 2001-09-08 Ravi Pratap <ravi@ximian.com>
19633 * Merge in changes and adjust code to tackle conflicts. Backed out my
19634 code in Assign::Resolve ;-)
19636 2001-09-08 Ravi Pratap <ravi@ximian.com>
19638 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
19639 instead Report.Error and also pass in the location.
19640 (CSharpParser::Lexer): New readonly property to return the reference
19641 to the Tokenizer object.
19642 (declare_local_variables): Use Report.Error with location instead of plain
19646 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
19647 (Operator.CheckBinaryOperator): Ditto.
19649 * cs-parser.jay (operator_declarator): Update accordingly.
19651 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
19652 (CheckBinaryOperator): Same here.
19654 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
19655 on the name without any prefixes of namespace names etc. This is because we
19656 already might have something already fully qualified like
19657 'System.Console.WriteLine'
19659 * assign.cs (Resolve): Begin implementation. Stuck ;-)
19661 2001-09-07 Ravi Pratap <ravi@ximian.com>
19663 * cs-tokenizer.cs (location): Return a string which also contains
19666 * expression.cs (ElementAccess): New class for expressions of the
19667 type 'element access.'
19668 (BaseAccess): New class for expressions of the type 'base access.'
19669 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
19672 * cs-parser.jay (element_access): Implement action.
19673 (base_access): Implement actions.
19674 (checked_expression, unchecked_expression): Implement.
19676 * cs-parser.jay (local_variable_type): Correct and implement.
19677 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
19679 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
19681 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
19682 name and the specifiers.
19684 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
19686 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
19687 making them all public ;-)
19689 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
19692 2001-09-07 Miguel de Icaza <miguel@ximian.com>
19694 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
19696 (FieldExpr, PropertyExprs): New resolved expressions.
19697 (SimpleName::MemberStaticCheck): Perform static checks for access
19698 to non-static fields on static methods. Maybe this should be
19699 generalized for MemberAccesses.
19700 (SimpleName::ResolveSimpleName): More work on simple name
19703 * cs-parser.jay (primary_expression/qualified_identifier): track
19704 the parameter index.
19706 * codegen.cs (CodeGen::Save): Catch save exception, report error.
19707 (EmitContext::EmitBoolExpression): Chain to expression generation
19708 instead of temporary hack.
19709 (::EmitStatementExpression): Put generic expression code generation.
19711 * assign.cs (Assign::Emit): Implement variable assignments to
19712 local variables, parameters and fields.
19714 2001-09-06 Miguel de Icaza <miguel@ximian.com>
19716 * statement.cs (Block::GetVariableInfo): New method, returns the
19717 VariableInfo for a variable name in a block.
19718 (Block::GetVariableType): Implement in terms of GetVariableInfo
19720 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
19721 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
19723 2001-09-06 Ravi Pratap <ravi@ximian.com>
19725 * cs-parser.jay (operator_declaration): Continue on my quest : update
19726 to take attributes argument.
19727 (event_declaration): Ditto.
19728 (enum_declaration): Ditto.
19729 (indexer_declaration): Ditto.
19731 * class.cs (Operator::Operator): Update constructor accordingly.
19732 (Event::Event): Ditto.
19734 * delegate.cs (Delegate::Delegate): Same here.
19736 * enum.cs (Enum::Enum): Same here.
19738 2001-09-05 Ravi Pratap <ravi@ximian.com>
19740 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
19742 * ../tests/cs0658.cs : New file to demonstrate error 0658.
19744 * attribute.cs (Attributes): New class to encapsulate all attributes which were
19745 being passed around as an arraylist.
19746 (Attributes::AddAttribute): Method to add attribute sections.
19748 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
19749 (struct_declaration): Update accordingly.
19750 (constant_declaration): Update.
19751 (field_declaration): Update.
19752 (method_header): Update.
19753 (fixed_parameter): Update.
19754 (parameter_array): Ditto.
19755 (property_declaration): Ditto.
19756 (destructor_declaration): Ditto.
19758 * class.cs (Struct::Struct): Update constructors accordingly.
19759 (Class::Class): Ditto.
19760 (Field::Field): Ditto.
19761 (Method::Method): Ditto.
19762 (Property::Property): Ditto.
19763 (TypeContainer::OptAttribute): update property's return type.
19765 * interface.cs (Interface.opt_attributes): New member.
19766 (Interface::Interface): Update to take the extra Attributes argument.
19768 * parameter.cs (Parameter::Parameter): Ditto.
19770 * constant.cs (Constant::Constant): Ditto.
19772 * interface.cs (InterfaceMemberBase): New OptAttributes field.
19773 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
19774 the attributes as a parameter.
19775 (InterfaceProperty): Update constructor call.
19776 (InterfaceEvent): Ditto.
19777 (InterfaceMethod): Ditto.
19778 (InterfaceIndexer): Ditto.
19780 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
19781 pass the attributes too.
19782 (interface_event_declaration): Ditto.
19783 (interface_property_declaration): Ditto.
19784 (interface_method_declaration): Ditto.
19785 (interface_declaration): Ditto.
19787 2001-09-05 Miguel de Icaza <miguel@ximian.com>
19789 * class.cs (Method::Define): Track the "static Main" definition to
19790 create an entry point.
19792 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
19793 EntryPoint if we find it.
19795 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
19796 (EmitContext::ig): Make this variable public.
19798 * driver.cs: Make the default output file be the first file name
19799 with the .exe extension.
19801 Detect empty compilations
19803 Handle various kinds of output targets. Handle --target and
19804 rename -t to --dumper.
19806 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
19807 methods inherited from Expression return now an Expression. This
19808 will is used during the tree rewriting as we resolve them during
19811 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
19812 the spec. Missing entirely is the information about
19813 accessability of elements of it.
19815 (Expression::ExprClassFromMemberInfo): New constructor for
19816 Expressions that creates a fully initialized Expression based on
19817 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
19820 (Invocation::Resolve): Begin implementing resolution of invocations.
19822 * literal.cs (StringLiteral): Implement Emit.
19824 2001-09-05 Ravi Pratap <ravi@ximian.com>
19826 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19829 2001-09-04 Ravi Pratap <ravi@ximian.com>
19831 * cs-parser.jay (attribute_arguments): Implement actions.
19832 (attribute): Fix bug in production. Implement action.
19833 (attribute_list): Implement.
19834 (attribute_target): Implement.
19835 (attribute_target_specifier, opt_target_specifier): Implement
19836 (CheckAttributeTarget): New method to check if the attribute target
19838 (attribute_section): Implement.
19839 (opt_attributes): Implement.
19841 * attribute.cs : New file to handle attributes.
19842 (Attribute): Class to hold attribute info.
19844 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19845 (attribute_section): Modify production to use 2 different rules to
19846 achieve the same thing. 1 s/r conflict down !
19847 Clean out commented, useless, non-reducing dimension_separator rules.
19849 * class.cs (TypeContainer.attributes): New member to hold list
19850 of attributes for a type.
19851 (Struct::Struct): Modify to take one more argument, the attribute list.
19852 (Class::Class): Ditto.
19853 (Field::Field): Ditto.
19854 (Method::Method): Ditto.
19855 (Property::Property): Ditto.
19857 * cs-parser.jay (struct_declaration): Update constructor call to
19858 pass in the attributes too.
19859 (class_declaration): Ditto.
19860 (constant_declaration): Ditto.
19861 (field_declaration): Ditto.
19862 (method_header): Ditto.
19863 (fixed_parameter): Ditto.
19864 (parameter_array): Ditto.
19865 (property_declaration): Ditto.
19867 * constant.cs (Constant::Constant): Update constructor similarly.
19868 Use System.Collections.
19870 * parameter.cs (Parameter::Parameter): Update as above.
19872 2001-09-02 Ravi Pratap <ravi@ximian.com>
19874 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19875 (TypeContainer.delegates): New member to hold list of delegates.
19877 * cs-parser.jay (delegate_declaration): Implement the action correctly
19878 this time as I seem to be on crack ;-)
19880 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19882 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19883 tell whether an identifier represents a namespace.
19885 * expression.cs (NamespaceExpr): A namespace expression, used only
19886 temporarly during expression resolution.
19887 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19888 utility functions to resolve names on expressions.
19890 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19892 * codegen.cs: Add hook for StatementExpressions.
19894 * class.cs: Fix inverted test for static flag in methods.
19896 2001-09-02 Ravi Pratap <ravi@ximian.com>
19898 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19899 to make it coincide with MS' number.
19900 (Operator::CheckBinaryOperator): Ditto.
19902 * ../errors/errors.txt : Remove error numbers added earlier.
19904 * ../errors/cs1019.cs : Test case for error # 1019
19906 * ../errros/cs1020.cs : Test case for error # 1020
19908 * cs-parser.jay : Clean out commented cruft.
19909 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19910 used anywhere - non-reducing rule.
19911 (namespace_declarations): Non-reducing rule - comment out.
19913 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19914 with TypeContainer::AddEnum.
19916 * delegate.cs : New file for delegate handling classes.
19917 (Delegate): Class for declaring delegates.
19919 * makefile : Update.
19921 * cs-parser.jay (delegate_declaration): Implement.
19923 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19925 * class.cs (Event::Define): Implement.
19926 (Event.EventBuilder): New member.
19928 * class.cs (TypeContainer::Populate): Update to define all enums and events
19930 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19931 readonly fields for all these cases ?
19933 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19935 * class.cs (Property): Revamp to use the convention of making fields readonly.
19936 Accordingly modify code elsewhere.
19938 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19939 the Define method of the Property class.
19941 * class.cs : Clean up applied patch and update references to variables etc. Fix
19943 (TypeContainer::Populate): Update to define all the properties we have. Also
19944 define all enumerations.
19946 * enum.cs (Define): Implement.
19948 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19950 * cs-parser.jay (overloadable_operator): The semantic value is an
19951 enum of the Operator class.
19952 (operator_declarator): Implement actions.
19953 (operator_declaration): Implement.
19955 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19956 validity of definitions.
19957 (Operator::CheckBinaryOperator): Static method to check for binary operators
19958 (TypeContainer::AddOperator): New method to add an operator to a type.
19960 * cs-parser.jay (indexer_declaration): Added line to actually call the
19961 AddIndexer method so it gets added ;-)
19963 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19964 already taken care of by the MS compiler ?
19966 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19968 * class.cs (Operator): New class for operator declarations.
19969 (Operator::OpType): Enum for the various operators.
19971 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19973 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19974 ostensibly handle this in semantic analysis.
19976 * cs-parser.jay (general_catch_clause): Comment out
19977 (specific_catch_clauses, specific_catch_clause): Ditto.
19978 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19979 (catch_args, opt_catch_args): New productions.
19980 (catch_clause): Rewrite to use the new productions above
19981 (catch_clauses): Modify accordingly.
19982 (opt_catch_clauses): New production to use in try_statement
19983 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19984 and re-write the code in the actions to extract the specific and
19985 general catch clauses by being a little smart ;-)
19987 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19988 Hooray, try and catch statements parse fine !
19990 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19992 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19993 string from the hashtable of variables.
19995 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19996 I end up making that mistake ;-)
19997 (catch_clauses): Fixed gross error which made Key and Value of the
19998 DictionaryEntry the same : $1 !!
20000 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20002 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
20004 * cs-parser.jay (event_declaration): Correct to remove the semicolon
20005 when the add and remove accessors are specified.
20007 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
20009 * cs-parser.jay (IndexerDeclaration): New helper class to hold
20010 information about indexer_declarator.
20011 (indexer_declarator): Implement actions.
20012 (parsing_indexer): New local boolean used to keep track of whether
20013 we are parsing indexers or properties. This is necessary because
20014 implicit_parameters come into picture even for the get accessor in the
20015 case of an indexer.
20016 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
20018 * class.cs (Indexer): New class for indexer declarations.
20019 (TypeContainer::AddIndexer): New method to add an indexer to a type.
20020 (TypeContainer::indexers): New member to hold list of indexers for the
20023 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20025 * cs-parser.jay (add_accessor_declaration): Implement action.
20026 (remove_accessor_declaration): Implement action.
20027 (event_accessors_declaration): Implement
20028 (variable_declarators): swap statements for first rule - trivial.
20030 * class.cs (Event): New class to hold information about event
20032 (TypeContainer::AddEvent): New method to add an event to a type
20033 (TypeContainer::events): New member to hold list of events.
20035 * cs-parser.jay (event_declaration): Implement actions.
20037 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
20039 * cs-parser.jay (dim_separators): Implement. Make it a string
20040 concatenating all the commas together, just as they appear.
20041 (opt_dim_separators): Modify accordingly
20042 (rank_specifiers): Update accordingly. Basically do the same
20043 thing - instead, collect the brackets here.
20044 (opt_rank_sepcifiers): Modify accordingly.
20045 (array_type): Modify to actually return the complete type string
20046 instead of ignoring the rank_specifiers.
20047 (expression_list): Implement to collect the expressions
20048 (variable_initializer): Implement. We make it a list of expressions
20049 essentially so that we can handle the array_initializer case neatly too.
20050 (variable_initializer_list): Implement.
20051 (array_initializer): Make it a list of variable_initializers
20052 (opt_array_initializer): Modify accordingly.
20054 * expression.cs (New::NType): Add enumeration to help us
20055 keep track of whether we have an object/delegate creation
20056 or an array creation.
20057 (New:NewType, New::Rank, New::Indices, New::Initializers): New
20058 members to hold data about array creation.
20059 (New:New): Modify to update NewType
20060 (New:New): New Overloaded contructor for the array creation
20063 * cs-parser.jay (array_creation_expression): Implement to call
20064 the overloaded New constructor.
20066 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
20068 * class.cs (TypeContainer::Constructors): Return member
20069 constructors instead of returning null.
20071 2001-08-26 Miguel de Icaza <miguel@ximian.com>
20073 * typemanager.cs (InitCoreTypes): Initialize the various core
20074 types after we have populated the type manager with the user
20075 defined types (this distinction will be important later while
20076 compiling corlib.dll)
20078 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
20079 on Expression Classification. Now all expressions have a method
20080 `Resolve' and a method `Emit'.
20082 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
20083 generation from working. Also add some temporary debugging
20086 2001-08-24 Miguel de Icaza <miguel@ximian.com>
20088 * codegen.cs: Lots of code generation pieces. This is only the
20089 beginning, will continue tomorrow with more touches of polish. We
20090 handle the fundamentals of if, while, do, for, return. Others are
20091 trickier and I need to start working on invocations soon.
20093 * gen-treedump.cs: Bug fix, use s.Increment here instead of
20096 * codegen.cs (EmitContext): New struct, used during code
20097 emission to keep a context. Most of the code generation will be
20100 * cs-parser.jay: Add embedded blocks to the list of statements of
20101 this block. So code generation proceeds in a top down fashion.
20103 2001-08-23 Miguel de Icaza <miguel@ximian.com>
20105 * statement.cs: Add support for multiple child blocks.
20107 2001-08-22 Miguel de Icaza <miguel@ximian.com>
20109 * codegen.cs (EmitCode): New function, will emit the code for a
20110 Block of code given a TypeContainer and its ILGenerator.
20112 * statement.cs (Block): Standard public readonly optimization.
20113 (Block::Block constructors): Link children.
20114 (Block::Child): Child Linker.
20115 (Block::EmitVariables): Emits IL variable declarations.
20117 * class.cs: Drop support for MethodGroups here, delay until
20119 (Method::): Applied the same simplification that I did before, and
20120 move from Properties to public readonly fields.
20121 (Method::ParameterTypes): Returns the parameter types for the
20122 function, and implements a cache that will be useful later when I
20123 do error checking and the semantic analysis on the methods is
20125 (Constructor::GetCallingConvention): Renamed from CallingConvetion
20126 and made a method, optional argument tells whether this is a class
20127 or a structure to apply the `has-this' bit.
20128 (Method::GetCallingConvention): Implement, returns the calling
20130 (Method::Define): Defines the type, a second pass is performed
20131 later to populate the methods.
20133 (Constructor::ParameterTypes): implement a cache similar to the
20134 one on Method::ParameterTypes, useful later when we do semantic
20137 (TypeContainer::EmitMethod): New method. Emits methods.
20139 * expression.cs: Removed MethodGroup class from here.
20141 * parameter.cs (Parameters::GetCallingConvention): new method.
20143 2001-08-21 Miguel de Icaza <miguel@ximian.com>
20145 * class.cs (TypeContainer::Populate): Drop RootContext from the
20148 (Constructor::CallingConvention): Returns the calling convention.
20149 (Constructor::ParameterTypes): Returns the constructor parameter
20152 (TypeContainer::AddConstructor): Keep track of default constructor
20153 and the default static constructor.
20155 (Constructor::) Another class that starts using `public readonly'
20156 instead of properties.
20158 (Constructor::IsDefault): Whether this is a default constructor.
20160 (Field::) use readonly public fields instead of properties also.
20162 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
20163 track of static constructors; If none is used, turn on
20164 BeforeFieldInit in the TypeAttributes.
20166 * cs-parser.jay (opt_argument_list): now the return can be null
20167 for the cases where there are no arguments.
20169 (constructor_declarator): If there is no implicit `base' or
20170 `this', then invoke the default parent constructor.
20172 * modifiers.cs (MethodAttr): New static function maps a set of
20173 modifiers flags into a MethodAttributes enum
20174 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
20175 MethodAttr, TypeAttr to represent the various mappings where the
20176 modifiers are used.
20177 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
20179 2001-08-19 Miguel de Icaza <miguel@ximian.com>
20181 * parameter.cs (GetParameterInfo): Fix bug where there would be no
20184 * interface.cs (PopulateIndexer): Implemented the code generator
20185 for interface indexers.
20187 2001-08-17 Miguel de Icaza <miguel@ximian.com>
20189 * interface.cs (InterfaceMemberBase): Now we track the new status
20192 (PopulateProperty): Implement property population. Woohoo! Got
20193 Methods and Properties going today.
20195 Removed all the properties for interfaces, and replaced them with
20196 `public readonly' fields.
20198 2001-08-16 Miguel de Icaza <miguel@ximian.com>
20200 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
20201 initialize their hashtables/arraylists only when they are needed
20202 instead of doing this always.
20204 * parameter.cs: Handle refs and out parameters.
20206 * cs-parser.jay: Use an ArrayList to construct the arguments
20207 instead of the ParameterCollection, and then cast that to a
20210 * parameter.cs: Drop the use of ParameterCollection and use
20211 instead arrays of Parameters.
20213 (GetParameterInfo): Use the Type, not the Name when resolving
20216 2001-08-13 Miguel de Icaza <miguel@ximian.com>
20218 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
20219 and instead use public readonly fields.
20221 * class.cs: Put back walking code for type containers.
20223 2001-08-11 Miguel de Icaza <miguel@ximian.com>
20225 * class.cs (MakeConstant): Code to define constants.
20227 * rootcontext.cs (LookupType): New function. Used to locate types
20230 2001-08-08 Miguel de Icaza <miguel@ximian.com>
20232 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
20233 this System.Reflection code is. Kudos to Microsoft
20235 * typemanager.cs: Implement a type cache and avoid loading all
20236 types at boot time. Wrap in LookupType the internals. This made
20237 the compiler so much faster. Wow. I rule!
20239 * driver.cs: Make sure we always load mscorlib first (for
20240 debugging purposes, nothing really important).
20242 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
20243 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
20245 * rootcontext.cs: Lookup types on their namespace; Lookup types
20246 on namespaces that have been imported using the `using' keyword.
20248 * class.cs (TypeContainer::TypeAttr): Virtualize.
20249 (Class::TypeAttr): Return attributes suitable for this bad boy.
20250 (Struct::TypeAttr): ditto.
20251 Handle nested classes.
20252 (TypeContainer::) Remove all the type visiting code, it is now
20253 replaced with the rootcontext.cs code
20255 * rootcontext.cs (GetClassBases): Added support for structs.
20257 2001-08-06 Miguel de Icaza <miguel@ximian.com>
20259 * interface.cs, statement.cs, class.cs, parameter.cs,
20260 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
20261 Drop use of TypeRefs, and use strings instead.
20263 2001-08-04 Miguel de Icaza <miguel@ximian.com>
20267 * class.cs (Struct::Struct): set the SEALED flags after
20268 checking the modifiers.
20269 (TypeContainer::TypeAttr): new property, returns the
20270 TypeAttributes for a class.
20272 * cs-parser.jay (type_list): Oops, list production was creating a
20273 new list of base types.
20275 * rootcontext.cs (StdLib): New property.
20276 (GetInterfaceTypeByName): returns an interface by type name, and
20277 encapsulates error handling here.
20278 (GetInterfaces): simplified.
20279 (ResolveTree): Encapsulated all the tree resolution here.
20280 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
20283 * driver.cs: Add support for --nostdlib, to avoid loading the
20284 default assemblies.
20285 (Main): Do not put tree resolution here.
20287 * rootcontext.cs: Beginning of the class resolution.
20289 2001-08-03 Miguel de Icaza <miguel@ximian.com>
20291 * rootcontext.cs: Provide better error reporting.
20293 * cs-parser.jay (interface_base): set our $$ to be interfaces.
20295 * rootcontext.cs (CreateInterface): Handle the case where there
20296 are no parent interfaces.
20298 (CloseTypes): Routine to flush types at the end.
20299 (CreateInterface): Track types.
20300 (GetInterfaces): Returns an array of Types from the list of
20301 defined interfaces.
20303 * typemanager.c (AddUserType): Mechanism to track user types (puts
20304 the type on the global type hash, and allows us to close it at the
20307 2001-08-02 Miguel de Icaza <miguel@ximian.com>
20309 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
20310 RecordInterface instead.
20312 * cs-parser.jay: Updated to reflect changes above.
20314 * decl.cs (Definition): Keep track of the TypeBuilder type that
20315 represents this type here. Not sure we will use it in the long
20316 run, but wont hurt for now.
20318 * driver.cs: Smaller changes to accomodate the new code.
20320 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
20323 * rootcontext.cs (CreateInterface): New method, used to create
20324 the System.TypeBuilder type for interfaces.
20325 (ResolveInterfaces): new entry point to resolve the interface
20327 (CodeGen): Property, used to keep track of the code generator.
20329 2001-07-26 Miguel de Icaza <miguel@ximian.com>
20331 * cs-parser.jay: Add a second production for delegate_declaration
20334 (enum_body): Put an opt_comma here instead of putting it on
20335 enum_body or enum_member_declarations so we can handle trailing
20336 commas on enumeration members. Gets rid of a shift/reduce.
20338 (type_list): Need a COMMA in the middle.
20340 (indexer_declaration): Tell tokenizer to recognize get/set
20342 * Remove old targets.
20344 * Re-add the parser target.
20346 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20348 * cs-parser.jay: Add precendence rules for a number of operators
20349 ot reduce the number of shift/reduce conflicts in the grammar.
20351 2001-07-17 Miguel de Icaza <miguel@ximian.com>
20353 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
20356 Get rid of old crufty code.
20358 * rootcontext.cs: Use this to keep track of the parsed
20359 representation and the defined types available to the program.
20361 * gen-treedump.cs: adjust for new convention.
20363 * type.cs: Split out the type manager, and the assembly builder
20366 * typemanager.cs: the type manager will live here now.
20368 * cil-codegen.cs: And the code generator here.
20370 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
20372 * makefile: Fixed up for easy making.
20374 2001-07-13 Simon Cozens <simon@simon-cozens.org>
20376 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
20379 (unary_expression): Expand pre_increment_expression and
20380 post_decrement_expression to reduce a shift/reduce.
20382 2001-07-11 Simon Cozens
20384 * cs-tokenizer.cs: Hex numbers should begin with a 0.
20386 Improve allow_keyword_as_indent name.
20388 2001-06-19 Miguel de Icaza <miguel@ximian.com>
20390 * Adjustments for Beta2.
20392 2001-06-13 Miguel de Icaza <miguel@ximian.com>
20394 * decl.cs: Added `Define' abstract method.
20395 (InTransit): new property, used to catch recursive definitions.
20397 * interface.cs: Implement `Define'.
20399 * modifiers.cs: Map Modifiers.constants to
20400 System.Reflection.TypeAttribute flags.
20402 * class.cs: Keep track of types and user-defined types.
20403 (BuilderInit): New method for creating an assembly
20404 (ResolveType): New function to launch the resolution process, only
20405 used by interfaces for now.
20407 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
20408 that are inserted into the name space.
20410 2001-06-08 Miguel de Icaza <miguel@ximian.com>
20412 * ARGH. I have screwed up my tree so many times due to the use of
20413 rsync rather than using CVS. Going to fix this at once.
20415 * driver.cs: Objetify driver. Load assemblies, use assemblies to
20418 2001-06-07 Miguel de Icaza <miguel@ximian.com>
20420 * Experiment successful: Use System.Type rather that our own
20423 2001-05-25 Miguel de Icaza <miguel@ximian.com>
20425 * cs-parser.jay: Removed nsAliases from here.
20427 Use new namespaces, handle `using XXX;'
20429 * namespace.cs: Reimplemented namespace handling, use a recursive
20430 definition of the class. Now we can keep track of using clauses
20431 and catch invalid using clauses.
20433 2001-05-24 Miguel de Icaza <miguel@ximian.com>
20435 * gen-treedump.cs: Adapted for all the renaming.
20437 * expression.cs (Expression): this class now has a Type property
20438 which returns an expression Type.
20440 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
20441 `Type', as this has a different meaning now in the base
20443 2001-05-22 Miguel de Icaza <miguel@ximian.com>
20445 * interface.cs, class.cs: Removed from all the sources the
20446 references to signature computation, as we can not do method
20447 signature computation during the parsing time, as we are not
20448 trying to solve at that point distinguishing:
20452 void a (NS.Blah x) {}
20455 Which depending on the context might be valid or not, as we do not
20456 know if Blah is the same thing as NS.Blah at that point.
20458 * Redid everything so the code uses TypeRefs now instead of
20459 Types. TypeRefs are just temporary type placeholders, that need
20460 to be resolved. They initially have a pointer to a string and the
20461 current scope in which they are used. This is used later by the
20462 compiler to resolve the reference to an actual Type.
20464 * DeclSpace is no longer a CIR.Type, and neither are
20465 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
20466 are all DeclSpaces, but no Types.
20468 * type.cs (TypeRefManager): This implements the TypeRef manager,
20469 which keeps track of all the types that need to be resolved after
20470 the parsing has finished.
20472 2001-05-13 Miguel de Icaza <miguel@ximian.com>
20474 * ARGH. We are going to have to store `foreach' as a class rather
20475 than resolving it, as we need to verify error 1579 after name
20476 resolution. *OR* we could keep a flag that says `This request to
20477 IEnumerator comes from a foreach statement' which we can then use
20478 to generate the error.
20480 2001-05-10 Miguel de Icaza <miguel@ximian.com>
20482 * class.cs (TypeContainer.AddMethod): we now add methods to the
20483 MethodGroup instead of the method hashtable.
20485 * expression.cs: Add MethodGroup abstraction, which gets us one
20486 step closer to the specification in the way we handle method
20489 * cs-parser.jay (primary_expression): qualified_identifier now
20490 tried to match up an identifier to a local variable reference or
20491 to a parameter reference.
20493 current_local_parameters is now a parser global variable that
20494 points to the current parameters for the block, used during name
20497 (property_declaration): Now creates an implicit `value' argument to
20500 2001-05-09 Miguel de Icaza <miguel@ximian.com>
20502 * parameter.cs: Do not use `param' arguments as part of the
20503 signature, per the spec.
20505 2001-05-08 Miguel de Icaza <miguel@ximian.com>
20507 * decl.cs: Base class for classes, structs and interfaces. This
20508 is the "Declaration Space"
20510 * cs-parser.jay: Use CheckDef for checking declaration errors
20511 instead of having one on each function.
20513 * class.cs: Factor out some code for handling error handling in
20514 accordance to the "Declarations" section in the "Basic Concepts"
20515 chapter in the ECMA C# spec.
20517 * interface.cs: Make all interface member classes derive from
20518 InterfaceMemberBase.
20520 2001-05-07 Miguel de Icaza <miguel@ximian.com>
20522 * Many things: all interfaces are parsed and generated in
20523 gen-treedump. Support for member variables, constructors,
20524 destructors, properties, constants is there.
20526 Beginning of the IL backend, but very little done, just there for
20529 2001-04-29 Miguel de Icaza <miguel@ximian.com>
20531 * cs-parser.jay: Fix labeled statement.
20533 * cs-tokenizer.cs (escape): Escape " and ' always.
20534 ref_line, ref_name: keep track of the line/filename as instructed
20535 by #line by the compiler.
20538 2001-04-27 Miguel de Icaza <miguel@ximian.com>
20540 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
20541 to match the values in System.CodeDOM.
20543 Divid renamed to Divide.
20545 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
20547 (Statements.set): remove.
20549 * System.CodeDOM/CodeCatchClause.cs: always have a valid
20552 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
20553 falseStatements always have valid values.
20555 * cs-parser.jay: Use System.CodeDOM now.