1 2005-02-11 Miguel de Icaza <miguel@novell.com>
3 * anonymous.cs (CaptureContext): Track whether `this' has been
6 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
7 only captured `this' if it was implicitly done (instance
8 methods/variables were used).
10 * codegen.cs (EmitContext.CaptureThis): New method to flag that
11 `this' must be captured.
13 2005-01-30 Miguel de Icaza <miguel@novell.com>
15 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
16 is null it means that there has been no need to capture anything,
17 so we just create a sibling.
19 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
21 Just a partial fix. The other half is fairly elusive.
23 2005-02-10 Raja R Harinath <rharinath@novell.com>
25 Fix #52586, cs0121-4.cs.
26 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
27 and return a hashtable.
28 (MemberCache.ClearDeclaredOnly): New.
29 (MemberCache.MemberCache): Update to change. Make a deep copy of
30 the method_hash of a base type too.
31 (MemberCache.AddMethods): Adapt to having a deep copy of the base
32 type methods. Overwrite entries with the same MethodHandle so
33 that the ReflectedType is correct. The process leaves in base
34 virtual functions and their overrides as distinct entries.
35 (CacheEntry): Now a class instead of a struct. It shouldn't alter
36 matters since it was boxed in a ArrayList before.
37 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
39 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
40 case of a virtual function and its override (choose the overload
42 (Invocation.OverloadResolve): Avoid 'override' members during
43 'applicable_type' calculation.
45 2005-02-09 Raja R Harinath <rharinath@novell.com>
47 Combine two near-redundant caches.
48 * typemanager.cs (method_params): Rename from method_internal_params.
49 (TypeManager.GetParameterData): New. Replace
50 Invocation.GetParameterData.
51 (TypeManager.LookupParametersByBuilder): Remove.
52 * expression.cs (Invocation.method_parameter_cache): Remove.
53 (Invocation.GetParameterData): Remove.
55 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
58 2005-02-08 Raja R Harinath <rharinath@novell.com>
61 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
62 TypeManager.multicast_delegate_type is null, resolve it by looking
63 up "System.MulticastDelegate".
64 * rootcontext.cs (RootContext.ResolveCore): Simplify.
66 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
67 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
68 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
71 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
72 (LabeledStatement.AddReference): New. Set 'referenced'.
73 (Goto.Resolve): Use it.
75 2005-02-05 John Luke <john.luke@gmail.com>
77 * driver.cs: remove duplicate -doc line in Usage ()
79 2005-02-04 Raja R Harinath <rharinath@novell.com>
81 * location.cs (Location.AddFile): Fix CS2002 error report.
83 2005-02-02 Martin Baulig <martin@ximian.com>
85 * delegate.cs (Delegate.DefineType): Report an internal error if
86 TypeManager.multicast_delegate_type is null. See bug #72015 for
89 2005-02-02 Raja R Harinath <rharinath@novell.com>
91 Fix a crasher in a variant of #31984.
92 * const.cs (Constant.CheckBase): New override that defers the
93 new-or-override check in case the base type hasn't been populated
95 (Constant.Define): Ensure the new-or-override check is performed.
97 2005-02-01 Duncan Mak <duncan@ximian.com>
99 * const.cs (LookupConstantValue): Check that `ce' is not null
100 before calling GetValue ().
102 2005-02-01 Raja R Harinath <rharinath@novell.com>
104 Fix test-334.cs (#69519).
105 * cs-parser.jay (using_alias_directive): Pass in an expression to
106 NamespaceEntry.UsingAlias.
107 (using_namespace_directive): Pass in an expression to
108 NamespaceEntry.Using.
109 (namespace_name): Don't flatten to a string.
110 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
111 (NamespaceEntry.AliasEntry.Resolve): Lookup using
113 (NamespaceEntry.UsingEntry): Likewise.
114 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
116 (NamespaceEntry.LookupForUsing): Remove.
117 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
119 (NamespaceEntry.Lookup): Remove support for dotted names.
121 2005-02-01 Raja R Harinath <rharinath@novell.com>
123 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
125 (NamespaceEntry.ImplicitParent): Compute on demand.
126 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
127 parallels the current.
128 (NamespaceEntry.LookupForUsing): Use it.
129 (NamespaceEntry.Lookup): If the current namespace-entry is
130 implicit, don't search aliases and using tables.
132 2005-02-01 Raja R Harinath <rharinath@novell.com>
135 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
137 (TypeContainer.BaseCache): Compute on demand.
138 (TypeContainer.FindMembers): Define constants and types if they're
140 (FieldMember.Define): Move resetting of ec.InUnsafe before error
142 * const.cs (Constant.Define): Make idempotent.
144 2005-01-29 Miguel de Icaza <miguel@novell.com>
146 * pending.cs: Produce better code (no nops produced by using Ldarg
149 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
150 i - 1' it should be arg + 1.
154 2005-01-28 Raja R Harinath <rharinath@novell.com>
156 * attribute.cs (Attribute.CheckAttributeType): Make private
158 (Attribute.ResolveType): Make virtual.
159 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
160 handling of RootContext.Tree.Types.
162 2005-01-27 Raja R Harinath <rharinath@novell.com>
164 Update attribute-handling to use the SimpleName/MemberAccess
166 * cs-parser.jay (attribute): Pass in an expression to the
167 constructors of Attribute and GlobalAttribute.
168 * attribute.cs (Attribute): Take an expression for the name.
169 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
170 passed in attribute name expression.
171 (Attribute.CheckAttributeType): Use it.
172 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
173 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
174 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
175 argument to prevent error messages if the lookup fails.
177 2005-01-27 Marek Safar <marek.safar@seznam.cz>
179 * expression.cs (Indirection): Implemented IVariable interface
180 to support indirection in AddressOf operator.
181 (PointerArithmetic.Emit): Add optimalization for case where
182 result can be precomputed.
184 2005-01-26 Martin Baulig <martin@ximian.com>
186 * class.cs (TypeContainer.AttributeTargets): Return the correct
187 AttributeTargets depending on our `Kind' instead of throwing an
188 exception; fixes #71632.
190 2005-01-26 Marek Safar <marek.safar@seznam.cz>
193 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
196 2005-03-17 Martin Baulig <martin@ximian.com>
198 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
199 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
201 2005-03-17 Martin Baulig <martin@ximian.com>
203 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
204 to bool so we can return an error condition.
205 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
208 2005-03-17 Martin Baulig <martin@ximian.com>
210 * generic.cs (TypeMananager.IsIEnumerable): New public method.
212 * convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
213 converting from an array-type of T to `IEnumerable<T>'.
215 2005-03-16 Martin Baulig <martin@ximian.com>
217 * generic.cs (Nullable.Unwrap): Implement IAssignMethod.
218 (Nullable.LiftedUnaryMutator): New public class.
220 * expression.cs (UnaryMutator.DoResolve): Added support for
223 2005-03-14 Martin Baulig <martin@ximian.com>
225 * generic.cs (Nullable.NullCoalescingOperator): Implemented.
227 2005-03-14 Martin Baulig <martin@ximian.com>
229 * generic.cs (Nullable.LiftedBinaryOperator): Added support for
230 the comparision operators `<', `>', `<=' and `>='.
232 2005-03-13 Martin Baulig <martin@ximian.com>
235 (Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
236 avoid confusion with the `NullLiteral'.
237 (Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
239 2005-03-13 Martin Baulig <martin@ximian.com>
241 * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
242 comparing arbitrary types with the null literal.
244 2005-03-13 Martin Baulig <martin@ximian.com>
246 * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
247 boolean operators '&&', '||', '&' and '|'.
248 (Nullable.OperatorTrueOrFalse): New public class.
250 * ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
251 instead of a `StaticCallExpr'; added support for nullables.
253 2005-03-10 Martin Baulig <martin@ximian.com>
256 (ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
257 rather than `etype.IsSubclassOf (TypeManager.value_type)'.
259 2005-03-07 Martin Baulig <martin@ximian.com>
261 * generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
262 it work if `expr' is not an IMemoryLocation.
263 (Nullable.Lifted): Implement IMemoryLocation.
264 (Nullable.LiftedConversion.ResolveUnderlying): Use the correct
267 2005-03-05 Martin Baulig <martin@ximian.com>
269 * generic.cs (Nullable.Unwrap, Wrap): New protected classes.
270 (Nullable.Lifted): New abstract class; rewrote the lifted conversions.
271 (Nullable): Added support for lifted unary and binary operators.
273 * expression.cs (Unary.DoResolve): Added support for nullable types.
274 (Binary.DoResolve): Likewise.
275 (Conditional.DoResolve): Likewise.
277 2005-03-02 Martin Baulig <martin@ximian.com>
279 * decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
281 * class.cs (ClassPart.SetParameterInfo): Override this.
282 (PartialContainer.SetParameterInfo): Override this.
283 (TypeContainer.CheckConstraints): New protected method.
284 (PartialContainer.CheckConstraints): Override this and check
285 whether the same contraints were specified in all parts of a
286 partial generic type definition.
287 (PartialContainer.UpdateConstraints): New public method.
289 * generic.cs (TypeParameter.UpdateConstraints): New public method.
291 2005-03-02 Martin Baulig <martin@ximian.com>
293 Committing a patch from Carlos Alberto Cortez to fix #72887.
295 * convert.cs (Convert.ExplicitReferenceConversionExists): Allow
296 casts from `T []' to `int []'.
298 2005-03-02 Martin Baulig <martin@ximian.com>
300 * generic.cs (TypeManager.IsEqual): Make this symmetric.
302 * expression.cs (Binary.ResolveOperator): When resolving a
303 BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
304 `=='. Fixes #71866. See gen-127.cs.
306 2005-03-02 Martin Baulig <martin@ximian.com>
308 * class.cs (TypeContainer.DoDefineMembers): We also need a default
309 static constructor in static classes.
311 2005-03-02 Martin Baulig <martin@ximian.com>
314 (NullableType.Name, NullableType.FullName): Add a "?" to the name.
315 (Nullable.LiftedConversion): Added support for user-defined
318 * cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
320 * cs-parser.jay: Use ComposedCast everywhere instead of
321 NullableType, so we don't need to check for NullableType
323 (conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
324 case where we'll be resolved into a `parenthesized_expression_0'
328 (Convert.UserDefinedConversion): Added nullable conversions.
330 2005-02-28 Martin Baulig <martin@ximian.com>
332 * generic.cs (TypeManager.IsNullableType): New static method.
333 (Nullable): New abstract class.
334 (Nullable.NullLiteral): New public class.
335 (Nullable.LiftedConversion): New public class.
337 * cs-parser.jay (non_expression_type): Changed `builtin_types' to
338 `builtin_types opt_nullable'.
341 (Convert.ImplicitConversionStandard): Added nullable conversions.
342 (Convert.ExplicitConversionStandard): Likewise.
343 (Convert.ExplicitConversion): Likewise.
345 2005-02-26 Martin Baulig <martin@ximian.com>
347 * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
348 begin with a "?", for instance "?[]". Don't do a type lookup if
351 2005-02-25 Martin Baulig <martin@ximian.com>
353 The first part of Nullable Types :-)
355 * generic.cs (NullableType): New public class.
356 (NullCoalescingOperator): New public class.
357 (TypeArguments.Resolve): Add a CS0306 check.
359 * cs-parser.jay (opt_error_modifier): Removed, this was unused.
360 (opt_nullable): New rule.
361 (type): Added `opt_nullable' to `namespace_or_type_name',
362 `builtin_types' and `pointer_type'.
363 (array_type): Added `opt_nullable'.
364 (opt_rank_specifier_or_nullable): New rule; this is the
365 combination of `opt_rank_specifier' and `opt_nullable'.
366 (opt_error): New rule; catch errors here.
367 (nullable_type_or_conditional): New rule; we use this to check for
368 nullable and still detect the conditional operator.
369 (local_variable_type): Use `opt_rank_specifier_or_nullable'
370 instead `opt_rank_specifier'.
372 * expression.cs (ComposedCast.DoResolveAsTypeStep): Added support
375 2005-02-24 Martin Baulig <martin@ximian.com>
377 * README, README.Changes: Removed; they're old and obsolete.
379 2005-02-22 Martin Baulig <martin@ximian.com>
381 * generic.cs (TypeParameter.Resolve): If resolving the constraints
382 returned an error, set `constraints' to null to avoid a crash
384 (TypeParameter.ResolveType): Likewise.
386 2005-02-22 Martin Baulig <martin@ximian.com>
389 (Constraints.ResolveTypes): Protect against being called twice.
390 (Constraints.CheckInterfaceMethod): Don't call ResolveTypes().
391 (TypeParameter.ResolveType): New public method; calls
392 constraints.ResolveTypes().
393 (TypeParameter.DefineType): Moved constraints.ResolveType() out
394 into the new ResolveType().
395 (GenericMethod.Define): Call ResolveType() on all our
398 2005-02-21 Martin Baulig <martin@ximian.com>
401 (TypeManager.generic_nullable_type): New static public field.
402 (TypeManager.InitGenericCoreType): Lookup "System.Nullable`1".
405 (RootContext.ResolveCore): Resolve "System.Nullable`1".
407 2005-02-15 Martin Baulig <martin@ximian.com>
409 * generic.cs (ConstructedType.Constraints): Correctly check
410 constraints if the argument type is a type parameter; fixes
413 2005-02-02 Martin Baulig <martin@ximian.com>
415 * delegate.cs (Delegate.DefineType): Report an internal error if
416 TypeManager.multicast_delegate_type is null. See bug #72015 for
419 2005-01-29 Miguel de Icaza <miguel@novell.com>
421 * pending.cs: Produce better code (no nops produced by using Ldarg
424 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
425 i - 1' it should be arg + 1.
429 2005-01-26 Martin Baulig <martin@ximian.com>
431 * cs-parser.jay (indexer_declarator): Don't report an error if we
432 have type parameters since we can be an explicit interface
433 implementation; fixes #71449.
435 2005-01-26 Martin Baulig <martin@ximian.com>
437 * class.cs (TypeContainer.AttributeTargets): Return the correct
438 AttributeTargets depending on our `Kind' instead of throwing an
439 exception; fixes #71632.
441 2005-01-26 Martin Baulig <martin@ximian.com>
443 * delegate.cs (Delegate.DefineType): Correctly define our type
444 parameters. Fixes #71483.
446 2005-01-25 Raja R Harinath <rharinath@novell.com>
449 * expression.cs (MemberAccess.DoResolve): Don't complain with
450 cs0572 when the LHS of a member access has identical name and type
453 2005-01-25 Marek Safar <marek.safar@seznam.cz>
456 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
458 Create custom PermissionSet only for PermissionSetAttribute.
460 2005-01-24 Marek Safar <marek.safar@seznam.cz>
463 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
464 delegates in static class.
466 2005-01-24 Martin Baulig <martin@ximian.com>
468 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
469 merging an implicit block, just use its reachability.
471 * statement.cs (Block.Resolve): Make the unreachable code check
472 work wrt. implicit blocks; see test-337 from #63842.
474 2005-01-21 Alp Toker <alp@atoker.com>
476 * cs-parser.jay: destructor_declaration's container is PartialContainer
477 not Class when partial types are used, so use Kind prop instead of
480 2005-01-22 Miguel de Icaza <miguel@ximian.com>
482 * cs-parser.jay: Improve error reporting when an interface
485 2005-01-20 Dick Porter <dick@ximian.com>
487 * support.cs: SeekableStreamReader fix from Sandor Dobos
488 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
489 chars are read. Fixes bug 70369.
491 2005-01-20 Raja R Harinath <rharinath@novell.com>
493 * cs-parser.jay (catch_clause): Simplify current_block handling
496 2005-01-17 Miguel de Icaza <miguel@ximian.com>
498 * convert.cs (ImplicitStandardConversionExists): Synchronize the
499 code with ImplicitStandardConversion to handle the implicit
500 conversion of method groups into valid delegate invocations.
502 The problem is that in parameter handling we were using this code
503 path. Fixes bug #64698
505 2005-01-19 Raja R Harinath <rharinath@novell.com>
507 * cs-parser.jay: Fix several infelicities.
508 - Avoid assigning to the parser value stack. Code like
509 '$3 = null' is unclean. Synthesize a value for the code block
511 - Avoid using oob_stack for storing location information. Use ...
512 (_mark_): ... this. New (empty) rule. Saves the current location
514 (foreach_statement): Avoid using oob_stack for current_block
515 handling. Use technique used in for_statement and
516 using_statement. Synthesize a value for the code block to store
517 additional intermediate information.
519 2005-01-13 Miguel de Icaza <miguel@ximian.com>
521 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
522 of a different type is only allowed to private fields of a
523 containing type, not on fields of a base class.
525 See test-174.cs and error cs0122-9.cs
527 2005-01-13 Raja R Harinath <rharinath@novell.com>
529 Fix test-335.cs (bug #58126).
530 * cs-parser.jay (argument): Split out non-expression parts of the
531 rule into 'non_simple_argument'.
532 (invocation_expression): Support parenthesized invocations with
533 multiple arguments, and with single non-simple arguments.
535 2005-01-13 Raja R Harinath <rharinath@novell.com>
537 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
540 2005-01-12 Raja R Harinath <rharinath@novell.com>
542 Fix cs0038-1.cs, cs1640-6.cs.
543 * ecore.cs (Expression.Resolve): Remove special-case for
544 SimpleName in error-handling.
545 (Expression.almostMatchedMembers): Relax access permission to
547 (Expression.MemberLookupFailed): Handle duplicates in
548 almostMatchedMembers list.
549 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
550 * expression.cs (New.DoResolve): Report CS1540 for more cases.
551 * typemanager.cs (GetFullNameSignature): Use the MethodBase
552 overload if the passed in MemberInfo is a MethodBase.
554 2005-01-25 Martin Baulig <martin@ximian.com>
557 (DocUtil.emptyParamList): Removed; use `Type.EmptyTypes' instead.
559 2005-01-12 Marek Safar <marek.safar@seznam.cz>
562 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
563 for non-CAS & merge permission sets properly.
565 2005-01-11 Raja R Harinath <rharinath@novell.com>
567 Improve standard-compliance of simple name and member access
568 resolution. Fixes bugs #52697, #57200, #67520, #69519.
569 * ecore.cs (FullNamedExpression): New abstract base class
570 for Namespaces and TypeExpressions.
571 (ResolveFlags.SimpleName): Remove.
572 (SimpleName): Remove support for dotted names.
573 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
574 DeclSpace.FindType and DeclSpace.LookupType.
575 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
576 (Expression.ExprClassName): Make member function.
577 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
578 a namespace. Remove creation of dotted "SimpleName"s.
579 (MemberAccess.DoResolve): Likewise.
580 * decl.cs (DeclSpace.Cache): Make private.
581 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
582 (DeclSpace.FindType): Update.
583 (DeclSpace.LookupType): Move here from RootContext. Return a
585 * namespace.cs (Namespace): Derive from FullNamedExpression
586 so that it can be part of expression resolution.
587 (Namespace.Lookup): Return an FullNamedExpression.
588 (NamespaceEntry.LookupAlias): Lookup aliases only in current
590 * rootcontext.cs (NamespaceLookup): Remove.
591 (LookupType): Move to DeclSpace.
592 * attribute.cs (CheckAttributeType): Update.
593 * doc.cs (FindDocumentedType): Remove allowAlias argument.
594 (FindDocumentedTypeNonArray): Likewise.
596 2005-01-11 Raja R Harinath <rharinath@novell.com>
598 Fix cs0509.cs, cs1632.cs.
599 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
600 is the same as IsInterface.
601 (TypeContainer.GetClassBases): Likewise.
602 * statement.cs (LabeledStatement.ig): New field.
603 (LabeledStatement.LabelTarget): Save ILGenerator which created the
605 (LabeledStatement.DoEmit): Check that the label was created with
606 the same ILGenerator.
608 2005-01-10 Marek Safar <marek.safar@seznam.cz>
611 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
612 accessors to its properties.
614 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
615 from accessors to property.
617 2005-01-10 Marek Safar <marek.safar@seznam.cz>
620 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
623 2005-01-08 Miguel de Icaza <miguel@ximian.com>
625 * attribute.cs: Check for null and empty strings.
627 I have lost another battle to Paolo.
629 2005-01-07 Marek Safar <marek.safar@seznam.cz>
632 * class.cs (PropertyMethod): Set Parent field in ctors.
633 (SetMethod.InternalParameters): Add unsafe switch hack.
634 Override MarkForDuplicationCheck where it is appropriate.
636 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
637 It says whether container allows members with the same name.
639 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
640 Removed is_method parameter.
642 2005-01-06 Duncan Mak <duncan@ximian.com>
644 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
645 because the previous change led to incorrect reporting of CS1032
646 ("Cannot define/undefine preprocessor symbols after first token in
647 file"). Instead of using `tokens_seen' as the only flag that
648 triggers CS1040, introduce `comments_seen'. This new flag is used
649 to signify having seen comments on the current line, so it is
650 unset after a newline.
652 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
654 * doc.cs : When searching for a type, find nested type too.
655 This fixes bug #71040.
657 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
660 - Warn missing member comment on those classes which also does not
661 have doc comments. Fixed bug #71041.
662 - Don't warn missing doc comment on default constructor.
665 2005-01-06 Duncan Mak <duncan@ximian.com>
667 * cs-tokenizer.cs (xtoken): After handling traditional C-style
668 comments, set `tokens_seen' to true. This allows us to detect
669 misplaced preprocessor directives (i.e. not at the beginning of
670 the a line, nor after whitespaces). In that case, report error
671 CS1040. This fixes bug #56460.
673 * cs-parser.jay (interface_member_declaration): Add checks for
674 IsExplicitImpl, and report CS0541 error if an interface member is
675 defined as an explicit interface declaration.
677 2005-01-06 Marek Safar <marek.safar@seznam.cz>
680 * class.cs (PropertyMethod): Set Parent field in ctors.
681 (SetMethod.InternalParameters): Add unsafe switch hack.
683 * decl.cs (MemberCore.Parent): Cannot be readonly.
685 2005-01-06 Raja R Harinath <rharinath@novell.com>
687 * decl.cs (DeclSpace.ResolveType): Remove.
688 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
689 Merge in code from ...
690 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
691 * class.cs, enum.cs: Update to changes.
693 2005-01-06 Miguel de Icaza <miguel@ximian.com>
695 * anonymous.cs: Ensure that we init the scope of our parent if it
696 has not been initialized yet.
698 2004-12-30 Duncan Mak <duncan@ximian.com>
700 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
701 if field.FieldBuilder is null. Fixes #70758.
703 * convert.cs: Fixed some typos and updated some of the comments.
704 (ImplicitStandardConversionExists):
705 (TryImplicitIntConversion): If `target_type' is an interface and
706 the type of `ic' implements this interface, return true or a new
707 BoxedCast instead of null. This fixes #70468.
709 2004-12-29 Duncan Mak <duncan@ximian.com>
711 * expression.cs (Argument.Emit): Check that Expr is
712 IMemoryLocation before casting to it, and report CS1510 otherwise.
716 2004-12-21 Ben Maurer <bmaurer@ximian.com>
718 * statement.cs (Block.ThisVariable): remove the recursion here, to
719 make the --profile more sane.
721 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
723 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
724 assembly, by JB Evain.
726 2004-12-17 Raja R Harinath <rharinath@novell.com>
728 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
729 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
730 "parent" refers to enclosing type/class. "base" refers to superclass.
732 2004-12-17 Raja R Harinath <rharinath@novell.com>
734 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
735 Ensure that we only have GlobalAttributes.
736 * attribute.cs (Attribute.Emit): Make non-virtual.
737 (GlobalAttribute.Emit): Remove.
738 (Attribute.Resolve): Make virtual.
739 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
740 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
741 the argument. Don't create one.
742 (Attribute.GetObsoleteAttribute): Likewise.
743 (Attribute.GetClsCompliantAttributeValue): Likewise.
744 * class.cs, decl.cs: Update to changes.
746 2004-12-17 Marek Safar <marek.safar@seznam.cz>
748 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
750 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
752 * statement.cs (Foreach.Resolve): Add error 186 report.
754 2004-12-16 Marek Safar <marek.safar@seznam.cz>
756 * expression.cs (Conditional.DoResolve): Add warning 429.
758 * statement.cs (If.Resolve): Add warning 665.
760 2004-12-16 Raja R Harinath <rharinath@novell.com>
762 New invariant: RootContext.Tree.Types.NamespaceEntry == null
763 except when in the parser, and in GlobalAttribute.
764 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
765 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
766 RootContext.Tree.Types.NamespaceEntry once work is done.
767 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
768 and resets RootContext.Tree.Types.NamespaceEntry.
770 2004-12-15 Marek Safar <marek.safar@seznam.cz>
772 * cs-parser.jay: Don't create a block for every variable.
774 2004-12-14 Miguel de Icaza <miguel@ximian.com>
776 * location.cs: Provide extra information.
778 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
779 variables from the captured environment, it is the ldarg_0.
781 2004-12-14 Marek Safar <marek.safar@seznam.cz>
783 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
786 * class.cs: Changed warning level for 169 to avoid developer
787 displeasure from warning flooding. It will be changed back when they
788 fix most of current BCL warnings.
790 * RootContext.cs: Pushed default WarningLevel to 3.
792 * statement.cs: Removed unused variable.
794 2004-12-14 Marek Safar <marek.safar@seznam.cz>
796 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
797 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
798 Add error 502 report.
799 (StaticClass.DefineType): Add error 441 report.
800 (Class.AllowedModifiersProp): New virtual property as temporary
801 extension to AllowedModifiers.
802 (Class.DefineType): Add error 418 report. Moved ModFlags check here
803 to share implementation with StaticClass and don't call virtual
806 * driver.cs (MainDriver): Add error 1558 test.
808 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
809 report. Moved error 36 test here.
811 * statement.cs (Throw.Resolve): Add error 724 report.
813 * typemanager.cs: Add out_attribute_type core type.
815 2004-12-13 Marek Safar <marek.safar@seznam.cz>
817 * class.cs (TypeContainer.VerifyClsCompliance): Add error
819 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
821 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
824 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
826 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
827 Add error 3023 report.
828 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
830 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
833 2004-12-12 John Luke <john.luke@gmail.com>
835 * driver.cs (AddArgs): take -- into account when
836 adding arguments, fixes bug 65710
838 2004-12-12 Martin Baulig <martin@ximian.com>
840 * expression.cs (Unary.TryReduceNegative): Added support for
841 SByteConstant and ByteConstant.
842 (Unary.Reduce): Check error values from TryReduceNegative().
844 2004-12-10 Marek Safar <marek.safar@seznam.cz>
846 * attributes.cs (Attribute.Resolve): Avoid multiple error report
847 and report exception as error 182.
849 2004-12-10 Raja R Harinath <rharinath@novell.com>
851 * driver.cs (Main): Fix message when there are warnings.
853 2004-12-09 Miguel de Icaza <miguel@ximian.com>
855 * delegate.cs: Fixed my fix from yesterday, sorry about that.
857 2004-12-09 Marek Safar <marek.safar@seznam.cz>
859 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
860 Reduced number of warnings.
862 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
864 2004-12-08 Miguel de Icaza <miguel@ximian.com>
866 * driver.cs: Removed message.
868 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
870 2004-12-08 <vargaz@freemail.hu>
872 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
874 2004-12-08 Martin Baulig <martin@ximian.com>
876 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
877 instead of a CS3002 for properties and indexer.
879 2004-12-08 Martin Baulig <martin@ximian.com>
881 * decl.cs (MemberName.ToString): Make this work again.
883 2004-12-08 Marek Safar <marek.safar@seznam.cz>
885 * attribute.cs (Resolve): Add error 591 detection.
887 * class.cs (FieldMember.Define): Add error 1547 detection.
888 (Indexer.Define): Add error 620 detection.
889 (Operator.Define): Add error 590 detection.
891 * ecore.cs: Missing argument for error 79.
893 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
896 2004-12-07 Marek Safar <marek.safar@seznam.cz>
899 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
902 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
904 * cs-parser.jay : handle doc comments on implicit/explicit operators.
905 Some operator comments were suppressed.
906 * doc.cs : Implicit/explicit operator name in doc comments are like
907 "op_Explicit(type)~returnType", so added suffix handling.
909 2005-01-21 Alp Toker <alp@atoker.com>
911 * cs-parser.jay: destructor_declaration's container is PartialContainer
912 not Class when partial types are used, so use Kind prop instead of 'is'.
914 2004-12-12 Martin Baulig <martin@ximian.com>
916 * expression.cs (Unary.TryReduceNegative): Added support for
917 SByteConstant and ByteConstant.
918 (Unary.Reduce): Check error values from TryReduceNegative().
920 2004-12-11 Martin Baulig <martin@ximian.com>
922 * support.cs (ReflectionParameters.ParameterName): If we have a
923 `gpd', call `ParameterName' on it.
925 * parameter.cs (Parameter.GetParameterAttributes): New static method.
927 * pending.cs (PendingImplementation.DefineProxy): Call
928 DefineParameter() for all of the MethodBuilder's arguments.
930 2004-12-09 Martin Baulig <martin@ximian.com>
932 * doc.cs (DocUtil): Make this a static class.
934 2004-12-09 Martin Baulig <martin@ximian.com>
936 * expression.cs (Invocation.InferType): Moved the type inference
937 implementation into TypeManager.
939 * generics.cs (TypeManager): Moved the type inference
942 2004-12-09 Martin Baulig <martin@ximian.com>
944 * typemanager.cs (TypeManager): Make this a partial class.
947 (TypeManager): Move the generics part of `TypeManager' here.
949 2004-12-08 Martin Baulig <martin@ximian.com>
951 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
952 instead of a CS3002 for properties and indexer. Added CS3024
953 check for generic interfaces.
955 * attributes.cs (AttributeTester.AnalyzeTypeCompliance): Generic
956 instances are not CLS-compliant.
958 2004-12-08 Martin Baulig <martin@ximian.com>
961 (void_pointer_expression): New rule for `void*', `void**' etc.
962 (typeof_expression): Add `void_pointer_expression'; fixes #66846.
964 2004-12-08 Martin Baulig <martin@ximian.com>
966 * expression.cs (Invocation.InferType): Removed the hack for
967 MethodCore.MayUnify().
969 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
972 * class.cs (MethodCore.MayUnify): Use
973 TypeManager.MayBecomeEqualGenericTypes().
975 2004-12-08 Martin Baulig <martin@ximian.com>
977 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
978 parameter, box it. Fixes #69233.
980 2004-12-08 Martin Baulig <martin@ximian.com>
982 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
983 have the ctor constraint. Fixes #68326.
985 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
987 * cs-parser.jay : interface comment was not consumed because of
988 extra opt_semicolon before doc handling.
990 2004-12-03 Raja R Harinath <rharinath@novell.com>
992 Fix test-327.cs, test-328.cs, and put in early infrastructure
993 for eventually fixing #52697.
994 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
995 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
997 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
998 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
999 (VerifyUsing, error246): Update.
1000 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1001 'NamespaceEntry.LookupNamespaceOrType'.
1003 2004-12-07 Martin Baulig <martin@ximian.com>
1005 * driver.cs: Call it "BETA SOFTWARE" :-)
1007 2004-12-06 Raja R Harinath <rharinath@novell.com>
1009 Fix crash on cs0657-17.cs.
1010 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1011 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1012 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1013 the case where the NamespaceEntry gets overwritten.
1015 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1017 Fixed #69195, #56821
1018 * ecore.cs (ResolveBoolean): Tiny refactoring.
1020 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1021 of right expression resolving when left is false constant and
1022 operator is LogicalAnd OR true constant and operator is LogicalOr.
1024 * statement.cs (ResolveUnreachable): Always reports warning.
1026 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1028 * class.cs: Distinguish between 1721 and 1722 (just a little help
1029 for the programmer).
1031 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1033 * delegate.cs: Only allow this on new versions of the language.
1035 2004-12-02 Duncan Mak <duncan@ximian.com>
1037 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1039 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1040 here as a static method. Take an additional bool out parameter
1041 `must_do_cs1540_check' for signaling to InstanceResolve.
1042 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1043 member field from PropertyExpr class and made it an argument of
1045 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1046 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1047 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1048 and `remove_accessor' as well as InstanceResolve: report CS0122
1053 2004-12-07 Martin Baulig <martin@ximian.com>
1055 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
1056 and CS0692 where appropriate.
1058 2004-12-06 Martin Baulig <martin@ximian.com>
1060 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
1061 IsDuplicateImplementation() and improved it.
1063 * expression.cs (Invocation.InferTypeArguments): Added
1064 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
1065 and removed the "ref" modifier from `infered_types'.
1067 * decl.cs (MemberName.ToString): Removed the exception.
1069 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1071 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1072 comments are allowed.
1074 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1076 * delegate.cs: Add checks for subtypes in paramaters and return values
1077 in VerifyMethod () to add support for Covariance/Contravariance
1080 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1082 * report.cs: Remove extra closing parenthesis.
1084 * convert.cs (Error_CannotImplicitConversion): If the name of the
1085 types are the same, provide some extra information.
1087 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1090 * attribute.cs (Resolve): Improved implementation of params
1091 attribute arguments.
1093 * support.cs (ParameterData): Add HasParams to be faster.
1095 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1097 all things are for /doc support:
1099 * doc.cs: new file that supports XML documentation generation.
1100 * mcs.exe.sources: added doc.cs.
1102 Handle /doc command line option.
1103 Report error 2006 instead of 5 for missing file name for /doc.
1104 Generate XML documentation when required, after type resolution.
1106 Added support for picking up documentation (/// and /** ... */),
1107 including a new XmlCommentState enumeration.
1109 Added lines to fill Documentation element for field, constant,
1110 property, indexer, method, constructor, destructor, operator, event
1111 and class, struct, interface, delegate, enum.
1112 Added lines to warn incorrect comment.
1114 Added Documentation field (passed only when /doc was specified).
1116 Added DocComment, DocCommentHeader, GenerateDocComment() and
1117 OnGenerateDocComment() and some supporting private members for
1118 /doc feature to MemberCore.
1120 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1122 Added overriden DocCommentHeader.
1124 Added overriden DocCommentHeader and GenerateDocComment().
1126 2004-12-01 Miguel de Icaza <miguel@ximian.com>
1128 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
1129 unwrapping the enumeration values, chain to
1130 DoConstantNumericPromotions again, so we can promote things to the
1131 fundamental types (takes care of enums that are bytes, sbytes).
1135 2004-12-01 Raja R Harinath <rharinath@novell.com>
1137 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
1138 Fix long-standing bug in type-lookup. Use FindType instead of
1139 LookupType when ec.ResolvingTypeTree.
1140 (Attribute.ResolveType, Attribute.Resolve)
1141 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
1143 (Attributes.Search): Remove internal version. Update.
1144 (Attributes.SearchMulti): Update.
1145 (Attributes.GetClsCompliantAttribute): Remove.
1146 (Attributes.GetIndexerNameAttribute): Remove.
1147 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
1148 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
1149 * class.cs (Indexer.Define): Likewise.
1151 2004-12-01 Marek Safar <marek.safar@seznam.cz>
1154 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
1155 MarshallByReference members access.
1157 * expression.cs: Use CheckMarshallByRefAccess;
1158 Better error CS0197 message.
1160 * report.cs: Print whole related error message.
1162 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1164 * class (GetClassBases): Better error 60 report.
1165 (EventProperty): Disabled warning 67 detection.
1167 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1170 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
1172 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
1175 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1178 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
1180 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
1182 2004-11-26 Miguel de Icaza <miguel@ximian.com>
1184 * attribute.cs (Attribute.Resolve): Refine error reporting and
1185 report a cs0117 if the identifier does not exist, to distinguish
1186 from 0617 which is a miss-use of the actual identifier.
1188 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
1189 between cs0070 and cs0079.
1191 * class.cs (MemberBase.DoDefine): When reporting a wrong
1192 accessibility level, we use MethodCore to compare instead of
1193 Method (this was a regression in some refactoring effort).
1195 So now we correctly report cs0056 again.
1197 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
1198 testing the target_type (which was known to be object_type) and
1199 not the source type (which is anonymous_method).
1201 Fixed reporting of error cs1660.
1203 * expression.cs (UserCast.Source): Expose the underlying cast.
1205 * statement.cs (Switch.SwitchGoverningType): Sort the list of
1206 allowed types to find a match to int32 first (most common).
1208 In addition, it ignores any ImplicitUserConversions that did an
1209 internal implicit conversion (as the switch statement allows only
1210 one integral conversion to exist).
1212 * class.cs (PartialContainer.Create): rename `name' to
1213 `member_name' for clarity. Then replace the string calls with a
1214 call to MemberName.GetPartialName, as now using
1215 MemberName.ToString is an error (this is due to the side effects
1216 it had, that were fixed in the past).
1218 This will restore the error reporting on a number of partial class
1219 errors that were missusing this (and getting an exception as a
1220 results, which is now just a plain textual warning, because
1221 yyparse debug output would crash otherwise).
1223 2004-11-26 Raja R Harinath <rharinath@novell.com>
1225 * Makefile (PROGRAM_INSTALL_DIR): Remove.
1227 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1229 * rootcontext.cs (LookupType): Make sure to cache lookups that
1230 don't give us a negative result. This saves about 5% of corlib
1233 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1235 * report.cs (AbstractMessage.Print): messages are sent to stderr
1237 * class.cs (TypeContainer.GetClassBases): It is an error to have a
1238 non-interface in the list of interfaces (at this point, either
1239 parent was properly set, or a base class is being listed in the
1240 interfaces section).
1242 This flags error 1722, and resolves the crash from bug 69259.
1244 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1246 * statement.cs (Using.EmitExpressionFinally): make this work right
1247 for valuetypes. Fixes 69926.
1249 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1251 * const.cs (Const.ChangeType): Cope with the "0 literal can be
1252 converted to an enum" here, before we try to change the underlying
1253 type. This code exists, but it is a different code path than the
1254 one used while encoding constants.
1256 (ImplicitReferenceConversionExists): In addition, resynchronized
1257 the code here, so it matches the same code in
1258 ImplicitReferenceConversionExists for the `from any class-type S
1259 to any interface-type T'.
1261 2004-11-25 Marek Safar <marek.safar@seznam.cz>
1263 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
1265 2004-11-24 Miguel de Icaza <miguel@ximian.com>
1267 * cs-parser.jay: Use verbosity accordingly.
1269 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1271 * expression.cs (Unary.ResolveOperator): Do not report warning;
1272 AddressOf reads from variable.
1274 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
1276 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1280 * attribute.cs (Attributable): Removed CheckTargets.
1281 (Attributes.Emit): Explicit attribute targets are tested here.
1283 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1284 not enabled for interfaces.
1286 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1287 (GetAssemblyName): Ouch next bug there.
1289 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1291 * expression.cs: Error 275 added.
1293 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1295 Fix bug #69177 (Implemented decimal constant support)
1297 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1298 (BinaryFold): Add DecimalConstant.
1300 * const.cs (Define): Decimal constant
1302 (ChangeType): Add decimal type handling.
1303 (LookupConstantValue): Don't set value for decimal type but
1304 emit DecimalConstantAttribute. Needed for constant optimization.
1306 * constant.cs (ToDecimal): New method.
1307 (ConvertToDecimal): New method.
1308 (IntConstant): Implemented ConvertToDecimal.
1309 (DecimalConstant.Emit): Emit optimized version for decimals in
1312 * expression.cs (ResolveOperator): Changed order of constant
1313 reduction to work correctly with native types which have
1314 overloaded operators.
1315 (ResolveMemberAccess): Extract constant value from attribute
1318 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1320 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1321 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1322 (ChangeType): Decimal is special.
1323 (TypeToCoreType): Add decimal type.
1325 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1327 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1330 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1332 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1335 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1337 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1339 * pending.cs (PendingImplementation): Grab only interfaces.
1341 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1343 * statement.cs (ForeachHelperMethods): Add location member and
1344 error 202 detection.
1346 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1348 * expression.cs (DoResolveBase): Fixed wrong warning for out
1351 2004-12-04 Martin Baulig <martin@ximian.com>
1353 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
1354 to check whether the conversion is ok.
1356 * typemanager.cs (TypeManager.GetTypeArguments): Just return
1357 `Type.EmptyTypes' if we're not a generic TypeContainer.
1359 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1361 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1362 old bug: when converting from the null literal to a pointer,
1363 return an EmptyCast, not the NullLiteral.
1365 This fixes #69921, the recent null_type changes probably made this
1368 2004-12-03 Martin Baulig <martin@ximian.com>
1370 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1371 method as our child, call AnonymousMethod.Compatible() on it.
1373 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1375 * class.cs (FieldBase): Use an unused bit field from the field to
1376 encode the `has_offset' property from the FieldMember. This saves
1377 a couple of Ks on bootstrap compilation.
1379 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1380 method as our child, return the AnonymousMethod resolved
1383 * expression.cs (New.DoResolve): Allow return values from
1384 NewDelegate to also include AnonymousMethods.
1388 2004-11-29 Raja R Harinath <rharinath@novell.com>
1390 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
1392 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
1393 System.Runtime.InteropServices._Exception, since it's a base
1394 interface of the core type System.Exception in the net_2_0 profile.
1396 2004-11-27 Martin Baulig <martin@ximian.com>
1398 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
1400 2004-11-26 Raja R Harinath <rharinath@novell.com>
1402 * Makefile: Convert to use executable.make.
1403 * gmcs.exe.sources: New.
1405 2004-11-25 Martin Baulig <martin@ximian.com>
1407 * expression.cs (Invocation.InferType): Added support for byref types.
1409 2004-11-25 Martin Baulig <martin@ximian.com>
1411 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
1412 in TypeManager.TypeToCoreType().
1414 2004-11-25 Martin Baulig <martin@ximian.com>
1416 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
1417 "Dispose" method from the `current_type'.
1418 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
1419 DoDefineMembers() instead of using the MethodBuilder; this is
1420 required for generic iterators.
1422 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
1424 2004-11-24 Martin Baulig <martin@ximian.com>
1426 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
1428 2004-11-20 Martin Baulig <martin@ximian.com>
1430 * expression.cs (Invocation.InferType): Correctly infer generic
1431 instances; see gen-103.cs.
1432 (Invocation.InferTypeArguments): If a generic method doesn't have
1433 any unbound type parameters, we don't need to infer anything.
1435 2004-11-19 Raja R Harinath <rharinath@novell.com>
1437 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
1439 2004-11-17 Raja R Harinath <rharinath@novell.com>
1441 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1442 (TypeHandle.GetMemberCache): New.
1443 (TypeHandle.TypeHandle): Update.
1444 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1445 (TypeManager.LookupParentInterfacesCache):
1446 Rename from LookupInterfaceCache. Optimize slightly.
1447 (TypeManager.MemberLookup_FindMembers): Update.
1448 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1450 (AddCacheContents): Rename from AddHashtable.
1451 * class.cs (TypeContainer.parent_container): Remove.
1452 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1453 (TypeContainer.DoDefineMembers): Don't initialize it.
1454 Update to name changes.
1456 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1458 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1459 that factors the code to check access modifiers on override.
1461 (PropertyBase): Use the code here.
1463 Patch from Lluis S'anchez, fixes bug #69361.
1465 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1467 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1468 routine that is used to report the use of a captured variable
1469 whose address has been taken.
1471 There are two checks: one when variables are being captured and
1472 the other check is when the address of a variable is taken.
1474 (because an anonymous methods might be resolved before *or* after
1475 the address has been taken) and
1477 * expression.cs (Conditional.DoResolve): Remove the special
1478 casing that Martin added to trueExpr and falseExpr being both
1479 NullLiteral. We get the right behavior now just by introducing
1480 the null_type into the compiler.
1482 * convert.cs (ExplicitConversion): Change the code to use
1483 null_type instead of testing `expr is NullLiteral'.
1484 (ImplicitConversionStandard): use null_type too.
1485 (ImplicitReferenceConversionExists): use null_type too.
1486 (ImplicitReferenceConversion): use null_type too.
1488 * literal.cs: The type of `NullLiteral' is now null_type instead
1490 (Resolve): Set the type here.
1492 * typemanager.cs: Introduce null_type.
1494 2004-11-18 Martin Baulig <martin@ximian.com>
1497 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
1499 2004-11-18 Martin Baulig <martin@ximian.com>
1501 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
1503 2004-11-18 Martin Baulig <martin@ximian.com>
1505 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
1506 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
1507 call ResolveConstructedType() on it to resolve it without checking
1509 (Constraints.ResolveTypes): Check them here.
1510 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
1511 but don't check constraints.
1512 (ConstructedType.ResolveAsTypeTerminal): Override this and also
1513 check constraints here.
1514 (ConstructedType.ResolveConstructedType): New public method. This
1515 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
1516 resolve ourselves without checking constraints.
1518 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
1520 2004-11-18 Martin Baulig <martin@ximian.com>
1523 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
1525 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
1527 2004-11-18 Martin Baulig <martin@ximian.com>
1529 * ecore.cs (TypeExpr.ResolveType): Removed.
1530 (Expression.ResolveAsTypeTerminal): We always return a fully
1531 resolved `TypeExpr', so we can just access its `Type'.
1533 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
1535 2004-11-17 Martin Baulig <martin@ximian.com>
1537 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
1538 sure we don't return any unresolved TypeExpr's.
1539 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
1541 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
1543 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
1544 unresolved `ConstructedType's.
1546 2004-11-17 Martin Baulig <martin@ximian.com>
1548 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
1550 2004-11-17 Martin Baulig <martin@ximian.com>
1553 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
1555 * decl.cs (DeclSpace.ResolveType): Removed.
1556 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
1558 2004-11-17 Martin Baulig <martin@ximian.com>
1560 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1561 direction, like FindMembers() does. Fixes #69546, testcase is in
1564 2004-11-16 Martin Baulig <martin@ximian.com>
1566 This is based on a patch from Marek Safar, see bug #69082.
1567 Fixes bugs #63705 and #67130.
1569 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1570 method; create a MemberCache for an interface type and cache the
1573 * decl.cs (IMemberContainer.ParentContainer): Removed.
1574 (IMemberContainer.ParentCache): New property.
1575 (MemberCache.SetupCacheForInterface): Removed.
1576 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1577 to create a cache for an interface's "parent".
1579 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1582 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1584 * statement.cs: Avoid adding bools to a hashtable.
1586 2004-11-15 Martin Baulig <martin@ximian.com>
1588 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
1590 2004-11-11 Martin Baulig <martin@ximian.com>
1592 * typemanager.cs (TypeManager.GetMethodName): New method.
1594 * class.cs (MethodData.Define): Include the generic arity in the
1595 name of an explicit interface; also add it to the method name.
1597 * pending.cs (PendingImplementation.InterfaceMethod): The method
1598 name now includes the generic arity.
1600 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1602 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1603 calling an unsafe method from a safe location.
1605 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1608 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1610 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1612 * namespace.cs (VerifyUsing): use GetPartialName instead of
1615 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1617 * statement.cs (Return.Resolve): Fix regression in typo: if
1618 `in_exc', we have to request a NeedReturnLabel, this was a typo
1619 introduced in the anonymous method check-in. Fixes #69131.
1621 * Indexers were using the ShortName when defining themselves,
1622 causing a regression in the compiler bootstrap when applying the
1623 patch from 2004-11-02 (first part), now they use their full name
1624 and the bug is gone.
1626 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1628 * driver.cs: Strip the path from the names of embedded resources. Fixes
1631 2004-11-04 Raja R Harinath <rharinath@novell.com>
1633 Fix error message regression: cs0104-2.cs.
1634 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1635 (AliasEntry.Resolve): Update.
1636 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1638 (RootContext.LookupType): Update.
1640 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1642 * cs-parser.jay: Add support for handling accessor modifiers
1643 * class: Add support port accessor modifiers and error checking,
1644 define PropertyMethod.Define as virtual (not abstract anymore)
1645 * ecore.cs: Add checking for proeprties access with access modifiers
1646 * iterators.cs: Modify Accessor constructor call based in the modified
1648 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1650 * expression.cs (StringConcat): Handle being called twice,
1651 as when we have a concat in a field init with more than two
1654 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1656 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1657 special case explicit implementations, we should always produce
1658 the .property or .event declaration.
1660 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1661 since it will not return correct data if people use this
1662 unresolved in the presence of using statements (see test-313).
1664 * class.cs (MethodData.Define): If we are an explicit interface
1665 implementation, set the method name to the full name of the
1666 interface plus the name of the method.
1668 Notice that using the method.MethodName.GetFullName() does not
1669 work, as it will only contain the name as declared on the source
1670 file (it can be a shorthand in the presence of using statements)
1671 and not the fully qualifed type name, for example:
1675 class D : ICloneable {
1676 object ICloneable.Clone () {
1680 Would produce a method called `ICloneable.Clone' instead of
1681 `System.ICloneable.Clone'.
1683 * namespace.cs (Alias.Resolve): Use GetPartialName.
1685 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1687 * cs-parser.jay: Add error 1055 report.
1689 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1691 * assign.cs (Assign.DoResolve): Only do the transform of
1692 assignment into a New if the types are compatible, if not, fall
1693 through and let the implicit code deal with the errors and with
1694 the necessary conversions.
1696 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1698 * cs-parser.jay: Add error 1031 report.
1700 * cs-tokenizer.cs: Add location for error 1038.
1702 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1704 * cs-parser.jay: Add error 1016 report.
1706 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1708 * cs-parser.jay: Add errors 1575,1611 report.
1710 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1712 * cs-parser.jay: Add error 1001 report.
1714 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1717 * attribute.cs (GetMarshal): Add method argument for
1718 caller identification.
1720 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1721 agument for GetMarshal and RuntimeMissingSupport.
1723 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1725 * attribute.cs (ExtractSecurityPermissionSet): Removed
1726 TypeManager.code_access_permission_type.
1728 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1730 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1732 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1733 for obsolete use of a variable here. Fixes regression on errors
1734 cs0619-25 and cs0619-26.
1736 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1738 Fix #62358, implemented security attribute encoding.
1740 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1741 Tests permitted SecurityAction for assembly or other types.
1742 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1743 data from SecurityPermissionAttribute to PermisionSet class.
1745 * class.cs (ApplyAttributeBuilder): Added special handling
1746 for System.Security.Permissions.SecurityAttribute based types.
1748 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1749 special handling for System.Security.Permissions.SecurityAttribute
1752 * enum.cs (ApplyAttributeBuilder): Added special handling
1753 for System.Security.Permissions.SecurityAttribute based types.
1755 * parameter.cs (ApplyAttributeBuilder): Added special handling
1756 for System.Security.Permissions.SecurityAttribute based types.
1758 * rootcontext.cs: Next 2 core types.
1760 * typemanager.cs (TypeManager.security_permission_attr_type):
1761 Built in type for the SecurityPermission Attribute.
1762 (code_access_permission_type): Build in type.
1764 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1766 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1767 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1768 all of this information into
1769 EmitContext.EmitCapturedVariableInstance.
1771 * codegen.cs (EmitCapturedVariableInstance): move here the
1772 funcionality of emitting an ldarg.0 in the presence of a
1773 remapping. This centralizes the instance emit code.
1775 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1776 then emit a load of this: it means that we have reached the
1777 topmost ScopeInfo: the one that contains the pointer to the
1778 instance of the class hosting the anonymous method.
1780 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1781 captures to the topmost CaptureContext.
1783 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1785 * expression.cs (LocalVariableReference): Move the knowledge about
1786 the iterators into codegen's EmitCapturedVariableInstance.
1788 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1790 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1791 all code paths return a value from an anonymous method (it is the
1792 same as the 161 error, but for anonymous methods).
1794 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1796 The introduction of anonymous methods in the compiler changed
1797 various ways of doing things in the compiler. The most
1798 significant one is the hard split between the resolution phase
1799 and the emission phases of the compiler.
1801 For instance, routines that referenced local variables no
1802 longer can safely create temporary variables during the
1803 resolution phase: they must do so from the emission phase,
1804 since the variable might have been "captured", hence access to
1805 it can not be done with the local-variable operations from the runtime.
1809 (Block.Flags): New flag `IsTopLevel' to indicate that this block
1810 is a toplevel block.
1812 (ToplevelBlock): A new kind of Block, these are the blocks that
1813 are created by the parser for all toplevel method bodies. These
1814 include methods, accessors and anonymous methods.
1816 These contain some extra information not found in regular blocks:
1817 A pointer to an optional CaptureContext (for tracking captured
1818 local variables and parameters). A pointer to the parent
1821 (Return.Resolve): Catch missmatches when returning a value from an
1822 anonymous method (error 1662).
1823 Invoke NeedReturnLabel from the Resolve phase instead of the emit
1826 (Break.Resolve): ditto.
1828 (SwitchLabel): instead of defining the labels during the
1829 resolution phase, we now turned the public ILLabel and ILLabelCode
1830 labels into methods called GetILLabelCode() and GetILLabel() that
1831 only define the label during the Emit phase.
1833 (GotoCase): Track the SwitchLabel instead of the computed label
1834 (its contained therein). Emit the code by using
1835 SwitchLabel.GetILLabelCode ().
1837 (LocalInfo.Flags.Captured): A new flag has been introduce to track
1838 whether the Local has been captured or not.
1840 (LocalInfo.IsCaptured): New property, used to tell whether the
1841 local has been captured.
1843 * anonymous.cs: Vastly updated to contain the anonymous method
1846 The main classes here are: CaptureContext which tracks any
1847 captured information for a toplevel block and ScopeInfo used to
1848 track the activation frames for various local variables.
1850 Each toplevel block has an optional capture context associated
1851 with it. When a method contains an anonymous method both the
1852 toplevel method and the anonymous method will create a capture
1853 context. When variables or parameters are captured, they are
1854 recorded on the CaptureContext that owns them, for example:
1858 MyDelegate d = delegate {
1863 Here `a' will be recorded as captured on the toplevel
1864 CapturedContext, the inner captured context will not have anything
1865 (it will only have data if local variables or parameters from it
1866 are captured in a nested anonymous method.
1868 The ScopeInfo is used to track the activation frames for local
1869 variables, for example:
1871 for (int i = 0; i < 10; i++)
1872 for (int j = 0; j < 10; j++){
1873 MyDelegate d = delegate {
1878 At runtime this captures a single captured variable `i', but it
1879 captures 10 different versions of the variable `j'. The variable
1880 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
1881 recorded on a child.
1883 The toplevel ScopeInfo will also track information like the `this'
1884 pointer if instance variables were referenced (this is necessary
1885 as the anonymous method lives inside a nested class in the host
1886 type of the method).
1888 (AnonymousMethod): Expanded to track the Toplevel, implement
1889 `AnonymousMethod.Compatible' to tell whether an anonymous method
1890 can be converted to a target delegate type.
1892 The routine now also produces the anonymous method content
1894 (AnonymousDelegate): A helper class that derives from
1895 DelegateCreation, this is used to generate the code necessary to
1896 produce the delegate for the anonymous method that was created.
1898 * assign.cs: API adjustments for new changes in
1899 Convert.ImplicitStandardConversionExists.
1901 * class.cs: Adjustments to cope with the fact that now toplevel
1902 blocks are of type `ToplevelBlock'.
1904 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
1905 insteda of standard blocks.
1907 Flag errors if params arguments are passed to anonymous methods.
1909 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
1910 `CurrentAnonymousMethod' which points to the current Anonymous
1911 Method. The variable points to the AnonymousMethod class that
1912 holds the code being compiled. It is set in the new EmitContext
1913 created for the anonymous method.
1915 (EmitContext.Phase): Introduce a variable and an enumeration to
1916 assist in enforcing some rules about when and where we are allowed
1917 to invoke certain methods (EmitContext.NeedsReturnLabel is the
1918 only one that enfonces this right now).
1920 (EmitContext.HaveCaptureInfo): new helper method that returns
1921 whether we have a CapturedContext initialized.
1923 (EmitContext.CaptureVariable): New method used to register that a
1924 LocalInfo must be flagged for capturing.
1926 (EmitContext.CapturedParameter): New method used to register that a
1927 parameters must be flagged for capturing.
1929 (EmitContext.CapturedField): New method used to register that a
1930 field must be flagged for capturing.
1932 (EmitContext.HaveCapturedVariables,
1933 EmitContext.HaveCapturedFields): Return whether there are captured
1934 variables or fields.
1936 (EmitContext.EmitMethodHostInstance): This is used to emit the
1937 instance for the anonymous method. The instance might be null
1938 (static methods), this (for anonymous methods that capture nothing
1939 and happen to live side-by-side with the current method body) or a
1940 more complicated expression if the method has a CaptureContext.
1942 (EmitContext.EmitTopBlock): Routine that drives the emission of
1943 code: it will first resolve the top block, then emit any metadata
1944 and then emit the code. The split is done so that we can extract
1945 any anonymous methods and flag any captured variables/parameters.
1947 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
1948 during this phase, the ILGenerator should not be used as labels
1949 and local variables declared here might not be accessible to any
1950 code that is part of an anonymous method.
1952 Exceptions to this include the temporary variables that are
1953 created by some statements internally for holding temporary
1956 (EmitContext.EmitMeta): New routine, in charge of emitting all the
1959 (EmitContext.TemporaryReturn): This method is typically called
1960 from the Emit phase, and its the only place where we allow the
1961 ReturnLabel to be defined other than the EmitMeta. The reason is
1962 that otherwise we would have to duplicate a lot of logic in the
1963 Resolve phases of various methods that today is on the Emit
1966 (EmitContext.NeedReturnLabel): This no longer creates the label,
1967 as the ILGenerator is not valid during the resolve phase.
1969 (EmitContext.EmitThis): Extended the knowledge in this class to
1970 work in anonymous methods in addition to iterators.
1972 (EmitContext.EmitCapturedVariableInstance): This emits whatever
1973 code is necessary on the stack to access the instance to a local
1974 variable (the variable will be accessed as a field).
1976 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
1977 EmitContext.EmitAddressOfParameter): Routines to support
1978 parameters (not completed at this point).
1980 Removals: Removed RemapLocal and RemapLocalLValue. We probably
1981 will also remove the parameters.
1983 * convert.cs (Convert): Define a `ConstantEC' which points to a
1984 null. This is just to prefity some code that uses
1985 ImplicitStandardConversion code and do not have an EmitContext
1988 The idea is to flag explicitly that at that point in time, it is
1989 known that the conversion will not trigger the delegate checking
1990 code in implicit conversions (which requires a valid
1993 Everywhere: pass new EmitContext parameter since
1994 ImplicitStandardConversionExists now requires it to check for
1995 anonymous method conversions.
1997 (Convert.ImplicitStandardConversionExists): If the type of an
1998 expression is the anonymous_method_type, and the type is a
1999 delegate, we invoke the AnonymousMethod.Compatible method to check
2000 whether an implicit conversion is possible.
2002 (Convert.ImplicitConversionStandard): Only do implicit method
2003 group conversions if the language level is not ISO_1.
2005 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2006 MethodInfo for the Invoke method. used by Delegate and
2009 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2010 method conversions if the target type is a delegate.
2012 Removed extra debugging nops.
2014 (LocalVariableReference): Turn the `local_info' into a public
2017 Add `prepared' field, the same hack used for FieldExprs to cope
2018 with composed assignments, as Local variables do not necessarily
2019 operate purely on the stack as they used to: they can be captured
2022 Add `temp' for a temporary result, like fields.
2024 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2026 It now copes with Local variables that are captured and emits the
2027 proper instance variable to load it from a field in the captured
2030 (ParameterReference.DoResolveBase): During the resolve phase,
2031 capture parameters if we are in an anonymous method.
2033 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2034 anonymous method, use the EmitContext helper routines to emit the
2035 parameter reference.
2037 * iterators.cs: Set RemapToProxy to true/false during the
2040 * parameters.cs (GetParameterByName): New helper method.
2042 * typemanager.cs (anonymous_method_type) a new type that
2043 represents an anonyous method. This is always an internal type,
2044 used as a fencepost to test against the anonymous-methodness of an
2047 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2049 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2051 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2053 2004-11-10 Martin Baulig <martin@ximian.com>
2055 * expression.cs (Invocation.BetterFunction): If two methods have
2056 equal parameter types, but only one of them is generic, the
2057 non-generic one wins.
2058 (New.DoResolve): Don't set `is_struct' to false if we're a generic
2059 instance; just use `Type.IsValueType' to determine whether
2060 something is a struct or not.
2061 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
2062 so we can be called multiple times.
2064 2004-11-10 Martin Baulig <martin@ximian.com>
2066 * generic.cs (TypeParameter.DefineConstraints): New public method.
2067 (TypeParameter.CheckAccessLevel): Override this and return true.
2068 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
2069 override ResolveType() anymore.
2070 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
2072 2004-11-10 Martin Baulig <martin@ximian.com>
2074 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
2075 call DeclSpace.ResolveNestedType() on it.
2077 2004-11-10 Martin Baulig <martin@ximian.com>
2079 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
2080 non-null, call ParameterModifier() on it.
2082 2004-11-10 Martin Baulig <martin@ximian.com>
2085 (Iterators): Added `current_type' and `this_type' fields.
2086 (Iterators.DefineIterator): Create a new EmitContext and store it
2087 in `ec'; compute `this_type'.
2089 2004-11-10 Martin Baulig <martin@ximian.com>
2092 (TypeManager.IsPrivateAccessible): New public method.
2093 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
2095 2004-11-10 Martin Baulig <martin@ximian.com>
2097 * class.cs (TypeContainer.DefineType): Call
2098 TypeBuilder.DefineGenericParameters() before resolving the type
2100 (MethodData.parent_method): New protected field.
2101 (MethodData..ctor): Added `MethodInfo parent_method' argument.
2102 (MethodData.Define): Compute `parent_method'.
2105 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
2106 (MemberCore.GetClsCompliantAttributeValue): Likewise.
2107 (DeclSpace.ec): New protected field; store the EmitContext here.
2108 (DeclSpace.EmitContext): New public property.
2109 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
2110 (DeclSpace.ResolveNestedType): New public method.
2111 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
2112 (DeclSpace.NestedAccessible): Added `Type tb' argument.
2113 (DeclSpace.FamilyAccessible): Likewise.
2114 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
2115 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
2118 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
2121 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
2122 (Enum.Emit): Don't create a new EmitContext.
2124 2004-10-18 Martin Baulig <martin@ximian.com>
2126 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2127 `Type' directly, but call ResolveType() on it.
2128 (Catch.Resolve): Likewise.
2129 (Foreach.Resolve): Likewise.
2131 2004-10-18 Martin Baulig <martin@ximian.com>
2133 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2134 `Type' directly, but call ResolveType() on it.
2135 (Probe.DoResolve): Likewise.
2136 (ArrayCreation.LookupType): Likewise.
2137 (TypeOf.DoResolve): Likewise.
2138 (SizeOf.DoResolve): Likewise.
2140 2004-10-18 Raja R Harinath <rharinath@novell.com>
2142 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2145 2004-10-17 John Luke <john.luke@gmail.com>
2147 * class.cs (Operator.GetSignatureForError): use CSharpName
2149 * parameter.cs (Parameter.GetSignatureForError): Returns
2150 correct name even if was not defined.
2152 2004-10-13 Raja R Harinath <rharinath@novell.com>
2155 * class.cs (TypeContainer.EmitContext): New property.
2156 (DefineNestedTypes): Create an emitcontext for each part.
2157 (MethodCore.DoDefineParameters): Use container's emitcontext.
2158 Pass type array to InternalParameters.
2159 (MemberBase.DoDefine): Use container's emitcontext.
2160 (FieldMember.Define): Likewise.
2161 (Event.Define): Likewise.
2162 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2163 Pass type array to InternalParameters.
2164 (SetIndexerMethod.GetParameterInfo): Likewise.
2165 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2166 * delegate.cs (Define): Pass emitcontext to
2167 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2168 array to InternalParameters.
2169 * expression.cs (ParameterReference.DoResolveBase): Pass
2170 emitcontext to GetParameterInfo.
2171 (ComposedCast.DoResolveAsTypeStep): Remove check on
2172 ec.ResolvingTypeTree.
2173 * parameter.cs (Parameter.Resolve): Change argument to
2174 EmitContext. Use ResolveAsTypeTerminal.
2175 (Parameter.GetSignature): Change argument to EmitContext.
2176 (Parameters.ComputeSignature): Likewise.
2177 (Parameters.ComputeParameterTypes): Likewise.
2178 (Parameters.GetParameterInfo): Likewise.
2179 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2180 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2181 * support.cs (InternalParameters..ctor): Remove variant that takes
2183 * typemanager.cs (system_intptr_expr): New.
2184 (InitExpressionTypes): Initialize it.
2186 2004-10-12 Chris Toshok <toshok@ximian.com>
2188 * cs-parser.jay: fix location for try_statement and catch_clause.
2190 2004-10-18 Martin Baulig <martin@ximian.com>
2192 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2193 `Type' directly, but call ResolveType() on it.
2194 (MemberBase.DoDefine): Likewise.
2196 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2197 `Type' directly, but call ResolveType() on it.
2198 (ComposedCast.DoResolveAsTypeStep): Likewise.
2200 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2201 `Type' directly, but call ResolveType() on it.
2203 2004-10-17 John Luke <john.luke@gmail.com>
2205 * class.cs (Operator.GetSignatureForError): use CSharpName
2207 * parameter.cs (Parameter.GetSignatureForError): Returns
2208 correct name even if was not defined.
2210 2004-10-13 Raja R Harinath <rharinath@novell.com>
2213 * class.cs (TypeContainer.EmitContext): New property.
2214 (DefineNestedTypes): Create an emitcontext for each part.
2215 (MethodCore.DoDefineParameters): Use container's emitcontext.
2216 Pass type array to InternalParameters.
2217 (MemberBase.DoDefine): Use container's emitcontext.
2218 (FieldMember.Define): Likewise.
2219 (Event.Define): Likewise.
2220 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2221 Pass type array to InternalParameters.
2222 (SetIndexerMethod.GetParameterInfo): Likewise.
2223 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2224 * delegate.cs (Define): Pass emitcontext to
2225 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2226 array to InternalParameters.
2227 * expression.cs (ParameterReference.DoResolveBase): Pass
2228 emitcontext to GetParameterInfo.
2229 (ComposedCast.DoResolveAsTypeStep): Remove check on
2230 ec.ResolvingTypeTree.
2231 * parameter.cs (Parameter.Resolve): Change argument to
2232 EmitContext. Use ResolveAsTypeTerminal.
2233 (Parameter.GetSignature): Change argument to EmitContext.
2234 (Parameters.ComputeSignature): Likewise.
2235 (Parameters.ComputeParameterTypes): Likewise.
2236 (Parameters.GetParameterInfo): Likewise.
2237 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2238 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2239 * support.cs (InternalParameters..ctor): Remove variant that takes
2241 * typemanager.cs (system_intptr_expr): New.
2242 (InitExpressionTypes): Initialize it.
2244 2004-10-12 Chris Toshok <toshok@ximian.com>
2246 * cs-parser.jay: fix location for try_statement and catch_clause.
2248 2004-10-07 Raja R Harinath <rharinath@novell.com>
2250 More DeclSpace.ResolveType avoidance.
2251 * decl.cs (MemberCore.InUnsafe): New property.
2252 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2253 with newly created EmitContext.
2254 (FieldMember.Define): Likewise.
2255 * delegate.cs (Delegate.Define): Likewise.
2256 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2257 only if normal name-lookup fails.
2258 (TypeExpr.DoResolve): Enable error-checking.
2259 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2260 (SizeOf.DoResolve): Likewise.
2261 (ComposedCast.DoResolveAsTypeStep): Likewise.
2262 (StackAlloc.DoResolve): Likewise.
2263 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2264 (Block.Unsafe): New property.
2265 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2266 (Unsafe): Set 'unsafe' flag of contained block.
2267 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2268 (Fixed.Resolve): Likewise.
2269 (Catch.Resolve): Likewise.
2270 (Using.ResolveLocalVariableDecls): Likewise.
2271 (Foreach.Resolve): Likewise.
2273 2004-10-05 John Luke <john.luke@gmail.com>
2275 * cs-parser.jay: add location to error CS0175
2277 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2279 * ecore.cs (Expression.Constantity): Add support for turning null
2282 * const.cs (Const.Define): Allow constants to be reference types
2283 as long as the value is Null.
2285 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2287 * namespace.cs (NamespaceEntry.Using): No matter which warning
2288 level is set, check if this namespace name has already been added.
2290 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2292 * expression.cs: reftype [!=]= null should always use br[true,false].
2295 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2298 * attribute.cs: Enum conversion moved to
2299 GetAttributeArgumentExpression to be applied to the all
2302 2004-10-01 Raja R Harinath <rharinath@novell.com>
2304 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2305 * class.c (TypeContainer.DefineType): Flag error if
2306 base types aren't accessible due to access permissions.
2307 * decl.cs (DeclSpace.ResolveType): Move logic to
2308 Expression.ResolveAsTypeTerminal.
2309 (DeclSpace.ResolveTypeExpr): Thin layer over
2310 Expression.ResolveAsTypeTerminal.
2311 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2312 Refactor code into NestedAccess. Use it.
2313 (DeclSpace.NestedAccess): New.
2314 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2315 argument to silence errors. Check access permissions.
2316 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2317 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2318 (Cast.DoResolve): Likewise.
2319 (New.DoResolve): Likewise.
2320 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2321 (TypeOf.DoResolve): Likewise.
2323 * expression.cs (Invocation.BetterConversion): Return the Type of
2324 the better conversion. Implement section 14.4.2.3 more faithfully.
2325 (Invocation.BetterFunction): Make boolean. Make correspondence to
2326 section 14.4.2.2 explicit.
2327 (Invocation.OverloadResolve): Update.
2328 (Invocation): Remove is_base field.
2329 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2330 (Invocation.Emit): Likewise.
2332 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2334 * cs-parser.jay: Reverted 642 warning fix.
2336 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2339 * decl.cs (FindMemberWithSameName): Indexer can have more than
2342 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2344 * expression.cs (LocalVariableReference.DoResolveLValue):
2345 Do not report warning 219 for out values.
2346 (EmptyExpression.Null): New member to avoid extra allocations.
2348 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2350 * cs-parser.jay: Fix wrong warning 642 report.
2352 * cs-tokenizer.cs (CheckNextToken): New helper;
2353 Inspect next character if is same as expected.
2355 2004-09-23 Martin Baulig <martin@ximian.com>
2357 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2358 (Convert.ImplicitReferenceConversionExists): Likewise.
2360 2004-11-09 Raja R Harinath <rharinath@novell.com>
2362 * Makefile (DISTFILES): Comment out a few missing files.
2364 2004-10-29 Raja R Harinath <rharinath@novell.com>
2366 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
2367 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
2368 (gmcs.exe): Invoke bootstrap-libs.
2369 (clean-local): Clean the net_2_0_bootstrap profile too.
2370 (PROGRAM_INSTALL_DIR): New.
2371 (install-local): Use it.
2373 2004-10-13 Martin Baulig <martin@ximian.com>
2375 * generic.cs (TypeManager.InflatedConstraints): New nested class.
2376 (TypeParameter.DefineType): If we're a method type parameter and
2377 that method is overriding something, "inflate" its constraints.
2379 2004-10-12 Martin Baulig <martin@ximian.com>
2381 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
2382 and have type arguments, create and resolve a ConstructedType.
2384 2004-10-12 Martin Baulig <martin@ximian.com>
2386 * decl.cs (MemberCache.FindMemberToOverride): Use
2387 TypeManager.IsEqual() to compare the parameters and Type.Equals()
2388 to compare the invocationType.
2390 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
2391 When comparing two type parameters, only do the signature-only
2392 comparision for method type parameters.
2394 2004-10-11 Martin Baulig <martin@ximian.com>
2396 * report.cs: Don't make --fatal abort on warnings, we have
2397 -warnaserror for that.
2399 2004-10-11 Martin Baulig <martin@ximian.com>
2402 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
2403 (TypeManager.IsEqual): Call ourself recursively instead of using
2406 2004-10-11 Martin Baulig <martin@ximian.com>
2408 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
2409 on our own type parameters, not on the ones we inherit from a containing
2412 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
2415 * generic.cs (TypeParameter.Define): We may only be called once.
2417 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
2418 instead of TypeManager.IsEqual().
2420 2004-09-28 Martin Baulig <martin@ximian.com>
2423 (GenericConstraints.EffectiveBaseClass): New public property.
2424 (TypeParameter.GenericConstraints): New public property.
2425 (ConstructedType.CheckConstraints): Improved.
2427 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
2428 (Convert.TypeParameterConversion): New private method; use this in
2429 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
2430 for all conversions related to type parameters.
2432 2004-09-24 Martin Baulig <martin@ximian.com>
2434 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
2435 type parameter conversions for type parameters which are known to
2438 2004-09-24 Martin Baulig <martin@ximian.com>
2440 * generic.cs (GenericConstraints): Added `IsReferenceType' and
2441 `IsValueType' properties.
2443 * support.cs (ReflectionConstraints): Use
2444 Type.GetGenericParameterConstraints() instead of the old hack.
2446 2004-09-24 Martin Baulig <martin@ximian.com>
2448 * generic.cs (GenericConstraints): Moved here and made it an
2451 * support.cs (GenericConstraints): Moved to generic.cs.
2453 2004-09-24 Martin Baulig <martin@ximian.com>
2456 (ReflectionConstraints): Un-nested this class and made it public.
2459 (TypeManager.GetTypeParameterConstraints): New public method.
2460 (TypeManager.HasConstructorConstraint): Use the attributes.
2462 2004-09-24 Martin Baulig <martin@ximian.com>
2464 * support.cs (GenericConstraints): Replaced `HasConstructor',
2465 `IsReferenceType' and `IsValueType' with `Attributes'.
2466 (ReflectionParameters.ReflectionConstraints): Removed the Create()
2467 method and made the .ctor public.
2469 * generic.cs (Constraints.Attributes): New public property.
2470 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
2471 `IsReferenceType' -> `HasReferenceTypeConstraint' and
2472 `IsValueType' -> `HasValueTypeConstraint'.
2474 2004-09-23 Martin Baulig <martin@ximian.com>
2476 * generic.cs (Constraints): Reflect latest runtime changes.
2478 2004-09-23 Martin Baulig <martin@ximian.com>
2480 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2481 (Convert.ImplicitReferenceConversionExists): Likewise.
2483 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2485 * class.cs (Operator.Define): Add error 448 and 559 report.
2487 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2489 * class.cs (MemberBase.IsTypePermitted): New protected
2490 method for checking error CS0610.
2492 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2494 * class.cs (TypeContainer.HasExplicitLayout): New property
2495 Returns whether container has StructLayout attribute set Explicit.
2496 (FieldMember): New abstract class for consts and fields.
2497 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2498 (Field): Reuse FieldMember.
2500 * const.cs (Const): Reuse FieldMember.
2502 * rootcontext.cs: EmitConstants call moved to class.
2504 2004-09-22 Martin Baulig <martin@ximian.com>
2506 Marek and me just fixed one of our oldest bugs: #28562 :-)
2508 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2510 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2511 we're an EnumConstant, just return that.
2512 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2513 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2514 to get the value which'll actually be written into the attribute.
2515 However, we have to use GetValue() to access the attribute's value
2518 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2520 * constant.cs (Constant.IsNegative): New abstract property
2523 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2524 (StackAlloc.DoResolve): Reused IsNegative.
2526 2004-09-22 Martin Baulig <martin@ximian.com>
2528 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
2529 public method; like LookupTypeContainer, but also works for
2532 * report.cs (Report.SymbolRelatedToPreviousError): Use
2533 TypeManager.LookupGenericTypeContainer().
2535 2004-09-22 Martin Baulig <martin@ximian.com>
2537 Thanks to Peter Sestoft for this bug report.
2539 * expression.cs (Conditional): If both the `trueExpr' and the
2540 `falseExpr' is a NullLiteral, return a NullLiteral.
2542 2004-09-22 Martin Baulig <martin@ximian.com>
2544 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2545 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2546 for the "get_Current" call.
2548 2004-09-21 Martin Baulig <martin@ximian.com>
2550 * convert.cs (Convert.ImplicitReferenceConversion): When
2551 converting to an interface type, first check whether we're
2552 converting from a reference type.
2554 2004-09-14 Martin Baulig <martin@ximian.com>
2556 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2558 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2561 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2562 called and is obsolete then this member suppress message
2563 when call is inside next [Obsolete] method or type.
2565 * expression.cs: Use TestObsoleteMethodUsage member.
2567 2004-09-14 Martin Baulig <martin@ximian.com>
2569 * genericparser.cs: Removed.
2571 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2573 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2575 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2577 * attribute.cs (Attribute.Resolve): Add error 653 report.
2579 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2581 (Method.ApplyAttributeBuilder): Add error 685 report.
2582 (Operator.Define): Add error 564 report.
2584 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2586 * expression.cs (Invocation.DoResolve): Add error
2589 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2592 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2594 * class.cs (ConstructorInitializer.Resolve):
2595 Wrong error number (515->516).
2597 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2599 * class.cs (Indexer.Define): Add error 631 report.
2601 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2603 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2605 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2607 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2609 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2611 * cs-parser.jay: Added error CS0241 report.
2613 2004-09-10 Raja R Harinath <rharinath@novell.com>
2615 * cs-parser.jay (fixed_statement): Introduce a scope for the
2616 declaration in the 'fixed' statement.
2618 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2620 * cs-parser.jay: Added CS0230 error report.
2622 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2624 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2626 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2628 * expression.cs (Argument.Resolve): Added error CS0192 and
2631 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2633 C# 2.0 #pragma warning feature
2635 * cs-tokenizer.cs (PreProcessPragma): New method;
2636 Handles #pragma directive.
2638 * report.cs (WarningRegions): New class; Support
2639 class for #pragma warning directive. It tests whether
2640 warning is enabled for a given line.
2642 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2644 * const.cs: Add more descriptive error report, tahnks to
2647 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2649 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2651 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2653 * expression.cs: Apply patch from Ben: Remove dead code from
2654 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2655 as that code just threw an exception anwyays.
2657 * const.cs: Remove the call to the turnintoconstant, for details
2660 * literal.cs: The type of the null-literal is the null type; So
2661 we use a placeholder type (literal.cs:System.Null, defined here)
2664 * expression.cs (Conditional.DoResolve): Remove some old code that
2665 is no longer needed, conversions have been fixed.
2667 (ArrayCreationExpression.DoResolve): Return false if we fail to
2668 resolve the inner expression.
2670 2004-09-07 Raja R Harinath <rharinath@novell.com>
2673 * cs-parser.jay (delegate_declaration): Record a delegate
2674 declaration as a type declaration.
2675 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2677 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2679 * parameter.cs: Do not crash if the type can not be resolved.
2681 * expression.cs: Report errors with unsafe pointers, fixes #64896
2683 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2685 * expression.cs: Pointer arith always needs to do a conv.i
2686 if the operand is a long. fix 65320
2688 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2690 Fixed cs0619-37.cs, cs0619-38.cs
2692 * enum.cs (GetObsoleteAttribute): Removed.
2694 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2695 on Enum member is double staged. The first is tested member
2698 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2700 Fixed #56986, #63631, #65231
2702 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2703 adds member to name container.
2704 (TypeContainer.AddToTypeContainer): New method, adds type to
2706 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2707 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2708 AddOperator): Simplified by reusing AddToMemberContainer.
2709 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2711 (Method.CheckForDuplications): Fixed implementation to test all
2713 (MemberBase): Detection whether member is explicit interface
2714 implementation is now in constructor.
2715 (MemberBase.UpdateMemberName): Handles IndexerName.
2716 (Accessor): Changed to keep also location information.
2717 (AbstractPropertyEventMethod): Is derived from MemberCore.
2718 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2719 will be emited or not.
2720 (PropertyBase.AreAccessorsDuplicateImplementation):
2721 Tests whether accessors are not in collision with some method.
2722 (Operator): Is derived from MethodCore to simplify common
2725 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2727 (DeclSpace.AddToContainer): Adds the member to defined_names
2728 table. It tests for duplications and enclosing name conflicts.
2730 * enum.cs (EnumMember): Clean up to reuse the base structures
2732 2004-09-03 Martin Baulig <martin@ximian.com>
2734 Merged latest changes into gmcs. Please keep this comment in
2735 here, it makes it easier for me to see what changed in MCS since
2736 the last time I merged.
2738 2004-09-03 Martin Baulig <martin@ximian.com>
2740 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2741 into TypeContainer, to make partial classes work again.
2743 2004-09-03 Martin Baulig <martin@ximian.com>
2745 * rootcontext.cs (RootContext.V2): Removed.
2747 2004-03-23 Martin Baulig <martin@ximian.com>
2749 * expression.cs (Invocation.OverloadResolve): Added `bool
2750 may_fail' argument and use it instead of the Location.IsNull() hack.
2752 2004-09-09 Martin Baulig <martin@ximian.com>
2754 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
2756 2004-09-09 Martin Baulig <martin@ximian.com>
2758 * generic.cs (TypeParameter.DefineType): Added support for
2759 explicit interface methods.
2761 2004-09-09 Martin Baulig <martin@ximian.com>
2763 * README.Changes: New document. Started to list important changes
2764 between MCS and GMCS here.
2766 2004-09-08 Martin Baulig <martin@ximian.com>
2769 (TypeContainer.CheckRecursiveDefinition): New protected method.
2770 (TypeContainer.DefineType): Move the CS0146 check into
2771 CheckRecursiveDefinition().
2773 2004-09-06 Martin Baulig <martin@ximian.com>
2775 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
2776 types for the constructor constraint.
2778 2004-09-03 Martin Baulig <martin@ximian.com>
2780 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2781 into TypeContainer, to make partial classes work again.
2783 2004-09-03 Martin Baulig <martin@ximian.com>
2785 * rootcontext.cs (RootContext.V2): Removed.
2787 2004-03-23 Martin Baulig <martin@ximian.com>
2789 * expression.cs (Invocation.OverloadResolve): Added `bool
2790 may_fail' argument and use it instead of the Location.IsNull() hack.
2792 2004-09-03 Martin Baulig <martin@ximian.com>
2794 Merged latest changes into gmcs. Please keep this comment in
2795 here, it makes it easier for me to see what changed in MCS since
2796 the last time I merged.
2798 2004-09-03 Raja R Harinath <rharinath@novell.com>
2801 * expression.cs (BetterConversion): Don't allow either conversion
2802 to be null. Remove redundant implicit conversion test when 'q ==
2803 null' -- when this function is invoked, we already know that the
2804 implicit conversion exists.
2805 (BetterFunction): Assume that 'best' is non-null. Remove
2806 redundant reimplementation of IsApplicable when 'best' is null.
2807 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2808 number of arguments.
2809 (IsAncestralType): Extract from OverloadResolve.
2810 (OverloadResolve): Make robust to the MethodGroupExpr being
2811 unsorted. Implement all the logic of Section 14.5.5.1, and
2812 support overloading of methods from multiple applicable types.
2813 Clean up logic somewhat. Don't pass null methods to BetterFunction.
2815 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
2816 (RealError, Warning): Append type of report to related symbol.
2818 2004-09-03 Marek Safar <marek.safar@seznam.cz>
2820 * enum.cs: Fixed CLS-Compliance checks for enum members.
2821 Error tests cs3008-8.cs, cs3014-8.cs
2823 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2825 Fixed bug #62342, #63102
2826 * class.cs: ImplementIndexer uses member.IsExplicitImpl
2827 like ImplementMethod.
2829 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2831 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2834 2004-09-02 Martin Baulig <martin@ximian.com>
2836 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2837 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2840 2004-09-01 Marek Safar <marek.safar@seznam.cz>
2842 C# 2.0 Static classes implemented
2844 * class.cs (TypeContainer): instance_constructors,
2845 initialized_fields, initialized_static_fields,
2846 default_constructor, base_inteface_types are protected to be
2847 accessible from StaticClass.
2848 (TypeContainer.DefineDefaultConstructor): New virtual method
2849 for custom default constructor generating
2850 (StaticClass): New class to handle "Static classes" feature.
2852 * cs-parser.jay: Handle static keyword on class like instance
2855 * driver.cs: Added "/langversion" command line switch with two
2856 options (iso-1, default).
2858 2004-08-31 Marek Safar <marek.safar@seznam.cz>
2860 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
2862 2004-08-31 Miguel de Icaza <miguel@ximian.com>
2864 * delegate.cs: Style.
2866 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
2868 * delegate.cs: Add seperate instance expr field for miguel.
2870 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2872 * PointerArithmetic (Resolve): make sure we are not doing
2873 pointer arith on void*. Also, make sure we are resolved
2874 by not setting eclass until resolve.
2876 All callers: Make sure that PointerArithmetic gets resolved.
2878 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2880 * ArrayCreation (LookupType): If the type does not resolve
2881 to an array, give an error.
2883 2004-08-27 Marek Safar <marek.safar@seznam.cz>
2885 * statement.cs (Try.Resolve): Fixed bug #64222
2887 2004-08-27 Martin Baulig <martin@ximian.com>
2890 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2893 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2895 * ecore.cs (Constantify): Get underlying type via
2896 System.Enum.GetUnderlyingType to avoid StackOverflow on the
2897 Windows in special cases.
2899 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2901 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
2902 for obtaining also private methods.
2903 (GetRemoveMethod): Used GetRemoveMethod (true)
2904 for obtaining also private methods.
2906 2004-09-02 Martin Baulig <martin@ximian.com>
2908 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2909 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2912 2004-08-27 Martin Baulig <martin@ximian.com>
2915 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2918 2004-08-25 Martin Baulig <martin@ximian.com>
2920 * support.cs (ReflectionParameters..ctor): If this is a generic
2921 method, retrieve and store its type parameters.
2922 (InternalParameters..ctor): Added `TypeParameter[]' argument.
2923 (ReflectionParameters.GenericConstraints): The argument specifies
2924 the type parameter, not the method parameter.
2925 (InternalParameters.GenericConstraints): Likewise.
2927 * generic.cs (TypeParameter.DefineType): Correctly handle
2928 constraints wrt. generic methods in interfaces and their
2931 2004-08-24 Martin Baulig <martin@ximian.com>
2933 * generic.cs (TypeParameter.IsSubclassOf): New public method.
2934 (Constraints.IsSubclassOf): New internal method.
2936 * typemanager.cs (TypeManager.FindMembers): Added special support
2937 for GenericTypeParameterBuilder's.
2938 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
2941 2004-08-24 Martin Baulig <martin@ximian.com>
2944 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
2945 this for accessibility checks.
2946 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
2947 IsNestedFamilyAccessible.
2948 (TypeManager.IsSubclassOf): New method, do what the name actually
2951 2004-08-24 Martin Baulig <martin@ximian.com>
2953 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
2954 as a SimpleName, include the generic arity.
2956 2004-08-24 Martin Baulig <martin@ximian.com>
2958 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
2959 MethodAttributes.HideBySig for operators.
2961 2004-08-23 Martin Baulig <martin@ximian.com>
2963 Back to the old error reporting system :-)
2965 * report.cs (Message): Removed.
2966 (Report.MessageData, ErrorData, WarningData): Removed.
2967 (Report.Error, Warning): Back to the old system.
2969 2004-08-23 Martin Baulig <martin@ximian.com>
2971 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2973 * class.cs (TypeContainer.ParentContainer): New public virtual
2974 method; replaces the explicit interface implementation.
2975 (ClassPart.ParentContainer): Override.
2977 2004-08-23 Martin Baulig <martin@ximian.com>
2979 * statement.cs (Switch): Added support for constant switches; see
2980 #59428 or test-285.cs.
2982 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2985 * statement.cs (GetEnumeratorFilter): Removed useless
2986 logic because C# specs is strict. GetEnumerator must be
2989 2004-08-22 Martin Baulig <martin@ximian.com>
2991 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2992 a switch and may break, reset the barrier. Fixes #59867.
2994 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2996 CLS-Compliance speed up (~5% for corlib)
2998 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
2999 New method. Tests container for CLS-Compliant names
3001 * class.cs (TypeContainer.VerifyClsName): New method.
3002 Checks whether container name is CLS Compliant.
3003 (Constructor): Implements IMethodData.
3005 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3006 low-case table for CLS Compliance test.
3007 (MemberCache.VerifyClsParameterConflict): New method.
3008 Checks method parameters for CS3006 error.
3010 * enum.cs (EnumMember): Is derived from MemberCore.
3011 (Enum.VerifyClsName): Optimized for better performance.
3013 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3015 * report.cs: Renamed Error_T to Error and changed all
3018 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3020 * class.cs (TypeContainer.IndexerArrayList): New inner class
3021 container for indexers.
3022 (TypeContainer.DefaultIndexerName): New constant for default
3023 indexer name. Replaced all "Item" with this constant.
3024 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3026 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3027 DefaultMemberAttribute constructor.
3029 2004-08-05 Martin Baulig <martin@ximian.com>
3031 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3034 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3036 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3037 multi platforms problem.
3039 * compiler.csproj: Included shared files.
3041 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3043 Fix bug 60333, 55971 in the more general way
3044 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3045 Added arg_type argument for constant conversion.
3046 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3048 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3051 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3052 OperatorArrayList, MethodCoreArrayList for typecontainer
3053 containers. Changed class member types to these new types.
3054 (MethodArrayList.DefineMembers): Added test for CS0659.
3056 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3058 * cfold.cs: Synchronize the folding with the code in expression.cs
3059 Binary.DoNumericPromotions for uint operands.
3061 * attribute.cs: Revert patch from Raja, it introduced a regression
3062 while building Blam-1.2.1 (hard to isolate a test case).
3064 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3068 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3070 (MethodCore.parent_method): New member. The method we're overriding
3071 if this is an override method.
3072 (MethodCore.CheckBase): Moved from Method class and made common.
3073 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3075 (MethodCore.CheckForDuplications): New abstract method. For custom
3076 member duplication search in a container
3077 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3078 method and its return type.
3079 (Event.conflict_symbol): New member. Symbol with same name in the
3083 (MemberCache.FindMemberWithSameName): New method. The method
3084 is looking for conflict with inherited symbols.
3086 2004-08-04 Martin Baulig <martin@ximian.com>
3088 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3090 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3092 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3094 * report.cs (Message): New enum for better error, warning reference in
3096 (MessageData): New inner abstract class. It generally handles printing of
3097 error and warning messages.
3098 Removed unused Error, Warning, Message methods.
3100 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3102 Fix for cs0592-8.cs test
3104 (Attributable.ValidAttributeTargets): Made public.
3105 (Attribute.ExplicitTarget): New member for explicit target value.
3106 (Attribute.CheckTargets): Now we translate explicit attribute
3107 target to Target here.
3109 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3111 * ecore.cs (MethodGroupExpr): new IsBase property.
3113 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3115 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3116 rather than an instance expr.
3118 (DelegateCreation.Emit): Use the method group rather than
3119 the instance expression. Also, if you have base.Foo as the
3120 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3122 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3124 (NewDelegate.DoResolve): Only check for the existance of Invoke
3125 if the method is going to be needed. Use MethodGroupExpr.
3127 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3129 * expression.cs: For pointer arith., make sure to use
3130 the size of the type, not the size of the pointer to
3133 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3136 * class.cs (Class): Added error CS0502 test.
3138 2004-08-03 John Luke <jluke@cfl.rr.com>
3139 Raja R Harinath <rharinath@novell.com>
3142 * attribute.cs (Attribute.complained_before): New flag.
3143 (Attribute.ResolveType, Attribute.Resolve),
3144 (Attribute.DefinePInvokeMethod): Set it.
3145 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3147 2004-08-03 Martin Baulig <martin@ximian.com>
3149 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3150 use a user-defined operator; we still need to do numeric
3151 promotions in case one argument is a builtin type and the other
3152 one has an implicit conversion to that type. Fixes #62322.
3154 2004-08-18 Martin Baulig <martin@ximian.com>
3156 * class.cs (Method.Define): Use the correct method name when
3157 creating the MethodBuilder for a generic method.
3159 2004-08-17 Martin Baulig <martin@ximian.com>
3161 * generic.cs (Constraints): Support type parameter constraints.
3163 2004-08-16 Martin Baulig <martin@ximian.com>
3165 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
3166 (Token.GENERIC_DIMENSION): New token; this is returned if we
3167 encounter an unbound generic type in a typeof() expression.
3169 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
3170 this token is only generated while parsing a typeof() expression.
3171 (typeof_expression): Removed the old unbound_type hack.
3173 * generic.cs (TypeArguments.IsUnbound): New public property.
3175 * decl.cs (MemberName): Added support for unbound types.
3177 2004-08-14 Martin Baulig <martin@ximian.com>
3180 (TypeManager.IsEqualGenericInstance): New static method.
3181 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
3182 just used to check accessibility, so follow the rules of 26.1.6.
3184 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
3185 ConstructedType instead of a TypeExpression if we have type arguments.
3187 * cs-parser.jay (typeof_expression): Support unbound generic types.
3189 * ecore.cs (UnboundTypeExpression): New public class.
3191 2004-08-12 Martin Baulig <martin@ximian.com>
3193 * typemanager.cs (TypeManager.IsNestedChildOf): Use
3194 TypeManager.IsEqual() rather than `=='.
3196 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
3197 generic instances as well.
3199 2004-08-12 Martin Baulig <martin@ximian.com>
3201 * expression.cs (Invocation.InferType): We can only infer method
3202 type parameters. Fixes #62647.
3204 2004-08-11 Martin Baulig <martin@ximian.com>
3206 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
3207 before resolving the base classes.
3209 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3211 * Makefile: install .mdb file too.
3213 2004-08-05 Martin Baulig <martin@ximian.com>
3215 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
3216 initializer, the current type is just the TypeBuilder, not the
3217 instantiated generic type.
3218 (FieldExpr.IsFieldInitializer): New public property.
3220 2004-08-04 Martin Baulig <martin@ximian.com>
3222 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3224 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3226 2004-08-03 Martin Baulig <martin@ximian.com>
3228 * class.cs (MethodData.Define): If we're an explicit
3229 implementation, remove the generic arity from the type name.
3231 2004-08-03 Martin Baulig <martin@ximian.com>
3233 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3234 use a user-defined operator; we still need to do numeric
3235 promotions in case one argument is a builtin type and the other
3236 one has an implicit conversion to that type. Fixes #62322.
3238 2004-08-02 Martin Baulig <martin@ximian.com>
3240 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
3242 (TypeContainer.GetClassBases): Return the unexpanded list of
3243 interfaces; we expand them later.
3244 (TypeContainer.DefineType): After creating the TypeBuilder, call
3245 TypeManager.ExpandInterfaces() to get an expanded and resolved
3248 * ecore.cs (TypeExpr.GetInterfaces): Removed
3250 * generics.cs (Constraints.InterfaceConstraints): Remove.
3251 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
3252 register the interface constraints.
3255 (TypeManager.AddUserType): Removed the `ifaces' argument.
3256 (TypeManager.AddTypeParameter): Likewise.
3257 (TypeManager.AddUserInterface): Removed, was unused.
3258 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
3259 `TypeExpr[]' array for the interfaces.
3260 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
3261 has been defined, returns a list of the resolved interfaces types.
3262 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
3263 (TypeManager.GetExplicitInterfaces): Likewise.
3265 2004-08-02 Martin Baulig <martin@ximian.com>
3267 * expression.cs (Invocation.EmitCall): If we're invoking a method
3268 on a type parameter, use the new `Constrained' prefix opcode.
3270 2004-08-02 Martin Baulig <martin@ximian.com>
3272 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3273 (LocalInfo.IsThis): New public property.
3274 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3276 2004-08-01 Martin Baulig <martin@ximian.com>
3278 * class.cs (TypeContainer.GetClassBases): Don't set the default
3279 here since we may get called from GetPartialBases().
3280 (TypeContainer.DefineType): If GetClassBases() didn't return a
3281 parent, use the default one.
3283 2004-07-30 Martin Baulig <martin@ximian.com>
3285 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3287 * class.cs (SourceMethod): New public class, derive from the
3288 symbol writer's ISourceMethod.
3289 (Method): Use the new symbol writer API.
3291 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3292 as argument and use the new symbol writer.
3295 (SourceFile): Implement the symbol writer's ISourceFile.
3296 (Location.SymbolDocument): Removed.
3297 (Location.SourceFile): New public property.
3299 * symbolwriter.cs: Use the new symbol writer API.
3301 2004-07-30 Raja R Harinath <rharinath@novell.com>
3303 * Makefile (install-local): Remove. Functionality moved to
3306 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3308 * Makefile: Install mcs.exe.config file together with mcs.exe.
3309 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3310 correct runtime version.
3312 2004-07-25 Martin Baulig <martin@ximian.com>
3315 (TypeContainer.RegisterOrder): Removed, this was unused.
3316 (TypeContainer, interface_order): Removed.
3317 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3318 TypeContainer as argument since we can also be called with a
3319 `PartialContainer' for a partial class/struct/interface.
3320 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3321 of checking whether we're an `Interface' - we could be a
3323 (PartialContainer.Register): Override; call
3324 AddClass()/AddStruct()/AddInterface() on our parent.
3326 * cs-parser.jay (interface_member_declaration): Add things to the
3327 `current_container', not the `current_class'.
3329 * rootcontext.cs (RegisterOrder): The overloaded version which
3330 takes an `Interface' was unused, removed.
3332 * typemanager.cs (TypeManager.LookupInterface): Return a
3333 `TypeContainer', not an `Interface'.
3334 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3335 contain a `PartialContainer' for an interface, so check it's
3336 `Kind' to figure out what it is.
3338 2004-07-25 Martin Baulig <martin@ximian.com>
3340 * class.cs (Class.DefaultTypeAttributes): New public constant.
3341 (Struct.DefaultTypeAttributes): Likewise.
3342 (Interface.DefaultTypeAttributes): Likewise.
3343 (PartialContainer.TypeAttr): Override this and add the
3344 DefaultTypeAttributes.
3346 2004-07-25 Martin Baulig <martin@ximian.com>
3348 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3349 we can just use the `Parent' field instead.
3351 2004-07-25 Martin Baulig <martin@ximian.com>
3353 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3355 2004-07-25 Martin Baulig <martin@ximian.com>
3357 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3358 our parts before defining any methods.
3359 (TypeContainer.VerifyImplements): Make this virtual.
3360 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3361 on our PartialContainer.
3363 2004-07-25 Martin Baulig <martin@ximian.com>
3365 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3367 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3368 argument, we can just use the `Parent' field instead.
3371 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3372 (MemberBase.DoDefine): Likewise.
3374 2004-07-24 Martin Baulig <martin@ximian.com>
3376 * decl.cs (MemberCore.Parent): New public field.
3377 (DeclSpace.Parent): Moved to MemberCore.
3379 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3380 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3382 (FieldBase, Field, Operator): Likewise.
3383 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3384 (EventField, Event): Likewise.
3386 2004-07-23 Martin Baulig <martin@ximian.com>
3388 * class.cs (PartialContainer): New public class.
3389 (ClassPart): New public class.
3390 (TypeContainer): Added support for partial classes.
3391 (TypeContainer.GetClassBases): Splitted some of the functionality
3392 out into GetNormalBases() and GetPartialBases().
3394 * cs-tokenizer.cs (Token.PARTIAL): New token.
3395 (Tokenizer.consume_identifier): Added some hacks to recognize
3396 `partial', but only if it's immediately followed by `class',
3397 `struct' or `interface'.
3399 * cs-parser.jay: Added support for partial clases.
3401 2004-07-23 Martin Baulig <martin@ximian.com>
3403 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3404 a `DeclSpace' and also made it readonly.
3405 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3406 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3407 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3409 * cs-parser.jay: Pass the `current_class', not the
3410 `current_container' (at the moment, this is still the same thing)
3411 to a new Method, Property, Event, Indexer or Constructor.
3413 2004-07-23 Martin Baulig <martin@ximian.com>
3415 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3416 and removed the `current_interface' one.
3417 (struct_declaration, class_declaration, interface_declaration):
3418 Set `current_class' to the newly created class/struct/interface;
3419 set their `Bases' and call Register() before parsing their body.
3421 2004-07-23 Martin Baulig <martin@ximian.com>
3423 * class.cs (Kind): New public enum.
3424 (TypeContainer): Made this class abstract.
3425 (TypeContainer.Kind): New public readonly field.
3426 (TypeContainer.CheckDef): New public method; moved here from
3428 (TypeContainer.Register): New public abstract method.
3429 (TypeContainer.GetPendingImplementations): New public abstract
3431 (TypeContainer.GetClassBases): Removed the `is_class' and
3432 `is_iface' parameters.
3433 (TypeContainer.DefineNestedTypes): Formerly known as
3435 (ClassOrStruct): Made this class abstract.
3437 * tree.cs (RootTypes): New public type.
3439 2004-07-20 Martin Baulig <martin@ximian.com>
3441 * tree.cs (Tree.RecordNamespace): Removed.
3442 (Tree.Namespaces): Removed.
3444 * rootcontext.cs (RootContext.IsNamespace): Removed.
3446 * cs-parser.jay (namespace_declaration): Just create a new
3447 NamespaceEntry here.
3449 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
3451 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
3452 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
3453 entry to make sure it runs in the correct runtime version.
3455 2004-07-18 Martin Baulig <martin@ximian.com>
3457 * generic.cs (ConstructedType.CheckConstraints): Improved
3458 constraints checking.
3460 2004-07-18 Martin Baulig <martin@ximian.com>
3462 * expression.cs (Invocation.BetterMethod): Call
3463 TypeManager.TypeToCoreType() on all types and removed my previous
3464 hack; we're already doig the right thing here.
3466 2004-07-17 Martin Baulig <martin@ximian.com>
3468 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
3470 2004-07-16 Martin Baulig <martin@ximian.com>
3472 * iterators.cs: Added generics support.
3474 2004-07-16 Martin Baulig <martin@ximian.com>
3476 * iterators.cs: Rewrote this. We're now using one single Proxy
3477 class for both the IEnumerable and the IEnumerator interface and
3478 `Iterator' derives from Class so we can use the high-level API.
3480 * class.cs (TypeContainer.AddIterator): New method.
3481 (TypeContainer.DoDefineType): New protected virtual method, which
3482 is called from DefineType().
3483 (TypeContainer.DoDefineMembers): Call DefineType() and
3484 DefineMembers() on all our iterators.
3485 (TypeContainer.Emit): Call Emit() on all our iterators.
3486 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3488 * codegen.cs (EmitContext.CurrentIterator): New public field.
3490 2004-07-15 Martin Baulig <martin@ximian.com>
3493 (TypeManager.not_supported_exception_type): New type.
3495 2004-07-14 Martin Baulig <martin@ximian.com>
3498 (TypeManager.generic_ienumerable_type): New type.
3499 (TypeManager.generic_ienumerator_type): New type.
3502 (RootContext.interfaces_first_stage): Added
3503 "System.Collections.Generic.IEnumerator`1" and
3504 "System.Collections.Generic.IEnumerable`1".
3506 2004-07-14 Martin Baulig <martin@ximian.com>
3508 * iterators.cs: Use real error numbers.
3510 2004-07-14 Martin Baulig <martin@ximian.com>
3512 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3513 requires this to be a System.Collection.IEnumerable and not a
3514 class implementing that interface.
3515 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3517 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3519 * class.cs: Fixed previous fix, it broke some error tests.
3521 2004-07-12 Martin Baulig <martin@ximian.com>
3523 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3526 2004-07-14 Martin Baulig <martin@ximian.com>
3528 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
3529 an exclamation mark (!) for the generic arity to reflect the
3530 latest spec changes; ie. use "System.Collections.Generic.IList`1".
3532 2004-07-13 Martin Baulig <martin@ximian.com>
3534 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
3535 specifiers being part of a type argument.
3537 2004-07-13 Martin Baulig <martin@ximian.com>
3539 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
3540 name for generic types.
3542 2004-07-13 Martin Baulig <martin@ximian.com>
3544 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
3547 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3549 * assign.cs (LocalTemporary): Add new argument: is_address,If
3550 `is_address' is true, then the value that we store is the address
3551 to the real value, and not the value itself.
3553 * ecore.cs (PropertyExpr): use the new local temporary
3554 stuff to allow us to handle X.Y += z (where X is a struct)
3556 2004-07-08 Martin Baulig <martin@ximian.com>
3558 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3559 not always return, just like we're doing in Using.Resolve().
3561 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3563 * cs-parser.jay (fixed_statement): flag this as Pinned.
3565 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3567 * typemanager.cs (TypeManager): Removed MakePinned method, this
3568 mechanism is replaced with the .NET 2.x compatible mechanism of
3569 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3571 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3572 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3573 `IsFixed' property which has a different meaning.
3575 2004-07-02 Raja R Harinath <rharinath@novell.com>
3577 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3578 visible from inside a nested class, not just the names of the
3579 immediately enclosing class.
3582 2004-06-24 Raja R Harinath <rharinath@novell.com>
3584 * expression.cs (BetterConversion): Remove buggy special-case
3585 handling of "implicit constant expression conversions". At this
3586 point, we already know that the conversion is possible -- we're
3587 only checking to see which is better.
3589 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3591 * cs-parser.jay: Added error CS0210 test.
3593 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3595 * cs-parser.jay: Added error CS0134 test.
3597 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3600 * cs-parser.jay: Added error CS0145 test.
3602 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3604 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3606 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3608 * expression.cs (StackAlloc.Resolve): The argument may not
3609 be a constant; deal with this case.
3611 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3613 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3614 GetIndexerAttributeValue.
3615 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3617 * class.cs (Indexer.Define): Added error tests for CS0415,
3620 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3622 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3625 2004-06-23 Martin Baulig <martin@ximian.com>
3627 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3628 neither return nor throw, reset the barrier as well. Fixes #60457.
3630 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3632 * class.cs : EventAttributes is now set to None by default.
3633 This fixes bug #60459.
3635 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3638 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3639 Don't throw exception but return null (it's sufficient now).
3641 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3643 * typemanager.cs (GetArgumentTypes): Faster implementation.
3645 2004-06-18 Martin Baulig <martin@ximian.com>
3647 * attribute.cs (Attribute.Resolve): Check whether we're an
3648 EmptyCast which a Constant child. Fixes #60333.
3650 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3652 * statement.cs (EmitCollectionForeach): Account for the fact that
3653 not all valuetypes are in areas which we can take the address of.
3654 For these variables, we store to a temporary variable. Also, make
3655 sure that we dont emit a `callvirt' on a valuetype method.
3657 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3659 * expression.cs (StackAlloc.DoReSolve): Added test for
3660 negative parameter (CS0247).
3662 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3665 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3667 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3670 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3673 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3675 Fix bug #58254 & cs1555.cs, cs1556.cs
3676 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3678 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3680 * cs-parser.jay: Added error CS1669 test for indexers.
3682 2004-06-18 Martin Baulig <martin@ximian.com>
3684 * generics.cs (GenericMethod.ctor): Don't take an Attributes
3685 argument. Fixes #60441.
3687 2004-06-16 Ben Maurer <bmaurer@ximian.com>
3688 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
3689 The name needs to have the actual name of the method in order
3690 for other tests (such as the one in OverloadResolve for Invoke
3691 on a delegate) to work. As well, it does not really help
3692 error reporting because the method group had multiple methods.
3693 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
3694 Make profiling work.
3696 2004-06-13 Martin Baulig <martin@ximian.com>
3698 * cs-parser.jay: Don't allow generic attributes.
3700 2004-06-13 Martin Baulig <martin@ximian.com>
3702 * class.cs (MemberBase.DoDefineBase): New protected method.
3703 (MemberBase.DoDefine): Compute the `flags' in the new
3704 DoDefineBase() which must be called first.
3705 (Method.Define): Call DoDefineBase() first so we have the flags
3706 when defining the generic method.
3708 * cs-parser.jay (interface_method_declaration): Support generic methods.
3710 2004-06-13 Martin Baulig <martin@ximian.com>
3712 * decl.cs (TypeName): Removed.
3713 (MemberName): Removed TypeName and MemberNow; now we just have
3716 * cs-parser.jay: Don't distinguish between type arguments and type
3717 parameters in the grammar and simplified the rules a bit. The
3718 reduce/reduce conflicts are now gone (except the one we inherited
3721 2004-06-11 Martin Baulig <martin@ximian.com>
3723 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3724 call this twice: for params and varargs methods.
3726 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3729 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3731 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3733 * attribute.cs (Attribute.GetValidTargets): Made public.
3736 (AbstractPropertyEventMethod): New class for better code sharing.
3737 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3739 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3741 2004-06-09 Martin Baulig <martin@ximian.com>
3743 * cs-parser.jay: Removed a reduce/reduce conflict.
3745 2004-06-03 Martin Baulig <martin@ximian.com>
3747 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
3748 GetSimpleName() and return a SimpleName.
3750 * ecore.cs (SimpleName.Arguments): New public field.
3751 (SimpleName): Added overloaded ctor which takes an additional
3752 TypeArguments argument.
3753 (SimpleName.SimpleNameResolve): Added support for generic methods.
3754 (MethodGroupExpr.ResolveGeneric): New public method. The code was
3755 formerly in MemberAccess.DoResolve(), but we also need it in
3756 SimpleNameResolve().
3758 * expression.cs (MemberAccess.DoResolve): Use the new
3759 MethodGroupExpr.ResolveGeneric().
3761 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3763 * decl.cs: If possible, use lookuptypedirect here. We can only do
3764 this if there is no `.' after the namespace. Avoids using
3765 LookupType, which does lots of slow processing.
3766 (FindNestedType) New method, does what it says :-).
3767 * namespace.cs: use LookupTypeDirect.
3768 * rootcontext.cs: use membercache, if possible.
3769 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3771 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3774 According to the spec,
3776 In a member access of the form E.I, if E is a single identifier,
3777 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3778 field, property, localvariable, or parameter with the same type as
3779 the meaning of E as a type-name (§3.8), then both possible
3780 meanings of E are permitted.
3782 We did not check that E as a simple-name had the same type as E as
3785 This trivial check gives us 5-7% on bootstrap time.
3787 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3789 * expression.cs (Invocation.OverloadResolve): Avoid the
3790 use of hashtables and boxing here by allocating on demand.
3792 2004-05-30 Martin Baulig <martin@ximian.com>
3794 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3795 we're doing a silent lookup. Don't try to lookup nested types in
3796 TypeManager.object_type (thanks to Ben Maurer).
3798 2004-05-30 Martin Baulig <martin@ximian.com>
3800 Committing a patch from Ben Maurer.
3802 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3804 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3806 * convert.cs: add a trivial cache for overload operator resolution.
3808 2004-05-31 Marek Safar <marek.safar@seznam.cz>
3811 (AttributeTester.GetObsoleteAttribute): Returns instance of
3812 ObsoleteAttribute when type is obsolete.
3815 (TypeContainer.VerifyObsoleteAttribute): Override.
3816 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
3817 (MethodCode.VerifyObsoleteAttribute): Override.
3818 (MemberBase.VerifyObsoleteAttribute): Override.
3821 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
3822 and report proper error.
3825 (Delegate.VerifyObsoleteAttribute): Override.
3828 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
3829 and report proper error.
3830 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
3833 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
3837 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
3838 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
3839 Added test for ObsoleteAttribute.
3842 (Catch): Derived from Statement.
3844 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3846 * decl.cs: If possible, use lookuptypedirect here. We can only do
3847 this if there is no `.' after the namespace. Avoids using
3848 LookupType, which does lots of slow processing.
3849 (FindNestedType) New method, does what it says :-).
3850 * namespace.cs: use LookupTypeDirect.
3851 * rootcontext.cs: use membercache, if possible.
3852 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3854 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3857 According to the spec,
3859 In a member access of the form E.I, if E is a single identifier,
3860 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3861 field, property, localvariable, or parameter with the same type as
3862 the meaning of E as a type-name (§3.8), then both possible
3863 meanings of E are permitted.
3865 We did not check that E as a simple-name had the same type as E as
3868 This trivial check gives us 5-7% on bootstrap time.
3870 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3872 Fixed bug #59071 & cs0160.cs
3873 * statement.cs (Try.Resolve): Check here whether order of catch
3874 clauses matches their dependencies.
3876 2004-05-30 Marek Safar <marek.safar@seznam.cz>
3879 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
3882 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3884 * expression.cs (Invocation.OverloadResolve): Avoid the
3885 use of hashtables and boxing here by allocating on demand.
3887 2004-05-30 Martin Baulig <martin@ximian.com>
3889 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3890 we're doing a silent lookup. Don't try to lookup nested types in
3891 TypeManager.object_type (thanks to Ben Maurer).
3893 2004-05-30 Martin Baulig <martin@ximian.com>
3895 Committing a patch from Ben Maurer.
3897 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3899 2004-05-29 Martin Baulig <martin@ximian.com>
3901 * class.cs (IMethodData.ShouldIgnore): New method.
3903 * typemanager.cs (TypeManager.MethodFlags): Don't take a
3904 `Location' argument, we don't need it anywhere. Use
3905 `IMethodData.ShouldIgnore ()' instead of
3906 `MethodData.GetMethodFlags ()'.
3907 (TypeManager.AddMethod): Removed.
3908 (TypeManager.AddMethod2): Renamed to AddMethod.
3910 2004-05-29 Martin Baulig <martin@ximian.com>
3912 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
3914 * convert.cs (Convert.ImplicitReferenceConversion): If we're
3915 converting from a class type S to an interface type and we already
3916 have an object on the stack, don't box it again. Fixes #52578.
3918 2004-05-29 Martin Baulig <martin@ximian.com>
3920 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3921 Added support for `params' parameters. Fixes #59267.
3923 2004-05-29 Martin Baulig <martin@ximian.com>
3925 * literal.cs (NullPointer): Provide a private .ctor which sets
3926 `type' to TypeManager.object_type. Fixes #59048.
3928 2004-05-29 Martin Baulig <martin@ximian.com>
3930 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
3931 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
3933 * ecore.cs (EventExpr.instance_expr): Make the field private.
3935 2004-05-26 Marek Safar <marek.safar@seznam.cz>
3937 Fixed bug #50080 & cs0214-2.cs
3938 * expression.cs (Cast.DoResolve): Check unsafe context here.
3940 * statement.cs (Resolve.DoResolve): Likewise.
3942 2004-05-26 Martin Baulig <martin@ximian.com>
3944 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
3946 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
3947 (RootContext.LookupType): Pass down the `silent' flag.
3949 2004-05-25 Martin Baulig <martin@ximian.com>
3952 (MethodGroupExpr.IdenticalTypeName): New public property.
3953 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
3954 expression actually refers to a type.
3956 2004-05-25 Martin Baulig <martin@ximian.com>
3958 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
3959 for #56176 and made it actually work.
3961 2004-05-25 Martin Baulig <martin@ximian.com>
3963 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
3964 (FieldExpr, PropertyExpr): Override and implement
3965 CacheTemporaries. Fixes #52279.
3967 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3969 * location.cs: In the new compiler listing a file twice is a
3970 warning, not an error.
3972 2004-05-24 Martin Baulig <martin@ximian.com>
3974 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3975 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3977 2004-05-24 Martin Baulig <martin@ximian.com>
3979 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3980 walking the `using' list. Fixes #53921.
3982 2004-05-24 Martin Baulig <martin@ximian.com>
3984 * const.cs (Const.LookupConstantValue): Added support for
3985 EmptyCast's; fixes #55251.
3987 2004-05-24 Martin Baulig <martin@ximian.com>
3989 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
3990 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
3991 which does the CS0135 check. The reason is that we first need to
3992 check whether the variable actually exists.
3994 2004-05-24 Martin Baulig <martin@ximian.com>
3996 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
3997 than RootContext.LookupType() to find the explicit interface
4000 2004-05-24 Raja R Harinath <rharinath@novell.com>
4002 * Makefile: Simplify. Use executable.make.
4003 * mcs.exe.sources: New file. List of sources of mcs.exe.
4005 2004-05-24 Anders Carlsson <andersca@gnome.org>
4009 Use the invariant culture when doing String.Compare for CLS case
4012 2004-05-23 Martin Baulig <martin@ximian.com>
4014 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4015 don't have any dots. Fixes #52622, added cs0246-8.cs.
4017 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4019 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4021 * class.cs (MemberBase.Define): Reuse MemberType member for
4022 resolved type. Other methods can use it too.
4024 2004-05-23 Martin Baulig <martin@ximian.com>
4026 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4027 the variable also exists in the current block (otherwise, we need
4028 to report a CS0103). Fixes #58670.
4030 2004-05-23 Martin Baulig <martin@ximian.com>
4032 * flowanalysis.cs (Reachability.Reachable): Compute this
4033 on-the-fly rather than storing it as a field.
4035 2004-05-23 Martin Baulig <martin@ximian.com>
4037 * flowanalysis.cs (Reachability.And): Manually compute the
4038 resulting `barrier' from the reachability.
4040 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4043 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4044 instance of ObsoleteAttribute when symbol is obsolete.
4047 (IMethodData): Extended interface for ObsoleteAttribute support.
4049 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4051 * attribute.cs: Fix bug #55970
4053 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4057 (GetObsoleteAttribute): New method. Creates the instance of
4059 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4060 ObsoleteAttribute when member is obsolete.
4061 (AttributeTester.Report_ObsoleteMessage): Common method for
4062 Obsolete error/warning reporting.
4065 (TypeContainer.base_classs_type): New member for storing parent type.
4068 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4069 for this MemberCore.
4071 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4073 * attribute.cs, const.cs: Fix bug #58590
4075 2004-05-21 Martin Baulig <martin@ximian.com>
4077 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4078 out parameters if the end of the method is unreachable. Fixes
4081 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4083 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4084 Hari was right, why extra method.
4086 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4088 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4090 2004-05-20 Martin Baulig <martin@ximian.com>
4092 * delegate.cs: Convert this file to Unix mode - like the original
4095 2004-05-20 Martin Baulig <martin@ximian.com>
4097 * attribute.cs: Convert this file to Unix mode - like the original
4100 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4102 Fix bug #58688 (MCS does not report error when the same attribute
4105 * attribute.cs (Attribute.Emit): Distinction between null and default.
4107 2004-05-19 Raja R Harinath <rharinath@novell.com>
4109 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4110 of a top-level attribute without an attribute target.
4111 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4113 (Attribute.Conditional_GetConditionName),
4114 (Attribute.Obsolete_GetObsoleteMessage): Update.
4115 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4116 part of ScanForIndexerName.
4117 (Attribute.CanIgnoreInvalidAttribute): New function.
4118 (Attribute.ScanForIndexerName): Move to ...
4119 (Attributes.ScanForIndexerName): ... here.
4120 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4121 (Attributes.Search): New internal variant that can choose not to
4122 complain if types aren't resolved. The original signature now
4124 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4125 complaints suppressed.
4126 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4127 only if it not useful.
4128 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4129 top-level for attributes that are shared between the assembly
4130 and a top-level class.
4131 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4132 * class.cs: Update to reflect changes.
4133 (DefineIndexers): Fuse loops.
4134 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4135 a couple more variants of attribute names.
4137 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4139 Fix bug #52585 (Implemented explicit attribute declaration)
4142 (Attributable.ValidAttributeTargets): New abstract method. It gets
4143 list of valid attribute targets for explicit target declaration.
4144 (Attribute.Target): It holds target itself.
4145 (AttributeSection): Removed.
4146 (Attribute.CheckTargets): New method. It checks whether attribute
4147 target is valid for the current element.
4150 (EventProperty): New class. For events that are declared like
4151 property (with add and remove accessors).
4152 (EventField): New class. For events that are declared like field.
4155 * cs-parser.jay: Implemented explicit attribute target declaration.
4157 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4158 Override ValidAttributeTargets.
4161 (ReturnParameter): Class for applying custom attributes on
4163 (ParameterAtribute): New class. Class for applying custom
4164 attributes on the parameter type.
4166 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4168 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4171 (Method): Allow UNSAFE here.
4173 * modifiers.cs: Support unsafe reporting.
4175 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4177 * decl.cs: Fix bug #58478.
4179 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4181 * statement.cs: When checking for unreachable code on an EmptyStatement,
4182 set the location. Fixes bug #58488.
4184 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4186 * driver.cs: Add -pkg handling.
4188 From Gonzalo: UseShelLExecute=false
4190 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4193 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4195 (Attribute.IsClsCompliaceRequired): Moved to base for better
4197 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4198 when attribute is AttributeUsageAttribute.
4199 (Attribute.GetValidTargets): Simplified.
4200 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4201 attribute for this type.
4202 (Attribute.ApplyAttributes): Method renamed to Emit and make
4204 (GlobalAttributeSection): New class for special handling of global
4205 attributes (assembly, module).
4206 (AttributeSection.Emit): New method.
4208 * class.cs: Implemented Attributable abstract methods.
4209 (MethodCore.LabelParameters): Moved to Parameter class.
4210 (Accessor): Is back simple class.
4211 (PropertyMethod): Implemented Attributable abstract class.
4212 (DelegateMethod): Implemented Attributable abstract class.
4213 (Event): New constructor for disctintion between normal Event
4214 and Event with accessors.
4216 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4218 * codegen.cs, const.cs, decl.cs, delegate.cs:
4219 (CommonAssemblyModulClass): Implemented Attributable abstract class
4222 * enum.cs: Implement IAttributeSupport interface.
4223 (EnumMember): New class for emum members. Implemented Attributable
4227 (ParameterBase): Is abstract.
4228 (ReturnParameter): New class for easier [return:] attribute handling.
4230 * typemanager.cs: Removed builder_to_attr.
4232 2004-05-11 Raja R Harinath <rharinath@novell.com>
4235 * attribute.cs (Attribute.GetPositionalValue): New function.
4236 * class.cs (TypeContainer.VerifyMembers): New function.
4237 (TypeContainer.Emit): Use it.
4238 (ClassOrStruct): New base class for Class and Struct.
4239 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4240 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4242 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4243 then each non-static field should have a FieldOffset attribute.
4244 Otherwise, none of the fields should have a FieldOffset attribute.
4245 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4246 and FieldOffset attributes.
4247 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4248 (TypeManager.field_offset_attribute_type): New core types.
4249 (TypeManager.InitCoreTypes): Initialize them.
4251 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4253 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4254 Return correct type.
4257 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4259 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4260 be implicitly converted to ulong.
4262 * expression.cs: The logic for allowing operator &, | and ^ worked
4263 was wrong, it worked before because we did not report an error in
4264 an else branch. Fixes 57895.
4266 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4267 allow volatile fields to be reference types.
4269 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4271 * driver.cs: Add support for /debug-
4273 2004-05-07 Raja R Harinath <rharinath@novell.com>
4275 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4276 Add a 'complain' parameter to silence errors.
4277 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4278 silently overlooked type-resolutions.
4279 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4281 (Attributes.Search): New function.
4282 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4283 (Attributes.GetAttributeFullName): Remove hack.
4284 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4285 Update to reflect changes.
4286 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4287 Use Attributes.Search instead of nested loops.
4289 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4292 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4293 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4294 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4296 * report.cs: (Report.Warning): Renamed to Warning_T because of
4297 parameter collision.
4299 2004-05-05 Raja R Harinath <rharinath@novell.com>
4301 * expression.cs (MemberAccess.ResolveMemberAccess):
4302 Exit with non-zero status after Report.Error.
4303 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4305 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4307 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4309 * support.cs: Don't hang when the file is empty.
4311 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4313 * support.cs: In SeekableStreamReader, compute the preamble size of the
4314 underlying stream. Position changes should take into account that initial
4317 2004-05-03 Todd Berman <tberman@sevenl.net>
4319 * driver.cs: remove unused GetSysVersion function.
4321 2004-05-03 Todd Berman <tberman@sevenl.net>
4323 * driver.cs: Remove the hack from saturday, as well as the hack
4324 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4325 link_paths to get that bit proper.
4327 2004-05-01 Todd Berman <tberman@sevenl.net>
4329 * driver.cs: Try a LoadFrom before a Load, this checks the current
4330 path. This is currently a bug in mono that is be fixed, however, this
4331 provides a workaround for now. This will be removed when the bug
4334 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4336 * CryptoConvert.cs: Updated to latest version. Fix issue with
4337 incomplete key pairs (#57941).
4339 2004-05-01 Todd Berman <tberman@sevenl.net>
4341 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4344 2004-04-30 Jackson Harper <jackson@ximian.com>
4346 * codegen.cs: Open keys readonly.
4348 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4350 * typemanager.cs: don't report cyclic struct layout when a struct
4351 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4352 which has 2 Pango.Rectangle fields.
4354 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4356 * expression.cs: Handle IntPtr comparisons with IL code
4357 rather than a method call.
4359 2004-04-29 Martin Baulig <martin@ximian.com>
4361 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4362 the list of PropertyInfo's in class hierarchy and find the
4363 accessor. Fixes #56013.
4365 2004-04-29 Martin Baulig <martin@ximian.com>
4367 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4369 2004-04-29 Martin Baulig <martin@ximian.com>
4371 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4373 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4375 2004-04-29 Martin Baulig <martin@ximian.com>
4377 * class.cs (ConstructorInitializer.Resolve): Check whether the
4378 parent .ctor is accessible. Fixes #52146.
4380 2004-04-29 Martin Baulig <martin@ximian.com>
4382 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4384 * statement.cs (Using.EmitLocalVariableDecls): Use
4385 TypeManager.idisposable_type, not typeof (IDisposable).
4386 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4388 2004-04-29 Martin Baulig <martin@ximian.com>
4390 * class.cs (Event.Define): Don't emit the field and don't set
4391 RTSpecialName and SpecialName for events on interfaces. Fixes
4394 2004-04-29 Raja R Harinath <rharinath@novell.com>
4396 Refactor Attribute.ApplyAttributes.
4397 * attribute.cs (Attributable): New base class for objects that can
4398 have Attributes applied on them.
4399 (Attribute): Make AttributeUsage fields public.
4400 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4401 (Attribute.IsInternalCall): New property.
4402 (Attribute.UsageAttr): Convert to a public read-only property.
4403 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4404 (Attribute.ResolveType, Attribute.Resolve)
4405 (Attribute.ScanForIndexerName): Update to reflect changes.
4406 (Attribute.CheckAttributeTarget): Re-format.
4407 (Attribute.ApplyAttributes): Refactor, to various
4408 Attributable.ApplyAttributeBuilder methods.
4409 * decl.cs (MemberCore): Make Attributable.
4410 * class.cs (Accessor): Make Attributable.
4411 (MethodData.ApplyAttributes): Use proper attribute types, not
4413 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4414 (TypeContainer.ApplyAttributeBuilder)
4415 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4416 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4417 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4418 (Operator.ApplyAttributeBuilder): New factored-out methods.
4419 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4420 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4421 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4422 * parameter.cs (ParameterBase): New Attributable base class
4423 that can also represent Return types.
4424 (Parameter): Update to the changes.
4426 2004-04-29 Jackson Harper <jackson@ximian.com>
4428 * driver.cs: Prefer the corlib system version when looking for
4429 assemblies in the GAC. This is still a hack, but its a better hack
4432 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4434 * decl.cs, enum.cs: Improved error 3005 reporting.
4436 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4437 (related_symbols): New private member for list of symbols
4438 related to reported error/warning.
4440 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4442 2004-04-29 Martin Baulig <martin@ximian.com>
4444 * ecore.cs (Expression.Constantify): If we're an enum and
4445 TypeManager.TypeToCoreType() doesn't give us another type, use
4446 t.UnderlyingSystemType. Fixes #56178.
4448 2004-04-29 Martin Baulig <martin@ximian.com>
4450 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4451 interfaces and for each interface, only add members directly
4452 declared in that interface. Fixes #53255.
4454 2004-04-28 Martin Baulig <martin@ximian.com>
4456 * expression.cs (ConditionalLogicalOperator): Use a temporary
4457 variable for `left' to avoid that we evaluate it more than once;
4460 2004-04-28 Martin Baulig <martin@ximian.com>
4462 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4465 2004-04-28 Martin Baulig <martin@ximian.com>
4467 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4470 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4471 whether the type is not void (CS1547).
4473 2004-04-28 Martin Baulig <martin@ximian.com>
4475 * expression.cs (Unary.DoResolveLValue): Override this and report
4476 CS0131 for anything but Operator.Indirection.
4478 2004-04-28 Martin Baulig <martin@ximian.com>
4480 Committing a patch from Ben Maurer; see bug #50820.
4482 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4485 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4488 2004-04-28 Martin Baulig <martin@ximian.com>
4490 Committing a patch from Ben Maurer; see bug #50820.
4492 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4495 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4498 2004-04-28 Martin Baulig <martin@ximian.com>
4500 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4501 (Block.AddLabel): Call DoLookupLabel() to only search in the
4504 2004-04-28 Martin Baulig <martin@ximian.com>
4506 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4507 comparing StringConstants and NullLiterals in Equality and Inequality.
4509 2004-04-28 Jackson Harper <jackson@ximian.com>
4511 * driver.cs: Attempt to load referenced assemblies from the
4512 GAC. This is the quick and dirty version of this method that
4513 doesnt take into account versions and just takes the first
4514 canidate found. Will be good enough for now as we will not have more
4515 then one version installed into the GAC until I update this method.
4517 2004-04-28 Martin Baulig <martin@ximian.com>
4519 * typemanager.cs (TypeManager.CheckStructCycles): New public
4520 static method to check for cycles in the struct layout.
4522 * rootcontext.cs (RootContext.PopulateTypes): Call
4523 TypeManager.CheckStructCycles() for each TypeContainer.
4524 [Note: We only need to visit each type once.]
4526 2004-04-28 Martin Baulig <martin@ximian.com>
4528 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4530 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4531 success and added `out object value'. Use a `bool resolved' field
4532 to check whether we've already been called rather than
4533 `ConstantValue != null' since this breaks for NullLiterals.
4535 2004-04-28 Raja R Harinath <rharinath@novell.com>
4537 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4538 setting of this flag, since the 'set' method may be non-public.
4540 2004-04-28 Raja R Harinath <rharinath@novell.com>
4542 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4543 check on current_vector.Block.
4545 2004-04-27 Martin Baulig <martin@ximian.com>
4547 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4548 a field initializer. Fixes #56459.
4550 2004-04-27 Martin Baulig <martin@ximian.com>
4552 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4553 we're not attempting to use an indexer. Fixes #52154.
4555 2004-04-27 Martin Baulig <martin@ximian.com>
4557 * statement.cs (Return): Don't create a return label if we don't
4558 need it; reverts my change from January 20th. Thanks to Ben
4561 2004-04-27 Martin Baulig <martin@ximian.com>
4563 According to the spec, `goto' can only leave a nested scope, but
4566 * statement.cs (Block.LookupLabel): Only lookup in the current
4567 block, don't recurse into parent or child blocks.
4568 (Block.AddLabel): Check in parent and child blocks, report
4569 CS0140/CS0158 if we find a duplicate.
4570 (Block): Removed this indexer for label lookups.
4571 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4572 this already does the error reporting for us.
4575 (FlowBranching.UsageVector.Block): New public variable; may be null.
4576 (FlowBranching.CreateSibling): Added `Block' argument.
4577 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4578 label for the target of a `goto' and check whether we're not
4579 leaving a `finally'.
4581 2004-04-27 Martin Baulig <martin@ximian.com>
4583 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4584 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4587 2004-04-27 Martin Baulig <martin@ximian.com>
4589 * statement.cs (Block.AddLabel): Also check for implicit blocks
4590 and added a CS0158 check.
4592 2004-04-27 Martin Baulig <martin@ximian.com>
4594 * flowanalysis.cs (FlowBranchingLoop): New class.
4595 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4596 UsageVector's instead of an ArrayList.
4597 (FlowBranching.Label): Likewise.
4598 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4599 (FlowBranching.AddBreakVector): New method.
4601 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4603 * attribute.cs: Small regression fix: only convert the type if we
4604 the type is different, fixes System.Drawing build.
4606 2004-04-27 Martin Baulig <martin@ximian.com>
4608 * attribute.cs (Attribute.Resolve): If we have a constant value
4609 for a named field or property, implicity convert it to the correct
4612 2004-04-27 Raja R Harinath <rharinath@novell.com>
4614 * statement.cs (Block.Block): Implicit blocks share
4615 'child_variable_names' fields with parent blocks.
4616 (Block.AddChildVariableNames): Remove.
4617 (Block.AddVariable): Mark variable as "used by a child block" in
4618 every surrounding block.
4619 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4620 been used in a child block, complain about violation of "Invariant
4621 meaning in blocks" rule.
4622 * cs-parser.jay (declare_local_variables): Don't use
4623 AddChildVariableNames.
4624 (foreach_statement): Don't create an implicit block: 'foreach'
4627 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4629 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4630 converting from 0L to ulong. Fixes 57522.
4632 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4634 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4635 derived class hides via 'new' keyword field from base class (test-242.cs).
4636 TODO: Handle this in the more general way.
4638 * class.cs (CheckBase): Ditto.
4640 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4642 * decl.cs (caching_flags): New member for storing cached values
4644 (MemberCore.Flags): New enum where bit flags for caching_flags
4646 (MemberCore.cls_compliance): Moved to caching_flags.
4647 (DeclSpace.Created): Moved to caching_flags.
4649 * class.cs: Use caching_flags instead of DeclSpace.Created
4651 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4653 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4654 if we are only a derived class, not a nested class.
4656 * typemanager.cs: Same as above, but do this at the MemberLookup
4657 level (used by field and methods, properties are handled in
4658 PropertyExpr). Allow for the qualified access if we are a nested
4661 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4663 * class.cs: Refactoring.
4664 (IMethodData): New inteface; Holds links to parent members
4665 to avoid member duplication (reduced memory allocation).
4666 (Method): Implemented IMethodData interface.
4667 (PropertyBase): New inner classes for get/set methods.
4668 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4669 (Event): New inner classes for add/remove methods.
4670 (Event.DelegateMethod): Implemented IMethodData interface.
4672 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4673 EmitContext (related to class.cs refactoring).
4675 2004-04-21 Raja R Harinath <rharinath@novell.com>
4677 * delegate.cs (Delegate.VerifyApplicability): If the number of
4678 arguments are the same as the number of parameters, first try to
4679 verify applicability ignoring any 'params' modifier on the last
4683 2004-04-08 Martin Baulig <martin@ximian.com>
4685 Merged latest changes into gmcs. Please keep this comment in
4686 here, it makes it easier for me to see what changed in MCS since
4687 the last time I merged.
4689 2004-04-16 Raja R Harinath <rharinath@novell.com>
4691 * class.cs (TypeContainer.AddIndexer): Use
4692 'ExplicitInterfaceName' to determine if interface name was
4693 explicitly specified. 'InterfaceType' is not initialized at this time.
4694 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4695 Indexers array is already in the required order. Initialize
4696 'IndexerName' only if there are normal indexers.
4697 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4698 (TypeContainer.Emit): Emit DefaultMember attribute only if
4699 IndexerName is initialized.
4702 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4704 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4707 2004-04-15 Raja R Harinath <rharinath@novell.com>
4709 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4713 * attribute.cs (Attribute.Resolve): Check for duplicate named
4717 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4719 * iterators.cs (MarkYield): track whether we are in an exception,
4720 and generate code accordingly. Use a temporary value to store the
4721 result for our state.
4723 I had ignored a bit the interaction of try/catch with iterators
4724 since their behavior was not entirely obvious, but now it is
4725 possible to verify that our behavior is the same as MS .NET 2.0
4729 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4731 * iterators.cs: Avoid creating temporaries if there is no work to
4734 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4735 Enumerations, use TypeManager.EnumToUnderlying and call
4738 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4741 (This.Emit): Use EmitContext.EmitThis to emit our
4744 (This.EmitAssign): Ditto.
4746 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4747 codepaths, we will move all the functionality into
4750 (FieldExpr.EmitAssign): Ditto.
4752 This fixes several hidden bugs that I uncovered while doing a code
4753 review of this today.
4755 * codegen.cs (EmitThis): reworked so the semantics are more clear
4756 and also support value types "this" instances.
4758 * iterators.cs: Changed so that for iterators in value types, we
4759 do not pass the value type as a parameter.
4761 Initialization of the enumerator helpers is now done in the caller
4762 instead of passing the parameters to the constructors and having
4763 the constructor set the fields.
4765 The fields have now `assembly' visibility instead of private.
4767 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4769 * expression.cs (Argument.Resolve): Check if fields passed as ref
4770 or out are contained in a MarshalByRefObject.
4772 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4773 another compiler type.
4775 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4777 * class.cs (Indexer.Define): use the new name checking method.
4778 Also, return false on an error.
4779 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4780 (is_identifier_[start/part]_character): make static.
4782 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4784 * expression.cs (Binary.ResolveOperator): Do no append strings
4785 twice: since we can be invoked more than once (array evaluation)
4786 on the same concatenation, take care of this here. Based on a fix
4787 from Ben (bug #56454)
4789 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4791 * codegen.cs: Fix another case where CS1548 must be reported (when
4792 delay-sign isn't specified and no private is available #56564). Fix
4793 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4794 error when MCS is used on the MS runtime and we need to delay-sign
4795 (which seems unsupported by AssemblyBuilder - see #56621).
4797 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4799 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4800 (TypeManager.ComputeNamespaces): Faster implementation for
4803 * compiler.csproj: Updated AssemblyName to mcs.
4805 2004-05-11 Jackson Harper <jackson@ximian.com>
4807 * Makefile: Preserve MONO_PATH
4809 2004-05-11 Jackson Harper <jackson@ximian.com>
4811 * Makefile: Use mono and mcs to build gmcs
4813 2004-05-03 Miguel de Icaza <miguel@ximian.com>
4815 * codegen.cs: Add patch from Robert Shade
4816 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
4819 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
4821 * CryptoConvert.cs: Updated to latest version. Fix issue with
4822 incomplete key pairs (#57941).
4824 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4826 * codegen.cs: Fix another case where CS1548 must be reported (when
4827 delay-sign isn't specified and no private is available #56564). Fix
4828 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4829 error when MCS is used on the MS runtime and we need to delay-sign
4830 (which seems unsupported by AssemblyBuilder - see #56621).
4832 2004-04-29 Jackson Harper <jackson@ximian.com>
4834 * Makefile: Set MONO_PATH to use the bootstrap corlib
4835 * driver.cs: Check the GAC for referenced assemblies.
4837 2004-04-29 Martin Baulig <martin@ximian.com>
4839 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
4841 2004-04-07 Martin Baulig <martin@ximian.com>
4843 * expression.cs (Binary.ResolveOperator): Added special case for
4844 Equality/Inequality between a type parameter and a null literal.
4846 2004-04-07 Martin Baulig <martin@ximian.com>
4848 * convert.cs: Check null literal -> type parameter conversions.
4850 2004-04-07 Martin Baulig <martin@ximian.com>
4852 * generic.cs (ConstructedType.CheckConstraints): Enforce the
4853 `class' and `struct' constraints.
4855 2004-04-07 Martin Baulig <martin@ximian.com>
4857 * generic.cs (SpecialConstraint): New public enum.
4858 (Constraints.Resolve): Added support for the `class' and `struct'
4861 * cs-parser.jay (type_parameter_constraint): Added support for the
4862 `class' and `struct' constraints.
4864 2004-04-07 Martin Baulig <martin@ximian.com>
4866 * support.cs (GenericConstraints): Replaced `Types' by
4867 `ClassConstraint' and `InterfaceConstraints'; added
4868 `HasClassConstraint'.
4870 2004-04-07 Martin Baulig <martin@ximian.com>
4873 (Constraints.InterfaceConstraints): New public property.
4874 (Constraints.Types): Make this property public
4875 (TypeParameter): Implement IMemberContainer.
4876 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
4877 instead of a TypeBuilder/MethodBuilder; pass the interface
4878 constraints to TypeManager.AddTypeParameter().
4879 (TypeParameter.DefineType): Just take an EmitContext and no
4880 TypeBuilder/MethodBuilder. Use the new public API.
4882 * typemanager.cs (TypeManager.AddTypeParameter): Added
4883 `TypeExpr[]' argument; add the interfaces to the
4884 `builder_to_ifaces' hash.
4885 (TypeManager.LookupMemberContainer): For
4886 GenericTypeParameterBuilders, get the TypeParameter from the
4887 `builder_to_type_param'.
4888 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
4889 the TypeParameter and call FindMembers on it.
4891 2004-04-07 Martin Baulig <martin@ximian.com>
4894 (MethodCore.GenericMethod): Moved this field here from Method.
4895 (MethodCore.IsDuplicateImplementation): Take the number of type
4896 parameters into account if we're a generic method.
4898 * expression.cs (Invocation.InferTypeArguments): Don't return true
4899 if `arguments' is null; we still need to check whether we actually
4900 don't need to infer anything in this case.
4901 (MemberAccess): Merged the functionality from GenericMemberAccess
4904 * generic.cs (GenericMemberAccess): Removed.
4906 2004-04-05 Martin Baulig <martin@ximian.com>
4908 * decl.cs (MemberCore): For generic classes, interfaces and
4909 structs, `Name' now includes the number of type parameters
4911 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
4912 encode the number of type arguments in the type name.
4914 * expression.cs (Expression.MemberLookup): Removed the
4915 `num_type_args' argument; we now encode the number of type
4916 arguments in the type name.
4918 * ecore.cs (SimpleName): Encode the number of type arguments in
4919 the type name itself.
4921 * generic.cs (ConstructedType): Likewise.
4923 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
4924 `MemberName'; we now include the number of type parameters in the
4927 * typemanager.cs (TypeManager.CheckGeneric): Removed.
4928 (TypeManager.MemberLookup): Removed the
4929 `num_type_args' argument; we now encode the number of type
4930 arguments in the type name.
4932 2004-04-03 Martin Baulig <martin@ximian.com>
4934 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
4935 (MemberCore.MemberName): Moved here from MemberBase.
4936 (DeclSpace.SetParameterInfo): Just take the constraints as an
4937 ArrayList; we already have the type parameters in our
4938 `MemberName'; also do the CS0080 reporting here.
4940 * cs-parser.jay (struct_declaration): Use `member_name' instead of
4941 `IDENTIFIER opt_type_parameter_list'; when constructing our
4942 `MemberName', it'll already include our type parameters.
4943 (class_declaration, interface_declaration): Likewise.
4944 (delegate_declaration): Likewise.
4945 (MakeName): Take a MemberName and return a MemberName.
4946 The following two changes are required to avoid shift/reduce conflicts:
4947 (member_name): Don't include a TypeName anymore; ie. this is now
4948 just 'IDENTIFIER opt_type_parameter_list'.
4949 (property_declaration, event_declaration): Use a
4950 `namespace_or_type_name' instead of a `member_name'.
4952 2004-04-03 Martin Baulig <martin@ximian.com>
4954 * decl.cs (MemberName): Renamed to `TypeName' and created a new
4956 (TypeName): Formerly known as MemberName.
4958 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
4959 instead of a `MemberName'.
4961 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
4962 (member_name): New rule; create a MemberName.
4964 2004-04-02 Martin Baulig <martin@ximian.com>
4966 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
4967 (CS0305 and CS0308).
4969 2004-04-02 Martin Baulig <martin@ximian.com>
4971 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
4972 support for nested types.
4974 2004-04-02 Martin Baulig <martin@ximian.com>
4976 * ecore.cs (IAlias): New public interface.
4977 (TypeExpr, TypeExpression): Implement IAlias.
4978 (TypeAliasExpression): New public class.
4980 * namespace.cs (Namespace): Implement IAlias.
4981 (Namespace.Lookup): Return an IAlias instead on an object.
4982 (Namespace.DefineName): Take an IAlias instead of an object.
4983 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
4985 (NamespaceEntry.UsingAlias): Take a Membername instead of an
4987 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
4989 (NamespaceEntry.Lookup): Likewise.
4991 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
4994 * decl.cs (DeclSpace): Implement IAlias.
4995 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
4997 * generic.cs (ConstructedType): Improved error checking.
4999 2004-04-02 Martin Baulig <martin@ximian.com>
5001 * convert.cs: Added type parameter conversions.
5004 (UnboxCast.Emit): Emit an `unbox.any' for type params.
5005 (ClassCast.Emit): If the source type is a type parameter, box it.
5006 If the target type is a type parameter, emit an `unbox.any'
5007 instead of a `classcast'.1
5009 2004-04-01 Martin Baulig <martin@ximian.com>
5011 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
5013 2004-04-01 Martin Baulig <martin@ximian.com>
5015 * generic.cs (ConstructedType.CheckConstraints): Use
5016 Convert.ImplicitStandardConversionExists(); user-defined implicit
5017 conversions are not allowed according to the spec.
5019 2004-03-30 Martin Baulig <martin@ximian.com>
5021 * expression.cs (New): Added support for type parameters.
5024 (TypeManager.activator_type): New public static field.
5025 (TypeManager.activator_create_instance): Likewise.
5027 2004-03-30 Martin Baulig <martin@ximian.com>
5029 * typemanager.cs (TypeManager.HasConstructorConstraint): New
5032 2004-03-30 Martin Baulig <martin@ximian.com>
5034 * generic.cs (ConstructedType.CheckConstraints): Actually follow
5035 the spec here: the argument type must be convertible to the
5038 2004-03-30 Martin Baulig <martin@ximian.com>
5041 (TypeParameter.Define, TypeParameter.DefineMethod): Call
5042 TypeManager.AddTypeParameter().
5043 (ConstructedType.CheckConstraints): Re-enable this and actually
5044 check whether we have a constructor constraint.
5047 (TypeManager.builder_to_type_param): New static field.
5048 (TypeManager.AddTypeParameter): New static method.
5049 (TypeManager.LookupTypeParameter): New public method.
5051 2004-03-30 Martin Baulig <martin@ximian.com>
5053 * generic.cs (TypeParameter.DefineType): Return a boolean and use
5054 the new API to actually define the constructor constraint.
5057 (TypeManager.new_constraint_attr_type): New static field.
5058 (TypeManager.InitCoreTypes): Initialize it.
5060 2004-03-30 Martin Baulig <martin@ximian.com>
5062 * generic.cs (Constraints): Completed error checking, use correct
5065 2004-03-29 Martin Baulig <martin@ximian.com>
5067 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
5069 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5070 public version which takes a `ParameterData pd' instead of an
5073 2004-03-29 Martin Baulig <martin@ximian.com>
5075 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
5078 2004-03-29 Martin Baulig <martin@ximian.com>
5080 * expression.cs (Argument.ResolveMethodGroup): If we're a
5081 ConstructedType, call GetMemberAccess() on it.
5083 2004-03-29 Martin Baulig <martin@ximian.com>
5085 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
5086 (MethodCore.CheckGenericOverride): When overriding a generic
5087 method, check whether the constraints match.
5089 * support.cs (GenericConstraints): New public interface.
5090 (ParameterData.GenericConstraints): New public method.
5092 * parameter.cs (Parameter.Resolve): Check whether we're a generic
5093 method parameter and compute our constraints if appropriate.
5094 (Parameter.GenericConstraints): New public property.
5096 * generic.cs (Constraints): Implement GenericConstraints.
5098 2004-03-29 Martin Baulig <martin@ximian.com>
5100 * decl.cs (MemberCache.FindMemberToOverride): Use
5101 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
5103 2004-03-29 Martin Baulig <martin@ximian.com>
5105 * generic.cs (GenericMethod.Define): Resolve our type parameters.
5107 2004-03-29 Martin Baulig <martin@ximian.com>
5109 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
5110 not allowed on non-generic declarations").
5112 2004-03-29 Martin Baulig <martin@ximian.com>
5114 * expression.cs (Invocation.InferTypeArguments): Added overloaded
5115 public version of this method.
5117 * class.cs (MethodCore.IsDuplicateImplementation): Use
5118 Invocation.InferTypeArguments() to check this.
5120 2004-03-29 Martin Baulig <martin@ximian.com>
5122 * convert.cs: Use TypeManager.IsDelegateType() instead of
5123 comparing types correctly.
5125 2004-03-29 Martin Baulig <martin@ximian.com>
5127 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
5128 types directly to make it work for generic instances.
5130 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
5132 2004-03-29 Martin Baulig <martin@ximian.com>
5134 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
5137 2004-03-24 Martin Baulig <martin@ximian.com>
5139 * decl.cs (DeclSpace.FindType): Also use
5140 TypeManager.CheckGeneric() for types from the using clauses.
5142 2004-03-23 Martin Baulig <martin@ximian.com>
5144 * expression.cs (Invocation.OverloadResolve): Added `bool
5145 may_fail' argument and use it instead of the Location.IsNull() hack.
5147 2004-03-23 Martin Baulig <martin@ximian.com>
5149 * expression.cs (Invocation.InferType): Use correct type inference
5152 2004-03-23 Martin Baulig <martin@ximian.com>
5154 * ecore.cs (MethodGroupExpr.Name): Use
5155 TypeManager.CSharpSignature() instead of just the name.
5157 * expression.cs (Invocation.OverloadResolve): Provide better error
5159 (Invocation.DoResolve): OverloadResolve() never returns null
5160 without reporting an error, so removed the error -6 reporting here.
5162 2004-03-23 Martin Baulig <martin@ximian.com>
5164 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
5167 * cs-parser.jay (delegate_declaration): Support generic delegates.
5169 * delegate.cs: Support generic delegates.
5171 2004-03-22 Martin Baulig <martin@ximian.com>
5173 * expression.cs (Invocation.InferParamsTypeArguments): New static
5174 method; does type inference for params arguments.
5176 2004-03-21 Martin Baulig <martin@ximian.com>
5178 * typemanager.cs (TypeManager.IsGenericMethod): New public static
5179 method; checks whether a method is a generic method.
5181 * expression.cs (Invocation.InferTypeArguments): New static method;
5182 infer type arguments for generic method invocation.
5184 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
5185 property; we set this to true if we're resolving a generic method
5186 invocation and the user specified type arguments, ie. we're not
5187 doing type inference.
5189 2004-03-20 Martin Baulig <martin@ximian.com>
5191 * class.cs (MethodData.DeclaringType): New public property.
5192 (MethodData.Define): Set DeclaringType here.
5193 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
5194 instead of OperatorMethodBuilder.DeclaringType.
5196 2004-03-20 Martin Baulig <martin@ximian.com>
5198 * cs-tokenizer.cs (xtoken): Return a special
5199 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
5201 * cs-parser.jay (default_value_expression): Switch to the new
5204 2004-03-19 Martin Baulig <martin@ximian.com>
5206 * decl.cs (MemberName): New class. We use this to "construct"
5207 namespace_or_type_name's.
5209 * generics.cs (TypeArguments.GetDeclarations): New public method;
5210 returns the type arguments as a string[] and reports a CS0081 if
5211 one of them is not an identifier.
5213 * class.cs (MemberBase): The .ctor now takes the name as a
5214 MemberName instead of a string.
5215 (MemberBase.ExplicitInterfaceName): Changed type from string to
5217 (MemberBase.DoDefine): If we're an explicit implementation, the
5218 InterfaceType may be a generic instance.
5220 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
5221 (namespace_name): Call MemberName.GetName () to transform the
5222 MemberName into a string and ensure we don't have any type
5224 (type_name): Call MemberName.GetTypeExpression() to transfrom the
5225 MemberName into an expression.
5226 (method_header): Use namespace_or_type_name instead of member_name.
5228 2004-04-07 Miguel de Icaza <miguel@ximian.com>
5230 * rootcontext.cs: Add new types to the boot resolution.
5232 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
5233 MulticastDelegate is not allowed.
5235 * typemanager.cs: Add new types to lookup: System.TypedReference
5238 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
5239 check for TypedReference or ArgIterator, they are not allowed.
5241 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
5242 makes us properly catch 1510 in some conditions (see bug 56016 for
5245 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
5247 * CryptoConvert.cs: update from corlib version
5250 2004-04-05 Miguel de Icaza <miguel@ximian.com>
5252 * class.cs (Indexer.Define): Check indexername declaration
5254 2004-04-05 Marek Safar <marek.safar@seznam.cz>
5256 * attribute.cs (IsClsCompliant): Fixed problem with handling
5257 all three states (compliant, not-compliant, undetected).
5259 2004-03-30 Marek Safar <marek.safar@seznam.cz>
5261 * attribute.cs (Attribute): Location is now public.
5262 (Resolve): Store resolved arguments (pos_values) in attribute class.
5263 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
5264 (GetClsCompliantAttributeValue): New method that gets
5265 CLSCompliantAttribute value.
5266 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
5267 if exists else null.
5268 (AttributeTester): New class for CLS-Compliant verification routines.
5270 * class.cs (Emit): Add CLS-Compliant verification.
5271 (Method.GetSignatureForError): Implemented.
5272 (Constructor.GetSignatureForError): Implemented
5273 (Constructor.HasCompliantArgs): Returns if constructor has
5274 CLS-Compliant arguments.
5275 (Constructor.Emit): Override.
5276 (Construcor.IsIdentifierClsCompliant): New method; For constructors
5277 is needed to test only parameters.
5278 (FieldBase.GetSignatureForError): Implemented.
5279 (TypeContainer): New member for storing base interfaces.
5280 (TypeContainer.FindMembers): Search in base interfaces too.
5282 * codegen.cs (GetClsComplianceAttribute): New method that gets
5283 assembly or module CLSCompliantAttribute value.
5284 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5286 (ModuleClass.Emit): Add error 3012 test.
5288 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5290 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5291 state for all decl types.
5292 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5293 if CLS-Compliant tests are required.
5294 (IsClsCompliaceRequired): New method. Analyze whether code
5295 must be CLS-Compliant.
5296 (IsExposedFromAssembly): New method. Returns true when MemberCore
5297 is exposed from assembly.
5298 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5299 value or gets cached value.
5300 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5301 is explicitly marked with CLSCompliantAttribute.
5302 (IsIdentifierClsCompliant): New abstract method. This method is
5303 used to testing error 3005.
5304 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5305 for identifier and parameters CLS-Compliant testing.
5306 (VerifyClsCompliance): New method. The main virtual method for
5307 CLS-Compliant verifications.
5308 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5309 null. I don't know why is null (too many public members !).
5310 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5311 and get value of first CLSCompliantAttribute that found.
5313 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5314 (VerifyClsCompliance): Override and add extra tests.
5316 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5317 clscheck- disable CLS-Compliant verification event if assembly is has
5318 CLSCompliantAttribute(true).
5320 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5321 ApllyAttribute is now called in emit section as in the other cases.
5322 Possible future Emit integration.
5323 (IsIdentifierClsCompliant): New override.
5324 (VerifyClsCompliance): New override.
5325 (GetEnumeratorName): Returns full enum name.
5327 * parameter.cs (GetSignatureForError): Implemented.
5329 * report.cs (WarningData): New struct for Warning message information.
5330 (LocationOfPreviousError): New method.
5331 (Warning): New method. Reports warning based on the warning table.
5332 (Error_T): New method. Reports error based on the error table.
5334 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5335 verifications are done here.
5337 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5339 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5340 CLSCompliantAttribute.
5341 (all_imported_types): New member holds all imported types from other
5343 (LoadAllImportedTypes): New method fills static table with exported types
5344 from all referenced assemblies.
5345 (Modules): New property returns all assembly modules.
5347 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5349 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5350 throwing a parser error.
5352 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5353 which removes the hardcoded get_/set_ prefixes for properties, as
5354 IL allows for the properties to be named something else.
5358 * expression.cs: Do not override operand before we know if it is
5361 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5363 * typemanager.cs: support for pinned variables.
5365 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5367 * decl.cs, typemanager.cs: Avoid using an arraylist
5368 as a buffer if there is only one result set.
5370 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5372 * expression.cs: Make sure you cant call a static method
5373 with an instance expression, bug #56174.
5375 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5377 * class.cs (IsDuplicateImplementation): Improve error reporting to
5378 flag 663 (method only differs in parameter modifier).
5380 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5381 in preprocessor directives.
5383 * location.cs (LookupFile): Allow for the empty path.
5385 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5386 better approach for some of that patch, but its failing with the
5387 CharSet enumeration. For now try/catch will do.
5389 * typemanager.cs: Do not crash if a struct does not have fields.
5392 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5394 * expression.cs: cs0213, cant fix a fixed expression.
5397 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5399 * cs-parser.jay: detect invalid embeded statements gracefully.
5402 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5404 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5407 the invocation type may not be a subclass of the tye of the item/
5408 The type of the item must be a subclass of the invocation item.
5413 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5415 * attribute.cs: Added methods to get a string and a bool from an
5416 attribute. Required to information from AssemblyKeyFileAttribute,
5417 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5418 * codegen.cs: Modified AssemblyName creation to include support for
5419 strongnames. Catch additional exceptions to report them as CS1548.
5420 * compiler.csproj: Updated include CryptoConvert.cs.
5421 * compiler.csproj.user: Removed file - user specific configuration.
5422 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5423 Mono.Security assembly. The original class is maintained and tested in
5424 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5425 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5426 like CSC 8.0 (C# v2) supports.
5427 * Makefile: Added CryptoConvert.cs to mcs sources.
5428 * rootcontext.cs: Added new options for strongnames.
5430 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5432 * driver.cs: For --expect-error, report error code `2'
5433 if the program compiled with no errors, error code `1' if
5434 it compiled with an error other than the one expected.
5436 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5438 * compiler.csproj: Updated for Visual Studio .NET 2003.
5439 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5440 * compiler.sln: Updated for Visual Studio .NET 2003.
5442 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5444 * expression.cs: Fix bug #47234. We basically need to apply the
5445 rule that we prefer the conversion of null to a reference type
5446 when faced with a conversion to 'object' (csc behaviour).
5448 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5450 * statement.cs: Shorter form for foreach, eliminates
5451 a local variable. r=Martin.
5453 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5455 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5456 checks if we can use brtrue/brfalse to test for 0.
5457 * expression.cs: use the above in the test for using brtrue/brfalse.
5460 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5462 * expression.cs: Rewrite string concat stuff. Benefits:
5464 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5465 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5466 rather than a concat chain.
5468 * typemanager.cs: Add lookups for more concat overloads.
5470 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5472 * expression.cs: Emit shorter il code for array init.
5489 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5491 * statement.cs: Before, two switch blocks would be merged if the
5492 total size of the blocks (end_item - begin_item + 1) was less than
5493 two times the combined sizes of the blocks.
5495 Now, it will only merge if after the merge at least half of the
5500 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5502 * class.cs : csc build fix for GetMethods(). See bug #52503.
5504 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5506 * expression.cs: Make sure fp comparisons work with NaN.
5507 This fixes bug #54303. Mig approved this patch a long
5508 time ago, but we were not able to test b/c the runtime
5511 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5513 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5515 2004-03-19 Martin Baulig <martin@ximian.com>
5517 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
5518 two overloads may unify for some type parameter substitutions and
5519 report a CS0408 if appropriate.
5521 2004-03-19 Martin Baulig <martin@ximian.com>
5523 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5524 error here and not in our caller.
5526 2004-03-19 Martin Baulig <martin@ximian.com>
5528 * interface.cs: Completely killed this file.
5529 (Interface): We're now a TypeContainer and live in class.cs.
5531 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5532 argument; we're now also called for interfaces.
5533 (TypeContainer.DefineMembers): Allow this method being called
5535 (TypeContainer.GetMethods): New public method; formerly known as
5536 Interface.GetMethod(). This is used by PendingImplementation.
5537 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5538 it's now private and non-static.
5539 (Interface): Moved this here; it's now implemented similar to
5541 (Method, Property, Event, Indexer): Added `bool is_interface'
5542 argument to their .ctor's.
5543 (MemberBase.IsInterface): New public field.
5545 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5546 instances instead of InterfaceMethod, InterfaceProperty, etc.
5547 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5548 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5550 2004-03-19 Martin Baulig <martin@ximian.com>
5552 * class.cs (MethodCore.IsDuplicateImplementation): New private
5553 method which does the CS0111 checking.
5554 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5555 Use IsDuplicateImplementation().
5557 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5559 * decl.cs (FindMemberToOverride): New method to find the correct
5560 method or property to override in the base class.
5562 - Make Method/Property use the above method to find the
5563 version in the base class.
5564 - Remove the InheritableMemberSignatureCompare as it is now
5567 This patch makes large code bases much faster to compile, as it is
5568 O(n) rather than O(n^2) to do this validation.
5570 Also, it fixes bug 52458 which is that nested classes are not
5571 taken into account when finding the base class member.
5573 Reviewed/Approved by Martin.
5575 2004-03-17 Martin Baulig <martin@ximian.com>
5577 * expression.cs (MemberAccess.DoResolve): Take the parent's number
5578 of type arguments into account; use the `real_num_type_args'
5579 approach like in DoResolveAsTypeStep().
5581 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
5584 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5586 * interface.cs: In all interface classes removed redundant
5587 member initialization.
5589 2004-03-16 Martin Baulig <martin@ximian.com>
5591 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5593 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5595 * decl.cs (DefineTypeAndParents): New helper method to define a
5596 type's containers before the type itself is defined; This is a
5597 bug exposed by the recent changes to Windows.Forms when an
5598 implemented interface was defined inside a class that had not been
5601 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5603 (Check): Loop correctly to report errors modifiers
5604 (UNSAFE was not in the loop, since it was the same as TOP).
5606 * interface.cs: Every interface member now takes a ModFlags,
5607 instead of a "is_new" bool, which we set on the base MemberCore.
5609 Every place where we called "UnsafeOk" in the interface, now we
5610 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5611 the unsafe settings from the member declaration instead of the
5612 container interface.
5614 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5616 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5617 `set_indexer_name' to the pending bits (one per type).
5619 We fixed a bug today that was picking the wrong method to
5620 override, since for properties the existing InterfaceMethod code
5621 basically ignored the method name. Now we make sure that the
5622 method name is one of the valid indexer names.
5624 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5626 * support.cs (SeekableStreamReader): Keep track of stream byte
5627 positions and don't mix them with character offsets to the buffer.
5629 Patch from Gustavo Giráldez
5631 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5633 * interface.cs (InterfaceSetGetBase): Removed double member
5634 initialization, base class does it as well.
5636 2004-03-13 Martin Baulig <martin@ximian.com>
5638 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5639 when compiling corlib.
5641 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5643 * convert.cs (ExplicitConversion): We were reporting an error on
5644 certain conversions (object_type source to a value type, when the
5645 expression was `null') before we had a chance to pass it through
5646 the user defined conversions.
5648 * driver.cs: Replace / and \ in resource specifications to dots.
5651 * class.cs: Add check for duplicate operators. Fixes 52477
5653 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5655 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5656 that are in the middle of the statements, not only at the end.
5659 * class.cs (TypeContainer.AddField): No longer set the
5660 `HaveStaticConstructor' flag, now we call it
5661 `UserDefineStaticConstructor' to diferentiate the slightly
5662 semantic difference.
5664 The situation is that we were not adding BeforeFieldInit (from
5665 Modifiers.TypeAttr) to classes that could have it.
5666 BeforeFieldInit should be set to classes that have no static
5671 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5673 And most importantly Zoltan's comment:
5675 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5677 "I think beforefieldinit means 'it's ok to initialize the type sometime
5678 before its static fields are used', i.e. initialization does not need
5679 to be triggered by the first access to the type. Setting this flag
5680 helps the JIT to compile better code, since it can run the static
5681 constructor at JIT time, and does not need to generate code to call it
5682 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5683 this flag for lots of classes like String.
5685 csc sets this flag if the type does not have an explicit static
5686 constructor. The reasoning seems to be that if there are only static
5687 initalizers for a type, and no static constructor, then the programmer
5688 does not care when this initialization happens, so beforefieldinit
5691 This bug prevents the AOT compiler from being usable, since it
5692 generates so many calls to mono_runtime_class_init that the AOT code
5693 is much slower than the JITted code. The JITted code is faster,
5694 because it does not generate these calls if the vtable is type is
5695 already initialized, which is true in the majority of cases. But the
5696 AOT compiler can't do this."
5698 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5700 * class.cs (MethodData.Emit): Refactor the code so symbolic
5701 information is generated for destructors; For some reasons we
5702 were taking a code path that did not generate symbolic information
5705 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5707 * class.cs: Create a Constructor.CheckBase method that
5708 takes care of all validation type code. The method
5709 contains some code that was moved from Define.
5711 It also includes new code that checks for duplicate ctors.
5712 This fixes bug #55148.
5714 2004-03-09 Joshua Tauberer <tauberer@for.net>
5716 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5717 a { ... }-style array creation invokes EmitStaticInitializers
5718 which is not good for reference-type arrays. String, decimal
5719 and now null constants (NullCast) are not counted toward
5720 static initializers.
5722 2004-03-05 Martin Baulig <martin@ximian.com>
5724 * location.cs (SourceFile.HasLineDirective): New public field;
5725 specifies whether the file contains or is referenced by a "#line"
5727 (Location.DefineSymbolDocuments): Ignore source files which
5728 either contain or are referenced by a "#line" directive.
5730 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5732 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5733 direct access to our parent, so check the method inline there.
5735 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5737 * expression.cs (Invocation.EmitCall): Miguel's last commit
5738 caused a regression. If you had:
5743 In Foo the implict this would be null.
5745 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5747 * expression.cs (Invocation.EmitCall): If the method is not
5748 virtual, do not emit a CallVirt to it, use Call.
5750 * typemanager.cs (GetFullNameSignature): Improve the method to
5751 cope with ".ctor" and replace it with the type name.
5753 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5754 as an argument the ConstructorBuilder where it is being defined,
5755 to catch the recursive constructor invocations.
5757 2004-03-16 Martin Baulig <martin@ximian.com>
5759 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
5760 ConstructedType, call ResolveType() on it to get the type rather
5761 than just using `expr.Type'.
5763 2004-03-16 Martin Baulig <martin@ximian.com>
5765 * generics.cs (ConstructedType.GetMemberAccess): Take the
5766 EmitContext instead on the TypeExpr and use
5767 ec.TypeContainer.CurrentType/ec.ContainerType.
5769 2004-03-16 Martin Baulig <martin@ximian.com>
5771 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
5772 parameters before aliases.
5774 2004-03-16 Martin Baulig <martin@ximian.com>
5776 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
5777 New oublic function; checks whether two generic instances may become
5778 equal under some instantiations (26.3.1).
5780 * class.cs (TypeContainer.Define): Call
5781 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
5784 2004-03-16 Martin Baulig <martin@ximian.com>
5786 * class.cs (TypeContainer.GetClassBases): Moved
5787 Error_TypeParameterAsBase() here and also check whether the base
5788 class is not an attribute.
5790 2004-03-16 Martin Baulig <martin@ximian.com>
5792 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5794 2004-03-16 Martin Baulig <martin@ximian.com>
5796 * class.cs (Error_TypeParameterAsBase): Use correct error number
5799 2004-03-16 Martin Baulig <martin@ximian.com>
5801 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
5804 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
5807 2004-03-15 Martin Baulig <martin@ximian.com>
5809 * typemanager.cs (TypeManager.GetFullName): New public method.
5810 (TypeManager.MemberLookup): Added `int_num_type_arguments'
5811 argument; only return members with the correct number of type
5813 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
5814 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
5815 whether the number of type arguments matches.
5817 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
5818 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
5820 * expression.cs (MemberAccess): Added public `NumTypeArguments'
5821 field; it's set by the protected .ctor when we're actually a
5822 GenericMemberAccess.
5823 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
5824 arguments and pass it to MemberLookupFinal ().
5826 * ecore.cs (Expression.MemberLookup): Added `int
5827 num_type_arguments' argument; only return members with the correct
5828 number of type arguments.
5829 (Expression.MemberLookupFailed): Check whether the MemberLookup
5830 failed because we did not have the correct number of type
5831 arguments; report CS0305 in this case.
5833 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
5834 `e.ResolveAsTypeTerminal()' already did so.
5836 2004-03-15 Martin Baulig <martin@ximian.com>
5838 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
5839 we're a ConstructedType; in this case, the caller must report an
5840 error (for instance CS0131).
5842 * generic.cs (TypeArguments): Added Location argument to the .ctor.
5843 (TypeArguments.Resolve): Actually report errors here.
5845 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5847 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5848 `set_indexer_name' to the pending bits (one per type).
5850 We fixed a bug today that was picking the wrong method to
5851 override, since for properties the existing InterfaceMethod code
5852 basically ignored the method name. Now we make sure that the
5853 method name is one of the valid indexer names.
5855 2004-03-15 Martin Baulig <martin@ximian.com>
5857 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
5858 for generic instances.
5860 2004-03-13 Martin Baulig <martin@ximian.com>
5862 * class.cs (TypeContainer.DefineType): Call
5863 TypeManager.AddUserType() immediately after creating the
5864 TypeBuilder; pass all type parameters when creating the
5867 * decl.cs (DeclSpace.FindNestedType): New public method.
5868 (DeclSpace.FindType): Added `int num_type_args' argument; only
5869 return types with the correct number of type parameters.
5870 (DeclSpace.CountTypeParams): New public property.
5872 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
5873 the number of type parameters; defaults to zero.
5875 * generic.cs (TypeArguments.Count): New public property.
5876 (ConstructedType.DoResolveAsTypeStep): First call
5877 ds.FindNestedType() to find out whether we're nested in the
5878 current generic type; in this case, we inherit all type parameters
5879 from the current class.
5881 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
5882 num_type_args' argument.
5883 (RootContext.LookupType): Added overloaded version which takes the
5884 number of type arguments; only return types with the correct
5885 number of type arguments.
5887 * typemanager.cs (TypeManager.CheckGeneric): New public function;
5888 checks whether `Type t' has `int num_type_args'.
5890 2004-03-13 Martin Baulig <martin@ximian.com>
5892 * generic.cs (GenericMethod.DefineType): New method; calls
5893 DefineType() on all the type parameters.
5895 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
5896 (MethodData.Define): If we're a generic method, call
5897 GenericMethod.DefineType() to define the type parameters.
5899 2004-03-10 Martin Baulig <martin@ximian.com>
5901 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
5902 instead of IsAssignableFrom.
5904 2004-03-10 Martin Baulig <martin@ximian.com>
5906 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
5908 * support.cs (ParameterData.HasArrayParameter): New property.
5909 (ReflectionParameters.ctor): Take a MethodBase instead of a
5910 ParameterInfo[]. If we have any type parameters, get the generic
5911 method definition and ask it whether we have variable arguments.
5913 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5915 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5916 routines to check if a type is an enumerable/enumerator allow
5917 classes that implement the IEnumerable or IEnumerator interfaces.
5919 * class.cs (Property, Operator): Implement IIteratorContainer, and
5920 implement SetYields.
5922 (Property.Define): Do the block swapping for get_methods in the
5923 context of iterators. We need to check if Properties also
5924 include indexers or not.
5926 (Operator): Assign the Block before invoking the
5927 OperatorMethod.Define, so we can trigger the Iterator code
5930 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5931 Property and Operator classes are not created when we parse the
5932 declarator but until we have the block completed, so we use a
5933 singleton SimpleIteratorContainer.Simple to flag whether the
5934 SetYields has been invoked.
5936 We propagate this setting then to the Property or the Operator to
5937 allow the `yield' to function.
5939 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5941 * codegen.cs: Implemented attribute support for modules.
5942 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5943 Assembly/Module functionality.
5945 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5946 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5947 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5949 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5951 * interface.cs (FindMembers): The operation is performed on all base
5952 interfaces and not only on the first. It is required for future CLS Compliance patch.
5954 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5956 * statement.cs, codegen.cs:
5957 This patch deals with patterns such as:
5959 public class List : IEnumerable {
5961 public MyEnumerator GetEnumerator () {
5962 return new MyEnumerator(this);
5965 IEnumerator IEnumerable.GetEnumerator () {
5969 public struct MyEnumerator : IEnumerator {
5974 Before, there were a few things we did wrong:
5975 1) we would emit callvirt on a struct, which is illegal
5976 2) we emited ldarg when we needed to emit ldarga
5977 3) we would mistakenly call the interface methods on an enumerator
5978 type that derived from IEnumerator and was in another assembly. For example:
5980 public class MyEnumerator : IEnumerator
5982 Would have the interface methods called, even if there were public impls of the
5983 method. In a struct, this lead to invalid IL code.
5985 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5987 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5990 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5992 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5994 * cs-parser.jay: Fix small regression: we were not testing V2
5995 compiler features correctly.
5997 * interface.cs: If the emit context is null, then create one
5999 2004-02-09 Marek Safar <marek.safar@seznam.cz>
6001 * decl.cs (GetSignatureForError): New virtual method to get full name
6004 * attribute.cs (IAttributeSupport): New interface for attribute setting.
6005 Now it is possible to rewrite ApplyAttributes method to be less if/else.
6007 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
6008 Duplicated members and code in these classes has been removed.
6009 Better encapsulation in these classes.
6011 2004-02-07 Miguel de Icaza <miguel@ximian.com>
6013 * assign.cs (Assign.DoResolve): When dealing with compound
6014 assignments, there is a new rule in ECMA C# 2.4 (might have been
6015 there before, but it is documented here) that states that in:
6019 If b is of type int, and the `op' is a shift-operator, then the
6020 above is evaluated as:
6024 * expression.cs (Binary.ResolveOperator): Instead of testing for
6025 int/uint/long/ulong, try to implicitly convert to any of those
6026 types and use that in pointer arithmetic.
6028 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
6029 method to print information for from the type, not from the
6030 null-method we were given.
6032 2004-02-01 Duncan Mak <duncan@ximian.com>
6034 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
6035 parsing for cmd, fixes bug #53694.
6037 2004-02-04 Marek Safar <marek.safar@seznam.cz>
6039 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
6040 in the member name duplication tests. Property and operator name duplication
6041 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
6043 2004-02-03 Marek Safar <marek.safar@seznam.cz>
6045 * interface.cs (PopulateMethod): Fixed crash when interface method
6046 returns not existing type (error test cs0246-3.cs).
6048 2004-02-02 Ravi Pratap M <ravi@ximian.com>
6050 * cs-parser.jay (interface_accessors): Re-write actions to also
6051 store attributes attached to get and set methods. Fix spelling
6054 (inteface_property_declaration): Modify accordingly.
6056 (InterfaceAccessorInfo): New helper class to store information to pass
6057 around between rules that use interface_accessors.
6059 * interface.cs (Emit): Apply attributes on the get and set
6060 accessors of properties and indexers too.
6062 * attribute.cs (ApplyAttributes): Modify accordingly to use the
6063 right MethodBuilder when applying attributes to the get and set accessors.
6065 2004-01-31 Miguel de Icaza <miguel@ximian.com>
6067 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
6069 2004-01-26 Miguel de Icaza <miguel@ximian.com>
6071 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
6073 2004-01-25 Miguel de Icaza <miguel@ximian.com>
6075 * cs-parser.jay: Remove YIELD token, instead use the new grammar
6076 changes that treat `yield' specially when present before `break'
6079 * cs-tokenizer.cs: yield is no longer a keyword.
6081 2004-01-23 Marek Safar <marek.safar@seznam.cz>
6083 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
6084 setting for default constructors.
6085 For default constructors are almost every time set wrong Modifier. The
6086 generated IL code has been alright. But inside mcs this values was
6087 wrong and this was reason why several of my CLS Compliance tests
6090 2004-02-27 Martin Baulig <martin@ximian.com>
6092 * generics.cs (ConstructedType.ResolveType): Make the nested type
6093 stuff actually work.
6095 2004-02-25 Martin Baulig <martin@ximian.com>
6097 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
6098 property; returns the type parameters just from the current type,
6099 ie. with the ones from outer classes.
6100 (DeclSpace.LookupGeneric): First search in the current class, then
6102 (DeclSpace.initialize_type_params): When hiding a type parameter
6103 from an outer class, put it into the `type_param_list' anyways.
6105 * expression.cs (MemberAccess.expr): Made this field protected.
6107 * class.cs (TypeContainer.Define): The `CurrentType' just contains
6108 the type parameters from the current class.
6110 * generic.cs (ConstructedType.ResolveType): Support nested generic
6111 types by taking the type parameters which we inherit from outer
6112 classes into account.
6113 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
6114 support for nested generic types.
6116 2004-02-23 Martin Baulig <martin@ximian.com>
6118 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
6119 field and check whether we're nested inside a generic type.
6120 (DeclSpace.ResolveType): If we're resolving to a generic type
6121 definition, create a ConstructedType and return its resolved type.
6122 (DeclSpace.initialize_type_params): New private method;
6123 initializes the `type_param_list' field from the type parameters
6124 from this and all enclosing classes.
6125 (DeclSpace.TypeParameters): Call initialize_type_params() unless
6126 we're already initialized.
6128 2004-02-23 Martin Baulig <martin@ximian.com>
6130 * class.cs (Method.Define): Create the generic method before
6132 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
6133 the TypeContainer one); we use this for generic methods.
6135 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
6136 parent's TypeBuilder.
6138 2004-02-18 Martin Baulig <martin@ximian.com>
6140 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
6141 to check for equality.
6143 2004-02-05 Martin Baulig <martin@ximian.com>
6145 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
6146 `ec.TypeContainer.CurrentType', use it instead of
6147 `ec.ContainerType' to check whether we're in the type's ctor.
6149 2004-01-29 Martin Baulig <martin@ximian.com>
6151 * expression.cs (Invocation.DoResolve): If we're a
6152 `ConstructedType', then we're actually a generic method, so
6153 rewrite the expr as a GenericMemberAccess.
6155 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
6156 here; manually parse it into a string.
6158 2004-01-28 Martin Baulig <martin@ximian.com>
6160 * typemanager.cs (TypeManager.IsEqual): New static method.
6161 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
6162 check for equality instead of using `=='.
6164 2004-01-26 Martin Baulig <martin@ximian.com>
6166 * decl.cs (DeclSpace.CurrentType): New public field.
6168 * expression.cs (This.ResolveBase): If we have an
6169 `ec.TypeContainer.CurrentType', use it instead of
6172 * class.cs (TypeContainer.DefineType): If we're a generic type,
6173 create the `CurrentType' (unresolved).
6174 (TypeContainer.GenericType): New private field.
6175 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
6176 it and store it in `GenericType' before creating the MemberCache.
6177 (TypeContainer.GetMembers): If we have a `GenericType', call
6178 TypeManager.FindMembers() on it.
6180 * interface.cs (Interface.GenericType): New private field.
6181 (Interface.DefineType): If we're a generic type, create the
6182 `CurrentType' (unresolved).
6183 (Interface.DefineMembers): If we have a `CurrentType', resolve it
6184 and store it in `GenericType' before creating the MemberCache.
6185 (Interface.GetMembers): If we have a `GenericType', call
6186 TypeManager.FindMembers() on it.
6188 2004-01-22 Martin Baulig <martin@ximian.com>
6190 * cs-parser.jay (namespace_or_type_name): Return an Expression,
6191 not a QualifiedIdentifier. This is what `type_name_expression'
6192 was previously doing.
6193 (type_name_expression): Removed; the code is now in
6194 `namespace_or_type_name'.
6195 (qualified_identifier): Removed, use `namespace_or_type_name'
6197 (QualifiedIdentifier): Removed this class.
6199 2004-01-22 Martin Baulig <martin@ximian.com>
6201 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
6202 not a string as alias name.
6204 2004-01-21 Miguel de Icaza <miguel@ximian.com>
6206 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
6207 #52730 bug, and instead compute correctly the need to use a
6208 temporary variable when requesting an address based on the
6209 static/instace modified of the field and the constructor.
6211 2004-01-21 Martin Baulig <martin@ximian.com>
6213 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
6214 class and namespace before looking up aliases. Fixes #52517.
6216 2004-01-21 Martin Baulig <martin@ximian.com>
6218 * flowanalysis.cs (UsageVector.Merge): Allow variables being
6219 assinged in a 'try'; fixes exception4.cs.
6221 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6222 * class.cs : Implemented parameter-less constructor for TypeContainer
6224 * decl.cs: Attributes are now stored here. New property OptAttributes
6226 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
6228 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
6230 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6232 * typemanager.cs (CSharpSignature): Now reports also inner class name.
6233 (CSharpSignature): New method for indexer and property signature.
6235 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6237 * pending.cs (IsVirtualFilter): Faster implementation.
6239 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6241 * typemanager.cs: Avoid inclusion of same assembly more than once.
6243 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6245 * cs-parser.jay: Fixed problem where the last assembly attribute
6246 has been applied also to following declaration (class, struct, etc.)
6248 2004-01-21 Marek Safar <marek.safar@seznam.cz>
6250 * class.cs: Added error CS0538, CS0539 reporting.
6251 Fixed crash on Microsoft runtime when field type is void.
6253 * cs-parser.jay: Added error CS0537 reporting.
6255 * pending.cs: Added error CS0535 reporting.
6256 Improved error report for errors CS0536, CS0534.
6258 2004-01-20 Miguel de Icaza <miguel@ximian.com>
6260 Merge a few bits from the Anonymous Method MCS tree.
6262 * statement.cs (ToplevelBlock): New class for toplevel methods,
6263 will hold anonymous methods, lifted variables.
6265 * cs-parser.jay: Create toplevel blocks for delegates and for
6266 regular blocks of code.
6268 2004-01-20 Martin Baulig <martin@ximian.com>
6270 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
6271 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
6272 and `NeedExplicitReturn'; added `IsLastStatement'.
6273 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
6274 have a `ReturnLabel' or we're not unreachable.
6276 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
6277 child's reachability; don't just override ours with it. Fixes
6278 #58058 (lluis's example).
6279 (FlowBranching): Added public InTryOrCatch(), InCatch(),
6280 InFinally(), InLoop(), InSwitch() and
6281 BreakCrossesTryCatchBoundary() methods.
6283 * statement.cs (Return): Do all error checking in Resolve().
6284 Unless we are the last statement in a top-level block, always
6285 create a return label and jump to it.
6286 (Break, Continue): Do all error checking in Resolve(); also make
6287 sure we aren't leaving a `finally'.
6288 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
6289 statement in a top-level block.
6290 (Block.Flags): Added `IsDestructor'.
6291 (Block.IsDestructor): New public property.
6293 2004-01-20 Martin Baulig <martin@ximian.com>
6295 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
6297 2004-01-20 Martin Baulig <martin@ximian.com>
6299 * statement.cs (Statement.ResolveUnreachable): New public method.
6300 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
6301 (Block.Resolve): Resolve unreachable statements.
6303 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6305 * expression.cs: We need to fix the case where we do
6306 not have a temp variable here.
6308 * assign.cs: Only expression compound assignments need
6309 temporary variables.
6311 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
6313 * flowanalysis.cs: Reduce memory allocation in a few ways:
6314 - A block with no variables should not allocate a bit
6316 - A method with no out parameters does not need any tracking
6317 for assignment of the parameters, so we need not allocate
6320 public readonly Type[] VariableTypes;
6321 public readonly string[] VariableNames;
6322 Are redundant. The data is already stored in the variable
6323 map, so we need not allocate another array for it.
6324 - We need to add alot of checks for if (params | locals) == null
6325 due to the first two changes.
6327 2004-01-18 Miguel de Icaza <miguel@ximian.com>
6329 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
6330 implement IMemoryLocation, we store a copy on a local variable and
6331 take the address of it. Patch from Benjamin Jemlich
6333 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
6334 to use a special "type_name_expression" rule which reduces the
6335 number of "QualifiedIdentifier" classes created, and instead
6336 directly creates MemberAccess expressions.
6338 2004-01-17 Miguel de Icaza <miguel@ximian.com>
6340 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
6341 that fixes #52853. Null literal assignment to ValueType
6343 * class.cs (MethodData.Emit): Instead of checking the name of the
6344 method to determine if its a destructor, create a new derived
6345 class from Method called Destructor, and test for that.
6347 * cs-parser.jay: Create a Destructor object instead of a Method.
6349 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
6353 2004-01-16 Miguel de Icaza <miguel@ximian.com>
6355 * expression.cs (Binary.ResolveOperator): Perform an implicit
6356 conversion from MethodGroups to their delegate types on the
6359 * delegate.cs: Introduce a new class DelegateCreation that is the
6360 base class for `NewDelegate' and `ImplicitDelegateCreation',
6361 factor some code in here.
6363 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
6364 conversion from MethodGroups to compatible delegate types.
6366 * ecore.cs (Expression.Resolve): Do not flag error 654
6367 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
6368 we allow conversions from MethodGroups to delegate types now.
6370 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
6371 assignments in v2 either.
6373 2004-01-10 Miguel de Icaza <miguel@ximian.com>
6375 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
6376 static read-only fields in ctors.
6378 Applied patch from Benjamin Jemlich
6380 * expression.cs (UnaryMutator): Avoid leaking local variables.
6382 2004-01-09 Miguel de Icaza <miguel@ximian.com>
6384 * cs-tokenizer.cs (IsCastToken): Allow the various native types
6385 here to return true, as they can be used like this:
6389 Fixed 49836 and all the other dups
6391 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
6393 * driver.cs: Implement /win32res and /win32icon.
6395 2004-01-08 Miguel de Icaza <miguel@ximian.com>
6397 * cs-parser.jay: Add a rule to improve error handling for the
6398 common mistake of placing modifiers after the type.
6400 2004-01-07 Miguel de Icaza <miguel@ximian.com>
6402 * cs-parser.jay (interface_event_declaration): Catch
6403 initialization of events on interfaces, and report cs0068
6405 * cs-parser.jay (interface_event_declaration): Catch
6406 initialization of events.
6408 * ecore.cs: Better report missing constructors.
6410 * expression.cs (Binary.ResolveOperator): My previous bug fix had
6411 the error reporting done in the wrong place. Fix.
6413 * expression.cs (Binary.ResolveOperator): Catch the
6414 operator + (E x, E y) error earlier, and later allow for implicit
6415 conversions in operator +/- (E e, U x) from U to the underlying
6418 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
6419 52596, if the container class is abstract, the default constructor
6420 is protected otherwise its public (before, we were always public).
6422 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
6425 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
6426 Jemlich that fixes bug #52597, MCS was generating invalid code for
6427 idisposable structs. Thanks to Ben for following up with this
6430 2004-01-06 Miguel de Icaza <miguel@ximian.com>
6432 * driver.cs: Allow assemblies without code to be generated, fixes
6435 2004-01-07 Nick Drochak <ndrochak@gol.com>
6437 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
6439 2004-01-05 Miguel de Icaza <miguel@ximian.com>
6441 * cs-parser.jay: Add rules to improve error reporting if fields or
6442 methods are declared at the namespace level (error 116)
6444 * Add rules to catch event add/remove
6446 2004-01-04 David Sheldon <dave-mono@earth.li>
6448 * expression.cs: Added matching ")" to error message for
6451 2004-01-03 Todd Berman <tberman@gentoo.org>
6453 * ecore.cs, attribute.cs:
6454 Applying fix from #52429.
6456 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6458 * ecore.cs, expression.cs, statement.cs:
6459 Total rewrite of how we handle branching. We
6460 now handle complex boolean expressions with fewer
6461 jumps. As well if (x == 0) no longer emits a ceq.
6463 if (x is Foo) is much faster now, because we generate
6466 Overall, we get a pretty big improvement on our benchmark
6467 tests. The code we generate is smaller and more readable.
6469 I did a full two-stage bootstrap. The patch was reviewed
6470 by Martin and Miguel.
6472 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6474 * cs-parser.jay: Make primary_expression not take a QI.
6475 we dont need this because the member_access rule covers
6476 us here. So we replace the rule with just IDENTIFIER.
6478 This has two good effects. First, we remove a s/r conflict.
6479 Second, we allocate many fewer QualifiedIdentifier objects.
6481 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6483 * attribute.cs: Handle MarshalAs attributes as pseudo, and
6484 set the correct information via SRE. This prevents
6485 hanging on the MS runtime. Fixes #29374.
6487 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6489 * convert.cs: correctly handle conversions to value types
6490 from Enum and ValueType as unboxing conversions.
6492 Fixes bug #52569. Patch by Benjamin Jemlich.
6494 2004-01-02 Ravi Pratap <ravi@ximian.com>
6496 * expression.cs (BetterConversion): Prefer int -> uint
6497 over int -> ulong (csc's behaviour). This fixed bug #52046.
6499 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6501 * decl.cs (MemberCache.FindMembers): now returns a
6504 * typemanager.cs: In general, go with with ^^.
6505 (CopyNewMethods): take an IList.
6506 (RealMemberLookup): Only allocate an arraylist
6507 if we copy from two sets of methods.
6509 This change basically does two things:
6510 1) Fewer array lists allocated due to CopyNewMethods.
6511 2) the explicit cast in MemberList costed ALOT.
6513 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6515 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6516 a hashtable to avoid needless string allocations when an identifier is
6517 used more than once (the common case).
6519 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6521 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6522 is broken, it will not return anything. So, we
6523 have to use the information we have in mcs to
6526 * typemanager.cs: Add a cache for GetInterfaces,
6527 since this will now be used more often (due to ^^)
6529 (GetExplicitInterfaces) New method that gets the
6530 declared, not effective, interfaces on a type
6531 builder (eg, if you have interface IFoo, interface
6532 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6535 This patch makes MCS able to bootstrap itself on
6538 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6540 * expression.cs: Remove the Nop's that Miguel put
6543 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6545 * report.cs, codegen.cs: Give the real stack trace to
6546 the error when an exception is thrown.
6548 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6550 * decl.cs: only allocate hashtables for ifaces if
6553 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6555 * expression.cs: fix the error from cs0121-2.cs
6556 (a parent interface has two child interfaces that
6557 have a function with the same name and 0 params
6558 and the function is called through the parent).
6560 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6562 * class.cs, rootcontext.cs, typmanager.cs: do not
6565 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6567 * codegen.cs: remove stack for the ec flow branching.
6568 It is already a linked list, so no need.
6570 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6572 * Makefile: Allow custom profiler here.
6574 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6576 * typemanager.cs (LookupType):
6577 - Use a static char [], because split takes
6578 a param array for args, so it was allocating
6580 - Do not store true in a hashtable, it boxes.
6582 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6584 * flowanalysis.cs: bytify common enums.
6586 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6588 * modifiers.cs: Add a new set of flags for the
6589 flags allowed on explicit interface impls.
6590 * cs-parser.jay: catch the use of modifiers in
6591 interfaces correctly.
6592 * class.cs: catch private void IFoo.Blah ().
6594 All related to bug #50572.
6596 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6598 * decl.cs: Rewrite the consistant accessability checking.
6599 Accessability is not linear, it must be implemented in
6600 a tableish way. Fixes #49704.
6602 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6604 * expression.cs: Handle negation in a checked context.
6605 We must use subtraction from zero. Fixes #38674.
6607 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6609 * class.cs: Ignore static void main in DLLs.
6610 * rootcontext.cs: Handle the target type here,
6611 since we are have to access it from class.cs
6612 * driver.cs: account for the above.
6614 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6616 * report.cs: Give line numbers and files if available.
6618 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6620 * driver.cs: Implement /addmodule.
6622 * typemanager.cs: Change 'modules' field so it now contains Modules not
6625 2003-12-20 Martin Baulig <martin@ximian.com>
6627 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6628 (FieldBase.IsAssigned): Removed this field.
6629 (FieldBase.SetAssigned): New public method.
6630 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6632 2003-12-20 Martin Baulig <martin@ximian.com>
6634 * expression.cs (LocalVariableReference.DoResolve): Don't set
6635 `vi.Used' if we're called from DoResolveLValue().
6637 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6638 returns the usage vector it just merged into the current one -
6639 pass this one to UsageWarning().
6640 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6641 of the `EmitContext', don't call this recursively on our children.
6643 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6645 * driver.cs: Implement /target:module.
6647 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6649 * support.cs (CharArrayHashtable): New helper class.
6651 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6652 char arrays, not strings, so we can avoid creating a string in
6653 consume_identifier if the identifier is a keyword.
6655 2003-12-16 Martin Baulig <martin@ximian.com>
6657 * statement.cs (LocalInfo.Assigned): Removed this property.
6658 (LocalInfo.Flags): Removed `Assigned'.
6659 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6660 and uses flow analysis.
6661 (Block.UsageWarning): Made this method private.
6662 (Block.Resolve): Call UsageWarning() if appropriate.
6664 * expression.cs (LocalVariableReference.DoResolve): Always set
6665 LocalInfo.Used here.
6667 2003-12-13 Martin Baulig <martin@ximian.com>
6669 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6670 any value here; we're now using flow analysis to figure out
6671 whether a statement/block returns a value.
6673 2003-12-13 Martin Baulig <martin@ximian.com>
6675 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6677 (FlowBranching.MergeFinally): Don't call
6678 `branching.CheckOutParameters()' here, this is called in
6680 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6681 when adding the `finally' vector.
6683 2003-12-13 Martin Baulig <martin@ximian.com>
6686 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6687 actually work and also fix #48962.
6689 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6691 * decl.cs: Do not check System.Object for nested types,
6692 since we know it does not have any. Big bang for buck:
6697 corlib: 17.99 seconds
6701 corlib: 17.39 seconds
6703 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6705 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6706 time we are returning 0 members, so we save alot here.
6708 2003-12-11 Martin Baulig <martin@ximian.com>
6710 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6711 `MergeChild()', also just take the `FlowBranching' as argument;
6712 call Merge() on it and return the result.
6713 (FlowBranching.Merge): We don't need to do anything if we just
6716 2003-12-11 Martin Baulig <martin@ximian.com>
6718 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6719 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6720 Maurer for this idea.
6722 2003-12-11 Martin Baulig <martin@ximian.com>
6724 * flowanalysis.cs (MergeResult): This class is now gone; we now
6725 use the `UsageVector' for this. The reason for this is that if a
6726 branching just has one sibling, we don't need to "merge" them at
6727 all - that's the next step to do.
6728 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6731 2003-12-11 Martin Baulig <martin@ximian.com>
6733 Reworked flow analyis and made it more precise and bug-free. The
6734 most important change is that we're now using a special `Reachability'
6735 class instead of having "magic" meanings of `FlowReturns'. I'll
6736 do some more cleanups and optimizations and also add some more
6737 documentation this week.
6739 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6740 largely reworked this class.
6741 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6742 the new `Reachability' class instead of having "magic" values here.
6743 (FlowBranching): We're now using an instance of `Reachability'
6744 instead of having separate `Returns', `Breaks' etc. fields.
6746 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6747 based on flow analysis; ignore the return value of block.Emit ().
6749 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6751 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6752 if they are private.
6754 2003-12-09 Martin Baulig <martin@ximian.com>
6756 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6757 call them directly on the UsageVector.
6759 2003-12-09 Martin Baulig <martin@ximian.com>
6761 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6762 Changed return type from `FlowReturns' to `Reachability'.
6764 2003-12-09 Martin Baulig <martin@ximian.com>
6766 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6767 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6768 `Reachable' fields with a single `Reachability' one.
6770 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6772 * class.cs (FindMembers): Remove foreach's.
6785 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6790 This patch does a few things:
6791 1. EmptyStatement is now a singleton, so it is never reallocated.
6792 2. All blah is EmptyStatement constructs have been changed to
6793 blah == EmptyStatement.Value, which is much faster and valid
6794 now that EmptyStatement is a singleton.
6795 3. When resolving a block, rather than allocating a new array for
6796 the non-empty statements, empty statements are replaced with
6797 EmptyStatement.Value
6798 4. Some recursive functions have been made non-recursive.
6799 Mainly the performance impact is from (3), however (1) and (2) are needed for
6800 this to work. (4) does not make a big difference in normal situations, however
6801 it makes the profile look saner.
6806 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6807 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6808 Total memory allocated: 56397 KB
6811 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6812 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6813 Total memory allocated: 55666 KB
6815 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6817 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6818 than the hashtable in a hashtable version
6820 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6821 we always end up concating a string. This results in a huge perf
6822 loss, because many strings have to be tracked by the GC. In this
6823 patch, we first use a hashtable that works with two keys, so that
6824 the strings do not need to be concat'ed.
6835 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6837 * Makefile: Add a new target `do-time' that does a quick and simple
6838 profile, leaving easy to parse output.
6840 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6842 * codegen.cs (Init): Create the dynamic assembly with
6843 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6845 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6847 * support.cs: Make the PtrHashtable use only one
6848 instance of its comparer.
6850 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6852 * typemanager.cs: Fix lookup of GetNamespaces.
6854 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6856 * expression.cs: Removed redundant line.
6858 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6859 ArrayLists, use for loops with bounds.
6861 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6864 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6865 arraylists, use for loop with bounds.
6867 The above three changes give us a 0.071 second performance
6868 improvement out of 3.294 seconds down to 3.223. On my machine
6869 the above changes reduced the memory usage by 1,387 KB during
6872 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6873 QualifiedIdentifiers. Before we created a new string through
6874 concatenation, and mostly later on, the result would be
6875 manipulated by DecomposeQI through string manipulation.
6877 This reduced the compiler memory usage for bootstrapping from
6878 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6879 compile times in 0.05 seconds.
6881 2003-11-28 Dick Porter <dick@ximian.com>
6883 * support.cs: Do string compares with the Invariant culture.
6891 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6892 the comparison is done with the Invariant culture.
6894 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6896 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6897 GetEnumerator method.
6899 (ProbeCollectionType): Iterate starting at the most specific type
6900 upwards looking for a GetEnumerator
6902 * expression.cs: Shift count can be up to 31 for int/uint and 63
6905 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6907 * statement.cs (Block.LookupLabel): Also look for the label on the
6908 children blocks. Use a hash table to keep track of visited
6911 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6912 we actually did transform the other operand, otherwise fall back
6913 to the common codepath that casts to long.
6915 * cs-tokenizer.cs: Use the same code pattern as the int case.
6916 Maybe I should do the parsing myself, and avoid depending on the
6917 Parse routines to get this done.
6919 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6921 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6922 which fixes bug 51347. This time test it.
6924 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6925 attributes for example can not tell the difference between these.
6926 The difference was only a syntax feature of the language.
6928 * attribute.cs: Apply attributes to delegates.
6930 * delegate.cs: Call the apply attributes method.
6932 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6934 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6935 comparing 0 vs Byte.MinValue, not the value
6937 (ImplicitConversionRequired): When reporting a conversion error,
6938 use error 31 to print out the constant error instead of the
6941 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6942 which fixes bug 51347.
6944 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6946 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6947 which fixes the -warnaserror command line option.
6949 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6951 * cfold.cs (DoNumericPromotions): During constant folding of
6952 additions on UIntConstant, special case intconstants with
6953 IntConstants like we do on the expression binary operator.
6955 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6957 * convert.cs (ImplicitReferenceConversion): We were missing a case
6958 (System.Enum are not value types or class types, so we need to
6959 classify them separatedly).
6961 * driver.cs: We do not support error 2007.
6963 2003-11-12 Jackson Harper <jackson@ximian.com>
6965 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6966 system directory. Also use the full file name so users can
6967 libraries names mscorlib-o-tron.dll in a non system dir.
6969 2004-01-04 David Sheldon <dave-mono@earth.li>
6971 * expression.cs: Added matching ")" to error message for CS0077.
6973 2003-12-19 Martin Baulig <martin@ximian.com>
6975 * typemanager.cs (TypeManager.IsEqualGenericType): New public
6976 static method; see documentation in the method.
6977 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
6979 * convert.cs (Convert.ImplicitReferenceConversion,
6980 Convert.ImplicitReferenceConversionExists): Add support for
6981 generic type declarations; see gen-36.cs.
6983 2003-12-19 Martin Baulig <martin@ximian.com>
6985 * pending.cs (Pending.InterfaceMethod): Use
6986 `Type.IsAssignableFrom()' instead of `=='.
6988 2003-12-18 Martin Baulig <martin@ximian.com>
6990 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
6993 * convert.cs (Convert.ImplicitStandardConversionExists): Use
6994 `expr_type.Equals (target_type)' instead of `=='.
6996 2003-12-08 Martin Baulig <martin@ximian.com>
6998 * generics.cs (Constraints.Types): Removed.
6999 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
7001 (Constraints.ResolveTypes): New public method; resolves the
7002 TypeExpr's to Type's.
7003 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
7004 longer takes the constraints.
7005 (TypeParameter.DefineMethod): Likewise.
7006 (TypeParameter.DefineType): New public method. Calls
7007 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
7010 2003-12-08 Martin Baulig <martin@ximian.com>
7012 * convert.cs (Convert.ImplicitConversionStandard): Use
7013 `expr_type.Equals (target_type)' instead of `=='.
7015 2003-12-08 Martin Baulig <martin@ximian.com>
7017 * typemanager.cs (TypeManager.GetReferenceType): Call
7018 `Type.MakeByRefType ()'.
7020 2003-12-08 Martin Baulig <martin@ximian.com>
7022 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
7023 just has some special meaning in some situations. For instance,
7024 it is allowed to use `where' as the name of a variable etc.
7026 2003-12-04 Martin Baulig <martin@ximian.com>
7028 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
7029 `Type.MakeArrayType()' for array types.
7031 2003-11-18 Miguel de Icaza <miguel@ximian.com>
7033 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
7036 (SizeOf.DoResolve): assign the `type_queried' field. This gets
7039 2003-11-16 Martin Baulig <martin@ximian.com>
7041 * codegen.cs (EmitContext.IsGeneric): Removed.
7043 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
7044 ResolveGeneric() on the DeclSpace.
7046 2003-11-16 Martin Baulig <martin@ximian.com>
7048 * generic.cs (TypeArguments.Resolve):
7049 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
7050 `ResolveType()' on it to get the Type.
7052 2003-11-15 Martin Baulig <martin@ximian.com>
7054 * generic.cs (ConstructedType.GetInterfaces): Override this.
7056 2003-11-14 Martin Baulig <martin@ximian.com>
7058 * interface.cs (Interface.DefineType): Define all type parameters
7059 before adding the interfaces we inherit.
7061 2003-11-11 Martin Baulig <martin@ximian.com>
7063 * generic.cs (ConstructedType.ResolveType): Always call
7064 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
7066 2003-11-10 Martin Baulig <martin@ximian.com>
7068 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
7069 (TypeManager.InitCoreTypes): Initialize them here, but instead of
7070 calling `ResolveType()' on them, directly assign their `Type'.
7072 2003-11-08 Martin Baulig <martin@ximian.com>
7074 * generic.cs (ConstructedType): Override `IsClass' etc.
7076 2003-11-08 Martin Baulig <martin@ximian.com>
7078 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
7079 return value and the `out parent' parameter.
7080 (TypeContainer.DefineType): Moved the CS0644 check into
7081 GetClassBases(). Don't pass the interface types to the
7082 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
7083 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
7085 * ecore.cs (TypeExpr.IsAttribute): New property.
7086 (TypeExpr.GetInterfaces): New method.
7088 * interface.cs (Interface.GetInterfaceTypeByName): Return a
7089 TypeExpr instead of a Type.
7090 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
7091 (Interface.DefineType): Don't pass the interface types to the
7092 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
7093 them later and then call `TypeBulider.AddInterfaceImplementation()'.
7095 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
7096 instead of a `Type[]'.
7097 (TypeManager.RegisterBuilder): Likewise.
7098 (TypeManager.AddUserInterface): Likewise.
7099 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
7100 `Type[]' and also return a `TypeExpr[]'.
7101 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
7103 2003-11-08 Martin Baulig <martin@ximian.com>
7105 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
7108 2003-11-08 Martin Baulig <martin@ximian.com>
7110 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
7111 TypeManager.ResolveExpressionTypes().
7113 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
7114 instead of an Expression.
7115 (TypeExpr): This is now an abstract base class for `TypeExpression'.
7116 (TypeExpression): New public class; formerly known as `TypeExpr'.
7118 * expression.cs (ComposedCast): Derive from TypeExpr.
7120 * typemanager.cs (TypeManager.system_*_expr): These are now
7121 TypExpr's instead of Expression's.
7122 (TypeManager.ResolveExpressionTypes): New public static function;
7123 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
7126 2003-11-06 Miguel de Icaza <miguel@ximian.com>
7128 * expression.cs (New.DoResolve): Do not dereference value that
7129 might be a null return.
7131 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
7132 sure that the constant value has the right type. Fixes an
7133 unreported bug, similar to 50425.
7135 * const.cs (Const.LookupConstantValue): Call
7136 ImplicitStandardConversionExists before doing a conversion to
7137 avoid havng the TypeManager.ChangeType do conversions.
7139 Reduced the number of casts used
7141 (Const.ChangeType): New routine to enable reuse of the constant
7142 type changing code from statement.
7144 * typemanager.cs (ChangeType): Move common initialization to
7145 static global variables.
7149 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
7150 every value type to go through, even if it was void. Fix that.
7152 * cs-tokenizer.cs: Use is_identifier_start_character on the start
7153 character of the define, and the is_identifier_part_character for
7154 the rest of the string.
7156 2003-11-05 Miguel de Icaza <miguel@ximian.com>
7158 * expression.cs (UnaryMutator.EmitCode): When I updated
7159 LocalVariableReference.DoResolve, I overdid it, and dropped an
7160 optimization done on local variable references.
7162 2003-11-04 Miguel de Icaza <miguel@ximian.com>
7164 * ecore.cs: Convert the return from Ldlen into an int.
7166 2003-10-20 Miguel de Icaza <miguel@ximian.com>
7168 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
7169 the accessibility, this is a special case for toplevel non-public
7170 classes (internal for instance).
7172 2003-10-20 Nick Drochak <ndrochak@gol.com>
7174 * ecore.cs: Fix typo and build. Needed another right paren.
7176 2003-10-19 Miguel de Icaza <miguel@ximian.com>
7178 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
7179 `internal' case regular and protected, but not allowing protected
7180 to be evaluated later. Bug 49840
7182 2003-10-15 Miguel de Icaza <miguel@ximian.com>
7184 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
7185 to kb.Nlast, and not the kb.nFirst to isolate the switch
7188 Extract the underlying type, so enumerations of long/ulong are
7189 treated like long/ulong.
7191 2003-10-14 Miguel de Icaza <miguel@ximian.com>
7193 * expression.cs (New): Overload the meaning of RequestedType to
7194 track the possible creation of the NewDelegate type, since
7195 DoResolve is invoked more than once for new constructors on field
7198 See bugs: #48800 and #37014
7200 * cs-parser.jay (declare_local_constants): Take an arraylist
7201 instead of a single constant.
7203 (local_constant_declaration): It should take a
7204 constant_declarators, not a constant_declarator. Fixes 49487
7206 * convert.cs: Fix error report.
7208 2003-10-13 Jackson Harper <jackson@ximian.com>
7210 * typemanager.cs (TypeToCoreType): Add float and double this fixes
7213 2003-11-03 Martin Baulig <martin@ximian.com>
7215 * expression.cs (ArrayAccess.GetStoreOpcode): Added
7216 `out bool has_type_arg'; if set, we need to pass the type to
7218 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
7219 Stelem_Any/Ldelem_Any for generic parameters.
7221 2003-11-02 Martin Baulig <martin@ximian.com>
7223 * expression.cs (Invocation.EmitCall): Use
7224 `TypeManager.IsValueType()' to check whether it's a value type.
7225 Don't set `struct_call' when calling a method on a type parameter.
7227 2003-11-02 Martin Baulig <martin@ximian.com>
7229 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
7230 and removed the TypeBuilder argument.
7232 * typemanager.cs (TypeManager.IsValueType): Return
7233 `t.IsGenericParameter || t.IsValueType'.
7235 2003-10-25 Martin Baulig <martin@ximian.com>
7237 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
7238 call ConstructedType.Resolve() on it.
7240 * generic.cs (ConstructedType.Resolve): Set `type' on success.
7242 2003-10-25 Martin Baulig <martin@ximian.com>
7244 * class.cs (TypeContainer.GetClassBases): Changed
7245 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
7246 CS8214 reporting here.
7247 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
7248 instead of a `Type' for our parent. In case of a recursive
7249 declaration (see tests/gen-23.cs for an example), our parent is a
7250 ConstructedType and it doesn't have its type set. So, first
7251 create our own TypeBuilder, then call constructed.Resolve() to get
7252 the parent's type and finally TypeBuilder.SetParent() it.
7254 * ecore.cs (TypeExpr.Name): New public virtual property.
7257 (ConstructedType): We're now a TypeExpr and not just an Expression.
7258 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
7259 arguments here; this is done later.
7260 (ConstructedType.Resolve): New public method to resolve the type
7261 arguments and bind them.
7263 2003-10-21 Martin Baulig <martin@ximian.com>
7265 * convert.cs: Use `TypeManager.IsValueType' instead of
7266 'type.IsValueType' everywhere.
7268 * typemanager.cs (TypeManager.IsValueType): Return true for type
7269 parameters. The reason for this is that we need to box a type
7270 parameter when converting it to a reference type.
7272 * cs-parser.jay: Added support for default value expressions.
7274 * generics.cs (DefaultValueExpression): New public class.
7276 2003-10-17 Martin Baulig <martin@ximian.com>
7278 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
7279 TypeContainer so we can also use this for Interfaces.
7280 (TypeParameter.Resolve): Likewise.
7282 * interface.cs (Interface.DefineType): Added support for generic
7285 * cs-parser.jay: Added support for generic structs and interfaces.
7287 2003-10-17 Martin Baulig <martin@ximian.com>
7289 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
7290 call generic methods :-)
7292 2003-10-16 Martin Baulig <martin@ximian.com>
7294 * cs-parser.jay (namespace_or_type_name): Only create a
7295 GenericMemberAccess if we actually have type arguments.
7297 2003-10-13 Martin Baulig <martin@ximian.com>
7299 * class.cs (Method.Define): If we're a generic method, call
7300 TypeBuilder.DefineGenericMethod () before resolving
7302 (MethodData): Added .ctor which takes an additional MethodBuilder
7303 argument; this is used for generic methods.
7304 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
7305 we already have a MethodBuilder.
7307 2003-10-10 Martin Baulig <martin@ximian.com>
7309 * class.cs (Method): Added .ctor which takes a `GenericMethod'
7310 instead of a `DeclSpace'. This is used for generic methods.
7312 * cs-parser.jay (method_header): Added support for generic
7313 methods; create a `GenericMethod' instance and pass it to the
7314 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
7315 parameters and locals.
7317 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
7318 since we already have the location. Check whether we're a generic
7319 type declaration or a generic method and create the correct type
7322 * generic.cs (TypeParameter.DefineMethod): New public method.
7323 (GenericMethod): New public class; derives from DeclSpace and is
7324 used for generic methods.
7326 2003-10-09 Martin Baulig <martin@ximian.com>
7328 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
7330 (MethodCore.DoDefineParameters): Removed the TypeContainer
7331 argument; use the DeclSpace which was passed to the .ctor instead.
7332 (MethodCore.CheckParameter): Take a DeclSpace instead of a
7333 TypeContainer; we only need a DeclSpace here.
7335 2003-10-09 Martin Baulig <martin@ximian.com>
7337 * class.cs (MethodData): Added additional `DeclSpace ds' argument
7339 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
7340 EmitContext's .ctor.
7342 2003-10-09 Martin Baulig <martin@ximian.com>
7344 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
7345 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
7346 AsAccessible(), moved them as well.
7348 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
7350 2003-10-07 Miguel de Icaza <miguel@ximian.com>
7352 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
7353 generation for >=, as spotted by Paolo, bug 48679.
7354 Patch from David Waite.
7356 * cs-tokenizer.cs: Add handling for #pragma.
7358 * cs-parser.jay: Allow for both yield and yield return in the
7359 syntax. The anti-cobolization of C# fight will go on!
7361 * class.cs (TypeBuilder.DefineType): Catch error condition here
7362 (Parent.DefineType erroring out and returning null).
7364 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7365 coping with enumerations variables, we were mistakenly processing
7366 them as a regular value type instead of built-in types. Fixes the
7369 * typemanager.cs (IsBuiltinOrEnum): New method.
7371 2003-09-30 Miguel de Icaza <miguel@ximian.com>
7373 * cs-parser.jay: Upgrade: yield now needs the return clause.
7375 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7377 * cs-parser.jay : Renamed yyName to yyNames related to jay.
7379 2003-09-29 Martin Baulig <martin@ximian.com>
7381 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
7382 inflated generic methods.
7384 * generics.cs (ConstructedType): Distinguish between open and
7385 closed constructed types; correctly resolve the arguments.
7387 2003-09-22 Martin Baulig <martin@ximian.com>
7389 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
7390 all type arguments meet their constraints.
7392 2003-09-19 Martin Baulig <martin@ximian.com>
7394 * decl.cs (MemberCache.SetupCacheForInterface): Take a
7395 `MemberCache parent' argument. Normally, an interface doesn't
7396 have a parent type except System.Object, but we use this in gmcs
7397 for generic type parameters.
7399 2003-09-18 Martin Baulig <martin@ximian.com>
7401 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
7402 on `type.IsInterface'; don't check whether the type has a parent
7403 to determine whether it's an interface.
7405 2003-09-17 Martin Baulig <martin@ximian.com>
7407 * generic.cs (ConstructedType.ToString): Always use `name' as the
7410 2003-09-15 Martin Baulig <martin@ximian.com>
7412 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
7414 * generic.cs (Constraints.Resolve): New public method; this is
7415 called to resolve the constraint types and to check whether all
7416 the constraints are correct.
7417 (Constraints.Types): New public property.
7418 (TypeParameter.Resolve): New public method; resolves all the
7421 * class.cs (TypeContainer.DefineType): Call
7422 TypeParameter.Resolve() before actually defining the type.
7424 2003-09-15 Martin Baulig <martin@ximian.com>
7426 * class.cs (TypeContainer.DefineType): Added an error flag to
7427 avoid reporting duplicate CS0146's ("class definition is
7430 * driver.cs (Driver.MainDriver): Abort if
7431 RootContext.ResolveTree() reported any errors.
7433 2003-09-07 Martin Baulig <martin@ximian.com>
7435 * report.cs (Error, Warning): Added overloaded versions which take
7436 a `params object[] args' and call String.Format().
7438 2003-09-07 Martin Baulig <martin@ximian.com>
7440 * decl.cs (DeclSpace..ctor): Don't call
7441 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
7442 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
7443 (DeclSpace.RecordDecl): New method.
7445 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
7447 2003-09-02 Ravi Pratap <ravi@ximian.com>
7449 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
7450 value attributes to be applied to ParameterBuilders.
7452 * class.cs (MethodCore.LabelParameters): Make static and more
7453 generic so that it can be used from other places - like interface
7454 methods, for instance.
7456 * interface.cs (Interface.Emit): Call LabelParameters before
7457 emitting attributes on the InterfaceMethod.
7459 2003-09-07 Martin Baulig <martin@ximian.com>
7461 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
7462 if the number of type parameters doesn't match.
7464 2003-09-04 Martin Baulig <martin@ximian.com>
7466 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
7467 for arrays of generic type params (ie. `!0[]').
7469 2003-09-04 Martin Baulig <martin@ximian.com>
7471 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
7474 2003-09-04 Martin Baulig <martin@ximian.com>
7476 * decl.cs (DeclSpace.LookupGeneric): New method.
7477 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
7480 * generic.cs (TypeParameterExpr): Take a TypeParameter as
7481 argument, not just a string.
7482 (TypeParameter.Define): New public method; this is called to
7483 actually define the generic parameter; after this, you can use the
7484 new `Type' property to get the type.
7486 2003-09-04 Martin Baulig <martin@ximian.com>
7488 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
7489 is now an ArrayList; initialize the result of the `TypeParameters'
7491 (DeclSpace.GetGenericData): Removed.
7492 (DeclSpace.LookupGeneric): Temporarily removed; we need to
7493 implement this in a different way.
7494 (DeclSpace.GetTypeParameters): Removed; there's now a
7495 `TypeParameters' property.
7496 (DeclSpace.TypeParameters): New public property.
7498 * generic.cs (Constraints): Make this class public.
7499 (TypeParameter): New public class.
7501 2003-09-04 Martin Baulig <martin@ximian.com>
7503 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
7506 * class.cs (TypeContainer.DefineType): Call
7507 TypeBuilder.DefineGenericParameter () on all generic parameters if
7508 this is a generic type.
7510 2003-08-28 Martin Baulig <martin@ximian.com>
7512 * sample-stack.il: Compile this with ilasm: "ilasm /dll
7515 * sample-hello.cs: Compile this with gmcs: "gmcs
7516 /r:sample-stack.dll sample-hello.cs".
7518 2003-08-28 Martin Baulig <martin@ximian.com>
7520 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
7521 the parameters to the generic type.
7523 2003-08-28 Martin Baulig <martin@ximian.com>
7525 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
7527 2003-08-28 Martin Baulig <martin@ximian.com>
7529 * cs-parser.jay (opt_type_argument_list): Use
7530 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
7531 (primary_expression): Replace `qualified_identifier' with `type_name'.
7532 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
7534 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
7535 parser to check whether it is syntactically a type parameter list;
7536 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
7539 2003-08-26 Martin Baulig <martin@ximian.com>
7541 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
7542 resolving aliases; fixes #47927.
7544 2003-08-26 Martin Baulig <martin@ximian.com>
7546 * statement.cs (Using.DoResolve): This is internally emitting a
7547 try/finally clause, so we need to set ec.NeedExplicitReturn if we
7548 do not always return. Fixes #47681.
7550 2003-08-26 Martin Baulig <martin@ximian.com>
7552 * decl.cs (MemberCore): Moved WarningNotHiding(),
7553 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
7555 (AdditionResult): Make this nested in DeclSpace.
7556 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
7557 argument; call NamespaceEntry.Define() unless we're nested in a
7560 * namespace.cs (Namespace.DefineName): New public function. This
7561 is called from DeclSpace's .ctor to add
7562 (Namespace.Lookup): Include DeclSpaces in the lookup.
7564 * class.cs (Operator): Derive from MemberBase, not MemberCore.
7566 * const.cs (Const): Derive from MemberBase, not MemberCore.
7568 2003-08-25 Martin Baulig <martin@ximian.com>
7570 * convert.cs (Convert.ExplicitReferenceConversion): When
7571 converting from an interface type to a class, unbox if the target
7572 type is a struct type. Fixes #47822.
7574 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7576 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
7579 2003-08-22 Martin Baulig <martin@ximian.com>
7581 * class.cs (TypeManager.DefineType): When defining a nested type,
7582 call DefineType() on our parent; fixes #47801.
7584 2003-08-22 Martin Baulig <martin@ximian.com>
7586 * class.cs (MethodData.Define): While checking if a method is an
7587 interface implementation, improve the test a bit more to fix #47654.
7589 2003-08-22 Martin Baulig <martin@ximian.com>
7591 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
7592 correctly; fixes #47722.
7594 2003-08-22 Martin Baulig <martin@ximian.com>
7596 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
7597 LocalVariableReference, ensure it's not read-only. Fixes #47536.
7599 * statement.cs (Fixed.DoResolve): Make all variables read-only.
7601 2003-08-22 Martin Baulig <martin@ximian.com>
7603 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
7604 can only be assigned in static constructors. Fixes #47161.
7606 2003-08-22 Martin Baulig <martin@ximian.com>
7608 Rewrote and improved the flow analysis code.
7610 * flowbranching.cs (FlowBranching): Make this class abstract.
7611 (FlowBranching.CreateBranching): New static function to create a
7613 (FlowBranchingBlock, FlowBranchingException): New classes.
7614 (FlowBranching.UsageVector.Type): New public readonly field.
7615 (FlowBranching.UsageVector.Breaks): Removed the setter.
7616 (FlowBranching.UsageVector.Returns): Removed the setter.
7617 (FlowBranching.UsageVector): Added Break(), Return(),
7618 NeverReachable() and Throw() methods to modify the reachability.
7619 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
7620 done by FlowBranching.Merge().
7621 (FlowBranching.UsageVector.MergeChild): New method; merges the
7622 merge result into the current vector.
7623 (FlowBranching.Merge): New abstract method to merge a branching.
7625 2003-08-12 Martin Baulig <martin@ximian.com>
7627 * expression.cs (Indirection.CacheTemporaries): Create the
7628 LocalTemporary with the pointer type, not its element type.
7630 2003-08-10 Miguel de Icaza <miguel@ximian.com>
7632 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
7633 token was a keyword or not.
7635 Add `error' options where an IDENTIFIER was expected; Provide
7636 CheckToken and CheckIdentifierToken convenience error reporting
7639 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
7641 * decl.cs: Rename `NamespaceEntry Namespace' public field into
7642 NameSpaceEntry NameSpaceEntry.
7644 (LookupInterfaceOrClass): Avoid creating a full qualified name
7645 from namespace and name: avoid doing lookups when we know the
7646 namespace is non-existant. Use new Tree.LookupByNamespace which
7647 looks up DeclSpaces based on their namespace, name pair.
7649 * driver.cs: Provide a new `parser verbose' to display the
7650 exception thrown during parsing. This is turned off by default
7651 now, so the output of a failure from mcs is more graceful.
7653 * namespace.cs: Track all the namespaces defined in a hashtable
7656 (IsNamespace): New method
7658 2003-08-09 Miguel de Icaza <miguel@ximian.com>
7660 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
7661 we know that we need to concatenate (full typename can never be
7666 * statement.cs: Use a bitfield; Do not initialize to null things
7667 which are done by the constructor by default.
7669 * cs-parser.jay: bug fix, parameter was 4, not 3.
7671 * expression.cs: Just use the property;
7673 * statement.cs: No need for GetVariableInfo method.
7675 2003-08-08 Martin Baulig <martin@ximian.com>
7677 * flowanalysis.cs (FlowReturns): This is now nested in the
7678 `FlowBranching' class.
7679 (MyBitVector): Moved this here from statement.cs.
7680 (FlowBranching.SiblingType): New enum type.
7681 (FlowBranching.CreateSibling): Added `SiblingType' argument.
7683 2003-08-07 Martin Baulig <martin@ximian.com>
7685 * flowanalysis.cs (FlowBranchingType): This is now nested in the
7686 `FlowBranching' class and called `BranchingType'.
7688 2003-08-07 Martin Baulig <martin@ximian.com>
7690 * flowanalysis.cs: Moved all the control flow analysis code into
7693 2003-08-07 Martin Baulig <martin@ximian.com>
7695 * assign.cs (Assign.DoResolve): `target' must either be an
7696 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
7699 2003-08-07 Miguel de Icaza <miguel@ximian.com>
7701 * expression.cs (BinaryMethod): This kind of expression is created by the
7702 Binary class if it determines that the operator has to be handled
7705 (BinaryDelegate): This kind of expression is created if we are
7706 dealing with a + or - operator on delegates.
7708 (Binary): remove method, argumetns, and DelegateOperator: when
7709 dealing with methods,
7711 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
7713 * statement.cs (Block): use bitfields for the three extra booleans
7714 we had in use. Remove unused topblock parameter.
7716 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
7718 * assign.cs: Drop extra unneeded tests.
7720 2003-08-06 Miguel de Icaza <miguel@ximian.com>
7722 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
7724 * statement.cs (Foreach): Use VariableStorage instead of
7727 * codegen.cs (VariableStorage): New class used by clients that
7728 require a variable stored: locals or fields for variables that
7729 need to live across yield.
7731 Maybe provide a convenience api for EmitThis+EmitLoad?
7733 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
7736 2003-08-05 Miguel de Icaza <miguel@ximian.com>
7738 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
7739 RemapParameterLValue): New methods that are used to turn a
7740 precomputed FieldInfo into an expression like this:
7744 The idea is to use this instead of making LocalVariableReference
7745 have more than one meaning.
7747 * cs-parser.jay: Add error production to BASE.
7749 * ecore.cs: Deal with TypeManager.GetField returning null, which
7750 is now a valid return value.
7752 (FieldExprNoAddress): New expression for Fields whose address can
7755 * expression.cs (LocalVariableReference): During the resolve
7756 phases, create new expressions if we are in a remapping context.
7757 Remove code that dealt with remapping here.
7759 (ParameterReference): same.
7761 (ProxyInstance): New expression, like the `This' expression, but
7762 it is born fully resolved. We know what we are doing, so remove
7763 the errors that are targeted to user-provided uses of `this'.
7765 * statement.cs (Foreach): our variable is now stored as an
7766 Expression; During resolution, follow the protocol, dont just
7767 assume it will return this.
7769 2003-08-06 Martin Baulig <martin@ximian.com>
7771 * support.cs (SeekableStreamReader.cs): New public class.
7773 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
7774 SeekableStreamReader instead of the normal StreamReader.
7776 2003-08-04 Martin Baulig <martin@ximian.com>
7778 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
7779 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
7780 deambiguate casts and delegate invocations.
7781 (parenthesized_expression): Use the new tokens to ensure this is
7782 not a cast of method invocation.
7784 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
7785 when reading a `)' and Deambiguate_CloseParens () was previously
7788 * expression.cs (ParenthesizedExpression): New class. This is
7789 just used for the CS0075 test.
7790 (Binary.DoResolve): Check for CS0075.
7792 2003-07-29 Ravi Pratap <ravi@ximian.com>
7794 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
7795 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
7796 reference comparison.
7798 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
7799 examine the ReturnType for equality - this is necessary in the
7800 cases of implicit and explicit operators whose signature also
7801 includes the return type.
7803 2003-07-26 Miguel de Icaza <miguel@ximian.com>
7805 * namespace.cs: Cache the result of the namespace computation,
7806 instead of computing it every time.
7808 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7810 * decl.cs: Use a global arraylist that we reuse over invocations
7811 to avoid excesive memory consumption. Reduces memory usage on an
7812 mcs compile by one meg (45 average).
7814 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7815 private, work around that.
7817 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7819 * literal.cs (IntLiteral): Define Zero and One static literals.
7821 * cs-parser.jay (integer_literal): use static literals to reduce
7822 memory usage for the most used literals (0, 1 and -1). 211kb
7823 reduced in memory usage.
7825 Replace all calls to `new ArrayList' with `new
7826 ArrayList(4)' which is a good average number for most allocations,
7827 and also requires only 16 bytes of memory for its buffer by
7830 This reduced MCS memory usage in seven megabytes for the RSS after
7833 2003-07-28 Ravi Pratap <ravi@ximian.com>
7835 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7836 handle params methods the correct way by forming only one
7837 applicable set with params and normal methods in them. Earlier we
7838 were looking at params methods only if we found no normal methods
7839 which was not the correct thing to do.
7841 (Invocation.BetterFunction): Take separate arguments indicating
7842 when candidate and the best method are params methods in their
7845 This fixes bugs #43367 and #46199.
7847 * attribute.cs: Documentation updates.
7849 (CheckAttribute): Rename to CheckAttributeTarget.
7850 (GetValidPlaces): Rename to GetValidTargets.
7852 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7853 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7857 2003-07-28 Miguel de Icaza <miguel@ximian.com>
7859 * codegen.cs: Compute IsGeneric correctly.
7861 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
7864 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
7865 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
7866 regressions, and I was chasing more bugs than I required.
7868 * interface.cs: Use expressions for base type names (like classes
7869 and structs have been doing for a while now), and resolve that.
7870 This patch should probably go into head as well.
7872 This makes it one less user of FindType.
7874 2003-07-24 Miguel de Icaza <miguel@ximian.com>
7876 This compiler can not self host currently. Need to fix that.
7878 * Makefile: compile to `gmcs.exe'
7880 * driver.cs: Turn on v2 by default on gmcs.
7882 * generic.cs (ConstructedType): Does no longer take a container
7883 type argument; That will be taken care of later.
7885 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
7886 Use SimpleName to resolve for now, so we can continue the work on
7887 the parser, until we get Type.GetType that understands generics.
7889 (ConstructedType.ToString): Implement
7891 (TypeArguments.Resolve): Resolve the child expressions as types.
7893 * cs-parser.jay: Rename interface_constraints to
7894 type_parameter_constraints
7896 (namespace_or_type_name): Only use constructed types for the basic
7897 construction, we will deal with identifier<...> later.
7899 (type/type_name): No longer call DecomposeQI, as
7900 namespace_or_type_name is always decoded now.
7902 2003-07-22 Ravi Pratap <ravi@ximian.com>
7904 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7905 closely: we eliminate methods in base types when we have an
7906 applicable method in a top-level type.
7908 Please see section 14.5.5.1 for an exact description of what goes
7911 This fixes bug #45127 and a host of other related to corlib compilation.
7913 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7914 array is the method corresponding to the top-level type (this is
7915 because of the changes made to icall.c) so we change this
7918 (MethodGroupExpr.Name): This too.
7920 * typemanager.cs (GetElementType): New method which does the right
7921 thing when compiling corlib.
7923 * everywhere: Make use of the above in the relevant places.
7925 2003-07-22 Martin Baulig <martin@ximian.com>
7927 * cs-parser.jay (invocation_expression): Moved
7928 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7929 `cast_expression', but create a InvocationOrCast which later
7930 resolves to either an Invocation or a Cast.
7932 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7933 method; call this before EmitStatement() to make sure that this
7934 expression can be used as a statement.
7936 * expression.cs (InvocationOrCast): New class; resolves to either
7937 an Invocation or a Cast.
7939 * statement.cs (StatementExpression): Call ResolveStatement() on
7940 the ExpressionStatement before emitting it.
7942 2003-07-21 Martin Baulig <martin@ximian.com>
7944 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7945 `ref' and `out' attributes match; fixes #46220.
7946 (MemberAccess.ResolveMemberAccess): You can't reference a type
7947 through an expression; fixes #33180.
7948 (Indexers.GetIndexersForType): Don't return the indexers from
7949 interfaces the class implements; fixes #46502.
7951 2003-07-21 Martin Baulig <martin@ximian.com>
7953 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7954 CS0661 checks; fixes bug #30442.
7956 2003-07-21 Martin Baulig <martin@ximian.com>
7958 * decl.cs (AdditionResult): Added `Error'.
7960 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7962 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
7963 cs0031.cs actually work.
7965 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7967 * cs-parser.jay (namespace_name): do not use
7968 namespace_or_type_name, use qualified_identifier, because
7969 namespace_or_type_name will soon return a composed expression
7970 instead of a string.
7972 (namespace_or_type_name): Instead of returning a string, now this
7973 production returns an expression.
7975 * codegen.cs (EmitContext): Setup IsGeneric property based on
7976 whether our DeclSpace is generic, our the method is generic.
7978 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
7979 the method is generic.
7981 * cs-parser.jay (type_arguments, opt_type_argument_list,
7982 type_parameters, type_parameter_list, opt_type_parameter_list,
7983 type_parameter,, opt_type_parameter_constraints_clauses,
7984 type_parameter_constraints_clauses,
7985 type_parameter_constraint_clause, type_parameter_constraint,
7986 interface_constraints): Add new production
7988 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
7989 DeclSpace is generic or not.
7991 (DeclSpace.SetParameterInfo): New routine, used to set the
7992 parameter info for a type.
7994 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
7995 returns a GenericTypeExpr
7997 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
7998 generic, lookup the generic argument.
8000 * attribute.cs: Do not allow TypeParameterExpressions in
8003 * class.cs: Do not allow the Main method to be defined in a
8006 * expression.cs (SizeOf): Do not allow generic types to be used as
8007 arguments to sizeof.
8009 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
8010 it: whether a type is generic or not. Only works for types we are
8011 currently building for now.
8013 2003-07-20 Martin Baulig <martin@ximian.com>
8015 * namespace.cs: Fixed that bug which caused a crash when compiling
8018 2003-07-20 Miguel de Icaza <miguel@ximian.com>
8020 * typemanager.cs (LookupTypeReflection): Never expose types which
8021 are NotPublic, NestedPrivate, NestedAssembly, or
8022 NestedFamANDAssem. We used to return these, and later do a check
8023 that would report a meaningful error, but the problem is that we
8024 would not get the real match, if there was a name override.
8026 2003-07-18 Miguel de Icaza <miguel@ximian.com>
8028 * namespace.cs (Namespace, Name): Do not compute the namespace
8029 name dynamically, compute it in the constructor. This reduced
8030 memory usage by 1697 KB.
8032 * driver.cs: Use --pause to pause at the end.
8034 2003-07-17 Peter Williams <peter@newton.cx>
8036 * Makefile: Change the name of the test target so that it doesn't
8037 conflict with the recursive test target.
8039 2003-07-17 Miguel de Icaza <miguel@ximian.com>
8041 * expression.cs (LocalVariableReference.Emit, EmitAssign,
8042 AddressOf): Do not use EmitThis, that was wrong, use the actual
8045 2003-07-15 Miguel de Icaza <miguel@ximian.com>
8047 * class.cs (MethodData.Define): While checking if a method is an
8048 interface implementation, improve the test: If we are not public
8049 (use new test here: use the computed MethodAttributes directly,
8050 instead of the parsed modifier flags) check if the `implementing'
8051 method comes from an interface or not.
8053 * pending.cs (VerifyPendingMethods): Slightly better error
8056 * makefile: add test target that does the mcs bootstrap.
8058 2003-07-16 Ravi Pratap <ravi@ximian.com>
8060 * interface.cs (Define): Do nothing here since there are no
8061 members to populate etc. Move the attribute emission out of here
8062 since this was just totally the wrong place to put it. Attribute
8063 application happens during the 'Emit' phase, not in the 'Define'
8066 (Emit): Add this method and move the attribute emission here
8068 * rootcontext.cs (EmitCode): Call the Emit method on interface
8071 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8073 * expression.cs (OverloadResolve): Report error only if Location
8074 is not 'Null' which means that there was a probe going on.
8076 2003-07-14 Martin Baulig <martin@ximian.com>
8078 * expression.cs (ConditionalLogicalOperator): New public class to
8079 implement user defined conditional logical operators.
8080 This is section 14.11.2 in the spec and bug #40505.
8082 2003-07-14 Martin Baulig <martin@ximian.com>
8084 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
8086 2003-07-14 Martin Baulig <martin@ximian.com>
8088 * codegen.cs (EmitContext.InFixedInitializer): New public field.
8090 * ecore.cs (IVariable.VerifyFixed): New interface method.
8092 * expression.cs (Unary.ResolveOperator): When resolving the `&'
8093 operator, check whether the variable is actually fixed. Fixes bug
8094 #36055. Set a variable definitely assigned when taking its
8095 address as required by the spec.
8097 * statement.cs (LocalInfo.IsFixed): New field.
8098 (LocalInfo.MakePinned): Set `IsFixed' to true.
8100 2003-07-14 Ravi Pratap M <ravi@ximian.com>
8102 * attribute.cs (Attribute.Resolve): While doing a Member lookup
8103 for .ctors, ensure that we only ask for members declared in the
8104 attribute type (BindingFlags.DeclaredOnly).
8108 * expression.cs (Error_WrongNumArguments): Report error 1501
8109 correctly the way CSC does.
8111 2003-07-13 Martin Baulig <martin@ximian.com>
8113 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
8114 lookup on the fully qualified name, to make things like "X.X" work
8115 where "X.X" is a fully qualified type name, but we also have a
8116 namespace "X" in the using list. Fixes #41975.
8118 2003-07-13 Martin Baulig <martin@ximian.com>
8120 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
8121 function. If we're a CompoundAssign, we need to create an embedded
8122 CompoundAssign, not an embedded Assign.
8123 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
8126 2003-07-13 Martin Baulig <martin@ximian.com>
8128 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
8129 work to fix bug #46088.
8131 2003-07-13 Ravi Pratap <ravi@ximian.com>
8133 * class.cs (Operator.Emit): Do not emit attributes here - it is
8134 taken care of by the Method class that we delegate too. This takes
8137 2003-07-10 Martin Baulig <martin@ximian.com>
8139 * expression.cs (TypeOfVoid): New class.
8140 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
8142 2003-07-10 Martin Baulig <martin@ximian.com>
8144 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
8147 2003-07-10 Martin Baulig <martin@ximian.com>
8149 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
8150 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
8152 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
8154 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
8156 2003-07-10 Martin Baulig <martin@ximian.com>
8158 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
8159 of decimal. Fixes #42850.
8161 NOTE: I also fixed the created byte blob, but this doesn't work on
8162 the MS runtime and csc never produces any byte blobs for decimal
8165 2003-07-10 Martin Baulig <martin@ximian.com>
8167 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
8168 structs; fixes #32068.
8169 (Block.AddChildVariableNames): Fixed #44302.
8171 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8173 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
8175 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8177 * attribute.cs: And this test is onger needed.
8179 2003-07-08 Martin Baulig <martin@ximian.com>
8181 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
8182 inaccessible types. Fixes #36313.
8184 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
8186 * namespace.cs (NamespaceEntry): Create implicit entries for all
8187 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
8188 implicit entries for N1.N2 and N1.
8190 2003-07-08 Martin Baulig <martin@ximian.com>
8192 Rewrote the handling of namespaces to fix a lot of the issues
8193 wrt. `using' aliases etc.
8195 * namespace.cs (Namespace): Splitted this class into a
8196 per-assembly `Namespace' and a per-file `NamespaceEntry'.
8198 * typemanager.cs (TypeManager.IsNamespace): Removed.
8199 (TypeManager.ComputeNamespaces): Only compute namespaces from
8200 loaded assemblies here, not the namespaces from the assembly we're
8201 currently compiling.
8203 2003-07-08 Martin Baulig <martin@ximian.com>
8205 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
8207 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8209 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
8212 I thought about the memory savings here, but LookupTypeReflection
8213 is used under already very constrained scenarios. Compiling
8214 corlib or mcs only exposes one hit, so it would not really reduce
8215 any memory consumption.
8217 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8219 * typemanager.cs: fixes bug #45889 by only adding public types from
8220 other assemblies to the list of known types.
8222 2003-07-07 Miguel de Icaza <miguel@ximian.com>
8224 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
8225 on the type we resolved.
8227 2003-07-05 Martin Baulig <martin@ximian.com>
8229 * pending.cs (PendingImplementation.ParentImplements): Don't
8230 create the proxy if the parent is abstract.
8232 * class.cs (TypeContainer.DefineIndexers): Process explicit
8233 interface implementations first. Fixes #37714.
8235 2003-07-04 Miguel de Icaza <miguel@ximian.com>
8237 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
8238 defined recursively; but since we modify the input parameters
8239 (left is set to `this' temporarily), we reset this value if the
8240 left_is_explicit is false, which gives the original semantics to
8243 * literal.cs (NullPointer): new class used to represent a null
8244 literal in a pointer context.
8246 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
8247 type is a pointer, use a NullPointer object instead of a
8248 NullLiteral. Closes 43687
8250 (ExplicitConversion): Convert pointer values using
8251 the conv opcode to the proper type.
8253 * ecore.cs (New): change ValueTypeVariable property into a method,
8254 that returns whether the valuetype is suitable for being used.
8256 * expression.cs (Binary.DoNumericPromotions): Only return if we
8257 the int constant was a valid uint, and we can return both left and
8258 right as uints. If not, we continue processing, to trigger the
8259 type conversion. This fixes 39018.
8261 * statement.cs (Block.EmitMeta): During constant resolution, set
8262 the CurrentBlock property on the emitcontext, so that we resolve
8263 constants propertly.
8265 2003-07-02 Martin Baulig <martin@ximian.com>
8267 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
8268 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
8270 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
8271 than emitting it here.
8273 * statement.cs: Fixed some more flow analysis bugs.
8275 2003-07-02 Martin Baulig <martin@ximian.com>
8277 * class.cs (MethodData.Define): When implementing interface
8278 methods, set Final unless we're Virtual.
8280 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
8281 check work for interface methods.
8283 2003-07-01 Martin Baulig <martin@ximian.com>
8285 * ecore.cs (EmitContext.This): Replaced this property with a
8286 GetThis() method which takes a Location argument. This ensures
8287 that we get the correct error location for a CS0188.
8289 2003-07-01 Miguel de Icaza <miguel@ximian.com>
8291 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
8292 ImplicitStandardConversion.
8294 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
8296 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
8298 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
8301 2003-06-30 Miguel de Icaza <miguel@ximian.com>
8303 * class.cs (Constructor.Define): Turn off initlocals for unsafe
8306 (MethodData.Define): Turn off initlocals for unsafe methods.
8308 2003-06-29 Miguel de Icaza <miguel@ximian.com>
8310 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
8311 complete; Fixes #37521.
8313 * delegate.cs: Use Modifiers.TypeAttr to compute the
8314 TypeAttributes, instead of rolling our own. This makes the flags
8315 correct for the delegates.
8317 2003-06-28 Miguel de Icaza <miguel@ximian.com>
8319 * class.cs (Constructor.Define): Set the private flag for static
8320 constructors as well.
8322 * cs-parser.jay (statement_expression): Set the return value to
8323 null, to avoid a crash when we catch an error.
8325 2003-06-24 Miguel de Icaza <miguel@ximian.com>
8327 * cs-parser.jay: Applied patch from Jackson that adds support for
8328 extern and unsafe modifiers to destructor declarations.
8330 * expression.cs: Report error 21 if the user is trying to index a
8333 * driver.cs: Add an error message, suggested by the bug report.
8335 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
8336 if we do not have a ": this ()" constructor initializer. Fixes 45149
8338 2003-06-14 Miguel de Icaza <miguel@ximian.com>
8340 * namespace.cs: Add some information to reduce FAQs.
8342 2003-06-13 Miguel de Icaza <miguel@ximian.com>
8344 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
8345 underlying enumeration types. Fixes #43915.
8347 * expression.cs: Treat ushort/short as legal values to be used in
8350 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
8352 * delegate.cs: transfer custom attributes for paramenters from
8353 the delegate declaration to Invoke and BeginInvoke.
8355 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
8357 * attribute.cs: handle custom marshalers and emit marshal info
8360 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
8362 * makefile.gnu: Added anonymous.cs to the compiler sources.
8364 2003-05-28 Miguel de Icaza <miguel@ximian.com>
8366 * iterators.cs: Change the name of the proxy class to include two
8369 * cs-parser.jay: Update grammar to include anonymous methods.
8371 * anonymous.cs: new file.
8373 2003-05-27 Miguel de Icaza <miguel@ximian.com>
8375 * class.cs (Field.Define): Add missing test for pointers and
8378 2003-05-27 Ravi Pratap <ravi@ximian.com>
8380 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
8381 we use the stobj opcode.
8383 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
8384 since it wasn't the correct fix.
8386 It still is puzzling that we are required to use stobj for IntPtr
8387 which seems to be a ValueType.
8389 2003-05-26 Miguel de Icaza <miguel@ximian.com>
8391 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
8392 during regular simple name resolution. Now, the trick is that
8393 instead of returning for processing the simplename, we do a
8394 TypeManager.LookupType (ie, a rooted lookup as opposed to a
8395 contextual lookup type). If a match is found, return that, if
8396 not, return for further composition.
8398 This fixes long-standing 30485.
8400 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
8401 using the address to initialize an object, do an Stobj instead of
8402 using the regular Stelem.
8404 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
8405 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
8406 Because if we are a BaseIndexerAccess that value will be true.
8409 * statement.cs (GotoCase.Resolve): Return after reporting an
8410 error, do not attempt to continue.
8412 * expression.cs (PointerArithmetic.Emit): If our operand is a
8413 long, convert our constants to match the operand before
8414 multiplying. Convert to I type before adding. Fixes 43670.
8416 2003-05-14 Ravi Pratap <ravi@ximian.com>
8418 * enum.cs (ImplicitConversionExists) : Rename to
8419 ImplicitEnumConversionExists to remove ambiguity.
8421 * ecore.cs (NullCast): New type of cast expression class which
8422 basically is very similar to EmptyCast with the difference being
8423 it still is a constant since it is used only to cast a null to
8427 * convert.cs (ImplicitReferenceConversion): When casting a null
8428 literal, we return a NullCast.
8430 * literal.cs (NullLiteralTyped): Remove - I don't see why this
8431 should be around anymore.
8433 The renaming (reported was slightly wrong). Corrections:
8435 ConvertImplicitStandard -> ImplicitConversionStandard
8436 ConvertExplicitStandard -> ExplicitConversionStandard
8438 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
8439 before passing them in !
8441 * convert.cs (ImplicitConversionStandard): When comparing for
8442 equal expr and target types, ensure that expr is not a
8445 In general, we must not be checking (expr_type ==
8446 target_type) in the top level conversion methods
8447 (ImplicitConversion, ExplicitConversion etc). This checking is
8448 done in the methods that they delegate to.
8450 2003-05-20 Miguel de Icaza <miguel@ximian.com>
8452 * convert.cs: Move Error_CannotConvertType,
8453 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
8454 ImplicitNumericConversion, ImplicitConversionExists,
8455 ImplicitUserConversionExists, StandardConversionExists,
8456 FindMostEncompassedType, FindMostSpecificSource,
8457 FindMostSpecificTarget, ImplicitUserConversion,
8458 ExplicitUserConversion, GetConversionOperators,
8459 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
8460 TryImplicitIntConversion, Error_CannotConvertImplicit,
8461 ConvertImplicitRequired, ConvertNumericExplicit,
8462 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
8463 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
8466 Perform the following renames:
8468 StandardConversionExists -> ImplicitStandardConversionExists
8469 ConvertImplicit -> ImplicitConversion
8470 ConvertImplicitStandard -> ImplicitStandardConversion
8471 TryImplicitIntConversion -> ImplicitIntConversion
8472 ConvertImplicitRequired -> ImplicitConversionRequired
8473 ConvertNumericExplicit -> ExplicitNumericConversion
8474 ConvertReferenceExplicit -> ExplicitReferenceConversion
8475 ConvertExplicit -> ExplicitConversion
8476 ConvertExplicitStandard -> ExplicitStandardConversion
8478 2003-05-19 Martin Baulig <martin@ximian.com>
8480 * statement.cs (TypeInfo.StructInfo): Made this type protected.
8481 (TypeInfo): Added support for structs having structs as fields.
8483 * ecore.cs (FieldExpr): Implement IVariable.
8484 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
8485 VariableInfo for the field.
8487 2003-05-18 Martin Baulig <martin@ximian.com>
8489 * expression.cs (This.DoResolve): Report a CS0027 if we're
8490 emitting a field initializer.
8492 2003-05-18 Martin Baulig <martin@ximian.com>
8494 * expression.cs (This.ResolveBase): New public function.
8495 (This.DoResolve): Check for CS0188.
8497 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
8500 * ecore.cs (MethodGroupExpr.DoResolve): Set the
8501 `instance_expression' to null if we don't have any non-static
8504 2003-05-18 Martin Baulig <martin@ximian.com>
8506 Reworked the way how local variables and parameters are handled by
8507 the flow analysis code.
8509 * statement.cs (TypeInfo, VariableMap): New public classes.
8510 (VariableInfo): New public class. This is now responsible for
8511 checking whether a variable has been assigned. It is used for
8512 parameters and local variables.
8513 (Block.EmitMeta): Take the InternalParameters as argument; compute
8514 the layout of the flow vectors here.
8515 (Block.LocalMap, Block.ParameterMap): New public properties.
8516 (FlowBranching): The .ctor doesn't get the InternalParameters
8517 anymore since Block.EmitMeta() now computes the layout of the flow
8519 (MyStructInfo): This class is now known as `StructInfo' and nested
8520 in `TypeInfo'; we don't access this directly anymore.
8522 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
8523 property and removed IsAssigned(), IsFieldAssigned(),
8524 SetAssigned() and SetFieldAssigned(); we now call them on the
8525 VariableInfo so we don't need to duplicate this code everywhere.
8527 * expression.cs (ParameterReference): Added `Block block' argument
8529 (LocalVariableReference, ParameterReference, This): The new
8530 VariableInfo class is now responsible for all the definite
8533 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
8534 IsParameterAssigned, SetParameterAssigned): Removed.
8536 2003-05-18 Martin Baulig <martin@ximian.com>
8538 * typemanager.cs (InitCoreTypes): Try calling
8539 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
8540 the 3-args-version. Corlib now also needs our `void_type'.
8541 (GetMethod): Added overloaded version which takes an optional
8542 `bool report_errors' to allow lookups of optional methods.
8544 2003-05-12 Martin Baulig <martin@ximian.com>
8546 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
8547 only used for locals and not for parameters.
8549 2003-05-12 Miguel de Icaza <miguel@ximian.com>
8551 * support.cs (InternalParameters.ParameterType): Return the
8552 ExternalType of the parameter.
8554 * parameter.cs (Parameter.ExternalType): drop the two arguments,
8557 2003-05-11 Miguel de Icaza <miguel@ximian.com>
8559 * class.cs (MethodData.Define): Do not set the `newslot' on
8560 interface members, if they are also flagged as "override".
8562 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
8563 better code for ++i and i++. This only works for static fields
8564 and local variables.
8566 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
8567 want to pull the DeclSpace out of the builder_to_declspace instead
8568 of the TypeBuilder (like in TypeContainer.FindMembers).
8570 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
8571 instead of LookupTypeContainer. Fixes the crash on .NET for
8572 looking up interface members.
8574 * const.cs: Create our own emit context during the Definition
8575 stage, so that constants are evaluated in the proper context, when
8576 a recursive definition happens.
8578 2003-05-11 Martin Baulig <martin@ximian.com>
8580 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
8581 new block for a switch section.
8582 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
8583 the adding/lookup in the switch block. Fixes #39828.
8585 2003-05-09 Miguel de Icaza <miguel@ximian.com>
8587 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
8588 functionality: I needed to convert the data after I had performed
8589 the add/sub operation into the operands type size.
8591 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
8592 pass the type for the box operation, otherwise the resulting
8593 object would have been of type object.
8595 (BoxedCast): Add constructor to specify the type to box as.
8597 2003-05-07 Miguel de Icaza <miguel@ximian.com>
8599 * iterators.cs: I was reusing the `count' variable inadvertently,
8600 take steps to not allow this to happen.
8602 2003-05-06 Miguel de Icaza <miguel@ximian.com>
8604 * attribute.cs (Attribute.Resolve): Params attributes are encoded
8605 by creating an array at the point where the params starts and
8606 putting all those arguments there, then adjusting the size of the
8609 2003-05-05 Miguel de Icaza <miguel@ximian.com>
8611 * expression.cs (New.AddressOf): Implement interface
8612 IMemoryLocation. This is used when the `new' operator is used in
8613 the context of an invocation to a method on a value type.
8615 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
8618 * namespace.cs: Also check the using aliases here.
8620 * driver.cs: Move the test for using validity after the types have
8621 been entered, so we do a single pass that also includes the using
8624 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
8625 in the regular case. CreateSiblingForFinally is doing extra
8628 * attribute.cs (GetAttributeArgumentExpression): Store the result
8629 on an out value, and use the return value to indicate failure
8630 instead of using null (which is a valid return for Constant.GetValue).
8632 * statement.cs: Perform the analysis flow for the increment
8633 portion after the statement, because this will be the real flow of
8634 execution. Fixes #42385
8636 * codegen.cs (EmitContext.EmitArgument,
8637 EmitContext.EmitStoreArgument): New helper functions when the
8638 RemapToProxy flag is set.
8640 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
8643 Add support for remapping parameters.
8645 * iterators.cs: Propagate parameter values; Store parameter
8646 values in the proxy classes.
8648 2003-05-04 Miguel de Icaza <miguel@ximian.com>
8650 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
8651 need a proxy reference; I do not know what I was thinking
8653 * cs-parser.jay (constructor_initializer): catch another error,
8654 and display nice message.
8656 (field_declaration): catch void field declaration
8657 to flag a better error.
8659 * class.cs (MemberBase.CheckBase): Report an error instead of a
8660 warning if a new protected member is declared in a struct.
8661 (Field.Define): catch the error of readonly/volatile.
8663 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
8665 (FieldExpr.AddressOf): ditto. Catch error where the address of a
8666 volatile variable is taken
8668 2003-05-02 Miguel de Icaza <miguel@ximian.com>
8670 * statement.cs (Fixed.Resolve): Report an error if we are not in
8673 2003-05-01 Miguel de Icaza <miguel@ximian.com>
8675 * typemanager.cs: reuse the code that handles type clashes for
8676 delegates and enumerations.
8678 * class.cs (Report28): Always report.
8680 * expression.cs (EncodeAsAttribute): Allow nulls here.
8682 2003-04-28 Miguel de Icaza <miguel@ximian.com>
8684 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
8685 the functionality for testing whether an expression is valid for
8686 an attribute here. Also handle the case of arrays of elements
8689 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
8690 encoding a linear array into an array of objects that are suitable
8691 to be passed to an CustomAttributeBuilder.
8693 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
8695 * ecore.cs: (FieldExpr): Handle field remapping here.
8697 * iteratators.cs: Pass the instance variable (if the method is an
8698 instance method) to the constructors, so we can access the field
8699 variables on the class.
8701 TODO: Test this with structs. I think the THIS variable on
8702 structs might have to be a pointer, and not a refenrece
8704 2003-04-27 Miguel de Icaza <miguel@ximian.com>
8706 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
8707 local variables to fields in a proxy class.
8709 * iterators.cs (PopulateProxy): Rename our internal fields to
8711 Create a <THIS> field if we are an instance method, so we can
8712 reference our parent container variables.
8713 (MapVariable): Called back from the EmitContext code to enter a
8714 new variable to field mapping into the proxy class (we just create
8718 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
8719 for using the remapped locals to fields.
8721 I placed the code here, because that gives the same semantics to
8722 local variables, and only changes the Emit code.
8724 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
8725 statements inside iterators.
8726 (VariableInfo): Add a FieldBuilder for the cases when we are
8727 remapping local variables to fields in a proxy class
8729 * ecore.cs (SimpleNameResolve): Avoid testing two times for
8730 current_block != null.
8732 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
8733 not cope with strings, as it has been moved to the
8734 TableSwitchEmit. Fixed bug in switch generation.
8736 * expression.cs (New.DoResolve): Provide more context for the user
8737 when reporting an error.
8739 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
8742 * expression.cs (MemberAccess.DoResolve): When we get a type back,
8743 check the permissions for it. Note than in a type-resolution
8744 context the check was already present in DeclSpace.ResolveType,
8745 but was missing from the MemberAccess.
8747 (ArrayCreation.CheckIndices): warn if the user has
8748 more nested levels of expressions, but there are no more
8749 dimensions specified. Avoids crash on bug 41906.
8751 2003-04-26 Miguel de Icaza <miguel@ximian.com>
8753 * statement.cs (Block): replace Implicit bool, for a generic
8755 New flag: `Unchecked'. This is used during the EmitMeta phase
8756 (which is out-of-line with the regular Resolve/Emit process for a
8757 statement, as this is done ahead of time, but still gets a chance
8758 to call constant resolve).
8760 (Block.Flags): new enum for adding a new flag.
8762 (Block.EmitMeta): track the state of unchecked.
8764 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
8765 to enable constant resolution to work there as well.
8767 2003-04-22 Miguel de Icaza <miguel@ximian.com>
8769 * typemanager.cs (ienumerable_type): Also look up
8770 System.Collections.IEnumerable.
8772 2003-04-21 Miguel de Icaza <miguel@ximian.com>
8774 TODO: Test more than one conditional per method.
8776 * class.cs (Indexer.Define): Report the location where the user is
8777 referencing the unsupported feature.
8779 (MethodData): Overload the use of `conditionals' to
8780 minimize the creation of needless ArrayLists. This saves roughly
8781 212kb on my machine.
8783 (Method): Implement the new IIteratorContainer interface.
8784 (Method.SetYields): Implement the method by setting the ModFlags
8785 to contain METHOD_YIELDS.
8787 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
8788 which just got set to null.
8790 * iterators.cs: New file.
8792 (Yield, YieldBreak): New statements.
8794 * statement.cs (Return.Resolve): Flag an error if we are used in
8797 * codegen.cs (InIterator): New flag set if the code is being
8798 compiled in an iterator method.
8800 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
8801 internal modifier, and we just use it to avoid adding extra
8802 fields, as this is seldom used.
8804 * cs-parser.jay: Add yield_statement (yield and yield break).
8806 * driver.cs: New flag -v2 to turn on version 2 features.
8808 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
8809 hashtable when v2 is enabled.
8811 2003-04-20 Miguel de Icaza <miguel@ximian.com>
8813 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
8814 there is already a namespace defined with this name.
8816 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
8817 people upgraded their corlibs.
8819 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
8820 always use fully qualified types, no need to use the compiler
8823 (TypeManager.IsNamespace): Use binarysearch.
8825 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8826 AddDelegate): I did not quite use the new IsValid API properly: I
8827 have to pass the short-name and the fullname. I was passing only
8828 the basename instead of the fullname sometimes.
8830 (TypeContainer.DefineType): call NamespaceClash.
8832 * interface.cs (Interface.DefineType): use NamespaceClash before
8835 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8838 * enum.cs: (Enum.DefineType): use NamespaceClash before
8841 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8842 speed increase. First, use the negative_hits cache when we get a
8843 negative. Second, add the type with its full original name
8844 instead of the new . and + encoded name (reflection uses + to
8845 separate type from a nested type). Use LookupTypeReflection
8846 directly which bypasses the type->name hashtable (that we already
8847 know does not contain the type.
8849 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8850 location/container type.
8852 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8854 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8856 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8858 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8859 method is being referenced in the method group from a static
8860 context, and report error 120 if so.
8862 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8865 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8866 is created, we create the A namespace).
8868 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8871 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8873 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8874 invocation to ModuleBuilder.GetType with the same values will
8875 return a new type instance, so we need to cache its return
8878 * expression.cs (Binary.ResolveOperator): Only allow the compare
8879 operators on enums if they are of the same type.
8881 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8882 types of ValueType on their own case. Before we were giving them
8883 the same treatment as objects.
8885 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8886 fullname. Short name is used to compare against container name.
8887 Fullname is used to check against defined namespace names.
8889 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8890 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8892 (Method.CheckBase): Call parent.
8893 (MemberBase.CheckBase): Check for protected members on sealed
8895 (PropertyBase.CheckBase): Call parent.
8896 (Field.Define): Call parent.
8898 * report.cs: Negative error codes are now mapped to 8000 - code,
8899 so that the display is render more nicely.
8901 * typemanager.cs: Do not use try/catch, instead report a regular
8904 (GetPointerType, GetReferenceType): These methods provide
8905 mechanisms to obtain the T* and T& from a T. We had the code
8906 previously scattered around the code base, and it also used
8907 TypeManager.LookupType that would go through plenty of caches.
8908 This one goes directly to the type source.
8910 In some places we did the Type.GetType followed by
8911 ModuleBuilder.GetType, but not in others, so this unifies the
8914 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8915 statements now that we have namespace information.
8917 * typemanager.cs (IsNamespace): New method, returns whether the
8918 string presented is a namespace or not.
8920 (ComputeNamespaces): New public entry point, computes the list of
8921 available namespaces, using the GetNamespaces API call in Mono, or
8922 the slower version in MS.NET.
8924 Now before we start the semantic analysis phase, we have a
8925 complete list of namespaces including everything that the user has
8928 Deleted old code to cache namespaces in .nsc files.
8930 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8932 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8933 class/struct location definition Location for the implicit
8934 constructor location.
8936 (Operator.Define): Use the location of the operator for the
8937 implicit Method definition.
8939 (Constructor.Emit): use the constructor location for the implicit
8940 base initializer constructor.
8942 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8943 and the Expression class now contains two new methods:
8945 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8946 isolate type lookup from the rest of the resolution process.
8948 Since we use Expressions to hold type definitions due to the way
8949 we parse the input we have historically overloaded Resolve to
8950 perform the Type lookups if a special flag is passed. Now this is
8951 eliminated and two methods take their place.
8953 The differences in the two methods between xStep and xTerminal is
8954 that xStep is involved in our current lookup system that uses
8955 SimpleNames to compose a name, while xTerminal is used just to
8956 catch the case where the simplename lookup failed.
8958 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8960 * expression.cs (ResolveMemberAccess): Remove redundant code.
8961 TypeExpr expressions are always born fully resolved.
8963 * interface.cs (PopulateMethod): Do not lookup the types twice.
8964 We were doing it once during SemanticAnalysis and once during
8967 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8968 in local variable type definitions, were being returned as a
8969 SimpleName (we decomposed everything into a string), that is
8970 because primary_expression was being used instead of a type in the
8971 grammar (reduce/reduce conflicts).
8973 The part that was wrong is that we converted the expression into a
8974 string (an oversimplification in one hand, compounded with primary
8975 expressions doing string concatenation).
8981 Would return "A.B.C[]" as a SimpleName. This stopped things like
8982 using clauses from working on this particular context. And a type
8983 was being matched directly against "A.B.C[]".
8985 We now use the correct approach, and allow for ComposedCast to be
8986 part of the unary expression. So the "A.B.C []" become a composed
8987 cast of "A.B.C" (as a nested group of MemberAccess with a
8988 SimpleName at the end) plus the rank composition "[]".
8992 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8994 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8995 for the access level checking.
8997 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8998 `TypeContainer container', because I kept getting confused when I
8999 was debugging this code.
9001 * expression.cs (Indexers): Instead of tracking getters/setters,
9002 we now track them in parallel. We create one arraylist less, but
9003 most importantly it is possible now for the LValue code to find a
9004 matching get for a set.
9006 (IndexerAccess.DoResolveLValue): Update the code.
9007 GetIndexersForType has been modified already to extract all the
9008 indexers from a type. The code assumed it did not.
9010 Also make the code set the correct return type for the indexer.
9011 This was fixed a long time ago for properties, but was missing for
9012 indexers. It used to be void_type.
9014 (Binary.Emit): Test first for doubles instead of
9015 floats, as they are more common.
9017 (Binary.EmitBranchable): Use the .un version of the branch opcodes
9018 when dealing with floats and the <=, >= operators. This fixes bug
9021 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
9022 to load the array value by emitting a load on the foreach variable
9023 type. This was incorrect.
9025 We now emit the code to load an element using the the array
9026 variable type, and then we emit the conversion operator.
9030 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
9032 * attribute.cs: Avoid allocation of ArrayLists in the common case.
9034 2003-04-09 Miguel de Icaza <miguel@ximian.com>
9036 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
9037 test for protection before we test for signatures.
9039 (MethodSignature.ToString): implement.
9041 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
9042 to the case where we reduced into a LongConstant.
9044 * decl.cs (CheckAccessLevel): If the type is an array, we can not
9045 depend on whether the information is acurrate, because the
9046 Microsoft runtime will always claim that the array type is public,
9047 regardless of the real state.
9049 If the type is a pointer, another problem happens: the type is
9050 reported as non-public in Microsoft.
9052 In both cases we have to call CheckAccessLevel recursively with
9053 the underlying type as the argument to be tested.
9055 2003-04-08 Miguel de Icaza <miguel@ximian.com>
9057 * assign.cs (Assign.Emit): If we are dealing with a compound
9058 assignment expression, we should use the code path that stores the
9059 intermediate result in a temporary value. This fixes #40903.
9061 *expression.cs (Indirection.ToString): Provide ToString method for
9064 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
9066 * class.cs: Null out fields holding references to Block objects so
9067 they can be garbage collected.
9069 * expression.cs (OverloadResolve): Remove unused local.
9071 2003-04-07 Martin Baulig <martin@ximian.com>
9073 * codegen.cs (EmitContext.CurrentFile): New public field.
9074 (EmitContext.Mark): Use the CurrentFile to check whether the
9075 location is in the correct file.
9076 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
9078 2003-04-07 Martin Baulig <martin@ximian.com>
9080 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
9082 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
9083 location. [FIXME: The location argument which gets passed to this
9084 method is sometimes wrong!]
9086 2003-04-07 Nick Drochak <ndrochak@gol.com>
9088 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
9090 2003-04-07 Miguel de Icaza <miguel@ximian.com>
9092 * expression.cs (Indirection.EmitAssign): We were using the
9093 temporary, but returning immediately instead of continuing the
9096 2003-04-06 Martin Baulig <martin@ximian.com>
9098 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
9099 if it's a nested child, but also deriving from the outer class.
9102 * typemanager.cs (IsNestedChildOf): Make this work if it's a
9103 nested child, but also deriving from the outer class. See
9105 (FilterWithClosure): We may access private members of the outer
9106 class if we're a nested child and deriving from the outer class.
9107 (RealMemberLookup): Only set `closure_private_ok' if the
9108 `original_bf' contained BindingFlags.NonPublic.
9110 2003-04-05 Martin Baulig <martin@ximian.com>
9112 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
9113 probe if its a type parameter, and if so, flag an error.
9115 * decl.cs: Move here the SetParameterInfo code from class.cs.
9116 Handle IsGeneric here.
9118 Handle a variety of errors in the parameter info definition.
9120 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
9121 type parameters here.
9123 * cs-parser.jay (class_declaration): report errors for parameters
9126 2003-01-21 Miguel de Icaza <miguel@ximian.com>
9128 * generic.cs: New file, contains support code for generics.
9130 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
9131 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
9133 Update parser for the above removals.
9135 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
9136 now taken care of in the parser.
9138 2003-04-02 Miguel de Icaza <miguel@ximian.com>
9140 * class.cs (Event.Define): Do not allow abstract events to have
9143 2003-04-01 Miguel de Icaza <miguel@ximian.com>
9145 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
9146 block in event declarations.
9148 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
9149 value type, get its address.
9151 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
9152 leaving a class on the stack instead of a boolean value (int
9153 0/1). Change the code so we compare against null, and then the
9154 result against zero.
9156 * class.cs (TypeContainer.GetClassBases): We were checking for the
9157 parent class being sealed too late.
9159 * expression.cs (Binary.Emit): For <= and >= when dealing with
9160 floating point values, use cgt.un and clt.un instead of cgt and
9163 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
9165 * statement.cs: Apply the same optimization as MS: skip the
9166 GetEnumerator returning an IEnumerator, and use the one returning a
9167 CharEnumerator instead. This allows us to avoid the try-finally block
9170 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
9172 * cs-parser.jay: Attributes cannot be applied to
9173 namespaces. Fixes #40473
9175 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9178 (Add*): check if the name is valid using the full name for constants,
9179 fields, properties and events.
9181 2003-03-28 Miguel de Icaza <miguel@ximian.com>
9183 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
9184 char constants to be part of the enumeration.
9186 * expression.cs (Conditional.DoResolve): Add support for operator
9187 true. Implements the missing functionality from 14.12
9189 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
9190 operator true/false as required by the spec.
9192 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
9193 implicit conversion to boolean.
9195 * statement.cs (Statement.ResolveBoolean): A boolean expression is
9196 also one where the type implements `operator true'.
9198 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
9199 get an expression that will invoke operator true based on an
9202 (GetConversionOperators): Removed the hack that called op_True
9205 (Expression.ResolveBoolean): Move this from Statement.
9207 2003-03-17 Miguel de Icaza <miguel@ximian.com>
9209 * ecore.cs (FieldExpr): do not allow initialization of initonly
9210 fields on derived classes
9212 2003-03-13 Martin Baulig <martin@ximian.com>
9214 * statement.cs (Block.Emit): Call ig.BeginScope() and
9215 ig.EndScope() when compiling with debugging info; call
9216 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
9218 2003-03-08 Miguel de Icaza <miguel@ximian.com>
9220 * expression.cs (Indexers): Do not construct immediately, allow
9221 for new members to be appended as we go. Fixes 38143
9223 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9225 * expression.cs: save/restore context when resolving an unchecked
9228 2003-03-05 Miguel de Icaza <miguel@ximian.com>
9230 * cfold.cs: Catch division by zero in modulus operator during
9233 2003-03-03 Miguel de Icaza <miguel@ximian.com>
9235 * interface.cs (Interface.DefineMembers): Avoid defining members
9238 2003-02-27 Miguel de Icaza <miguel@ximian.com>
9240 * driver.cs: handle the +/- options for -noconfig
9242 * statement.cs (Unckeched.Resolve): Also track the state of
9243 unchecked in the Resolve phase.
9245 2003-02-27 Martin Baulig <martin@ximian.com>
9247 * ecore.cs (Expression.MemberLookup): Don't create a
9248 MethodGroupExpr for something which is not a method. Fixes #38291.
9250 2003-02-25 Miguel de Icaza <miguel@ximian.com>
9252 * class.cs (MemberBase.CheckParameters): Also check that the type
9253 is unmanaged if it is a pointer.
9255 * expression.cs (SizeOf.Resolve): Add location information.
9257 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
9258 a managed type is declared.
9260 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
9261 parameter modifiers as well. Fixes bug 38606
9263 * class.cs: Very sad. Am backing out the speed up changes
9264 introduced by the ArrayList -> Array in the TypeContainer, as they
9265 were not actually that much faster, and introduced a bug (no error
9266 reports on duplicated methods).
9268 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
9269 source first, this will guarantee that we have a valid expression
9270 before calling in lower levels functions that will require a
9271 resolved object. Then use this original_source in the
9272 target.ResolveLValue instead of the original source that was
9275 Another change. Use target.Resolve instead of LValueResolve.
9276 Although we are resolving for LValues, we will let the Assign code
9277 take care of that (it will be called again from Resolve). This
9278 basically allows code like this:
9280 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
9281 class Y { void A (X x) { x [0] += o; }
9283 The problem was that the indexer was trying to resolve for
9284 set_Item (idx, object o) and never finding one. The real set_Item
9285 was set_Item (idx, X). By delaying the process we get the right
9290 2003-02-23 Martin Baulig <martin@ximian.com>
9292 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
9293 while calling DoEmit ().
9295 * codegen.cs (EmitContext.Mark): Don't mark locations in other
9296 source files; if you use the #line directive inside a method, the
9297 compiler stops emitting line numbers for the debugger until it
9298 reaches the end of the method or another #line directive which
9299 restores the original file.
9301 2003-02-23 Martin Baulig <martin@ximian.com>
9303 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
9305 2003-02-23 Martin Baulig <martin@ximian.com>
9307 * statement.cs (Block.AddChildVariableNames): We need to call this
9308 recursively, not just for our immediate children.
9310 2003-02-23 Martin Baulig <martin@ximian.com>
9312 * class.cs (Event.Define): Always make the field private, like csc does.
9314 * typemanager.cs (TypeManager.RealMemberLookup): Make events
9315 actually work, fixes bug #37521.
9317 2003-02-23 Miguel de Icaza <miguel@ximian.com>
9319 * delegate.cs: When creating the various temporary "Parameters"
9320 classes, make sure that we call the ComputeAndDefineParameterTypes
9321 on those new parameters (just like we do with the formal ones), to
9322 allow them to be resolved in the context of the DeclSpace.
9324 This fixes the bug that Dick observed in Bugzilla #38530.
9326 2003-02-22 Miguel de Icaza <miguel@ximian.com>
9328 * expression.cs (ResolveMemberAccess): When resolving a constant,
9329 do not attempt to pull a constant if the value was not able to
9330 generate a valid constant.
9332 * const.cs (LookupConstantValue): Do not report more errors than required.
9334 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9336 * expression.cs: fixes bug #38328.
9338 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9340 * class.cs: Changed all the various members that can be part of a
9341 class from being an ArrayList to be an Array of the right type.
9342 During the DefineType type_list, interface_list, delegate_list and
9343 enum_list are turned into types, interfaces, delegates and enums
9346 And during the member population, indexer_list, event_list,
9347 constant_list, field_list, instance_constructor_list, method_list,
9348 operator_list and property_list are turned into their real arrays.
9350 Although we could probably perform this operation earlier, for
9351 good error reporting we need to keep the lists and remove the
9352 lists for longer than required.
9354 This optimization was triggered by Paolo profiling the compiler
9355 speed on the output of `gen-sample-program.pl' perl script.
9357 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
9358 not crash in methods like MemberLookupFailed that use this field.
9360 This problem arises when the compiler fails to resolve a type
9361 during interface type definition for example.
9363 2003-02-18 Miguel de Icaza <miguel@ximian.com>
9365 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
9366 inherit from System.Object, so we have to stop at null, not only
9367 when reaching System.Object.
9369 2003-02-17 Miguel de Icaza <miguel@ximian.com>
9371 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
9372 DeclaredOnly because the parent indexer might have had a different
9373 name, but did not loop until the top of the hierarchy was reached.
9375 The problem this one fixes is 35492: when a class implemented an
9376 indexer from an interface, we were getting the interface method
9377 (which was abstract) and we were flagging an error (can not invoke
9380 This also keeps bug 33089 functioning, and test-148 functioning.
9382 * typemanager.cs (IsSpecialMethod): The correct way of figuring
9383 out if a method is special is to see if it is declared in a
9384 property or event, or whether it is one of the predefined operator
9385 names. This should fix correctly #36804.
9387 2003-02-15 Miguel de Icaza <miguel@ximian.com>
9389 The goal here is to remove the dependency on EmptyCast.Peel ().
9390 Killing it completely.
9392 The problem is that currently in a number of places where
9393 constants are expected, we have to "probe" for an EmptyCast, and
9394 Peel, which is not the correct thing to do, as this will be
9395 repetitive and will likely lead to errors.
9397 The idea is to remove any EmptyCasts that are used in casts that
9398 can be reduced to constants, so we only have to cope with
9401 This bug hunt was triggered by Bug 37363 and the desire to remove
9402 the duplicate pattern where we were "peeling" emptycasts to check
9403 whether they were constants. Now constants will always be
9406 * ecore.cs: Use an enumconstant here instead of wrapping with
9409 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
9410 throwing me off. By handling this we can get rid of a few hacks.
9412 * statement.cs (Switch): Removed Peel() code.
9414 2003-02-14 Miguel de Icaza <miguel@ximian.com>
9416 * class.cs: Location information for error 508
9418 * expression.cs (New.DoResolve): Add a guard against double
9419 resolution of an expression.
9421 The New DoResolve might be called twice when initializing field
9422 expressions (see EmitFieldInitializers, the call to
9423 GetInitializerExpression will perform a resolve on the expression,
9424 and later the assign will trigger another resolution
9426 This leads to bugs (#37014)
9428 * delegate.cs: The signature for EndInvoke should contain any ref
9429 or out parameters as well. We were not doing this in the past.
9431 * class.cs (Field.Define): Do not overwrite the type definition
9432 inside the `volatile' group. Turns out that volatile enumerations
9433 were changing the type here to perform a validity test, which
9436 2003-02-12 Miguel de Icaza <miguel@ximian.com>
9438 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
9439 and structs, we do not want to load the instance variable
9441 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
9442 enum_type has to be handled like an object reference (implicit
9443 conversions exists from this to object), but the regular IsClass
9444 and IsValueType tests will never return true for this one.
9446 Also we use TypeManager.IsValueType instead of type.IsValueType,
9447 just for consistency with the rest of the code (this is only
9448 needed if we ever use the construct exposed by test-180.cs inside
9449 corlib, which we dont today).
9451 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
9453 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
9456 2003-02-09 Martin Baulig <martin@ximian.com>
9458 * namespace.cs (Namespace..ctor): Added SourceFile argument.
9459 (Namespace.DefineNamespaces): New static public method; this is
9460 called when we're compiling with debugging to add all namespaces
9463 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
9464 pass it to the Namespace's .ctor.
9466 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
9467 and MethodBase arguments; pass the namespace ID to the symwriter;
9468 pass the MethodBase instead of the token to the symwriter.
9469 (SymbolWriter.DefineNamespace): New method to add a namespace to
9472 2003-02-09 Martin Baulig <martin@ximian.com>
9474 * symbolwriter.cs: New file. This is a wrapper around
9475 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
9476 methods here in near future.
9478 2003-02-09 Martin Baulig <martin@ximian.com>
9480 * codegen.cs (EmitContext.Mark): Just pass the arguments to
9481 ILGenerator.MarkSequencePoint() which are actually used by the
9484 2003-02-09 Martin Baulig <martin@ximian.com>
9486 * location.cs (SourceFile): New public sealed class. This
9487 contains the name and an index which is used in the location's token.
9488 (Location): Reserve an appropriate number of bits in the token for
9489 the source file instead of walking over that list, this gives us a
9490 really huge performance improvement when compiling with debugging.
9492 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
9493 `SourceFile' argument instead of a string.
9494 (Driver.ProcessFile): Add all the files via Location.AddFile(),
9495 but don't parse/tokenize here, we need to generate the list of all
9496 source files before we do that.
9497 (Driver.ProcessFiles): New static function. Parses/tokenizes all
9500 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
9501 instead of a string.
9503 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
9506 2003-02-09 Martin Baulig <martin@ximian.com>
9508 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
9509 filename on `#line default'.
9511 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
9513 * statement.cs: don't clear the pinned var when the fixed statement
9514 returns from the method (fixes bug#37752).
9516 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
9518 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
9521 2003-02-07 Martin Baulig <martin@ximian.com>
9523 * driver.cs: Removed the `--debug-args' command line argument.
9525 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
9526 automatically by the AsssemblyBuilder.
9527 (CodeGen.InitializeSymbolWriter): We don't need to call any
9528 initialization function on the symbol writer anymore. This method
9529 doesn't take any arguments.
9531 2003-02-03 Miguel de Icaza <miguel@ximian.com>
9533 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
9534 from referenced assemblies as well.
9536 2003-02-02 Martin Baulig <martin@ximian.com>
9538 * class.cs (MethodData.Emit): Generate debugging info for external methods.
9540 2003-02-02 Martin Baulig <martin@ximian.com>
9542 * class.cs (Constructor.Emit): Open the symbol writer before
9543 emitting the constructor initializer.
9544 (ConstructorInitializer.Emit): Call ec.Mark() to allow
9545 single-stepping through constructor initializers.
9547 2003-01-30 Miguel de Icaza <miguel@ximian.com>
9549 * class.cs: Handle error 549: do not allow virtual methods in
9552 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
9554 * decl.cs: Check access levels when resolving types
9556 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
9558 * statement.cs: Add parameters and locals set in catch blocks that might
9559 return to set vector
9561 2003-01-29 Miguel de Icaza <miguel@ximian.com>
9563 * class.cs (Operator): Set the SpecialName flags for operators.
9565 * expression.cs (Invocation.DoResolve): Only block calls to
9566 accessors and operators on SpecialName methods.
9568 (Cast.TryReduce): Handle conversions from char constants.
9571 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
9573 * statement.cs: small memory and time optimization in FlowBranching.
9575 2003-01-28 Pedro Mart <yoros@wanadoo.es>
9577 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
9578 problem that the last fix but in the other sid (Set).
9580 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
9581 access when there is no indexer in the hierarchy.
9583 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
9585 * class.cs: Combine some if statements.
9587 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9589 * driver.cs: fixed bug #37187.
9591 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
9593 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
9594 any indexer, it's needed to build a list with all the indexers in the
9595 hierarchy (AllGetters), else we have problems. Fixes #35653.
9597 2003-01-23 Miguel de Icaza <miguel@ximian.com>
9599 * class.cs (MethodData.Define): It is wrong for an interface
9600 implementation to be static in both cases: explicit and implicit.
9601 We were only handling this in one case.
9603 Improve the if situation there to not have negations.
9605 * class.cs (Field.Define): Turns out that we do not need to check
9606 the unsafe bit on field definition, only on usage. Remove the test.
9608 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9610 * driver.cs: use assembly.Location instead of Codebase (the latest
9611 patch made mcs fail when using MS assemblies).
9613 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
9615 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
9616 get the path to *corlib.dll.
9618 2003-01-21 Nick Drochak <ndrochak@gol.com>
9622 * typemanager.cs: Remove compiler warnings
9624 2003-01-20 Duncan Mak <duncan@ximian.com>
9626 * AssemblyInfo.cs: Bump the version number to 0.19.
9628 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9630 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
9632 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
9634 * class.cs (Constructor::Emit): Emit debugging info for constructors.
9636 2003-01-17 Miguel de Icaza <miguel@ximian.com>
9638 * cs-parser.jay: Small fix: we were not comparing the constructor
9639 name correctly. Thanks to Zoltan for the initial pointer.
9641 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
9643 * cs-tokenizer.cs: Set file name when specified with #line
9645 2003-01-15 Miguel de Icaza <miguel@ximian.com>
9647 * cs-parser.jay: Only perform the constructor checks here if we
9648 are named like the class; This will help provider a better
9649 error. The constructor path is taken when a type definition is
9650 not found, but most likely the user forgot to add the type, so
9651 report that rather than the constructor error.
9653 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
9655 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
9658 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9660 * cs-parser.jay: Add cleanup call.
9662 2003-01-13 Duncan Mak <duncan@ximian.com>
9664 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
9665 consistent with other methods.
9667 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
9669 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
9671 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
9673 * attribute.cs: only set GuidAttr to true when we have a
9676 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9680 * typemanager.cs: fixes to allow mcs compile corlib with the new
9681 Type.IsSubclassOf fix.
9683 2003-01-08 Miguel de Icaza <miguel@ximian.com>
9685 * expression.cs (LocalVariableReference.DoResolve): Classify a
9686 constant as a value, not as a variable. Also, set the type for
9689 * cs-parser.jay (fixed_statement): take a type instead of a
9690 pointer_type, so we can produce a better error message later.
9692 * statement.cs (Fixed.Resolve): Flag types that are not pointers
9695 (For.DoEmit): Make inifinite loops have a
9696 non-conditional branch back.
9698 (Fixed.DoEmit): First populate the pinned variables, then emit the
9699 statement, then clear the variables. Before I was emitting the
9700 code once for each fixed piece.
9703 2003-01-08 Martin Baulig <martin@ximian.com>
9705 * statement.cs (FlowBranching.MergeChild): A break in a
9706 SWITCH_SECTION does not leave a loop. Fixes #36155.
9708 2003-01-08 Martin Baulig <martin@ximian.com>
9710 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
9711 lives in the same number space than `param_map'. Fixes #36154.
9713 2003-01-07 Miguel de Icaza <miguel@ximian.com>
9715 * cs-parser.jay (constructor_declaration): Set the
9716 Constructor.ModFlags before probing for it. This makes the
9717 compiler report 514, 515 and 132 (the code was there, but got
9720 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
9721 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
9722 (GotoCase.Resolve): Set `Returns' to ALWAYS.
9724 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
9726 * enum.cs: create the enum static fields using the enum type.
9728 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
9730 * class.cs: don't try to create the ParamBuilder for the return
9731 type if it's not needed (and handle it breaking for the ms runtime
9734 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
9736 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
9738 2002-12-29 Miguel de Icaza <miguel@ximian.com>
9740 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
9741 the command. This showed up while compiling the JANET source
9742 code, which used \r as its only newline separator.
9744 2002-12-28 Miguel de Icaza <miguel@ximian.com>
9746 * class.cs (Method.Define): If we are an operator (because it
9747 reuses our code), then set the SpecialName and HideBySig. #36128
9749 2002-12-22 Miguel de Icaza <miguel@ximian.com>
9751 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
9752 exception, report error 120 `object reference required'.
9754 * driver.cs: Add --pause option, used during to measure the size
9755 of the process as it goes with --timestamp.
9757 * expression.cs (Invocation.DoResolve): Do not allow methods with
9758 SpecialName to be invoked.
9760 2002-12-21 Miguel de Icaza <miguel@ximian.com>
9762 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
9763 number before adding it.
9765 2002-12-21 Ravi Pratap <ravi@ximian.com>
9767 * ecore.cs (StandardImplicitConversion): When in an unsafe
9768 context, we allow conversion between void * to any other pointer
9769 type. This fixes bug #35973.
9771 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
9773 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
9774 is not thrown when extensionless outputs are used
9776 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9778 * rootcontext.cs: fixed compilation of corlib.
9780 2002-12-19 Miguel de Icaza <miguel@ximian.com>
9782 * attribute.cs (Attributes.Contains): Add new method.
9784 * class.cs (MethodCore.LabelParameters): if the parameter is an
9785 `out' parameter, check that no attribute `[In]' has been passed.
9787 * enum.cs: Handle the `value__' name in an enumeration.
9789 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
9791 * decl.cs: Added special case to allow overrides on "protected
9794 2002-12-18 Ravi Pratap <ravi@ximian.com>
9796 * attribute.cs (Attributes.AddAttributeSection): Rename to this
9797 since it makes much more sense.
9799 (Attributes.ctor): Don't require a Location parameter.
9801 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
9803 * attribute.cs (ApplyAttributes): Remove extra Location parameters
9804 since we already have that information per attribute.
9806 * everywhere : make appropriate changes.
9808 * class.cs (LabelParameters): Write the code which actually
9809 applies attributes to the return type. We can't do this on the MS
9810 .NET runtime so we flag a warning in the case an exception is
9813 2002-12-18 Miguel de Icaza <miguel@ximian.com>
9815 * const.cs: Handle implicit null conversions here too.
9817 2002-12-17 Ravi Pratap <ravi@ximian.com>
9819 * class.cs (MethodCore.LabelParameters): Remove the extra
9820 Type [] parameter since it is completely unnecessary. Instead
9821 pass in the method's attributes so that we can extract
9822 the "return" attribute.
9824 2002-12-17 Miguel de Icaza <miguel@ximian.com>
9826 * cs-parser.jay (parse): Use Report.Error to flag errors instead
9827 of ignoring it and letting the compile continue.
9829 * typemanager.cs (ChangeType): use an extra argument to return an
9830 error condition instead of throwing an exception.
9832 2002-12-15 Miguel de Icaza <miguel@ximian.com>
9834 * expression.cs (Unary.TryReduce): mimic the code for the regular
9835 code path. Perform an implicit cast in the cases where we can
9836 implicitly convert to one of the integral types, and then reduce
9837 based on that constant. This fixes bug #35483.
9839 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9841 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
9843 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9845 * namespace.cs: fixed bug #35489.
9847 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9849 * class.cs: Remove some dead code.
9851 * cs-parser.jay: Estimate the number of methods needed
9852 (RootContext.MethodCount);
9854 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9855 numbers instead of StringBuilders.
9857 * support.cs (PtrHashtable): Add constructor with initial size;
9858 We can now reduce reallocations of the method table.
9860 2002-12-10 Ravi Pratap <ravi@ximian.com>
9862 * attribute.cs (ApplyAttributes): Keep track of the emitted
9863 attributes on a per-target basis. This fixes bug #35413.
9865 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9867 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9868 default to the Windows 1252 encoding.
9870 (UnixParseOption): Support version, thanks to Alp for the missing
9873 * AssemblyInfo.cs: Add nice assembly information.
9875 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9878 * cs-parser.jay: Allow a trailing comma before the close bracked
9879 in the attribute_section production.
9881 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9882 address of the instance was being taken, I will take this out,
9883 because we take the address of the object immediately here.
9885 2002-12-09 Ravi Pratap <ravi@ximian.com>
9887 * typemanager.cs (AreMultipleAllowed): Take care of the most
9888 obvious case where attribute type is not in the current assembly -
9891 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9893 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9894 definitions, instead of doing that afterwards.
9896 Also we use a nice little hack, depending on the constructor, we
9897 know if we are a "composed" name or a simple name. Hence, we
9898 avoid the IndexOf test, and we avoid
9900 * codegen.cs: Add code to assist in a bug reporter to track down
9901 the source of a compiler crash.
9903 2002-12-07 Ravi Pratap <ravi@ximian.com>
9905 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9906 types have been emitted for a given element and flag an error
9907 if something which does not have AllowMultiple set is used more
9910 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9911 attribute types and their corresponding AllowMultiple properties
9913 (AreMultipleAllowed): Check the property for a given type.
9915 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9916 property in the case we have a TypeContainer.
9918 (Attributes.AddAttribute): Detect duplicates and just skip on
9919 adding them. This trivial fix catches a pretty gross error in our
9920 attribute emission - global attributes were being emitted twice!
9922 Bugzilla bug #33187 is now fixed.
9924 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9926 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9929 * expression.cs (Binary.ResolveOperator): I can only use the
9930 Concat (string, string, string) and Concat (string, string,
9931 string, string) if the child is actually a concatenation of
9934 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9936 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9937 context where we need a 2-character lookahead.
9939 * pending.cs (PendingImplementation): Rework so we can keep track
9940 of interface types all the time, and flag those which were
9941 implemented by parents as optional.
9943 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9945 * expression.cs (Binary.ResolveOperator): Use
9946 String.Concat(string,string,string) or
9947 String.Concat(string,string,string,string) when possible.
9949 * typemanager: More helper methods.
9952 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9954 * pending.cs: remove the bogus return from GetMissingInterfaces()
9955 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9957 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9959 * namespace.cs: avoid duplicated 'using xxx' being added to
9960 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9961 when we get more than one 'using' statement for the same namespace.
9962 Report a CS0105 warning for it.
9964 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9966 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9967 of calling getChar/putback, uses internal knowledge of it.
9969 (xtoken): Reorder tokenizer so most common patterns are checked
9970 first. This reduces the compilation time in another 5% (from 8.11s
9971 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9973 The parsing time is 22% of the compilation in mcs, and from that
9974 64% is spent on the tokenization process.
9976 I tried using a binary search for keywords, but this is slower
9977 than the hashtable. Another option would be to do a couple of
9980 * Not use a StringBuilder, instead use an array of chars,
9981 with a set value. Notice that this way we could catch
9982 the 645 error without having to do it *afterwards*.
9984 * We could write a hand-parser to avoid the hashtable
9985 compares altogether.
9987 The identifier consumption process takes 37% of the tokenization
9988 time. Another 15% is spent on is_number. 56% of the time spent
9989 on is_number is spent on Int64.Parse:
9991 * We could probably choose based on the string length to
9992 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9995 Another 3% is spend on wrapping `xtoken' in the `token' function.
9997 Handle 0xa0 as whitespace (#34752)
9999 2002-11-26 Miguel de Icaza <miguel@ximian.com>
10001 * typemanager.cs (IsCLRType): New routine to tell whether a type
10002 is one of the builtin types.
10004 Maybe it needs to use TypeCodes to be faster. Maybe we could use
10005 typecode in more places instead of doing pointer comparissions.
10006 We could leverage some knowledge about the way the typecodes are
10009 New code to cache namespaces in assemblies, it is currently not
10010 invoked, to be used soon.
10012 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
10014 * expression.cs (Binary.ResolveOperator): specially handle
10015 strings, and do not perform user-defined operator overloading for
10018 2002-11-24 Miguel de Icaza <miguel@ximian.com>
10020 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
10021 internalcall as it is a pretty simple operation; Avoid whenever
10022 possible to call Char.IsLetter.
10024 (consume_identifier): Cut by half the number of
10025 hashtable calls by merging the is_keyword and GetKeyword behavior.
10027 Do not short-circuit, because if we do, we
10028 report errors (ie, #if false && true would produce an invalid
10032 2002-11-24 Martin Baulig <martin@ximian.com>
10034 * expression.cs (Cast.TryReduce): If we're in checked syntax,
10035 check constant ranges and report a CS0221. Fixes #33186.
10037 2002-11-24 Martin Baulig <martin@ximian.com>
10039 * cs-parser.jay: Make this work for uninitialized variable
10040 declarations in the `for' initializer. Fixes #32416.
10042 2002-11-24 Martin Baulig <martin@ximian.com>
10044 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
10045 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
10047 2002-11-24 Martin Baulig <martin@ximian.com>
10049 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
10050 argument; if true, we also check for user-defined conversions.
10051 This is only needed if both arguments are of a user-defined type.
10052 Fixes #30443, added test-175.cs.
10053 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
10055 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
10057 2002-11-24 Martin Baulig <martin@ximian.com>
10059 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
10060 function to get the store opcode.
10061 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
10062 only emit the Ldelema if the store opcode is Stobj. You must run
10063 both test-34 and test-167 to test this. Fixes #34529.
10065 2002-11-23 Martin Baulig <martin@ximian.com>
10067 * ecore.cs (Expression.MemberLookup): Added additional
10068 `qualifier_type' argument which is used when we're being called
10069 from MemberAccess.DoResolve() and null if we're called from a
10071 (Expression.MemberLookupFailed): New method to report errors; this
10072 does the CS1540 check and reports the correct error message.
10074 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
10075 argument for the CS1540 check and redone the way how we're dealing
10076 with private members. See the comment in the source code for details.
10077 (FilterWithClosure): Reverted this back to revision 1.197; renamed
10078 `closure_start_type' to `closure_qualifier_type' and check whether
10079 it's not null. It was not this filter being broken, it was just
10080 being called with the wrong arguments.
10082 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
10083 and pass it the correct `qualifier_type'; this also does the error
10086 2002-11-22 Miguel de Icaza <miguel@ximian.com>
10088 * expression.cs (Invocation.EmitParams): If the we are dealing
10089 with a non-built-in value type, load its address as well.
10091 (ArrayCreation): Use a a pretty constant instead
10092 of the hardcoded value 2. Use 6 instead of 2 for the number of
10093 static initializers.
10095 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
10096 because they are not really value types, just glorified integers.
10098 * driver.cs: Do not append .exe, the CSC compiler does not do it.
10100 * ecore.cs: Remove redundant code for enumerations, make them use
10101 the same code path as everything else, fixes the casting issue
10102 with enumerations in Windows.Forms.
10104 * attribute.cs: Do only cast to string if it is a string, the
10105 validation happens later.
10107 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
10108 people upgrade their corlibs.
10110 * ecore.cs: Oops, enumerations were not following the entire code path
10112 2002-11-21 Miguel de Icaza <miguel@ximian.com>
10114 * typemanager.cs (FilterWithClosure): Commented out the test for
10115 1540 in typemanager.cs, as it has problems when accessing
10116 protected methods from a parent class (see test-174.cs).
10118 * attribute.cs (Attribute.ValidateGuid): new method.
10119 (Attribute.Resolve): Use above.
10121 2002-11-19 Miguel de Icaza <miguel@ximian.com>
10123 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
10125 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
10126 handling for enumerations, as we only needed the TypeContainer
10127 functionality to begin with (this is required for the fix below to
10128 work for enums that reference constants in a container class for
10131 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
10133 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
10134 a valid TypeBuilder to perform lookups on.o
10136 * class.cs (InheritableMemberSignatureCompare): Use true in the
10137 call to GetGetMethod and GetSetMethod, because we are comparing
10138 the signature, and we need to get the methods *even* if they are
10141 (PropertyBase.CheckBase): ditto.
10143 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
10144 GotoCase.Resolve): Use Peel on EmpytCasts.
10146 * ecore.cs (EmptyCast): drop child, add Peel method.
10148 2002-11-17 Martin Baulig <martin@ximian.com>
10150 * ecore.cs (EmptyCast.Child): New public property.
10152 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
10153 label resolved to an EmptyCast. Fixes #34162.
10154 (GotoCase.Resolve): Likewise.
10155 (Block.EmitMeta): Likewise.
10157 2002-11-17 Martin Baulig <martin@ximian.com>
10159 * expression.cs (Invocation.BetterConversion): Prefer int over
10160 uint; short over ushort; long over ulong for integer literals.
10161 Use ImplicitConversionExists instead of StandardConversionExists
10162 since we also need to check for user-defined implicit conversions.
10163 Fixes #34165. Added test-173.cs.
10165 2002-11-16 Martin Baulig <martin@ximian.com>
10167 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
10168 with the `true' and `false' literals. Fixes #33151.
10170 2002-11-16 Martin Baulig <martin@ximian.com>
10172 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
10173 October 22nd; don't do the cs1540 check for static members.
10175 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
10176 now using our own filter here and doing the cs1540 check again.
10178 2002-11-16 Martin Baulig <martin@ximian.com>
10180 * support.cs (InternalParameters): Don't crash if we don't have
10181 any fixed parameters. Fixes #33532.
10183 2002-11-16 Martin Baulig <martin@ximian.com>
10185 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
10186 when looking up static methods to make this work on Windows.
10189 2002-11-16 Martin Baulig <martin@ximian.com>
10191 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
10192 a setter rather than using PropertyInfo.CanWrite.
10194 2002-11-15 Nick Drochak <ndrochak@gol.com>
10196 * class.cs: Allow acces to block member by subclasses. Fixes build
10199 2002-11-14 Martin Baulig <martin@ximian.com>
10201 * class.cs (Constructor.Emit): Added the extern/block check.
10204 2002-11-14 Martin Baulig <martin@ximian.com>
10206 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
10207 iteration while looking for indexers, this is needed because the
10208 indexer may have a different name in our base classes. Fixed the
10209 error reporting (no indexers at all, not get accessor, no
10210 overloaded match). Fixes bug #33089.
10211 (IndexerAccess.DoResolveLValue): Likewise.
10213 2002-11-14 Martin Baulig <martin@ximian.com>
10215 * class.cs (PropertyBase.CheckBase): Make this work for multiple
10216 indexers. Fixes the first part of bug #33089.
10217 (MethodSignature.InheritableMemberSignatureCompare): Added support
10220 2002-11-13 Ravi Pratap <ravi@ximian.com>
10222 * attribute.cs (Attribute.Resolve): Catch the
10223 NullReferenceException and report it since it isn't supposed to
10226 2002-11-12 Miguel de Icaza <miguel@ximian.com>
10228 * expression.cs (Binary.EmitBranchable): Also handle the cases for
10229 LogicalOr and LogicalAnd that can benefit from recursively
10230 handling EmitBranchable. The code now should be nice for Paolo.
10232 2002-11-08 Miguel de Icaza <miguel@ximian.com>
10234 * typemanager.cs (LookupType): Added a negative-hit hashtable for
10235 the Type lookups, as we perform quite a number of lookups on
10236 non-Types. This can be removed once we can deterministically tell
10237 whether we have a type or a namespace in advance.
10239 But this might require special hacks from our corlib.
10243 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
10244 and double which avoids a conversion from an integer to a double.
10246 * expression.cs: tiny optimization, avoid calling IsConstant,
10247 because it effectively performs the lookup twice.
10249 2002-11-06 Miguel de Icaza <miguel@ximian.com>
10251 But a bogus return here to keep the semantics of the old code
10252 until the Mono runtime is fixed.
10254 * pending.cs (GetMissingInterfaces): New method used to remove all
10255 the interfaces that are already implemented by our parent
10256 classes from the list of pending methods.
10258 * interface.cs: Add checks for calls after ResolveTypeExpr.
10260 2002-11-05 Miguel de Icaza <miguel@ximian.com>
10262 * class.cs (Class.Emit): Report warning 67: event not used if the
10263 warning level is beyond 3.
10265 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
10266 being a NullLiteral.
10268 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
10271 * class.cs (TypeContainer.GetClassBases): Cover a missing code
10272 path that might fail if a type can not be resolved.
10274 * expression.cs (Binary.Emit): Emit unsigned versions of the
10277 * driver.cs: use error 5.
10279 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
10281 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
10283 2002-11-01 Miguel de Icaza <miguel@ximian.com>
10285 * cs-parser.jay (switch_section): A beautiful patch from Martin
10286 Baulig that fixed 33094.
10288 2002-10-31 Miguel de Icaza <miguel@ximian.com>
10290 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
10291 Check whether the base is abstract and report an error if so.
10293 * expression.cs (IndexerAccess.DoResolveLValue,
10294 IndexerAccess.DoResolve): ditto.
10296 (Invocation.DoResolve): ditto.
10298 (Invocation.FullMethodDesc): Improve the report string.
10300 * statement.cs (Block): Eliminate IsVariableDefined as it is
10301 basically just a wrapper for GetVariableInfo.
10303 * ecore.cs (SimpleName): Use new
10305 * support.cs (ReflectionParamter.ParameterType): We unwrap the
10306 type, as we return the actual parameter ref/unref state on a
10309 2002-10-30 Miguel de Icaza <miguel@ximian.com>
10311 * support.cs: Return proper flags REF/OUT fixing the previous
10314 * expression.cs: Reverted last patch, that was wrong. Is_ref is
10315 not used to mean `ref' but `ref or out' in ParameterReference
10317 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
10318 full type signature instead of calling TypeManger.CSharpName
10321 * support.cs (InternalParameters.ParameterDesc): Do not compare
10322 directly to the modflags, because REF/OUT will actually be bitsets
10325 * delegate.cs (VerifyMethod): Check also the modifiers.
10327 * cs-tokenizer.cs: Fix bug where floating point values with an
10328 exponent where a sign was missing was ignored.
10330 * driver.cs: Allow multiple assemblies to be specified in a single
10333 2002-10-28 Miguel de Icaza <miguel@ximian.com>
10335 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
10336 because identifiers after a parenthesis would end up in this kind
10337 of production, and we needed to desamiguate it for having casts
10340 (UserDefinedType *) xxx
10342 2002-10-24 Miguel de Icaza <miguel@ximian.com>
10344 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
10345 we should set on the Bindingflags.NonPublic, but not turn on
10346 private_ok. private_ok controls whether a Private member is
10347 returned (this is chekced on the filter routine), while the
10348 BindingFlags.NonPublic just controls whether private/protected
10349 will be allowed. This fixes the problem part of the problem of
10350 private properties being allowed to be used in derived classes.
10352 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
10353 so we can call the children DoResolveLValue method (this will
10354 properly signal errors on lvalue assignments to base properties)
10356 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
10357 getter are null, and we have a property info, we know that this
10358 happened because the lookup failed, so we report an error 122 for
10359 protection level violation.
10361 We also silently return if setter and getter are null in the
10362 resolve functions, this condition only happens if we have flagged
10363 the error before. This is the other half of the problem.
10365 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
10366 not have accessibility information, that is why we were returning
10367 true in the filter function in typemanager.cs.
10369 To properly report 122 (property is inaccessible because of its
10370 protection level) correctly, we report this error in ResolveAccess
10371 by failing if both the setter and the getter are lacking (ie, the
10374 DoResolve and DoLResolve have been modified to check for both
10375 setter/getter being null and returning silently, the reason being
10376 that I did not want to put the knowledge about this error in upper
10379 int old = Report.Errors;
10380 x = new PropertyExpr (...);
10381 if (old != Report.Errors)
10386 So the property expr is returned, but it is invalid, so the error
10387 will be flagged during the resolve process.
10389 * class.cs: Remove InheritablePropertySignatureCompare from the
10390 class, as we no longer depend on the property signature to compute
10391 whether it is possible to implement a method or not.
10393 The reason is that calling PropertyInfo.GetGetMethod will return
10394 null (in .NET, in Mono it works, and we should change this), in
10395 cases where the Get Method does not exist in that particular
10400 class X { public virtual int A { get { return 1; } } }
10402 class Z : Y { public override int A { get { return 2; } } }
10404 Would fail in Z because the parent (Y) would not have the property
10405 defined. So we avoid this completely now (because the alternative
10406 fix was ugly and slow), and we now depend exclusively on the
10409 (PropertyBase.CheckBase): Use a method-base mechanism to find our
10410 reference method, instead of using the property.
10412 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
10413 routines are gone now.
10415 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
10416 names, they were incorrectly named.
10418 * cs-tokenizer.cs: Return are more gentle token on failure.
10420 * pending.cs (PendingImplementation.InterfaceMethod): This routine
10421 had an out-of-sync index variable, which caused it to remove from
10422 the list of pending methods the wrong method sometimes.
10424 2002-10-22 Miguel de Icaza <miguel@ximian.com>
10426 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
10427 CanWrite, because those refer to this particular instance of the
10428 property, and do not take into account the fact that we can
10429 override single members of a property.
10431 Constructor requires an EmitContext. The resolution process does
10432 not happen here, but we need to compute the accessors before,
10433 because the resolution does not always happen for properties.
10435 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
10436 subclass, before we did not update this flag, but we did update
10439 (GetAccessors): Drop this routine, as it did not work in the
10440 presence of partially overwritten set/get methods.
10442 Notice that this broke the cs1540 detection, but that will require
10445 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10449 * driver.cs: issue a warning instead of an error if we don't support
10450 debugging for the platform. Also ignore a couple of errors that may
10451 arise when trying to write the symbols. Undo my previous patch.
10453 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10455 * driver.cs: ignore /debug switch except for Unix platforms.
10457 2002-10-23 Nick Drochak <ndrochak@gol.com>
10459 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
10461 2002-10-21 Miguel de Icaza <miguel@ximian.com>
10463 * driver.cs: Do not make mcs-debug conditional, so we do not break
10464 builds that use it.
10466 * statement.cs (UsageVector.MergeChildren): I would like Martin to
10467 review this patch. But basically after all the children variables
10468 have been merged, the value of "Breaks" was not being set to
10469 new_breaks for Switch blocks. I think that it should be set after
10470 it has executed. Currently I set this to the value of new_breaks,
10471 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
10472 conservative, but I do not understand this code very well.
10474 I did not break anything in the build, so that is good ;-)
10476 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
10478 2002-10-20 Mark Crichton <crichton@gimp.org>
10480 * cfold.cs: Fixed compile blocker. Really fixed it this time.
10482 2002-10-20 Nick Drochak <ndrochak@gol.com>
10484 * cfold.cs: Fixed compile blocker.
10486 2002-10-20 Miguel de Icaza <miguel@ximian.com>
10488 * driver.cs: I was chekcing the key, not the file.
10490 2002-10-19 Ravi Pratap <ravi@ximian.com>
10492 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
10493 message that we were generating - we just need to silently return
10496 2002-10-19 Miguel de Icaza <miguel@ximian.com>
10498 * class.cs (Event.Define): Change my previous commit, as this
10499 breaks the debugger. This is a temporary hack, as it seems like
10500 the compiler is generating events incorrectly to begin with.
10502 * expression.cs (Binary.ResolveOperator): Added support for
10503 "U operator - (E x, E y)"
10505 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
10508 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
10509 init-only variables, but this path did not take into account that
10510 there might be also instance readonly variables. Correct this
10513 This fixes bug 32253
10515 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
10518 * driver.cs: Change the extension for modules to `netmodule'
10520 * cs-parser.jay: Improved slightly the location tracking for
10521 the debugger symbols.
10523 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
10524 modifiers that were specified instead of the hardcoded value
10525 (FamAndAssem). This was basically ignoring the static modifier,
10526 and others. Fixes 32429.
10528 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
10529 fixed a bug in the process (32476)
10531 * expression.cs (ArrayAccess.EmitAssign): Patch from
10532 hwang_rob@yahoo.ca that fixes bug 31834.3
10534 2002-10-18 Miguel de Icaza <miguel@ximian.com>
10536 * driver.cs: Make the module extension .netmodule.
10538 2002-10-16 Miguel de Icaza <miguel@ximian.com>
10540 * driver.cs: Report an error if the resource file is not found
10541 instead of crashing.
10543 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
10544 false, like Emit does.
10546 2002-10-16 Nick Drochak <ndrochak@gol.com>
10548 * typemanager.cs: Remove unused private member. Also reported mcs
10549 bug to report this as a warning like csc.
10551 2002-10-15 Martin Baulig <martin@gnome.org>
10553 * statement.cs (Statement.Emit): Made this a virtual method; emits
10554 the line number info and calls DoEmit().
10555 (Statement.DoEmit): New protected abstract method, formerly knows
10556 as Statement.Emit().
10558 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
10560 2002-10-11 Miguel de Icaza <miguel@ximian.com>
10562 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
10563 have fixed a remaining problem: not every AddXXXX was adding a
10564 fully qualified name.
10566 Now everyone registers a fully qualified name in the DeclSpace as
10567 being defined instead of the partial name.
10569 Downsides: we are slower than we need to be due to the excess
10570 copies and the names being registered this way.
10572 The reason for this is that we currently depend (on the corlib
10573 bootstrap for instance) that types are fully qualified, because
10574 we dump all the types in the namespace, and we should really have
10575 types inserted into the proper namespace, so we can only store the
10576 basenames in the defined_names array.
10578 2002-10-10 Martin Baulig <martin@gnome.org>
10580 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
10581 from bug #31834, see the bug report for a testcase which is
10584 2002-10-10 Martin Baulig <martin@gnome.org>
10586 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
10587 flow analysis code for this.
10589 * statement.cs (Do, While, For): Tell the flow analysis code about
10591 (FlowBranching.UsageVector): Added support for infinite loops.
10592 (Block.Resolve): Moved the dead code elimination here and use flow
10595 2002-10-09 Miguel de Icaza <miguel@ximian.com>
10597 * class.cs (Field.Define): Catch cycles on struct type
10600 * typemanager.cs (IsUnmanagedtype): Do not recursively check
10601 fields if the fields are static. We only need to check instance
10604 * expression.cs (As.DoResolve): Test for reference type.
10606 * statement.cs (Using.ResolveExpression): Use
10607 ConvertImplicitRequired, not ConvertImplicit which reports an
10609 (Using.ResolveLocalVariableDecls): ditto.
10611 * expression.cs (Binary.ResolveOperator): Report errors in a few
10612 places where we had to.
10614 * typemanager.cs (IsUnmanagedtype): Finish implementation.
10616 2002-10-08 Miguel de Icaza <miguel@ximian.com>
10618 * expression.cs: Use StoreFromPtr instead of extracting the type
10619 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
10621 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
10622 an enumeration value to a System.Enum, but System.Enum is not a
10623 value type, but an class type, so we need to box.
10625 (Expression.ConvertExplicit): One codepath could return
10626 errors but not flag them. Fix this. Fixes #31853
10628 * parameter.cs (Resolve): Do not allow void as a parameter type.
10630 2002-10-06 Martin Baulig <martin@gnome.org>
10632 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
10633 if it's a class type and not a struct. Fixes #31815.
10635 2002-10-06 Martin Baulig <martin@gnome.org>
10637 * statement.cs: Reworked the flow analysis code a bit to make it
10638 usable for dead code elimination.
10640 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10642 * cs-parser.jay: allow empty source files. Fixes bug #31781.
10644 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10646 * expression.cs (ComposedCast.DoResolveType): A quick workaround
10647 to fix the test 165, will investigate deeper.
10649 2002-10-04 Martin Baulig <martin@gnome.org>
10651 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
10652 finally blocks actually work.
10653 (Try.Resolve): We don't need to create a sibling for `finally' if
10654 there is no finally block.
10656 2002-10-04 Martin Baulig <martin@gnome.org>
10658 * class.cs (Constructor.Define): The default accessibility for a
10659 non-default constructor is private, not public.
10661 2002-10-04 Miguel de Icaza <miguel@ximian.com>
10663 * class.cs (Constructor): Make AllowedModifiers public, add
10666 * cs-parser.jay: Perform the modifiers test here, as the
10667 constructor for the Constructor class usually receives a zero
10668 because of the way we create it (first we create, later we
10669 customize, and we were never checking the modifiers).
10671 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
10672 is a version of LookupTypeReflection that includes the type-name
10673 cache. This can be used as a fast path for functions that know
10674 the fully qualified name and are only calling into *.GetType() to
10675 obtain a composed type.
10677 This is also used by TypeManager.LookupType during its type
10680 (LookupType): We now also track the real type name, as sometimes
10681 we can get a quey for the real type name from things like
10682 ComposedCast. This fixes bug 31422.
10684 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
10685 complete type fullname, it does not have to go through the type
10686 resolution system to obtain the composed version of the type (for
10687 obtaining arrays or pointers).
10689 (Conditional.Emit): Use the EmitBoolExpression to
10690 generate nicer code, as requested by Paolo.
10692 (ArrayCreation.CheckIndices): Use the patch from
10693 hwang_rob@yahoo.ca to validate the array initializers.
10695 2002-10-03 Miguel de Icaza <miguel@ximian.com>
10697 * class.cs (ConstructorInitializer.Emit): simplify code by using
10698 Invocation.EmitCall, and at the same time, fix the bugs in calling
10699 parent constructors that took variable arguments.
10701 * ecore.cs (Expression.ConvertNumericExplicit,
10702 Expression.ImplicitNumericConversion): Remove the code that
10703 manually wrapped decimal (InternalTypeConstructor call is now gone
10706 * expression.cs (Cast.TryReduce): Also handle decimal types when
10707 trying to perform a constant fold on the type.
10709 * typemanager.cs (IsUnmanagedtype): Partially implemented.
10711 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
10712 that only turned off an error report, and did nothing else.
10714 2002-10-02 Miguel de Icaza <miguel@ximian.com>
10716 * driver.cs: Handle and ignore /fullpaths
10718 2002-10-01 Miguel de Icaza <miguel@ximian.com>
10720 * expression.cs (Binary.ResolveOperator): Catch the case where
10721 DoNumericPromotions returns true,
10723 (Binary.DoNumericPromotions): Simplify the code, and the tests.
10725 2002-09-27 Miguel de Icaza <miguel@ximian.com>
10727 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
10730 2002-09-26 Miguel de Icaza <miguel@ximian.com>
10732 * ecore.cs (ConvertNumericExplicit): It is not enough that the
10733 conversion exists, but it is also required that the conversion be
10734 performed. This manifested in "(Type64Enum) 2".
10736 * class.cs (TypeManager.AddMethod): The fix is not to change
10737 AddEnum, because that one was using a fully qualified name (every
10738 DeclSpace derivative does), but to change the AddMethod routine
10739 that was using an un-namespaced name. This now correctly reports
10740 the duplicated name.
10742 Revert patch until I can properly fix it. The issue
10743 is that we have a shared Type space across all namespaces
10744 currently, which is wrong.
10746 Options include making the Namespace a DeclSpace, and merge
10747 current_namespace/current_container in the parser.
10749 2002-09-25 Miguel de Icaza <miguel@ximian.com>
10751 * cs-parser.jay: Improve error reporting when we get a different
10752 kind of expression in local_variable_type and
10753 local_variable_pointer_type.
10755 Propagate this to avoid missleading errors being reported.
10757 * ecore.cs (ImplicitReferenceConversion): treat
10758 TypeManager.value_type as a target just like object_type. As
10763 Is valid, and needs to result in the int 1 being boxed before it
10764 is assigned to the value type v.
10766 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
10767 to validate the enumeration name.
10769 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
10770 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
10771 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
10773 * ecore.cs (TryImplicitIntConversion): When doing an
10774 implicit-enumeration-conversion, check if the type is 64-bits and
10775 perform a conversion before passing to EnumConstant.
10777 2002-09-23 Miguel de Icaza <miguel@ximian.com>
10779 * decl.cs (Error_AmbiguousTypeReference); New routine used to
10780 report ambiguous type references. Unlike the MS version, we
10781 report what the ambiguity is. Innovation at work ;-)
10783 (DeclSpace.FindType): Require a location argument to
10784 display when we display an ambiguous error.
10786 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
10788 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
10790 * expression.cs (EmitDynamicInitializers): Apply patch from
10791 hwang_rob@yahoo.ca that fixes the order in which we emit our
10794 2002-09-21 Martin Baulig <martin@gnome.org>
10796 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
10797 delegate takes no arguments.
10799 2002-09-20 Miguel de Icaza <miguel@ximian.com>
10801 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
10804 * expression.cs: Extract the underlying type.
10806 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
10808 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
10810 2002-09-19 Miguel de Icaza <miguel@ximian.com>
10812 * class.cs (TypeContainer.DefineType): We can not use the nice
10813 PackingSize with the size set to 1 DefineType method, because it
10814 will not allow us to define the interfaces that the struct
10817 This completes the fixing of bug 27287
10819 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
10820 means also structs. This fixes part of the problem.
10821 (Expresion.ImplicitReferenceConversionExists): ditto.
10823 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
10824 error if there were no errors reported during the type lookup
10825 process, to avoid duplicates or redundant errors. Without this
10826 you would get an ambiguous errors plus a type not found. We have
10827 beaten the user enough with the first error.
10829 (DeclSparce.FindType): Emit a warning if we have an ambiguous
10832 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
10833 during the resolution process, stop the lookup, this avoids
10834 repeated error reports (same error twice).
10836 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
10838 * typemanager.cs (LookupType): Redo the type lookup code to match
10839 the needs of System.Reflection.
10841 The issue is that System.Reflection requires references to nested
10842 types to begin with a "+" sign instead of a dot. So toplevel
10843 types look like: "NameSpace.TopLevelClass", and nested ones look
10844 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
10847 2002-09-19 Martin Baulig <martin@gnome.org>
10849 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10850 says that a method always returns or always throws an exception,
10851 don't report the CS0161.
10853 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10854 set `Returns = new_returns'.
10856 2002-09-19 Martin Baulig <martin@gnome.org>
10858 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10859 to an enum constant, check for a CS0176.
10861 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10863 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10864 for operators that must be in pairs and report errors.
10866 * ecore.cs (SimpleName.DoResolveType): During the initial type
10867 resolution process, when we define types recursively, we must
10868 check first for types in our current scope before we perform
10869 lookups in the enclosing scopes.
10871 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10873 (Invocation.VerifyArgumentsCompat): Call
10874 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10875 I thought we were supposed to always call this, but there are a
10876 few places in the code where we dont do it.
10878 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10880 * driver.cs: Add support in -linkres and -resource to specify the
10881 name of the identifier.
10883 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10885 * ecore.cs (StandardConversionExists): Sync with the conversion
10886 code: allow anything-* to void* conversions.
10888 (FindMostSpecificSource): Use an Expression argument
10889 instead of a Type, because we might be handed over a Literal which
10890 gets a few more implicit conversions that plain types do not. So
10891 this information was being lost.
10893 Also, we drop the temporary type-holder expression when not
10896 2002-09-17 Martin Baulig <martin@gnome.org>
10898 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10899 this is an explicit interface implementation.
10901 2002-09-17 Martin Baulig <martin@gnome.org>
10903 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10904 different `IndexerName' attributes.
10906 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10907 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10908 virtual CommonResolve().
10910 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10912 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10913 and convert that to the UnderlyingType.
10915 * statement.cs (Foreach.Resolve): Indexers are just like variables
10916 or PropertyAccesses.
10918 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10919 inside quoted strings, we were not doing this before.
10921 2002-09-16 Martin Baulig <martin@gnome.org>
10923 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10924 resolve it. This is needed for the definite assignment check of the
10925 instance expression, fixes bug #29846.
10926 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10928 2002-09-16 Nick Drochak <ndrochak@gol.com>
10930 * parameter.cs: Fix compile error. Cannot reference static member
10931 from an instance object. Is this an mcs bug?
10933 2002-09-14 Martin Baulig <martin@gnome.org>
10935 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10936 multiple times. Fixes bug #30295, added test-166.cs.
10938 2002-09-14 Martin Baulig <martin@gnome.org>
10940 * statement.cs (Block.Emit): Don't emit unreachable code.
10941 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10942 `break' statements.
10943 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10945 2002-09-14 Martin Baulig <martin@gnome.org>
10947 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10950 2002-09-14 Martin Baulig <martin@gnome.org>
10952 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10953 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10954 be false on the ms runtime.
10956 2002-09-13 Martin Baulig <martin@gnome.org>
10958 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10959 the CS0038 error message.
10961 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10963 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10964 constant inside, return it.
10966 2002-09-12 Martin Baulig <martin@gnome.org>
10968 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10969 implicit conversion can be done between enum types.
10971 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10972 check whether an implicit conversion to the current enum's UnderlyingType
10973 exists and report an error if not.
10975 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10976 without debugging support.
10978 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10979 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10981 2002-09-12 Martin Baulig <martin@gnome.org>
10983 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10985 * ecore.cs (IMemberExpr.DeclaringType): New property.
10986 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10987 nonstatic member of an outer type (CS0038).
10989 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10991 * driver.cs: Activate the using-error detector at warning level
10992 4 (at least for MS-compatible APIs).
10994 * namespace.cs (VerifyUsing): Small buglett fix.
10996 * pending.cs (PendingImplementation): pass the container pointer.
10998 * interface.cs (GetMethods): Allow for recursive definition. Long
10999 term, I would like to move every type to support recursive
11000 definitions, not the current ordering mechanism that we have right
11003 The situation is this: Attributes are handled before interfaces,
11004 so we can apply attributes to interfaces. But some attributes
11005 implement interfaces, we will now handle the simple cases
11006 (recursive definitions will just get an error).
11008 * parameter.cs: Only invalidate types at the end if we fail to
11011 2002-09-09 Martin Baulig <martin@gnome.org>
11013 * ecore.cs (PropertyExpr.Emit): Also check for
11014 TypeManager.system_int_array_get_length so this'll also work when
11015 compiling corlib. Fixes #30003.
11017 2002-09-09 Martin Baulig <martin@gnome.org>
11019 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
11020 and throw an exception if we can't get the type's size. Fixed #30040,
11023 2002-09-09 Martin Baulig <martin@gnome.org>
11025 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
11027 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
11028 context. Fixes bug #30027.
11030 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
11031 virtual functions. Fixes bug #30043, added test-164.cs.
11033 2002-09-08 Ravi Pratap <ravi@ximian.com>
11035 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
11037 2002-09-08 Nick Drochak <ndrochak@gol.com>
11039 * driver.cs: Use an object to get the windows codepage since it's not a
11042 2002-09-08 Miguel de Icaza <miguel@ximian.com>
11044 * statement.cs (For.Emit): for infinite loops (test == null)
11045 return whether there is a break inside, not always "true".
11047 * namespace.cs (UsingEntry): New struct to hold the name of the
11048 using definition, the location where it is defined, and whether it
11049 has been used in a successful type lookup.
11051 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
11056 2002-09-06 Ravi Pratap <ravi@ximian.com>
11058 * attribute.cs : Fix incorrect code which relied on catching
11059 a NullReferenceException to detect a null being passed in
11060 where an object was expected.
11062 2002-09-06 Miguel de Icaza <miguel@ximian.com>
11064 * statement.cs (Try): flag the catch variable as assigned
11066 * expression.cs (Cast): Simplified by using ResolveType instead of
11067 manually resolving.
11069 * statement.cs (Catch): Fix bug by using ResolveType.
11071 2002-09-06 Ravi Pratap <ravi@ximian.com>
11073 * expression.cs (BetterConversion): Special case for when we have
11074 a NullLiteral as the argument and we have to choose between string
11075 and object types - we choose string the way csc does.
11077 * attribute.cs (Attribute.Resolve): Catch the
11078 NullReferenceException and report error #182 since the Mono
11079 runtime no more has the bug and having this exception raised means
11080 we tried to select a constructor which takes an object and is
11083 2002-09-05 Ravi Pratap <ravi@ximian.com>
11085 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
11086 message (1502, 1503) when we can't locate a method after overload
11087 resolution. This is much more informative and closes the bug
11090 * interface.cs (PopulateMethod): Return if there are no argument
11091 types. Fixes a NullReferenceException bug.
11093 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
11094 expressions too. Previously we were checking only in one place for
11095 positional arguments leaving out named arguments.
11097 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
11098 type to the enum type is not allowed. Remove code corresponding to
11101 (ConvertNumericExplicit): Allow explicit conversions from
11102 the underlying type to enum type. This precisely follows the spec
11103 and closes a bug filed by Gonzalo.
11105 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11108 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
11110 2002-09-03 Miguel de Icaza <miguel@ximian.com>
11112 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
11113 it was important that we stored the right value after the
11114 reduction in `converted'.
11116 2002-09-04 Martin Baulig <martin@gnome.org>
11118 * location.cs (Location.SymbolDocument): Use full pathnames for the
11121 2002-08-30 Miguel de Icaza <miguel@ximian.com>
11123 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
11124 of the expression resolve mechanism, because that will catch the
11125 SimpleName error failures.
11127 (Conditional): If we can not resolve the
11128 expression, return, do not crash.
11130 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11133 (location): display token name instead of its number.
11135 2002-08-28 Martin Baulig <martin@gnome.org>
11137 * expression.cs (Binary.ResolveOperator): Don't silently return
11138 but return an error if an operator cannot be applied between two
11141 2002-08-28 Martin Baulig <martin@gnome.org>
11143 * class.cs (Constructor.Define): Set the permission attributes
11144 correctly instead of making all constructors public.
11146 2002-08-28 Martin Baulig <martin@gnome.org>
11148 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
11149 for private members before reporting a CS0103; if we find anything,
11152 2002-08-28 Martin Baulig <martin@gnome.org>
11154 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
11155 to check whether `closure_start_type == closure_invocation_type',
11156 we also need to check whether `m.DeclaringType == closure_invocation_type'
11157 before bypassing the permission checks. We might be accessing
11158 protected/private members from the base class.
11159 (TypeManager.RealMemberLookup): Only set private_ok if private
11160 members were requested via BindingFlags.NonPublic.
11162 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
11164 * expression.cs (MemberAccess.ResolveMemberAccess): Set
11165 MethodGroupExpr.IsExplicitImpl if appropriate.
11166 (Invocation.DoResolve): Don't report the CS0120 for explicit
11167 interface implementations.
11169 2002-08-27 Martin Baulig <martin@gnome.org>
11171 * expression.cs (Invocation.DoResolve): If this is a static
11172 method and we don't have an InstanceExpression, we must report
11175 2002-08-25 Martin Baulig <martin@gnome.org>
11177 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
11178 `==' between a valuetype and an object.
11180 2002-08-25 Miguel de Icaza <miguel@ximian.com>
11182 * ecore.cs (TypeExpr): Provide a ToString method.
11184 2002-08-24 Martin Baulig <martin@gnome.org>
11186 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
11187 now called proggie.dbg and it's a binary file.
11189 2002-08-23 Martin Baulig <martin@gnome.org>
11191 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
11193 2002-08-23 Martin Baulig <martin@gnome.org>
11195 * struct.cs (MyStructInfo.ctor): Make this work with empty
11196 structs; it's not allowed to use foreach() on null.
11198 2002-08-23 Martin Baulig <martin@gnome.org>
11200 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
11201 writer the full pathname of the generated assembly.
11203 2002-08-23 Martin Baulig <martin@gnome.org>
11205 * statements.cs (FlowBranching.UsageVector.MergeChildren):
11206 A `finally' block never returns or breaks; improved handling of
11209 2002-08-23 Martin Baulig <martin@gnome.org>
11211 * statement.cs (Throw.Resolve): Allow `throw null'.
11213 2002-08-23 Martin Baulig <martin@gnome.org>
11215 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
11216 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
11217 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
11218 MemberLookup would return a wrong event if this is an explicit
11219 interface implementation and the class has an event with the same
11222 2002-08-23 Martin Baulig <martin@gnome.org>
11224 * statement.cs (Block.AddChildVariableNames): New public method.
11225 (Block.AddChildVariableName): Likewise.
11226 (Block.IsVariableNameUsedInChildBlock): Likewise.
11227 (Block.AddVariable): Check whether a variable name has already
11228 been used in a child block.
11230 * cs-parser.jay (declare_local_variables): Mark all variable names
11231 from the current block as being used in a child block in the
11234 2002-08-23 Martin Baulig <martin@gnome.org>
11236 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
11237 find the symbol writer.
11239 * driver.cs: csc also allows the arguments to /define being
11240 separated by commas, not only by semicolons.
11242 2002-08-23 Martin Baulig <martin@gnome.org>
11244 * interface.cs (Interface.GetMembers): Added static check for events.
11246 2002-08-15 Martin Baulig <martin@gnome.org>
11248 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
11249 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
11251 * ecore.cs (Expression.MemberLookup): Added documentation and explained
11252 why the MethodData.EmitDestructor() change was necessary.
11254 2002-08-20 Martin Baulig <martin@gnome.org>
11256 * class.cs (TypeContainer.FindMembers): Added static check for events.
11258 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
11260 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
11261 use Type.GetEvents(), not Type.FindMembers().
11263 2002-08-20 Martin Baulig <martin@gnome.org>
11265 * decl.cs (MemberCache): Added a special method cache which will
11266 be used for method-only searched. This ensures that a method
11267 search will return a MethodInfo with the correct ReflectedType for
11270 2002-08-20 Martin Baulig <martin@gnome.org>
11272 * decl.cs (DeclSpace.FindMembers): Made this public.
11274 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11276 * delegate.cs: fixed build on windows.
11277 [FIXME: Filed as bug #29150: MCS must report these errors.]
11279 2002-08-19 Ravi Pratap <ravi@ximian.com>
11281 * ecore.cs (StandardConversionExists): Return a false
11282 if we are trying to convert the void type to anything else
11283 since that is not allowed.
11285 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
11286 we flag error 70 in the event an event is trying to be accessed
11287 directly from outside the declaring type.
11289 2002-08-20 Martin Baulig <martin@gnome.org>
11291 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
11292 MemberCache from typemanager.cs to decl.cs.
11294 2002-08-19 Martin Baulig <martin@gnome.org>
11296 * class.cs (TypeContainer): Implement IMemberContainer.
11297 (TypeContainer.DefineMembers): Create the MemberCache.
11298 (TypeContainer.FindMembers): Do better BindingFlags checking; only
11299 return public members if BindingFlags.Public was given, check
11300 whether members are static.
11302 2002-08-16 Martin Baulig <martin@gnome.org>
11304 * decl.cs (DeclSpace.Define): Splitted this in Define and
11305 DefineMembers. DefineMembers is called first and initializes the
11308 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
11309 DefineMembers() on all our DeclSpaces.
11311 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
11312 but call DefineMembers() on all nested interfaces. We call their
11313 Define() in our new Define() function.
11315 * interface.cs (Interface): Implement IMemberContainer.
11316 (Interface.Define): Moved all code except the attribute stuf to
11318 (Interface.DefineMembers): Initialize the member cache.
11320 * typemanager.cs (IMemberFinder): Removed this interface, we don't
11321 need this anymore since we can use MemberCache.FindMembers directly.
11323 2002-08-19 Martin Baulig <martin@gnome.org>
11325 * typemanager.cs (MemberCache): When creating the cache for an
11326 interface type, add all inherited members.
11327 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
11328 to `out bool used_cache' and documented it.
11329 (TypeManager.MemberLookup): If we already used the cache in the first
11330 iteration, we don't need to do the interfaces check.
11332 2002-08-19 Martin Baulig <martin@gnome.org>
11334 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
11335 here from IMemberFinder and don't implement this interface anymore.
11336 (DeclSpace.MemberCache): Moved here from IMemberFinder.
11338 * typemanager.cs (IMemberFinder): This interface is now only used by
11339 classes which actually support the member cache.
11340 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
11341 since we only put DeclSpaces into this Hashtable.
11342 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
11343 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
11345 2002-08-16 Martin Baulig <martin@gnome.org>
11347 * typemanager.cs (ICachingMemberFinder): Removed.
11348 (IMemberFinder.MemberCache): New property.
11349 (TypeManager.FindMembers): Merged this with RealFindMembers().
11350 This function will never be called from TypeManager.MemberLookup()
11351 so we can't use the cache here, just the IMemberFinder.
11352 (TypeManager.MemberLookup_FindMembers): Check whether the
11353 IMemberFinder has a MemberCache and call the cache's FindMembers
11355 (MemberCache): Rewrote larger parts of this yet another time and
11356 cleaned it up a bit.
11358 2002-08-15 Miguel de Icaza <miguel@ximian.com>
11360 * driver.cs (LoadArgs): Support quoting.
11362 (Usage): Show the CSC-like command line arguments.
11364 Improved a few error messages.
11366 2002-08-15 Martin Baulig <martin@gnome.org>
11368 * typemanager.cs (IMemberContainer.Type): New property.
11369 (IMemberContainer.IsInterface): New property.
11371 The following changes are conditional to BROKEN_RUNTIME, which is
11372 defined at the top of the file.
11374 * typemanager.cs (MemberCache.MemberCache): Don't add the base
11375 class'es members, but add all members from TypeHandle.ObjectType
11376 if we're an interface.
11377 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
11378 is the current type.
11379 (MemberCache.CacheEntry.Container): Removed this field.
11380 (TypeHandle.GetMembers): Include inherited members.
11382 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11384 * typemanager.cs: fixed compilation and added a comment on a field that
11387 2002-08-15 Martin Baulig <martin@gnome.org>
11389 * class.cs (ConstructorInitializer.Resolve): In the
11390 Expression.MemberLookup call, use the queried_type as
11393 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
11394 declared' attribute, it's always true.
11395 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
11396 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
11397 temporary wrapper for FindMembers which tells MemberLookup whether
11398 members from the base classes are included in the return value.
11399 This will go away soon.
11400 (TypeManager.MemberLookup): Use this temporary hack here; once the
11401 new MemberCache is completed, we don't need to do the DeclaredOnly
11402 looping here anymore since the MemberCache will take care of this.
11403 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
11404 (MemberCache): When creating the MemberCache for a class, get
11405 members from the current class and all its base classes.
11406 (MemberCache.CacheEntry.Container): New field. This is a
11407 temporary hack until the Mono runtime is fixed to distinguish
11408 between ReflectedType and DeclaringType. It allows us to use MCS
11409 with both the MS runtime and the unfixed Mono runtime without
11410 problems and without accecting performance.
11411 (MemberCache.SearchMembers): The DeclaredOnly looping from
11412 TypeManager.MemberLookup is now done here.
11414 2002-08-14 Martin Baulig <martin@gnome.org>
11416 * statement.cs (MyStructInfo.MyStructInfo): Don't call
11417 Type.GetFields on dynamic types but get the fields from the
11418 corresponding TypeContainer.
11419 (MyStructInfo.GetStructInfo): Added check for enum types.
11421 * typemanager.cs (MemberList.IsSynchronized): Implemented.
11422 (MemberList.SyncRoot): Implemented.
11423 (TypeManager.FilterWithClosure): No need to check permissions if
11424 closure_start_type == closure_invocation_type, don't crash if
11425 closure_invocation_type is null.
11427 2002-08-13 Martin Baulig <martin@gnome.org>
11429 Rewrote TypeContainer.FindMembers to use a member cache. This
11430 gives us a speed increase of about 35% for the self-hosting MCS
11431 build and of about 15-20% for the class libs (both on GNU/Linux).
11433 * report.cs (Timer): New class to get enhanced profiling. This
11434 whole class is "TIMER" conditional since it remarkably slows down
11437 * class.cs (MemberList): New class. This is an IList wrapper
11438 which we're now using instead of passing MemberInfo[]'s around to
11439 avoid copying this array unnecessarily.
11440 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
11441 (ICachingMemberFinder, IMemberContainer): New interface.
11442 (TypeManager.FilterWithClosure): If `criteria' is null, the name
11443 has already been checked, otherwise use it for the name comparision.
11444 (TypeManager.FindMembers): Renamed to RealMemberFinder and
11445 provided wrapper which tries to use ICachingMemberFinder.FindMembers
11446 if possible. Returns a MemberList, not a MemberInfo [].
11447 (TypeHandle): New class, implements IMemberContainer. We create
11448 one instance of this class per type, it contains a MemberCache
11449 which is used to do the member lookups.
11450 (MemberCache): New class. Each instance of this class contains
11451 all members of a type and a name-based hash table.
11452 (MemberCache.FindMembers): This is our new member lookup
11453 function. First, it looks up all members of the requested name in
11454 the hash table. Then, it walks this list and sorts out all
11455 applicable members and returns them.
11457 2002-08-13 Martin Baulig <martin@gnome.org>
11459 In addition to a nice code cleanup, this gives us a performance
11460 increase of about 1.4% on GNU/Linux - not much, but it's already
11461 half a second for the self-hosting MCS compilation.
11463 * typemanager.cs (IMemberFinder): New interface. It is used by
11464 TypeManager.FindMembers to call FindMembers on a TypeContainer,
11465 Enum, Delegate or Interface.
11466 (TypeManager.finder_to_member_finder): New PtrHashtable.
11467 (TypeManager.finder_to_container): Removed.
11468 (TypeManager.finder_to_delegate): Removed.
11469 (TypeManager.finder_to_interface): Removed.
11470 (TypeManager.finder_to_enum): Removed.
11472 * interface.cs (Interface): Implement IMemberFinder.
11474 * delegate.cs (Delegate): Implement IMemberFinder.
11476 * enum.cs (Enum): Implement IMemberFinder.
11478 * class.cs (TypeContainer): Implement IMemberFinder.
11480 2002-08-12 Martin Baulig <martin@gnome.org>
11482 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
11484 2002-08-12 Martin Baulig <martin@gnome.org>
11486 * ecore.cs (ITypeExpression): New interface for expressions which
11488 (TypeExpression): Renamed to TypeLookupExpression.
11489 (Expression.DoResolve): If we're doing a types-only lookup, the
11490 expression must implement the ITypeExpression interface and we
11491 call DoResolveType() on it.
11492 (SimpleName): Implement the new ITypeExpression interface.
11493 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
11494 hack, the situation that we're only looking up types can't happen
11495 anymore when this method is called. Moved the type lookup code to
11496 DoResolveType() and call it.
11497 (SimpleName.DoResolveType): This ITypeExpression interface method
11498 is now doing the types-only lookup.
11499 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
11500 (ResolveFlags): Added MaskExprClass.
11502 * expression.cs (MemberAccess): Implement the ITypeExpression
11504 (MemberAccess.DoResolve): Added support for a types-only lookup
11505 when we're called via ITypeExpression.DoResolveType().
11506 (ComposedCast): Implement the ITypeExpression interface.
11508 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
11509 Expression.Resolve() with ResolveFlags.Type instead.
11511 2002-08-12 Martin Baulig <martin@gnome.org>
11513 * interface.cs (Interface.Define): Apply attributes.
11515 * attribute.cs (Attribute.ApplyAttributes): Added support for
11516 interface attributes.
11518 2002-08-11 Martin Baulig <martin@gnome.org>
11520 * statement.cs (Block.Emit): Only check the "this" variable if we
11521 do not always throw an exception.
11523 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
11524 whether the property has a set accessor.
11526 2002-08-11 Martin Baulig <martin@gnome.org>
11528 Added control flow analysis support for structs.
11530 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
11531 with control flow analysis turned off.
11532 (IVariable): New interface.
11533 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
11534 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
11535 (FieldExpr.DoResolve): Resolve the instance expression with flow
11536 analysis turned off and do the definite assignment check after the
11537 resolving when we know what the expression will resolve to.
11539 * expression.cs (LocalVariableReference, ParameterReference):
11540 Implement the new IVariable interface, only call the flow analysis
11541 code if ec.DoFlowAnalysis is true.
11542 (This): Added constructor which takes a Block argument. Implement
11543 the new IVariable interface.
11544 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
11545 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
11546 This does the definite assignment checks for struct members.
11548 * class.cs (Constructor.Emit): If this is a non-static `struct'
11549 constructor which doesn't have any initializer, call
11550 Block.AddThisVariable() to tell the flow analysis code that all
11551 struct elements must be initialized before control returns from
11554 * statement.cs (MyStructInfo): New public class.
11555 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
11556 argument to this indexer. If non-zero, check an individual struct
11557 member, not the whole struct.
11558 (FlowBranching.CheckOutParameters): Check struct members.
11559 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
11560 overloaded versions of these methods which take an additional
11561 `int field_idx' argument to check struct members.
11562 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
11563 overloaded versions of these methods which take an additional
11564 `string field_name' argument to check struct member.s
11565 (VariableInfo): Implement the IVariable interface.
11566 (VariableInfo.StructInfo): New public property. Returns the
11567 MyStructInfo instance of the variable if it's a struct or null.
11568 (Block.AddThisVariable): New public method. This is called from
11569 Constructor.Emit() for non-static `struct' constructor which do
11570 not have any initializer. It creates a special variable for the
11571 "this" instance variable which will be checked by the flow
11572 analysis code to ensure that all of the struct's fields are
11573 initialized before control returns from the constructor.
11574 (UsageVector): Added support for struct members. If a
11575 variable/parameter is a struct with N members, we reserve a slot
11576 in the usage vector for each member. A struct is considered fully
11577 initialized if either the struct itself (slot 0) or all its
11578 members are initialized.
11580 2002-08-08 Martin Baulig <martin@gnome.org>
11582 * driver.cs (Driver.MainDriver): Only report an error CS5001
11583 if there were no compilation errors.
11585 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
11586 `UnsafeContext' property to determine whether the parent is in
11587 unsafe context rather than checking the parent's ModFlags:
11588 classes nested in an unsafe class are unsafe as well.
11590 2002-08-08 Martin Baulig <martin@gnome.org>
11592 * statement.cs (UsageVector.MergeChildren): Distinguish between
11593 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
11594 we return. Added test17() and test18() to test-154.cs.
11596 2002-08-08 Martin Baulig <martin@gnome.org>
11598 * typemanager.cs (TypeManager.FilterWithClosure): If we have
11599 Family access, make sure the invoking type isn't a subclass of the
11600 queried type (that'd be a CS1540).
11602 * ecore.cs (Expression.MemberLookup): Added overloaded version of
11603 this method which takes an additional `Type invocation_type'.
11605 * expression.cs (BaseAccess.DoResolve): Use the base type as
11606 invocation and query type.
11607 (MemberAccess.DoResolve): If the lookup failed and we're about to
11608 report a CS0122, try a lookup with the ec.ContainerType - if this
11609 succeeds, we must report a CS1540.
11611 2002-08-08 Martin Baulig <martin@gnome.org>
11613 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
11614 (MethodGroupExpr): Implement the IMemberExpr interface.
11616 * expression (MemberAccess.ResolveMemberAccess): No need to have
11617 any special code for MethodGroupExprs anymore, they're now
11620 2002-08-08 Martin Baulig <martin@gnome.org>
11622 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
11623 Family, FamANDAssem and FamORAssem permissions.
11624 (TypeManager.IsSubclassOrNestedChildOf): New public method.
11626 2002-08-08 Martin Baulig <martin@gnome.org>
11628 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
11629 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
11632 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
11634 * driver.cs: implemented /resource option to embed managed resources.
11636 2002-08-07 Martin Baulig <martin@gnome.org>
11638 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
11639 (FieldBase.HasFieldInitializer): New public property.
11640 (FieldBase.GetInitializerExpression): New public method. Resolves and
11641 returns the field initializer and makes sure it is only resolved once.
11642 (TypeContainer.EmitFieldInitializers): Call
11643 FieldBase.GetInitializerExpression to get the initializer, this ensures
11644 that it isn't resolved multiple times.
11646 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
11647 the resolving process (SimpleName/MemberLookup) that we're currently
11648 emitting a field initializer (which must not access any instance members,
11649 this is an error CS0236).
11651 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
11652 argument, if the `IsFieldInitializer' flag is set, we must report and
11653 error CS0236 and not an error CS0120.
11655 2002-08-07 Martin Baulig <martin@gnome.org>
11657 * ecore.cs (IMemberExpr): New public interface.
11658 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
11659 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
11660 if the expression is an IMemberExpr.
11662 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
11663 to be null, implicitly default to `this' if we're non-static in
11664 this case. Simplified the code a lot by using the new IMemberExpr
11665 interface. Also fixed bug #28176 here.
11667 2002-08-06 Martin Baulig <martin@gnome.org>
11669 * cs-parser.jay (SimpleLookup): Removed. We need to create
11670 ParameterReferences during semantic analysis so that we can do a
11671 type-only search when resolving Cast, TypeOf and SizeOf.
11672 (block): Pass the `current_local_parameters' to the Block's
11675 * class.cs (ConstructorInitializer): Added `Parameters parameters'
11676 argument to the constructor.
11677 (ConstructorInitializer.Resolve): Create a temporary implicit
11678 block with the parameters.
11680 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
11681 references here if we aren't doing a type-only search.
11683 * statement.cs (Block): Added constructor which takes a
11684 `Parameters parameters' argument.
11685 (Block.Parameters): New public property.
11687 * support.cs (InternalParameters.Parameters): Renamed `parameters'
11688 to `Parameters' and made it public readonly.
11690 2002-08-06 Martin Baulig <martin@gnome.org>
11692 * ecore.cs (Expression.Warning): Made this public as well.
11694 * report.cs (Report.Debug): Print the contents of collections.
11696 2002-08-06 Martin Baulig <martin@gnome.org>
11698 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
11699 used to tell Resolve() which kinds of expressions it may return.
11700 (Expression.Resolve): Added overloaded version of this method which
11701 takes a `ResolveFlags flags' argument. This can be used to tell
11702 Resolve() which kinds of expressions it may return. Reports a
11704 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
11705 ResolveFlags.SimpleName.
11706 (Expression.Error118): Added overloaded version of this method which
11707 takes a `ResolveFlags flags' argument. It uses the flags to determine
11708 which kinds of expressions are allowed.
11710 * expression.cs (Argument.ResolveMethodGroup): New public method.
11711 Resolves an argument, but allows a MethodGroup to be returned.
11712 This is used when invoking a delegate.
11714 * TODO: Updated a bit.
11716 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11718 Fixed compilation with csc.
11720 * ecore.cs: Expression.Error made public. Is this correct? Should
11721 Warning be made public too?
11723 * expression.cs: use ea.Location instead of ea.loc.
11724 [FIXME: Filed as bug #28607: MCS must report these errors.]
11726 2002-08-06 Martin Baulig <martin@gnome.org>
11728 * ecore.cs (Expression.loc): Moved the location here instead of
11729 duplicating it in all derived classes.
11730 (Expression.Location): New public property.
11731 (Expression.Error, Expression.Warning): Made them non-static and
11732 removed the location argument.
11733 (Expression.Warning): Added overloaded version which takes an
11734 `int level' argument.
11735 (Expression.Error118): Make this non-static and removed the
11736 expression and location arguments.
11737 (TypeExpr): Added location argument to the constructor.
11739 * expression.cs (StaticCallExpr): Added location argument to
11741 (Indirection, PointerArithmetic): Likewise.
11742 (CheckedExpr, UnCheckedExpr): Likewise.
11743 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
11744 (StringPtr): Likewise.
11747 2002-08-05 Martin Baulig <martin@gnome.org>
11749 * expression.cs (BaseAccess.DoResolve): Actually report errors.
11751 * assign.cs (Assign.DoResolve): Check whether the source
11752 expression is a value or variable.
11754 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
11755 while resolving the corresponding blocks.
11757 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
11758 an error, don't silently return null.
11760 * statement.cs (Block.AddVariable): Do the error reporting here
11761 and distinguish between CS0128 and CS0136.
11762 (Block.DoResolve): Report all unused labels (warning CS0164).
11763 (LabeledStatement): Pass the location to the constructor.
11764 (LabeledStatement.HasBeenReferenced): New property.
11765 (LabeledStatement.Resolve): Set it to true here.
11767 * statement.cs (Return.Emit): Return success even after reporting
11768 a type mismatch error (CS0126 or CS0127), this is what csc does and
11769 it avoids confusing the users with any consecutive errors.
11771 2002-08-05 Martin Baulig <martin@gnome.org>
11773 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
11775 * const.cs (Const.LookupConstantValue): Catch circular definitions.
11777 * expression.cs (MemberAccess.DoResolve): Silently return if an
11778 error has already been reported.
11780 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
11781 error has already been reported.
11783 2002-08-05 Martin Baulig <martin@gnome.org>
11785 * statement.cs (UsageVector): Only initialize the `parameters'
11786 vector if we actually have any "out" parameters.
11788 2002-08-05 Martin Baulig <martin@gnome.org>
11790 * expression.cs (Binary.ResolveOperator): When combining delegates,
11791 they must have the same type.
11793 2002-08-05 Martin Baulig <martin@gnome.org>
11795 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
11796 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
11797 work with the ms runtime and we also don't need it: if we're a
11798 PropertyBuilder and not in the `indexer_arguments' hash, then we
11799 are a property and not an indexer.
11801 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
11802 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
11803 since the latter one doesn't work with the ms runtime.
11805 2002-08-03 Martin Baulig <martin@gnome.org>
11807 Fixed bugs #27998 and #22735.
11809 * class.cs (Method.IsOperator): New public field.
11810 (Method.CheckBase): Report CS0111 if there's already a method
11811 with the same parameters in the current class. Report CS0508 when
11812 attempting to change the return type of an inherited method.
11813 (MethodData.Emit): Report CS0179 if a method doesn't have a body
11814 and it's not marked abstract or extern.
11815 (PropertyBase): New abstract base class for Property and Indexer.
11816 (PropertyBase.CheckBase): Moved here from Property and made it work
11818 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
11819 the same so we can reuse it there.
11820 (Property, Indexer): Derive from PropertyBase.
11821 (MethodSignature.inheritable_property_signature_filter): New delegate
11822 to find properties and indexers.
11824 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
11825 argument and improved error reporting.
11827 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
11828 EmptyReadOnlyParameters and made it a property.
11830 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
11831 version of this method which takes a `PropertyInfo indexer'.
11832 (TypeManager.RegisterIndexer): New method.
11834 * class.cs: Added myself as author of this file :-)
11836 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11838 * class.cs: fixed compilation on windoze.
11840 2002-08-03 Martin Baulig <martin@gnome.org>
11842 * interface.cs (Interface.GetInterfaceBases): Check whether all
11843 base interfaces are at least as accessible than the current one.
11845 * class.cs (TypeContainer.GetClassBases): Check whether base types
11846 are at least as accessible than the current type.
11847 (TypeContainer.AsAccessible): Implemented and made non-static.
11848 (MemberBase.CheckParameters): Report errors if the accessibility
11851 * delegate.cs (Delegate.Delegate): The default visibility is
11852 internal for top-level types and private for nested types.
11853 (Delegate.Define): Report errors if the accessibility checks fail.
11855 * enum.cs (Enum.Enum): The default visibility is internal for
11856 top-level types and private for nested types.
11857 (Enum.DefineType): Compute the correct visibility.
11859 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11860 function which takes a `bool is_toplevel' instead of a TypeContainer.
11862 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11865 2002-08-02 Martin Baulig <martin@gnome.org>
11867 * expression.cs (LocalVariableReferenc): Added constructor which
11868 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11869 (LocalVariableReference.IsReadOnly): New property.
11870 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11871 variable is readonly, use our own readonly flag to do this; you can
11872 use the new constructor to get a writable reference to a read-only
11875 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11876 reference to the local variable.
11878 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11880 * rootcontext.cs (ResolveCore): Also include System.Exception
11882 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11883 we reach an EmptyStatement.
11885 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11888 * expression.cs (Binary.ResolveOperator): Check error result in
11891 use brtrue/brfalse directly and avoid compares to null.
11893 2002-08-02 Martin Baulig <martin@gnome.org>
11895 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11896 Fixes bug #28407, added test-155.cs.
11898 2002-08-01 Martin Baulig <martin@gnome.org>
11900 * class.cs (Event.EmitDefaultMethod): Make this work with static
11901 events. Fixes #28311, added verify-3.cs.
11903 2002-08-01 Martin Baulig <martin@gnome.org>
11905 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11906 `is_disposable' fields.
11907 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11908 `hm.is_disposable' if we're using the collection pattern.
11909 (Foreach.EmitCollectionForeach): Use the correct type for the
11910 enumerator's local variable, only emit the try/finally block if
11911 necessary (fixes #27713).
11913 2002-08-01 Martin Baulig <martin@gnome.org>
11915 * ecore.cs (Expression.report118): Renamed to Error118 and made
11918 * statement.cs (Throw.Resolve): Check whether the expression is of
11919 the correct type (CS0118) and whether the type derives from
11920 System.Exception (CS0155).
11921 (Catch.Resolve): New method. Do the type lookup here and check
11922 whether it derives from System.Exception (CS0155).
11923 (Catch.CatchType, Catch.IsGeneral): New public properties.
11925 * typemanager.cs (TypeManager.exception_type): Added.
11927 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11929 * driver.cs: Updated About function.
11931 2002-07-31 Martin Baulig <martin@gnome.org>
11933 Implemented Control Flow Analysis.
11935 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11936 (EmitContext.CurrentBranching): Added.
11937 (EmitContext.StartFlowBranching): Added.
11938 (EmitContext.EndFlowBranching): Added.
11939 (EmitContext.KillFlowBranching): Added.
11940 (EmitContext.IsVariableAssigned): Added.
11941 (EmitContext.SetVariableAssigned): Added.
11942 (EmitContext.IsParameterAssigned): Added.
11943 (EmitContext.SetParameterAssigned): Added.
11944 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11945 Added control flow analysis stuff here.
11947 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11948 resolve the expression as lvalue.
11949 (LocalVariableReference.DoResolve): Check whether the variable has
11950 already been assigned.
11951 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11952 the parameter as assigned here.
11953 (ParameterReference.DoResolve): Check whether the parameter has already
11955 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11956 expression as lvalue.
11958 * statement.cs (FlowBranching): New class for the flow analysis code.
11959 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11960 (LabeledStatement.IsDefined): New public property.
11961 (LabeledStatement.AddUsageVector): New public method to tell flow
11962 analyis that the label may be reached via a forward jump.
11963 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11965 (VariableInfo.Number): New public field. This is used by flow analysis
11966 to number all locals of a block.
11967 (Block.CountVariables): New public property. This is the number of
11968 local variables in this block (including the locals from all parent
11970 (Block.EmitMeta): Number all the variables.
11972 * statement.cs: Added flow analysis support to all classes.
11974 2002-07-31 Martin Baulig <martin@gnome.org>
11976 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11977 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11978 then use this argument.
11980 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11982 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11983 use this to specify /define options.
11985 2002-07-29 Martin Baulig <martin@gnome.org>
11987 * statement.cs (Fixed): Moved all code that does variable lookups
11988 and resolvings from Emit to Resolve.
11990 * statement.cs (For): Moved all code that does variable lookups
11991 and resolvings from Emit to Resolve.
11993 * statement.cs (Using): Moved all code that does variable lookups
11994 and resolvings from Emit to Resolve.
11996 2002-07-29 Martin Baulig <martin@gnome.org>
11998 * attribute.cs (Attribute.Resolve): Explicitly catch a
11999 System.NullReferenceException when creating the
12000 CustromAttributeBuilder and report a different warning message.
12002 2002-07-29 Martin Baulig <martin@gnome.org>
12004 * support.cs (ParameterData.ParameterName): Added method to
12005 get the name of a parameter.
12007 * typemanager.cs (TypeManager.IsValueType): New public method.
12009 2002-07-29 Martin Baulig <martin@gnome.org>
12011 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
12012 is a flag which specifies that it's either ref or out.
12013 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
12014 the out parameter to `out Parameter.Modifier mod', also set the
12015 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
12017 * support.cs (InternalParameters.ParameterModifier): Distinguish
12018 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12019 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12021 * expression.cs (Argument.GetParameterModifier): Distinguish
12022 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
12023 Parameter.Modifier.ISBYREF flag if it's either ref or out.
12025 2002-07-29 Martin Baulig <martin@gnome.org>
12027 * expression.cs (ParameterReference.ParameterReference): Added
12028 `Location loc' argument to the constructor.
12030 * cs-parser.jay: Pass location to ParameterReference.
12032 2002-07-28 Miguel de Icaza <miguel@ximian.com>
12034 * statement.cs (Try): Initialize the location.
12036 * cs-parser.jay: pass location to Try.
12038 * expression.cs (Unary.Reduce): Change the prototype to return
12039 whether a constant fold could be performed or not. The result is
12040 returned in an out parameters. In the case of Indirection and
12041 AddressOf, we want to perform the full tests.
12043 2002-07-26 Miguel de Icaza <miguel@ximian.com>
12045 * statement.cs (Statement.Emit): Flag dead code.
12047 2002-07-27 Andrew Birkett <andy@nobugs.org>
12049 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
12051 2002-07-27 Martin Baulig <martin@gnome.org>
12053 * class.cs (MethodData.Define): Put back call to
12054 TypeManager.AddMethod(), accidentally commented this out.
12056 * report.cs (Debug): New public method to print debugging information,
12057 this is `[Conditional ("DEBUG")]'.
12059 2002-07-26 Martin Baulig <martin@gnome.org>
12061 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
12062 (switch_statement): Push the current_block to the switch_stack and
12063 pop it again when we're done with the switch.
12064 (switch_section): The new block is a child of the current_block.
12065 Fixes bug #24007, added test-152.cs.
12067 2002-07-27 Martin Baulig <martin@gnome.org>
12069 * expression.cs (Invocation.EmitArguments): When calling a varargs
12070 function with only its fixed arguments, we need to pass an empty
12073 2002-07-27 Martin Baulig <martin@gnome.org>
12075 Mono 0.13 has been released.
12077 2002-07-25 Miguel de Icaza <miguel@ximian.com>
12079 * driver.cs: Rename --resource to --linkres, because that is what
12080 we do currently, we dont support --resource yet.
12082 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
12084 2002-07-25 Martin Baulig <martin@gnome.org>
12086 * class.cs (MethodData): New public class. This is a `method builder'
12087 class for a method or one accessor of a Property/Indexer/Event.
12088 (MethodData.GetMethodFlags): Moved here from MemberBase.
12089 (MethodData.ApplyAttributes): Likewise.
12090 (MethodData.ApplyObsoleteAttribute): Likewise.
12091 (MethodData.ApplyConditionalAttribute): Likewise.
12092 (MethodData.ApplyDllImportAttribute): Likewise.
12093 (MethodData.CheckAbstractAndExternal): Likewise.
12094 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
12095 (MethodData.Emit): Formerly known as Method.Emit().
12096 (MemberBase): Moved everything which was specific to a single
12097 accessor/method to MethodData.
12098 (Method): Create a new MethodData and call Define() and Emit() on it.
12099 (Property, Indexer, Event): Create a new MethodData objects for each
12100 accessor and call Define() and Emit() on them.
12102 2002-07-25 Martin Baulig <martin@gnome.org>
12104 Made MethodCore derive from MemberBase to reuse the code from there.
12105 MemberBase now also checks for attributes.
12107 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
12108 (MemberBase.GetMethodFlags): Moved here from class Method and marked
12110 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
12111 `CallingConventions cc' and `Attributes opt_attrs' arguments.
12112 (MemberBase.ApplyAttributes): New virtual method; applies the
12113 attributes to a method or accessor.
12114 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
12115 (MemberBase.ApplyConditionalAttribute): Likewise.
12116 (MemberBase.ApplyDllImportAttribute): Likewise.
12117 (MemberBase.CheckAbstractAndExternal): Likewise.
12118 (MethodCore.ParameterTypes): This is now a property instead of a
12119 method, it's initialized from DoDefineParameters().
12120 (MethodCore.ParameterInfo): Removed the set accessor.
12121 (MethodCore.DoDefineParameters): New protected virtual method to
12122 initialize ParameterTypes and ParameterInfo.
12123 (Method.GetReturnType): We can now simply return the MemberType.
12124 (Method.GetMethodFlags): Override the MemberBase version and add
12125 the conditional flags.
12126 (Method.CheckBase): Moved some code from Define() here, call
12127 DoDefineParameters() here.
12128 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
12129 here to avoid some larger code duplication.
12130 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
12131 ensure that abstract and external accessors don't declare a body.
12133 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
12134 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
12135 lookup in the attribute's parent classes, so we need to abort as soon
12136 as we found the first match.
12137 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
12138 the attribute has no arguments.
12140 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
12143 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12145 * cs-parser.jay: reverted previous patch.
12147 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12149 * cs-parser.jay: fixed bug #22119.
12151 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12153 * attribute.cs: fixed compilation. The error was:
12154 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
12155 be assigned to before control leaves the current method."
12156 [FIXME: Filed as bug #28186: MCS must report this error.]
12158 2002-07-25 Martin Baulig <martin@gnome.org>
12160 * attribute.cs (Attribute.Conditional_GetConditionName): New static
12161 method to pull the condition name ouf of a Conditional attribute.
12162 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
12163 the obsolete message and error flag out of an Obsolete attribute.
12165 * class.cs (Method.GetMethodFlags): New public method to get the
12166 TypeManager.MethodFlags for this method.
12167 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
12169 (Method.Define): Get and apply the Obsolete and Conditional attributes;
12170 if we're overriding a virtual function, set the new private variable
12171 `parent_method'; call the new TypeManager.AddMethod().
12173 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
12174 the MethodBuilder and the Method in a PtrHashtable.
12175 (TypeManager.builder_to_method): Added for this purpose.
12176 (TypeManager.MethodFlags): Added IsObsoleteError.
12177 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
12178 Obsolete and Conditional arguments in MethodBuilders. If we discover
12179 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
12180 the message from the attribute.
12182 2002-07-24 Martin Baulig <martin@gnome.org>
12184 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
12185 preprocessor directives, ensure that the argument to #define/#undef is
12186 exactly one identifier and that it's actually an identifier.
12188 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
12191 2002-07-24 Martin Baulig <martin@gnome.org>
12193 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
12194 initialize it to TypeManager.object_type in the constructor.
12195 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
12196 of the `hm.get_current' method if we're using the collection pattern.
12197 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
12198 for the explicit conversion to make it work when we're using the collection
12199 pattern and the `Current' property has a different return type than `object'.
12202 2002-07-24 Martin Baulig <martin@gnome.org>
12204 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
12205 does not match, but don't report any errors. This method is called in
12206 order for all methods in a MethodGroupExpr until a matching method is
12207 found, so we don't want to bail out if the first method doesn't match.
12208 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
12209 matches, report the 123. Fixes #28070.
12211 2002-07-24 Martin Baulig <martin@gnome.org>
12213 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
12214 TypeManager.TypeToCoreType() to the top of the method so the
12215 following equality checks will work. Fixes #28107.
12217 2002-07-24 Martin Baulig <martin@gnome.org>
12219 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
12220 operand is of type uint, and the other operand is of type sbyte,
12221 short or int, the operands are converted to type long." -
12222 Actually do what this comment already told us. Fixes bug #28106,
12225 2002-07-24 Martin Baulig <martin@gnome.org>
12227 * class.cs (MethodBase): New abstract class. This is now a base
12228 class for Property, Indexer and Event to avoid some code duplication
12229 in their Define() and DefineMethods() methods.
12230 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
12231 generic methods for Define() and DefineMethods().
12232 (FieldBase): Derive from MemberBase, not MemberCore.
12233 (Property): Derive from MemberBase, not MemberCore.
12234 (Property.DefineMethod): Moved all the code from this method to the
12235 new MethodBase.DefineAccessor(), just call it with appropriate
12237 (Property.Define): Call the new Property.DoDefine(), this does some
12238 sanity checks and we don't need to duplicate the code everywhere.
12239 (Event): Derive from MemberBase, not MemberCore.
12240 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
12241 accessors, this will also make them work with interface events.
12242 (Indexer): Derive from MemberBase, not MemberCore.
12243 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
12244 (Indexer.Define): Use the new MethodBase functions.
12246 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
12247 argument to the constructor.
12248 (Interface.FindMembers): Added support for interface events.
12249 (Interface.PopluateEvent): Implemented.
12251 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
12253 2002-07-22 Miguel de Icaza <miguel@ximian.com>
12255 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
12256 but this is required to check for a method name being the same as
12257 the containing class.
12261 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12263 * interface.cs: initialize variable.
12265 2002-07-23 Martin Baulig <martin@gnome.org>
12267 Implemented the IndexerName attribute in interfaces.
12269 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
12270 name if this is an explicit interface implementation.
12271 (Indexer.InterfaceIndexerName): New public variable. If we're
12272 implementing an interface indexer, this is the IndexerName in that
12273 interface. Otherwise, it's the IndexerName.
12274 (Indexer.DefineMethod): If we're implementing interface indexer,
12275 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
12276 and Pending.ImplementIndexer methods.
12277 (Indexer.Define): Also define the PropertyBuilder if we're
12278 implementing an interface indexer and this is neither an explicit
12279 interface implementation nor do the IndexerName match the one in
12282 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
12283 If a method is defined here, then we always need to create a proxy
12284 for it. This is used when implementing interface indexers.
12285 (Pending.IsInterfaceIndexer): New public method.
12286 (Pending.ImplementIndexer): New public method.
12287 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
12288 This is used when implementing interface indexers to define a proxy
12290 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
12291 define a proxy if necessary.
12293 * interface.cs (Interface.IndexerName): New public variable.
12294 (Interface.PopulateIndexer): Set the IndexerName.
12295 (Interface.DefineIndexers): New private method. Populate all the
12296 indexers and make sure their IndexerNames match.
12298 * typemanager.cs (IndexerPropertyName): Added support for interface
12301 2002-07-22 Martin Baulig <martin@gnome.org>
12303 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
12304 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
12305 ret if HasReturnLabel.
12306 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
12309 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
12310 and set the ec.LoopBeginTryCatchLevel.
12311 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
12312 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
12313 the current ec.TryCatchLevel, the branch goes out of an exception
12314 block. In this case, we need to use Leave and not Br.
12316 2002-07-22 Martin Baulig <martin@gnome.org>
12318 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
12319 block unless the block does not always return or it is contained in
12320 another try { ... } catch { ... } block. Fixes bug #26506.
12321 Added verify-1.cs to the test suite.
12323 2002-07-22 Martin Baulig <martin@gnome.org>
12325 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
12326 then we do not always return. Fixes bug #24985.
12328 2002-07-22 Martin Baulig <martin@gnome.org>
12330 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
12331 lookup on a per-class level; ie. walk up the class hierarchy until we
12332 found at least one applicable method, then choose the best among them.
12333 Fixes bug #24463 and test-29.cs.
12335 2002-07-22 Martin Baulig <martin@gnome.org>
12337 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
12338 return types of the methods. The return type is not part of the
12339 signature and we must not check it to make the `new' modifier work.
12340 Fixes bug #27999, also added test-147.cs.
12341 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
12343 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
12344 on the method's return type.
12346 2002-07-21 Martin Baulig <martin@gnome.org>
12348 * assign.cs: Make this work if the rightmost source is a constant and
12349 we need to do an implicit type conversion. Also adding a few more tests
12350 to test-38.cs which should have caught this.
12352 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
12353 target in the makefile for this. The makefile.gnu is primarily intended
12354 for end-users who don't want to debug the compiler.
12356 2002-07-21 Martin Baulig <martin@gnome.org>
12358 * assign.cs: Improved the Assign class so it can now handle embedded
12359 assignments (X = Y = Z = something). As a side-effect this'll now also
12360 consume less local variables. test-38.cs now passes with MCS, added
12361 a few new test cases to that test.
12363 2002-07-20 Martin Baulig <martin@gnome.org>
12365 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
12366 instructions. Fixes bug #27977, also added test-146.cs.
12368 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12370 * cs-tokenizer.cs: fixed getHex ().
12372 2002-07-19 Martin Baulig <martin@gnome.org>
12374 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
12375 not Type.GetType() to lookup the array type. This is needed when
12376 we're constructing an array of a user-defined type.
12377 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
12378 single-dimensional arrays, but also for single-dimensial arrays of
12381 2002-07-19 Martin Baulig <martin@gnome.org>
12383 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
12384 this function is called, it's not allowed to share LocalBuilders
12385 among ILGenerators.
12387 2002-07-19 Martin Baulig <martin@gnome.org>
12389 * expression.cs (Argument.Resolve): Report an error 118 when trying
12390 to pass a type as argument.
12392 2002-07-18 Martin Baulig <martin@gnome.org>
12394 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
12395 Conv_R_Un for the signed `long' type.
12397 2002-07-15 Miguel de Icaza <miguel@ximian.com>
12399 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
12400 `expr' for the temporary result, as that will fail if we do
12401 multiple resolves on the same expression.
12403 2002-07-05 Miguel de Icaza <miguel@ximian.com>
12405 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
12406 ec.TypeContainer for looking up aliases.
12408 * class.cs (TypeContainer): Remove LookupAlias from here.
12410 * decl.cs (DeclSpace); Move here.
12412 2002-07-01 Miguel de Icaza <miguel@ximian.com>
12414 * class.cs (FindMembers): Only call filter if the constructor
12415 bulider is not null.
12417 Also handle delegates in `NestedTypes' now. Now we will perform
12418 type lookups using the standard resolution process. This also
12421 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
12422 This uses Expressions (the limited kind that can be parsed by the
12423 tree) instead of strings.
12425 * expression.cs (ComposedCast.ToString): Implement, used to flag
12426 errors since now we have to render expressions.
12428 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
12431 * ecore.cs (SimpleName.ToString): ditto.
12433 * cs-parser.jay: Instead of using strings to assemble types, use
12434 Expressions to assemble the type (using SimpleName, ComposedCast,
12435 MemberAccess). This should fix the type lookups in declarations,
12436 because we were using a different code path for this.
12438 * statement.cs (Block.Resolve): Continue processing statements
12439 even when there is an error.
12441 2002-07-17 Miguel de Icaza <miguel@ximian.com>
12443 * class.cs (Event.Define): Also remove the `remove' method from
12444 the list of pending items.
12446 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
12447 generate more compact code.
12449 2002-07-17 Martin Baulig <martin@gnome.org>
12451 * const.cs (Const.LookupConstantValue): Add support for constant
12452 `unchecked' and `checked' expressions.
12453 Also adding test case test-140.cs for this.
12455 2002-07-17 Martin Baulig <martin@gnome.org>
12457 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
12458 check whether mi.ReturnType implements the IEnumerator interface; the
12459 `==' and the IsAssignableFrom() will fail in this situation.
12461 2002-07-16 Ravi Pratap <ravi@ximian.com>
12463 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
12466 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12468 * expression.cs: fixed bug #27811.
12470 2002-07-14 Miguel de Icaza <miguel@ximian.com>
12472 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
12473 Molaro: when we are a ref, the value already contains a pointer
12474 value, do not take the address of it.
12476 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12477 * removed mb-parser.jay and mb-tokenizer.cs
12479 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12481 * expression.cs: check against the building corlib void type.
12483 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
12485 * ecore.cs: fix for valuetype static readonly fields: when
12486 initializing them, we need their address, not the address of a copy.
12488 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
12490 * typemanager.cs: register also enum_type in corlib.
12492 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12494 * class.cs: allow calling this (but not base) initializers in structs.
12496 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
12498 * ecore.cs: make sure we compare against the building base types
12501 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
12503 * typemanager.cs: fix TypeToCoreType() to handle void and object
12504 (corlib gets no more typerefs after this change).
12506 2002-07-12 Miguel de Icaza <miguel@ximian.com>
12508 * expression.cs (ArrayCreation.EmitArrayArguments): use
12509 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
12511 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
12512 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
12513 array indexes, the runtime actually forbids them.
12515 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
12516 for array arguments here.
12518 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
12519 instead of the default for ValueTypes.
12521 (New.DoEmit): Use IsValueType instead of
12522 IsSubclassOf (value_type)
12523 (New.DoResolve): ditto.
12524 (Invocation.EmitCall): ditto.
12526 * assign.cs (Assign): ditto.
12528 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
12529 Statements *are* currently doing part of their resolution during
12532 Expressions do always resolve during resolve, but statements are
12533 only required to propagate resolution to their children.
12535 2002-07-11 Miguel de Icaza <miguel@ximian.com>
12537 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
12539 (LoadAssembly): Do not add the dll if it is already specified
12541 (MainDriver): Add the System directory to the link path at the end,
12542 after all the other -L arguments.
12544 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
12545 wrong opcode for loading bytes and bools (ldelem.i1 instead of
12546 ldelem.u1) and using the opposite for sbytes.
12548 This fixes Digger, and we can finally run it.
12550 * driver.cs (UnixParseOption): Move the option parsing here.
12551 (CSCParseOption): Implement CSC-like parsing of options.
12553 We now support both modes of operation, the old Unix way, and the
12554 new CSC-like way. This should help those who wanted to make cross
12555 platform makefiles.
12557 The only thing broken is that /r:, /reference: and /lib: are not
12558 implemented, because I want to make those have the same semantics
12559 as the CSC compiler has, and kill once and for all the confussion
12560 around this. Will be doing this tomorrow.
12562 * statement.cs (Unsafe.Resolve): The state is checked during
12563 resolve, not emit, so we have to set the flags for IsUnsfe here.
12565 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12567 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
12568 not catch the Error_ObjectRefRequired in SimpleName (as it is
12569 possible to have a class/instance variable name that later gets
12570 deambiguated), we have to check this here.
12572 2002-07-10 Ravi Pratap <ravi@ximian.com>
12574 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
12575 make static and put into Expression.
12577 (Event.Define): Register the private field of the event with the
12578 TypeManager so that GetFieldFromEvent can get at it.
12580 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
12581 keep track of the private field associated with an event which
12584 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
12587 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
12589 2002-07-10 Miguel de Icaza <miguel@ximian.com>
12591 * expression.cs (Binary.EmitBranchable): this routine emits the
12592 Binary expression in a branchable context. This basically means:
12593 we need to branch somewhere, not just get the value on the stack.
12595 This works together with Statement.EmitBoolExpression.
12597 * statement.cs (Statement.EmitBoolExpression): Use
12600 2002-07-09 Miguel de Icaza <miguel@ximian.com>
12602 * statement.cs (For): Reduce the number of jumps in loops.
12604 (For): Implement loop inversion for the For statement.
12606 (Break): We can be breaking out of a Try/Catch controlled section
12607 (foreach might have an implicit try/catch clause), so we need to
12608 use Leave instead of Br.
12610 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
12611 now). If the instace expression supports IMemoryLocation, we use
12612 the AddressOf method from the IMemoryLocation to extract the
12613 address instead of emitting the instance.
12615 This showed up with `This', as we were emitting the instance
12616 always (Emit) instead of the Address of This. Particularly
12617 interesting when This is a value type, as we dont want the Emit
12618 effect (which was to load the object).
12620 2002-07-08 Miguel de Icaza <miguel@ximian.com>
12622 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
12624 * statement.cs (Checked): Set the CheckedState during the resolve
12625 process too, as the ConvCast operations track the checked state on
12626 the resolve process, and not emit.
12628 * cs-parser.jay (namespace_member_declaration): Flag that we have
12629 found a declaration when we do. This is used to flag error 1529
12631 * driver.cs: Report ok when we display the help only.
12633 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
12635 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
12637 2002-07-04 Miguel de Icaza <miguel@ximian.com>
12639 * cs-tokenizer.cs (define): We also have to track locally the
12640 defines. AllDefines is just used for the Conditional Attribute,
12641 but we also need the local defines for the current source code.
12643 2002-07-03 Miguel de Icaza <miguel@ximian.com>
12645 * statement.cs (While, For, Do): These loops can exit through a
12646 Break statement, use this information to tell whether the
12647 statement is the last piece of code.
12649 (Break): Flag that we break.
12651 * codegen.cs (EmitContexts): New `Breaks' state variable.
12653 2002-07-03 Martin Baulig <martin@gnome.org>
12655 * class.cs (TypeContainer.MethodModifiersValid): Allow override
12656 modifiers in method declarations in structs. Otherwise, you won't
12657 be able to override things like Object.Equals().
12659 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12661 * class.cs (Method, Property, Indexer): Do not allow the public
12662 modifier to be used in explicit interface implementations.
12664 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
12665 override modifiers in method declarations in structs
12667 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
12669 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
12670 integer or real overflow, report an error
12672 2002-07-02 Martin Baulig <martin@gnome.org>
12674 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
12675 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
12676 to tell the runtime about our newly created System.Object and
12677 System.ValueType types.
12679 2002-07-02 Miguel de Icaza <miguel@ximian.com>
12681 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
12682 struct instead of Ldarg/Starg.
12684 2002-07-02 Martin Baulig <martin@gnome.org>
12686 * expression.cs (Indirection.Indirection): Call
12687 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
12689 2002-07-02 Martin Baulig <martin@gnome.org>
12691 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
12692 ValueType, call TypeManager.TypeToCoreType() on it.
12693 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
12694 the OpCodes.Newarr argument.
12696 2002-07-02 Martin Baulig <martin@gnome.org>
12698 * expression.cs (Invocation.EmitCall): When compiling corlib,
12699 replace all calls to the system's System.Array type to calls to
12700 the newly created one.
12702 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
12703 System.Array methods.
12704 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
12705 from the system's System.Array type which must be replaced.
12707 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
12709 * typemanager.cs: load unverifiable_code_ctor so we can build
12710 corlib using the correct type. Avoid using GetTypeCode() with
12712 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
12713 TypeManager.object_type to allow building corlib.
12715 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
12717 * ecore.cs: handle System.Enum separately in LoadFromPtr().
12719 2002-07-01 Martin Baulig <martin@gnome.org>
12721 * class.cs: Make the last change actually work, we need to check
12722 whether `ifaces != null' to avoid a crash.
12724 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
12726 * class.cs: when we build structs without fields that implement
12727 interfaces, we need to add the interfaces separately, since there is
12728 no API to both set the size and add the interfaces at type creation
12731 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
12733 * expression.cs: the dimension arguments to the array constructors
12734 need to be converted if they are a long.
12736 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
12738 * class.cs: don't emit ldarg.0 if there is no parent constructor
12739 (fixes showstopper for corlib).
12741 2002-06-29 Martin Baulig <martin@gnome.org>
12743 MCS now compiles corlib on GNU/Linux :-)
12745 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
12746 ie. check for MethodImplOptions.InternalCall.
12748 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
12749 and TypeManager.attribute_type are null, so we must explicitly check
12750 whether parent is not null to find out whether it's an attribute type.
12751 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
12752 and SetBuilder, not only if the property is neither abstract nor external.
12753 This is necessary to set the MethodImplOptions on the accessor methods.
12754 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
12755 SetBuilder, see Property.Emit().
12757 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
12758 populate "System.Object", "System.ValueType" and "System.Attribute" since
12759 they've already been populated from BootCorlib_PopulateCoreTypes().
12761 2002-06-29 Martin Baulig <martin@gnome.org>
12763 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
12764 is the NullLiteral, we also need to make sure that target_type is not
12767 2002-06-29 Martin Baulig <martin@gnome.org>
12769 * rootcontext.cs (RootContext.ResolveCore): We must initialize
12770 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
12771 before calling BootstrapCorlib_ResolveDelegate ().
12773 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12775 * statement.cs: fixed build-breaker. All tests passed ok.
12777 2002-06-27 Martin Baulig <martin@gnome.org>
12779 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
12780 for System.Decimal when compiling corlib.
12782 2002-06-27 Martin Baulig <martin@gnome.org>
12784 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
12785 switch blocks which contain nothing but a default clause.
12787 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
12789 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
12791 2002-06-27 Martin Baulig <martin@gnome.org>
12793 * ecore.cs (PropertyExpr.PropertyExpr): Call
12794 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
12796 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
12797 is already a TypeBuilder.
12799 2002-06-27 Martin Baulig <martin@gnome.org>
12801 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
12802 `target_type == TypeManager.array_type', not IsAssignableFrom() in
12803 the "from an array-type to System.Array" case. This makes it work
12804 when compiling corlib.
12806 2002-06-27 Martin Baulig <martin@gnome.org>
12808 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
12809 non-static PropertyExpr, set its InstanceExpression. This makes
12810 the `ICollection.Count' property work in System/Array.cs.
12812 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
12814 * driver.cs: Made error handling more consistent. Errors now
12815 tracked by Report class, so many methods which used to return int
12816 now return void. Main() now prints success/failure and
12817 errors/warnings message.
12819 Renamed '--probe' compiler argument to '--expect-error'. Removed
12820 the magic number return values (123 and 124). Now, if the
12821 expected error occurs, the compiler exits with success (exit value
12822 0). If the compilation completes without seeing that particular
12823 error, the compiler exits with failure (exit value 1). The
12824 makefile in mcs/errors has been changed to handle the new behaviour.
12826 * report.cs: Made 'expected error' number a property and renamed
12827 it from 'Probe' to 'ExpectedError'.
12829 * genericparser.cs: Removed error handling support, since it is
12830 now all done by Report class.
12832 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
12833 class, so parse() no longer returns an int.
12835 * namespace.cs: Use Report.Error instead of GenericParser.error
12837 2002-06-22 Miguel de Icaza <miguel@ximian.com>
12839 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
12840 TypeContainer.AddOperator): At the front of the list put the
12841 explicit implementations, so they get resolved/defined first.
12843 2002-06-21 Miguel de Icaza <miguel@ximian.com>
12845 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
12846 interface type is implemented by this TypeContainer. Used during
12847 explicit interface implementation.
12849 (Property.Define, Indexer.Define, Method.Define): Validate that
12850 the given interface in the explicit implementation is one of the
12851 base classes for the containing type.
12853 Also if we are explicitly implementing an interface, but there is
12854 no match in the pending implementation table, report an error.
12856 (Property.Define): Only define the property if we are
12857 not explicitly implementing a property from an interface. Use the
12858 correct name also for those properties (the same CSC uses,
12859 although that is really not needed).
12861 (Property.Emit): Do not emit attributes for explicitly implemented
12862 properties, as there is no TypeBuilder.
12864 (Indexer.Emit): ditto.
12866 Hiding then means that we do not really *implement* a pending
12867 implementation, which makes code fail.
12869 2002-06-22 Martin Baulig <martin@gnome.org>
12871 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12872 the return value of Object.GetType(). [FIXME: we need to do this whenever
12873 we get a type back from the reflection library].
12875 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12877 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12879 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12881 * attribute.cs: Return null if we can not look up the type.
12883 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12884 the interface types found.
12886 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12887 interface types found.
12889 * typemanager.cs (GetInterfaces): Make this routine returns alll
12890 the interfaces and work around the lame differences between
12891 System.Type and System.Reflection.Emit.TypeBuilder in the results
12892 result for GetInterfaces.
12894 (ExpandInterfaces): Given an array of interface types, expand and
12895 eliminate repeated ocurrences of an interface. This expands in
12896 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12899 2002-06-21 Martin Baulig <martin@gnome.org>
12901 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12904 2002-06-21 Martin Baulig <martin@gnome.org>
12906 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12907 and called with one of the core types, return the corresponding typebuilder for
12910 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12913 2002-06-21 Martin Baulig <martin@gnome.org>
12915 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12916 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12917 (Expression.ConvertReferenceExplicit): Likewise.
12919 * expression.cs (ElementAccess.DoResolve): Likewise.
12920 (ElementAccess.DoResolveLValue): Likewise.
12922 2002-06-10 Martin Baulig <martin@gnome.org>
12924 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12925 add the "value" parameter to the parameter list.
12927 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12930 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12932 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12933 the argument to an int, uint, long or ulong, per the spec. Also
12934 catch negative constants in array creation.
12936 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12938 * class.cs: do not allow the same interface to appear twice in
12939 the definition list.
12941 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12943 * ecore.cs: don't use ldlen with System.Array.
12945 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12947 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12949 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12951 * modifiers.cs: produce correct field attributes for protected
12952 internal. Easy fix so miguel can work on ther harder stuff:-)
12954 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12956 * pending.cs: New file. Move the code from class.cs here.
12957 Support clearning the pending flag for all methods (when not doing
12958 explicit interface implementation).
12960 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12962 * rootcontext.cs: added a couple more types needed to bootstrap.
12964 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12966 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12967 constructor in the type, instead of any constructor in the type
12968 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12969 a bug in the Mono runtime when applying the params attribute).
12971 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12972 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12974 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12976 * expression.cs (Unary.ResolveOperator): Use TypeManager
12977 to resolve the type.
12979 2002-06-13 Ravi Pratap <ravi@ximian.com>
12981 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12984 * enum.cs (AddEnumMember): Add support to store the attributes associated
12985 with each member too.
12987 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12988 field builders too - this takes care of the enum member case.
12990 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12992 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12993 address-of operator on both value types and pointers.
12995 2002-06-10 Martin Baulig <martin@gnome.org>
12997 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12998 PropertyBuilder to the `property_builders' list.
13000 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
13001 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
13002 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
13003 find any indexers which are inherited from an interface.
13005 2002-06-09 Martin Baulig <martin@gnome.org>
13007 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
13008 the same type as the constant if necessary. There's also a test-130.cs
13011 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
13013 * typemanager.cs (TypeManager.ChangeType): Previously known as
13014 Enum.ChangeEnumType().
13016 2002-06-09 Martin Baulig <martin@gnome.org>
13018 * expression.cs (Cast.TryReduce): Added support for consts.
13020 2002-06-08 Ravi Pratap <ravi@ximian.com>
13022 * class.cs (Accessor): Hold attributes information so we can pass
13025 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
13026 Modify to pass in attributes attached to the methods.
13028 (add_accessor_declaration, remove_accessor_declaration): Ditto.
13030 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
13031 to handle the Accessor kind :-)
13033 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
13035 2002-06-08 Martin Baulig <martin@gnome.org>
13037 * expression.cs (Unary.TryReduceNegative): Added support for
13040 2002-06-08 Martin Baulig <martin@gnome.org>
13042 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
13043 name can't be found in the `defined_names' - the caller will do a
13044 MemberLookup in this case and thus find methods in System.Enum
13045 such as Enum.IsDefined().
13047 2002-06-08 Martin Baulig <martin@gnome.org>
13049 * enum.cs (Enum.ChangeEnumType): This is a custom version of
13050 Convert.ChangeType() which works with TypeBuilder created types.
13051 (Enum.LookupEnumValue, Enum.Define): Use it here.
13053 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
13054 `TypeBuilder.BaseType != null' check.
13055 (TypeContainer.FindMembers): Only lookup parent members if we
13056 actually have a parent.
13057 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
13058 (ConstructorInitializer.Resolve): Likewise.
13060 * interface.cs (Interface.FindMembers): Added
13061 `TypeBuilder.BaseType != null' check.
13063 * rootcontext.cs (RootContext.ResolveCore): Added
13064 "System.Runtime.CompilerServices.IndexerNameAttribute" to
13065 classes_second_stage.
13067 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
13068 debug_type and trace_type when compiling with --nostdlib.
13070 2002-06-07 Martin Baulig <martin@gnome.org>
13072 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
13073 (AddField): Set it to true when adding a non-static field.
13074 (DefineType): Use `have_nonstatic_fields' to find out whether we
13075 have non-static fields, not `Fields != null'.
13077 2002-06-02 Miguel de Icaza <miguel@ximian.com>
13079 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
13080 dereferencing a null on the static-field code path)
13082 2002-05-30 Martin Baulig <martin@gnome.org>
13084 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
13085 to take command line arguments. Use reflection to call the new
13086 custom `Initialize' function on the symbol writer and pass it the
13087 command line arguments.
13089 * driver.cs (--debug-args): New command line argument to pass command
13090 line arguments to the symbol writer.
13092 2002-05-28 Miguel de Icaza <miguel@ximian.com>
13094 * assign.cs (DoResolve): Forgot to do the implicit conversion to
13095 the target type for indexers and properties. Thanks to Joe for
13098 2002-05-27 Miguel de Icaza <miguel@ximian.com>
13100 * typemanager.cs (MethodFlags): returns the method flags
13101 (Obsolete/ShouldIgnore) that control warning emission and whether
13102 the invocation should be made, or ignored.
13104 * expression.cs (Invocation.Emit): Remove previous hack, we should
13105 not do this on matching a base type, we should do this based on an attribute
13107 Only emit calls to System.Diagnostics.Debug and
13108 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
13109 on the command line.
13111 * rootcontext.cs: Global settings for tracing and debugging.
13113 * cs-tokenizer.cs (define): New utility function to track
13114 defines. Set the global settings for TRACE and DEBUG if found.
13116 2002-05-25 Ravi Pratap <ravi@ximian.com>
13118 * interface.cs (Populate*): Pass in the TypeContainer as well as
13119 the DeclSpace as parameters so that we can create EmitContexts and
13120 then use that to apply attributes etc.
13122 (PopulateMethod, PopulateEvent, PopulateProperty)
13123 (PopulateIndexer): Apply attributes everywhere.
13125 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
13128 (ApplyAttributes): Update accordingly.
13130 We now apply interface attributes for all members too.
13132 2002-05-26 Miguel de Icaza <miguel@ximian.com>
13134 * class.cs (Indexer.Define); Correctly check if we are explicit
13135 implementation (instead of checking the Name for a ".", we
13136 directly look up if the InterfaceType was specified).
13138 Delay the creation of the PropertyBuilder.
13140 Only create the PropertyBuilder if we are not an explicit
13141 interface implementation. This means that explicit interface
13142 implementation members do not participate in regular function
13143 lookups, and hence fixes another major ambiguity problem in
13144 overload resolution (that was the visible effect).
13146 (DefineMethod): Return whether we are doing an interface
13149 * typemanager.cs: Temporary hack until we get attributes in
13150 interfaces (Ravi is working on that) and we get IndexerName
13151 support in interfaces.
13153 * interface.cs: Register the indexers as properties.
13155 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
13156 warning, I have verified that this is a bug in the .NET runtime
13157 (JavaScript suffers of the same problem).
13159 * typemanager.cs (MemberLookup): When looking up members for
13160 interfaces, the parent of an interface is the implicit
13161 System.Object (so we succeed in searches of Object methods in an
13162 interface method invocation. Example: IEnumerable x; x.ToString
13165 2002-05-25 Miguel de Icaza <miguel@ximian.com>
13167 * class.cs (Event): Events should also register if they do
13168 implement the methods that an interface requires.
13170 * typemanager.cs (MemberLookup); use the new GetInterfaces
13173 (GetInterfaces): The code used to lookup interfaces for a type is
13174 used in more than one place, factor it here.
13176 * driver.cs: Track the errors at the bottom of the file, we kept
13179 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
13180 instance if the method we are calling is static!
13182 2002-05-24 Miguel de Icaza <miguel@ximian.com>
13184 * attribute.cs (ApplyAttributes): Make this function filter out
13185 the IndexerName attribute (as that attribute in reality is never
13186 applied) and return the string constant for the IndexerName
13189 * class.cs (TypeContainer.Emit): Validate that all the indexers
13190 have the same IndexerName attribute, and if so, set the
13191 DefaultName attribute on the class.
13193 * typemanager.cs: The return value might contain other stuff (not
13194 only methods). For instance, consider a method with an "Item"
13195 property and an Item method.
13197 * class.cs: If there is a problem with the parameter types,
13200 2002-05-24 Ravi Pratap <ravi@ximian.com>
13202 * ecore.cs (ImplicitConversionExists): Wrapper function which also
13203 looks at user defined conversion after making a call to
13204 StandardConversionExists - we need this for overload resolution.
13206 * expression.cs : Update accordingly the various method calls.
13208 This fixes 2 bugs filed against implicit user defined conversions
13210 2002-05-22 Miguel de Icaza <miguel@ximian.com>
13212 * statement.cs: Track the result of the assignment.
13214 2002-05-21 Miguel de Icaza <miguel@ximian.com>
13216 * expression.cs (MemberAccess): Improved error reporting for
13217 inaccessible members.
13219 2002-05-22 Martin Baulig <martin@gnome.org>
13221 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
13222 itself with debugging support.
13224 2002-05-22 Martin Baulig <martin@gnome.org>
13226 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
13227 Removed, this isn't needed anymore.
13229 2002-05-20 Martin Baulig <martin@gnome.org>
13231 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
13232 be underlying type for an enum.
13234 2002-05-20 Miguel de Icaza <miguel@ximian.com>
13236 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
13237 that splits out the loading of just the core types.
13239 * rootcontext.cs (ResolveCore): Split the struct resolution in
13240 two, so we can load the enumeration underlying types before any
13243 * expression.cs (Is): Bandaid until we fix properly Switch (see
13244 bug #24985 for details).
13246 * typemanager.cs (ImplementsInterface): The hashtable will contain
13247 a null if there are no interfaces implemented.
13249 2002-05-18 Miguel de Icaza <miguel@ximian.com>
13251 * cs-parser.jay (indexer_declarator): It is fine to have array
13254 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13256 * typemanager.cs: (RegisterBuilder): New function used to register
13257 TypeBuilders that implement interfaces. Since
13258 TypeBuilder.GetInterfaces (as usual) does not work with lame
13260 (AddUserType): register interfaces.
13262 (ImplementsInterface): Use the builder_to_ifaces hash if we are
13263 dealing with TypeBuilder. Also, arrays are showing up as
13264 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
13265 methods can not be invoked on them!
13267 * ecore.cs (ExplicitReferenceConversionExists): Made public.
13268 (ImplicitReferenceConversionExists): Split out from
13269 StandardConversionExists.
13271 * expression.cs (As): We were only implementing one of the three
13272 cases for the as operator. We now implement them all.
13273 (Is): Implement the various other cases for Is as well.
13275 * typemanager.cs (CACHE): New define used to control if we want or
13276 not the FindMembers cache. Seems to have a negative impact on
13277 performance currently
13279 (MemberLookup): Nested types have full acess to
13280 enclosing type members
13282 Remove code that coped with instance/static returns for events, we
13283 now catch this in RealFindMembers.
13285 (RealFindMembers): only perform static lookup if the instance
13286 lookup did not return a type or an event.
13288 2002-05-17 Miguel de Icaza <miguel@ximian.com>
13290 * assign.cs (CompoundAssign): We pass more semantic information
13291 now to Compound Assignments than we did before: now we have all
13292 the information at hand, and now we resolve the target *before* we
13293 do the expression expansion, which allows the "CacheValue" method
13294 to have the effect we intended (before, a [x] += 1 would generate
13295 two differen ArrayAccess expressions from the ElementAccess,
13296 during the resolution process).
13298 (CompoundAssign.DoResolve): Resolve target and original_source here.
13300 2002-05-16 Miguel de Icaza <miguel@ximian.com>
13302 * expression.cs (ArrayAccess): dropped debugging information.
13304 * typemanager.cs: Small bug fix: I was always returning i_members,
13305 instead of one of i_members or s_members (depending on which had
13308 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
13309 method is invoked before any code generation takes place, and it
13310 is a mechanism to inform that the expression will be invoked more
13311 than once, and that the method should use temporary values to
13312 avoid having side effects
13314 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
13316 * ecore.cs (Expression.CacheTemporaries): Provide empty default
13319 * expression.cs (Indirection, ArrayAccess): Add support for
13320 CacheTemporaries in these two bad boys.
13322 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
13323 ldobj or ldind_ref.
13324 (StoreFromPtr): Handle stobj as well.
13326 * expression.cs (UnaryMutator): Share more code.
13328 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
13329 down: I was not tracking the Filter function as well, which
13330 was affecting the results of the cache.
13332 2002-05-15 Miguel de Icaza <miguel@ximian.com>
13334 * attribute.cs: Remove the hack to handle the CharSet property on
13337 2002-05-14 Miguel de Icaza <miguel@ximian.com>
13339 * attribute.cs (DoResolve): More uglyness, we now only try to
13340 resolve the attribute partially, to extract the CharSet
13341 information (only if we are a StructLayout attribute). Otherwise
13343 (GetExtraTypeInfo): Add some code to conditionally kill in the
13344 future this. I am more and more convinced that the .NET
13345 framework has special code to handle the attribute setting on
13348 * expression.cs (IsParamsMethodApplicable): Revert my previous
13349 foreach change here, it was wrong.
13351 2002-05-13 Miguel de Icaza <miguel@ximian.com>
13353 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
13354 (pp_expr): do not abort on unknown input, just return.
13355 (eval): abort if there are pending chars.
13357 * attribute.cs (Attribute.Resolve): Positional parameters are
13358 optional. Deal with that case.
13360 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
13361 the Ansi/Unicode/Auto information for the type.
13363 (TypeContainer.DefineType): instantiate the EmitContext here, as
13364 we will be using it during the type definition (to resolve
13365 attributes) and during the emit phase.
13367 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
13368 to pull type information out of the attributes
13370 (Attribute.Resolve): track the constructor builder, and allow for
13371 multiple invocations (structs and classes will use this).
13373 * ecore.cs (MemberLookupFinal): new version with all the
13374 parameters customizable.
13376 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
13377 constructors. Return if the result value is null (as the error
13378 would have been flagged already by MemberLookupFinal)
13380 Do not allow instances of abstract classes or interfaces to be
13383 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
13384 We have to compare the assembly property here when dealing with
13385 FamANDAssem and Assembly access modifiers, because we might be
13386 creating an assembly from *modules* (that means that we are not
13387 getting TypeBuilders for types defined in other modules that are
13388 part of this assembly).
13390 (Method.Emit): If the method is marked abstract and has a body,
13393 (TypeContainer.DefineMembers): If both the defined member and the
13394 parent name match are methods, then do not emit any warnings: let
13395 the Method.Define routine take care of flagging warnings. But if
13396 there is a mismatch (method overrides something else, or method is
13397 overriwritten by something, then emit warning).
13399 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
13400 set to null, this means `do not check for the return type on the
13403 (Method.Define): set the return type for the method signature to
13404 null, so that we get methods with the same name and parameters and
13405 different return types. This is used to flag warning 114 (you are
13406 hiding a method, and you probably want to use the new/override
13409 * typemanager.cs (MemberLookup): Implemented proper access
13410 control, closing a long standing set of bug reports. The problem
13411 was that the Framework only has two bits: Public and NonPublic,
13412 and NonPublic includes private and protected methods, but we need
13413 to enforce the FamANDAssem, FamOrAssem and Family.
13415 2002-05-11 Miguel de Icaza <miguel@ximian.com>
13417 * statement.cs (GotoCase): Return true: Ammounts to giving up
13418 knowledge on whether we return or not, and letting the other case
13419 be responsible for it.
13421 2002-05-10 Miguel de Icaza <miguel@ximian.com>
13423 * driver.cs: Do not load directories for each file processed, only
13424 do it if there is a pattern.
13426 * ecore.cs: Report readonly assigns here as well, as we might have
13427 been resolved only by MemberAccess.
13429 (SimpleName.SimpleNameResolve): Also be useful for LValue
13430 resolution. We need this to propagate assign to local readonly variables
13432 * typemanager.cs: Use a ptrhashtable for the criteria, because we
13433 do not want to reuse potential criteria memory.
13435 * class.cs (MyEventBuilder): Set reflected_type;
13437 * ecore.cs (Constantify): Added support for constifying bools.
13439 (RootContext.LookupType): Added a cache for values looked up in
13440 the declaration space.
13442 * typemanager.cs (FindMembers): Now is a front-end to
13443 RealFindMembers, and provides a two-level hashtable-based cache to
13446 15% performance improvement: from 22.5 to 19.2 seconds.
13448 * expression.cs (IsParamsMethodApplicable): use foreach.
13449 (Invocation.DoResolve): ditto.
13450 (New.DoResolve): ditto.
13451 (ArrayCreation.DoResolve): ditto.
13453 * ecore.cs (FindMostEncompassingType): use foreach.
13455 * delegate.cs (NewDelegate.DoResolve): Use foreach
13457 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
13458 (RemoveMethods): use foreach.
13460 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
13461 nested foreach statements instead of for, and also break out of
13462 the inner loop once a match is found.
13464 (Invocation.OverloadResolve): Use foreach, simplify the code.
13466 2002-05-08 Miguel de Icaza <miguel@ximian.com>
13468 * cfold.cs (BinaryFold): During an enumeration evaluation context,
13469 we actually unwrap the expression to allow for extra information
13472 * expression.cs: Use Shr_Un on unsigned operations.
13474 2002-05-08 Ravi Pratap <ravi@ximian.com>
13476 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
13477 applicable operators was not being considered correctly. This closes
13478 the bug Miguel reported.
13480 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
13482 * attribute.cs: check that the type derives from System.Attribute
13483 and report the correct error in that case (moved the duplicate code to
13484 its own method, too).
13486 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
13488 * attribute.cs: lookup attribute type name as the spec says: first the
13489 bare attribute name and then name + "Attribute" (nant compiles with
13490 mcs after this fix).
13492 2002-05-07 Miguel de Icaza <miguel@ximian.com>
13494 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
13495 Because of the way we parse things, we should try to see if a
13496 UIntConstant can fit in an integer.
13498 2002-05-07 Ravi Pratap <ravi@ximian.com>
13500 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
13501 when we are in an explicit context.
13503 (ConvertReferenceExplicit): When converting from Iface type S to Class
13504 T make sure the rules are implemented as an OR.
13506 * parameter.cs (ParameterType): Make it a property for now although the
13507 purpose really isn't anything immediate.
13509 * expression.cs (Is*Applicable): Do better checking on the parameter type
13510 of a ref/out parameter. The ones from the system assemblies are already
13511 marked with the correct type so we don't need to do any correction.
13513 * ecore.cs (StandardConversionExists): Conversion from Interface types to
13514 the object type is standard too so include that.
13516 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13518 * ecore.cs (StandardConversionExists): Augment with missing code:
13519 deal with IntConstant, LongConstants and Enumerations.
13521 * assign.cs: Report the error, instead of failing silently
13523 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
13524 typecontainer that they are declared, because the
13525 typecontainer/namespace will have the list of using clauses that
13526 need to be applied.
13528 Assembly Attributes were escaping the normal registration
13531 (EmitCode): Apply attributes within an EmitContext that represents
13532 the container they were declared on.
13534 * cs-parser.jay: Track bases for structs. How did I get this wrong?
13536 2002-05-06 Ravi Pratap <ravi@ximian.com>
13538 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
13539 Revamp completely - make much cleaner as we now operate only
13542 (FindMostSpecificSource, FindMostSpecificTarget): New methods
13543 to implement the logic detailed in the spec more correctly.
13545 (UserDefinedConversion): Update accordingly.
13547 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13549 * statement.cs: Return flow analysis information up.
13551 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
13554 (token): Do not consume an extra character before calling
13557 2002-05-06 Piers Haken <piersh@friskit.com>
13559 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
13561 2002-05-06 Miguel de Icaza <miguel@ximian.com>
13563 * class.cs (Constructor.Emit): Set the IsStatic flag in the
13564 EmitContext during the instance constructor initializer
13565 resolution, to stop access to instance variables.
13567 This is mandated by the spec, last paragraph of the `constructor
13568 initializers' section.
13570 2002-05-05 Miguel de Icaza <miguel@ximian.com>
13572 * cs-parser.jay, class.cs (Accessor): new class used to represent
13573 an accessor (get or set). In the past we used `null' to represent
13574 a missing accessor. But this is ambiguous because there was no
13575 way to tell in abstract indexers/properties if one of them was
13578 Now there is a way of addressing that.
13580 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
13581 instead of FindMembers.
13583 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
13584 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
13586 * attribute.cs: Treat indexers and properties as the same in terms
13587 of applying attributes
13589 * ecore.cs (FindMostEncompassedType): Use statically initialized
13590 EmptyExpressions()s like we do elsewhere to avoid creating useless
13591 objects (and we take this out of the tight loop).
13593 (GetConversionOperators): Move the code to extract the actual
13594 operators to a separate routine to clean things up.
13596 2002-05-04 Miguel de Icaza <miguel@ximian.com>
13598 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
13599 events are always registered FieldBuilders.
13601 * class.cs (FieldBase): New class shared by Fields
13603 * delegate.cs: If we are a toplevel delegate, use our full name.
13604 If we are a nested delegate, then only use our tail name.
13606 2002-05-02 Ravi Pratap <ravi@ximian.com>
13608 * expression.cs (IsApplicable): Ensure that we add the "&" to
13609 ref/out types before comparing it with the type of the argument.
13611 (IsParamsMethodApplicable): Ditto.
13613 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
13616 * delegate.cs : Handle the case when we have more than one applicable
13617 method. Flag an error only when we finish checking all.
13619 2002-05-02 Miguel de Icaza <miguel@ximian.com>
13621 * expression.cs: Add support for boolean static initializers.
13623 2002-05-01 Miguel de Icaza <miguel@ximian.com>
13625 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
13627 * parameter.cs (ComputeParameterTypes,
13628 ComputeAndDefineParameterTypes): Better error handling: now we
13629 clear the `types' cache if we fail during any of the type lookups.
13630 We also return the status code correctly to our caller
13632 * delegate.cs: If we fail to define a delegate, abort the extra
13635 * expression.cs (Binary.ResolveOperator): for
13636 operator==(object,object) and operator !=(object, object) we also
13637 have to verify that there is an implicit conversion from one to
13640 (ArrayAccess.DoResolve): Array Access can operate on
13643 2002-04-30 Miguel de Icaza <miguel@ximian.com>
13645 * assign.cs (CompoundAssign): A new class used as a "flag" that
13646 the assignment actually is happening as part of a compound
13647 assignment operator.
13649 During compound assignment, a few new rules exist to enable things
13656 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
13657 to the type of x) if y is implicitly convertible to the type of x,
13658 and the operator is a builtin operator and the return type of the
13659 operator is explicitly convertible to the type of x.
13661 * rootcontext.cs: Reset warning level to 2. 4 catches various
13662 "interesting" features in mcs, we must clean this up at some
13663 point, but currently am trying to kill other bugs ;-)
13665 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
13666 in container classes as well.
13668 * expression.cs (Binary.ResolveOperator): Handle string case
13669 before anything else (as operator overloading does emit an error
13670 before doing anything else).
13672 This code could go away when we move to a table driven model, but
13673 i could not come up with a good plan last night.
13675 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
13677 * typemanager.cs (CSharpName): reimplementation using regex.
13678 * class.cs: added null check for fields in Emit
13679 * rootcontext.cs: set warninglevel to 4
13681 2002-04-29 Miguel de Icaza <miguel@ximian.com>
13683 * typemanager.cs (CSharpName): reimplemented with Lupus
13686 2002-04-28 Miguel de Icaza <miguel@ximian.com>
13688 * statement.cs (If): correclty implement Resolve, because we were
13689 not catching sem errors in there. The same process is needed
13691 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
13694 (Statement.Warning_DeadCodeFound): Factorize code.
13695 (While): Report dead code here too.
13697 (Statement): Added Resolve virtual method to allow
13698 for resolution split from the emit code.
13700 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13702 * statement.cs (EmitBoolExpression): No longer try to resolve the
13704 (MakeBoolean): New utility function that resolve, implicitly
13705 converts to boolean and tags the expression.
13708 (If, Do): Implement dead code elimination.
13709 (While): Implement loop inversion
13711 (Do, While, For, If): Resolve the expression prior to calling our
13714 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
13717 - added method Report28 (warning: program has more than one entry point)
13718 - added method IsEntryPoint, implements paragraph 10.1 of the spec
13719 - modified method Method.Define, the part at the end of the method
13721 * rootcontext.cs: added static public Location EntryPointLocation;
13723 * ../errors/cs0028.cs : Add test case for the above warning.
13726 - modified method CSharpName to allow arrays of primitive type to
13727 be printed nicely (e.g. instead of System.Int32[][] it now prints
13729 - added method CSharpSignature: returns the signature of a method
13730 in string format to be used in reporting errors, warnings, etc.
13732 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
13735 2002-04-26 Ravi Pratap <ravi@ximian.com>
13737 * delegate.cs (Define): Fix extremely silly bug where I was
13738 setting the type of the 'object' parameter of the BeginInvoke
13739 method to System.IAsyncResult instead of System.Object ;-)
13741 2002-04-26 Miguel de Icaza <miguel@ximian.com>
13743 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
13746 (Constructor.Emit): return if we fail to initialize the
13747 constructor. Another door closed!
13749 * expression.cs (New.DoResolve): Improve error message (from -6 to
13750 1501). Use DeclaredOnly lookup to find the exact constructor.
13752 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
13753 loop. This is useful.
13755 * cs-parser.jay: Adjust the default parameters so that destructors
13756 have the proper signature.
13758 2002-04-26 Martin Baulig <martin@gnome.org>
13760 * driver.cs (LoadAssembly): If `assembly' contains any characters
13761 which are only valid in path names and not in assembly names
13762 (currently slash, backslash and point), use Assembly.LoadFrom ()
13763 instead of Assembly.Load () on the `assembly' (before iteration
13764 over the link_paths).
13766 2002-04-26 Martin Baulig <martin@gnome.org>
13768 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
13770 2002-04-25 Miguel de Icaza <miguel@ximian.com>
13772 * class.cs (Property): use the new typemanager.MemberLookup
13774 (TypeContainer.MemberLookup): Implement using the
13775 TypeManager.MemberLookup now.
13777 * typemanager.cs: Make MemberLookup a function of the TypeManager,
13778 and return MemberInfos, so that these can be used without an
13779 EmitContext (what we had before).
13781 2002-04-24 Miguel de Icaza <miguel@ximian.com>
13783 * expression.cs: Fix the case where the argument to params if the
13784 type of the params. I omitted handling this before. Fixed
13786 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13788 * driver.cs: Call BootCorlib_PopulateCoreType
13790 * class.cs (Property.CheckBase): Check for properties only, not
13793 * interface.cs: Temporary hack: try/catch around the
13794 CustomAttributeBuilder, because I am getting an exception that I
13797 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
13798 types whose definitions are required to be there (attributes are
13799 defined before standard types).
13801 Compute definitions as we boot the various types, as they are used
13802 immediately (value_type class will need object_type, but if we do
13803 not initialize object_type, we will pass a null, which will let
13804 the runtime pick the System.Object from the existing corlib, which
13805 is not what we want).
13807 2002-04-22 Patrik Torstensson <totte@labs2.com>
13809 * cs-tokenizer.cs: fixed a number of trim() issues.
13811 2002-04-22 Ravi Pratap <ravi@ximian.com>
13813 * expression.cs (Argument.Type): Ensure that we return the correct
13814 type when we have out or ref parameters [in which case we
13817 2002-04-22 Miguel de Icaza <miguel@ximian.com>
13819 * class.cs (Property, Indexer): Allow extern modifier in there.
13821 * typemanager.cs (InitBaseTypes): Initializes object_type and
13822 value_type, since those will be used early on during the bootstrap
13823 process to compile corlib.
13825 (InitCoreTypes): Move code from here to InitBaseTypes.
13827 2002-04-21 Miguel de Icaza <miguel@ximian.com>
13829 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
13830 single-dimension arrays as using the ldlen opcode.
13832 Daniel Lewis discovered this optimization.
13834 * typemanager.cs: Add signature for System.Array::get_Length
13836 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13838 * statement.cs: report the error when the foreach does not apply to an
13839 array nor a collection.
13841 2002-04-19 Miguel de Icaza <miguel@ximian.com>
13843 * expression.cs: Add implicit conversions to the operator ~.
13845 * constant.cs (DecimalConstant.Emit): Emit decimal value.
13847 * typemanager.cs: Locate the decimal constructor.
13849 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13851 * attribute.cs: use the new property of TypeOf.
13852 * expression.cs: added 'get' property around typearg.
13854 These changes fix a build breaker reported by NickD. Is this the
13855 correct way to fix? If not, please, revert my changes and make it
13858 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13860 * attribute.cs: Add support for typeof in attribute invocations.
13861 I am not sure that this is right though.
13863 2002-04-14 Duncan Mak <duncan@ximian.com>
13865 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13866 Binary.Operator.Division case.
13868 2002-04-13 Ravi Pratap <ravi@ximian.com>
13870 * class.cs (DefineType): Ensure that we do a proper check on
13871 attribute types and also register it with the TypeManager.
13873 (TypeContainer.Targets): The default for attribute types is
13874 AttributeTargets.All.
13876 * attribute.cs (ApplyAttributes): Registering the attribute type
13877 is done elsewhere, not when we discover we have a Usage attribute.
13879 2002-04-12 Ravi Pratap <ravi@ximian.com>
13881 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13882 and get rid of is_delegate parameter.
13884 * everywhere : update.
13886 2002-04-12 Ravi Pratap <ravi@ximian.com>
13888 * cs-parser.jay (compilation_unit): Revamp completely to use
13889 some new ideas that I got from Rhys' grammar to solve the problems
13890 with assembly level attributes.
13892 (outer_declaration): New grammar production.
13894 (attribute_sections): Add.
13896 (opt_attributes): Base on attribute_sections
13898 (namespace_declaration): Allow opt_attributes to tackle the case
13899 when we have assembly level attributes - we are clever in this
13902 * attribute.cs (ApplyAttributes): Do not worry about assembly
13903 attributes in the non-global context.
13905 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13906 instead of SetGlobalAttributes.
13908 * class.cs, rootcontext.cs : Ensure we define and generate
13909 attribute types before anything else.
13911 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13912 and flag the new error -20 for the case when the attribute type
13913 does not have valid targets specified. csc does not catch this.
13915 * ../errors/errors.txt : update for error # -20
13917 2002-04-11 Ravi Pratap <ravi@ximian.com>
13919 * support.cs (InternalParameters.ParameterModifier): Do some null
13920 checking and return sane values.
13922 * class.cs (Method.Define): If we are a PInvoke method, ensure
13923 that we are static and extern. Report error # 601
13925 * ../errors/cs0601.cs : Add test case for the above error.
13927 2002-04-07 Ravi Pratap <ravi@ximian.com>
13929 * rootcontext.cs (attribute_types): We need to keep type of
13930 all attribute types separately and emit code for them first.
13932 (RegisterAttribute) : Implement.
13934 * class.cs (DefineType): Check if the current Type is a custom
13935 attribute type and register it accordingly.
13937 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13938 adding the first attribute twice and rename to
13940 (SetGlobalAttributes): this.
13942 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13945 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13946 if we are processing global arguments. Hmm, I am unsure of this.
13948 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13950 * expression.cs: added static array of strings to avoid calling
13951 Enum.ToString () for Operator in Binary. Significant recover of
13954 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13956 * class.cs (FindMembers): Allow the Builders of the various
13957 members to be null. If they are skip them. This only happens
13958 during the PInvoke declaration.
13960 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13962 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13963 failure, so we do not keep going afterwards.
13965 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13966 wanted to pass `false' as the `is_delegate' argument. If this is
13967 the case, why not use delegate_type == null to mean `is_delegate =
13968 false' and anything else as is_delegate = true.
13970 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13972 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13973 code for the section, not the beginning of the tests.
13975 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13977 * cfold.cs: Handle operator + (Enum x, Underlying x)
13979 * expression.cs (Binary): same. Warn about errors where we have
13980 Enum/Enum in operator + as well.
13982 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13985 - added support for switch(bool)
13986 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13987 - add TableSwitchEmit() to handle table-based switch statements
13989 2002-04-05 Ravi Pratap <ravi@ximian.com>
13991 * expression.cs (Invocation.OverloadResolve): Factor out code which
13992 does parameter compatibility checking with arguments so that we can
13993 re-use the code even from Delegate.VerifyApplicability
13995 (VerifyArgumentsCompat): Move above code here.
13997 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13998 and instead make a call to the above method.
14000 2002-03-31 Ravi Pratap <ravi@ximian.com>
14002 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
14003 We use it to keep track of classes which are attribute types.
14005 2002-04-02 Miguel de Icaza <miguel@ximian.com>
14007 * delegate.cs (Delegate.Define): Correctly define the types in the
14008 presence of fixed and array parameters.
14010 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
14013 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
14014 include NonPublic after the first iteration.
14016 * class.cs (Indexer.CheckBase): Only check if both parents are
14019 * cs-parser.jay (accessor_body): If empty, set to null.
14021 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
14022 same code path here to resolve constants names that we did have in
14023 MemberAccess.DoResolve. There is too much code duplicated here.
14025 2002-04-01 Miguel de Icaza <miguel@ximian.com>
14027 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
14029 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
14032 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
14033 tokens, numbers and strings.
14035 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
14038 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
14039 asyncronous parameters and the regular parameters.
14041 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
14042 specify the target directory.
14044 * expression.cs: (This.DoResolve): Simplify
14045 (As.Emit): Optimize, do not generate IsInst if the expression is
14046 always of the given type.
14048 (Is.DoResolve): Bug fix, we were reporting both always/never for
14051 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
14052 creating too many unnecessary arrays.
14054 2002-03-31 Miguel de Icaza <miguel@ximian.com>
14056 * class.cs (EmitFieldInitializer): Use Assign expression to assign
14057 fields instead of rolling our own initializer. Takes care of all
14058 implicit conversions, and drops unnecessary static checks/argument.
14060 2002-03-31 Dick Porter <dick@ximian.com>
14062 * driver.cs: use the GetDirectories() return values properly, and
14063 use "/" as path separator.
14065 2002-03-30 Miguel de Icaza <miguel@ximian.com>
14067 * expression.cs (Unary): Optimize - - expr into expr.
14068 (Binary): Optimize a + (-b) into a -b.
14070 * codegen.cs (CodeGen): Made all methods static.
14072 2002-03-29 Miguel de Icaza <miguel@ximian.com>
14076 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
14077 TypeBuilder property.
14079 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
14082 * tree.cs: Removed the various RecordXXXX, and replaced with a
14083 single RecordDecl. Removed all the accessor methods, and just
14084 left a single access point Type
14086 * enum.cs: Rename DefineEnum to DefineType.
14088 * decl.cs: New abstract method `DefineType' used to unify the
14089 Defines for Enumerations, Interfaces, TypeContainers and
14092 (FindType): Moved LookupInterfaceOrClass here. Moved the
14093 LookupBaseClasses method that used to live in class.cs and
14094 interface.cs here, and renamed to FindType.
14096 * delegate.cs: Implement DefineType. Take advantage of the
14097 refactored pattern for locating the parent builder without taking
14098 the parent_builder argument (which we know does not work if we are
14099 nested, and triggering a toplevel definition).
14101 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14103 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
14104 accessibility of a member has changed during override and report
14107 * class.cs (Method.Define, Property.Define): Only complain on
14108 overrides if the method is private, any other accessibility is
14109 fine (and since we just checked the permission is the same, we are
14112 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
14113 and elif are processed always. The other pre-processing
14114 directives are only processed if we are "taking" the path
14116 2002-03-29 Martin Baulig <martin@gnome.org>
14118 * class.cs (Method.Emit): Only emit symbolic debugging info if the
14119 current location is not Null.
14121 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
14122 a separate method so we can profile it.
14124 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
14125 `span.Seconds' are just seconds, but no minutes or hours.
14126 (MainDriver): Profile the CodeGen.SaveSymbols calls.
14128 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14130 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
14131 Remove the gratuitous set of Final:
14133 // If an interface implementation, then we can set Final.
14134 if (((flags & MethodAttributes.Abstract) == 0) &&
14135 implementing.DeclaringType.IsInterface)
14136 flags |= MethodAttributes.Final;
14138 I do not know what I was smoking when I used that.
14141 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
14142 step into fixing the name resolution issues for delegates and
14143 unifying the toplevel name resolution.
14145 2002-03-28 Martin Baulig <martin@gnome.org>
14147 * class.cs (Method.Emit): If we have a symbol writer, call its
14148 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
14149 tell it about the current method.
14151 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
14152 writer that we're going to emit the first byte of IL code for a new
14153 statement (a new source line).
14154 (EmitContext.EmitTopBlock): If we have a symbol writer, call
14155 EmitContext.Mark() before emitting any code.
14157 * location.cs (SymbolDocument): Return null when we're Null.
14159 * statement.cs (Statement): Moved the `Location loc' variable here.
14160 (Statement.EmitBoolExpression): If we have a symbol writer, call
14161 ec.Mark() before emitting any code to tell it that we're at the
14162 beginning of a new statement.
14163 (StatementExpression): Added `Location' argument to the constructor.
14164 (Block): Added public readonly variable `StartLocation' and public
14165 variable `EndLocation'. The latter is to be set using SetEndLocation().
14166 (Block): Added constructor which takes a start and end location.
14167 (Block.SetEndLocation): New method. This sets the end location.
14168 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
14169 local variables we create.
14170 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
14171 each statement and do also mark the begin and end of the block.
14173 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
14174 tell it the current lexer.Location, use Location.Null for the end of the
14176 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
14177 current block, set its end location using SetEndLocation().
14178 (statement_expression): StatementExpression constructor now takes the
14179 lexer.Location as additional argument.
14180 (for_statement, declare_local_variables): Likewise.
14181 (declare_local_variables): When creating a new implicit block, use the
14182 new Block constructor and pass it the lexer.Location.
14184 2002-03-28 Miguel de Icaza <miguel@ximian.com>
14186 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
14187 members also on the parent interfaces recursively.
14189 2002-03-27 Miguel de Icaza <miguel@ximian.com>
14191 * report.cs: Use new formats, since Gonzalo finished the missing
14194 * expression.cs (Binary.ResolveOperator): added missing operator|
14195 operator& and operator^ for bool/bool.
14197 * cs-parser.jay: CheckDef now takes a Location argument that is
14198 used to report errors more precisly (instead of reporting the end
14199 of a definition, we try to track something which is a lot closer
14200 to the source of the problem).
14202 * cs-tokenizer.cs: Track global token use, so we can properly flag
14203 the use of #define/#undef after the first token has been seen.
14205 Also, rename the reportXXXX to Error_DescriptiveName
14207 * decl.cs (DeclSpace.IsTopLevel): Move property here from
14208 TypeContainer, so that Enum and Interface can use this too.
14210 * class.cs (TypeContainer.LookupInterfaceOrClass,
14211 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
14212 `builder' argument. Typically this was used to pass the parent
14213 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
14216 The problem is that a nested class could trigger the definition of
14217 a toplevel class, and the builder would be obviously wrong in that
14220 So we drop this argument, and we compute dynamically the
14221 TypeBuilder/ModuleBuilder (the correct information was available
14222 to us anyways from DeclSpace.Parent)
14224 * interface.cs (Interface.DefineInterface): Drop builder
14225 parameter cleanup like class.cs
14227 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
14230 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
14233 (Try.Emit): Propagate the returns value from the statement.
14235 (Return.Emit): Even if we are leavning
14237 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
14239 * modifiers.cs: Fix the computation of MethodAttributes flags.
14241 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
14243 * driver.cs: allow compilation of files that start with '/'.
14244 Add a default case when checking the argument of --target.
14246 2002-03-25 Miguel de Icaza <miguel@ximian.com>
14248 * interface.cs: Implement the same search algorithm for types in
14249 the interface code.
14251 * delegate.cs: Do not allow multiple definition.
14253 * Recovered ChangeLog that got accidentally amputated
14255 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
14257 * rootcontext.cs: Load manually enum to allow core classes to
14258 contain enumerations.
14260 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
14261 Update to new static methods in TypeManager.
14263 * typemanager.cs (GetMethod, GetConstructor): Use our
14264 implementation of FindMembers to find the members, since during
14265 corlib compilation, the types are TypeBuilders and GetMethod and
14266 GetConstructor do not work.
14268 Make all methods in TypeManager static.
14270 (InitCodeHelpers): Split the functionality from
14271 the InitCodeTypes function.
14273 * driver.cs: Call InitCodeHelpers after we have populated the
14276 * cs-parser.jay (delegate_declaration): we did not used to compute
14277 the delegate name correctly for void delegates.
14279 2002-03-24 Miguel de Icaza <miguel@ximian.com>
14281 * rootcontext.cs (RootContext): Init the interface_resolve_order
14282 and type_container_resolve_order always.
14284 (ResolveCore, BootstrapCorlib_ResolveClass,
14285 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
14286 compiler when compiling with --nostdlib
14288 * class.cs (TypeContainer.DefineType): Check that our parent is
14289 not null. This test is most important when we are bootstraping
14292 * codegen.cs: Split out the symbol writing code.
14294 2002-03-25 Martin Baulig <martin@gnome.org>
14296 * driver.cs (-g): Made -g an alias for --debug.
14298 2002-03-24 Martin Baulig <martin@gnome.org>
14300 * codegen.cs (SymbolWriter): New public variable. Returns the
14301 current symbol writer.
14302 (CodeGen): Added `bool want_debugging_support' argument to the
14303 constructor. If true, tell the ModuleBuild that we want debugging
14304 support and ask it for the ISymbolWriter.
14305 (Save): If we have a symbol writer, call it's Close() method after
14306 saving the assembly.
14308 * driver.c (--debug): New command line argument to create a
14309 debugger information file.
14311 * location.cs (SymbolDocument): New public property. Returns an
14312 ISymbolDocumentWriter object for the current source file or null
14313 if we don't have a symbol writer.
14315 2002-03-21 Miguel de Icaza <miguel@ximian.com>
14317 * driver.cs (LoadAssembly): Correctly return when all the paths
14318 have been tried and not before.
14320 * statement.cs (Switch.Emit): return the actual coverage for this
14321 statement (returns/not-returns)
14323 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
14324 switch of the statement if we are the last switch section. That
14325 kills two problems: try/catch problems (we used to emit an empty
14326 nop at the end) and switch statements where all branches would
14329 2002-03-19 Miguel de Icaza <miguel@ximian.com>
14331 * driver.cs: Add default assemblies (the equivalent to the
14332 Microsoft CSC.RSP file)
14334 * cs-tokenizer.cs: When updating `cols and setting it to zero,
14335 also update tokens_seen and set it to false.
14337 * driver.cs: Implement --recurse for Mike.
14339 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
14340 correctly splitting out the paths.
14342 2002-03-18 Miguel de Icaza <miguel@ximian.com>
14344 * interface.cs (Interface.PopulateProperty): Instead of using
14345 `parent' as the declaration space for the set parameters, use
14348 * support.cs (InternalParameters): InternalParameters constructor
14349 takes a DeclSpace instead of a TypeContainer.
14351 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
14352 types are being initialized, load the address of it before calling
14355 (New): Provide a mechanism to disable the generation of local
14356 value type temporaries when the caller will be providing us with
14357 an address to store it.
14359 (ArrayCreation.EmitDynamicInitializers): Use it.
14361 2002-03-17 Miguel de Icaza <miguel@ximian.com>
14363 * expression.cs (Invocation.EmitArguments): Only probe for array
14364 property if there is more than one argument. Sorry about that.
14366 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
14367 empty param arrays.
14369 * class.cs (Method.LabelParameters): Fix incorrect code path that
14370 prevented the `ParamArrayAttribute' from being applied to the
14373 2002-03-16 Miguel de Icaza <miguel@ximian.com>
14375 * support.cs (ReflectionParameters): Correctly compute whether the
14376 last argument is a params array. Fixes the problem with
14379 * typemanager.cs: Make the assemblies array always be non-null
14380 (empty, but non-null)
14382 * tree.cs (RecordDecl): New function that abstracts the recording
14383 of names. This reports error 101, and provides a pointer to the
14384 previous declaration. Fixes a crash in the compiler.
14386 * cs-parser.jay (constructor_declaration): Update to new grammar,
14387 and provide a constructor_body that can be empty.
14389 2002-03-15 Miguel de Icaza <miguel@ximian.com>
14391 * driver.cs: Add support for --resources.
14393 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
14394 Make all types for the various array helper methods be integer.
14396 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
14397 CheckState to ConvCast.
14399 (ConvCast): Now it takes a `checked' state argument, to avoid
14400 depending on the emit context for the conversion, and just using
14401 the resolve time setting.
14403 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
14404 instead of Invocation.EmitArguments. We do not emit the original
14405 arguments, instead we emit those which have been converted to
14406 unsigned int expressions.
14408 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
14410 * codegen.cs: ditto.
14412 * expression.cs (LocalVariableReference): Drop the use of the
14413 Store function that depended on the variable index.
14415 * statement.cs (VariableInfo): Drop the `Idx' property from this
14416 class, as this is not taking into account the indexes for
14417 temporaries tat we generate during the execution, getting the
14420 * class.cs: First emit class initializers, then call the parent
14423 * expression.cs (Binary): Fix opcode emision.
14424 (UnaryMutator.EmitCode): Support checked code generation
14426 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
14427 matches for events for both the Static and Instance scans,
14428 pointing to the same element. Fix that.
14430 2002-03-14 Miguel de Icaza <miguel@ximian.com>
14432 * rootcontext.cs (ResolveTree): Always set the
14433 interface_resolve_order, because nested interfaces will be calling
14436 * class.cs (GetInterfaceOrClass): Track the same resolution
14437 process used by TypeManager.LookupType. This fixes the nested
14438 type lookups in class declarations (separate path from
14441 (TypeContainer.DefineType): Also define nested interfaces.
14442 (TypeContainer.RegisterOrder): New public function used to
14443 register the order in which child interfaces need to be closed.
14445 Nested interfaces need to be closed after their parents have been
14448 * interface.cs (InterfaceAttr): Put all the logic for computing
14449 the interface attribute here.
14451 (DefineInterface): Register our interface order with the
14452 RootContext or with the TypeContainer depending on the case.
14454 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14456 * cs-parser.jay: rework foreach statement to work with the new
14457 changes to the policy on SimpleNames.
14459 * report.cs: support Stacktrace on warnings as well.
14461 * makefile: drop --unsafe and /unsafe from the compile.
14463 2002-03-13 Ravi Pratap <ravi@ximian.com>
14465 * ecore.cs (StandardConversionExists): Modify to take an Expression
14466 as the first parameter. Ensure we do null -> reference type conversion
14469 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
14470 temporary Expression objects.
14472 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
14474 * interface.cs: workaround bug in method overloading resolution
14475 (there is already a bugzilla bug for it).
14477 2002-03-12 Miguel de Icaza <miguel@ximian.com>
14479 We could also solve this problem by having a separate path for
14480 performing type lookups, instead of DoResolve, we could have a
14481 ResolveType entry point, and only participating pieces of the
14482 production (simplename, deref, array) would implement this.
14484 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
14485 signal SimpleName to only resolve type names and not attempt to
14486 resolve anything else.
14488 * expression.cs (Cast): Set the flag.
14490 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
14492 * class.cs: Only report 108 if there is no `new' modifier.
14494 * cs-parser.jay: rework foreach statement to work with the new
14495 changes to the policy on SimpleNames.
14497 * report.cs: support Stacktrace on warnings as well.
14499 * makefile: drop --unsafe and /unsafe from the compile.
14501 2002-03-11 Miguel de Icaza <miguel@ximian.com>
14503 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14504 lookups here, instead of doing that at parse time. This means
14505 that our grammar will not introduce `LocalVariableReferences' as
14506 expressions at this point. That solves the problem of code like
14510 static void Main ()
14514 This is only half the fix. The full fix requires parameters to
14515 also be handled in this way.
14517 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
14518 makes the use more obvious of the DeclSpace. The
14519 ec.TypeContainer.TypeBuilder is now only used to pull the
14520 TypeBuilder for it.
14522 My theory is that I can get rid of the TypeBuilder completely from
14523 the EmitContext, and have typecasts where it is used (from
14524 DeclSpace to where it matters).
14526 The only pending problem is that the code that implements Aliases
14527 is on TypeContainer, and probably should go in DeclSpace.
14529 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
14530 lookups here, instead of doing that at parse time. This means
14531 that our grammar will not introduce `LocalVariableReferences' as
14532 expressions at this point. That solves the problem of code like
14536 static void Main ()
14540 This is only half the fix. The full fix requires parameters to
14541 also be handled in this way.
14543 * class.cs (Property.DefineMethod): When implementing an interface
14544 method, set newslot, when implementing an abstract method, do not
14545 set the flag (before we tried never setting it, or always setting
14546 it, which is the difference).
14547 (Indexer.DefineMethod): same.
14548 (Method.DefineMethod): same.
14550 * ecore.cs: Only set the status used flag if we get back a Field.
14552 * attribute.cs: Temporary hack, so Paolo can keep working.
14554 2002-03-08 Ravi Pratap <ravi@ximian.com>
14556 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
14557 the unmanaged type in the case we have a MarshalAs attribute.
14559 (Resolve): Handle the case when we are parsing the special MarshalAs
14560 attribute [we need to store the unmanaged type to use later]
14562 * typemanager.cs (marshal_as_attr_type): Built in type for the
14563 MarshalAs Attribute.
14565 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
14566 on parameters and accordingly set the marshalling info.
14568 2002-03-09 Miguel de Icaza <miguel@ximian.com>
14570 * class.cs: Optimizing slightly by removing redundant code after
14571 we switched to the `NoTypes' return value.
14572 (Property.DefineMethod): use NoTypes here too.
14574 This fixes the bug I introduced in my last batch of changes.
14576 2002-03-05 Ravi Pratap <ravi@ximian.com>
14578 * tree.cs (RecordEnum): Add. We now keep track of enums too.
14580 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
14581 Enums since those are types too.
14583 * cs-parser.jay (enum_declaration): Record enums as we parse them.
14585 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
14586 thanks to a call during the lookup process.
14588 2002-03-07 Miguel de Icaza <miguel@ximian.com>
14590 * statement.cs (Foreach): Lots of work to accomodate a particular
14591 kind of foreach statement that I had not kept in mind. It is
14592 possible to have foreachs on classes that provide a GetEnumerator
14593 method that return objects that implement the "pattern" for using
14594 a foreach, there is no need to support GetEnumerator
14597 This is needed to compile nant.
14599 * decl.cs: Only report 114 if the member is not `Finalize' and if
14600 the warning level is at least 2.
14602 * class.cs: Moved the compare function from Method to
14605 (MethodSignature.InheritableMemberSignatureCompare): Add new
14606 filter function that is used to extract inheritable methods from a
14609 (Method.Define): Use the new `inheritable_method_signature_filter'
14612 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
14615 2002-03-06 Miguel de Icaza <miguel@ximian.com>
14617 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
14619 * cs-parser.jay: Add opt_semicolon to the interface declaration.
14621 * expression.cs: Pass location information to
14622 ConvertImplicitStandard.
14624 * class.cs: Added debugging code to track return values from
14627 2002-03-05 Miguel de Icaza <miguel@ximian.com>
14629 * expression.cs (Is.DoResolve): If either side of the `is' is an
14630 interface, do not flag the warning.
14632 * ecore.cs (ImplicitReferenceConversion): We need a separate test
14635 * report.cs: Allow for --fatal to be used with --probe.
14637 * typemanager.cs (NoTypes): Move the definition for the empty Type
14640 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
14642 (TypeContainer.DefineProxy): New function used to proxy to parent
14643 implementations when implementing interfaces.
14644 (TypeContainer.ParentImplements): used to lookup if our parent
14645 implements a public function that is required by an interface.
14646 (TypeContainer.VerifyPendingMethods): Hook this up.
14648 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
14649 `modules' and `assemblies' arraylists into arrays. We only grow
14650 these are the very early start up of the program, so this improves
14651 the speedof LookupType (nicely measured).
14653 * expression.cs (MakeByteBlob): Replaced unsafe code with
14654 BitConverter, as suggested by Paolo.
14656 * cfold.cs (ConstantFold.Binary): Special case: perform constant
14657 folding of string concatenation, but if either side is a string,
14658 and the other is not, then return null, and let the runtime use
14659 the concatenation on the string plus the object (using
14660 `Object.ToString').
14662 2002-03-04 Miguel de Icaza <miguel@ximian.com>
14664 Constant Folding has been implemented now.
14666 * expression.cs (Unary.Reduce): Do not throw an exception, catch
14667 the error instead on types that are not supported in one's
14670 * constant.cs (Constant and all children): New set of functions to
14671 perform implict and explicit conversions.
14673 * ecore.cs (EnumConstant): Implement the new functions to perform
14674 conversion by proxying to the child expression.
14676 * codegen.cs: (ConstantCheckState): Constant evaluation has its
14677 own separate setting that can not be turned off from the command
14678 line using --unchecked or --checked and is only controlled using
14679 the checked/unchecked statements and expressions. This setting is
14680 used by the constant folder to flag errors.
14682 * expression.cs (CheckedExpr, UncheckedExpr): Set the
14683 ConstantCheckState as well.
14685 During Resolve, they also have to flag the state, because the
14686 constant folder runs completely in the Resolve phase.
14688 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
14691 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14693 * cfold.cs: New file, this file contains the constant folder.
14695 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
14696 argument to track whether we are using the resulting address to
14697 load or store a value and provide better error messages.
14699 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
14700 new AddressOf arguments.
14702 * statement.cs (Foreach.EmitCollectionForeach): Update
14704 * expression.cs (Argument.Emit): Call AddressOf with proper
14705 arguments to track usage.
14707 (New.DoEmit): Call AddressOf with new arguments.
14709 (Unary.Emit): Adjust AddressOf call.
14711 2002-03-01 Ravi Pratap <ravi@ximian.com>
14713 * cs-parser.jay (member_access): Change the case for pre-defined types
14714 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
14717 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
14720 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
14721 essentially like methods and apply attributes like MethodImplOptions to them too.
14723 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
14726 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
14727 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
14730 * Update code everywhere accordingly.
14732 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
14734 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
14736 2002-02-28 Ravi Pratap <ravi@ximian.com>
14738 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
14739 try performing lookups against those instead of jumping straight into using
14740 the 'using' clauses.
14742 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
14744 (LookupType): Perform lookups in implicit parents too.
14746 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
14747 sequence as RootContext.LookupType.
14749 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
14750 the various cases of namespace lookups into this method.
14752 2002-03-01 Miguel de Icaza <miguel@ximian.com>
14754 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
14755 in positional arguments)
14757 * class.cs (Operator): Update the AllowedModifiers to contain
14760 * cs-parser.jay: Update operator declaration to allow for the
14761 operator body to be empty.
14763 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
14766 2002-02-27 Miguel de Icaza <miguel@ximian.com>
14768 * class.cs (Method.Emit): Label parameters.
14770 * driver.cs: Return 1 or 0 as the program exit code.
14772 2002-02-26 Miguel de Icaza <miguel@ximian.com>
14774 * expression.cs: Special case the `null' object when trying to
14775 auto-compute the type, as anything can be explicitly converted to
14778 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
14779 spotting this Paolo.
14781 (Expression.ImplicitNumericConversion): Perform comparissions of
14782 the type using the underlying type in the case of an enumeration
14783 rather than using the enumeration type for the compare.
14785 Cope with the underlying == type case, which is not possible to
14788 (Expression.ConvertNumericExplicit): Perform comparissions of
14789 the type using the underlying type in the case of an enumeration
14790 rather than using the enumeration type for the compare.
14792 * driver.cs: If the user does not supply an extension, assume .exe
14794 * cs-parser.jay (if_statement): Rewrote so that we can track the
14795 location for the if statement.
14797 * expression.cs (Binary.ConstantFold): Only concat strings when
14798 the operation is "+", not everything ;-)
14800 * statement.cs (Statement.EmitBoolExpression): Take a location
14802 (If, While, Do): Track location.
14804 * expression.cs (Binary.ResolveOperator): In the object + string
14805 case, I was missing a call to ConvertImplicit
14807 2002-02-25 Ravi Pratap <ravi@ximian.com>
14809 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
14810 Location arguments. Ensure we use RootContext.LookupType to do our work
14811 and not try to do a direct Type.GetType and ModuleBuilder.GetType
14813 * interface.cs (PopulateMethod): Handle the type of the parameter being
14816 * expression.cs (Invocation.BetterFunction): Handle the case when we
14817 have a params method with no fixed arguments and a call is made with no
14820 2002-02-25 Miguel de Icaza <miguel@ximian.com>
14822 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
14823 the verbatim-string-literal
14825 * support.cs (InternalParameters.ParameterModifier): handle null
14827 (InternalParameters.ParameterType): ditto.
14829 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
14830 duplicating the name of the variable parameter.
14831 (GetParameterByName): Fix bug where we were not looking up array
14832 paramters if they were the only present (thanks Paolo!).
14833 (GetParameterInfo): We only have an empty set of types if both
14834 fixed and array are set to null.
14835 (GetParameterInfo-idx): Handle FixedParameter == null
14837 * cs-parser.jay: Handle the case where there is no catch
14838 statements (missing null test).
14840 2002-02-22 Miguel de Icaza <miguel@ximian.com>
14842 * driver.cs (MainDriver): Be conservative on our command line
14845 Catch DirectoryNotFoundException when calling GetFiles.
14847 (SplitPathAndPattern): Used to split the input specification into
14848 a path and a pattern that we can feed to Directory.GetFiles.
14850 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14852 * statement.cs (Fixed): Implement the last case of the Fixed
14853 statement (string handling).
14855 * expression.cs (StringPtr): New class used to return a char * to
14856 a string; Used by the Fixed statement.
14858 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14860 * expression.cs (Binary.ResolveOperator): Remove redundant
14861 MemberLookup pn parent type.
14862 Optimize union call, we do not need a union if the types are the same.
14863 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14866 Specialize the use of MemberLookup everywhere, instead of using
14867 the default settings.
14869 (StackAlloc): Implement stackalloc keyword.
14871 * cs-parser.jay: Add rule to parse stackalloc.
14873 * driver.cs: Handle /h, /help, /?
14875 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14876 before we supported unsafe code.
14878 * makefile: add --unsafe to the self compilation of mcs.
14880 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14882 * expression.cs (PointerArithmetic): New class that is used to
14883 perform pointer arithmetic.
14884 (Binary.Resolve): Handle pointer arithmetic
14885 Handle pointer comparission.
14886 (ArrayPtr): Utility expression class that is used to take the
14887 address of an array.
14889 (ElementAccess): Implement array access for pointers
14891 * statement.cs (Fixed): Implement fixed statement for arrays, we
14892 are missing one more case before we are done.
14894 * expression.cs (Indirection): Implement EmitAssign and set the
14895 ExprClass to Variable. This allows pointer dereferences to be
14896 treated as variables, and to have values assigned to them.
14898 * ecore.cs (Expression.StoreFromPtr): New utility function to
14899 store values dereferencing.
14901 2002-02-20 Ravi Pratap <ravi@ximian.com>
14903 * expression.cs (Binary.ResolveOperator): Ensure that we are
14904 not trying to operate on a void type - this fixes the reported
14907 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14908 the parent implementation is sealed.
14910 * ../errors/cs0239.cs : Add.
14912 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14914 * typemanager.cs (unverifiable_code_type): Corresponds to
14915 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14916 which have unsafe code in them.
14918 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14921 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14923 * cs-tokenizer.cs: Add support for @"litreal strings"
14925 Make tokenizer accept pre-processor directives
14926 on any column (remove the old C-like limitation).
14928 * rootcontext.cs (EmitCode): Emit any global attributes.
14929 (AddGlobalAttributes): Used to keep track of assembly attributes.
14931 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14933 * cs-parser.jay: Add support for global attributes.
14935 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14937 * expression.cs (Indirection): New helper class. Unary will
14938 create Indirection classes to be able to implement the
14939 IMemoryLocation interface on it.
14941 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14943 * cs-parser.jay (fixed_statement): reference the right statement.
14945 * statement.cs (Fixed.Emit): Finish implementing the fixed
14946 statement for the &x case.
14948 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14950 * class.cs (Property.Define, Method.Define): Remove newslot when
14953 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14954 wrong. NewSlot should only be used if the `new' keyword is present.
14956 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14957 locating our system dir. Sorry about this.
14959 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14961 * driver.cs (GetSystemDir): Compute correctly the location of our
14962 system assemblies. I was using the compiler directory instead of
14963 the library directory.
14965 2002-02-13 Ravi Pratap <ravi@ximian.com>
14967 * expression.cs (BetterFunction): Put back in what Miguel commented out
14968 since it is the correct fix. The problem is elsewhere ;-)
14970 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14971 parameters of the parms method are themselves compatible or not !
14973 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14974 to check that a class implements an interface before saying that an implicit
14975 conversion was allowed. Use ImplementsInterface to do the checking.
14977 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14979 * class.cs (Method.Define): Track whether we are an explicit
14980 implementation or not. And only call DefineMethodOverride if we
14981 are an explicit implementation.
14983 (Property.DefineMethod): Ditto.
14985 2002-02-11 Ravi Pratap <ravi@ximian.com>
14987 * expression.cs (BetterFunction): Catch hideous bug which was
14988 preventing us from detecting ambiguous calls due to implicit casts i.e
14991 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14993 * support.cs (Pair): Remove un-needed method. I figured why I was
14994 getting the error in cs-parser.jay, the variable in a foreach loop
14995 is readonly, and the compiler does not really treat this as a variable.
14997 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14998 instead of EQUALS in grammar.
15000 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
15002 * expression.cs (Unary.DoResolve): Check whether the argument is
15005 2002-01-28 Miguel de Icaza <miguel@ximian.com>
15007 * support.cs: Api for Pair to set a value. Despite the fact that
15008 the variables are public the MS C# compiler refuses to compile
15009 code that accesses the field if the variable is part of a foreach
15012 * statement.cs (Fixed): Begin implementation of the fixed
15015 (Block.AddVariable): Return the VariableInfo on success and null
15016 on failure instead of true/false.
15018 * cs-parser.jay (foreach): Catch errors on variables already
15019 defined (we were ignoring this value before) and properly unwind
15020 the block hierarchy
15022 (fixed_statement): grammar for the fixed statement.
15024 2002-01-25 Miguel de Icaza <miguel@ximian.com>
15026 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
15027 pointer types to be incretemented.
15029 (SizeOf): Implement.
15031 * cs-parser.jay (pointer_member_access): Implement
15032 expr->IDENTIFIER production.
15034 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
15035 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
15038 (Unary): Implement indirection.
15040 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
15041 use in non-unsafe context).
15043 (SimpleName.DoResolve): Check for pointers in field access on safe
15046 (Expression.LoadFromPtr): Factor the load-indirect code in this
15047 function. This was duplicated in UnboxCast and ParameterReference
15049 2002-01-24 Miguel de Icaza <miguel@ximian.com>
15051 * expression.cs (ComposedCast): report an error if a pointer cast
15052 is used in a safe region.
15054 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
15055 pointer type casts in unsafe context.
15057 * codegen.cs (EmitContext): Set up IsUnsafe.
15059 * cs-parser.jay (non_expression_type): Add productions for pointer
15062 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
15063 code. We should not use force into static mode if the method is
15064 not virtual. Fixes bug in MIS
15066 * statement.cs (Do.Emit, While.Emit, For.Emit,
15067 Statement.EmitBoolExpression): Add support to Do and While to
15068 propagate infinite loop as `I do return' semantics.
15070 Improve the For case to also test for boolean constants.
15072 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
15073 to the list of attributes we can add.
15075 Remove `EmitContext' argument.
15077 * class.cs (Method.Define): Apply parameter attributes.
15078 (Constructor.Define): Apply parameter attributes.
15079 (MethodCore.LabelParameters): Move here the core of labeling
15082 * support.cs (ReflectionParameters.ParameterModifier,
15083 InternalParameters.ParameterModifier): Use IsByRef on the type and
15084 only return the OUT bit for these parameters instead of in/out/ref
15087 This is because I miss-understood things. The ParameterInfo.IsIn
15088 and IsOut represent whether the parameter has the [In] and [Out]
15091 2002-01-22 Miguel de Icaza <miguel@ximian.com>
15093 * ecore.cs (FieldExpr.Emit): Release temporaries.
15095 * assign.cs (LocalTemporary.Release): new function.
15097 * codegen.cs (EmitContext.GetTemporaryStorage,
15098 EmitContext.FreeTemporaryStorage): Rework the way we deal with
15099 temporary storage. Now we can "put back" localbuilders when we
15102 2002-01-21 Miguel de Icaza <miguel@ximian.com>
15104 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
15105 need to make a copy of the variable to generate verifiable code.
15107 2002-01-19 Miguel de Icaza <miguel@ximian.com>
15109 * driver.cs: Compute dynamically the system directory.
15111 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
15112 Slower, but more generally useful. Used by the abstract
15113 registering implementation.
15115 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
15116 the rules for the special rule on Type/instances. First check if
15117 we have the same name, and if so, try that special static path
15118 rather than the instance path.
15120 2002-01-18 Miguel de Icaza <miguel@ximian.com>
15122 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
15125 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
15126 Enum, ValueType, Delegate or Array for non-corlib compiles.
15128 * cs-tokenizer.cs: Catch long identifiers (645)
15130 * typemanager.cs (IndexerPropetyName): Ravi never tested this
15133 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
15134 fix, we were returning too early, so we were not registering
15135 pending methods from abstract classes.
15137 Do not register pending methods if the class is abstract.
15139 * expression.cs (Conditional.DoResolve): Report circular implicit
15140 conversions when we neecd to compute it for conditional
15143 (Is.DoResolve): If the expression is always of the provided type,
15144 flag warning 183. If the expression can not ever be of the
15145 provided type flag warning 184.
15147 * class.cs: Catch 169 as well.
15149 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
15152 2002-01-18 Nick Drochak <ndrochak@gol.com>
15154 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
15156 2002-01-17 Miguel de Icaza <miguel@ximian.com>
15158 * interface.cs: (PopulateMethod): Check for pointers being defined
15159 only if the unsafe context is active.
15160 (PopulateProperty): ditto.
15161 (PopulateIndexer): ditto.
15163 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
15164 specified. If pointers are present, make sure that they are
15165 present in an unsafe context.
15166 (Constructor, Constructor.Define): ditto.
15167 (Field, Field.Define): ditto.
15168 (Property, Property.Define): ditto.
15169 (Event, Event.Define): ditto.
15171 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
15172 hashtable if there are classes or structs defined.
15174 * expression.cs (LocalVariableReference.DoResolve): Simplify this
15175 code, as the constant resolution moved.
15177 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
15178 the metadata, so we can flag error 133.
15180 * decl.cs (MemberCore.UnsafeOK): New function to test that a
15181 pointer is being declared in an unsafe context.
15183 2002-01-16 Miguel de Icaza <miguel@ximian.com>
15185 * modifiers.cs (Modifiers.Check): Require a Location argument.
15186 Report error 227 for Unsafe use.
15188 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
15190 * statement.cs (For.Emit): If the test is null, then report that
15191 we do `return', as we wont reach anything afterwards.
15193 (Switch.SwitchGoverningType): Track the expression that matched
15196 * driver.cs: Allow negative numbers as an error code to flag.
15198 * cs-parser.jay: Handle 1551.
15200 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
15202 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15204 * cs-parser.jay: Report 1518 (type declaration can only contain
15205 class, struct, interface, enum or delegate)
15207 (switch_label): Report 1523 (keywords `case' or `default' must
15210 (opt_switch_sections): Report 1522 (empty switch)
15212 * driver.cs: Report 1515 (response file specified multiple times)
15213 Report 1516 (Source file specified multiple times).
15215 * expression.cs (Argument.Resolve): Signal 1510
15217 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
15218 access not allowed in static code)
15220 2002-01-11 Ravi Pratap <ravi@ximian.com>
15222 * typemanager.cs (IsPointerType): Utility method which we are going
15225 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
15226 the object type, so we take care of that.
15228 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
15230 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
15231 added to non-params parameters :-)
15233 * typemanager.cs (CSharpName): Include 'void' type too.
15235 (void_ptr_type): Include in the set of core types.
15237 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
15240 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
15243 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
15244 completely forgotten about it.
15246 2002-01-10 Ravi Pratap <ravi@ximian.com>
15248 * cs-parser.jay (pointer_type): Add. This begins our implementation
15249 of parsing rules for unsafe code.
15251 (unsafe_statement): Implement.
15253 (embedded_statement): Modify to include the above.
15255 * statement.cs (Unsafe): Implement new class for unsafe blocks.
15257 * codegen.cs (EmitContext.InUnsafe): Add. This determines
15258 if the current context is an unsafe one.
15260 * cs-parser.jay (local_variable_pointer_type): Since local variable types
15261 are handled differently, we need separate rules for them.
15263 (local_variable_declaration): Update to use local_variable_pointer_type
15264 to allow variable declarations of unmanaged pointer types.
15266 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
15267 in unsafe contexts.
15269 * ../errors/cs0214.cs : Add.
15271 2002-01-16 Nick Drochak <ndrochak@gol.com>
15273 * makefile: remove 'response' file when cleaning.
15275 2002-01-15 Miguel de Icaza <miguel@ximian.com>
15277 * cs-parser.jay: Report 1524.
15279 2002-01-14 Miguel de Icaza <miguel@ximian.com>
15281 * typemanager.cs (RegisterMethod): drop checking if we have
15282 registered this from here
15284 2002-01-12 Miguel de Icaza <miguel@ximian.com>
15286 * class.cs (Method.EmitDestructor): Implement calling our base
15289 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
15290 value of InFinally.
15292 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
15293 this routine and will wrap the call in a try/catch block. Deal
15296 2002-01-11 Miguel de Icaza <miguel@ximian.com>
15298 * ecore.cs (Expression.MemberLookup): instead of taking a
15299 parameter `same_type' that was used to tell whether we could
15300 access private members we compute our containing type from the
15303 (FieldExpr): Added partial support for volatile fields. This does
15304 not work for volatile fields exposed from assemblies, as I can not
15305 figure out how to extract the modreq from it.
15307 Updated all the source files to use this.
15309 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
15310 because it is referenced by MemberLookup very often.
15312 2002-01-09 Ravi Pratap <ravi@ximian.com>
15314 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
15315 TypeBuilder.GetCustomAttributes to retrieve what we need.
15317 Get rid of redundant default_member_attr_type as this is the same as
15318 default_member_type which already exists.
15320 * interface.cs, attribute.cs : Update accordingly.
15322 2002-01-08 Miguel de Icaza <miguel@ximian.com>
15324 * typemanager.cs: Enable IndexerPropertyName again. It does not
15325 work for TYpeBuilders though. Ravi, can you please fix this?
15327 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
15329 * expression.cs (Argument.Emit): Handle the case of ref objects
15330 being passed to ref functions;
15332 (ParameterReference.EmitLoad): Loads the content of the pointer
15333 without dereferencing.
15335 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15337 * cs-tokenizer.cs: Implemented the pre-processing expressions.
15339 2002-01-08 Ravi Pratap <ravi@ximian.com>
15341 * class.cs (Indexer.DefineMethod): Incorporate the interface
15342 type in the name of the method if we are doing explicit interface
15345 * expression.cs (ConversionExists): Remove as it is completely obsolete.
15347 (BetterConversion): Fix extremely trivial bug where we were referring to
15348 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
15351 * ../errors/bug16.cs : Add although we have fixed it.
15353 2002-01-07 Miguel de Icaza <miguel@ximian.com>
15355 * expression.cs (BaseIndexer): Begin implementation.
15357 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
15359 * cs-parser.jay (indexer_declarator): Use qualified_identifier
15360 production directly to remove a shift/reduce, and implement
15361 explicit interface implementation.
15363 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
15364 after a floating point suffix.
15366 * expression.cs (DoNumericPromotions): Improved the conversion for
15367 uint/uint. If we have a constant, we avoid doing a typecast to a
15370 * class.cs (Indexer): Implement explicit interface implementation
15373 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
15375 * class.cs: make the default instance constructor public and hidebysig.
15377 2001-01-03 Ravi Pratap <ravi@ximian.com>
15379 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
15380 so we can call it from elsewhere.
15382 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
15383 we emit it internally if the class has a defined indexer; otherwise the user
15384 emits it by decorating the class definition with the DefaultMemberAttribute.
15386 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
15387 attribute is not used on a type which defines an indexer.
15389 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
15390 character when we skip whitespace.
15392 * ../errors/cs0646.cs : Add.
15394 2002-01-03 Miguel de Icaza <miguel@ximian.com>
15396 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
15399 * makefile: Add practical target `mcs3.exe' which builds the third
15400 generation compiler.
15402 * expression.cs (New): Fix structures constructor calling.
15404 * class.cs (Property, Method, Indexer): Emit Final flag on the
15405 method if we are an interface implementation and we are not
15408 * ecore.cs (PropertyExpr): New public field `IsBase', tells
15409 whether this property is referencing a `base' method.
15411 * expression.cs (Invocation.EmitCall): take an extra argument:
15412 is_base, this is used to determine whether the `call' or
15413 `callvirt' opcode should be used.
15416 * delegate.cs: update EmitCall.
15418 * class.cs (Method.Define): Set NewSlot for the cases where we are
15419 not implementing an interface method.
15421 (Property.Define): ditto.
15423 2002-01-02 Miguel de Icaza <miguel@ximian.com>
15425 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
15426 'r'. Allows mcs to parse itself fully.
15428 2002-01-02 Ravi Pratap <ravi@ximian.com>
15430 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
15431 of the number of initializers that require the InitializeArray method.
15433 (CheckIndices): Store the Expression in all cases - not the plain value. Also
15434 update the above field where necessary.
15436 (MakeByteBlob): Update accordingly.
15438 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
15441 (EmitDynamicInitializers): Update in accordance with the new optimization.
15443 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
15444 same OpCode applies.
15446 * cs-parser.jay : Fix some glaring errors I introduced.
15448 2002-01-01 Ravi Pratap <ravi@ximian.com>
15450 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
15451 so that we can check for name clashes there too.
15453 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
15454 for interface indexers.
15456 * interfaces.cs (Define): Emit the default member attribute.
15458 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
15459 variable was being referred to while setting the value ;-)
15461 2002-01-01 Miguel de Icaza <miguel@ximian.com>
15463 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
15464 byte-by-byte information when we know the data is zero.
15466 Make the block always a multiple of 4, because
15467 DefineInitializedData has a bug.
15469 * assign.cs: Fix, we should assign from the temporary, not from
15472 * expression.cs (MakeByteBlob): Fix my incorrect code.
15474 2001-12-31 Miguel de Icaza <miguel@ximian.com>
15476 * typemanager.cs (EnumToUnderlying): This function is used to get
15477 the underlying type from an enumeration, because it does not
15480 * constant.cs: Use the I4_S form for values between -128 and 127.
15482 * statement.cs (Block.LookupLabel): Looks up a label.
15483 (Block): Drop support for labeled blocks.
15485 (LabeledStatement): New kind of statement that represents a label
15488 (Goto): Finally implement this bad boy.
15490 * cs-parser.jay: Update to reflect new mechanism to implement
15493 2001-12-30 Miguel de Icaza <miguel@ximian.com>
15495 * codegen.cs (EmitContext.This): a codegen property that keeps the
15496 a single instance of this instead of creating many different this
15499 * delegate.cs (Delegate.DoResolve): Update to use the property;
15501 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
15503 * expression.cs (BaseAccess.DoResolve): Ditto.
15505 2001-12-29 Ravi Pratap <ravi@ximian.com>
15507 * typemanager.cs (methodimpl_attr_type): Add to hold the type
15508 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
15510 (InitCoreTypes): Update accordingly.
15512 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
15513 so we can quickly store the state.
15515 (ApplyAttributes): Set the correct implementation flags
15516 for InternalCall methods.
15518 2001-12-29 Miguel de Icaza <miguel@ximian.com>
15520 * expression.cs (EmitCall): if a method is not virtual, then do
15521 not use callvirt on it.
15523 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
15524 user defined stuff) requires the use of stobj, which takes an
15525 address on the stack instead of an array and an index. So emit
15526 the Ldelema operation for it.
15528 (EmitStoreOpcode): Use stobj for valuetypes.
15530 (UnaryMutator.EmitCode): Use the right 1 value depending on
15531 whether we are dealing with int64/uint64, float or doubles.
15533 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
15534 constructors that I implemented last night.
15536 (Constructor.IsDefault): Fix to work properly for static
15539 * cs-parser.jay (CheckDef): report method signature errors.
15540 Update error number 103 to be 132.
15542 * decl.cs: New AdditionResult enumeration value: MethodExists.
15543 Although we do this check for methods later on in the semantic
15544 analysis, catching repeated default constructors is so easy that
15545 we catch these here.
15547 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
15550 (ParameterReference.EmitAssign, Emit): handle
15553 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
15554 (ArrayAccess.EmitStoreOpcode): ditto.
15556 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
15558 * expression.cs (MakeByteBlob): Complete all the missing types
15559 (uint, short, ushort, byte, sbyte)
15561 * class.cs: Only init instance field initializers on instance
15564 Rename `constructors' to instance_constructors.
15566 (TypeContainer.AddConstructor): Only add constructors to the list
15567 if it is not static.
15569 Make sure that we handle default_static_constructor independently
15570 everywhere where we handle instance_constructors
15572 2001-12-28 Miguel de Icaza <miguel@ximian.com>
15574 * class.cs: Do not lookup or create a base initializer for a
15575 static constructor.
15577 (ConstructorInitializer.Resolve): use the proper type to lookup
15580 * cs-parser.jay: Report error 1585 (modifiers between type and name).
15582 * enum.cs, interface.cs: Remove CloseType, this is taken care by
15585 * decl.cs: CloseType is now an virtual method, the default
15586 implementation just closes this type.
15588 2001-12-28 Ravi Pratap <ravi@ximian.com>
15590 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
15591 to PreserveSig by default. Also emit HideBySig on such methods.
15593 Basically, set the defaults to standard values.
15595 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
15596 argument, if candidate is better, it can't be worse than the best !
15598 (Invocation): Re-write bits to differentiate between methods being
15599 applicable in their expanded form and their normal form - for params
15602 Get rid of use_standard everywhere as only standard conversions are allowed
15603 in overload resolution.
15605 More spec conformance.
15607 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15609 * driver.cs: Add --timestamp, to see where the compiler spends
15612 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
15613 `this' in static code.
15615 (SimpleName.DoResolve): Implement in terms of a helper function
15616 that allows static-references to be passed upstream to
15619 (Expression.ResolveWithSimpleName): Resolve specially simple
15620 names when called by MemberAccess to implement the special
15623 (Expression.ImplicitReferenceConversion): Handle conversions from
15624 Null to reference types before others, as Null's type is
15627 * expression.cs (Invocation.EmitCall): Handle the special case of
15628 calling methods declared on a reference type from a ValueType
15629 (Base classes System.Object and System.Enum)
15631 (MemberAccess.Resolve): Only perform lookups on Enumerations if
15632 the left hand side is a TypeExpr, not on every enumeration.
15634 (Binary.Resolve): If types are reference types, then do a cast to
15635 object on operators != and == of both arguments.
15637 * typemanager.cs (FindMembers): Extract instance and static
15638 members if requested.
15640 * interface.cs (PopulateProperty): Use void_type instead of null
15641 as the return type for the setter method.
15643 (PopulateIndexer): ditto.
15645 2001-12-27 Ravi Pratap <ravi@ximian.com>
15647 * support.cs (ReflectionParameters): Fix minor bug where we
15648 were examining the wrong parameter for the ParamArray attribute.
15650 Cope with requests for the type of the parameter at position
15651 greater than the params parameter's. We now return the element
15652 type of the params array as that makes more sense.
15654 * expression.cs (Invocation.IsParamsMethodApplicable): Update
15655 accordingly as we no longer have to extract the element type
15658 (Invocation.OverloadResolve): Update.
15660 2001-12-27 Miguel de Icaza <miguel@ximian.com>
15662 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
15663 against IEnumerator, test whether the return value is a descendant
15664 of the IEnumerator interface.
15666 * class.cs (Indexer.Define): Use an auxiliary method to implement
15667 the other bits of the method definition. Begin support for
15668 explicit interface implementation.
15670 (Property.DefineMethod): Use TypeManager.void_type instead of null
15671 for an empty return value.
15673 2001-12-26 Miguel de Icaza <miguel@ximian.com>
15675 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
15676 dealing with a FieldExpr which is composed of a FieldBuilder, in
15677 the code path we did extract the constant, but we should have
15678 obtained the underlying value to be able to cast it (otherwise we
15679 end up in an infinite loop, this is what Ravi was running into).
15681 (ArrayCreation.UpdateIndices): Arrays might be empty.
15683 (MemberAccess.ResolveMemberAccess): Add support for section
15684 14.5.4.1 that deals with the special case of E.I when E is a type
15685 and something else, that I can be a reference to a static member.
15687 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
15688 handle a particular array type to create byte blobs, it is just
15689 something we dont generate byteblobs for.
15691 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
15694 * location.cs (Push): remove the key from the hashtable that we
15695 are about to add. This happens for empty files.
15697 * driver.cs: Dispose files after we have parsed them.
15699 (tokenize): new function that only runs the tokenizer on its
15700 input, for speed testing.
15702 2001-12-26 Ravi Pratap <ravi@ximian.com>
15704 * class.cs (Event.Define): Define the private field only if there
15705 are no accessors defined.
15707 * expression.cs (ResolveMemberAccess): If there is no associated
15708 field with the event, that means we have an event defined with its
15709 own accessors and we should flag error cs0070 since transforming
15710 ourselves into a field is not valid in that case.
15712 * ecore.cs (SimpleName.DoResolve): Same as above.
15714 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
15715 and charset to sane values.
15717 2001-12-25 Ravi Pratap <ravi@ximian.com>
15719 * assign.cs (DoResolve): Perform check on events only if they
15720 are being accessed outside the declaring type.
15722 * cs-parser.jay (event_declarations): Update rules to correctly
15723 set the type of the implicit parameter etc.
15725 (add_accessor, remove_accessor): Set current local parameters.
15727 * expression.cs (Binary): For delegate addition and subtraction,
15728 cast the return value from the method into the appropriate delegate
15731 2001-12-24 Ravi Pratap <ravi@ximian.com>
15733 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
15734 of these as the workaround is unnecessary.
15736 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
15737 delegate data - none of that is needed at all.
15739 Re-write bits to extract the instance expression and the delegate method
15742 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
15745 * attribute.cs (ApplyAttributes): New method to take care of common tasks
15746 of attaching attributes instead of duplicating code everywhere.
15748 * everywhere : Update code to do attribute emission using the above method.
15750 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15752 * expression.cs (IsParamsMethodApplicable): if there are not
15753 parameters, return immediately.
15755 * ecore.cs: The 0 literal can be implicity converted to an enum
15758 (SimpleName.DoResolve): First lookup the type, then lookup the
15761 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
15762 want to get its address. If the InstanceExpression is not
15763 addressable, store the result in a temporary variable, then get
15766 * codegen.cs: Only display 219 errors on warning level or above.
15768 * expression.cs (ArrayAccess): Make it implement the
15769 IMemoryLocation interface.
15771 (Binary.DoResolve): handle the operator == (object a, object b)
15772 and operator != (object a, object b) without incurring into a
15773 BoxedCast (because 5 != o should never be performed).
15775 Handle binary enumerator operators.
15777 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
15778 value type, otherwise use Ldelem_ref.
15780 Use precomputed names;
15782 (AddressOf): Implement address of
15784 * cs-parser.jay (labeled_statement): Fix recursive block
15785 addition by reworking the production.
15787 * expression.cs (New.DoEmit): New has a special case:
15789 If we are dealing with a ValueType, we have a few
15790 situations to deal with:
15792 * The target of New is a ValueType variable, that is
15793 easy, we just pass this as the variable reference
15795 * The target of New is being passed as an argument,
15796 to a boxing operation or a function that takes a
15799 In this case, we need to create a temporary variable
15800 that is the argument of New.
15803 2001-12-23 Ravi Pratap <ravi@ximian.com>
15805 * rootcontext.cs (LookupType): Check that current_type is not null before
15806 going about looking at nested types.
15808 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
15809 not implement the IAssignMethod interface any more.
15811 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
15812 where we tranform them into FieldExprs if they are being resolved from within
15813 the declaring type.
15815 * ecore.cs (SimpleName.DoResolve): Do the same here.
15817 * assign.cs (DoResolve, Emit): Clean up code considerably.
15819 * ../errors/bug10.cs : Add.
15821 * ../errors/cs0070.cs : Add.
15823 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
15825 * assign.cs : Get rid of EventIsLocal everywhere.
15827 2001-12-23 Miguel de Icaza <miguel@ximian.com>
15829 * ecore.cs (ConvertIntLiteral): finished the implementation.
15831 * statement.cs (SwitchLabel): Convert the value we are using as a
15832 key before looking up the table.
15834 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15836 * codegen.cs (EmitTopBlock): Require a Location argument now.
15838 * cs-parser.jay (constructor_declarator): We need to setup
15839 current_local_parameters before we parse the
15840 opt_constructor_initializer, to allow the variables to be bound
15841 to the constructor arguments.
15843 * rootcontext.cs (LookupType): First lookup nested classes in our
15844 class and our parents before we go looking outside our class.
15846 * expression.cs (ConstantFold): Extract/debox the values at the
15849 * rootcontext.cs (EmitCode): Resolve the constants first before we
15850 resolve the types. This is not really needed, but it helps debugging.
15852 * statement.cs: report location.
15854 * cs-parser.jay: pass location to throw statement.
15856 * driver.cs: Small bug fix.
15858 * report.cs: Updated format to be 4-zero filled digits.
15860 2001-12-22 Ravi Pratap <ravi@ximian.com>
15862 * expression.cs (CheckIndices): Fix minor bug where the wrong
15863 variable was being referred to ;-)
15865 (DoEmit): Do not call EmitStaticInitializers when the
15866 underlying type is System.Object.
15868 2001-12-21 Ravi Pratap <ravi@ximian.com>
15870 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15871 and do the usual workaround for SRE.
15873 * class.cs (MyEventBuilder.EventType): New member to get at the type
15874 of the event, quickly.
15876 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15878 * assign.cs (Assign.DoResolve): Handle the case when the target
15879 is an EventExpr and perform the necessary checks.
15881 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15884 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15886 (EventExpr): Set the type in the constructor itself since we
15887 are meant to be born fully resolved.
15889 (EventExpr.Define): Revert code I wrote earlier.
15891 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15892 instance expression is null. The instance expression is a This in that case
15893 or a null, depending on whether it is a static method or not.
15895 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15896 refers to more than one method.
15898 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15899 and accordingly flag errors.
15901 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15903 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15905 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15907 * location.cs (ToString): Provide useful rutine.
15909 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15911 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15912 objects, return the actual integral boxed.
15914 * statement.cs (SwitchLabel): define an ILLabel for each
15917 (Switch.CheckSwitch): If the value is a Literal, extract
15918 the underlying literal.
15920 Also in the unused hashtable we had, add the SwitchLabel so we can
15921 quickly look this value up.
15923 * constant.cs: Implement a bunch of new constants. Rewrite
15924 Literal based on this. Made changes everywhere to adapt to this.
15926 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15927 dereferencing array only once, and also copes with enumrations.
15929 bytes are two bytes wide, not one.
15931 (Cast): Perform constant conversions.
15933 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15934 wrappers to the literals here.
15936 * expression.cs (DoNumericPromotions): long literals can converted
15937 to ulong implicity (this is taken care of elsewhere, but I was
15938 missing this spot).
15940 * ecore.cs (Expression.Literalize): Make the return type Literal,
15941 to improve type checking.
15943 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15945 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15947 * literal.cs: Revert code from ravi that checked the bounds. The
15948 bounds are sane by the definition of the type itself.
15950 * typemanager.cs: Fix implementation of ImplementsInterface. We
15951 need to actually look up in our parent hierarchy for interfaces
15954 * const.cs: Use the underlying type for enumerations
15956 * delegate.cs: Compute the basename for the delegate creation,
15957 that should fix the delegate test case, and restore the correct
15958 Type Lookup semantics in rootcontext
15960 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15961 referencing a nested type with the Reflection API is using the "+"
15964 * cs-parser.jay: Do not require EOF token at the end.
15966 2001-12-20 Ravi Pratap <ravi@ximian.com>
15968 * rootcontext.cs (LookupType): Concatenate type names with
15969 a '.' instead of a '+' The test suite passes again.
15971 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15972 field of the enumeration.
15974 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15975 the case when the member is an EventExpr.
15977 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15978 static has an associated instance expression.
15980 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15982 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15984 * class.cs (Event.Define): Register event and perform appropriate checks
15987 We define the Add and Remove methods even if the use provides none because
15988 in that case, we provide default implementations ourselves.
15990 Define a private field of the type of the event. This is done by the CSC compiler
15991 and we should be doing it too ;-)
15993 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15994 More methods we use in code we generate.
15996 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15999 (InitCoreTypes): Update accordingly for the above.
16001 * class.cs (Event.Emit): Generate code for default accessors that we provide
16003 (EmitDefaultMethod): Do the job in the above.
16005 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
16008 2001-12-20 Miguel de Icaza <miguel@ximian.com>
16010 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
16011 builders even if we were missing one.
16013 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
16014 pass the Basename as our class name instead of the Name. The
16015 basename will be correctly composed for us.
16017 * parameter.cs (Paramters): Now takes a Location argument.
16019 * decl.cs (DeclSpace.LookupType): Removed convenience function and
16020 make all the code call directly LookupType in RootContext and take
16021 this chance to pass the Location information everywhere.
16023 * Everywhere: pass Location information.
16025 2001-12-19 Miguel de Icaza <miguel@ximian.com>
16027 * class.cs (Constructor.Define): Updated way of detecting the
16028 length of the parameters.
16030 (TypeContainer.DefineType): Use basename as the type name for
16033 (TypeContainer.Define): Do not recursively define types here, as
16034 definition is taken care in order by the RootContext.
16036 * tree.cs: Keep track of namespaces in a per-file basis.
16038 * parameter.cs (Parameter.ComputeSignature): Update to use
16041 (Parameters.GetSignature): ditto.
16043 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
16044 instead of a TypeContainer.
16046 (Interface.SemanticAnalysis): Use `this' instead of our parent to
16047 resolve names. Because we need to be resolve in our context, not
16050 * driver.cs: Implement response files.
16052 * class.cs (TypeContainer.DefineType): If we are defined, do not
16053 redefine ourselves.
16055 (Event.Emit): Emit the code for add/remove handlers.
16056 (Event.Define): Save the MethodBuilders for add/remove.
16058 * typemanager.cs: Use pair here too.
16060 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
16061 DictionaryEntry requires the first argument to be non-null.
16063 (enum_declaration): Compute full name for registering the
16066 (delegate_declaration): Instead of using
16067 formal_parameter_list, use opt_formal_parameter_list as the list
16070 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
16071 (EventParsing): New property that controls whether `add' and
16072 `remove' are returned as tokens or identifiers (for events);
16074 2001-12-19 Ravi Pratap <ravi@ximian.com>
16076 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
16077 use MyEventBuilder only and let it wrap the real builder for us.
16079 (MyEventBuilder): Revamp constructor etc.
16081 Implement all operations that we perform on EventBuilder in precisely the same
16084 (FindMembers): Update to use the EventBuilder member.
16086 (Event.Emit): Update accordingly.
16088 2001-12-18 Ravi Pratap <ravi@ximian.com>
16090 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
16091 by calling the appropriate methods.
16093 (GetCustomAttributes): Make stubs as they cannot possibly do anything
16096 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
16098 2001-12-17 Ravi Pratap <ravi@ximian.com>
16100 * delegate.cs (Delegate.Populate): Check that the return type
16101 and various parameters types are indeed accessible.
16103 * class.cs (Constructor.Define): Same here.
16105 (Field.Define): Ditto.
16107 (Event.Define): Ditto.
16109 (Operator.Define): Check that the underlying Method defined itself
16110 correctly - so it's MethodBuilder should not be null.
16112 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
16113 expression happens to be null.
16115 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
16116 members but as of now we don't seem to be able to do anything really useful with it.
16118 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
16119 not the EventBuilder.
16121 2001-12-18 Miguel de Icaza <miguel@ximian.com>
16123 * cs-tokenizer.cs: Add support for defines.
16124 Add support for #if, #elif, #else, #endif
16126 (eval_var): evaluates a variable.
16127 (eval): stubbed for evaluating functions.
16129 * cs-parser.jay: Pass the defines information
16131 * driver.cs: Add --define command line option.
16133 * decl.cs: Move MemberCore here.
16135 Make it the base class for DeclSpace. This allows us to catch and
16136 report 108 and 109 for everything now.
16138 * class.cs (TypeContainer.Define): Extract all the members
16139 before populating and emit the warning 108 (new keyword required
16140 to override) instead of having each member implement this.
16142 (MemberCore.Define): New abstract method, we will be using this in
16143 the warning reporting engine in Populate.
16145 (Operator.Define): Adjust to new MemberCore protocol.
16147 * const.cs (Const): This does not derive from Expression, it is a
16148 temporary object we use to create fields, it is a MemberCore.
16150 * class.cs (Method.Define): Allow the entry point to be in a
16153 * driver.cs: Rewrite the argument handler to clean it up a bit.
16155 * rootcontext.cs: Made it just an auxiliary namespace feature by
16156 making everything static.
16158 * driver.cs: Adapt code to use RootContext type name instead of
16161 * delegate.cs: Remove RootContext argument.
16163 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
16166 * class.cs (Event.Define): The lookup can fail.
16168 * cs-tokenizer.cs: Begin implementation of pre-procesor.
16170 * expression.cs: Resolve the this instance before invoking the code.
16172 2001-12-17 Miguel de Icaza <miguel@ximian.com>
16174 * cs-parser.jay: Add a production in element_access that allows
16175 the thing to become a "type" reference. This way we can parse
16176 things like "(string [])" as a type.
16178 Note that this still does not handle the more complex rules of
16182 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
16184 * ecore.cs: (CopyNewMethods): new utility function used to
16185 assemble the list of methods from running FindMembers.
16187 (MemberLookup): Rework FindMembers so that
16189 2001-12-16 Miguel de Icaza <miguel@ximian.com>
16191 * class.cs (TypeContainer): Remove Delegates who fail to be
16194 * delegate.cs (Populate): Verify that we dont get null return
16195 values. TODO: Check for AsAccessible.
16197 * cs-parser.jay: Use basename to emit error 574 (destructor should
16198 have the same name as container class), not the full name.
16200 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
16201 possible representation.
16203 Also implements integer type suffixes U and L.
16205 2001-12-15 Miguel de Icaza <miguel@ximian.com>
16207 * expression.cs (ArrayCreation.DoResolve): We need to do the
16208 argument resolution *always*.
16210 * decl.cs: Make this hold the namespace. Hold the root context as
16212 (LookupType): Move here.
16214 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
16216 * location.cs (Row, Name): Fixed the code, it was always returning
16217 references to the first file.
16219 * interface.cs: Register properties defined through interfaces.
16221 * driver.cs: Add support for globbing on the command line
16223 * class.cs (Field): Make it derive from MemberCore as well.
16226 2001-12-15 Ravi Pratap <ravi@ximian.com>
16228 * class.cs (Event::Define): Check that the type of the event is a delegate
16229 type else flag error #66.
16231 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
16234 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
16235 values of EntryPoint, CharSet etc etc.
16237 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
16239 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
16240 be null and we should ignore this. I am not sure if this is really clean. Apparently,
16241 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
16242 which needs this to do its work.
16244 * ../errors/cs0066.cs : Add.
16246 2001-12-14 Miguel de Icaza <miguel@ximian.com>
16248 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
16251 * class.cs: (MethodSignature.MethodSignature): Removed hack that
16252 clears out the parameters field.
16253 (MemberSignatureCompare): Cleanup
16255 (MemberCore): New base class used to share code between MethodCore
16258 (RegisterRequiredImplementations) BindingFlags.Public requires
16259 either BindingFlags.Instace or Static. Use instance here.
16261 (Property): Refactored code to cope better with the full spec.
16263 * parameter.cs (GetParameterInfo): Return an empty array instead
16266 * class.cs (Property): Abstract or extern properties have no bodies.
16268 * parameter.cs (GetParameterInfo): return a zero-sized array.
16270 * class.cs (TypeContainer.MethodModifiersValid): Move all the
16271 method modifier validation to the typecontainer so we can reuse
16272 this on properties.
16274 (MethodCore.ParameterTypes): return an empty sized array of types.
16276 (Property.Define): Test property modifier validity.
16278 Add tests for sealed/override too.
16280 (Method.Emit): abstract or extern methods have no bodies.
16282 2001-12-14 Ravi Pratap <ravi@ximian.com>
16284 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
16287 (Method::Define, ::Emit): Modify accordingly.
16289 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
16291 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
16293 * makefile: Pass in /unsafe.
16295 2001-12-13 Miguel de Icaza <miguel@ximian.com>
16297 * class.cs (MakeKey): Kill routine.
16299 * class.cs (TypeContainer.Define): Correctly define explicit
16300 method implementations (they require the full interface name plus
16303 * typemanager.cs: Deply the PtrHashtable here and stop using the
16304 lame keys. Things work so much better.
16306 This of course broke everyone who depended on `RegisterMethod' to
16307 do the `test for existance' test. This has to be done elsewhere.
16309 * support.cs (PtrHashtable): A hashtable that avoid comparing with
16310 the object stupid Equals method (because, that like fails all over
16311 the place). We still do not use it.
16313 * class.cs (TypeContainer.SetRequiredInterface,
16314 TypeContainer.RequireMethods): Killed these two routines and moved
16315 all the functionality to RegisterRequiredImplementations.
16317 (TypeContainer.RegisterRequiredImplementations): This routine now
16318 registers all the implementations required in an array for the
16319 interfaces and abstract methods. We use an array of structures
16320 which can be computed ahead of time to reduce memory usage and we
16321 also assume that lookups are cheap as most classes will not
16322 implement too many interfaces.
16324 We also avoid creating too many MethodSignatures.
16326 (TypeContainer.IsInterfaceMethod): Update and optionally does not
16327 clear the "pending" bit if we find that there are problems with
16330 (TypeContainer.VerifyPendingMethods): Update to report errors of
16331 methods that look like implementations but are not.
16333 (TypeContainer.Define): Add support for explicit interface method
16336 2001-12-12 Miguel de Icaza <miguel@ximian.com>
16338 * typemanager.cs: Keep track of the parameters here instead of
16339 being a feature of the TypeContainer.
16341 * class.cs: Drop the registration of parameters here, as
16342 InterfaceMethods are also interface declarations.
16344 * delegate.cs: Register methods with the TypeManager not only with
16345 the TypeContainer. This code was buggy.
16347 * interface.cs: Full registation here.
16349 2001-12-11 Miguel de Icaza <miguel@ximian.com>
16351 * expression.cs: Remove reducer for binary expressions, it can not
16354 * const.cs: Put here the code that used to go into constant.cs
16356 * constant.cs: Put here the code for constants, this is a new base
16357 class for Literals.
16359 * literal.cs: Make Literal derive from Constant.
16361 2001-12-09 Miguel de Icaza <miguel@ximian.com>
16363 * statement.cs (Return.Emit): Report error 157 if the user
16364 attempts to return from a finally block.
16366 (Return.Emit): Instead of emitting a return, jump to the end of
16369 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
16370 LocalBuilder to store the result of the function. ReturnLabel is
16371 the target where we jump.
16374 2001-12-09 Radek Doulik <rodo@ximian.com>
16376 * cs-parser.jay: remember alias in current namespace
16378 * ecore.cs (SimpleName::DoResolve): use aliases for types or
16381 * class.cs (LookupAlias): lookup alias in my_namespace
16383 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
16385 (LookupAlias): lookup alias in this and if needed in parent
16388 2001-12-08 Miguel de Icaza <miguel@ximian.com>
16392 * rootcontext.cs: (ModuleBuilder) Made static, first step into
16393 making things static. I need this to avoid passing the
16394 TypeContainer when calling ParameterType.
16396 * support.cs (InternalParameters.ParameterType): Remove ugly hack
16397 that did string manipulation to compute the type and then call
16398 GetType. Use Parameter.ParameterType instead.
16400 * cs-tokenizer.cs: Consume the suffix for floating values.
16402 * expression.cs (ParameterReference): figure out whether this is a
16403 reference parameter or not. Kill an extra variable by computing
16404 the arg_idx during emission.
16406 * parameter.cs (Parameters.GetParameterInfo): New overloaded
16407 function that returns whether a parameter is an out/ref value or not.
16409 (Parameter.ParameterType): The type of the parameter (base,
16410 without ref/out applied).
16412 (Parameter.Resolve): Perform resolution here.
16413 (Parameter.ExternalType): The full type (with ref/out applied).
16415 * statement.cs (Using.Emit, Using.EmitExpression): Implement
16416 support for expressions on the using statement.
16418 2001-12-07 Miguel de Icaza <miguel@ximian.com>
16420 * statement.cs (Using.EmitLocalVariableDecls): Split the
16421 localvariable handling of the using statement.
16423 (Block.EmitMeta): Keep track of variable count across blocks. We
16424 were reusing slots on separate branches of blocks.
16426 (Try.Emit): Emit the general code block, we were not emitting it.
16428 Check the type of the declaration to be an IDisposable or
16429 something that can be implicity converted to it.
16431 Emit conversions if required.
16433 * ecore.cs (EmptyExpression): New utility class.
16434 (Expression.ImplicitConversionExists): New utility function.
16436 2001-12-06 Miguel de Icaza <miguel@ximian.com>
16438 * statement.cs (Using): Implement.
16440 * expression.cs (LocalVariableReference): Support read only variables.
16442 * statement.cs: Remove the explicit emit for the Leave opcode.
16443 (VariableInfo): Add a readonly field.
16445 2001-12-05 Miguel de Icaza <miguel@ximian.com>
16447 * ecore.cs (ConvCast): new class used to encapsulate the various
16448 explicit integer conversions that works in both checked and
16449 unchecked contexts.
16451 (Expression.ConvertNumericExplicit): Use new ConvCast class to
16452 properly generate the overflow opcodes.
16454 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16456 * statement.cs: The correct type for the EmptyExpression is the
16457 element_type, not the variable type. Ravi pointed this out.
16459 2001-12-04 Ravi Pratap <ravi@ximian.com>
16461 * class.cs (Method::Define): Handle PInvoke methods specially
16462 by using DefinePInvokeMethod instead of the usual one.
16464 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
16465 above to do the task of extracting information and defining the method.
16467 2001-12-04 Ravi Pratap <ravi@ximian.com>
16469 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
16470 of the condition for string type.
16472 (Emit): Move that here.
16474 (ArrayCreation::CheckIndices): Keep string literals in their expression
16477 (EmitDynamicInitializers): Handle strings appropriately.
16479 2001-12-04 Miguel de Icaza <miguel@ximian.com>
16481 * codegen.cs (EmitContext): Replace multiple variables with a
16482 single pointer to the current Switch statement.
16484 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
16487 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16491 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
16494 (Foreach.Emit): Foreach on arrays was not setting
16495 up the loop variables (for break/continue).
16497 (GotoCase): Semi-implented.
16499 2001-12-03 Ravi Pratap <ravi@ximian.com>
16501 * attribute.cs (CheckAttribute): Handle system attributes by using
16502 Attribute.GetAttributes to examine information we need.
16504 (GetValidPlaces): Same here.
16506 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
16508 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
16510 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
16512 (Method::Define): Set appropriate flags if we have a DllImport attribute.
16514 (Method::Emit): Handle the case when we are a PInvoke method.
16516 2001-12-03 Miguel de Icaza <miguel@ximian.com>
16518 * expression.cs: Use ResolveWithSimpleName on compound names.
16520 2001-12-02 Ravi Pratap <ravi@ximian.com>
16522 * constant.cs (EmitConstant): Make sure we resolve the associated expression
16523 before trying to reduce it.
16525 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
16527 * constant.cs (LookupConstantValue): Implement.
16529 (EmitConstant): Use the above in emitting the constant.
16531 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
16532 that are user-defined by doing a LookupConstantValue on them.
16534 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
16537 2001-11-29 Miguel de Icaza <miguel@ximian.com>
16539 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
16541 (BaseAccess.DoResolve): Implement.
16543 (MemberAccess.DoResolve): Split this routine into a
16544 ResolveMemberAccess routine that can be used independently
16546 2001-11-28 Miguel de Icaza <miguel@ximian.com>
16548 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
16549 As that share bits of the implementation. Is returns a boolean,
16550 while As returns the Type that is being probed.
16552 2001-12-01 Ravi Pratap <ravi@ximian.com>
16554 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
16555 instead of a Literal - much easier.
16557 (EnumInTransit): Remove - utterly useless :-)
16559 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
16561 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
16563 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
16564 chain when we have no associated expression.
16566 2001-11-30 Ravi Pratap <ravi@ximian.com>
16568 * constant.cs (Define): Use Location while reporting the errror.
16570 Also emit a warning when 'new' is used and there is no inherited
16573 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
16576 (LookupEnumValue): Implement to lookup an enum member's value and define it
16579 (Populate): Re-write accordingly to use the above routine.
16581 2001-11-27 Miguel de Icaza <miguel@ximian.com>
16583 * expression.cs (This): Fix prototype for DoResolveLValue to
16584 override the base class DoResolveLValue.
16586 * cs-parser.cs: Report errors cs574 and cs575 (destructor
16589 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
16590 (we need to load the address of the field here). This fixes
16593 (FieldExpr.DoResolveLValue): Call the DoResolve
16594 function to initialize the Instance expression.
16596 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
16597 correctly the GetEnumerator operation on a value type.
16599 * cs-parser.jay: Add more simple parsing error catches.
16601 * statement.cs (Switch): Add support for string switches.
16602 Handle null specially.
16604 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
16606 2001-11-28 Ravi Pratap <ravi@ximian.com>
16608 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
16610 (declare_local_constant): New helper function.
16612 * statement.cs (AddConstant): Keep a separate record of constants
16614 (IsConstant): Implement to determine if a variable is a constant.
16616 (GetConstantExpression): Implement.
16618 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
16620 * statement.cs (IsVariableDefined): Re-write.
16622 2001-11-27 Ravi Pratap <ravi@ximian.com>
16624 * class.cs (TypeContainer::FindMembers): Look for constants
16625 in the case when we are looking for MemberTypes.Field
16627 * expression.cs (MemberAccess::DoResolve): Check that in the
16628 case we are a FieldExpr and a Literal, we are not being accessed
16629 by an instance reference.
16631 * cs-parser.jay (local_constant_declaration): Implement.
16633 (declaration_statement): Implement for constant declarations.
16635 2001-11-26 Miguel de Icaza <miguel@ximian.com>
16637 * statement.cs (Switch): Catch double defaults.
16639 (Switch): More work on the switch() statement
16640 implementation. It works for integral values now, need to finish
16644 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16646 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
16647 integer literals into other integer literals. To be used by
16650 2001-11-24 Ravi Pratap <ravi@ximian.com>
16652 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
16655 (EmitDynamicInitializers): Cope with the above since we extract data
16656 directly from ArrayData now.
16658 (ExpectInitializers): Keep track of whether initializers are mandatory
16661 (Bounds): Make it a hashtable to prevent the same dimension being
16662 recorded for every element in that dimension.
16664 (EmitDynamicInitializers): Fix bug which prevented the Set array method
16667 Also fix bug which was causing the indices to be emitted in the reverse
16670 2001-11-24 Miguel de Icaza <miguel@ximian.com>
16672 * expression.cs (ArrayCreation): Implement the bits that Ravi left
16673 unfinished. They do not work, because the underlying code is
16676 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16678 * cs-parser.jay: Remove bogus fixme.
16680 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
16681 on Switch statement.
16683 2001-11-23 Ravi Pratap <ravi@ximian.com>
16685 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
16688 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
16689 parameter. Apparently, any expression is allowed.
16691 (ValidateInitializers): Update accordingly.
16693 (CheckIndices): Fix some tricky bugs thanks to recursion.
16695 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
16696 I was being completely brain-dead.
16698 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
16699 and re-write acordingly.
16701 (DelegateInvocation): Re-write accordingly.
16703 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
16705 (MakeByteBlob): Handle types more correctly.
16707 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
16708 initialization from expressions but it is incomplete because I am a complete
16711 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16713 * statement.cs (If.Emit): Fix a bug that generated incorrect code
16714 on If. Basically, we have to return `true' (ie, we do return to
16715 our caller) only if both branches of the if return.
16717 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
16718 short-circuit operators, handle them as short circuit operators.
16720 (Cast.DoResolve): Resolve type.
16721 (Cast.Cast): Take an expression as the target type.
16723 * cs-parser.jay (cast_expression): Remove old hack that only
16724 allowed a limited set of types to be handled. Now we take a
16725 unary_expression and we resolve to a type during semantic
16728 Use the grammar productions from Rhys to handle casts (this is
16729 not complete like Rhys syntax yet, we fail to handle that corner
16730 case that C# has regarding (-x), but we will get there.
16732 2001-11-22 Ravi Pratap <ravi@ximian.com>
16734 * class.cs (EmitFieldInitializer): Take care of the case when we have a
16735 field which is an array type.
16737 * cs-parser.jay (declare_local_variables): Support array initialization too.
16739 * typemanager.cs (MakeKey): Implement.
16741 (everywhere): Use the above appropriately.
16743 * cs-parser.jay (for_statement): Update for array initialization while
16744 declaring variables.
16746 * ecore.cs : The error message was correct, it's the variable's names that
16747 were misleading ;-) Make the code more readable.
16749 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
16750 the correct type etc.
16752 (ConvertExplicit): Handle Enum types by examining the underlying type.
16754 2001-11-21 Ravi Pratap <ravi@ximian.com>
16756 * parameter.cs (GetCallingConvention): Always return
16757 CallingConventions.Standard for now.
16759 2001-11-22 Miguel de Icaza <miguel@ximian.com>
16761 * expression.cs (Binary.ResolveOperator): Update the values of `l'
16762 and `r' after calling DoNumericPromotions.
16764 * ecore.cs: Fix error message (the types were in the wrong order).
16766 * statement.cs (Foreach.ProbeCollectionType): Need to pass
16767 BindingFlags.Instance as well
16769 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
16770 implicit int literal conversion in an empty cast so that we
16771 propagate the right type upstream.
16773 (UnboxCast): new class used to unbox value types.
16774 (Expression.ConvertExplicit): Add explicit type conversions done
16777 (Expression.ImplicitNumericConversion): Oops, forgot to test for
16778 the target type before applying the implicit LongLiterals to ULong
16781 2001-11-21 Miguel de Icaza <miguel@ximian.com>
16783 * cs-parser.jay (for_statement): Reworked the way For works: now
16784 we declare manually any variables that are introduced in
16785 for_initializer to solve the problem of having out-of-band code
16786 emition (that is what got for broken).
16788 (declaration_statement): Perform the actual variable declaration
16789 that used to be done in local_variable_declaration here.
16791 (local_variable_declaration): Do not declare anything, just pass
16792 the information on a DictionaryEntry
16794 2001-11-20 Ravi Pratap <ravi@ximian.com>
16796 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
16797 re-write of the logic to now make it recursive.
16799 (UpdateIndices): Re-write accordingly.
16801 Store element data in a separate ArrayData list in the above methods.
16803 (MakeByteBlob): Implement to dump the array data into a byte array.
16805 2001-11-19 Ravi Pratap <ravi@ximian.com>
16807 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
16810 * constant.cs (Define): Implement.
16812 (EmitConstant): Re-write fully.
16814 Pass in location info.
16816 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
16819 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
16820 DictionaryEntry since we need location info too.
16822 (constant_declaration): Update accordingly.
16824 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
16825 code into another method : UpdateIndices.
16827 2001-11-18 Ravi Pratap <ravi@ximian.com>
16829 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
16830 some type checking etc.
16832 2001-11-17 Ravi Pratap <ravi@ximian.com>
16834 * expression.cs (ArrayCreation::ValidateInitializers): Implement
16835 bits to provide dimension info if the user skips doing that.
16837 Update second constructor to store the rank correctly.
16839 2001-11-16 Ravi Pratap <ravi@ximian.com>
16841 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
16842 and try to implement.
16844 * ../errors/cs0150.cs : Add.
16846 * ../errors/cs0178.cs : Add.
16848 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16850 * statement.cs: Implement foreach on multi-dimensional arrays.
16852 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16853 name of the params argument.
16855 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16856 initializing the array.
16858 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16859 we can use this elsewhere.
16861 * statement.cs: Finish implementation of foreach for single
16864 * cs-parser.jay: Use an out-of-band stack to pass information
16865 around, I wonder why I need this.
16867 foreach_block: Make the new foreach_block the current_block.
16869 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16870 function used to return a static Parameters structure. Used for
16871 empty parameters, as those are created very frequently.
16873 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16875 2001-11-15 Ravi Pratap <ravi@ximian.com>
16877 * interface.cs : Default modifier is private, not public. The
16878 make verify test passes again.
16880 2001-11-15 Ravi Pratap <ravi@ximian.com>
16882 * support.cs (ReflectionParameters): Fix logic to determine
16883 whether the last parameter is a params one. Test 9 passes again.
16885 * delegate.cs (Populate): Register the builders we define with
16886 RegisterParameterForBuilder. Test 19 passes again.
16888 * cs-parser.jay (property_declaration): Reference $6 instead
16889 of $$ to get at the location.
16891 (indexer_declaration): Similar stuff.
16893 (attribute): Ditto.
16895 * class.cs (Property): Register parameters for the Get and Set methods
16896 if they exist. Test 23 passes again.
16898 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16899 call to EmitArguments as we are sure there aren't any params arguments.
16900 Test 32 passes again.
16902 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16903 IndexOutOfRangeException.
16905 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16906 Test 33 now passes again.
16908 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16910 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16911 broke a bunch of things. Will have to come up with a better way
16912 of tracking locations.
16914 * statement.cs: Implemented foreach for single dimension arrays.
16916 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16918 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16919 an error. This removes the lookup from the critical path.
16921 * cs-parser.jay: Removed use of temporary_loc, which is completely
16924 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16926 * support.cs (ReflectionParameters.ParameterModifier): Report
16927 whether the argument is a PARAMS argument or not.
16929 * class.cs: Set the attribute `ParamArrayAttribute' on the
16930 parameter argument.
16932 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16933 and cons_param_array_attribute (ConstructorInfo for
16934 ParamArrayAttribute).,
16936 * codegen.cs: Emit the return using the `Return' statement, that
16937 way we can report the error correctly for missing return values.
16939 * class.cs (Method.Emit): Clean up.
16941 * expression.cs (Argument.Resolve): Take another argument: the
16942 location where this argument is used. Notice that this is not
16943 part of the "Argument" class as to reduce the size of the
16944 structure (we know the approximate location anyways).
16946 Test if the argument is a variable-reference, if not, then
16947 complain with a 206.
16949 (Argument.Emit): Emit addresses of variables.
16951 (Argument.FullDesc): Simplify.
16953 (Invocation.DoResolve): Update for Argument.Resolve.
16955 (ElementAccess.DoResolve): ditto.
16957 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16958 method should be virtual, as this method is always virtual.
16960 (NewDelegate.DoResolve): Update for Argument.Resolve.
16962 * class.cs (ConstructorInitializer.DoResolve): ditto.
16964 * attribute.cs (Attribute.Resolve): ditto.
16966 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16968 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16970 * expression.cs (ParameterReference): Drop IStackStorage and implement
16971 IAssignMethod instead.
16973 (LocalVariableReference): ditto.
16975 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16976 IAssignMethod instead.
16978 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16980 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16981 enumerations that are used in heavily used structures derive from
16982 byte in a laughable and pathetic attempt to reduce memory usage.
16983 This is the kind of pre-optimzations that you should not do at
16984 home without adult supervision.
16986 * expression.cs (UnaryMutator): New class, used to handle ++ and
16987 -- separatedly from the other unary operators. Cleans up the
16988 code, and kills the ExpressionStatement dependency in Unary.
16990 (Unary): Removed `method' and `Arguments' from this class, making
16991 it smaller, and moving it all to SimpleCall, so I can reuse this
16992 code in other locations and avoid creating a lot of transient data
16993 strucutres when not required.
16995 * cs-parser.jay: Adjust for new changes.
16997 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16999 * enum.cs (Enum.Populate): If there is a failure during
17002 * cs-parser.jay (opt_enum_base): we used to catch type errors
17003 here, but this is really incorrect. The type error should be
17004 catched during semantic analysis.
17006 2001-12-11 Ravi Pratap <ravi@ximian.com>
17008 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
17009 current_local_parameters as expected since I, in my stupidity, had forgotten
17012 * attribute.cs (GetValidPlaces): Fix stupid bug.
17014 * class.cs (Method::Emit): Perform check on applicability of attributes.
17016 (Constructor::Emit): Ditto.
17018 (Field::Emit): Ditto.
17020 (Field.Location): Store location information.
17022 (Property, Event, Indexer, Operator): Ditto.
17024 * cs-parser.jay (field_declaration): Pass in location for each field.
17026 * ../errors/cs0592.cs : Add.
17028 2001-11-12 Ravi Pratap <ravi@ximian.com>
17030 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
17032 (InitCoreTypes): Update accordingly.
17034 (RegisterAttrType, LookupAttr): Implement.
17036 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
17037 info about the same.
17039 (Resolve): Update to populate the above as necessary.
17041 (Error592): Helper.
17043 (GetValidPlaces): Helper to the above.
17045 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
17047 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
17049 2001-11-12 Ravi Pratap <ravi@ximian.com>
17051 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
17053 * ../errors/cs0617.cs : Add.
17055 2001-11-11 Ravi Pratap <ravi@ximian.com>
17057 * enum.cs (Emit): Rename to Populate to be more consistent with what
17058 we expect it to do and when exactly it is called.
17060 * class.cs, rootcontext.cs : Update accordingly.
17062 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
17063 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
17065 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
17067 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
17068 of a fieldinfo using the above, when dealing with a FieldBuilder.
17070 2001-11-10 Ravi Pratap <ravi@ximian.com>
17072 * ../errors/cs0031.cs : Add.
17074 * ../errors/cs1008.cs : Add.
17076 * ../errrors/cs0543.cs : Add.
17078 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
17081 (FindMembers): Implement.
17083 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
17084 enums and delegates too.
17086 (enum_types): Rename to builder_to_enum.
17088 (delegate_types): Rename to builder_to_delegate.
17090 * delegate.cs (FindMembers): Implement.
17092 2001-11-09 Ravi Pratap <ravi@ximian.com>
17094 * typemanager.cs (IsEnumType): Implement.
17096 * enum.cs (Emit): Re-write parts to account for the underlying type
17097 better and perform checking etc.
17099 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
17100 of the underlying type.
17102 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
17105 * enum.cs (error31): Helper to report error #31.
17107 * cs-parser.jay (enum_declaration): Store location of each member too.
17109 * enum.cs (member_to_location): New hashtable.
17111 (AddEnumMember): Update location hashtable.
17113 (Emit): Use the location of each member while reporting errors.
17115 2001-11-09 Miguel de Icaza <miguel@ximian.com>
17117 * cs-parser.jay: A for_initializer if is a
17118 local_variable_declaration really ammount to have an implicit
17119 block with the variable declaration and no initializer for for.
17121 * statement.cs (For.Emit): Cope with null initializers.
17123 This fixes the infinite loop on for initializers.
17125 2001-11-08 Miguel de Icaza <miguel@ximian.com>
17127 * enum.cs: More cleanup.
17129 * ecore.cs: Remove dead code.
17131 * class.cs (Property.Emit): More simplification.
17132 (Event.Emit): ditto.
17134 Reworked to have less levels of indentation.
17136 2001-11-08 Ravi Pratap <ravi@ximian.com>
17138 * class.cs (Property): Emit attributes.
17148 * enum.cs (Emit): Ditto.
17150 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
17153 * class.cs (Field, Event, etc.): Move attribute generation into the
17154 Emit method everywhere.
17156 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
17157 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
17158 as we had no way of defining nested enums !
17160 * rootcontext.cs : Adjust code accordingly.
17162 * typemanager.cs (AddEnumType): To keep track of enum types separately.
17164 2001-11-07 Ravi Pratap <ravi@ximian.com>
17166 * expression.cs (EvalConstantExpression): Move into ecore.cs
17168 * enum.cs (Enum): Rename some members and make them public and readonly
17169 according to our convention.
17171 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
17174 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
17176 (Enum::Emit): Write a simple version for now which doesn't try to compute
17177 expressions. I shall modify this to be more robust in just a while.
17179 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
17181 (TypeContainer::CloseType): Create the Enum types too.
17183 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
17185 * expression.cs (EvalConstantExpression): Get rid of completely.
17187 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
17188 user-defined values and other cases.
17190 (IsValidEnumLiteral): Helper function.
17192 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
17193 out there in the case we had a literal FieldExpr.
17195 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
17197 (Literalize): Revamp a bit to take two arguments.
17199 (EnumLiteral): New class which derives from Literal to wrap enum literals.
17201 2001-11-06 Ravi Pratap <ravi@ximian.com>
17203 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
17205 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
17207 (Resolve): Use the above to ensure we have proper initializers.
17209 2001-11-05 Ravi Pratap <ravi@ximian.com>
17211 * expression.cs (Expression::EvalConstantExpression): New method to
17212 evaluate constant expressions.
17214 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
17216 2001-11-07 Miguel de Icaza <miguel@ximian.com>
17218 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
17221 (Binary.ResolveOperator): Handle operator != (object a, object b)
17222 and operator == (object a, object b);
17224 (Binary.DoNumericPromotions): Indicate whether the numeric
17225 promotion was possible.
17227 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
17230 Made the ArrayAccess implement interface IAssignMethod instead of
17231 IStackStore as the order in which arguments are passed reflects
17234 * assign.cs: Instead of using expr.ExprClass to select the way of
17235 assinging, probe for the IStackStore/IAssignMethod interfaces.
17237 * typemanager.cs: Load InitializeArray definition.
17239 * rootcontext.cs (RootContext.MakeStaticData): Used to define
17240 static data that can be used to initialize arrays.
17242 2001-11-05 Miguel de Icaza <miguel@ximian.com>
17244 * expression.cs: Handle operator== and operator!= for booleans.
17246 (Conditioal.Reduce): Implement reducer for the ?: operator.
17248 (Conditional.Resolve): Implement dead code elimination.
17250 (Binary.Resolve): Catch string literals and return a new
17251 concatenated string.
17253 (Unary.Reduce): Implement reduction of unary expressions.
17255 * ecore.cs: Split out the expression core handling here.
17257 (Expression.Reduce): New method used to perform constant folding
17258 and CSE. This is needed to support constant-expressions.
17260 * statement.cs (Statement.EmitBoolExpression): Pass true and false
17261 targets, and optimize for !x.
17263 2001-11-04 Ravi Pratap <ravi@ximian.com>
17265 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
17266 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
17267 set custom atttributes.
17269 * literal.cs (Literal::GetValue): New abstract method to return the actual
17270 value of the literal, cast as an object.
17272 (*Literal): Implement GetValue method.
17274 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
17275 expressions to the arraylist but objects of type Argument.
17277 * class.cs (TypeContainer::Emit): Emit our attributes too.
17279 (Method::Emit, Constructor::Emit): Ditto.
17281 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
17282 to be ignoring earlier.
17284 2001-11-03 Ravi Pratap <ravi@ximian.com>
17286 * attribute.cs (AttributeSection::Define): Implement to do the business
17287 of constructing a CustomAttributeBuilder.
17289 (Attribute): New trivial class. Increases readability of code.
17291 * cs-parser.jay : Update accordingly.
17293 (positional_argument_list, named_argument_list, named_argument): New rules
17295 (attribute_arguments): Use the above so that we are more correct.
17297 2001-11-02 Ravi Pratap <ravi@ximian.com>
17299 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
17300 to perform all checks for a method with a params parameter.
17302 (Invocation::OverloadResolve): Update to use the above method and therefore
17303 cope correctly with params method invocations.
17305 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
17308 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
17309 constructors in our parent too because we can't afford to miss out on
17312 * attribute.cs (AttributeSection): New name for the class Attribute
17314 Other trivial changes to improve readability.
17316 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
17317 use the new class names.
17319 2001-11-01 Ravi Pratap <ravi@ximian.com>
17321 * class.cs (Method::Define): Complete definition for params types too
17323 (Indexer::Define): Ditto.
17325 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
17326 Cope everywhere with a request for info about the array parameter.
17328 2001-11-01 Ravi Pratap <ravi@ximian.com>
17330 * tree.cs (RecordNamespace): Fix up to check for the correct key.
17332 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
17333 local_variable_type to extract the string corresponding to the type.
17335 (local_variable_type): Fixup the action to use the new helper method.
17337 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
17340 * expression.cs : Clean out code which uses the above.
17342 2001-10-31 Ravi Pratap <ravi@ximian.com>
17344 * typemanager.cs (RegisterMethod): Check if we already have an existing key
17345 and bale out if necessary by returning a false.
17347 (RegisterProperty): Ditto.
17349 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
17350 and print out appropriate error messages.
17352 * interface.cs (everywhere): Ditto.
17354 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
17355 location to constructor.
17357 * class.cs (Property, Event, Indexer): Update accordingly.
17359 * ../errors/cs111.cs : Added.
17361 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
17362 of a method, as laid down by the spec.
17364 (Invocation::OverloadResolve): Use the above method.
17366 2001-10-31 Ravi Pratap <ravi@ximian.com>
17368 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
17369 now take a TypeContainer and a Parameters object.
17371 (ParameterData): Modify return type of ParameterModifier method to be
17372 Parameter.Modifier and not a string.
17374 (ReflectionParameters, InternalParameters): Update accordingly.
17376 * expression.cs (Argument::GetParameterModifier): Same here.
17378 * support.cs (InternalParameters::ParameterType): Find a better way of determining
17379 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
17380 symbol in it at all so maybe this is only for now.
17382 2001-10-30 Ravi Pratap <ravi@ximian.com>
17384 * support.cs (InternalParameters): Constructor now takes an extra argument
17385 which is the actual Parameters class.
17387 (ParameterDesc): Update to provide info on ref/out modifiers.
17389 * class.cs (everywhere): Update call to InternalParameters to pass in
17390 the second argument too.
17392 * support.cs (ParameterData): Add ParameterModifier, which is a method
17393 to return the modifier info [ref/out etc]
17395 (InternalParameters, ReflectionParameters): Implement the above.
17397 * expression.cs (Argument::ParameterModifier): Similar function to return
17398 info about the argument's modifiers.
17400 (Invocation::OverloadResolve): Update to take into account matching modifiers
17403 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
17404 a new SetFormalParameters object which we pass to InternalParameters.
17406 2001-10-30 Ravi Pratap <ravi@ximian.com>
17408 * expression.cs (NewArray): Merge into the ArrayCreation class.
17410 2001-10-29 Ravi Pratap <ravi@ximian.com>
17412 * expression.cs (NewArray): Merge classes NewBuiltinArray and
17413 NewUserdefinedArray into one as there wasn't much of a use in having
17416 * expression.cs (Argument): Change field's name to ArgType from Type.
17418 (Type): New readonly property which returns the proper type, taking into
17419 account ref/out modifiers.
17421 (everywhere): Adjust code accordingly for the above.
17423 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
17424 whether we are emitting for a ref or out parameter.
17426 * expression.cs (Argument::Emit): Use the above field to set the state.
17428 (LocalVariableReference::Emit): Update to honour the flag and emit the
17431 * parameter.cs (Attributes): Set the correct flags for ref parameters.
17433 * expression.cs (Argument::FullDesc): New function to provide a full desc.
17435 * support.cs (ParameterData): Add method ParameterDesc to the interface.
17437 (ReflectionParameters, InternalParameters): Implement the above method.
17439 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
17442 (Invocation::FullMethodDesc): Ditto.
17444 2001-10-29 Miguel de Icaza <miguel@ximian.com>
17446 * cs-parser.jay: Add extra production for the second form of array
17449 * expression.cs (ArrayCreation): Update to reflect the above
17452 * Small changes to prepare for Array initialization.
17454 2001-10-28 Miguel de Icaza <miguel@ximian.com>
17456 * typemanager.cs (ImplementsInterface): interface might be null;
17457 Deal with this problem;
17459 Also, we do store negative hits on the cache (null values), so use
17460 this instead of calling t.GetInterfaces on the type everytime.
17462 2001-10-28 Ravi Pratap <ravi@ximian.com>
17464 * typemanager.cs (IsBuiltinType): New method to help determine the same.
17466 * expression.cs (New::DoResolve): Get rid of array creation code and instead
17467 split functionality out into different classes.
17469 (New::FormArrayType): Move into NewBuiltinArray.
17471 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
17474 (NewBuiltinArray): New class to handle creation of built-in arrays.
17476 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
17477 account creation of one-dimensional arrays.
17479 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
17481 (NewUserdefinedArray::DoResolve): Implement.
17483 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
17485 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
17486 we maintain inside the TypeManager. This is necessary to perform lookups on the
17489 (LookupType): Update to perform GetType on the module builders too.
17491 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
17493 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
17495 2001-10-23 Ravi Pratap <ravi@ximian.com>
17497 * expression.cs (New::DoResolve): Implement guts of array creation.
17499 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
17501 2001-10-27 Miguel de Icaza <miguel@ximian.com>
17503 * expression.cs: Fix bug I introduced lsat night that broke
17506 (Expression.Resolve): Report a 246 error (can not resolve name)
17507 if we find a SimpleName in the stream.
17509 (Expression.ResolveLValue): Ditto.
17511 (Expression.ResolveWithSimpleName): This function is a variant of
17512 ResolveName, this one allows SimpleNames to be returned without a
17513 warning. The only consumer of SimpleNames is MemberAccess
17515 2001-10-26 Miguel de Icaza <miguel@ximian.com>
17517 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
17518 might arrive here. I have my doubts that this is correct.
17520 * statement.cs (Lock): Implement lock statement.
17522 * cs-parser.jay: Small fixes to support `lock' and `using'
17524 * cs-tokenizer.cs: Remove extra space
17526 * driver.cs: New flag --checked, allows to turn on integer math
17529 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
17530 Threading.Monitor.Exit
17532 2001-10-23 Miguel de Icaza <miguel@ximian.com>
17534 * expression.cs (IndexerAccess::DoResolveLValue): Set the
17535 Expression Class to be IndexerAccess.
17537 Notice that Indexer::DoResolve sets the eclass to Value.
17539 2001-10-22 Miguel de Icaza <miguel@ximian.com>
17541 * class.cs (TypeContainer::Emit): Emit code for indexers.
17543 * assign.cs (IAssignMethod): New interface implemented by Indexers
17544 and Properties for handling assignment.
17546 (Assign::Emit): Simplify and reuse code.
17548 * expression.cs (IndexerAccess, PropertyExpr): Implement
17549 IAssignMethod, clean up old code.
17551 2001-10-22 Ravi Pratap <ravi@ximian.com>
17553 * typemanager.cs (ImplementsInterface): New method to determine if a type
17554 implements a given interface. Provides a nice cache too.
17556 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
17559 (ConvertReferenceExplicit): Ditto.
17561 * delegate.cs (Delegate::Populate): Update to define the parameters on the
17562 various methods, with correct names etc.
17564 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
17565 Operator.UnaryNegation.
17567 * cs-parser.jay (operator_declarator): Be a little clever in the case where
17568 we have a unary plus or minus operator.
17570 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
17573 * everywhere : update accordingly.
17575 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
17578 * class.cs (Method::Define): For the case where we are implementing a method
17579 inherited from an interface, we need to set the MethodAttributes.Final flag too.
17580 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
17582 2001-10-21 Ravi Pratap <ravi@ximian.com>
17584 * interface.cs (FindMembers): Implement to work around S.R.E
17587 * typemanager.cs (IsInterfaceType): Implement.
17589 (FindMembers): Update to handle interface types too.
17591 * expression.cs (ImplicitReferenceConversion): Re-write bits which
17592 use IsAssignableFrom as that is not correct - it doesn't work.
17594 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
17595 and accordingly override EmitStatement.
17597 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
17598 using the correct logic :-)
17600 2001-10-19 Ravi Pratap <ravi@ximian.com>
17602 * ../errors/cs-11.cs : Add to demonstrate error -11
17604 2001-10-17 Miguel de Icaza <miguel@ximian.com>
17606 * assign.cs (Assign::Resolve): Resolve right hand side first, and
17607 then pass this as a hint to ResolveLValue.
17609 * expression.cs (FieldExpr): Add Location information
17611 (FieldExpr::LValueResolve): Report assignment to readonly
17614 (Expression::ExprClassFromMemberInfo): Pass location information.
17616 (Expression::ResolveLValue): Add new method that resolves an
17619 (Expression::DoResolveLValue): Default invocation calls
17622 (Indexers): New class used to keep track of indexers in a given
17625 (IStackStore): Renamed from LValue, as it did not really describe
17626 what this did. Also ResolveLValue is gone from this interface and
17627 now is part of Expression.
17629 (ElementAccess): Depending on the element access type
17631 * typemanager.cs: Add `indexer_name_type' as a Core type
17632 (System.Runtime.CompilerServices.IndexerNameAttribute)
17634 * statement.cs (Goto): Take a location.
17636 2001-10-18 Ravi Pratap <ravi@ximian.com>
17638 * delegate.cs (Delegate::VerifyDelegate): New method to verify
17639 if two delegates are compatible.
17641 (NewDelegate::DoResolve): Update to take care of the case when
17642 we instantiate a delegate from another delegate.
17644 * typemanager.cs (FindMembers): Don't even try to look up members
17645 of Delegate types for now.
17647 2001-10-18 Ravi Pratap <ravi@ximian.com>
17649 * delegate.cs (NewDelegate): New class to take care of delegate
17652 * expression.cs (New): Split the delegate related code out into
17653 the NewDelegate class.
17655 * delegate.cs (DelegateInvocation): New class to handle delegate
17658 * expression.cs (Invocation): Split out delegate related code into
17659 the DelegateInvocation class.
17661 2001-10-17 Ravi Pratap <ravi@ximian.com>
17663 * expression.cs (New::DoResolve): Implement delegate creation fully
17664 and according to the spec.
17666 (New::DoEmit): Update to handle delegates differently.
17668 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
17669 because of which we were printing out arguments in reverse order !
17671 * delegate.cs (VerifyMethod): Implement to check if the given method
17672 matches the delegate.
17674 (FullDelegateDesc): Implement.
17676 (VerifyApplicability): Implement.
17678 * expression.cs (Invocation::DoResolve): Update to accordingly handle
17679 delegate invocations too.
17681 (Invocation::Emit): Ditto.
17683 * ../errors/cs1593.cs : Added.
17685 * ../errors/cs1594.cs : Added.
17687 * delegate.cs (InstanceExpression, TargetMethod): New properties.
17689 2001-10-16 Ravi Pratap <ravi@ximian.com>
17691 * typemanager.cs (intptr_type): Core type for System.IntPtr
17693 (InitCoreTypes): Update for the same.
17695 (iasyncresult_type, asynccallback_type): Ditto.
17697 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
17700 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
17703 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
17704 the builders for the 4 members of a delegate type :-)
17706 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
17709 * expression.cs (New::DoResolve): Implement guts for delegate creation.
17711 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
17713 2001-10-15 Miguel de Icaza <miguel@ximian.com>
17715 * statement.cs (Break::Emit): Implement.
17716 (Continue::Emit): Implement.
17718 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
17719 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
17720 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
17721 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
17724 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
17725 properties that track the label for the current loop (begin of the
17726 loop and end of the loop).
17728 2001-10-15 Ravi Pratap <ravi@ximian.com>
17730 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
17731 use of emitting anything at all.
17733 * class.cs, rootcontext.cs : Get rid of calls to the same.
17735 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
17737 (Populate): Define the constructor correctly and set the implementation
17740 * typemanager.cs (delegate_types): New hashtable to hold delegates that
17743 (AddDelegateType): Implement.
17745 (IsDelegateType): Implement helper method.
17747 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
17749 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
17750 and accordingly handle it.
17752 * delegate.cs (Populate): Take TypeContainer argument.
17753 Implement bits to define the Invoke method. However, I still haven't figured out
17754 how to take care of the native int bit :-(
17756 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
17757 Qualify the name of the delegate, not its return type !
17759 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
17762 (StandardConversionExists): Checking for array types turns out to be recursive.
17764 (ConvertReferenceExplicit): Implement array conversion.
17766 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
17768 2001-10-12 Ravi Pratap <ravi@ximian.com>
17770 * cs-parser.jay (delegate_declaration): Store the fully qualified
17771 name as it is a type declaration.
17773 * delegate.cs (ReturnType, Name): Rename members to these. Make them
17776 (DefineDelegate): Renamed from Define. Does the same thing essentially,
17777 as TypeContainer::DefineType.
17779 (Populate): Method in which all the definition of the various methods (Invoke)
17782 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
17785 (CloseDelegate): Finally creates the delegate.
17787 * class.cs (TypeContainer::DefineType): Update to define delegates.
17788 (Populate, Emit and CloseType): Do the same thing here too.
17790 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
17791 delegates in all these operations.
17793 2001-10-14 Miguel de Icaza <miguel@ximian.com>
17795 * expression.cs: LocalTemporary: a new expression used to
17796 reference a temporary that has been created.
17798 * assign.cs: Handle PropertyAccess back here, so that we can
17799 provide the proper semantic access to properties.
17801 * expression.cs (Expression::ConvertReferenceExplicit): Implement
17802 a few more explicit conversions.
17804 * modifiers.cs: `NEW' modifier maps to HideBySig.
17806 * expression.cs (PropertyExpr): Make this into an
17807 ExpressionStatement, and support the EmitStatement code path.
17809 Perform get/set error checking, clean up the interface.
17811 * assign.cs: recognize PropertyExprs as targets, and if so, turn
17812 them into toplevel access objects.
17814 2001-10-12 Miguel de Icaza <miguel@ximian.com>
17816 * expression.cs: PropertyExpr::PropertyExpr: use work around the
17819 * typemanager.cs: Keep track here of our PropertyBuilders again to
17820 work around lameness in SRE.
17822 2001-10-11 Miguel de Icaza <miguel@ximian.com>
17824 * expression.cs (LValue::LValueResolve): New method in the
17825 interface, used to perform a second resolution pass for LValues.
17827 (This::DoResolve): Catch the use of this in static methods.
17829 (This::LValueResolve): Implement.
17831 (This::Store): Remove warning, assigning to `this' in structures
17834 (Invocation::Emit): Deal with invocation of
17835 methods on value types. We need to pass the address to structure
17836 methods rather than the object itself. (The equivalent code to
17837 emit "this" for structures leaves the entire structure on the
17838 stack instead of a pointer to it).
17840 (ParameterReference::DoResolve): Compute the real index for the
17841 argument based on whether the method takes or not a `this' pointer
17842 (ie, the method is static).
17844 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
17845 value types returned from functions when we need to invoke a
17846 method on the sturcture.
17849 2001-10-11 Ravi Pratap <ravi@ximian.com>
17851 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17852 defining the type in the Modulebuilder or Typebuilder. This is to take
17853 care of nested types which need to be defined on the TypeBuilder using
17854 DefineNestedMethod.
17856 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17857 methods in RootContext, only ported to be part of TypeContainer.
17859 (TypeContainer::GetInterfaceOrClass): Ditto.
17861 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17863 * interface.cs (Interface::DefineInterface): New method. Does exactly
17864 what RootContext.CreateInterface did earlier, only it takes care of nested types
17867 (Interface::GetInterfaces): Move from RootContext here and port.
17869 (Interface::GetInterfaceByName): Same here.
17871 * rootcontext.cs (ResolveTree): Re-write.
17873 (PopulateTypes): Re-write.
17875 * class.cs (TypeContainer::Populate): Populate nested types too.
17876 (TypeContainer::Emit): Emit nested members too.
17878 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17879 instead just use the name argument passed in as it is already fully
17882 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17883 to TypeContainer mapping to see if a type is user-defined.
17885 * class.cs (TypeContainer::CloseType): Implement.
17887 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17888 the default constructor.
17890 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17893 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17895 * interface.cs (CloseType): Create the type here.
17897 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17900 Remove all the methods which are now in TypeContainer.
17902 2001-10-10 Ravi Pratap <ravi@ximian.com>
17904 * delegate.cs (Define): Re-write bits to define the delegate
17907 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17909 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17911 * expression.cs (ImplicitReferenceConversion): handle null as well
17912 as a source to convert to any reference type.
17914 * statement.cs (Return): Perform any implicit conversions to
17915 expected return type.
17917 Validate use of return statement.
17919 * codegen.cs (EmitContext): Pass the expected return type here.
17921 * class.cs (Method, Constructor, Property): Pass expected return
17922 type to EmitContext.
17924 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17926 * expression.cs: Make DoResolve take an EmitContext instead of a
17929 Replaced `l' and `location' for `loc', for consistency.
17931 (Error, Warning): Remove unneeded Tc argument.
17933 * assign.cs, literal.cs, constant.cs: Update to new calling
17936 * codegen.cs: EmitContext now contains a flag indicating whether
17937 code is being generated in a static method or not.
17939 * cs-parser.jay: DecomposeQI, new function that replaces the old
17940 QualifiedIdentifier. Now we always decompose the assembled
17941 strings from qualified_identifier productions into a group of
17944 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17946 * rootcontext.cs: Deal with field-less struct types correctly now
17947 by passing the size option to Define Type.
17949 * class.cs: Removed hack that created one static field.
17951 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17953 * statement.cs: Moved most of the code generation here.
17955 2001-10-09 Ravi Pratap <ravi@ximian.com>
17957 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17960 (ElementAccess): Remove useless bits for now - keep checks as the spec
17963 2001-10-08 Ravi Pratap <ravi@ximian.com>
17965 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17966 and start performing checks according to the spec.
17968 2001-10-07 Ravi Pratap <ravi@ximian.com>
17970 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17971 rank_specifiers instead.
17973 (rank_specifiers): Change the order in which the rank specifiers are stored
17975 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17977 * expression.cs (ElementAccess): Implement the LValue interface too.
17979 2001-10-06 Ravi Pratap <ravi@ximian.com>
17981 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17982 except that user defined conversions are not included.
17984 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17985 perform the conversion of the return type, if necessary.
17987 (New::DoResolve): Check whether we are creating an array or an object
17988 and accordingly do the needful.
17990 (New::Emit): Same here.
17992 (New::DoResolve): Implement guts of array creation.
17994 (New::FormLookupType): Helper function.
17996 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17998 * codegen.cs: Removed most of the code generation here, and move the
17999 corresponding code generation bits to the statement classes.
18001 Added support for try/catch/finalize and throw.
18003 * cs-parser.jay: Added support for try/catch/finalize.
18005 * class.cs: Catch static methods having the flags override,
18006 virtual or abstract.
18008 * expression.cs (UserCast): This user cast was not really doing
18009 what it was supposed to do. Which is to be born in fully resolved
18010 state. Parts of the resolution were being performed at Emit time!
18014 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18016 * expression.cs: Implicity convert the result from UserCast.
18018 2001-10-05 Ravi Pratap <ravi@ximian.com>
18020 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
18021 prevented it from working correctly.
18023 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
18024 merely ConvertImplicit.
18026 2001-10-05 Miguel de Icaza <miguel@ximian.com>
18028 * typemanager.cs: Make the LookupTypeContainer function static,
18029 and not per-instance.
18031 * class.cs: Make static FindMembers (the one that takes a Type
18034 * codegen.cs: Add EmitForeach here.
18036 * cs-parser.jay: Make foreach a toplevel object instead of the
18037 inline expansion, as we need to perform semantic analysis on it.
18039 2001-10-05 Ravi Pratap <ravi@ximian.com>
18041 * expression.cs (Expression::ImplicitUserConversion): Rename to
18042 UserDefinedConversion.
18044 (Expression::UserDefinedConversion): Take an extra argument specifying
18045 whether we look for explicit user conversions too.
18047 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
18049 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
18051 (ExplicitUserConversion): Make it a call to UserDefinedConversion
18052 with the appropriate arguments.
18054 * cs-parser.jay (cast_expression): Record location too.
18056 * expression.cs (Cast): Record location info.
18058 (Expression::ConvertExplicit): Take location argument.
18060 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
18061 to determine if we are doing explicit conversions.
18063 (UserCast::Emit): Update accordingly.
18065 (Expression::ConvertExplicit): Report an error if everything fails.
18067 * ../errors/cs0030.cs : Add.
18069 2001-10-04 Miguel de Icaza <miguel@ximian.com>
18071 * modifiers.cs: If the ABSTRACT keyword is present, also set the
18072 virtual and newslot bits.
18074 * class.cs (TypeContainer::RegisterRequiredImplementations):
18075 Record methods we need.
18077 (TypeContainer::MakeKey): Helper function to make keys for
18078 MethodBases, since the Methodbase key is useless.
18080 (TypeContainer::Populate): Call RegisterRequiredImplementations
18081 before defining the methods.
18083 Create a mapping for method_builders_to_methods ahead of time
18084 instead of inside a tight loop.
18086 (::RequireMethods): Accept an object as the data to set into the
18087 hashtable so we can report interface vs abstract method mismatch.
18089 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18091 * report.cs: Make all of it static.
18093 * rootcontext.cs: Drop object_type and value_type computations, as
18094 we have those in the TypeManager anyways.
18096 Drop report instance variable too, now it is a global.
18098 * driver.cs: Use try/catch on command line handling.
18100 Add --probe option to debug the error reporting system with a test
18103 * report.cs: Add support for exiting program when a probe
18104 condition is reached.
18106 2001-10-03 Ravi Pratap <ravi@ximian.com>
18108 * expression.cs (Binary::DoNumericPromotions): Fix the case when
18109 we do a forcible conversion regardless of type, to check if
18110 ForceConversion returns a null.
18112 (Binary::error19): Use location to report error.
18114 (Unary::error23): Use location here too.
18116 * ../errors/cs0019.cs : Check in.
18118 * ../errors/cs0023.cs : Check in.
18120 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
18121 case of a non-null MethodInfo object with a length of 0 !
18123 (Binary::ResolveOperator): Flag error if overload resolution fails to find
18124 an applicable member - according to the spec :-)
18125 Also fix logic to find members in base types.
18127 (Unary::ResolveOperator): Same here.
18129 (Unary::report23): Change name to error23 and make first argument a TypeContainer
18130 as I was getting thoroughly confused between this and error19 :-)
18132 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
18133 (::FindMostEncompassedType): Implement.
18134 (::FindMostEncompassingType): Implement.
18135 (::StandardConversionExists): Implement.
18137 (UserImplicitCast): Re-vamp. We now need info about most specific
18138 source and target types so that we can do the necessary conversions.
18140 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
18141 mathematical union with no duplicates.
18143 2001-10-03 Miguel de Icaza <miguel@ximian.com>
18145 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
18146 in order from base classes to child classes, so that we can in
18147 child classes look up in our parent for method names and
18148 attributes (required for handling abstract, virtual, new, override
18149 constructs: we need to instrospect our base class, and if we dont
18150 populate the classes in order, the introspection might be
18151 incorrect. For example, a method could query its parent before
18152 the parent has any methods and would determine that the parent has
18153 no abstract methods (while it could have had them)).
18155 (RootContext::CreateType): Record the order in which we define the
18158 2001-10-02 Miguel de Icaza <miguel@ximian.com>
18160 * class.cs (TypeContainer::Populate): Also method definitions can
18161 fail now, keep track of this.
18163 (TypeContainer::FindMembers): Implement support for
18164 DeclaredOnly/noDeclaredOnly flag.
18166 (Constructor::Emit) Return the ConstructorBuilder.
18168 (Method::Emit) Return the MethodBuilder.
18169 Check for abstract or virtual methods to be public.
18171 * rootcontext.cs (RootContext::CreateType): Register all the
18172 abstract methods required for the class to be complete and the
18173 interface methods that must be implemented.
18175 * cs-parser.jay: Report error 501 (method requires body if it is
18176 not marked abstract or extern).
18178 * expression.cs (TypeOf::Emit): Implement.
18180 * typemanager.cs: runtime_handle_type, new global type.
18182 * class.cs (Property::Emit): Generate code for properties.
18184 2001-10-02 Ravi Pratap <ravi@ximian.com>
18186 * expression.cs (Unary::ResolveOperator): Find operators on base type
18187 too - we now conform exactly to the spec.
18189 (Binary::ResolveOperator): Same here.
18191 * class.cs (Operator::Define): Fix minor quirk in the tests.
18193 * ../errors/cs0215.cs : Added.
18195 * ../errors/cs0556.cs : Added.
18197 * ../errors/cs0555.cs : Added.
18199 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18201 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
18202 single integer which is really efficient
18204 2001-10-01 Ravi Pratap <ravi@ximian.com>
18206 * expression.cs (Expression::ImplicitUserConversion): Use location
18207 even in the case when we are examining True operators.
18209 * class.cs (Operator::Define): Perform extensive checks to conform
18210 with the rules for operator overloading in the spec.
18212 * expression.cs (Expression::ImplicitReferenceConversion): Implement
18213 some of the other conversions mentioned in the spec.
18215 * typemanager.cs (array_type): New static member for the System.Array built-in
18218 (cloneable_interface): For System.ICloneable interface.
18220 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
18221 we start resolving the tree and populating types.
18223 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
18225 2001-10-01 Miguel de Icaza <miguel@ximian.com>
18227 * expression.cs (Expression::ExprClassFromMemberInfo,
18228 Expression::Literalize): Create literal expressions from
18229 FieldInfos which are literals.
18231 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
18232 type casts, because they were wrong. The test suite in tests
18235 (ImplicitNumericConversion): ushort to ulong requires a widening
18238 Int32 constant to long requires widening cast as well.
18240 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
18241 for integers because the type on the stack is not i4.
18243 2001-09-30 Miguel de Icaza <miguel@ximian.com>
18245 * expression.cs (report118): require location argument.
18247 * parameter.cs: Do not dereference potential null value.
18249 * class.cs: Catch methods that lack the `new' keyword when
18250 overriding a name. Report warnings when `new' is used without
18251 anything being there to override.
18253 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
18255 * class.cs: Only add constructor to hashtable if it is non-null
18256 (as now constructors can fail on define).
18258 (TypeManager, Class, Struct): Take location arguments.
18260 Catch field instance initialization in structs as errors.
18262 accepting_filter: a new filter for FindMembers that is static so
18263 that we dont create an instance per invocation.
18265 (Constructor::Define): Catch errors where a struct constructor is
18268 * cs-parser.jay: Pass location information for various new
18271 * delegate.cs (Delegate): take a location argument.
18273 * driver.cs: Do not call EmitCode if there were problesm in the
18274 Definition of the types, as many Builders wont be there.
18276 * decl.cs (Decl::Decl): Require a location argument.
18278 * cs-tokenizer.cs: Handle properly hex constants that can not fit
18279 into integers, and find the most appropiate integer for it.
18281 * literal.cs: Implement ULongLiteral.
18283 * rootcontext.cs: Provide better information about the location of
18284 failure when CreateType fails.
18286 2001-09-29 Miguel de Icaza <miguel@ximian.com>
18288 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
18291 * expression.cs (Binary::CheckShiftArguments): Add missing type
18293 (Binary::ResolveOperator): Add type to the logical and and logical
18294 or, Bitwise And/Or and Exclusive Or code paths, it was missing
18297 (Binary::DoNumericPromotions): In the case where either argument
18298 is ulong (and most signed types combined with ulong cause an
18299 error) perform implicit integer constant conversions as well.
18301 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18303 * expression.cs (UserImplicitCast): Method should always be
18305 (Invocation::BetterConversion): Simplified test for IntLiteral.
18307 (Expression::ImplicitNumericConversion): Split this routine out.
18308 Put the code that performs implicit constant integer conversions
18311 (Expression::Resolve): Become a wrapper around DoResolve so we can
18312 check eclass and type being set after resolve.
18314 (Invocation::Badness): Remove this dead function
18316 (Binary::ResolveOperator): Do not compute the expensive argumnets
18317 unless we have a union for it.
18319 (Probe::Emit): Is needs to do an isinst and then
18320 compare against null.
18322 (::CanConvert): Added Location argument. If the Location argument
18323 is null (Location.Null), then we do not report errors. This is
18324 used by the `probe' mechanism of the Explicit conversion. We do
18325 not want to generate an error for something that the user
18326 explicitly requested to be casted. But the pipeline for an
18327 explicit cast first tests for potential implicit casts.
18329 So for now, if the Location is null, it means `Probe only' to
18330 avoid adding another argument. Might have to revise this
18333 (ClassCast): New class used to type cast objects into arbitrary
18334 classes (used in Explicit Reference Conversions).
18336 Implement `as' as well.
18338 Reverted all the patches from Ravi below: they were broken:
18340 * The use of `level' as a mechanism to stop recursive
18341 invocations is wrong. That was there just to catch the
18342 bug with a strack trace but not as a way of addressing
18345 To fix the problem we have to *understand* what is going
18346 on and the interactions and come up with a plan, not
18347 just get things going.
18349 * The use of the type conversion cache that I proposed
18350 last night had an open topic: How does this work across
18351 protection domains. A user defined conversion might not
18352 be public in the location where we are applying the
18353 conversion, a different conversion might be selected
18354 (ie, private A->B (better) but public B->A (worse),
18355 inside A, A->B applies, but outside it, B->A will
18358 * On top of that (ie, even if the above is solved),
18359 conversions in a cache need to be abstract. Ie, `To
18360 convert from an Int to a Short use an OpcodeCast', not
18361 `To convert from an Int to a Short use the OpcodeCast on
18362 the variable 5' (which is what this patch was doing).
18364 2001-09-28 Ravi Pratap <ravi@ximian.com>
18366 * expression.cs (Invocation::ConversionExists): Re-write to use
18367 the conversion cache
18369 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
18370 cache all conversions done, not just user-defined ones.
18372 (Invocation::BetterConversion): The real culprit. Use ConversionExists
18373 to determine if a conversion exists instead of acutually trying to
18374 perform the conversion. It's faster too.
18376 (Expression::ConvertExplicit): Modify to use ConversionExists to check
18377 and only then attempt the implicit conversion.
18379 2001-09-28 Ravi Pratap <ravi@ximian.com>
18381 * expression.cs (ConvertImplicit): Use a cache for conversions
18382 already found. Check level of recursion and bail out if necessary.
18384 2001-09-28 Miguel de Icaza <miguel@ximian.com>
18386 * typemanager.cs (string_concat_string_string, string_concat_object_object):
18387 Export standard methods that we expect for string operations.
18389 * statement.cs (Block::UsageWarning): Track usage of variables and
18390 report the errors for not used variables.
18392 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
18395 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18397 * codegen.cs: remove unnneded code
18399 * expression.cs: Removed BuiltinTypeAccess class
18401 Fix the order in which implicit conversions are
18404 The previous fixed dropped support for boxed conversions (adding a
18405 test to the test suite now)
18407 (UserImplicitCast::CanConvert): Remove test for source being null,
18408 that code is broken. We should not feed a null to begin with, if
18409 we do, then we should track the bug where the problem originates
18410 and not try to cover it up here.
18412 Return a resolved expression of type UserImplicitCast on success
18413 rather than true/false. Ravi: this is what I was talking about,
18414 the pattern is to use a static method as a "constructor" for
18417 Also, do not create arguments until the very last minute,
18418 otherwise we always create the arguments even for lookups that
18419 will never be performed.
18421 (UserImplicitCast::Resolve): Eliminate, objects of type
18422 UserImplicitCast are born in a fully resolved state.
18424 * typemanager.cs (InitCoreTypes): Init also value_type
18425 (System.ValueType).
18427 * expression.cs (Cast::Resolve): First resolve the child expression.
18429 (LValue): Add new method AddressOf to be used by
18432 Change the argument of Store to take an EmitContext instead of an
18433 ILGenerator, because things like FieldExpr need to be able to call
18434 their children expression to generate the instance code.
18436 (Expression::Error, Expression::Warning): Sugar functions for
18439 (Expression::MemberLookup): Accept a TypeContainer instead of a
18440 Report as the first argument.
18442 (Expression::ResolvePrimary): Killed. I still want to improve
18443 this as currently the code is just not right.
18445 (Expression::ResolveMemberAccess): Simplify, but it is still
18448 (Unary::Resolve): Catch errors in AddressOf operators.
18450 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
18451 index to a byte for the short-version, or the compiler will choose
18452 the wrong Emit call, which generates the wrong data.
18454 (ParameterReference::Emit, ::Store): same.
18456 (FieldExpr::AddressOf): Implement.
18458 * typemanager.cs: TypeManager: made public variable instead of
18461 * driver.cs: document --fatal.
18463 * report.cs (ErrorMessage, WarningMessage): new names for the old
18464 Error and Warning classes.
18466 * cs-parser.jay (member_access): Turn built-in access to types
18467 into a normal simplename
18469 2001-09-27 Ravi Pratap <ravi@ximian.com>
18471 * expression.cs (Invocation::BetterConversion): Fix to cope
18472 with q being null, since this was introducing a bug.
18474 * expression.cs (ConvertImplicit): Do built-in conversions first.
18476 2001-09-27 Ravi Pratap <ravi@ximian.com>
18478 * expression.cs (UserImplicitCast::Resolve): Fix bug.
18480 2001-09-27 Ravi Pratap <ravi@ximian.com>
18482 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
18483 I had introduced long ago (what's new ?).
18485 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18486 the work of all the checking.
18487 (ConvertImplicit): Call CanConvert and only then create object if necessary.
18488 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
18490 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
18491 that is the right way.
18493 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
18494 overloading resolution. Use everywhere instead of cutting and pasting code.
18496 (Binary::ResolveOperator): Use MakeUnionSet.
18498 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
18499 we have to convert to bool types. Not complete yet.
18501 2001-09-27 Miguel de Icaza <miguel@ximian.com>
18503 * typemanager.cs (TypeManager::CSharpName): support ushort.
18505 * expression.cs (Expression::TryImplicitIntConversion): Attempts
18506 to provide an expression that performsn an implicit constant int
18507 conversion (section 6.1.6).
18508 (Expression::ConvertImplicitRequired): Reworked to include
18509 implicit constant expression conversions.
18511 (Expression::ConvertNumericExplicit): Finished.
18513 (Invocation::Emit): If InstanceExpression is null, then it means
18514 that we perform a call on this.
18516 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18518 * expression.cs (Unary::Emit): Remove some dead code.
18519 (Probe): Implement Resolve and Emit for `is'.
18520 (Expression::ConvertImplicitRequired): Attempt to do constant
18521 expression conversions here. Maybe should be moved to
18522 ConvertImplicit, but I am not sure.
18523 (Expression::ImplicitLongConstantConversionPossible,
18524 Expression::ImplicitIntConstantConversionPossible): New functions
18525 that tell whether is it possible to apply an implicit constant
18526 expression conversion.
18528 (ConvertNumericExplicit): Started work on explicit numeric
18531 * cs-parser.jay: Update operator constants.
18533 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
18534 (Parameters::GetSignature): Hook up VerifyArgs here.
18535 (Parameters::VerifyArgs): Verifies that no two arguments have the
18538 * class.cs (Operator): Update the operator names to reflect the
18539 ones that the spec expects (as we are just stringizing the
18542 * expression.cs (Unary::ResolveOperator): Fix bug: Use
18543 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
18544 previous usage did only work for our methods.
18545 (Expression::ConvertImplicit): Handle decimal implicit numeric
18546 conversions as well.
18547 (Expression::InternalTypeConstructor): Used to invoke constructors
18548 on internal types for default promotions.
18550 (Unary::Emit): Implement special handling for the pre/post
18551 increment/decrement for overloaded operators, as they need to have
18552 the same semantics as the other operators.
18554 (Binary::ResolveOperator): ditto.
18555 (Invocation::ConversionExists): ditto.
18556 (UserImplicitCast::Resolve): ditto.
18558 2001-09-26 Ravi Pratap <ravi@ximian.com>
18560 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
18561 operator, return after emitting body. Regression tests pass again !
18563 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
18564 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
18565 (Invocation::OverloadResolve): Ditto.
18566 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
18568 * everywhere : update calls to the above methods accordingly.
18570 2001-09-26 Miguel de Icaza <miguel@ximian.com>
18572 * assign.cs (Assign): Make it inherit from ExpressionStatement.
18574 * expression.cs (ExpressionStatement): New base class used for
18575 expressions that can appear in statements, so that we can provide
18576 an alternate path to generate expression that do not leave a value
18579 (Expression::Emit, and all the derivatives): We no longer return
18580 whether a value is left on the stack or not. Every expression
18581 after being emitted leaves a single value on the stack.
18583 * codegen.cs (EmitContext::EmitStatementExpression): Use the
18584 facilties of ExpressionStatement if possible.
18586 * cs-parser.jay: Update statement_expression.
18588 2001-09-25 Miguel de Icaza <miguel@ximian.com>
18590 * driver.cs: Change the wording of message
18592 2001-09-25 Ravi Pratap <ravi@ximian.com>
18594 * expression.cs (Binary::ResolveOperator): Had forgottten to set
18595 the type of the expression to the return type of the method if
18596 we have an overloaded operator match ! The regression tests pass again !
18597 (Unary::ResolveOperator): Ditto.
18599 * expression.cs (Invocation::ConversionExists): Correct the member lookup
18600 to find "op_Implicit", not "implicit" ;-)
18601 (UserImplicitCast): New class to take care of user-defined implicit conversions.
18602 (ConvertImplicit, ForceConversion): Take TypeContainer argument
18604 * everywhere : Correct calls to the above accordingly.
18606 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
18607 (ConvertImplicit): Do user-defined conversion if it exists.
18609 2001-09-24 Miguel de Icaza <miguel@ximian.com>
18611 * assign.cs: track location.
18612 (Resolve): Use implicit conversions on assignment.
18614 * literal.cs: Oops. Not good, Emit of short access values should
18615 pass (Bytes) or the wrong argument will be selected.
18617 * expression.cs (Unary::Emit): Emit code for -expr.
18619 (Unary::ResolveOperator): Handle `Substract' for non-constants
18620 (substract from zero from the non-constants).
18621 Deal with Doubles as well.
18623 (Expression::ConvertImplicitRequired): New routine that reports an
18624 error if no implicit conversion exists.
18626 (Invocation::OverloadResolve): Store the converted implicit
18627 expressions if we make them
18629 2001-09-24 Ravi Pratap <ravi@ximian.com>
18631 * class.cs (ConstructorInitializer): Take a Location argument.
18632 (ConstructorBaseInitializer): Same here.
18633 (ConstructorThisInitializer): Same here.
18635 * cs-parser.jay : Update all calls accordingly.
18637 * expression.cs (Unary, Binary, New): Take location argument.
18638 Update accordingly everywhere.
18640 * cs-parser.jay : Update all calls to the above to take a location
18643 * class.cs : Ditto.
18645 2001-09-24 Ravi Pratap <ravi@ximian.com>
18647 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
18648 (Invocation::BetterConversion): Same here
18649 (Invocation::ConversionExists): Ditto.
18651 (Invocation::ConversionExists): Implement.
18653 2001-09-22 Ravi Pratap <ravi@ximian.com>
18655 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
18656 Also take an additional TypeContainer argument.
18658 * All over : Pass in TypeContainer as argument to OverloadResolve.
18660 * typemanager.cs (CSharpName): Update to check for the string type and return
18663 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
18666 2001-09-21 Ravi Pratap <ravi@ximian.com>
18668 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
18669 (Invocation::BetterFunction): Implement.
18670 (Invocation::BetterConversion): Implement.
18671 (Invocation::ConversionExists): Skeleton, no implementation yet.
18673 Okay, things work fine !
18675 2001-09-21 Miguel de Icaza <miguel@ximian.com>
18677 * typemanager.cs: declare and load enum_type, delegate_type and
18680 * expression.cs (Expression::Emit): Now emit returns a value that
18681 tells whether a value is left on the stack or not. This strategy
18682 might be reveted tomorrow with a mechanism that would address
18683 multiple assignments.
18684 (Expression::report118): Utility routine to report mismatches on
18687 (Unary::Report23): Report impossible type/operator combination
18690 (Unary::IsIncrementableNumber): Whether the type can be
18691 incremented or decremented with add.
18692 (Unary::ResolveOperator): Also allow enumerations to be bitwise
18694 (Unary::ResolveOperator): Implement ++, !, ~,
18696 (Invocation::Emit): Deal with new Emit convetion.
18698 * All Expression derivatives: Updated their Emit method to return
18699 whether they leave values on the stack or not.
18701 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
18702 stack for expressions that are statements.
18704 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18706 * expression.cs (LValue): New interface. Must be implemented by
18708 (LocalVariableReference, ParameterReference, FieldExpr): Implement
18711 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
18712 interface for generating code, simplifies the code.
18714 2001-09-20 Ravi Pratap <ravi@ximian.com>
18716 * expression.cs (everywhere): Comment out return statements in ::Resolve
18717 methods to avoid the warnings.
18719 2001-09-20 Miguel de Icaza <miguel@ximian.com>
18721 * driver.cs (parse): Report error 2001 if we can not open the
18724 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
18727 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
18730 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
18731 otherwise nested blocks end up with the same index.
18733 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
18735 * expression.cs: Instead of having FIXMEs in the Resolve
18736 functions, throw exceptions so it is obvious that we are facing a
18739 * cs-parser.jay (invocation_expression): Pass Location information.
18741 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
18742 Use a basename for those routines because .NET does not like paths
18745 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
18748 2001-09-19 Miguel de Icaza <miguel@ximian.com>
18750 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
18751 are loading the correct data types (throws an exception if not).
18752 (TypeManager::InitCoreTypes): Use CoreLookupType
18754 * expression.cs (Unary::ResolveOperator): return the child
18755 expression for expressions which are just +expr.
18756 (Unary::ResolveOperator): Return negative literals for -LITERAL
18757 expressions (otherwise they are Unary {Literal}).
18758 (Invocation::Badness): Take into account `Implicit constant
18759 expression conversions'.
18761 * literal.cs (LongLiteral): Implement long literal class.
18762 (IntLiteral): export the `Value' of the intliteral.
18764 2001-09-19 Ravi Pratap <ravi@ximian.com>
18766 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
18768 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
18769 instead of 'Operator'
18771 * expression.cs (Binary::ResolveOperator): Update accordingly.
18772 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
18775 * cs-parser.jay (unary_expression): Update to use the new names.
18777 * gen-treedump.cs (GetUnary): Same here.
18779 * expression.cs (Unary::Resolve): Implement.
18780 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
18781 operators are found instead of making noise ;-)
18782 (Unary::ResolveOperator): New method to do precisely the same thing which
18783 Binary::ResolveOperator does for Binary expressions.
18784 (Unary.method, .Arguments): Add.
18785 (Unary::OperName): Implement.
18786 (Unary::ForceConversion): Copy and Paste !
18788 * class.cs (Operator::Define): Fix a small bug for the case when we have
18791 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
18792 for the inbuilt operators. Only overloading works for now ;-)
18794 2001-09-18 Miguel de Icaza <miguel@ximian.com>
18796 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
18797 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
18799 * expression.cs (This::Emit): Implement.
18800 (This::Resolve): Implement.
18801 (TypeOf:Resolve): Implement.
18802 (Expression::ResolveSimpleName): Add an implicit this to instance
18804 (MemberAccess::Resolve): Deal with Parameters and Fields.
18805 Bind instance variable to Field expressions.
18806 (FieldExpr::Instance): New field used to track the expression that
18807 represents the object instance.
18808 (FieldExpr::Resolve): Track potential errors from MemberLookup not
18810 (FieldExpr::Emit): Implement.
18812 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
18813 the last instruction contains a return opcode to avoid generating
18814 the last `ret' instruction (this generates correct code, and it is
18815 nice to pass the peverify output).
18817 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
18818 initializer for static and instance variables.
18819 (Constructor::Emit): Allow initializer to be null in the case of
18820 static constructors. Only emit initializer for instance
18823 (TypeContainer::FindMembers): Return a null array if there are no
18826 Also fix the code for the MemberTypes.Method branch, as it was not
18827 scanning that for operators (or tried to access null variables before).
18829 * assign.cs (Assign::Emit): Handle instance and static fields.
18833 * driver.cs: Stop compilation if there are parse errors.
18835 * cs-parser.jay (constructor_declaration): Provide default base
18836 initializer for non-static constructors.
18837 (constructor_declarator): Do not provide a default base
18838 initializers if none was specified.
18839 Catch the fact that constructors should not have parameters.
18841 * class.cs: Do not emit parent class initializers for static
18842 constructors, that should be flagged as an error.
18844 2001-09-18 Ravi Pratap <ravi@ximian.com>
18846 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
18847 Move back code into TypeContainer::Populate.
18849 2001-09-18 Ravi Pratap <ravi@ximian.com>
18851 * class.cs (TypeContainer::AddConstructor): Fix the check to
18852 compare against Name, not Basename.
18853 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18855 * cs-parser.jay : Update accordingly.
18857 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18858 for methods, don't forget to look into the operators too.
18859 (RegisterMethodBuilder): Helper method to take care of this for
18860 methods, constructors and operators.
18861 (Operator::Define): Completely revamp.
18862 (Operator.OperatorMethod, MethodName): New fields.
18863 (TypeContainer::Populate): Move the registering of builders into
18864 RegisterMethodBuilder.
18865 (Operator::Emit): Re-write.
18867 * expression.cs (Binary::Emit): Comment out code path to emit method
18868 invocation stuff for the case when we have a user defined operator. I am
18869 just not able to get it right !
18871 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18873 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18876 (Expression::MemberLookup): Provide a version that allows to
18877 specify the MemberTypes and BindingFlags.
18879 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18880 so it was not fetching variable information from outer blocks.
18882 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18883 Beforefieldinit as it was buggy.
18885 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18886 that Ravi put here.
18888 * class.cs (Constructor::Emit): Only emit if block is not null.
18889 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18890 deal with this by semantically definining it as if the user had
18893 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18894 constructors as we now "emit" them at a higher level.
18896 (TypeContainer::DefineDefaultConstructor): Used to define the
18897 default constructors if none was provided.
18899 (ConstructorInitializer): Add methods Resolve and Emit.
18901 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18903 2001-09-17 Ravi Pratap <ravi@ximian.com>
18905 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18906 the default constructor builder with our hashtable for methodbuilders
18909 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18910 and argument_count is 0 in which case we have a match.
18911 (Binary::ResolveOperator): More null checking and miscellaneous coding
18914 2001-09-17 Ravi Pratap <ravi@ximian.com>
18916 * rootcontext.cs (IsNameSpace): Compare against null.
18918 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18920 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18921 and Unary::Operator.
18923 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18926 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18927 we have overloaded operators.
18928 (Binary::ResolveOperator): Implement the part which does the operator overload
18931 * class.cs (Operator::Emit): Implement.
18932 (TypeContainer::Emit): Emit the operators we have too.
18934 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18935 the case when we have a user-defined operator.
18937 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18939 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18941 2001-09-16 Ravi Pratap <ravi@ximian.com>
18943 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18944 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18945 (Constructor::Emit): Implement.
18946 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18947 if we have no work to do.
18948 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18951 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18952 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18954 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18957 2001-09-15 Ravi Pratap <ravi@ximian.com>
18959 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18961 (Tree::RecordNamespace): Method to do what the name says ;-)
18962 (Tree::Namespaces): Property to get at the namespaces hashtable.
18964 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18967 * rootcontext.cs (IsNamespace): Fixed it :-)
18969 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18971 * class.cs (TypeContainer::FindMembers): Add support for
18973 (MethodCore): New class that encapsulates both the shared aspects
18974 of a Constructor and a Method.
18975 (Method, Constructor): Factored pieces into MethodCore.
18977 * driver.cs: Added --fatal which makes errors throw exceptions.
18978 Load System assembly as well as part of the standard library.
18980 * report.cs: Allow throwing exceptions on errors for debugging.
18982 * modifiers.cs: Do not use `parent', instead use the real type
18983 container to evaluate permission settings.
18985 * class.cs: Put Ravi's patch back in. He is right, and we will
18986 have to cope with the
18988 2001-09-14 Ravi Pratap <ravi@ximian.com>
18990 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18991 FamORAssem, not FamANDAssem.
18993 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18995 * driver.cs: Added --parse option that only parses its input files
18998 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18999 incorrect. IsTopLevel is not used to tell whether an object is
19000 root_types or not (that can be achieved by testing this ==
19001 root_types). But to see if this is a top-level *class* (not
19002 necessarly our "toplevel" container).
19004 2001-09-14 Ravi Pratap <ravi@ximian.com>
19006 * enum.cs (Enum::Define): Modify to call the Lookup method on the
19007 parent instead of a direct call to GetType.
19009 2001-09-14 Ravi Pratap <ravi@ximian.com>
19011 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
19012 Modifiers.TypeAttr. This should just be a call to that method.
19014 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
19015 object so that we can determine if we are top-level or not.
19017 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
19020 * enum.cs (Enum::Define): Ditto.
19022 * modifiers.cs (FieldAttr): Re-write.
19024 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
19025 (TypeContainer::HaveStaticConstructor): New property to provide access
19026 to precisely that info.
19028 * modifiers.cs (MethodAttr): Re-write.
19029 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
19031 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
19032 of top-level types as claimed.
19034 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19036 * expression.cs (MemberLookup): Fruitless attempt to lookup
19037 constructors. Maybe I need to emit default constructors? That
19038 might be it (currently .NET emits this for me automatically).
19039 (Invocation::OverloadResolve): Cope with Arguments == null.
19040 (Invocation::EmitArguments): new function, shared by the new
19041 constructor and us.
19042 (Invocation::Emit): Handle static and instance methods. Emit
19043 proper call instruction for virtual or non-virtual invocations.
19044 (New::Emit): Implement.
19045 (New::Resolve): Implement.
19046 (MemberAccess:Resolve): Implement.
19047 (MethodGroupExpr::InstanceExpression): used conforming to the spec
19048 to track instances.
19049 (FieldExpr::Resolve): Set type.
19051 * support.cs: Handle empty arguments.
19053 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
19054 SimpleLookup): Auxiliary routines to help parse a qualifier
19057 Update qualifier_identifier rule.
19059 * codegen.cs: Removed debugging messages.
19061 * class.cs: Make this a global thing, this acts just as a "key" to
19062 objects that we might have around.
19064 (Populate): Only initialize method_builders_to_methods once.
19066 * expression.cs (PropertyExpr): Initialize type from the
19069 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
19070 Resolve pattern. Attempt to implicitly convert value to boolean.
19073 * expression.cs: Set the type for the int32/int32 argument case.
19074 (Binary::ResolveOperator): Set the return type to boolean for
19075 comparission operators
19077 * typemanager.cs: Remove debugging print code.
19079 (Invocation::Resolve): resolve type.
19081 * class.cs: Allocate a MemberInfo of the correct size, as the code
19082 elsewhere depends on the test to reflect the correct contents.
19084 (Method::) Keep track of parameters, due to System.Reflection holes
19086 (TypeContainer::Populate): Keep track of MethodBuilders to Method
19089 (TypeContainer::FindMembers): Use ArrayList and then copy an array
19090 of the exact size and return that.
19092 (Class::LookupMethodByBuilder): New function that maps
19093 MethodBuilders to its methods. Required to locate the information
19094 on methods because System.Reflection bit us again.
19096 * support.cs: New file, contains an interface ParameterData and
19097 two implementations: ReflectionParameters and InternalParameters
19098 used to access Parameter information. We will need to grow this
19101 * expression.cs (Invocation::GetParameterData): implement a cache
19102 and a wrapper around the ParameterData creation for methods.
19103 (Invocation::OverloadResolve): Use new code.
19105 2001-09-13 Ravi Pratap <ravi@ximian.com>
19107 * class.cs (TypeContainer::EmitField): Remove and move into
19108 (Field::Define): here and modify accordingly.
19109 (Field.FieldBuilder): New member.
19110 (TypeContainer::Populate): Update accordingly.
19111 (TypeContainer::FindMembers): Implement.
19113 2001-09-13 Miguel de Icaza <miguel@ximian.com>
19115 * statement.cs: (VariableInfo::VariableType): New field to be
19116 initialized with the full type once it is resolved.
19118 2001-09-12 Miguel de Icaza <miguel@ximian.com>
19120 * parameter.cs (GetParameterInfo): Use a type cache to compute
19121 things only once, and to reuse this information
19123 * expression.cs (LocalVariableReference::Emit): Implement.
19124 (OpcodeCast::Emit): fix.
19126 (ParameterReference::Resolve): Implement.
19127 (ParameterReference::Emit): Implement.
19129 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
19130 that are expressions need to stay as Expressions.
19132 * typemanager.cs (CSharpName): Returns the C# name of a type if
19135 * expression.cs (Expression::ConvertImplicit): New function that
19136 implements implicit type conversions.
19138 (Expression::ImplicitReferenceConversion): Implements implicit
19139 reference conversions.
19141 (EmptyCast): New type for transparent casts.
19143 (OpcodeCast): New type for casts of types that are performed with
19144 a sequence of bytecodes.
19146 (BoxedCast): New type used for casting value types into reference
19147 types. Emits a box opcode.
19149 (Binary::DoNumericPromotions): Implements numeric promotions of
19150 and computation of the Binary::Type.
19152 (Binary::EmitBranchable): Optimization.
19154 (Binary::Emit): Implement code emission for expressions.
19156 * typemanager.cs (TypeManager): Added two new core types: sbyte
19159 2001-09-12 Ravi Pratap <ravi@ximian.com>
19161 * class.cs (TypeContainer::FindMembers): Method which does exactly
19162 what Type.FindMembers does, only we don't have to use reflection. No
19163 implementation yet.
19165 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
19166 typecontainer objects as we need to get at them.
19167 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
19169 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
19170 typecontainer object.
19172 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
19173 of just a Report object.
19175 2001-09-11 Ravi Pratap <ravi@ximian.com>
19177 * class.cs (Event::Define): Go back to using the prefixes "add_" and
19179 (TypeContainer::Populate): Now define the delegates of the type too.
19180 (TypeContainer.Delegates): Property to access the list of delegates defined
19183 * delegates.cs (Delegate::Define): Implement partially.
19185 * modifiers.cs (TypeAttr): Handle more flags.
19187 2001-09-11 Ravi Pratap <ravi@ximian.com>
19189 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
19191 (Operator::Define): Re-write logic to get types by using the LookupType method
19192 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
19193 (Indexer::Define): Ditto.
19194 (Event::Define): Ditto.
19195 (Property::Define): Ditto.
19197 2001-09-10 Ravi Pratap <ravi@ximian.com>
19199 * class.cs (TypeContainer::Populate): Now define operators too.
19200 (TypeContainer.Operators): New property to access the list of operators
19202 (Operator.OperatorMethodBuilder): New member to hold the method builder
19203 for the operator we are defining.
19204 (Operator::Define): Implement.
19206 2001-09-10 Ravi Pratap <ravi@ximian.com>
19208 * class.cs (Event::Define): Make the prefixes of the accessor methods
19209 addOn_ and removeOn_
19211 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
19212 of the location being passed in too. Ideally, this should go later since all
19213 error reporting should be done through the Report object.
19215 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
19216 (Populate): Iterate thru the indexers we have and define them too.
19217 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
19218 for the get and set accessors.
19219 (Indexer::Define): Implement.
19221 2001-09-09 Miguel de Icaza <miguel@ximian.com>
19223 * expression.cs (Binary::Resolve): Beginning of it. I scratched
19224 my previous implementation, did not work.
19226 * typemanager.cs: Add a couple of missing types (the longs).
19228 * literal.cs: Use TypeManager.bool_type instead of getting it.
19230 * expression.cs (EventExpr): New kind of expressions.
19231 (Expressio::ExprClassFromMemberInfo): finish
19233 2001-09-08 Miguel de Icaza <miguel@ximian.com>
19235 * assign.cs: Emit stores to static fields differently.
19237 2001-09-08 Ravi Pratap <ravi@ximian.com>
19239 * Merge in changes and adjust code to tackle conflicts. Backed out my
19240 code in Assign::Resolve ;-)
19242 2001-09-08 Ravi Pratap <ravi@ximian.com>
19244 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
19245 instead Report.Error and also pass in the location.
19246 (CSharpParser::Lexer): New readonly property to return the reference
19247 to the Tokenizer object.
19248 (declare_local_variables): Use Report.Error with location instead of plain
19252 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
19253 (Operator.CheckBinaryOperator): Ditto.
19255 * cs-parser.jay (operator_declarator): Update accordingly.
19257 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
19258 (CheckBinaryOperator): Same here.
19260 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
19261 on the name without any prefixes of namespace names etc. This is because we
19262 already might have something already fully qualified like
19263 'System.Console.WriteLine'
19265 * assign.cs (Resolve): Begin implementation. Stuck ;-)
19267 2001-09-07 Ravi Pratap <ravi@ximian.com>
19269 * cs-tokenizer.cs (location): Return a string which also contains
19272 * expression.cs (ElementAccess): New class for expressions of the
19273 type 'element access.'
19274 (BaseAccess): New class for expressions of the type 'base access.'
19275 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
19278 * cs-parser.jay (element_access): Implement action.
19279 (base_access): Implement actions.
19280 (checked_expression, unchecked_expression): Implement.
19282 * cs-parser.jay (local_variable_type): Correct and implement.
19283 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
19285 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
19287 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
19288 name and the specifiers.
19290 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
19292 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
19293 making them all public ;-)
19295 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
19298 2001-09-07 Miguel de Icaza <miguel@ximian.com>
19300 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
19302 (FieldExpr, PropertyExprs): New resolved expressions.
19303 (SimpleName::MemberStaticCheck): Perform static checks for access
19304 to non-static fields on static methods. Maybe this should be
19305 generalized for MemberAccesses.
19306 (SimpleName::ResolveSimpleName): More work on simple name
19309 * cs-parser.jay (primary_expression/qualified_identifier): track
19310 the parameter index.
19312 * codegen.cs (CodeGen::Save): Catch save exception, report error.
19313 (EmitContext::EmitBoolExpression): Chain to expression generation
19314 instead of temporary hack.
19315 (::EmitStatementExpression): Put generic expression code generation.
19317 * assign.cs (Assign::Emit): Implement variable assignments to
19318 local variables, parameters and fields.
19320 2001-09-06 Miguel de Icaza <miguel@ximian.com>
19322 * statement.cs (Block::GetVariableInfo): New method, returns the
19323 VariableInfo for a variable name in a block.
19324 (Block::GetVariableType): Implement in terms of GetVariableInfo
19326 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
19327 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
19329 2001-09-06 Ravi Pratap <ravi@ximian.com>
19331 * cs-parser.jay (operator_declaration): Continue on my quest : update
19332 to take attributes argument.
19333 (event_declaration): Ditto.
19334 (enum_declaration): Ditto.
19335 (indexer_declaration): Ditto.
19337 * class.cs (Operator::Operator): Update constructor accordingly.
19338 (Event::Event): Ditto.
19340 * delegate.cs (Delegate::Delegate): Same here.
19342 * enum.cs (Enum::Enum): Same here.
19344 2001-09-05 Ravi Pratap <ravi@ximian.com>
19346 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
19348 * ../tests/cs0658.cs : New file to demonstrate error 0658.
19350 * attribute.cs (Attributes): New class to encapsulate all attributes which were
19351 being passed around as an arraylist.
19352 (Attributes::AddAttribute): Method to add attribute sections.
19354 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
19355 (struct_declaration): Update accordingly.
19356 (constant_declaration): Update.
19357 (field_declaration): Update.
19358 (method_header): Update.
19359 (fixed_parameter): Update.
19360 (parameter_array): Ditto.
19361 (property_declaration): Ditto.
19362 (destructor_declaration): Ditto.
19364 * class.cs (Struct::Struct): Update constructors accordingly.
19365 (Class::Class): Ditto.
19366 (Field::Field): Ditto.
19367 (Method::Method): Ditto.
19368 (Property::Property): Ditto.
19369 (TypeContainer::OptAttribute): update property's return type.
19371 * interface.cs (Interface.opt_attributes): New member.
19372 (Interface::Interface): Update to take the extra Attributes argument.
19374 * parameter.cs (Parameter::Parameter): Ditto.
19376 * constant.cs (Constant::Constant): Ditto.
19378 * interface.cs (InterfaceMemberBase): New OptAttributes field.
19379 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
19380 the attributes as a parameter.
19381 (InterfaceProperty): Update constructor call.
19382 (InterfaceEvent): Ditto.
19383 (InterfaceMethod): Ditto.
19384 (InterfaceIndexer): Ditto.
19386 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
19387 pass the attributes too.
19388 (interface_event_declaration): Ditto.
19389 (interface_property_declaration): Ditto.
19390 (interface_method_declaration): Ditto.
19391 (interface_declaration): Ditto.
19393 2001-09-05 Miguel de Icaza <miguel@ximian.com>
19395 * class.cs (Method::Define): Track the "static Main" definition to
19396 create an entry point.
19398 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
19399 EntryPoint if we find it.
19401 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
19402 (EmitContext::ig): Make this variable public.
19404 * driver.cs: Make the default output file be the first file name
19405 with the .exe extension.
19407 Detect empty compilations
19409 Handle various kinds of output targets. Handle --target and
19410 rename -t to --dumper.
19412 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
19413 methods inherited from Expression return now an Expression. This
19414 will is used during the tree rewriting as we resolve them during
19417 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
19418 the spec. Missing entirely is the information about
19419 accessability of elements of it.
19421 (Expression::ExprClassFromMemberInfo): New constructor for
19422 Expressions that creates a fully initialized Expression based on
19423 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
19426 (Invocation::Resolve): Begin implementing resolution of invocations.
19428 * literal.cs (StringLiteral): Implement Emit.
19430 2001-09-05 Ravi Pratap <ravi@ximian.com>
19432 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
19435 2001-09-04 Ravi Pratap <ravi@ximian.com>
19437 * cs-parser.jay (attribute_arguments): Implement actions.
19438 (attribute): Fix bug in production. Implement action.
19439 (attribute_list): Implement.
19440 (attribute_target): Implement.
19441 (attribute_target_specifier, opt_target_specifier): Implement
19442 (CheckAttributeTarget): New method to check if the attribute target
19444 (attribute_section): Implement.
19445 (opt_attributes): Implement.
19447 * attribute.cs : New file to handle attributes.
19448 (Attribute): Class to hold attribute info.
19450 * cs-parser.jay (opt_attribute_target_specifier): Remove production
19451 (attribute_section): Modify production to use 2 different rules to
19452 achieve the same thing. 1 s/r conflict down !
19453 Clean out commented, useless, non-reducing dimension_separator rules.
19455 * class.cs (TypeContainer.attributes): New member to hold list
19456 of attributes for a type.
19457 (Struct::Struct): Modify to take one more argument, the attribute list.
19458 (Class::Class): Ditto.
19459 (Field::Field): Ditto.
19460 (Method::Method): Ditto.
19461 (Property::Property): Ditto.
19463 * cs-parser.jay (struct_declaration): Update constructor call to
19464 pass in the attributes too.
19465 (class_declaration): Ditto.
19466 (constant_declaration): Ditto.
19467 (field_declaration): Ditto.
19468 (method_header): Ditto.
19469 (fixed_parameter): Ditto.
19470 (parameter_array): Ditto.
19471 (property_declaration): Ditto.
19473 * constant.cs (Constant::Constant): Update constructor similarly.
19474 Use System.Collections.
19476 * parameter.cs (Parameter::Parameter): Update as above.
19478 2001-09-02 Ravi Pratap <ravi@ximian.com>
19480 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
19481 (TypeContainer.delegates): New member to hold list of delegates.
19483 * cs-parser.jay (delegate_declaration): Implement the action correctly
19484 this time as I seem to be on crack ;-)
19486 2001-09-02 Miguel de Icaza <miguel@ximian.com>
19488 * rootcontext.cs (RootContext::IsNamespace): new function, used to
19489 tell whether an identifier represents a namespace.
19491 * expression.cs (NamespaceExpr): A namespace expression, used only
19492 temporarly during expression resolution.
19493 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
19494 utility functions to resolve names on expressions.
19496 2001-09-01 Miguel de Icaza <miguel@ximian.com>
19498 * codegen.cs: Add hook for StatementExpressions.
19500 * class.cs: Fix inverted test for static flag in methods.
19502 2001-09-02 Ravi Pratap <ravi@ximian.com>
19504 * class.cs (Operator::CheckUnaryOperator): Correct error number used
19505 to make it coincide with MS' number.
19506 (Operator::CheckBinaryOperator): Ditto.
19508 * ../errors/errors.txt : Remove error numbers added earlier.
19510 * ../errors/cs1019.cs : Test case for error # 1019
19512 * ../errros/cs1020.cs : Test case for error # 1020
19514 * cs-parser.jay : Clean out commented cruft.
19515 (dimension_separators, dimension_separator): Comment out. Ostensibly not
19516 used anywhere - non-reducing rule.
19517 (namespace_declarations): Non-reducing rule - comment out.
19519 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
19520 with TypeContainer::AddEnum.
19522 * delegate.cs : New file for delegate handling classes.
19523 (Delegate): Class for declaring delegates.
19525 * makefile : Update.
19527 * cs-parser.jay (delegate_declaration): Implement.
19529 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
19531 * class.cs (Event::Define): Implement.
19532 (Event.EventBuilder): New member.
19534 * class.cs (TypeContainer::Populate): Update to define all enums and events
19536 (Events): New property for the events arraylist we hold. Shouldn't we move to using
19537 readonly fields for all these cases ?
19539 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19541 * class.cs (Property): Revamp to use the convention of making fields readonly.
19542 Accordingly modify code elsewhere.
19544 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
19545 the Define method of the Property class.
19547 * class.cs : Clean up applied patch and update references to variables etc. Fix
19549 (TypeContainer::Populate): Update to define all the properties we have. Also
19550 define all enumerations.
19552 * enum.cs (Define): Implement.
19554 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
19556 * cs-parser.jay (overloadable_operator): The semantic value is an
19557 enum of the Operator class.
19558 (operator_declarator): Implement actions.
19559 (operator_declaration): Implement.
19561 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
19562 validity of definitions.
19563 (Operator::CheckBinaryOperator): Static method to check for binary operators
19564 (TypeContainer::AddOperator): New method to add an operator to a type.
19566 * cs-parser.jay (indexer_declaration): Added line to actually call the
19567 AddIndexer method so it gets added ;-)
19569 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
19570 already taken care of by the MS compiler ?
19572 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19574 * class.cs (Operator): New class for operator declarations.
19575 (Operator::OpType): Enum for the various operators.
19577 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
19579 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
19580 ostensibly handle this in semantic analysis.
19582 * cs-parser.jay (general_catch_clause): Comment out
19583 (specific_catch_clauses, specific_catch_clause): Ditto.
19584 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
19585 (catch_args, opt_catch_args): New productions.
19586 (catch_clause): Rewrite to use the new productions above
19587 (catch_clauses): Modify accordingly.
19588 (opt_catch_clauses): New production to use in try_statement
19589 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
19590 and re-write the code in the actions to extract the specific and
19591 general catch clauses by being a little smart ;-)
19593 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
19594 Hooray, try and catch statements parse fine !
19596 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19598 * statement.cs (Block::GetVariableType): Fix logic to extract the type
19599 string from the hashtable of variables.
19601 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
19602 I end up making that mistake ;-)
19603 (catch_clauses): Fixed gross error which made Key and Value of the
19604 DictionaryEntry the same : $1 !!
19606 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19608 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
19610 * cs-parser.jay (event_declaration): Correct to remove the semicolon
19611 when the add and remove accessors are specified.
19613 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
19615 * cs-parser.jay (IndexerDeclaration): New helper class to hold
19616 information about indexer_declarator.
19617 (indexer_declarator): Implement actions.
19618 (parsing_indexer): New local boolean used to keep track of whether
19619 we are parsing indexers or properties. This is necessary because
19620 implicit_parameters come into picture even for the get accessor in the
19621 case of an indexer.
19622 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
19624 * class.cs (Indexer): New class for indexer declarations.
19625 (TypeContainer::AddIndexer): New method to add an indexer to a type.
19626 (TypeContainer::indexers): New member to hold list of indexers for the
19629 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19631 * cs-parser.jay (add_accessor_declaration): Implement action.
19632 (remove_accessor_declaration): Implement action.
19633 (event_accessors_declaration): Implement
19634 (variable_declarators): swap statements for first rule - trivial.
19636 * class.cs (Event): New class to hold information about event
19638 (TypeContainer::AddEvent): New method to add an event to a type
19639 (TypeContainer::events): New member to hold list of events.
19641 * cs-parser.jay (event_declaration): Implement actions.
19643 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
19645 * cs-parser.jay (dim_separators): Implement. Make it a string
19646 concatenating all the commas together, just as they appear.
19647 (opt_dim_separators): Modify accordingly
19648 (rank_specifiers): Update accordingly. Basically do the same
19649 thing - instead, collect the brackets here.
19650 (opt_rank_sepcifiers): Modify accordingly.
19651 (array_type): Modify to actually return the complete type string
19652 instead of ignoring the rank_specifiers.
19653 (expression_list): Implement to collect the expressions
19654 (variable_initializer): Implement. We make it a list of expressions
19655 essentially so that we can handle the array_initializer case neatly too.
19656 (variable_initializer_list): Implement.
19657 (array_initializer): Make it a list of variable_initializers
19658 (opt_array_initializer): Modify accordingly.
19660 * expression.cs (New::NType): Add enumeration to help us
19661 keep track of whether we have an object/delegate creation
19662 or an array creation.
19663 (New:NewType, New::Rank, New::Indices, New::Initializers): New
19664 members to hold data about array creation.
19665 (New:New): Modify to update NewType
19666 (New:New): New Overloaded contructor for the array creation
19669 * cs-parser.jay (array_creation_expression): Implement to call
19670 the overloaded New constructor.
19672 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
19674 * class.cs (TypeContainer::Constructors): Return member
19675 constructors instead of returning null.
19677 2001-08-26 Miguel de Icaza <miguel@ximian.com>
19679 * typemanager.cs (InitCoreTypes): Initialize the various core
19680 types after we have populated the type manager with the user
19681 defined types (this distinction will be important later while
19682 compiling corlib.dll)
19684 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
19685 on Expression Classification. Now all expressions have a method
19686 `Resolve' and a method `Emit'.
19688 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
19689 generation from working. Also add some temporary debugging
19692 2001-08-24 Miguel de Icaza <miguel@ximian.com>
19694 * codegen.cs: Lots of code generation pieces. This is only the
19695 beginning, will continue tomorrow with more touches of polish. We
19696 handle the fundamentals of if, while, do, for, return. Others are
19697 trickier and I need to start working on invocations soon.
19699 * gen-treedump.cs: Bug fix, use s.Increment here instead of
19702 * codegen.cs (EmitContext): New struct, used during code
19703 emission to keep a context. Most of the code generation will be
19706 * cs-parser.jay: Add embedded blocks to the list of statements of
19707 this block. So code generation proceeds in a top down fashion.
19709 2001-08-23 Miguel de Icaza <miguel@ximian.com>
19711 * statement.cs: Add support for multiple child blocks.
19713 2001-08-22 Miguel de Icaza <miguel@ximian.com>
19715 * codegen.cs (EmitCode): New function, will emit the code for a
19716 Block of code given a TypeContainer and its ILGenerator.
19718 * statement.cs (Block): Standard public readonly optimization.
19719 (Block::Block constructors): Link children.
19720 (Block::Child): Child Linker.
19721 (Block::EmitVariables): Emits IL variable declarations.
19723 * class.cs: Drop support for MethodGroups here, delay until
19725 (Method::): Applied the same simplification that I did before, and
19726 move from Properties to public readonly fields.
19727 (Method::ParameterTypes): Returns the parameter types for the
19728 function, and implements a cache that will be useful later when I
19729 do error checking and the semantic analysis on the methods is
19731 (Constructor::GetCallingConvention): Renamed from CallingConvetion
19732 and made a method, optional argument tells whether this is a class
19733 or a structure to apply the `has-this' bit.
19734 (Method::GetCallingConvention): Implement, returns the calling
19736 (Method::Define): Defines the type, a second pass is performed
19737 later to populate the methods.
19739 (Constructor::ParameterTypes): implement a cache similar to the
19740 one on Method::ParameterTypes, useful later when we do semantic
19743 (TypeContainer::EmitMethod): New method. Emits methods.
19745 * expression.cs: Removed MethodGroup class from here.
19747 * parameter.cs (Parameters::GetCallingConvention): new method.
19749 2001-08-21 Miguel de Icaza <miguel@ximian.com>
19751 * class.cs (TypeContainer::Populate): Drop RootContext from the
19754 (Constructor::CallingConvention): Returns the calling convention.
19755 (Constructor::ParameterTypes): Returns the constructor parameter
19758 (TypeContainer::AddConstructor): Keep track of default constructor
19759 and the default static constructor.
19761 (Constructor::) Another class that starts using `public readonly'
19762 instead of properties.
19764 (Constructor::IsDefault): Whether this is a default constructor.
19766 (Field::) use readonly public fields instead of properties also.
19768 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
19769 track of static constructors; If none is used, turn on
19770 BeforeFieldInit in the TypeAttributes.
19772 * cs-parser.jay (opt_argument_list): now the return can be null
19773 for the cases where there are no arguments.
19775 (constructor_declarator): If there is no implicit `base' or
19776 `this', then invoke the default parent constructor.
19778 * modifiers.cs (MethodAttr): New static function maps a set of
19779 modifiers flags into a MethodAttributes enum
19780 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
19781 MethodAttr, TypeAttr to represent the various mappings where the
19782 modifiers are used.
19783 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
19785 2001-08-19 Miguel de Icaza <miguel@ximian.com>
19787 * parameter.cs (GetParameterInfo): Fix bug where there would be no
19790 * interface.cs (PopulateIndexer): Implemented the code generator
19791 for interface indexers.
19793 2001-08-17 Miguel de Icaza <miguel@ximian.com>
19795 * interface.cs (InterfaceMemberBase): Now we track the new status
19798 (PopulateProperty): Implement property population. Woohoo! Got
19799 Methods and Properties going today.
19801 Removed all the properties for interfaces, and replaced them with
19802 `public readonly' fields.
19804 2001-08-16 Miguel de Icaza <miguel@ximian.com>
19806 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
19807 initialize their hashtables/arraylists only when they are needed
19808 instead of doing this always.
19810 * parameter.cs: Handle refs and out parameters.
19812 * cs-parser.jay: Use an ArrayList to construct the arguments
19813 instead of the ParameterCollection, and then cast that to a
19816 * parameter.cs: Drop the use of ParameterCollection and use
19817 instead arrays of Parameters.
19819 (GetParameterInfo): Use the Type, not the Name when resolving
19822 2001-08-13 Miguel de Icaza <miguel@ximian.com>
19824 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
19825 and instead use public readonly fields.
19827 * class.cs: Put back walking code for type containers.
19829 2001-08-11 Miguel de Icaza <miguel@ximian.com>
19831 * class.cs (MakeConstant): Code to define constants.
19833 * rootcontext.cs (LookupType): New function. Used to locate types
19836 2001-08-08 Miguel de Icaza <miguel@ximian.com>
19838 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
19839 this System.Reflection code is. Kudos to Microsoft
19841 * typemanager.cs: Implement a type cache and avoid loading all
19842 types at boot time. Wrap in LookupType the internals. This made
19843 the compiler so much faster. Wow. I rule!
19845 * driver.cs: Make sure we always load mscorlib first (for
19846 debugging purposes, nothing really important).
19848 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19849 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19851 * rootcontext.cs: Lookup types on their namespace; Lookup types
19852 on namespaces that have been imported using the `using' keyword.
19854 * class.cs (TypeContainer::TypeAttr): Virtualize.
19855 (Class::TypeAttr): Return attributes suitable for this bad boy.
19856 (Struct::TypeAttr): ditto.
19857 Handle nested classes.
19858 (TypeContainer::) Remove all the type visiting code, it is now
19859 replaced with the rootcontext.cs code
19861 * rootcontext.cs (GetClassBases): Added support for structs.
19863 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19865 * interface.cs, statement.cs, class.cs, parameter.cs,
19866 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19867 Drop use of TypeRefs, and use strings instead.
19869 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19873 * class.cs (Struct::Struct): set the SEALED flags after
19874 checking the modifiers.
19875 (TypeContainer::TypeAttr): new property, returns the
19876 TypeAttributes for a class.
19878 * cs-parser.jay (type_list): Oops, list production was creating a
19879 new list of base types.
19881 * rootcontext.cs (StdLib): New property.
19882 (GetInterfaceTypeByName): returns an interface by type name, and
19883 encapsulates error handling here.
19884 (GetInterfaces): simplified.
19885 (ResolveTree): Encapsulated all the tree resolution here.
19886 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19889 * driver.cs: Add support for --nostdlib, to avoid loading the
19890 default assemblies.
19891 (Main): Do not put tree resolution here.
19893 * rootcontext.cs: Beginning of the class resolution.
19895 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19897 * rootcontext.cs: Provide better error reporting.
19899 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19901 * rootcontext.cs (CreateInterface): Handle the case where there
19902 are no parent interfaces.
19904 (CloseTypes): Routine to flush types at the end.
19905 (CreateInterface): Track types.
19906 (GetInterfaces): Returns an array of Types from the list of
19907 defined interfaces.
19909 * typemanager.c (AddUserType): Mechanism to track user types (puts
19910 the type on the global type hash, and allows us to close it at the
19913 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19915 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19916 RecordInterface instead.
19918 * cs-parser.jay: Updated to reflect changes above.
19920 * decl.cs (Definition): Keep track of the TypeBuilder type that
19921 represents this type here. Not sure we will use it in the long
19922 run, but wont hurt for now.
19924 * driver.cs: Smaller changes to accomodate the new code.
19926 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19929 * rootcontext.cs (CreateInterface): New method, used to create
19930 the System.TypeBuilder type for interfaces.
19931 (ResolveInterfaces): new entry point to resolve the interface
19933 (CodeGen): Property, used to keep track of the code generator.
19935 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19937 * cs-parser.jay: Add a second production for delegate_declaration
19940 (enum_body): Put an opt_comma here instead of putting it on
19941 enum_body or enum_member_declarations so we can handle trailing
19942 commas on enumeration members. Gets rid of a shift/reduce.
19944 (type_list): Need a COMMA in the middle.
19946 (indexer_declaration): Tell tokenizer to recognize get/set
19948 * Remove old targets.
19950 * Re-add the parser target.
19952 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19954 * cs-parser.jay: Add precendence rules for a number of operators
19955 ot reduce the number of shift/reduce conflicts in the grammar.
19957 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19959 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19962 Get rid of old crufty code.
19964 * rootcontext.cs: Use this to keep track of the parsed
19965 representation and the defined types available to the program.
19967 * gen-treedump.cs: adjust for new convention.
19969 * type.cs: Split out the type manager, and the assembly builder
19972 * typemanager.cs: the type manager will live here now.
19974 * cil-codegen.cs: And the code generator here.
19976 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19978 * makefile: Fixed up for easy making.
19980 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19982 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19985 (unary_expression): Expand pre_increment_expression and
19986 post_decrement_expression to reduce a shift/reduce.
19988 2001-07-11 Simon Cozens
19990 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19992 Improve allow_keyword_as_indent name.
19994 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19996 * Adjustments for Beta2.
19998 2001-06-13 Miguel de Icaza <miguel@ximian.com>
20000 * decl.cs: Added `Define' abstract method.
20001 (InTransit): new property, used to catch recursive definitions.
20003 * interface.cs: Implement `Define'.
20005 * modifiers.cs: Map Modifiers.constants to
20006 System.Reflection.TypeAttribute flags.
20008 * class.cs: Keep track of types and user-defined types.
20009 (BuilderInit): New method for creating an assembly
20010 (ResolveType): New function to launch the resolution process, only
20011 used by interfaces for now.
20013 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
20014 that are inserted into the name space.
20016 2001-06-08 Miguel de Icaza <miguel@ximian.com>
20018 * ARGH. I have screwed up my tree so many times due to the use of
20019 rsync rather than using CVS. Going to fix this at once.
20021 * driver.cs: Objetify driver. Load assemblies, use assemblies to
20024 2001-06-07 Miguel de Icaza <miguel@ximian.com>
20026 * Experiment successful: Use System.Type rather that our own
20029 2001-05-25 Miguel de Icaza <miguel@ximian.com>
20031 * cs-parser.jay: Removed nsAliases from here.
20033 Use new namespaces, handle `using XXX;'
20035 * namespace.cs: Reimplemented namespace handling, use a recursive
20036 definition of the class. Now we can keep track of using clauses
20037 and catch invalid using clauses.
20039 2001-05-24 Miguel de Icaza <miguel@ximian.com>
20041 * gen-treedump.cs: Adapted for all the renaming.
20043 * expression.cs (Expression): this class now has a Type property
20044 which returns an expression Type.
20046 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
20047 `Type', as this has a different meaning now in the base
20049 2001-05-22 Miguel de Icaza <miguel@ximian.com>
20051 * interface.cs, class.cs: Removed from all the sources the
20052 references to signature computation, as we can not do method
20053 signature computation during the parsing time, as we are not
20054 trying to solve at that point distinguishing:
20058 void a (NS.Blah x) {}
20061 Which depending on the context might be valid or not, as we do not
20062 know if Blah is the same thing as NS.Blah at that point.
20064 * Redid everything so the code uses TypeRefs now instead of
20065 Types. TypeRefs are just temporary type placeholders, that need
20066 to be resolved. They initially have a pointer to a string and the
20067 current scope in which they are used. This is used later by the
20068 compiler to resolve the reference to an actual Type.
20070 * DeclSpace is no longer a CIR.Type, and neither are
20071 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
20072 are all DeclSpaces, but no Types.
20074 * type.cs (TypeRefManager): This implements the TypeRef manager,
20075 which keeps track of all the types that need to be resolved after
20076 the parsing has finished.
20078 2001-05-13 Miguel de Icaza <miguel@ximian.com>
20080 * ARGH. We are going to have to store `foreach' as a class rather
20081 than resolving it, as we need to verify error 1579 after name
20082 resolution. *OR* we could keep a flag that says `This request to
20083 IEnumerator comes from a foreach statement' which we can then use
20084 to generate the error.
20086 2001-05-10 Miguel de Icaza <miguel@ximian.com>
20088 * class.cs (TypeContainer.AddMethod): we now add methods to the
20089 MethodGroup instead of the method hashtable.
20091 * expression.cs: Add MethodGroup abstraction, which gets us one
20092 step closer to the specification in the way we handle method
20095 * cs-parser.jay (primary_expression): qualified_identifier now
20096 tried to match up an identifier to a local variable reference or
20097 to a parameter reference.
20099 current_local_parameters is now a parser global variable that
20100 points to the current parameters for the block, used during name
20103 (property_declaration): Now creates an implicit `value' argument to
20106 2001-05-09 Miguel de Icaza <miguel@ximian.com>
20108 * parameter.cs: Do not use `param' arguments as part of the
20109 signature, per the spec.
20111 2001-05-08 Miguel de Icaza <miguel@ximian.com>
20113 * decl.cs: Base class for classes, structs and interfaces. This
20114 is the "Declaration Space"
20116 * cs-parser.jay: Use CheckDef for checking declaration errors
20117 instead of having one on each function.
20119 * class.cs: Factor out some code for handling error handling in
20120 accordance to the "Declarations" section in the "Basic Concepts"
20121 chapter in the ECMA C# spec.
20123 * interface.cs: Make all interface member classes derive from
20124 InterfaceMemberBase.
20126 2001-05-07 Miguel de Icaza <miguel@ximian.com>
20128 * Many things: all interfaces are parsed and generated in
20129 gen-treedump. Support for member variables, constructors,
20130 destructors, properties, constants is there.
20132 Beginning of the IL backend, but very little done, just there for
20135 2001-04-29 Miguel de Icaza <miguel@ximian.com>
20137 * cs-parser.jay: Fix labeled statement.
20139 * cs-tokenizer.cs (escape): Escape " and ' always.
20140 ref_line, ref_name: keep track of the line/filename as instructed
20141 by #line by the compiler.
20144 2001-04-27 Miguel de Icaza <miguel@ximian.com>
20146 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
20147 to match the values in System.CodeDOM.
20149 Divid renamed to Divide.
20151 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
20153 (Statements.set): remove.
20155 * System.CodeDOM/CodeCatchClause.cs: always have a valid
20158 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
20159 falseStatements always have valid values.
20161 * cs-parser.jay: Use System.CodeDOM now.