1 2003-11-12 Miguel de Icaza <miguel@ximian.com>
3 * convert.cs (ImplicitReferenceConversion): We were missing a case
4 (System.Enum are not value types or class types, so we need to
5 classify them separatedly).
7 * driver.cs: We do not support error 2007.
9 2003-11-12 Jackson Harper <jackson@ximian.com>
11 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
12 system directory. Also use the full file name so users can
13 libraries names mscorlib-o-tron.dll in a non system dir.
15 2003-11-10 Martin Baulig <martin@ximian.com>
17 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
18 (TypeManager.InitCoreTypes): Initialize them here, but instead of
19 calling `ResolveType()' on them, directly assign their `Type'.
21 2003-11-08 Martin Baulig <martin@ximian.com>
23 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
24 return value and the `out parent' parameter.
25 (TypeContainer.DefineType): Moved the CS0644 check into
26 GetClassBases(). Don't pass the interface types to the
27 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
28 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
30 * ecore.cs (TypeExpr.IsAttribute): New property.
31 (TypeExpr.GetInterfaces): New method.
33 * interface.cs (Interface.GetInterfaceTypeByName): Return a
34 TypeExpr instead of a Type.
35 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
36 (Interface.DefineType): Don't pass the interface types to the
37 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
38 them later and then call `TypeBulider.AddInterfaceImplementation()'.
40 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
41 instead of a `Type[]'.
42 (TypeManager.RegisterBuilder): Likewise.
43 (TypeManager.AddUserInterface): Likewise.
44 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
45 `Type[]' and also return a `TypeExpr[]'.
46 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
48 2003-11-08 Martin Baulig <martin@ximian.com>
50 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
53 2003-11-08 Martin Baulig <martin@ximian.com>
55 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
56 TypeManager.ResolveExpressionTypes().
58 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
59 instead of an Expression.
60 (TypeExpr): This is now an abstract base class for `TypeExpression'.
61 (TypeExpression): New public class; formerly known as `TypeExpr'.
63 * expression.cs (ComposedCast): Derive from TypeExpr.
65 * typemanager.cs (TypeManager.system_*_expr): These are now
66 TypExpr's instead of Expression's.
67 (TypeManager.ResolveExpressionTypes): New public static function;
68 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
71 2003-11-06 Miguel de Icaza <miguel@ximian.com>
73 * expression.cs (New.DoResolve): Do not dereference value that
74 might be a null return.
76 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
77 sure that the constant value has the right type. Fixes an
78 unreported bug, similar to 50425.
80 * const.cs (Const.LookupConstantValue): Call
81 ImplicitStandardConversionExists before doing a conversion to
82 avoid havng the TypeManager.ChangeType do conversions.
84 Reduced the number of casts used
86 (Const.ChangeType): New routine to enable reuse of the constant
87 type changing code from statement.
89 * typemanager.cs (ChangeType): Move common initialization to
90 static global variables.
94 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
95 every value type to go through, even if it was void. Fix that.
97 * cs-tokenizer.cs: Use is_identifier_start_character on the start
98 character of the define, and the is_identifier_part_character for
99 the rest of the string.
101 2003-11-05 Miguel de Icaza <miguel@ximian.com>
103 * expression.cs (UnaryMutator.EmitCode): When I updated
104 LocalVariableReference.DoResolve, I overdid it, and dropped an
105 optimization done on local variable references.
107 2003-11-04 Miguel de Icaza <miguel@ximian.com>
109 * ecore.cs: Convert the return from Ldlen into an int.
111 2003-10-20 Miguel de Icaza <miguel@ximian.com>
113 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
114 the accessibility, this is a special case for toplevel non-public
115 classes (internal for instance).
117 2003-10-20 Nick Drochak <ndrochak@gol.com>
119 * ecore.cs: Fix typo and build. Needed another right paren.
121 2003-10-19 Miguel de Icaza <miguel@ximian.com>
123 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
124 `internal' case regular and protected, but not allowing protected
125 to be evaluated later. Bug 49840
127 2003-10-15 Miguel de Icaza <miguel@ximian.com>
129 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
130 to kb.Nlast, and not the kb.nFirst to isolate the switch
133 Extract the underlying type, so enumerations of long/ulong are
134 treated like long/ulong.
136 2003-10-14 Miguel de Icaza <miguel@ximian.com>
138 * expression.cs (New): Overload the meaning of RequestedType to
139 track the possible creation of the NewDelegate type, since
140 DoResolve is invoked more than once for new constructors on field
143 See bugs: #48800 and #37014
145 * cs-parser.jay (declare_local_constants): Take an arraylist
146 instead of a single constant.
148 (local_constant_declaration): It should take a
149 constant_declarators, not a constant_declarator. Fixes 49487
151 * convert.cs: Fix error report.
153 2003-10-13 Jackson Harper <jackson@ximian.com>
155 * typemanager.cs (TypeToCoreType): Add float and double this fixes
158 2003-10-09 Martin Baulig <martin@ximian.com>
160 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
162 (MethodCore.DoDefineParameters): Removed the TypeContainer
163 argument; use the DeclSpace which was passed to the .ctor instead.
164 (MethodCore.CheckParameter): Take a DeclSpace instead of a
165 TypeContainer; we only need a DeclSpace here.
167 2003-10-09 Martin Baulig <martin@ximian.com>
169 * class.cs (MethodData): Added additional `DeclSpace ds' argument
171 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
174 2003-10-09 Martin Baulig <martin@ximian.com>
176 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
177 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
178 AsAccessible(), moved them as well.
180 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
182 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
184 * cs-parser.jay : Renamed yyName to yyNames related to jay.
186 2003-10-07 Miguel de Icaza <miguel@ximian.com>
188 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
189 generation for >=, as spotted by Paolo, bug 48679.
190 Patch from David Waite.
192 * cs-tokenizer.cs: Add handling for #pragma.
194 * cs-parser.jay: Allow for both yield and yield return in the
195 syntax. The anti-cobolization of C# fight will go on!
197 * class.cs (TypeBuilder.DefineType): Catch error condition here
198 (Parent.DefineType erroring out and returning null).
200 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
201 coping with enumerations variables, we were mistakenly processing
202 them as a regular value type instead of built-in types. Fixes the
205 * typemanager.cs (IsBuiltinOrEnum): New method.
207 2003-09-30 Miguel de Icaza <miguel@ximian.com>
209 * cs-parser.jay: Upgrade: yield now needs the return clause.
211 2003-09-19 Martin Baulig <martin@ximian.com>
213 * decl.cs (MemberCache.SetupCacheForInterface): Take a
214 `MemberCache parent' argument. Normally, an interface doesn't
215 have a parent type except System.Object, but we use this in gmcs
216 for generic type parameters.
218 2003-09-18 Martin Baulig <martin@ximian.com>
220 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
221 on `type.IsInterface'; don't check whether the type has a parent
222 to determine whether it's an interface.
224 2003-09-15 Martin Baulig <martin@ximian.com>
226 * class.cs (TypeContainer.DefineType): Added an error flag to
227 avoid reporting duplicate CS0146's ("class definition is
230 * driver.cs (Driver.MainDriver): Abort if
231 RootContext.ResolveTree() reported any errors.
233 2003-09-07 Martin Baulig <martin@ximian.com>
235 * report.cs (Error, Warning): Added overloaded versions which take
236 a `params object[] args' and call String.Format().
238 2003-09-07 Martin Baulig <martin@ximian.com>
240 * decl.cs (DeclSpace..ctor): Don't call
241 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
242 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
243 (DeclSpace.RecordDecl): New method.
245 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
247 2003-09-02 Ravi Pratap <ravi@ximian.com>
249 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
250 value attributes to be applied to ParameterBuilders.
252 * class.cs (MethodCore.LabelParameters): Make static and more
253 generic so that it can be used from other places - like interface
254 methods, for instance.
256 * interface.cs (Interface.Emit): Call LabelParameters before
257 emitting attributes on the InterfaceMethod.
259 2003-08-26 Martin Baulig <martin@ximian.com>
261 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
262 resolving aliases; fixes #47927.
264 2003-08-26 Martin Baulig <martin@ximian.com>
266 * statement.cs (Using.DoResolve): This is internally emitting a
267 try/finally clause, so we need to set ec.NeedExplicitReturn if we
268 do not always return. Fixes #47681.
270 2003-08-26 Martin Baulig <martin@ximian.com>
272 * decl.cs (MemberCore): Moved WarningNotHiding(),
273 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
275 (AdditionResult): Make this nested in DeclSpace.
276 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
277 argument; call NamespaceEntry.Define() unless we're nested in a
280 * namespace.cs (Namespace.DefineName): New public function. This
281 is called from DeclSpace's .ctor to add
282 (Namespace.Lookup): Include DeclSpaces in the lookup.
284 * class.cs (Operator): Derive from MemberBase, not MemberCore.
286 * const.cs (Const): Derive from MemberBase, not MemberCore.
288 2003-08-25 Martin Baulig <martin@ximian.com>
290 * convert.cs (Convert.ExplicitReferenceConversion): When
291 converting from an interface type to a class, unbox if the target
292 type is a struct type. Fixes #47822.
294 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
296 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
299 2003-08-22 Martin Baulig <martin@ximian.com>
301 * class.cs (TypeManager.DefineType): When defining a nested type,
302 call DefineType() on our parent; fixes #47801.
304 2003-08-22 Martin Baulig <martin@ximian.com>
306 * class.cs (MethodData.Define): While checking if a method is an
307 interface implementation, improve the test a bit more to fix #47654.
309 2003-08-22 Martin Baulig <martin@ximian.com>
311 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
312 correctly; fixes #47722.
314 2003-08-22 Martin Baulig <martin@ximian.com>
316 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
317 LocalVariableReference, ensure it's not read-only. Fixes #47536.
319 * statement.cs (Fixed.DoResolve): Make all variables read-only.
321 2003-08-22 Martin Baulig <martin@ximian.com>
323 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
324 can only be assigned in static constructors. Fixes #47161.
326 2003-08-22 Martin Baulig <martin@ximian.com>
328 Rewrote and improved the flow analysis code.
330 * flowbranching.cs (FlowBranching): Make this class abstract.
331 (FlowBranching.CreateBranching): New static function to create a
333 (FlowBranchingBlock, FlowBranchingException): New classes.
334 (FlowBranching.UsageVector.Type): New public readonly field.
335 (FlowBranching.UsageVector.Breaks): Removed the setter.
336 (FlowBranching.UsageVector.Returns): Removed the setter.
337 (FlowBranching.UsageVector): Added Break(), Return(),
338 NeverReachable() and Throw() methods to modify the reachability.
339 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
340 done by FlowBranching.Merge().
341 (FlowBranching.UsageVector.MergeChild): New method; merges the
342 merge result into the current vector.
343 (FlowBranching.Merge): New abstract method to merge a branching.
345 2003-08-12 Martin Baulig <martin@ximian.com>
347 * expression.cs (Indirection.CacheTemporaries): Create the
348 LocalTemporary with the pointer type, not its element type.
350 2003-08-10 Miguel de Icaza <miguel@ximian.com>
352 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
353 token was a keyword or not.
355 Add `error' options where an IDENTIFIER was expected; Provide
356 CheckToken and CheckIdentifierToken convenience error reporting
359 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
361 * decl.cs: Rename `NamespaceEntry Namespace' public field into
362 NameSpaceEntry NameSpaceEntry.
364 (LookupInterfaceOrClass): Avoid creating a full qualified name
365 from namespace and name: avoid doing lookups when we know the
366 namespace is non-existant. Use new Tree.LookupByNamespace which
367 looks up DeclSpaces based on their namespace, name pair.
369 * driver.cs: Provide a new `parser verbose' to display the
370 exception thrown during parsing. This is turned off by default
371 now, so the output of a failure from mcs is more graceful.
373 * namespace.cs: Track all the namespaces defined in a hashtable
376 (IsNamespace): New method
378 2003-08-09 Miguel de Icaza <miguel@ximian.com>
380 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
381 we know that we need to concatenate (full typename can never be
386 * statement.cs: Use a bitfield; Do not initialize to null things
387 which are done by the constructor by default.
389 * cs-parser.jay: bug fix, parameter was 4, not 3.
391 * expression.cs: Just use the property;
393 * statement.cs: No need for GetVariableInfo method.
395 2003-08-08 Martin Baulig <martin@ximian.com>
397 * flowanalysis.cs (FlowReturns): This is now nested in the
398 `FlowBranching' class.
399 (MyBitVector): Moved this here from statement.cs.
400 (FlowBranching.SiblingType): New enum type.
401 (FlowBranching.CreateSibling): Added `SiblingType' argument.
403 2003-08-07 Martin Baulig <martin@ximian.com>
405 * flowanalysis.cs (FlowBranchingType): This is now nested in the
406 `FlowBranching' class and called `BranchingType'.
408 2003-08-07 Martin Baulig <martin@ximian.com>
410 * flowanalysis.cs: Moved all the control flow analysis code into
413 2003-08-07 Martin Baulig <martin@ximian.com>
415 * assign.cs (Assign.DoResolve): `target' must either be an
416 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
419 2003-08-07 Miguel de Icaza <miguel@ximian.com>
421 * expression.cs (BinaryMethod): This kind of expression is created by the
422 Binary class if it determines that the operator has to be handled
425 (BinaryDelegate): This kind of expression is created if we are
426 dealing with a + or - operator on delegates.
428 (Binary): remove method, argumetns, and DelegateOperator: when
429 dealing with methods,
431 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
433 * statement.cs (Block): use bitfields for the three extra booleans
434 we had in use. Remove unused topblock parameter.
436 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
438 * assign.cs: Drop extra unneeded tests.
440 2003-08-06 Miguel de Icaza <miguel@ximian.com>
442 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
444 * statement.cs (Foreach): Use VariableStorage instead of
447 * codegen.cs (VariableStorage): New class used by clients that
448 require a variable stored: locals or fields for variables that
449 need to live across yield.
451 Maybe provide a convenience api for EmitThis+EmitLoad?
453 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
456 2003-08-05 Miguel de Icaza <miguel@ximian.com>
458 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
459 RemapParameterLValue): New methods that are used to turn a
460 precomputed FieldInfo into an expression like this:
464 The idea is to use this instead of making LocalVariableReference
465 have more than one meaning.
467 * cs-parser.jay: Add error production to BASE.
469 * ecore.cs: Deal with TypeManager.GetField returning null, which
470 is now a valid return value.
472 (FieldExprNoAddress): New expression for Fields whose address can
475 * expression.cs (LocalVariableReference): During the resolve
476 phases, create new expressions if we are in a remapping context.
477 Remove code that dealt with remapping here.
479 (ParameterReference): same.
481 (ProxyInstance): New expression, like the `This' expression, but
482 it is born fully resolved. We know what we are doing, so remove
483 the errors that are targeted to user-provided uses of `this'.
485 * statement.cs (Foreach): our variable is now stored as an
486 Expression; During resolution, follow the protocol, dont just
487 assume it will return this.
489 2003-08-06 Martin Baulig <martin@ximian.com>
491 * support.cs (SeekableStreamReader.cs): New public class.
493 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
494 SeekableStreamReader instead of the normal StreamReader.
496 2003-08-04 Martin Baulig <martin@ximian.com>
498 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
499 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
500 deambiguate casts and delegate invocations.
501 (parenthesized_expression): Use the new tokens to ensure this is
502 not a cast of method invocation.
504 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
505 when reading a `)' and Deambiguate_CloseParens () was previously
508 * expression.cs (ParenthesizedExpression): New class. This is
509 just used for the CS0075 test.
510 (Binary.DoResolve): Check for CS0075.
512 2003-07-29 Ravi Pratap <ravi@ximian.com>
514 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
515 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
516 reference comparison.
518 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
519 examine the ReturnType for equality - this is necessary in the
520 cases of implicit and explicit operators whose signature also
521 includes the return type.
523 2003-07-26 Miguel de Icaza <miguel@ximian.com>
525 * namespace.cs: Cache the result of the namespace computation,
526 instead of computing it every time.
528 2003-07-24 Miguel de Icaza <miguel@ximian.com>
530 * decl.cs: Use a global arraylist that we reuse over invocations
531 to avoid excesive memory consumption. Reduces memory usage on an
532 mcs compile by one meg (45 average).
534 * typemanager.cs (LookupTypeReflection): In .NET pointers are
535 private, work around that.
537 2003-07-23 Miguel de Icaza <miguel@ximian.com>
539 * literal.cs (IntLiteral): Define Zero and One static literals.
541 * cs-parser.jay (integer_literal): use static literals to reduce
542 memory usage for the most used literals (0, 1 and -1). 211kb
543 reduced in memory usage.
545 Replace all calls to `new ArrayList' with `new
546 ArrayList(4)' which is a good average number for most allocations,
547 and also requires only 16 bytes of memory for its buffer by
550 This reduced MCS memory usage in seven megabytes for the RSS after
553 2003-07-28 Ravi Pratap <ravi@ximian.com>
555 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
556 handle params methods the correct way by forming only one
557 applicable set with params and normal methods in them. Earlier we
558 were looking at params methods only if we found no normal methods
559 which was not the correct thing to do.
561 (Invocation.BetterFunction): Take separate arguments indicating
562 when candidate and the best method are params methods in their
565 This fixes bugs #43367 and #46199.
567 * attribute.cs: Documentation updates.
569 (CheckAttribute): Rename to CheckAttributeTarget.
570 (GetValidPlaces): Rename to GetValidTargets.
572 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
573 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
577 2003-07-28 Martin Baulig <martin@ximian.com>
579 * class.cs (TypeContainer.DefineMembers): Use the base type's full
580 name when looking up the base class of a nested class. Fixes #46977.
582 2003-07-26 Martin Baulig <martin@ximian.com>
584 * expression.cs (Indexers.Indexer): New nested struct; contains
585 getter, setter and the indexer's type.
586 (Indexers.Properties): This is now an ArrayList of
588 (IndexerAccess.DoResolveLValue): Correctly set the type if the
589 indexer doesn't have any getters.
591 * assign.cs (Assign.DoResolve): Also do the implicit conversions
592 for embedded property and indexer assignments.
594 2003-07-26 Martin Baulig <martin@ximian.com>
596 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
597 preprocessor directive is not the first non-whitespace character
600 2003-07-26 Martin Baulig <martin@ximian.com>
602 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
603 namespace parsing, follow the spec more closely.
605 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
606 NamespaceEntry.Lookup().
608 2003-07-25 Martin Baulig <martin@ximian.com>
610 * MethodCore.cs (OverridesSomething): New public field; it's set
611 from TypeContainer.DefineMembers if this method overrides
612 something (which doesn't need to be a method). Fix #39462.
614 2003-07-25 Ravi Pratap <ravi@ximian.com>
616 * typemanager.cs (GetMembers): Ensure that the list of members is
617 reversed. This keeps things in sync.
619 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
620 find an AttributeUsage attribute.
622 * expression.cs (Invocation.OverloadResolve): Perform the check
623 which disallows Invoke to be directly called on a Delegate.
625 (Error_InvokeOnDelegate): Report error cs1533.
627 2003-07-25 Martin Baulig <martin@ximian.com>
629 * expression.cs (Indexers.GetIndexersForType): Only look in the
630 interface hierarchy if the requested type is already an
631 interface. Fixes #46788 while keeping #46502 fixed.
633 2003-07-25 Martin Baulig <martin@ximian.com>
635 * class.cs (TypeContainer.DefineMembers): Check whether all
636 readonly fields have been assigned and report warning CS0649 if
639 * statement.cs (LocalInfo.IsFixed): Always return true if this is
642 2003-07-24 Ravi Pratap <ravi@ximian.com>
644 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
645 returned from GetMethods to make things consistent with the
646 assumptions MCS makes about ordering of methods.
648 This should comprehensively fix bug #45127 and it does :-)
650 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
651 ordering is actually reverse.
653 * Clean up some debug messages I left lying around.
655 * interface.cs (Populate*): Get rid of code which emits attributes
656 since the stage in which we emit attributes is the 'Emit' stage,
657 not the define stage.
659 (Emit): Move attribute emission for interface members here.
661 2003-07-22 Ravi Pratap <ravi@ximian.com>
663 * expression.cs (Invocation.OverloadResolve): Follow the spec more
664 closely: we eliminate methods in base types when we have an
665 applicable method in a top-level type.
667 Please see section 14.5.5.1 for an exact description of what goes
670 This fixes bug #45127 and a host of other related to corlib compilation.
672 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
673 array is the method corresponding to the top-level type (this is
674 because of the changes made to icall.c) so we change this
677 (MethodGroupExpr.Name): This too.
679 * typemanager.cs (GetElementType): New method which does the right
680 thing when compiling corlib.
682 * everywhere: Make use of the above in the relevant places.
684 2003-07-22 Martin Baulig <martin@ximian.com>
686 * cs-parser.jay (invocation_expression): Moved
687 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
688 `cast_expression', but create a InvocationOrCast which later
689 resolves to either an Invocation or a Cast.
691 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
692 method; call this before EmitStatement() to make sure that this
693 expression can be used as a statement.
695 * expression.cs (InvocationOrCast): New class; resolves to either
696 an Invocation or a Cast.
698 * statement.cs (StatementExpression): Call ResolveStatement() on
699 the ExpressionStatement before emitting it.
701 2003-07-21 Martin Baulig <martin@ximian.com>
703 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
704 `ref' and `out' attributes match; fixes #46220.
705 (MemberAccess.ResolveMemberAccess): You can't reference a type
706 through an expression; fixes #33180.
707 (Indexers.GetIndexersForType): Don't return the indexers from
708 interfaces the class implements; fixes #46502.
710 2003-07-21 Martin Baulig <martin@ximian.com>
712 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
713 CS0661 checks; fixes bug #30442.
715 2003-07-21 Martin Baulig <martin@ximian.com>
717 * decl.cs (AdditionResult): Added `Error'.
719 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
721 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
722 makes cs0031.cs actually work.
724 2003-07-20 Martin Baulig <martin@ximian.com>
726 * namespace.cs: Fixed that bug which caused a crash when compiling
729 2003-07-20 Miguel de Icaza <miguel@ximian.com>
731 * typemanager.cs (LookupTypeReflection): Never expose types which
732 are NotPublic, NestedPrivate, NestedAssembly, or
733 NestedFamANDAssem. We used to return these, and later do a check
734 that would report a meaningful error, but the problem is that we
735 would not get the real match, if there was a name override.
737 2003-07-18 Miguel de Icaza <miguel@ximian.com>
739 * namespace.cs (Namespace, Name): Do not compute the namespace
740 name dynamically, compute it in the constructor. This reduced
741 memory usage by 1697 KB.
743 * driver.cs: Use --pause to pause at the end.
745 2003-07-17 Peter Williams <peter@newton.cx>
747 * Makefile: Change the name of the test target so that it doesn't
748 conflict with the recursive test target.
750 2003-07-17 Miguel de Icaza <miguel@ximian.com>
752 * expression.cs (LocalVariableReference.Emit, EmitAssign,
753 AddressOf): Do not use EmitThis, that was wrong, use the actual
756 2003-07-15 Miguel de Icaza <miguel@ximian.com>
758 * class.cs (MethodData.Define): While checking if a method is an
759 interface implementation, improve the test: If we are not public
760 (use new test here: use the computed MethodAttributes directly,
761 instead of the parsed modifier flags) check if the `implementing'
762 method comes from an interface or not.
764 * pending.cs (VerifyPendingMethods): Slightly better error
767 * makefile: add test target that does the mcs bootstrap.
769 2003-07-16 Ravi Pratap <ravi@ximian.com>
771 * interface.cs (Define): Do nothing here since there are no
772 members to populate etc. Move the attribute emission out of here
773 since this was just totally the wrong place to put it. Attribute
774 application happens during the 'Emit' phase, not in the 'Define'
777 (Emit): Add this method and move the attribute emission here
779 * rootcontext.cs (EmitCode): Call the Emit method on interface
782 2003-07-14 Ravi Pratap M <ravi@ximian.com>
784 * expression.cs (OverloadResolve): Report error only if Location
785 is not 'Null' which means that there was a probe going on.
787 2003-07-14 Martin Baulig <martin@ximian.com>
789 * expression.cs (ConditionalLogicalOperator): New public class to
790 implement user defined conditional logical operators.
791 This is section 14.11.2 in the spec and bug #40505.
793 2003-07-14 Martin Baulig <martin@ximian.com>
795 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
797 2003-07-14 Martin Baulig <martin@ximian.com>
799 * codegen.cs (EmitContext.InFixedInitializer): New public field.
801 * ecore.cs (IVariable.VerifyFixed): New interface method.
803 * expression.cs (Unary.ResolveOperator): When resolving the `&'
804 operator, check whether the variable is actually fixed. Fixes bug
805 #36055. Set a variable definitely assigned when taking its
806 address as required by the spec.
808 * statement.cs (LocalInfo.IsFixed): New field.
809 (LocalInfo.MakePinned): Set `IsFixed' to true.
811 2003-07-14 Ravi Pratap M <ravi@ximian.com>
813 * attribute.cs (Attribute.Resolve): While doing a Member lookup
814 for .ctors, ensure that we only ask for members declared in the
815 attribute type (BindingFlags.DeclaredOnly).
819 * expression.cs (Error_WrongNumArguments): Report error 1501
820 correctly the way CSC does.
822 2003-07-13 Martin Baulig <martin@ximian.com>
824 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
825 lookup on the fully qualified name, to make things like "X.X" work
826 where "X.X" is a fully qualified type name, but we also have a
827 namespace "X" in the using list. Fixes #41975.
829 2003-07-13 Martin Baulig <martin@ximian.com>
831 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
832 function. If we're a CompoundAssign, we need to create an embedded
833 CompoundAssign, not an embedded Assign.
834 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
837 2003-07-13 Martin Baulig <martin@ximian.com>
839 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
840 work to fix bug #46088.
842 2003-07-13 Ravi Pratap <ravi@ximian.com>
844 * class.cs (Operator.Emit): Do not emit attributes here - it is
845 taken care of by the Method class that we delegate too. This takes
848 2003-07-10 Martin Baulig <martin@ximian.com>
850 * expression.cs (TypeOfVoid): New class.
851 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
853 2003-07-10 Martin Baulig <martin@ximian.com>
855 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
858 2003-07-10 Martin Baulig <martin@ximian.com>
860 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
861 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
863 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
865 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
867 2003-07-10 Martin Baulig <martin@ximian.com>
869 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
870 of decimal. Fixes #42850.
872 NOTE: I also fixed the created byte blob, but this doesn't work on
873 the MS runtime and csc never produces any byte blobs for decimal
876 2003-07-10 Martin Baulig <martin@ximian.com>
878 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
879 structs; fixes #32068.
880 (Block.AddChildVariableNames): Fixed #44302.
882 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
884 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
886 2003-07-07 Miguel de Icaza <miguel@ximian.com>
888 * attribute.cs: And this test is onger needed.
890 2003-07-08 Martin Baulig <martin@ximian.com>
892 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
893 inaccessible types. Fixes #36313.
895 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
897 * namespace.cs (NamespaceEntry): Create implicit entries for all
898 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
899 implicit entries for N1.N2 and N1.
901 2003-07-08 Martin Baulig <martin@ximian.com>
903 Rewrote the handling of namespaces to fix a lot of the issues
904 wrt. `using' aliases etc.
906 * namespace.cs (Namespace): Splitted this class into a
907 per-assembly `Namespace' and a per-file `NamespaceEntry'.
909 * typemanager.cs (TypeManager.IsNamespace): Removed.
910 (TypeManager.ComputeNamespaces): Only compute namespaces from
911 loaded assemblies here, not the namespaces from the assembly we're
914 2003-07-08 Martin Baulig <martin@ximian.com>
916 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
918 2003-07-07 Miguel de Icaza <miguel@ximian.com>
920 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
923 I thought about the memory savings here, but LookupTypeReflection
924 is used under already very constrained scenarios. Compiling
925 corlib or mcs only exposes one hit, so it would not really reduce
926 any memory consumption.
928 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
930 * typemanager.cs: fixes bug #45889 by only adding public types from
931 other assemblies to the list of known types.
933 2003-07-07 Miguel de Icaza <miguel@ximian.com>
935 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
936 on the type we resolved.
938 2003-07-05 Martin Baulig <martin@ximian.com>
940 * pending.cs (PendingImplementation.ParentImplements): Don't
941 create the proxy if the parent is abstract.
943 * class.cs (TypeContainer.DefineIndexers): Process explicit
944 interface implementations first. Fixes #37714.
946 2003-07-04 Miguel de Icaza <miguel@ximian.com>
948 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
949 defined recursively; but since we modify the input parameters
950 (left is set to `this' temporarily), we reset this value if the
951 left_is_explicit is false, which gives the original semantics to
954 * literal.cs (NullPointer): new class used to represent a null
955 literal in a pointer context.
957 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
958 type is a pointer, use a NullPointer object instead of a
959 NullLiteral. Closes 43687
961 (ExplicitConversion): Convert pointer values using
962 the conv opcode to the proper type.
964 * ecore.cs (New): change ValueTypeVariable property into a method,
965 that returns whether the valuetype is suitable for being used.
967 * expression.cs (Binary.DoNumericPromotions): Only return if we
968 the int constant was a valid uint, and we can return both left and
969 right as uints. If not, we continue processing, to trigger the
970 type conversion. This fixes 39018.
972 * statement.cs (Block.EmitMeta): During constant resolution, set
973 the CurrentBlock property on the emitcontext, so that we resolve
976 2003-07-02 Martin Baulig <martin@ximian.com>
978 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
979 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
981 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
982 than emitting it here.
984 * statement.cs: Fixed some more flow analysis bugs.
986 2003-07-02 Martin Baulig <martin@ximian.com>
988 * class.cs (MethodData.Define): When implementing interface
989 methods, set Final unless we're Virtual.
991 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
992 check work for interface methods.
994 2003-07-01 Martin Baulig <martin@ximian.com>
996 * ecore.cs (EmitContext.This): Replaced this property with a
997 GetThis() method which takes a Location argument. This ensures
998 that we get the correct error location for a CS0188.
1000 2003-07-01 Miguel de Icaza <miguel@ximian.com>
1002 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1003 ImplicitStandardConversion.
1005 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1007 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
1009 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1012 2003-06-30 Miguel de Icaza <miguel@ximian.com>
1014 * class.cs (Constructor.Define): Turn off initlocals for unsafe
1017 (MethodData.Define): Turn off initlocals for unsafe methods.
1019 2003-06-29 Miguel de Icaza <miguel@ximian.com>
1021 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1022 complete; Fixes #37521.
1024 * delegate.cs: Use Modifiers.TypeAttr to compute the
1025 TypeAttributes, instead of rolling our own. This makes the flags
1026 correct for the delegates.
1028 2003-06-28 Miguel de Icaza <miguel@ximian.com>
1030 * class.cs (Constructor.Define): Set the private flag for static
1031 constructors as well.
1033 * cs-parser.jay (statement_expression): Set the return value to
1034 null, to avoid a crash when we catch an error.
1036 2003-06-24 Miguel de Icaza <miguel@ximian.com>
1038 * cs-parser.jay: Applied patch from Jackson that adds support for
1039 extern and unsafe modifiers to destructor declarations.
1041 * expression.cs: Report error 21 if the user is trying to index a
1044 * driver.cs: Add an error message, suggested by the bug report.
1046 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1047 if we do not have a ": this ()" constructor initializer. Fixes 45149
1049 2003-06-14 Miguel de Icaza <miguel@ximian.com>
1051 * namespace.cs: Add some information to reduce FAQs.
1053 2003-06-13 Miguel de Icaza <miguel@ximian.com>
1055 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1056 underlying enumeration types. Fixes #43915.
1058 * expression.cs: Treat ushort/short as legal values to be used in
1061 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1063 * delegate.cs: transfer custom attributes for paramenters from
1064 the delegate declaration to Invoke and BeginInvoke.
1066 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1068 * attribute.cs: handle custom marshalers and emit marshal info
1071 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
1073 * makefile.gnu: Added anonymous.cs to the compiler sources.
1075 2003-05-28 Miguel de Icaza <miguel@ximian.com>
1077 * iterators.cs: Change the name of the proxy class to include two
1080 * cs-parser.jay: Update grammar to include anonymous methods.
1082 * anonymous.cs: new file.
1084 2003-05-27 Miguel de Icaza <miguel@ximian.com>
1086 * class.cs (Field.Define): Add missing test for pointers and
1089 2003-05-27 Ravi Pratap <ravi@ximian.com>
1091 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1092 we use the stobj opcode.
1094 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1095 since it wasn't the correct fix.
1097 It still is puzzling that we are required to use stobj for IntPtr
1098 which seems to be a ValueType.
1100 2003-05-26 Miguel de Icaza <miguel@ximian.com>
1102 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1103 during regular simple name resolution. Now, the trick is that
1104 instead of returning for processing the simplename, we do a
1105 TypeManager.LookupType (ie, a rooted lookup as opposed to a
1106 contextual lookup type). If a match is found, return that, if
1107 not, return for further composition.
1109 This fixes long-standing 30485.
1111 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1112 using the address to initialize an object, do an Stobj instead of
1113 using the regular Stelem.
1115 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1116 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1117 Because if we are a BaseIndexerAccess that value will be true.
1120 * statement.cs (GotoCase.Resolve): Return after reporting an
1121 error, do not attempt to continue.
1123 * expression.cs (PointerArithmetic.Emit): If our operand is a
1124 long, convert our constants to match the operand before
1125 multiplying. Convert to I type before adding. Fixes 43670.
1127 2003-05-14 Ravi Pratap <ravi@ximian.com>
1129 * enum.cs (ImplicitConversionExists) : Rename to
1130 ImplicitEnumConversionExists to remove ambiguity.
1132 * ecore.cs (NullCast): New type of cast expression class which
1133 basically is very similar to EmptyCast with the difference being
1134 it still is a constant since it is used only to cast a null to
1138 * convert.cs (ImplicitReferenceConversion): When casting a null
1139 literal, we return a NullCast.
1141 * literal.cs (NullLiteralTyped): Remove - I don't see why this
1142 should be around anymore.
1144 The renaming (reported was slightly wrong). Corrections:
1146 ConvertImplicitStandard -> ImplicitConversionStandard
1147 ConvertExplicitStandard -> ExplicitConversionStandard
1149 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1150 before passing them in !
1152 * convert.cs (ImplicitConversionStandard): When comparing for
1153 equal expr and target types, ensure that expr is not a
1156 In general, we must not be checking (expr_type ==
1157 target_type) in the top level conversion methods
1158 (ImplicitConversion, ExplicitConversion etc). This checking is
1159 done in the methods that they delegate to.
1161 2003-05-20 Miguel de Icaza <miguel@ximian.com>
1163 * convert.cs: Move Error_CannotConvertType,
1164 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1165 ImplicitNumericConversion, ImplicitConversionExists,
1166 ImplicitUserConversionExists, StandardConversionExists,
1167 FindMostEncompassedType, FindMostSpecificSource,
1168 FindMostSpecificTarget, ImplicitUserConversion,
1169 ExplicitUserConversion, GetConversionOperators,
1170 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1171 TryImplicitIntConversion, Error_CannotConvertImplicit,
1172 ConvertImplicitRequired, ConvertNumericExplicit,
1173 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1174 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1177 Perform the following renames:
1179 StandardConversionExists -> ImplicitStandardConversionExists
1180 ConvertImplicit -> ImplicitConversion
1181 ConvertImplicitStandard -> ImplicitStandardConversion
1182 TryImplicitIntConversion -> ImplicitIntConversion
1183 ConvertImplicitRequired -> ImplicitConversionRequired
1184 ConvertNumericExplicit -> ExplicitNumericConversion
1185 ConvertReferenceExplicit -> ExplicitReferenceConversion
1186 ConvertExplicit -> ExplicitConversion
1187 ConvertExplicitStandard -> ExplicitStandardConversion
1189 2003-05-19 Martin Baulig <martin@ximian.com>
1191 * statement.cs (TypeInfo.StructInfo): Made this type protected.
1192 (TypeInfo): Added support for structs having structs as fields.
1194 * ecore.cs (FieldExpr): Implement IVariable.
1195 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1196 VariableInfo for the field.
1198 2003-05-18 Martin Baulig <martin@ximian.com>
1200 * expression.cs (This.DoResolve): Report a CS0027 if we're
1201 emitting a field initializer.
1203 2003-05-18 Martin Baulig <martin@ximian.com>
1205 * expression.cs (This.ResolveBase): New public function.
1206 (This.DoResolve): Check for CS0188.
1208 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1211 * ecore.cs (MethodGroupExpr.DoResolve): Set the
1212 `instance_expression' to null if we don't have any non-static
1215 2003-05-18 Martin Baulig <martin@ximian.com>
1217 Reworked the way how local variables and parameters are handled by
1218 the flow analysis code.
1220 * statement.cs (TypeInfo, VariableMap): New public classes.
1221 (VariableInfo): New public class. This is now responsible for
1222 checking whether a variable has been assigned. It is used for
1223 parameters and local variables.
1224 (Block.EmitMeta): Take the InternalParameters as argument; compute
1225 the layout of the flow vectors here.
1226 (Block.LocalMap, Block.ParameterMap): New public properties.
1227 (FlowBranching): The .ctor doesn't get the InternalParameters
1228 anymore since Block.EmitMeta() now computes the layout of the flow
1230 (MyStructInfo): This class is now known as `StructInfo' and nested
1231 in `TypeInfo'; we don't access this directly anymore.
1233 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1234 property and removed IsAssigned(), IsFieldAssigned(),
1235 SetAssigned() and SetFieldAssigned(); we now call them on the
1236 VariableInfo so we don't need to duplicate this code everywhere.
1238 * expression.cs (ParameterReference): Added `Block block' argument
1240 (LocalVariableReference, ParameterReference, This): The new
1241 VariableInfo class is now responsible for all the definite
1244 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1245 IsParameterAssigned, SetParameterAssigned): Removed.
1247 2003-05-18 Martin Baulig <martin@ximian.com>
1249 * typemanager.cs (InitCoreTypes): Try calling
1250 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1251 the 3-args-version. Corlib now also needs our `void_type'.
1252 (GetMethod): Added overloaded version which takes an optional
1253 `bool report_errors' to allow lookups of optional methods.
1255 2003-05-12 Martin Baulig <martin@ximian.com>
1257 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1258 only used for locals and not for parameters.
1260 2003-05-12 Miguel de Icaza <miguel@ximian.com>
1262 * support.cs (InternalParameters.ParameterType): Return the
1263 ExternalType of the parameter.
1265 * parameter.cs (Parameter.ExternalType): drop the two arguments,
1268 2003-05-11 Miguel de Icaza <miguel@ximian.com>
1270 * class.cs (MethodData.Define): Do not set the `newslot' on
1271 interface members, if they are also flagged as "override".
1273 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1274 better code for ++i and i++. This only works for static fields
1275 and local variables.
1277 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1278 want to pull the DeclSpace out of the builder_to_declspace instead
1279 of the TypeBuilder (like in TypeContainer.FindMembers).
1281 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1282 instead of LookupTypeContainer. Fixes the crash on .NET for
1283 looking up interface members.
1285 * const.cs: Create our own emit context during the Definition
1286 stage, so that constants are evaluated in the proper context, when
1287 a recursive definition happens.
1289 2003-05-11 Martin Baulig <martin@ximian.com>
1291 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
1292 new block for a switch section.
1293 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1294 the adding/lookup in the switch block. Fixes #39828.
1296 2003-05-09 Miguel de Icaza <miguel@ximian.com>
1298 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1299 functionality: I needed to convert the data after I had performed
1300 the add/sub operation into the operands type size.
1302 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1303 pass the type for the box operation, otherwise the resulting
1304 object would have been of type object.
1306 (BoxedCast): Add constructor to specify the type to box as.
1308 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1310 * iterators.cs: I was reusing the `count' variable inadvertently,
1311 take steps to not allow this to happen.
1313 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1315 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1316 by creating an array at the point where the params starts and
1317 putting all those arguments there, then adjusting the size of the
1320 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1322 * expression.cs (New.AddressOf): Implement interface
1323 IMemoryLocation. This is used when the `new' operator is used in
1324 the context of an invocation to a method on a value type.
1326 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1329 * namespace.cs: Also check the using aliases here.
1331 * driver.cs: Move the test for using validity after the types have
1332 been entered, so we do a single pass that also includes the using
1335 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1336 in the regular case. CreateSiblingForFinally is doing extra
1339 * attribute.cs (GetAttributeArgumentExpression): Store the result
1340 on an out value, and use the return value to indicate failure
1341 instead of using null (which is a valid return for Constant.GetValue).
1343 * statement.cs: Perform the analysis flow for the increment
1344 portion after the statement, because this will be the real flow of
1345 execution. Fixes #42385
1347 * codegen.cs (EmitContext.EmitArgument,
1348 EmitContext.EmitStoreArgument): New helper functions when the
1349 RemapToProxy flag is set.
1351 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1354 Add support for remapping parameters.
1356 * iterators.cs: Propagate parameter values; Store parameter
1357 values in the proxy classes.
1359 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1361 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1362 need a proxy reference; I do not know what I was thinking
1364 * cs-parser.jay (constructor_initializer): catch another error,
1365 and display nice message.
1367 (field_declaration): catch void field declaration
1368 to flag a better error.
1370 * class.cs (MemberBase.CheckBase): Report an error instead of a
1371 warning if a new protected member is declared in a struct.
1372 (Field.Define): catch the error of readonly/volatile.
1374 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1376 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1377 volatile variable is taken
1379 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1381 * statement.cs (Fixed.Resolve): Report an error if we are not in
1384 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1386 * typemanager.cs: reuse the code that handles type clashes for
1387 delegates and enumerations.
1389 * class.cs (Report28): Always report.
1391 * expression.cs (EncodeAsAttribute): Allow nulls here.
1393 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1395 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1396 the functionality for testing whether an expression is valid for
1397 an attribute here. Also handle the case of arrays of elements
1400 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1401 encoding a linear array into an array of objects that are suitable
1402 to be passed to an CustomAttributeBuilder.
1404 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1406 * ecore.cs: (FieldExpr): Handle field remapping here.
1408 * iteratators.cs: Pass the instance variable (if the method is an
1409 instance method) to the constructors, so we can access the field
1410 variables on the class.
1412 TODO: Test this with structs. I think the THIS variable on
1413 structs might have to be a pointer, and not a refenrece
1415 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1417 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1418 local variables to fields in a proxy class.
1420 * iterators.cs (PopulateProxy): Rename our internal fields to
1422 Create a <THIS> field if we are an instance method, so we can
1423 reference our parent container variables.
1424 (MapVariable): Called back from the EmitContext code to enter a
1425 new variable to field mapping into the proxy class (we just create
1429 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1430 for using the remapped locals to fields.
1432 I placed the code here, because that gives the same semantics to
1433 local variables, and only changes the Emit code.
1435 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1436 statements inside iterators.
1437 (VariableInfo): Add a FieldBuilder for the cases when we are
1438 remapping local variables to fields in a proxy class
1440 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1441 current_block != null.
1443 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1444 not cope with strings, as it has been moved to the
1445 TableSwitchEmit. Fixed bug in switch generation.
1447 * expression.cs (New.DoResolve): Provide more context for the user
1448 when reporting an error.
1450 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1453 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1454 check the permissions for it. Note than in a type-resolution
1455 context the check was already present in DeclSpace.ResolveType,
1456 but was missing from the MemberAccess.
1458 (ArrayCreation.CheckIndices): warn if the user has
1459 more nested levels of expressions, but there are no more
1460 dimensions specified. Avoids crash on bug 41906.
1462 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1464 * statement.cs (Block): replace Implicit bool, for a generic
1466 New flag: `Unchecked'. This is used during the EmitMeta phase
1467 (which is out-of-line with the regular Resolve/Emit process for a
1468 statement, as this is done ahead of time, but still gets a chance
1469 to call constant resolve).
1471 (Block.Flags): new enum for adding a new flag.
1473 (Block.EmitMeta): track the state of unchecked.
1475 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1476 to enable constant resolution to work there as well.
1478 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1480 * typemanager.cs (ienumerable_type): Also look up
1481 System.Collections.IEnumerable.
1483 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1485 TODO: Test more than one conditional per method.
1487 * class.cs (Indexer.Define): Report the location where the user is
1488 referencing the unsupported feature.
1490 (MethodData): Overload the use of `conditionals' to
1491 minimize the creation of needless ArrayLists. This saves roughly
1492 212kb on my machine.
1494 (Method): Implement the new IIteratorContainer interface.
1495 (Method.SetYields): Implement the method by setting the ModFlags
1496 to contain METHOD_YIELDS.
1498 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1499 which just got set to null.
1501 * iterators.cs: New file.
1503 (Yield, YieldBreak): New statements.
1505 * statement.cs (Return.Resolve): Flag an error if we are used in
1508 * codegen.cs (InIterator): New flag set if the code is being
1509 compiled in an iterator method.
1511 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1512 internal modifier, and we just use it to avoid adding extra
1513 fields, as this is seldom used.
1515 * cs-parser.jay: Add yield_statement (yield and yield break).
1517 * driver.cs: New flag -v2 to turn on version 2 features.
1519 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1520 hashtable when v2 is enabled.
1522 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1524 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1525 there is already a namespace defined with this name.
1527 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1528 people upgraded their corlibs.
1530 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1531 always use fully qualified types, no need to use the compiler
1534 (TypeManager.IsNamespace): Use binarysearch.
1536 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1537 AddDelegate): I did not quite use the new IsValid API properly: I
1538 have to pass the short-name and the fullname. I was passing only
1539 the basename instead of the fullname sometimes.
1541 (TypeContainer.DefineType): call NamespaceClash.
1543 * interface.cs (Interface.DefineType): use NamespaceClash before
1546 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1549 * enum.cs: (Enum.DefineType): use NamespaceClash before
1552 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1553 speed increase. First, use the negative_hits cache when we get a
1554 negative. Second, add the type with its full original name
1555 instead of the new . and + encoded name (reflection uses + to
1556 separate type from a nested type). Use LookupTypeReflection
1557 directly which bypasses the type->name hashtable (that we already
1558 know does not contain the type.
1560 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1561 location/container type.
1563 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1565 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1567 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1569 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1570 method is being referenced in the method group from a static
1571 context, and report error 120 if so.
1573 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1576 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1577 is created, we create the A namespace).
1579 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1582 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1584 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1585 invocation to ModuleBuilder.GetType with the same values will
1586 return a new type instance, so we need to cache its return
1589 * expression.cs (Binary.ResolveOperator): Only allow the compare
1590 operators on enums if they are of the same type.
1592 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1593 types of ValueType on their own case. Before we were giving them
1594 the same treatment as objects.
1596 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1597 fullname. Short name is used to compare against container name.
1598 Fullname is used to check against defined namespace names.
1600 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1601 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1603 (Method.CheckBase): Call parent.
1604 (MemberBase.CheckBase): Check for protected members on sealed
1606 (PropertyBase.CheckBase): Call parent.
1607 (Field.Define): Call parent.
1609 * report.cs: Negative error codes are now mapped to 8000 - code,
1610 so that the display is render more nicely.
1612 * typemanager.cs: Do not use try/catch, instead report a regular
1615 (GetPointerType, GetReferenceType): These methods provide
1616 mechanisms to obtain the T* and T& from a T. We had the code
1617 previously scattered around the code base, and it also used
1618 TypeManager.LookupType that would go through plenty of caches.
1619 This one goes directly to the type source.
1621 In some places we did the Type.GetType followed by
1622 ModuleBuilder.GetType, but not in others, so this unifies the
1625 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1626 statements now that we have namespace information.
1628 * typemanager.cs (IsNamespace): New method, returns whether the
1629 string presented is a namespace or not.
1631 (ComputeNamespaces): New public entry point, computes the list of
1632 available namespaces, using the GetNamespaces API call in Mono, or
1633 the slower version in MS.NET.
1635 Now before we start the semantic analysis phase, we have a
1636 complete list of namespaces including everything that the user has
1639 Deleted old code to cache namespaces in .nsc files.
1641 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1643 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1644 class/struct location definition Location for the implicit
1645 constructor location.
1647 (Operator.Define): Use the location of the operator for the
1648 implicit Method definition.
1650 (Constructor.Emit): use the constructor location for the implicit
1651 base initializer constructor.
1653 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1654 and the Expression class now contains two new methods:
1656 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1657 isolate type lookup from the rest of the resolution process.
1659 Since we use Expressions to hold type definitions due to the way
1660 we parse the input we have historically overloaded Resolve to
1661 perform the Type lookups if a special flag is passed. Now this is
1662 eliminated and two methods take their place.
1664 The differences in the two methods between xStep and xTerminal is
1665 that xStep is involved in our current lookup system that uses
1666 SimpleNames to compose a name, while xTerminal is used just to
1667 catch the case where the simplename lookup failed.
1669 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1671 * expression.cs (ResolveMemberAccess): Remove redundant code.
1672 TypeExpr expressions are always born fully resolved.
1674 * interface.cs (PopulateMethod): Do not lookup the types twice.
1675 We were doing it once during SemanticAnalysis and once during
1678 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1679 in local variable type definitions, were being returned as a
1680 SimpleName (we decomposed everything into a string), that is
1681 because primary_expression was being used instead of a type in the
1682 grammar (reduce/reduce conflicts).
1684 The part that was wrong is that we converted the expression into a
1685 string (an oversimplification in one hand, compounded with primary
1686 expressions doing string concatenation).
1692 Would return "A.B.C[]" as a SimpleName. This stopped things like
1693 using clauses from working on this particular context. And a type
1694 was being matched directly against "A.B.C[]".
1696 We now use the correct approach, and allow for ComposedCast to be
1697 part of the unary expression. So the "A.B.C []" become a composed
1698 cast of "A.B.C" (as a nested group of MemberAccess with a
1699 SimpleName at the end) plus the rank composition "[]".
1703 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1705 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1706 for the access level checking.
1708 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1709 `TypeContainer container', because I kept getting confused when I
1710 was debugging this code.
1712 * expression.cs (Indexers): Instead of tracking getters/setters,
1713 we now track them in parallel. We create one arraylist less, but
1714 most importantly it is possible now for the LValue code to find a
1715 matching get for a set.
1717 (IndexerAccess.DoResolveLValue): Update the code.
1718 GetIndexersForType has been modified already to extract all the
1719 indexers from a type. The code assumed it did not.
1721 Also make the code set the correct return type for the indexer.
1722 This was fixed a long time ago for properties, but was missing for
1723 indexers. It used to be void_type.
1725 (Binary.Emit): Test first for doubles instead of
1726 floats, as they are more common.
1728 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1729 when dealing with floats and the <=, >= operators. This fixes bug
1732 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1733 to load the array value by emitting a load on the foreach variable
1734 type. This was incorrect.
1736 We now emit the code to load an element using the the array
1737 variable type, and then we emit the conversion operator.
1741 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1743 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1745 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1747 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1748 test for protection before we test for signatures.
1750 (MethodSignature.ToString): implement.
1752 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1753 to the case where we reduced into a LongConstant.
1755 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1756 depend on whether the information is acurrate, because the
1757 Microsoft runtime will always claim that the array type is public,
1758 regardless of the real state.
1760 If the type is a pointer, another problem happens: the type is
1761 reported as non-public in Microsoft.
1763 In both cases we have to call CheckAccessLevel recursively with
1764 the underlying type as the argument to be tested.
1766 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1768 * assign.cs (Assign.Emit): If we are dealing with a compound
1769 assignment expression, we should use the code path that stores the
1770 intermediate result in a temporary value. This fixes #40903.
1772 *expression.cs (Indirection.ToString): Provide ToString method for
1775 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
1777 * class.cs: Null out fields holding references to Block objects so
1778 they can be garbage collected.
1780 * expression.cs (OverloadResolve): Remove unused local.
1782 2003-04-07 Martin Baulig <martin@ximian.com>
1784 * codegen.cs (EmitContext.CurrentFile): New public field.
1785 (EmitContext.Mark): Use the CurrentFile to check whether the
1786 location is in the correct file.
1787 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1789 2003-04-07 Martin Baulig <martin@ximian.com>
1791 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1793 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1794 location. [FIXME: The location argument which gets passed to this
1795 method is sometimes wrong!]
1797 2003-04-07 Nick Drochak <ndrochak@gol.com>
1799 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1801 2003-04-07 Miguel de Icaza <miguel@ximian.com>
1803 * expression.cs (Indirection.EmitAssign): We were using the
1804 temporary, but returning immediately instead of continuing the
1807 2003-04-06 Martin Baulig <martin@ximian.com>
1809 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1810 if it's a nested child, but also deriving from the outer class.
1813 * typemanager.cs (IsNestedChildOf): Make this work if it's a
1814 nested child, but also deriving from the outer class. See
1816 (FilterWithClosure): We may access private members of the outer
1817 class if we're a nested child and deriving from the outer class.
1818 (RealMemberLookup): Only set `closure_private_ok' if the
1819 `original_bf' contained BindingFlags.NonPublic.
1821 2003-04-05 Martin Baulig <martin@ximian.com>
1823 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1825 2003-04-02 Miguel de Icaza <miguel@ximian.com>
1827 * class.cs (Event.Define): Do not allow abstract events to have
1830 2003-04-01 Miguel de Icaza <miguel@ximian.com>
1832 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1833 block in event declarations.
1835 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1836 value type, get its address.
1838 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1839 leaving a class on the stack instead of a boolean value (int
1840 0/1). Change the code so we compare against null, and then the
1841 result against zero.
1843 * class.cs (TypeContainer.GetClassBases): We were checking for the
1844 parent class being sealed too late.
1846 * expression.cs (Binary.Emit): For <= and >= when dealing with
1847 floating point values, use cgt.un and clt.un instead of cgt and
1850 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
1852 * statement.cs: Apply the same optimization as MS: skip the
1853 GetEnumerator returning an IEnumerator, and use the one returning a
1854 CharEnumerator instead. This allows us to avoid the try-finally block
1857 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
1859 * cs-parser.jay: Attributes cannot be applied to
1860 namespaces. Fixes #40473
1862 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1865 (Add*): check if the name is valid using the full name for constants,
1866 fields, properties and events.
1868 2003-03-28 Miguel de Icaza <miguel@ximian.com>
1870 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1871 char constants to be part of the enumeration.
1873 * expression.cs (Conditional.DoResolve): Add support for operator
1874 true. Implements the missing functionality from 14.12
1876 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1877 operator true/false as required by the spec.
1879 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1880 implicit conversion to boolean.
1882 * statement.cs (Statement.ResolveBoolean): A boolean expression is
1883 also one where the type implements `operator true'.
1885 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1886 get an expression that will invoke operator true based on an
1889 (GetConversionOperators): Removed the hack that called op_True
1892 (Expression.ResolveBoolean): Move this from Statement.
1894 2003-03-17 Miguel de Icaza <miguel@ximian.com>
1896 * ecore.cs (FieldExpr): do not allow initialization of initonly
1897 fields on derived classes
1899 2003-03-13 Martin Baulig <martin@ximian.com>
1901 * statement.cs (Block.Emit): Call ig.BeginScope() and
1902 ig.EndScope() when compiling with debugging info; call
1903 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1905 2003-03-08 Miguel de Icaza <miguel@ximian.com>
1907 * expression.cs (Indexers): Do not construct immediately, allow
1908 for new members to be appended as we go. Fixes 38143
1910 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1912 * expression.cs: save/restore context when resolving an unchecked
1915 2003-03-05 Miguel de Icaza <miguel@ximian.com>
1917 * cfold.cs: Catch division by zero in modulus operator during
1920 2003-03-03 Miguel de Icaza <miguel@ximian.com>
1922 * interface.cs (Interface.DefineMembers): Avoid defining members
1925 2003-02-27 Miguel de Icaza <miguel@ximian.com>
1927 * driver.cs: handle the +/- options for -noconfig
1929 * statement.cs (Unckeched.Resolve): Also track the state of
1930 unchecked in the Resolve phase.
1932 2003-02-27 Martin Baulig <martin@ximian.com>
1934 * ecore.cs (Expression.MemberLookup): Don't create a
1935 MethodGroupExpr for something which is not a method. Fixes #38291.
1937 2003-02-25 Miguel de Icaza <miguel@ximian.com>
1939 * class.cs (MemberBase.CheckParameters): Also check that the type
1940 is unmanaged if it is a pointer.
1942 * expression.cs (SizeOf.Resolve): Add location information.
1944 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1945 a managed type is declared.
1947 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1948 parameter modifiers as well. Fixes bug 38606
1950 * class.cs: Very sad. Am backing out the speed up changes
1951 introduced by the ArrayList -> Array in the TypeContainer, as they
1952 were not actually that much faster, and introduced a bug (no error
1953 reports on duplicated methods).
1955 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1956 source first, this will guarantee that we have a valid expression
1957 before calling in lower levels functions that will require a
1958 resolved object. Then use this original_source in the
1959 target.ResolveLValue instead of the original source that was
1962 Another change. Use target.Resolve instead of LValueResolve.
1963 Although we are resolving for LValues, we will let the Assign code
1964 take care of that (it will be called again from Resolve). This
1965 basically allows code like this:
1967 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1968 class Y { void A (X x) { x [0] += o; }
1970 The problem was that the indexer was trying to resolve for
1971 set_Item (idx, object o) and never finding one. The real set_Item
1972 was set_Item (idx, X). By delaying the process we get the right
1977 2003-02-23 Martin Baulig <martin@ximian.com>
1979 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1980 while calling DoEmit ().
1982 * codegen.cs (EmitContext.Mark): Don't mark locations in other
1983 source files; if you use the #line directive inside a method, the
1984 compiler stops emitting line numbers for the debugger until it
1985 reaches the end of the method or another #line directive which
1986 restores the original file.
1988 2003-02-23 Martin Baulig <martin@ximian.com>
1990 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1992 2003-02-23 Martin Baulig <martin@ximian.com>
1994 * statement.cs (Block.AddChildVariableNames): We need to call this
1995 recursively, not just for our immediate children.
1997 2003-02-23 Martin Baulig <martin@ximian.com>
1999 * class.cs (Event.Define): Always make the field private, like csc does.
2001 * typemanager.cs (TypeManager.RealMemberLookup): Make events
2002 actually work, fixes bug #37521.
2004 2003-02-23 Miguel de Icaza <miguel@ximian.com>
2006 * delegate.cs: When creating the various temporary "Parameters"
2007 classes, make sure that we call the ComputeAndDefineParameterTypes
2008 on those new parameters (just like we do with the formal ones), to
2009 allow them to be resolved in the context of the DeclSpace.
2011 This fixes the bug that Dick observed in Bugzilla #38530.
2013 2003-02-22 Miguel de Icaza <miguel@ximian.com>
2015 * expression.cs (ResolveMemberAccess): When resolving a constant,
2016 do not attempt to pull a constant if the value was not able to
2017 generate a valid constant.
2019 * const.cs (LookupConstantValue): Do not report more errors than required.
2021 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2023 * expression.cs: fixes bug #38328.
2025 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2027 * class.cs: Changed all the various members that can be part of a
2028 class from being an ArrayList to be an Array of the right type.
2029 During the DefineType type_list, interface_list, delegate_list and
2030 enum_list are turned into types, interfaces, delegates and enums
2033 And during the member population, indexer_list, event_list,
2034 constant_list, field_list, instance_constructor_list, method_list,
2035 operator_list and property_list are turned into their real arrays.
2037 Although we could probably perform this operation earlier, for
2038 good error reporting we need to keep the lists and remove the
2039 lists for longer than required.
2041 This optimization was triggered by Paolo profiling the compiler
2042 speed on the output of `gen-sample-program.pl' perl script.
2044 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2045 not crash in methods like MemberLookupFailed that use this field.
2047 This problem arises when the compiler fails to resolve a type
2048 during interface type definition for example.
2050 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2052 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2053 inherit from System.Object, so we have to stop at null, not only
2054 when reaching System.Object.
2056 2003-02-17 Miguel de Icaza <miguel@ximian.com>
2058 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2059 DeclaredOnly because the parent indexer might have had a different
2060 name, but did not loop until the top of the hierarchy was reached.
2062 The problem this one fixes is 35492: when a class implemented an
2063 indexer from an interface, we were getting the interface method
2064 (which was abstract) and we were flagging an error (can not invoke
2067 This also keeps bug 33089 functioning, and test-148 functioning.
2069 * typemanager.cs (IsSpecialMethod): The correct way of figuring
2070 out if a method is special is to see if it is declared in a
2071 property or event, or whether it is one of the predefined operator
2072 names. This should fix correctly #36804.
2074 2003-02-15 Miguel de Icaza <miguel@ximian.com>
2076 The goal here is to remove the dependency on EmptyCast.Peel ().
2077 Killing it completely.
2079 The problem is that currently in a number of places where
2080 constants are expected, we have to "probe" for an EmptyCast, and
2081 Peel, which is not the correct thing to do, as this will be
2082 repetitive and will likely lead to errors.
2084 The idea is to remove any EmptyCasts that are used in casts that
2085 can be reduced to constants, so we only have to cope with
2088 This bug hunt was triggered by Bug 37363 and the desire to remove
2089 the duplicate pattern where we were "peeling" emptycasts to check
2090 whether they were constants. Now constants will always be
2093 * ecore.cs: Use an enumconstant here instead of wrapping with
2096 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2097 throwing me off. By handling this we can get rid of a few hacks.
2099 * statement.cs (Switch): Removed Peel() code.
2101 2003-02-14 Miguel de Icaza <miguel@ximian.com>
2103 * class.cs: Location information for error 508
2105 * expression.cs (New.DoResolve): Add a guard against double
2106 resolution of an expression.
2108 The New DoResolve might be called twice when initializing field
2109 expressions (see EmitFieldInitializers, the call to
2110 GetInitializerExpression will perform a resolve on the expression,
2111 and later the assign will trigger another resolution
2113 This leads to bugs (#37014)
2115 * delegate.cs: The signature for EndInvoke should contain any ref
2116 or out parameters as well. We were not doing this in the past.
2118 * class.cs (Field.Define): Do not overwrite the type definition
2119 inside the `volatile' group. Turns out that volatile enumerations
2120 were changing the type here to perform a validity test, which
2123 2003-02-12 Miguel de Icaza <miguel@ximian.com>
2125 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2126 and structs, we do not want to load the instance variable
2128 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2129 enum_type has to be handled like an object reference (implicit
2130 conversions exists from this to object), but the regular IsClass
2131 and IsValueType tests will never return true for this one.
2133 Also we use TypeManager.IsValueType instead of type.IsValueType,
2134 just for consistency with the rest of the code (this is only
2135 needed if we ever use the construct exposed by test-180.cs inside
2136 corlib, which we dont today).
2138 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
2140 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2143 2003-02-09 Martin Baulig <martin@ximian.com>
2145 * namespace.cs (Namespace..ctor): Added SourceFile argument.
2146 (Namespace.DefineNamespaces): New static public method; this is
2147 called when we're compiling with debugging to add all namespaces
2150 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2151 pass it to the Namespace's .ctor.
2153 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2154 and MethodBase arguments; pass the namespace ID to the symwriter;
2155 pass the MethodBase instead of the token to the symwriter.
2156 (SymbolWriter.DefineNamespace): New method to add a namespace to
2159 2003-02-09 Martin Baulig <martin@ximian.com>
2161 * symbolwriter.cs: New file. This is a wrapper around
2162 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
2163 methods here in near future.
2165 2003-02-09 Martin Baulig <martin@ximian.com>
2167 * codegen.cs (EmitContext.Mark): Just pass the arguments to
2168 ILGenerator.MarkSequencePoint() which are actually used by the
2171 2003-02-09 Martin Baulig <martin@ximian.com>
2173 * location.cs (SourceFile): New public sealed class. This
2174 contains the name and an index which is used in the location's token.
2175 (Location): Reserve an appropriate number of bits in the token for
2176 the source file instead of walking over that list, this gives us a
2177 really huge performance improvement when compiling with debugging.
2179 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2180 `SourceFile' argument instead of a string.
2181 (Driver.ProcessFile): Add all the files via Location.AddFile(),
2182 but don't parse/tokenize here, we need to generate the list of all
2183 source files before we do that.
2184 (Driver.ProcessFiles): New static function. Parses/tokenizes all
2187 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2188 instead of a string.
2190 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2193 2003-02-09 Martin Baulig <martin@ximian.com>
2195 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2196 filename on `#line default'.
2198 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2200 * statement.cs: don't clear the pinned var when the fixed statement
2201 returns from the method (fixes bug#37752).
2203 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2205 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
2208 2003-02-07 Martin Baulig <martin@ximian.com>
2210 * driver.cs: Removed the `--debug-args' command line argument.
2212 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2213 automatically by the AsssemblyBuilder.
2214 (CodeGen.InitializeSymbolWriter): We don't need to call any
2215 initialization function on the symbol writer anymore. This method
2216 doesn't take any arguments.
2218 2003-02-03 Miguel de Icaza <miguel@ximian.com>
2220 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2221 from referenced assemblies as well.
2223 2003-02-02 Martin Baulig <martin@ximian.com>
2225 * class.cs (MethodData.Emit): Generate debugging info for external methods.
2227 2003-02-02 Martin Baulig <martin@ximian.com>
2229 * class.cs (Constructor.Emit): Open the symbol writer before
2230 emitting the constructor initializer.
2231 (ConstructorInitializer.Emit): Call ec.Mark() to allow
2232 single-stepping through constructor initializers.
2234 2003-01-30 Miguel de Icaza <miguel@ximian.com>
2236 * class.cs: Handle error 549: do not allow virtual methods in
2239 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2241 * decl.cs: Check access levels when resolving types
2243 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2245 * statement.cs: Add parameters and locals set in catch blocks that might
2246 return to set vector
2248 2003-01-29 Miguel de Icaza <miguel@ximian.com>
2250 * class.cs (Operator): Set the SpecialName flags for operators.
2252 * expression.cs (Invocation.DoResolve): Only block calls to
2253 accessors and operators on SpecialName methods.
2255 (Cast.TryReduce): Handle conversions from char constants.
2258 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2260 * statement.cs: small memory and time optimization in FlowBranching.
2262 2003-01-28 Pedro Mart <yoros@wanadoo.es>
2264 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2265 problem that the last fix but in the other sid (Set).
2267 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2268 access when there is no indexer in the hierarchy.
2270 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2272 * class.cs: Combine some if statements.
2274 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2276 * driver.cs: fixed bug #37187.
2278 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
2280 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2281 any indexer, it's needed to build a list with all the indexers in the
2282 hierarchy (AllGetters), else we have problems. Fixes #35653.
2284 2003-01-23 Miguel de Icaza <miguel@ximian.com>
2286 * class.cs (MethodData.Define): It is wrong for an interface
2287 implementation to be static in both cases: explicit and implicit.
2288 We were only handling this in one case.
2290 Improve the if situation there to not have negations.
2292 * class.cs (Field.Define): Turns out that we do not need to check
2293 the unsafe bit on field definition, only on usage. Remove the test.
2295 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2297 * driver.cs: use assembly.Location instead of Codebase (the latest
2298 patch made mcs fail when using MS assemblies).
2300 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
2302 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2303 get the path to *corlib.dll.
2305 2003-01-21 Nick Drochak <ndrochak@gol.com>
2309 * typemanager.cs: Remove compiler warnings
2311 2003-01-20 Duncan Mak <duncan@ximian.com>
2313 * AssemblyInfo.cs: Bump the version number to 0.19.
2315 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2317 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2319 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2321 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2323 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2325 * cs-parser.jay: Small fix: we were not comparing the constructor
2326 name correctly. Thanks to Zoltan for the initial pointer.
2328 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2330 * cs-tokenizer.cs: Set file name when specified with #line
2332 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2334 * cs-parser.jay: Only perform the constructor checks here if we
2335 are named like the class; This will help provider a better
2336 error. The constructor path is taken when a type definition is
2337 not found, but most likely the user forgot to add the type, so
2338 report that rather than the constructor error.
2340 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2342 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2345 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2347 * cs-parser.jay: Add cleanup call.
2349 2003-01-13 Duncan Mak <duncan@ximian.com>
2351 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2352 consistent with other methods.
2354 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2356 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2358 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2360 * attribute.cs: only set GuidAttr to true when we have a
2363 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2367 * typemanager.cs: fixes to allow mcs compile corlib with the new
2368 Type.IsSubclassOf fix.
2370 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2372 * expression.cs (LocalVariableReference.DoResolve): Classify a
2373 constant as a value, not as a variable. Also, set the type for
2376 * cs-parser.jay (fixed_statement): take a type instead of a
2377 pointer_type, so we can produce a better error message later.
2379 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2382 (For.DoEmit): Make inifinite loops have a
2383 non-conditional branch back.
2385 (Fixed.DoEmit): First populate the pinned variables, then emit the
2386 statement, then clear the variables. Before I was emitting the
2387 code once for each fixed piece.
2390 2003-01-08 Martin Baulig <martin@ximian.com>
2392 * statement.cs (FlowBranching.MergeChild): A break in a
2393 SWITCH_SECTION does not leave a loop. Fixes #36155.
2395 2003-01-08 Martin Baulig <martin@ximian.com>
2397 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2398 lives in the same number space than `param_map'. Fixes #36154.
2400 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2402 * cs-parser.jay (constructor_declaration): Set the
2403 Constructor.ModFlags before probing for it. This makes the
2404 compiler report 514, 515 and 132 (the code was there, but got
2407 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2408 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2409 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2411 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2413 * enum.cs: create the enum static fields using the enum type.
2415 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2417 * class.cs: don't try to create the ParamBuilder for the return
2418 type if it's not needed (and handle it breaking for the ms runtime
2421 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2423 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2425 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2427 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2428 the command. This showed up while compiling the JANET source
2429 code, which used \r as its only newline separator.
2431 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2433 * class.cs (Method.Define): If we are an operator (because it
2434 reuses our code), then set the SpecialName and HideBySig. #36128
2436 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2438 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2439 exception, report error 120 `object reference required'.
2441 * driver.cs: Add --pause option, used during to measure the size
2442 of the process as it goes with --timestamp.
2444 * expression.cs (Invocation.DoResolve): Do not allow methods with
2445 SpecialName to be invoked.
2447 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2449 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2450 number before adding it.
2452 2002-12-21 Ravi Pratap <ravi@ximian.com>
2454 * ecore.cs (StandardImplicitConversion): When in an unsafe
2455 context, we allow conversion between void * to any other pointer
2456 type. This fixes bug #35973.
2458 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2460 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2461 is not thrown when extensionless outputs are used
2463 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2465 * rootcontext.cs: fixed compilation of corlib.
2467 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2469 * attribute.cs (Attributes.Contains): Add new method.
2471 * class.cs (MethodCore.LabelParameters): if the parameter is an
2472 `out' parameter, check that no attribute `[In]' has been passed.
2474 * enum.cs: Handle the `value__' name in an enumeration.
2476 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2478 * decl.cs: Added special case to allow overrides on "protected
2481 2002-12-18 Ravi Pratap <ravi@ximian.com>
2483 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2484 since it makes much more sense.
2486 (Attributes.ctor): Don't require a Location parameter.
2488 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2490 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2491 since we already have that information per attribute.
2493 * everywhere : make appropriate changes.
2495 * class.cs (LabelParameters): Write the code which actually
2496 applies attributes to the return type. We can't do this on the MS
2497 .NET runtime so we flag a warning in the case an exception is
2500 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2502 * const.cs: Handle implicit null conversions here too.
2504 2002-12-17 Ravi Pratap <ravi@ximian.com>
2506 * class.cs (MethodCore.LabelParameters): Remove the extra
2507 Type [] parameter since it is completely unnecessary. Instead
2508 pass in the method's attributes so that we can extract
2509 the "return" attribute.
2511 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2513 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2514 of ignoring it and letting the compile continue.
2516 * typemanager.cs (ChangeType): use an extra argument to return an
2517 error condition instead of throwing an exception.
2519 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2521 * expression.cs (Unary.TryReduce): mimic the code for the regular
2522 code path. Perform an implicit cast in the cases where we can
2523 implicitly convert to one of the integral types, and then reduce
2524 based on that constant. This fixes bug #35483.
2526 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2528 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2530 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2532 * namespace.cs: fixed bug #35489.
2534 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2536 * class.cs: Remove some dead code.
2538 * cs-parser.jay: Estimate the number of methods needed
2539 (RootContext.MethodCount);
2541 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2542 numbers instead of StringBuilders.
2544 * support.cs (PtrHashtable): Add constructor with initial size;
2545 We can now reduce reallocations of the method table.
2547 2002-12-10 Ravi Pratap <ravi@ximian.com>
2549 * attribute.cs (ApplyAttributes): Keep track of the emitted
2550 attributes on a per-target basis. This fixes bug #35413.
2552 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2554 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2555 default to the Windows 1252 encoding.
2557 (UnixParseOption): Support version, thanks to Alp for the missing
2560 * AssemblyInfo.cs: Add nice assembly information.
2562 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2565 * cs-parser.jay: Allow a trailing comma before the close bracked
2566 in the attribute_section production.
2568 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2569 address of the instance was being taken, I will take this out,
2570 because we take the address of the object immediately here.
2572 2002-12-09 Ravi Pratap <ravi@ximian.com>
2574 * typemanager.cs (AreMultipleAllowed): Take care of the most
2575 obvious case where attribute type is not in the current assembly -
2578 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2580 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2581 definitions, instead of doing that afterwards.
2583 Also we use a nice little hack, depending on the constructor, we
2584 know if we are a "composed" name or a simple name. Hence, we
2585 avoid the IndexOf test, and we avoid
2587 * codegen.cs: Add code to assist in a bug reporter to track down
2588 the source of a compiler crash.
2590 2002-12-07 Ravi Pratap <ravi@ximian.com>
2592 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2593 types have been emitted for a given element and flag an error
2594 if something which does not have AllowMultiple set is used more
2597 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2598 attribute types and their corresponding AllowMultiple properties
2600 (AreMultipleAllowed): Check the property for a given type.
2602 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2603 property in the case we have a TypeContainer.
2605 (Attributes.AddAttribute): Detect duplicates and just skip on
2606 adding them. This trivial fix catches a pretty gross error in our
2607 attribute emission - global attributes were being emitted twice!
2609 Bugzilla bug #33187 is now fixed.
2611 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2613 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2616 * expression.cs (Binary.ResolveOperator): I can only use the
2617 Concat (string, string, string) and Concat (string, string,
2618 string, string) if the child is actually a concatenation of
2621 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2623 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2624 context where we need a 2-character lookahead.
2626 * pending.cs (PendingImplementation): Rework so we can keep track
2627 of interface types all the time, and flag those which were
2628 implemented by parents as optional.
2630 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2632 * expression.cs (Binary.ResolveOperator): Use
2633 String.Concat(string,string,string) or
2634 String.Concat(string,string,string,string) when possible.
2636 * typemanager: More helper methods.
2639 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2641 * pending.cs: remove the bogus return from GetMissingInterfaces()
2642 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2644 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2646 * namespace.cs: avoid duplicated 'using xxx' being added to
2647 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2648 when we get more than one 'using' statement for the same namespace.
2649 Report a CS0105 warning for it.
2651 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2653 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2654 of calling getChar/putback, uses internal knowledge of it.
2656 (xtoken): Reorder tokenizer so most common patterns are checked
2657 first. This reduces the compilation time in another 5% (from 8.11s
2658 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2660 The parsing time is 22% of the compilation in mcs, and from that
2661 64% is spent on the tokenization process.
2663 I tried using a binary search for keywords, but this is slower
2664 than the hashtable. Another option would be to do a couple of
2667 * Not use a StringBuilder, instead use an array of chars,
2668 with a set value. Notice that this way we could catch
2669 the 645 error without having to do it *afterwards*.
2671 * We could write a hand-parser to avoid the hashtable
2672 compares altogether.
2674 The identifier consumption process takes 37% of the tokenization
2675 time. Another 15% is spent on is_number. 56% of the time spent
2676 on is_number is spent on Int64.Parse:
2678 * We could probably choose based on the string length to
2679 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2682 Another 3% is spend on wrapping `xtoken' in the `token' function.
2684 Handle 0xa0 as whitespace (#34752)
2686 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2688 * typemanager.cs (IsCLRType): New routine to tell whether a type
2689 is one of the builtin types.
2691 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2692 typecode in more places instead of doing pointer comparissions.
2693 We could leverage some knowledge about the way the typecodes are
2696 New code to cache namespaces in assemblies, it is currently not
2697 invoked, to be used soon.
2699 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2701 * expression.cs (Binary.ResolveOperator): specially handle
2702 strings, and do not perform user-defined operator overloading for
2705 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2707 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2708 internalcall as it is a pretty simple operation; Avoid whenever
2709 possible to call Char.IsLetter.
2711 (consume_identifier): Cut by half the number of
2712 hashtable calls by merging the is_keyword and GetKeyword behavior.
2714 Do not short-circuit, because if we do, we
2715 report errors (ie, #if false && true would produce an invalid
2719 2002-11-24 Martin Baulig <martin@ximian.com>
2721 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2722 check constant ranges and report a CS0221. Fixes #33186.
2724 2002-11-24 Martin Baulig <martin@ximian.com>
2726 * cs-parser.jay: Make this work for uninitialized variable
2727 declarations in the `for' initializer. Fixes #32416.
2729 2002-11-24 Martin Baulig <martin@ximian.com>
2731 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2732 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2734 2002-11-24 Martin Baulig <martin@ximian.com>
2736 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2737 argument; if true, we also check for user-defined conversions.
2738 This is only needed if both arguments are of a user-defined type.
2739 Fixes #30443, added test-175.cs.
2740 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2742 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2744 2002-11-24 Martin Baulig <martin@ximian.com>
2746 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2747 function to get the store opcode.
2748 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2749 only emit the Ldelema if the store opcode is Stobj. You must run
2750 both test-34 and test-167 to test this. Fixes #34529.
2752 2002-11-23 Martin Baulig <martin@ximian.com>
2754 * ecore.cs (Expression.MemberLookup): Added additional
2755 `qualifier_type' argument which is used when we're being called
2756 from MemberAccess.DoResolve() and null if we're called from a
2758 (Expression.MemberLookupFailed): New method to report errors; this
2759 does the CS1540 check and reports the correct error message.
2761 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2762 argument for the CS1540 check and redone the way how we're dealing
2763 with private members. See the comment in the source code for details.
2764 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2765 `closure_start_type' to `closure_qualifier_type' and check whether
2766 it's not null. It was not this filter being broken, it was just
2767 being called with the wrong arguments.
2769 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2770 and pass it the correct `qualifier_type'; this also does the error
2773 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2775 * expression.cs (Invocation.EmitParams): If the we are dealing
2776 with a non-built-in value type, load its address as well.
2778 (ArrayCreation): Use a a pretty constant instead
2779 of the hardcoded value 2. Use 6 instead of 2 for the number of
2780 static initializers.
2782 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2783 because they are not really value types, just glorified integers.
2785 * driver.cs: Do not append .exe, the CSC compiler does not do it.
2787 * ecore.cs: Remove redundant code for enumerations, make them use
2788 the same code path as everything else, fixes the casting issue
2789 with enumerations in Windows.Forms.
2791 * attribute.cs: Do only cast to string if it is a string, the
2792 validation happens later.
2794 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2795 people upgrade their corlibs.
2797 * ecore.cs: Oops, enumerations were not following the entire code path
2799 2002-11-21 Miguel de Icaza <miguel@ximian.com>
2801 * typemanager.cs (FilterWithClosure): Commented out the test for
2802 1540 in typemanager.cs, as it has problems when accessing
2803 protected methods from a parent class (see test-174.cs).
2805 * attribute.cs (Attribute.ValidateGuid): new method.
2806 (Attribute.Resolve): Use above.
2808 2002-11-19 Miguel de Icaza <miguel@ximian.com>
2810 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2812 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2813 handling for enumerations, as we only needed the TypeContainer
2814 functionality to begin with (this is required for the fix below to
2815 work for enums that reference constants in a container class for
2818 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2820 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2821 a valid TypeBuilder to perform lookups on.o
2823 * class.cs (InheritableMemberSignatureCompare): Use true in the
2824 call to GetGetMethod and GetSetMethod, because we are comparing
2825 the signature, and we need to get the methods *even* if they are
2828 (PropertyBase.CheckBase): ditto.
2830 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2831 GotoCase.Resolve): Use Peel on EmpytCasts.
2833 * ecore.cs (EmptyCast): drop child, add Peel method.
2835 2002-11-17 Martin Baulig <martin@ximian.com>
2837 * ecore.cs (EmptyCast.Child): New public property.
2839 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2840 label resolved to an EmptyCast. Fixes #34162.
2841 (GotoCase.Resolve): Likewise.
2842 (Block.EmitMeta): Likewise.
2844 2002-11-17 Martin Baulig <martin@ximian.com>
2846 * expression.cs (Invocation.BetterConversion): Prefer int over
2847 uint; short over ushort; long over ulong for integer literals.
2848 Use ImplicitConversionExists instead of StandardConversionExists
2849 since we also need to check for user-defined implicit conversions.
2850 Fixes #34165. Added test-173.cs.
2852 2002-11-16 Martin Baulig <martin@ximian.com>
2854 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2855 with the `true' and `false' literals. Fixes #33151.
2857 2002-11-16 Martin Baulig <martin@ximian.com>
2859 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2860 October 22nd; don't do the cs1540 check for static members.
2862 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2863 now using our own filter here and doing the cs1540 check again.
2865 2002-11-16 Martin Baulig <martin@ximian.com>
2867 * support.cs (InternalParameters): Don't crash if we don't have
2868 any fixed parameters. Fixes #33532.
2870 2002-11-16 Martin Baulig <martin@ximian.com>
2872 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2873 when looking up static methods to make this work on Windows.
2876 2002-11-16 Martin Baulig <martin@ximian.com>
2878 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2879 a setter rather than using PropertyInfo.CanWrite.
2881 2002-11-15 Nick Drochak <ndrochak@gol.com>
2883 * class.cs: Allow acces to block member by subclasses. Fixes build
2886 2002-11-14 Martin Baulig <martin@ximian.com>
2888 * class.cs (Constructor.Emit): Added the extern/block check.
2891 2002-11-14 Martin Baulig <martin@ximian.com>
2893 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2894 iteration while looking for indexers, this is needed because the
2895 indexer may have a different name in our base classes. Fixed the
2896 error reporting (no indexers at all, not get accessor, no
2897 overloaded match). Fixes bug #33089.
2898 (IndexerAccess.DoResolveLValue): Likewise.
2900 2002-11-14 Martin Baulig <martin@ximian.com>
2902 * class.cs (PropertyBase.CheckBase): Make this work for multiple
2903 indexers. Fixes the first part of bug #33089.
2904 (MethodSignature.InheritableMemberSignatureCompare): Added support
2907 2002-11-13 Ravi Pratap <ravi@ximian.com>
2909 * attribute.cs (Attribute.Resolve): Catch the
2910 NullReferenceException and report it since it isn't supposed to
2913 2002-11-12 Miguel de Icaza <miguel@ximian.com>
2915 * expression.cs (Binary.EmitBranchable): Also handle the cases for
2916 LogicalOr and LogicalAnd that can benefit from recursively
2917 handling EmitBranchable. The code now should be nice for Paolo.
2919 2002-11-08 Miguel de Icaza <miguel@ximian.com>
2921 * typemanager.cs (LookupType): Added a negative-hit hashtable for
2922 the Type lookups, as we perform quite a number of lookups on
2923 non-Types. This can be removed once we can deterministically tell
2924 whether we have a type or a namespace in advance.
2926 But this might require special hacks from our corlib.
2930 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2931 and double which avoids a conversion from an integer to a double.
2933 * expression.cs: tiny optimization, avoid calling IsConstant,
2934 because it effectively performs the lookup twice.
2936 2002-11-06 Miguel de Icaza <miguel@ximian.com>
2938 But a bogus return here to keep the semantics of the old code
2939 until the Mono runtime is fixed.
2941 * pending.cs (GetMissingInterfaces): New method used to remove all
2942 the interfaces that are already implemented by our parent
2943 classes from the list of pending methods.
2945 * interface.cs: Add checks for calls after ResolveTypeExpr.
2947 2002-11-05 Miguel de Icaza <miguel@ximian.com>
2949 * class.cs (Class.Emit): Report warning 67: event not used if the
2950 warning level is beyond 3.
2952 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2953 being a NullLiteral.
2955 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2958 * class.cs (TypeContainer.GetClassBases): Cover a missing code
2959 path that might fail if a type can not be resolved.
2961 * expression.cs (Binary.Emit): Emit unsigned versions of the
2964 * driver.cs: use error 5.
2966 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2968 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2970 2002-11-01 Miguel de Icaza <miguel@ximian.com>
2972 * cs-parser.jay (switch_section): A beautiful patch from Martin
2973 Baulig that fixed 33094.
2975 2002-10-31 Miguel de Icaza <miguel@ximian.com>
2977 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2978 Check whether the base is abstract and report an error if so.
2980 * expression.cs (IndexerAccess.DoResolveLValue,
2981 IndexerAccess.DoResolve): ditto.
2983 (Invocation.DoResolve): ditto.
2985 (Invocation.FullMethodDesc): Improve the report string.
2987 * statement.cs (Block): Eliminate IsVariableDefined as it is
2988 basically just a wrapper for GetVariableInfo.
2990 * ecore.cs (SimpleName): Use new
2992 * support.cs (ReflectionParamter.ParameterType): We unwrap the
2993 type, as we return the actual parameter ref/unref state on a
2996 2002-10-30 Miguel de Icaza <miguel@ximian.com>
2998 * support.cs: Return proper flags REF/OUT fixing the previous
3001 * expression.cs: Reverted last patch, that was wrong. Is_ref is
3002 not used to mean `ref' but `ref or out' in ParameterReference
3004 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3005 full type signature instead of calling TypeManger.CSharpName
3008 * support.cs (InternalParameters.ParameterDesc): Do not compare
3009 directly to the modflags, because REF/OUT will actually be bitsets
3012 * delegate.cs (VerifyMethod): Check also the modifiers.
3014 * cs-tokenizer.cs: Fix bug where floating point values with an
3015 exponent where a sign was missing was ignored.
3017 * driver.cs: Allow multiple assemblies to be specified in a single
3020 2002-10-28 Miguel de Icaza <miguel@ximian.com>
3022 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
3023 because identifiers after a parenthesis would end up in this kind
3024 of production, and we needed to desamiguate it for having casts
3027 (UserDefinedType *) xxx
3029 2002-10-24 Miguel de Icaza <miguel@ximian.com>
3031 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3032 we should set on the Bindingflags.NonPublic, but not turn on
3033 private_ok. private_ok controls whether a Private member is
3034 returned (this is chekced on the filter routine), while the
3035 BindingFlags.NonPublic just controls whether private/protected
3036 will be allowed. This fixes the problem part of the problem of
3037 private properties being allowed to be used in derived classes.
3039 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3040 so we can call the children DoResolveLValue method (this will
3041 properly signal errors on lvalue assignments to base properties)
3043 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3044 getter are null, and we have a property info, we know that this
3045 happened because the lookup failed, so we report an error 122 for
3046 protection level violation.
3048 We also silently return if setter and getter are null in the
3049 resolve functions, this condition only happens if we have flagged
3050 the error before. This is the other half of the problem.
3052 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3053 not have accessibility information, that is why we were returning
3054 true in the filter function in typemanager.cs.
3056 To properly report 122 (property is inaccessible because of its
3057 protection level) correctly, we report this error in ResolveAccess
3058 by failing if both the setter and the getter are lacking (ie, the
3061 DoResolve and DoLResolve have been modified to check for both
3062 setter/getter being null and returning silently, the reason being
3063 that I did not want to put the knowledge about this error in upper
3066 int old = Report.Errors;
3067 x = new PropertyExpr (...);
3068 if (old != Report.Errors)
3073 So the property expr is returned, but it is invalid, so the error
3074 will be flagged during the resolve process.
3076 * class.cs: Remove InheritablePropertySignatureCompare from the
3077 class, as we no longer depend on the property signature to compute
3078 whether it is possible to implement a method or not.
3080 The reason is that calling PropertyInfo.GetGetMethod will return
3081 null (in .NET, in Mono it works, and we should change this), in
3082 cases where the Get Method does not exist in that particular
3087 class X { public virtual int A { get { return 1; } } }
3089 class Z : Y { public override int A { get { return 2; } } }
3091 Would fail in Z because the parent (Y) would not have the property
3092 defined. So we avoid this completely now (because the alternative
3093 fix was ugly and slow), and we now depend exclusively on the
3096 (PropertyBase.CheckBase): Use a method-base mechanism to find our
3097 reference method, instead of using the property.
3099 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3100 routines are gone now.
3102 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3103 names, they were incorrectly named.
3105 * cs-tokenizer.cs: Return are more gentle token on failure.
3107 * pending.cs (PendingImplementation.InterfaceMethod): This routine
3108 had an out-of-sync index variable, which caused it to remove from
3109 the list of pending methods the wrong method sometimes.
3111 2002-10-22 Miguel de Icaza <miguel@ximian.com>
3113 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3114 CanWrite, because those refer to this particular instance of the
3115 property, and do not take into account the fact that we can
3116 override single members of a property.
3118 Constructor requires an EmitContext. The resolution process does
3119 not happen here, but we need to compute the accessors before,
3120 because the resolution does not always happen for properties.
3122 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3123 subclass, before we did not update this flag, but we did update
3126 (GetAccessors): Drop this routine, as it did not work in the
3127 presence of partially overwritten set/get methods.
3129 Notice that this broke the cs1540 detection, but that will require
3132 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3136 * driver.cs: issue a warning instead of an error if we don't support
3137 debugging for the platform. Also ignore a couple of errors that may
3138 arise when trying to write the symbols. Undo my previous patch.
3140 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3142 * driver.cs: ignore /debug switch except for Unix platforms.
3144 2002-10-23 Nick Drochak <ndrochak@gol.com>
3146 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3148 2002-10-21 Miguel de Icaza <miguel@ximian.com>
3150 * driver.cs: Do not make mcs-debug conditional, so we do not break
3153 * statement.cs (UsageVector.MergeChildren): I would like Martin to
3154 review this patch. But basically after all the children variables
3155 have been merged, the value of "Breaks" was not being set to
3156 new_breaks for Switch blocks. I think that it should be set after
3157 it has executed. Currently I set this to the value of new_breaks,
3158 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3159 conservative, but I do not understand this code very well.
3161 I did not break anything in the build, so that is good ;-)
3163 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3165 2002-10-20 Mark Crichton <crichton@gimp.org>
3167 * cfold.cs: Fixed compile blocker. Really fixed it this time.
3169 2002-10-20 Nick Drochak <ndrochak@gol.com>
3171 * cfold.cs: Fixed compile blocker.
3173 2002-10-20 Miguel de Icaza <miguel@ximian.com>
3175 * driver.cs: I was chekcing the key, not the file.
3177 2002-10-19 Ravi Pratap <ravi@ximian.com>
3179 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3180 message that we were generating - we just need to silently return
3183 2002-10-19 Miguel de Icaza <miguel@ximian.com>
3185 * class.cs (Event.Define): Change my previous commit, as this
3186 breaks the debugger. This is a temporary hack, as it seems like
3187 the compiler is generating events incorrectly to begin with.
3189 * expression.cs (Binary.ResolveOperator): Added support for
3190 "U operator - (E x, E y)"
3192 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3195 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3196 init-only variables, but this path did not take into account that
3197 there might be also instance readonly variables. Correct this
3200 This fixes bug 32253
3202 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3205 * driver.cs: Change the extension for modules to `netmodule'
3207 * cs-parser.jay: Improved slightly the location tracking for
3208 the debugger symbols.
3210 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3211 modifiers that were specified instead of the hardcoded value
3212 (FamAndAssem). This was basically ignoring the static modifier,
3213 and others. Fixes 32429.
3215 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3216 fixed a bug in the process (32476)
3218 * expression.cs (ArrayAccess.EmitAssign): Patch from
3219 hwang_rob@yahoo.ca that fixes bug 31834.3
3221 2002-10-18 Miguel de Icaza <miguel@ximian.com>
3223 * driver.cs: Make the module extension .netmodule.
3225 2002-10-16 Miguel de Icaza <miguel@ximian.com>
3227 * driver.cs: Report an error if the resource file is not found
3228 instead of crashing.
3230 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3231 false, like Emit does.
3233 2002-10-16 Nick Drochak <ndrochak@gol.com>
3235 * typemanager.cs: Remove unused private member. Also reported mcs
3236 bug to report this as a warning like csc.
3238 2002-10-15 Martin Baulig <martin@gnome.org>
3240 * statement.cs (Statement.Emit): Made this a virtual method; emits
3241 the line number info and calls DoEmit().
3242 (Statement.DoEmit): New protected abstract method, formerly knows
3243 as Statement.Emit().
3245 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3247 2002-10-11 Miguel de Icaza <miguel@ximian.com>
3249 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3250 have fixed a remaining problem: not every AddXXXX was adding a
3251 fully qualified name.
3253 Now everyone registers a fully qualified name in the DeclSpace as
3254 being defined instead of the partial name.
3256 Downsides: we are slower than we need to be due to the excess
3257 copies and the names being registered this way.
3259 The reason for this is that we currently depend (on the corlib
3260 bootstrap for instance) that types are fully qualified, because
3261 we dump all the types in the namespace, and we should really have
3262 types inserted into the proper namespace, so we can only store the
3263 basenames in the defined_names array.
3265 2002-10-10 Martin Baulig <martin@gnome.org>
3267 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3268 from bug #31834, see the bug report for a testcase which is
3271 2002-10-10 Martin Baulig <martin@gnome.org>
3273 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3274 flow analysis code for this.
3276 * statement.cs (Do, While, For): Tell the flow analysis code about
3278 (FlowBranching.UsageVector): Added support for infinite loops.
3279 (Block.Resolve): Moved the dead code elimination here and use flow
3282 2002-10-09 Miguel de Icaza <miguel@ximian.com>
3284 * class.cs (Field.Define): Catch cycles on struct type
3287 * typemanager.cs (IsUnmanagedtype): Do not recursively check
3288 fields if the fields are static. We only need to check instance
3291 * expression.cs (As.DoResolve): Test for reference type.
3293 * statement.cs (Using.ResolveExpression): Use
3294 ConvertImplicitRequired, not ConvertImplicit which reports an
3296 (Using.ResolveLocalVariableDecls): ditto.
3298 * expression.cs (Binary.ResolveOperator): Report errors in a few
3299 places where we had to.
3301 * typemanager.cs (IsUnmanagedtype): Finish implementation.
3303 2002-10-08 Miguel de Icaza <miguel@ximian.com>
3305 * expression.cs: Use StoreFromPtr instead of extracting the type
3306 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3308 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3309 an enumeration value to a System.Enum, but System.Enum is not a
3310 value type, but an class type, so we need to box.
3312 (Expression.ConvertExplicit): One codepath could return
3313 errors but not flag them. Fix this. Fixes #31853
3315 * parameter.cs (Resolve): Do not allow void as a parameter type.
3317 2002-10-06 Martin Baulig <martin@gnome.org>
3319 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3320 if it's a class type and not a struct. Fixes #31815.
3322 2002-10-06 Martin Baulig <martin@gnome.org>
3324 * statement.cs: Reworked the flow analysis code a bit to make it
3325 usable for dead code elimination.
3327 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3329 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3331 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3333 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3334 to fix the test 165, will investigate deeper.
3336 2002-10-04 Martin Baulig <martin@gnome.org>
3338 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3339 finally blocks actually work.
3340 (Try.Resolve): We don't need to create a sibling for `finally' if
3341 there is no finally block.
3343 2002-10-04 Martin Baulig <martin@gnome.org>
3345 * class.cs (Constructor.Define): The default accessibility for a
3346 non-default constructor is private, not public.
3348 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3350 * class.cs (Constructor): Make AllowedModifiers public, add
3353 * cs-parser.jay: Perform the modifiers test here, as the
3354 constructor for the Constructor class usually receives a zero
3355 because of the way we create it (first we create, later we
3356 customize, and we were never checking the modifiers).
3358 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3359 is a version of LookupTypeReflection that includes the type-name
3360 cache. This can be used as a fast path for functions that know
3361 the fully qualified name and are only calling into *.GetType() to
3362 obtain a composed type.
3364 This is also used by TypeManager.LookupType during its type
3367 (LookupType): We now also track the real type name, as sometimes
3368 we can get a quey for the real type name from things like
3369 ComposedCast. This fixes bug 31422.
3371 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3372 complete type fullname, it does not have to go through the type
3373 resolution system to obtain the composed version of the type (for
3374 obtaining arrays or pointers).
3376 (Conditional.Emit): Use the EmitBoolExpression to
3377 generate nicer code, as requested by Paolo.
3379 (ArrayCreation.CheckIndices): Use the patch from
3380 hwang_rob@yahoo.ca to validate the array initializers.
3382 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3384 * class.cs (ConstructorInitializer.Emit): simplify code by using
3385 Invocation.EmitCall, and at the same time, fix the bugs in calling
3386 parent constructors that took variable arguments.
3388 * ecore.cs (Expression.ConvertNumericExplicit,
3389 Expression.ImplicitNumericConversion): Remove the code that
3390 manually wrapped decimal (InternalTypeConstructor call is now gone
3393 * expression.cs (Cast.TryReduce): Also handle decimal types when
3394 trying to perform a constant fold on the type.
3396 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3398 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3399 that only turned off an error report, and did nothing else.
3401 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3403 * driver.cs: Handle and ignore /fullpaths
3405 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3407 * expression.cs (Binary.ResolveOperator): Catch the case where
3408 DoNumericPromotions returns true,
3410 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3412 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3414 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3417 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3419 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3420 conversion exists, but it is also required that the conversion be
3421 performed. This manifested in "(Type64Enum) 2".
3423 * class.cs (TypeManager.AddMethod): The fix is not to change
3424 AddEnum, because that one was using a fully qualified name (every
3425 DeclSpace derivative does), but to change the AddMethod routine
3426 that was using an un-namespaced name. This now correctly reports
3427 the duplicated name.
3429 Revert patch until I can properly fix it. The issue
3430 is that we have a shared Type space across all namespaces
3431 currently, which is wrong.
3433 Options include making the Namespace a DeclSpace, and merge
3434 current_namespace/current_container in the parser.
3436 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3438 * cs-parser.jay: Improve error reporting when we get a different
3439 kind of expression in local_variable_type and
3440 local_variable_pointer_type.
3442 Propagate this to avoid missleading errors being reported.
3444 * ecore.cs (ImplicitReferenceConversion): treat
3445 TypeManager.value_type as a target just like object_type. As
3450 Is valid, and needs to result in the int 1 being boxed before it
3451 is assigned to the value type v.
3453 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3454 to validate the enumeration name.
3456 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3457 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3458 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3460 * ecore.cs (TryImplicitIntConversion): When doing an
3461 implicit-enumeration-conversion, check if the type is 64-bits and
3462 perform a conversion before passing to EnumConstant.
3464 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3466 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3467 report ambiguous type references. Unlike the MS version, we
3468 report what the ambiguity is. Innovation at work ;-)
3470 (DeclSpace.FindType): Require a location argument to
3471 display when we display an ambiguous error.
3473 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3475 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3477 * expression.cs (EmitDynamicInitializers): Apply patch from
3478 hwang_rob@yahoo.ca that fixes the order in which we emit our
3481 2002-09-21 Martin Baulig <martin@gnome.org>
3483 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3484 delegate takes no arguments.
3486 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3488 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3491 * expression.cs: Extract the underlying type.
3493 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3495 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3497 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3499 * class.cs (TypeContainer.DefineType): We can not use the nice
3500 PackingSize with the size set to 1 DefineType method, because it
3501 will not allow us to define the interfaces that the struct
3504 This completes the fixing of bug 27287
3506 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3507 means also structs. This fixes part of the problem.
3508 (Expresion.ImplicitReferenceConversionExists): ditto.
3510 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3511 error if there were no errors reported during the type lookup
3512 process, to avoid duplicates or redundant errors. Without this
3513 you would get an ambiguous errors plus a type not found. We have
3514 beaten the user enough with the first error.
3516 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3519 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3520 during the resolution process, stop the lookup, this avoids
3521 repeated error reports (same error twice).
3523 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3525 * typemanager.cs (LookupType): Redo the type lookup code to match
3526 the needs of System.Reflection.
3528 The issue is that System.Reflection requires references to nested
3529 types to begin with a "+" sign instead of a dot. So toplevel
3530 types look like: "NameSpace.TopLevelClass", and nested ones look
3531 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3534 2002-09-19 Martin Baulig <martin@gnome.org>
3536 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3537 says that a method always returns or always throws an exception,
3538 don't report the CS0161.
3540 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3541 set `Returns = new_returns'.
3543 2002-09-19 Martin Baulig <martin@gnome.org>
3545 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3546 to an enum constant, check for a CS0176.
3548 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3550 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3551 for operators that must be in pairs and report errors.
3553 * ecore.cs (SimpleName.DoResolveType): During the initial type
3554 resolution process, when we define types recursively, we must
3555 check first for types in our current scope before we perform
3556 lookups in the enclosing scopes.
3558 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3560 (Invocation.VerifyArgumentsCompat): Call
3561 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3562 I thought we were supposed to always call this, but there are a
3563 few places in the code where we dont do it.
3565 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3567 * driver.cs: Add support in -linkres and -resource to specify the
3568 name of the identifier.
3570 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3572 * ecore.cs (StandardConversionExists): Sync with the conversion
3573 code: allow anything-* to void* conversions.
3575 (FindMostSpecificSource): Use an Expression argument
3576 instead of a Type, because we might be handed over a Literal which
3577 gets a few more implicit conversions that plain types do not. So
3578 this information was being lost.
3580 Also, we drop the temporary type-holder expression when not
3583 2002-09-17 Martin Baulig <martin@gnome.org>
3585 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3586 this is an explicit interface implementation.
3588 2002-09-17 Martin Baulig <martin@gnome.org>
3590 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3591 different `IndexerName' attributes.
3593 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3594 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3595 virtual CommonResolve().
3597 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3599 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3600 and convert that to the UnderlyingType.
3602 * statement.cs (Foreach.Resolve): Indexers are just like variables
3603 or PropertyAccesses.
3605 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3606 inside quoted strings, we were not doing this before.
3608 2002-09-16 Martin Baulig <martin@gnome.org>
3610 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3611 resolve it. This is needed for the definite assignment check of the
3612 instance expression, fixes bug #29846.
3613 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3615 2002-09-16 Nick Drochak <ndrochak@gol.com>
3617 * parameter.cs: Fix compile error. Cannot reference static member
3618 from an instance object. Is this an mcs bug?
3620 2002-09-14 Martin Baulig <martin@gnome.org>
3622 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3623 multiple times. Fixes bug #30295, added test-166.cs.
3625 2002-09-14 Martin Baulig <martin@gnome.org>
3627 * statement.cs (Block.Emit): Don't emit unreachable code.
3628 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3630 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3632 2002-09-14 Martin Baulig <martin@gnome.org>
3634 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3637 2002-09-14 Martin Baulig <martin@gnome.org>
3639 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3640 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3641 be false on the ms runtime.
3643 2002-09-13 Martin Baulig <martin@gnome.org>
3645 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3646 the CS0038 error message.
3648 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3650 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3651 constant inside, return it.
3653 2002-09-12 Martin Baulig <martin@gnome.org>
3655 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3656 implicit conversion can be done between enum types.
3658 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3659 check whether an implicit conversion to the current enum's UnderlyingType
3660 exists and report an error if not.
3662 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3663 without debugging support.
3665 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3666 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3668 2002-09-12 Martin Baulig <martin@gnome.org>
3670 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3672 * ecore.cs (IMemberExpr.DeclaringType): New property.
3673 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3674 nonstatic member of an outer type (CS0038).
3676 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3678 * driver.cs: Activate the using-error detector at warning level
3679 4 (at least for MS-compatible APIs).
3681 * namespace.cs (VerifyUsing): Small buglett fix.
3683 * pending.cs (PendingImplementation): pass the container pointer.
3685 * interface.cs (GetMethods): Allow for recursive definition. Long
3686 term, I would like to move every type to support recursive
3687 definitions, not the current ordering mechanism that we have right
3690 The situation is this: Attributes are handled before interfaces,
3691 so we can apply attributes to interfaces. But some attributes
3692 implement interfaces, we will now handle the simple cases
3693 (recursive definitions will just get an error).
3695 * parameter.cs: Only invalidate types at the end if we fail to
3698 2002-09-09 Martin Baulig <martin@gnome.org>
3700 * ecore.cs (PropertyExpr.Emit): Also check for
3701 TypeManager.system_int_array_get_length so this'll also work when
3702 compiling corlib. Fixes #30003.
3704 2002-09-09 Martin Baulig <martin@gnome.org>
3706 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3707 and throw an exception if we can't get the type's size. Fixed #30040,
3710 2002-09-09 Martin Baulig <martin@gnome.org>
3712 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3714 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3715 context. Fixes bug #30027.
3717 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3718 virtual functions. Fixes bug #30043, added test-164.cs.
3720 2002-09-08 Ravi Pratap <ravi@ximian.com>
3722 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3724 2002-09-08 Nick Drochak <ndrochak@gol.com>
3726 * driver.cs: Use an object to get the windows codepage since it's not a
3729 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3731 * statement.cs (For.Emit): for infinite loops (test == null)
3732 return whether there is a break inside, not always "true".
3734 * namespace.cs (UsingEntry): New struct to hold the name of the
3735 using definition, the location where it is defined, and whether it
3736 has been used in a successful type lookup.
3738 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3743 2002-09-06 Ravi Pratap <ravi@ximian.com>
3745 * attribute.cs : Fix incorrect code which relied on catching
3746 a NullReferenceException to detect a null being passed in
3747 where an object was expected.
3749 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3751 * statement.cs (Try): flag the catch variable as assigned
3753 * expression.cs (Cast): Simplified by using ResolveType instead of
3756 * statement.cs (Catch): Fix bug by using ResolveType.
3758 2002-09-06 Ravi Pratap <ravi@ximian.com>
3760 * expression.cs (BetterConversion): Special case for when we have
3761 a NullLiteral as the argument and we have to choose between string
3762 and object types - we choose string the way csc does.
3764 * attribute.cs (Attribute.Resolve): Catch the
3765 NullReferenceException and report error #182 since the Mono
3766 runtime no more has the bug and having this exception raised means
3767 we tried to select a constructor which takes an object and is
3770 2002-09-05 Ravi Pratap <ravi@ximian.com>
3772 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3773 message (1502, 1503) when we can't locate a method after overload
3774 resolution. This is much more informative and closes the bug
3777 * interface.cs (PopulateMethod): Return if there are no argument
3778 types. Fixes a NullReferenceException bug.
3780 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3781 expressions too. Previously we were checking only in one place for
3782 positional arguments leaving out named arguments.
3784 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3785 type to the enum type is not allowed. Remove code corresponding to
3788 (ConvertNumericExplicit): Allow explicit conversions from
3789 the underlying type to enum type. This precisely follows the spec
3790 and closes a bug filed by Gonzalo.
3792 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3795 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3797 2002-09-03 Miguel de Icaza <miguel@ximian.com>
3799 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3800 it was important that we stored the right value after the
3801 reduction in `converted'.
3803 2002-09-04 Martin Baulig <martin@gnome.org>
3805 * location.cs (Location.SymbolDocument): Use full pathnames for the
3808 2002-08-30 Miguel de Icaza <miguel@ximian.com>
3810 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3811 of the expression resolve mechanism, because that will catch the
3812 SimpleName error failures.
3814 (Conditional): If we can not resolve the
3815 expression, return, do not crash.
3817 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3820 (location): display token name instead of its number.
3822 2002-08-28 Martin Baulig <martin@gnome.org>
3824 * expression.cs (Binary.ResolveOperator): Don't silently return
3825 but return an error if an operator cannot be applied between two
3828 2002-08-28 Martin Baulig <martin@gnome.org>
3830 * class.cs (Constructor.Define): Set the permission attributes
3831 correctly instead of making all constructors public.
3833 2002-08-28 Martin Baulig <martin@gnome.org>
3835 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3836 for private members before reporting a CS0103; if we find anything,
3839 2002-08-28 Martin Baulig <martin@gnome.org>
3841 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3842 to check whether `closure_start_type == closure_invocation_type',
3843 we also need to check whether `m.DeclaringType == closure_invocation_type'
3844 before bypassing the permission checks. We might be accessing
3845 protected/private members from the base class.
3846 (TypeManager.RealMemberLookup): Only set private_ok if private
3847 members were requested via BindingFlags.NonPublic.
3849 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3851 * expression.cs (MemberAccess.ResolveMemberAccess): Set
3852 MethodGroupExpr.IsExplicitImpl if appropriate.
3853 (Invocation.DoResolve): Don't report the CS0120 for explicit
3854 interface implementations.
3856 2002-08-27 Martin Baulig <martin@gnome.org>
3858 * expression.cs (Invocation.DoResolve): If this is a static
3859 method and we don't have an InstanceExpression, we must report
3862 2002-08-25 Martin Baulig <martin@gnome.org>
3864 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3865 `==' between a valuetype and an object.
3867 2002-08-25 Miguel de Icaza <miguel@ximian.com>
3869 * ecore.cs (TypeExpr): Provide a ToString method.
3871 2002-08-24 Martin Baulig <martin@gnome.org>
3873 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3874 now called proggie.dbg and it's a binary file.
3876 2002-08-23 Martin Baulig <martin@gnome.org>
3878 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3880 2002-08-23 Martin Baulig <martin@gnome.org>
3882 * struct.cs (MyStructInfo.ctor): Make this work with empty
3883 structs; it's not allowed to use foreach() on null.
3885 2002-08-23 Martin Baulig <martin@gnome.org>
3887 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3888 writer the full pathname of the generated assembly.
3890 2002-08-23 Martin Baulig <martin@gnome.org>
3892 * statements.cs (FlowBranching.UsageVector.MergeChildren):
3893 A `finally' block never returns or breaks; improved handling of
3896 2002-08-23 Martin Baulig <martin@gnome.org>
3898 * statement.cs (Throw.Resolve): Allow `throw null'.
3900 2002-08-23 Martin Baulig <martin@gnome.org>
3902 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3903 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3904 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
3905 MemberLookup would return a wrong event if this is an explicit
3906 interface implementation and the class has an event with the same
3909 2002-08-23 Martin Baulig <martin@gnome.org>
3911 * statement.cs (Block.AddChildVariableNames): New public method.
3912 (Block.AddChildVariableName): Likewise.
3913 (Block.IsVariableNameUsedInChildBlock): Likewise.
3914 (Block.AddVariable): Check whether a variable name has already
3915 been used in a child block.
3917 * cs-parser.jay (declare_local_variables): Mark all variable names
3918 from the current block as being used in a child block in the
3921 2002-08-23 Martin Baulig <martin@gnome.org>
3923 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3924 find the symbol writer.
3926 * driver.cs: csc also allows the arguments to /define being
3927 separated by commas, not only by semicolons.
3929 2002-08-23 Martin Baulig <martin@gnome.org>
3931 * interface.cs (Interface.GetMembers): Added static check for events.
3933 2002-08-15 Martin Baulig <martin@gnome.org>
3935 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3936 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3938 * ecore.cs (Expression.MemberLookup): Added documentation and explained
3939 why the MethodData.EmitDestructor() change was necessary.
3941 2002-08-20 Martin Baulig <martin@gnome.org>
3943 * class.cs (TypeContainer.FindMembers): Added static check for events.
3945 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3947 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3948 use Type.GetEvents(), not Type.FindMembers().
3950 2002-08-20 Martin Baulig <martin@gnome.org>
3952 * decl.cs (MemberCache): Added a special method cache which will
3953 be used for method-only searched. This ensures that a method
3954 search will return a MethodInfo with the correct ReflectedType for
3957 2002-08-20 Martin Baulig <martin@gnome.org>
3959 * decl.cs (DeclSpace.FindMembers): Made this public.
3961 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3963 * delegate.cs: fixed build on windows.
3964 [FIXME: Filed as bug #29150: MCS must report these errors.]
3966 2002-08-19 Ravi Pratap <ravi@ximian.com>
3968 * ecore.cs (StandardConversionExists): Return a false
3969 if we are trying to convert the void type to anything else
3970 since that is not allowed.
3972 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3973 we flag error 70 in the event an event is trying to be accessed
3974 directly from outside the declaring type.
3976 2002-08-20 Martin Baulig <martin@gnome.org>
3978 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3979 MemberCache from typemanager.cs to decl.cs.
3981 2002-08-19 Martin Baulig <martin@gnome.org>
3983 * class.cs (TypeContainer): Implement IMemberContainer.
3984 (TypeContainer.DefineMembers): Create the MemberCache.
3985 (TypeContainer.FindMembers): Do better BindingFlags checking; only
3986 return public members if BindingFlags.Public was given, check
3987 whether members are static.
3989 2002-08-16 Martin Baulig <martin@gnome.org>
3991 * decl.cs (DeclSpace.Define): Splitted this in Define and
3992 DefineMembers. DefineMembers is called first and initializes the
3995 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
3996 DefineMembers() on all our DeclSpaces.
3998 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3999 but call DefineMembers() on all nested interfaces. We call their
4000 Define() in our new Define() function.
4002 * interface.cs (Interface): Implement IMemberContainer.
4003 (Interface.Define): Moved all code except the attribute stuf to
4005 (Interface.DefineMembers): Initialize the member cache.
4007 * typemanager.cs (IMemberFinder): Removed this interface, we don't
4008 need this anymore since we can use MemberCache.FindMembers directly.
4010 2002-08-19 Martin Baulig <martin@gnome.org>
4012 * typemanager.cs (MemberCache): When creating the cache for an
4013 interface type, add all inherited members.
4014 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4015 to `out bool used_cache' and documented it.
4016 (TypeManager.MemberLookup): If we already used the cache in the first
4017 iteration, we don't need to do the interfaces check.
4019 2002-08-19 Martin Baulig <martin@gnome.org>
4021 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
4022 here from IMemberFinder and don't implement this interface anymore.
4023 (DeclSpace.MemberCache): Moved here from IMemberFinder.
4025 * typemanager.cs (IMemberFinder): This interface is now only used by
4026 classes which actually support the member cache.
4027 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4028 since we only put DeclSpaces into this Hashtable.
4029 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4030 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4032 2002-08-16 Martin Baulig <martin@gnome.org>
4034 * typemanager.cs (ICachingMemberFinder): Removed.
4035 (IMemberFinder.MemberCache): New property.
4036 (TypeManager.FindMembers): Merged this with RealFindMembers().
4037 This function will never be called from TypeManager.MemberLookup()
4038 so we can't use the cache here, just the IMemberFinder.
4039 (TypeManager.MemberLookup_FindMembers): Check whether the
4040 IMemberFinder has a MemberCache and call the cache's FindMembers
4042 (MemberCache): Rewrote larger parts of this yet another time and
4043 cleaned it up a bit.
4045 2002-08-15 Miguel de Icaza <miguel@ximian.com>
4047 * driver.cs (LoadArgs): Support quoting.
4049 (Usage): Show the CSC-like command line arguments.
4051 Improved a few error messages.
4053 2002-08-15 Martin Baulig <martin@gnome.org>
4055 * typemanager.cs (IMemberContainer.Type): New property.
4056 (IMemberContainer.IsInterface): New property.
4058 The following changes are conditional to BROKEN_RUNTIME, which is
4059 defined at the top of the file.
4061 * typemanager.cs (MemberCache.MemberCache): Don't add the base
4062 class'es members, but add all members from TypeHandle.ObjectType
4063 if we're an interface.
4064 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4065 is the current type.
4066 (MemberCache.CacheEntry.Container): Removed this field.
4067 (TypeHandle.GetMembers): Include inherited members.
4069 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4071 * typemanager.cs: fixed compilation and added a comment on a field that
4074 2002-08-15 Martin Baulig <martin@gnome.org>
4076 * class.cs (ConstructorInitializer.Resolve): In the
4077 Expression.MemberLookup call, use the queried_type as
4080 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4081 declared' attribute, it's always true.
4082 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4083 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4084 temporary wrapper for FindMembers which tells MemberLookup whether
4085 members from the base classes are included in the return value.
4086 This will go away soon.
4087 (TypeManager.MemberLookup): Use this temporary hack here; once the
4088 new MemberCache is completed, we don't need to do the DeclaredOnly
4089 looping here anymore since the MemberCache will take care of this.
4090 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4091 (MemberCache): When creating the MemberCache for a class, get
4092 members from the current class and all its base classes.
4093 (MemberCache.CacheEntry.Container): New field. This is a
4094 temporary hack until the Mono runtime is fixed to distinguish
4095 between ReflectedType and DeclaringType. It allows us to use MCS
4096 with both the MS runtime and the unfixed Mono runtime without
4097 problems and without accecting performance.
4098 (MemberCache.SearchMembers): The DeclaredOnly looping from
4099 TypeManager.MemberLookup is now done here.
4101 2002-08-14 Martin Baulig <martin@gnome.org>
4103 * statement.cs (MyStructInfo.MyStructInfo): Don't call
4104 Type.GetFields on dynamic types but get the fields from the
4105 corresponding TypeContainer.
4106 (MyStructInfo.GetStructInfo): Added check for enum types.
4108 * typemanager.cs (MemberList.IsSynchronized): Implemented.
4109 (MemberList.SyncRoot): Implemented.
4110 (TypeManager.FilterWithClosure): No need to check permissions if
4111 closure_start_type == closure_invocation_type, don't crash if
4112 closure_invocation_type is null.
4114 2002-08-13 Martin Baulig <martin@gnome.org>
4116 Rewrote TypeContainer.FindMembers to use a member cache. This
4117 gives us a speed increase of about 35% for the self-hosting MCS
4118 build and of about 15-20% for the class libs (both on GNU/Linux).
4120 * report.cs (Timer): New class to get enhanced profiling. This
4121 whole class is "TIMER" conditional since it remarkably slows down
4124 * class.cs (MemberList): New class. This is an IList wrapper
4125 which we're now using instead of passing MemberInfo[]'s around to
4126 avoid copying this array unnecessarily.
4127 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4128 (ICachingMemberFinder, IMemberContainer): New interface.
4129 (TypeManager.FilterWithClosure): If `criteria' is null, the name
4130 has already been checked, otherwise use it for the name comparision.
4131 (TypeManager.FindMembers): Renamed to RealMemberFinder and
4132 provided wrapper which tries to use ICachingMemberFinder.FindMembers
4133 if possible. Returns a MemberList, not a MemberInfo [].
4134 (TypeHandle): New class, implements IMemberContainer. We create
4135 one instance of this class per type, it contains a MemberCache
4136 which is used to do the member lookups.
4137 (MemberCache): New class. Each instance of this class contains
4138 all members of a type and a name-based hash table.
4139 (MemberCache.FindMembers): This is our new member lookup
4140 function. First, it looks up all members of the requested name in
4141 the hash table. Then, it walks this list and sorts out all
4142 applicable members and returns them.
4144 2002-08-13 Martin Baulig <martin@gnome.org>
4146 In addition to a nice code cleanup, this gives us a performance
4147 increase of about 1.4% on GNU/Linux - not much, but it's already
4148 half a second for the self-hosting MCS compilation.
4150 * typemanager.cs (IMemberFinder): New interface. It is used by
4151 TypeManager.FindMembers to call FindMembers on a TypeContainer,
4152 Enum, Delegate or Interface.
4153 (TypeManager.finder_to_member_finder): New PtrHashtable.
4154 (TypeManager.finder_to_container): Removed.
4155 (TypeManager.finder_to_delegate): Removed.
4156 (TypeManager.finder_to_interface): Removed.
4157 (TypeManager.finder_to_enum): Removed.
4159 * interface.cs (Interface): Implement IMemberFinder.
4161 * delegate.cs (Delegate): Implement IMemberFinder.
4163 * enum.cs (Enum): Implement IMemberFinder.
4165 * class.cs (TypeContainer): Implement IMemberFinder.
4167 2002-08-12 Martin Baulig <martin@gnome.org>
4169 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4171 2002-08-12 Martin Baulig <martin@gnome.org>
4173 * ecore.cs (ITypeExpression): New interface for expressions which
4175 (TypeExpression): Renamed to TypeLookupExpression.
4176 (Expression.DoResolve): If we're doing a types-only lookup, the
4177 expression must implement the ITypeExpression interface and we
4178 call DoResolveType() on it.
4179 (SimpleName): Implement the new ITypeExpression interface.
4180 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4181 hack, the situation that we're only looking up types can't happen
4182 anymore when this method is called. Moved the type lookup code to
4183 DoResolveType() and call it.
4184 (SimpleName.DoResolveType): This ITypeExpression interface method
4185 is now doing the types-only lookup.
4186 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4187 (ResolveFlags): Added MaskExprClass.
4189 * expression.cs (MemberAccess): Implement the ITypeExpression
4191 (MemberAccess.DoResolve): Added support for a types-only lookup
4192 when we're called via ITypeExpression.DoResolveType().
4193 (ComposedCast): Implement the ITypeExpression interface.
4195 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
4196 Expression.Resolve() with ResolveFlags.Type instead.
4198 2002-08-12 Martin Baulig <martin@gnome.org>
4200 * interface.cs (Interface.Define): Apply attributes.
4202 * attribute.cs (Attribute.ApplyAttributes): Added support for
4203 interface attributes.
4205 2002-08-11 Martin Baulig <martin@gnome.org>
4207 * statement.cs (Block.Emit): Only check the "this" variable if we
4208 do not always throw an exception.
4210 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4211 whether the property has a set accessor.
4213 2002-08-11 Martin Baulig <martin@gnome.org>
4215 Added control flow analysis support for structs.
4217 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4218 with control flow analysis turned off.
4219 (IVariable): New interface.
4220 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4221 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4222 (FieldExpr.DoResolve): Resolve the instance expression with flow
4223 analysis turned off and do the definite assignment check after the
4224 resolving when we know what the expression will resolve to.
4226 * expression.cs (LocalVariableReference, ParameterReference):
4227 Implement the new IVariable interface, only call the flow analysis
4228 code if ec.DoFlowAnalysis is true.
4229 (This): Added constructor which takes a Block argument. Implement
4230 the new IVariable interface.
4231 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4232 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4233 This does the definite assignment checks for struct members.
4235 * class.cs (Constructor.Emit): If this is a non-static `struct'
4236 constructor which doesn't have any initializer, call
4237 Block.AddThisVariable() to tell the flow analysis code that all
4238 struct elements must be initialized before control returns from
4241 * statement.cs (MyStructInfo): New public class.
4242 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4243 argument to this indexer. If non-zero, check an individual struct
4244 member, not the whole struct.
4245 (FlowBranching.CheckOutParameters): Check struct members.
4246 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4247 overloaded versions of these methods which take an additional
4248 `int field_idx' argument to check struct members.
4249 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4250 overloaded versions of these methods which take an additional
4251 `string field_name' argument to check struct member.s
4252 (VariableInfo): Implement the IVariable interface.
4253 (VariableInfo.StructInfo): New public property. Returns the
4254 MyStructInfo instance of the variable if it's a struct or null.
4255 (Block.AddThisVariable): New public method. This is called from
4256 Constructor.Emit() for non-static `struct' constructor which do
4257 not have any initializer. It creates a special variable for the
4258 "this" instance variable which will be checked by the flow
4259 analysis code to ensure that all of the struct's fields are
4260 initialized before control returns from the constructor.
4261 (UsageVector): Added support for struct members. If a
4262 variable/parameter is a struct with N members, we reserve a slot
4263 in the usage vector for each member. A struct is considered fully
4264 initialized if either the struct itself (slot 0) or all its
4265 members are initialized.
4267 2002-08-08 Martin Baulig <martin@gnome.org>
4269 * driver.cs (Driver.MainDriver): Only report an error CS5001
4270 if there were no compilation errors.
4272 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4273 `UnsafeContext' property to determine whether the parent is in
4274 unsafe context rather than checking the parent's ModFlags:
4275 classes nested in an unsafe class are unsafe as well.
4277 2002-08-08 Martin Baulig <martin@gnome.org>
4279 * statement.cs (UsageVector.MergeChildren): Distinguish between
4280 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4281 we return. Added test17() and test18() to test-154.cs.
4283 2002-08-08 Martin Baulig <martin@gnome.org>
4285 * typemanager.cs (TypeManager.FilterWithClosure): If we have
4286 Family access, make sure the invoking type isn't a subclass of the
4287 queried type (that'd be a CS1540).
4289 * ecore.cs (Expression.MemberLookup): Added overloaded version of
4290 this method which takes an additional `Type invocation_type'.
4292 * expression.cs (BaseAccess.DoResolve): Use the base type as
4293 invocation and query type.
4294 (MemberAccess.DoResolve): If the lookup failed and we're about to
4295 report a CS0122, try a lookup with the ec.ContainerType - if this
4296 succeeds, we must report a CS1540.
4298 2002-08-08 Martin Baulig <martin@gnome.org>
4300 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4301 (MethodGroupExpr): Implement the IMemberExpr interface.
4303 * expression (MemberAccess.ResolveMemberAccess): No need to have
4304 any special code for MethodGroupExprs anymore, they're now
4307 2002-08-08 Martin Baulig <martin@gnome.org>
4309 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4310 Family, FamANDAssem and FamORAssem permissions.
4311 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4313 2002-08-08 Martin Baulig <martin@gnome.org>
4315 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4316 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4319 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4321 * driver.cs: implemented /resource option to embed managed resources.
4323 2002-08-07 Martin Baulig <martin@gnome.org>
4325 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4326 (FieldBase.HasFieldInitializer): New public property.
4327 (FieldBase.GetInitializerExpression): New public method. Resolves and
4328 returns the field initializer and makes sure it is only resolved once.
4329 (TypeContainer.EmitFieldInitializers): Call
4330 FieldBase.GetInitializerExpression to get the initializer, this ensures
4331 that it isn't resolved multiple times.
4333 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4334 the resolving process (SimpleName/MemberLookup) that we're currently
4335 emitting a field initializer (which must not access any instance members,
4336 this is an error CS0236).
4338 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4339 argument, if the `IsFieldInitializer' flag is set, we must report and
4340 error CS0236 and not an error CS0120.
4342 2002-08-07 Martin Baulig <martin@gnome.org>
4344 * ecore.cs (IMemberExpr): New public interface.
4345 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4346 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4347 if the expression is an IMemberExpr.
4349 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4350 to be null, implicitly default to `this' if we're non-static in
4351 this case. Simplified the code a lot by using the new IMemberExpr
4352 interface. Also fixed bug #28176 here.
4354 2002-08-06 Martin Baulig <martin@gnome.org>
4356 * cs-parser.jay (SimpleLookup): Removed. We need to create
4357 ParameterReferences during semantic analysis so that we can do a
4358 type-only search when resolving Cast, TypeOf and SizeOf.
4359 (block): Pass the `current_local_parameters' to the Block's
4362 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4363 argument to the constructor.
4364 (ConstructorInitializer.Resolve): Create a temporary implicit
4365 block with the parameters.
4367 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4368 references here if we aren't doing a type-only search.
4370 * statement.cs (Block): Added constructor which takes a
4371 `Parameters parameters' argument.
4372 (Block.Parameters): New public property.
4374 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4375 to `Parameters' and made it public readonly.
4377 2002-08-06 Martin Baulig <martin@gnome.org>
4379 * ecore.cs (Expression.Warning): Made this public as well.
4381 * report.cs (Report.Debug): Print the contents of collections.
4383 2002-08-06 Martin Baulig <martin@gnome.org>
4385 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4386 used to tell Resolve() which kinds of expressions it may return.
4387 (Expression.Resolve): Added overloaded version of this method which
4388 takes a `ResolveFlags flags' argument. This can be used to tell
4389 Resolve() which kinds of expressions it may return. Reports a
4391 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4392 ResolveFlags.SimpleName.
4393 (Expression.Error118): Added overloaded version of this method which
4394 takes a `ResolveFlags flags' argument. It uses the flags to determine
4395 which kinds of expressions are allowed.
4397 * expression.cs (Argument.ResolveMethodGroup): New public method.
4398 Resolves an argument, but allows a MethodGroup to be returned.
4399 This is used when invoking a delegate.
4401 * TODO: Updated a bit.
4403 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4405 Fixed compilation with csc.
4407 * ecore.cs: Expression.Error made public. Is this correct? Should
4408 Warning be made public too?
4410 * expression.cs: use ea.Location instead of ea.loc.
4411 [FIXME: Filed as bug #28607: MCS must report these errors.]
4413 2002-08-06 Martin Baulig <martin@gnome.org>
4415 * ecore.cs (Expression.loc): Moved the location here instead of
4416 duplicating it in all derived classes.
4417 (Expression.Location): New public property.
4418 (Expression.Error, Expression.Warning): Made them non-static and
4419 removed the location argument.
4420 (Expression.Warning): Added overloaded version which takes an
4421 `int level' argument.
4422 (Expression.Error118): Make this non-static and removed the
4423 expression and location arguments.
4424 (TypeExpr): Added location argument to the constructor.
4426 * expression.cs (StaticCallExpr): Added location argument to
4428 (Indirection, PointerArithmetic): Likewise.
4429 (CheckedExpr, UnCheckedExpr): Likewise.
4430 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4431 (StringPtr): Likewise.
4434 2002-08-05 Martin Baulig <martin@gnome.org>
4436 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4438 * assign.cs (Assign.DoResolve): Check whether the source
4439 expression is a value or variable.
4441 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4442 while resolving the corresponding blocks.
4444 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4445 an error, don't silently return null.
4447 * statement.cs (Block.AddVariable): Do the error reporting here
4448 and distinguish between CS0128 and CS0136.
4449 (Block.DoResolve): Report all unused labels (warning CS0164).
4450 (LabeledStatement): Pass the location to the constructor.
4451 (LabeledStatement.HasBeenReferenced): New property.
4452 (LabeledStatement.Resolve): Set it to true here.
4454 * statement.cs (Return.Emit): Return success even after reporting
4455 a type mismatch error (CS0126 or CS0127), this is what csc does and
4456 it avoids confusing the users with any consecutive errors.
4458 2002-08-05 Martin Baulig <martin@gnome.org>
4460 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4462 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4464 * expression.cs (MemberAccess.DoResolve): Silently return if an
4465 error has already been reported.
4467 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4468 error has already been reported.
4470 2002-08-05 Martin Baulig <martin@gnome.org>
4472 * statement.cs (UsageVector): Only initialize the `parameters'
4473 vector if we actually have any "out" parameters.
4475 2002-08-05 Martin Baulig <martin@gnome.org>
4477 * expression.cs (Binary.ResolveOperator): When combining delegates,
4478 they must have the same type.
4480 2002-08-05 Martin Baulig <martin@gnome.org>
4482 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4483 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4484 work with the ms runtime and we also don't need it: if we're a
4485 PropertyBuilder and not in the `indexer_arguments' hash, then we
4486 are a property and not an indexer.
4488 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4489 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4490 since the latter one doesn't work with the ms runtime.
4492 2002-08-03 Martin Baulig <martin@gnome.org>
4494 Fixed bugs #27998 and #22735.
4496 * class.cs (Method.IsOperator): New public field.
4497 (Method.CheckBase): Report CS0111 if there's already a method
4498 with the same parameters in the current class. Report CS0508 when
4499 attempting to change the return type of an inherited method.
4500 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4501 and it's not marked abstract or extern.
4502 (PropertyBase): New abstract base class for Property and Indexer.
4503 (PropertyBase.CheckBase): Moved here from Property and made it work
4505 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4506 the same so we can reuse it there.
4507 (Property, Indexer): Derive from PropertyBase.
4508 (MethodSignature.inheritable_property_signature_filter): New delegate
4509 to find properties and indexers.
4511 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4512 argument and improved error reporting.
4514 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4515 EmptyReadOnlyParameters and made it a property.
4517 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4518 version of this method which takes a `PropertyInfo indexer'.
4519 (TypeManager.RegisterIndexer): New method.
4521 * class.cs: Added myself as author of this file :-)
4523 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4525 * class.cs: fixed compilation on windoze.
4527 2002-08-03 Martin Baulig <martin@gnome.org>
4529 * interface.cs (Interface.GetInterfaceBases): Check whether all
4530 base interfaces are at least as accessible than the current one.
4532 * class.cs (TypeContainer.GetClassBases): Check whether base types
4533 are at least as accessible than the current type.
4534 (TypeContainer.AsAccessible): Implemented and made non-static.
4535 (MemberBase.CheckParameters): Report errors if the accessibility
4538 * delegate.cs (Delegate.Delegate): The default visibility is
4539 internal for top-level types and private for nested types.
4540 (Delegate.Define): Report errors if the accessibility checks fail.
4542 * enum.cs (Enum.Enum): The default visibility is internal for
4543 top-level types and private for nested types.
4544 (Enum.DefineType): Compute the correct visibility.
4546 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4547 function which takes a `bool is_toplevel' instead of a TypeContainer.
4549 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4552 2002-08-02 Martin Baulig <martin@gnome.org>
4554 * expression.cs (LocalVariableReferenc): Added constructor which
4555 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4556 (LocalVariableReference.IsReadOnly): New property.
4557 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4558 variable is readonly, use our own readonly flag to do this; you can
4559 use the new constructor to get a writable reference to a read-only
4562 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4563 reference to the local variable.
4565 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4567 * rootcontext.cs (ResolveCore): Also include System.Exception
4569 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4570 we reach an EmptyStatement.
4572 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4575 * expression.cs (Binary.ResolveOperator): Check error result in
4578 use brtrue/brfalse directly and avoid compares to null.
4580 2002-08-02 Martin Baulig <martin@gnome.org>
4582 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4583 Fixes bug #28407, added test-155.cs.
4585 2002-08-01 Martin Baulig <martin@gnome.org>
4587 * class.cs (Event.EmitDefaultMethod): Make this work with static
4588 events. Fixes #28311, added verify-3.cs.
4590 2002-08-01 Martin Baulig <martin@gnome.org>
4592 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4593 `is_disposable' fields.
4594 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4595 `hm.is_disposable' if we're using the collection pattern.
4596 (Foreach.EmitCollectionForeach): Use the correct type for the
4597 enumerator's local variable, only emit the try/finally block if
4598 necessary (fixes #27713).
4600 2002-08-01 Martin Baulig <martin@gnome.org>
4602 * ecore.cs (Expression.report118): Renamed to Error118 and made
4605 * statement.cs (Throw.Resolve): Check whether the expression is of
4606 the correct type (CS0118) and whether the type derives from
4607 System.Exception (CS0155).
4608 (Catch.Resolve): New method. Do the type lookup here and check
4609 whether it derives from System.Exception (CS0155).
4610 (Catch.CatchType, Catch.IsGeneral): New public properties.
4612 * typemanager.cs (TypeManager.exception_type): Added.
4614 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4616 * driver.cs: Updated About function.
4618 2002-07-31 Martin Baulig <martin@gnome.org>
4620 Implemented Control Flow Analysis.
4622 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4623 (EmitContext.CurrentBranching): Added.
4624 (EmitContext.StartFlowBranching): Added.
4625 (EmitContext.EndFlowBranching): Added.
4626 (EmitContext.KillFlowBranching): Added.
4627 (EmitContext.IsVariableAssigned): Added.
4628 (EmitContext.SetVariableAssigned): Added.
4629 (EmitContext.IsParameterAssigned): Added.
4630 (EmitContext.SetParameterAssigned): Added.
4631 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4632 Added control flow analysis stuff here.
4634 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4635 resolve the expression as lvalue.
4636 (LocalVariableReference.DoResolve): Check whether the variable has
4637 already been assigned.
4638 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4639 the parameter as assigned here.
4640 (ParameterReference.DoResolve): Check whether the parameter has already
4642 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4643 expression as lvalue.
4645 * statement.cs (FlowBranching): New class for the flow analysis code.
4646 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4647 (LabeledStatement.IsDefined): New public property.
4648 (LabeledStatement.AddUsageVector): New public method to tell flow
4649 analyis that the label may be reached via a forward jump.
4650 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4652 (VariableInfo.Number): New public field. This is used by flow analysis
4653 to number all locals of a block.
4654 (Block.CountVariables): New public property. This is the number of
4655 local variables in this block (including the locals from all parent
4657 (Block.EmitMeta): Number all the variables.
4659 * statement.cs: Added flow analysis support to all classes.
4661 2002-07-31 Martin Baulig <martin@gnome.org>
4663 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4664 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4665 then use this argument.
4667 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4669 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4670 use this to specify /define options.
4672 2002-07-29 Martin Baulig <martin@gnome.org>
4674 * statement.cs (Fixed): Moved all code that does variable lookups
4675 and resolvings from Emit to Resolve.
4677 * statement.cs (For): Moved all code that does variable lookups
4678 and resolvings from Emit to Resolve.
4680 * statement.cs (Using): Moved all code that does variable lookups
4681 and resolvings from Emit to Resolve.
4683 2002-07-29 Martin Baulig <martin@gnome.org>
4685 * attribute.cs (Attribute.Resolve): Explicitly catch a
4686 System.NullReferenceException when creating the
4687 CustromAttributeBuilder and report a different warning message.
4689 2002-07-29 Martin Baulig <martin@gnome.org>
4691 * support.cs (ParameterData.ParameterName): Added method to
4692 get the name of a parameter.
4694 * typemanager.cs (TypeManager.IsValueType): New public method.
4696 2002-07-29 Martin Baulig <martin@gnome.org>
4698 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4699 is a flag which specifies that it's either ref or out.
4700 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4701 the out parameter to `out Parameter.Modifier mod', also set the
4702 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4704 * support.cs (InternalParameters.ParameterModifier): Distinguish
4705 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4706 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4708 * expression.cs (Argument.GetParameterModifier): Distinguish
4709 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4710 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4712 2002-07-29 Martin Baulig <martin@gnome.org>
4714 * expression.cs (ParameterReference.ParameterReference): Added
4715 `Location loc' argument to the constructor.
4717 * cs-parser.jay: Pass location to ParameterReference.
4719 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4721 * statement.cs (Try): Initialize the location.
4723 * cs-parser.jay: pass location to Try.
4725 * expression.cs (Unary.Reduce): Change the prototype to return
4726 whether a constant fold could be performed or not. The result is
4727 returned in an out parameters. In the case of Indirection and
4728 AddressOf, we want to perform the full tests.
4730 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4732 * statement.cs (Statement.Emit): Flag dead code.
4734 2002-07-27 Andrew Birkett <andy@nobugs.org>
4736 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4738 2002-07-27 Martin Baulig <martin@gnome.org>
4740 * class.cs (MethodData.Define): Put back call to
4741 TypeManager.AddMethod(), accidentally commented this out.
4743 * report.cs (Debug): New public method to print debugging information,
4744 this is `[Conditional ("DEBUG")]'.
4746 2002-07-26 Martin Baulig <martin@gnome.org>
4748 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4749 (switch_statement): Push the current_block to the switch_stack and
4750 pop it again when we're done with the switch.
4751 (switch_section): The new block is a child of the current_block.
4752 Fixes bug #24007, added test-152.cs.
4754 2002-07-27 Martin Baulig <martin@gnome.org>
4756 * expression.cs (Invocation.EmitArguments): When calling a varargs
4757 function with only its fixed arguments, we need to pass an empty
4760 2002-07-27 Martin Baulig <martin@gnome.org>
4762 Mono 0.13 has been released.
4764 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4766 * driver.cs: Rename --resource to --linkres, because that is what
4767 we do currently, we dont support --resource yet.
4769 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4771 2002-07-25 Martin Baulig <martin@gnome.org>
4773 * class.cs (MethodData): New public class. This is a `method builder'
4774 class for a method or one accessor of a Property/Indexer/Event.
4775 (MethodData.GetMethodFlags): Moved here from MemberBase.
4776 (MethodData.ApplyAttributes): Likewise.
4777 (MethodData.ApplyObsoleteAttribute): Likewise.
4778 (MethodData.ApplyConditionalAttribute): Likewise.
4779 (MethodData.ApplyDllImportAttribute): Likewise.
4780 (MethodData.CheckAbstractAndExternal): Likewise.
4781 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4782 (MethodData.Emit): Formerly known as Method.Emit().
4783 (MemberBase): Moved everything which was specific to a single
4784 accessor/method to MethodData.
4785 (Method): Create a new MethodData and call Define() and Emit() on it.
4786 (Property, Indexer, Event): Create a new MethodData objects for each
4787 accessor and call Define() and Emit() on them.
4789 2002-07-25 Martin Baulig <martin@gnome.org>
4791 Made MethodCore derive from MemberBase to reuse the code from there.
4792 MemberBase now also checks for attributes.
4794 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4795 (MemberBase.GetMethodFlags): Moved here from class Method and marked
4797 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4798 `CallingConventions cc' and `Attributes opt_attrs' arguments.
4799 (MemberBase.ApplyAttributes): New virtual method; applies the
4800 attributes to a method or accessor.
4801 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4802 (MemberBase.ApplyConditionalAttribute): Likewise.
4803 (MemberBase.ApplyDllImportAttribute): Likewise.
4804 (MemberBase.CheckAbstractAndExternal): Likewise.
4805 (MethodCore.ParameterTypes): This is now a property instead of a
4806 method, it's initialized from DoDefineParameters().
4807 (MethodCore.ParameterInfo): Removed the set accessor.
4808 (MethodCore.DoDefineParameters): New protected virtual method to
4809 initialize ParameterTypes and ParameterInfo.
4810 (Method.GetReturnType): We can now simply return the MemberType.
4811 (Method.GetMethodFlags): Override the MemberBase version and add
4812 the conditional flags.
4813 (Method.CheckBase): Moved some code from Define() here, call
4814 DoDefineParameters() here.
4815 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4816 here to avoid some larger code duplication.
4817 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4818 ensure that abstract and external accessors don't declare a body.
4820 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4821 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4822 lookup in the attribute's parent classes, so we need to abort as soon
4823 as we found the first match.
4824 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4825 the attribute has no arguments.
4827 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4830 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4832 * cs-parser.jay: reverted previous patch.
4834 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4836 * cs-parser.jay: fixed bug #22119.
4838 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4840 * attribute.cs: fixed compilation. The error was:
4841 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
4842 be assigned to before control leaves the current method."
4843 [FIXME: Filed as bug #28186: MCS must report this error.]
4845 2002-07-25 Martin Baulig <martin@gnome.org>
4847 * attribute.cs (Attribute.Conditional_GetConditionName): New static
4848 method to pull the condition name ouf of a Conditional attribute.
4849 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4850 the obsolete message and error flag out of an Obsolete attribute.
4852 * class.cs (Method.GetMethodFlags): New public method to get the
4853 TypeManager.MethodFlags for this method.
4854 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4856 (Method.Define): Get and apply the Obsolete and Conditional attributes;
4857 if we're overriding a virtual function, set the new private variable
4858 `parent_method'; call the new TypeManager.AddMethod().
4860 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
4861 the MethodBuilder and the Method in a PtrHashtable.
4862 (TypeManager.builder_to_method): Added for this purpose.
4863 (TypeManager.MethodFlags): Added IsObsoleteError.
4864 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
4865 Obsolete and Conditional arguments in MethodBuilders. If we discover
4866 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4867 the message from the attribute.
4869 2002-07-24 Martin Baulig <martin@gnome.org>
4871 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4872 preprocessor directives, ensure that the argument to #define/#undef is
4873 exactly one identifier and that it's actually an identifier.
4875 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4878 2002-07-24 Martin Baulig <martin@gnome.org>
4880 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4881 initialize it to TypeManager.object_type in the constructor.
4882 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4883 of the `hm.get_current' method if we're using the collection pattern.
4884 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4885 for the explicit conversion to make it work when we're using the collection
4886 pattern and the `Current' property has a different return type than `object'.
4889 2002-07-24 Martin Baulig <martin@gnome.org>
4891 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4892 does not match, but don't report any errors. This method is called in
4893 order for all methods in a MethodGroupExpr until a matching method is
4894 found, so we don't want to bail out if the first method doesn't match.
4895 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4896 matches, report the 123. Fixes #28070.
4898 2002-07-24 Martin Baulig <martin@gnome.org>
4900 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4901 TypeManager.TypeToCoreType() to the top of the method so the
4902 following equality checks will work. Fixes #28107.
4904 2002-07-24 Martin Baulig <martin@gnome.org>
4906 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4907 operand is of type uint, and the other operand is of type sbyte,
4908 short or int, the operands are converted to type long." -
4909 Actually do what this comment already told us. Fixes bug #28106,
4912 2002-07-24 Martin Baulig <martin@gnome.org>
4914 * class.cs (MethodBase): New abstract class. This is now a base
4915 class for Property, Indexer and Event to avoid some code duplication
4916 in their Define() and DefineMethods() methods.
4917 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4918 generic methods for Define() and DefineMethods().
4919 (FieldBase): Derive from MemberBase, not MemberCore.
4920 (Property): Derive from MemberBase, not MemberCore.
4921 (Property.DefineMethod): Moved all the code from this method to the
4922 new MethodBase.DefineAccessor(), just call it with appropriate
4924 (Property.Define): Call the new Property.DoDefine(), this does some
4925 sanity checks and we don't need to duplicate the code everywhere.
4926 (Event): Derive from MemberBase, not MemberCore.
4927 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4928 accessors, this will also make them work with interface events.
4929 (Indexer): Derive from MemberBase, not MemberCore.
4930 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4931 (Indexer.Define): Use the new MethodBase functions.
4933 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4934 argument to the constructor.
4935 (Interface.FindMembers): Added support for interface events.
4936 (Interface.PopluateEvent): Implemented.
4938 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
4940 2002-07-22 Miguel de Icaza <miguel@ximian.com>
4942 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4943 but this is required to check for a method name being the same as
4944 the containing class.
4948 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4950 * interface.cs: initialize variable.
4952 2002-07-23 Martin Baulig <martin@gnome.org>
4954 Implemented the IndexerName attribute in interfaces.
4956 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4957 name if this is an explicit interface implementation.
4958 (Indexer.InterfaceIndexerName): New public variable. If we're
4959 implementing an interface indexer, this is the IndexerName in that
4960 interface. Otherwise, it's the IndexerName.
4961 (Indexer.DefineMethod): If we're implementing interface indexer,
4962 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
4963 and Pending.ImplementIndexer methods.
4964 (Indexer.Define): Also define the PropertyBuilder if we're
4965 implementing an interface indexer and this is neither an explicit
4966 interface implementation nor do the IndexerName match the one in
4969 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4970 If a method is defined here, then we always need to create a proxy
4971 for it. This is used when implementing interface indexers.
4972 (Pending.IsInterfaceIndexer): New public method.
4973 (Pending.ImplementIndexer): New public method.
4974 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4975 This is used when implementing interface indexers to define a proxy
4977 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4978 define a proxy if necessary.
4980 * interface.cs (Interface.IndexerName): New public variable.
4981 (Interface.PopulateIndexer): Set the IndexerName.
4982 (Interface.DefineIndexers): New private method. Populate all the
4983 indexers and make sure their IndexerNames match.
4985 * typemanager.cs (IndexerPropertyName): Added support for interface
4988 2002-07-22 Martin Baulig <martin@gnome.org>
4990 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4991 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4992 ret if HasReturnLabel.
4993 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4996 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4997 and set the ec.LoopBeginTryCatchLevel.
4998 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4999 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5000 the current ec.TryCatchLevel, the branch goes out of an exception
5001 block. In this case, we need to use Leave and not Br.
5003 2002-07-22 Martin Baulig <martin@gnome.org>
5005 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5006 block unless the block does not always return or it is contained in
5007 another try { ... } catch { ... } block. Fixes bug #26506.
5008 Added verify-1.cs to the test suite.
5010 2002-07-22 Martin Baulig <martin@gnome.org>
5012 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5013 then we do not always return. Fixes bug #24985.
5015 2002-07-22 Martin Baulig <martin@gnome.org>
5017 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5018 lookup on a per-class level; ie. walk up the class hierarchy until we
5019 found at least one applicable method, then choose the best among them.
5020 Fixes bug #24463 and test-29.cs.
5022 2002-07-22 Martin Baulig <martin@gnome.org>
5024 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5025 return types of the methods. The return type is not part of the
5026 signature and we must not check it to make the `new' modifier work.
5027 Fixes bug #27999, also added test-147.cs.
5028 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5030 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5031 on the method's return type.
5033 2002-07-21 Martin Baulig <martin@gnome.org>
5035 * assign.cs: Make this work if the rightmost source is a constant and
5036 we need to do an implicit type conversion. Also adding a few more tests
5037 to test-38.cs which should have caught this.
5039 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5040 target in the makefile for this. The makefile.gnu is primarily intended
5041 for end-users who don't want to debug the compiler.
5043 2002-07-21 Martin Baulig <martin@gnome.org>
5045 * assign.cs: Improved the Assign class so it can now handle embedded
5046 assignments (X = Y = Z = something). As a side-effect this'll now also
5047 consume less local variables. test-38.cs now passes with MCS, added
5048 a few new test cases to that test.
5050 2002-07-20 Martin Baulig <martin@gnome.org>
5052 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5053 instructions. Fixes bug #27977, also added test-146.cs.
5055 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5057 * cs-tokenizer.cs: fixed getHex ().
5059 2002-07-19 Martin Baulig <martin@gnome.org>
5061 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5062 not Type.GetType() to lookup the array type. This is needed when
5063 we're constructing an array of a user-defined type.
5064 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5065 single-dimensional arrays, but also for single-dimensial arrays of
5068 2002-07-19 Martin Baulig <martin@gnome.org>
5070 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5071 this function is called, it's not allowed to share LocalBuilders
5074 2002-07-19 Martin Baulig <martin@gnome.org>
5076 * expression.cs (Argument.Resolve): Report an error 118 when trying
5077 to pass a type as argument.
5079 2002-07-18 Martin Baulig <martin@gnome.org>
5081 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5082 Conv_R_Un for the signed `long' type.
5084 2002-07-15 Miguel de Icaza <miguel@ximian.com>
5086 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5087 `expr' for the temporary result, as that will fail if we do
5088 multiple resolves on the same expression.
5090 2002-07-05 Miguel de Icaza <miguel@ximian.com>
5092 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5093 ec.TypeContainer for looking up aliases.
5095 * class.cs (TypeContainer): Remove LookupAlias from here.
5097 * decl.cs (DeclSpace); Move here.
5099 2002-07-01 Miguel de Icaza <miguel@ximian.com>
5101 * class.cs (FindMembers): Only call filter if the constructor
5102 bulider is not null.
5104 Also handle delegates in `NestedTypes' now. Now we will perform
5105 type lookups using the standard resolution process. This also
5108 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5109 This uses Expressions (the limited kind that can be parsed by the
5110 tree) instead of strings.
5112 * expression.cs (ComposedCast.ToString): Implement, used to flag
5113 errors since now we have to render expressions.
5115 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
5118 * ecore.cs (SimpleName.ToString): ditto.
5120 * cs-parser.jay: Instead of using strings to assemble types, use
5121 Expressions to assemble the type (using SimpleName, ComposedCast,
5122 MemberAccess). This should fix the type lookups in declarations,
5123 because we were using a different code path for this.
5125 * statement.cs (Block.Resolve): Continue processing statements
5126 even when there is an error.
5128 2002-07-17 Miguel de Icaza <miguel@ximian.com>
5130 * class.cs (Event.Define): Also remove the `remove' method from
5131 the list of pending items.
5133 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5134 generate more compact code.
5136 2002-07-17 Martin Baulig <martin@gnome.org>
5138 * const.cs (Const.LookupConstantValue): Add support for constant
5139 `unchecked' and `checked' expressions.
5140 Also adding test case test-140.cs for this.
5142 2002-07-17 Martin Baulig <martin@gnome.org>
5144 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5145 check whether mi.ReturnType implements the IEnumerator interface; the
5146 `==' and the IsAssignableFrom() will fail in this situation.
5148 2002-07-16 Ravi Pratap <ravi@ximian.com>
5150 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
5153 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5155 * expression.cs: fixed bug #27811.
5157 2002-07-14 Miguel de Icaza <miguel@ximian.com>
5159 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5160 Molaro: when we are a ref, the value already contains a pointer
5161 value, do not take the address of it.
5163 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5164 * removed mb-parser.jay and mb-tokenizer.cs
5166 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5168 * expression.cs: check against the building corlib void type.
5170 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5172 * ecore.cs: fix for valuetype static readonly fields: when
5173 initializing them, we need their address, not the address of a copy.
5175 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5177 * typemanager.cs: register also enum_type in corlib.
5179 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5181 * class.cs: allow calling this (but not base) initializers in structs.
5183 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5185 * ecore.cs: make sure we compare against the building base types
5188 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5190 * typemanager.cs: fix TypeToCoreType() to handle void and object
5191 (corlib gets no more typerefs after this change).
5193 2002-07-12 Miguel de Icaza <miguel@ximian.com>
5195 * expression.cs (ArrayCreation.EmitArrayArguments): use
5196 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5198 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5199 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
5200 array indexes, the runtime actually forbids them.
5202 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5203 for array arguments here.
5205 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5206 instead of the default for ValueTypes.
5208 (New.DoEmit): Use IsValueType instead of
5209 IsSubclassOf (value_type)
5210 (New.DoResolve): ditto.
5211 (Invocation.EmitCall): ditto.
5213 * assign.cs (Assign): ditto.
5215 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5216 Statements *are* currently doing part of their resolution during
5219 Expressions do always resolve during resolve, but statements are
5220 only required to propagate resolution to their children.
5222 2002-07-11 Miguel de Icaza <miguel@ximian.com>
5224 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5226 (LoadAssembly): Do not add the dll if it is already specified
5228 (MainDriver): Add the System directory to the link path at the end,
5229 after all the other -L arguments.
5231 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5232 wrong opcode for loading bytes and bools (ldelem.i1 instead of
5233 ldelem.u1) and using the opposite for sbytes.
5235 This fixes Digger, and we can finally run it.
5237 * driver.cs (UnixParseOption): Move the option parsing here.
5238 (CSCParseOption): Implement CSC-like parsing of options.
5240 We now support both modes of operation, the old Unix way, and the
5241 new CSC-like way. This should help those who wanted to make cross
5244 The only thing broken is that /r:, /reference: and /lib: are not
5245 implemented, because I want to make those have the same semantics
5246 as the CSC compiler has, and kill once and for all the confussion
5247 around this. Will be doing this tomorrow.
5249 * statement.cs (Unsafe.Resolve): The state is checked during
5250 resolve, not emit, so we have to set the flags for IsUnsfe here.
5252 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5254 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5255 not catch the Error_ObjectRefRequired in SimpleName (as it is
5256 possible to have a class/instance variable name that later gets
5257 deambiguated), we have to check this here.
5259 2002-07-10 Ravi Pratap <ravi@ximian.com>
5261 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5262 make static and put into Expression.
5264 (Event.Define): Register the private field of the event with the
5265 TypeManager so that GetFieldFromEvent can get at it.
5267 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5268 keep track of the private field associated with an event which
5271 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5274 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5276 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5278 * expression.cs (Binary.EmitBranchable): this routine emits the
5279 Binary expression in a branchable context. This basically means:
5280 we need to branch somewhere, not just get the value on the stack.
5282 This works together with Statement.EmitBoolExpression.
5284 * statement.cs (Statement.EmitBoolExpression): Use
5287 2002-07-09 Miguel de Icaza <miguel@ximian.com>
5289 * statement.cs (For): Reduce the number of jumps in loops.
5291 (For): Implement loop inversion for the For statement.
5293 (Break): We can be breaking out of a Try/Catch controlled section
5294 (foreach might have an implicit try/catch clause), so we need to
5295 use Leave instead of Br.
5297 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5298 now). If the instace expression supports IMemoryLocation, we use
5299 the AddressOf method from the IMemoryLocation to extract the
5300 address instead of emitting the instance.
5302 This showed up with `This', as we were emitting the instance
5303 always (Emit) instead of the Address of This. Particularly
5304 interesting when This is a value type, as we dont want the Emit
5305 effect (which was to load the object).
5307 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5309 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5311 * statement.cs (Checked): Set the CheckedState during the resolve
5312 process too, as the ConvCast operations track the checked state on
5313 the resolve process, and not emit.
5315 * cs-parser.jay (namespace_member_declaration): Flag that we have
5316 found a declaration when we do. This is used to flag error 1529
5318 * driver.cs: Report ok when we display the help only.
5320 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5322 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5324 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5326 * cs-tokenizer.cs (define): We also have to track locally the
5327 defines. AllDefines is just used for the Conditional Attribute,
5328 but we also need the local defines for the current source code.
5330 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5332 * statement.cs (While, For, Do): These loops can exit through a
5333 Break statement, use this information to tell whether the
5334 statement is the last piece of code.
5336 (Break): Flag that we break.
5338 * codegen.cs (EmitContexts): New `Breaks' state variable.
5340 2002-07-03 Martin Baulig <martin@gnome.org>
5342 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5343 modifiers in method declarations in structs. Otherwise, you won't
5344 be able to override things like Object.Equals().
5346 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5348 * class.cs (Method, Property, Indexer): Do not allow the public
5349 modifier to be used in explicit interface implementations.
5351 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5352 override modifiers in method declarations in structs
5354 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5356 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5357 integer or real overflow, report an error
5359 2002-07-02 Martin Baulig <martin@gnome.org>
5361 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5362 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5363 to tell the runtime about our newly created System.Object and
5364 System.ValueType types.
5366 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5368 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5369 struct instead of Ldarg/Starg.
5371 2002-07-02 Martin Baulig <martin@gnome.org>
5373 * expression.cs (Indirection.Indirection): Call
5374 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5376 2002-07-02 Martin Baulig <martin@gnome.org>
5378 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5379 ValueType, call TypeManager.TypeToCoreType() on it.
5380 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5381 the OpCodes.Newarr argument.
5383 2002-07-02 Martin Baulig <martin@gnome.org>
5385 * expression.cs (Invocation.EmitCall): When compiling corlib,
5386 replace all calls to the system's System.Array type to calls to
5387 the newly created one.
5389 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5390 System.Array methods.
5391 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5392 from the system's System.Array type which must be replaced.
5394 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5396 * typemanager.cs: load unverifiable_code_ctor so we can build
5397 corlib using the correct type. Avoid using GetTypeCode() with
5399 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5400 TypeManager.object_type to allow building corlib.
5402 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5404 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5406 2002-07-01 Martin Baulig <martin@gnome.org>
5408 * class.cs: Make the last change actually work, we need to check
5409 whether `ifaces != null' to avoid a crash.
5411 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5413 * class.cs: when we build structs without fields that implement
5414 interfaces, we need to add the interfaces separately, since there is
5415 no API to both set the size and add the interfaces at type creation
5418 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5420 * expression.cs: the dimension arguments to the array constructors
5421 need to be converted if they are a long.
5423 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5425 * class.cs: don't emit ldarg.0 if there is no parent constructor
5426 (fixes showstopper for corlib).
5428 2002-06-29 Martin Baulig <martin@gnome.org>
5430 MCS now compiles corlib on GNU/Linux :-)
5432 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5433 ie. check for MethodImplOptions.InternalCall.
5435 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5436 and TypeManager.attribute_type are null, so we must explicitly check
5437 whether parent is not null to find out whether it's an attribute type.
5438 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5439 and SetBuilder, not only if the property is neither abstract nor external.
5440 This is necessary to set the MethodImplOptions on the accessor methods.
5441 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5442 SetBuilder, see Property.Emit().
5444 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5445 populate "System.Object", "System.ValueType" and "System.Attribute" since
5446 they've already been populated from BootCorlib_PopulateCoreTypes().
5448 2002-06-29 Martin Baulig <martin@gnome.org>
5450 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5451 is the NullLiteral, we also need to make sure that target_type is not
5454 2002-06-29 Martin Baulig <martin@gnome.org>
5456 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5457 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5458 before calling BootstrapCorlib_ResolveDelegate ().
5460 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5462 * statement.cs: fixed build-breaker. All tests passed ok.
5464 2002-06-27 Martin Baulig <martin@gnome.org>
5466 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5467 for System.Decimal when compiling corlib.
5469 2002-06-27 Martin Baulig <martin@gnome.org>
5471 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5472 switch blocks which contain nothing but a default clause.
5474 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5476 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5478 2002-06-27 Martin Baulig <martin@gnome.org>
5480 * ecore.cs (PropertyExpr.PropertyExpr): Call
5481 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5483 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5484 is already a TypeBuilder.
5486 2002-06-27 Martin Baulig <martin@gnome.org>
5488 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5489 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5490 the "from an array-type to System.Array" case. This makes it work
5491 when compiling corlib.
5493 2002-06-27 Martin Baulig <martin@gnome.org>
5495 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5496 non-static PropertyExpr, set its InstanceExpression. This makes
5497 the `ICollection.Count' property work in System/Array.cs.
5499 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5501 * driver.cs: Made error handling more consistent. Errors now
5502 tracked by Report class, so many methods which used to return int
5503 now return void. Main() now prints success/failure and
5504 errors/warnings message.
5506 Renamed '--probe' compiler argument to '--expect-error'. Removed
5507 the magic number return values (123 and 124). Now, if the
5508 expected error occurs, the compiler exits with success (exit value
5509 0). If the compilation completes without seeing that particular
5510 error, the compiler exits with failure (exit value 1). The
5511 makefile in mcs/errors has been changed to handle the new behaviour.
5513 * report.cs: Made 'expected error' number a property and renamed
5514 it from 'Probe' to 'ExpectedError'.
5516 * genericparser.cs: Removed error handling support, since it is
5517 now all done by Report class.
5519 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5520 class, so parse() no longer returns an int.
5522 * namespace.cs: Use Report.Error instead of GenericParser.error
5524 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5526 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5527 TypeContainer.AddOperator): At the front of the list put the
5528 explicit implementations, so they get resolved/defined first.
5530 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5532 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5533 interface type is implemented by this TypeContainer. Used during
5534 explicit interface implementation.
5536 (Property.Define, Indexer.Define, Method.Define): Validate that
5537 the given interface in the explicit implementation is one of the
5538 base classes for the containing type.
5540 Also if we are explicitly implementing an interface, but there is
5541 no match in the pending implementation table, report an error.
5543 (Property.Define): Only define the property if we are
5544 not explicitly implementing a property from an interface. Use the
5545 correct name also for those properties (the same CSC uses,
5546 although that is really not needed).
5548 (Property.Emit): Do not emit attributes for explicitly implemented
5549 properties, as there is no TypeBuilder.
5551 (Indexer.Emit): ditto.
5553 Hiding then means that we do not really *implement* a pending
5554 implementation, which makes code fail.
5556 2002-06-22 Martin Baulig <martin@gnome.org>
5558 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5559 the return value of Object.GetType(). [FIXME: we need to do this whenever
5560 we get a type back from the reflection library].
5562 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5564 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5566 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5568 * attribute.cs: Return null if we can not look up the type.
5570 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5571 the interface types found.
5573 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5574 interface types found.
5576 * typemanager.cs (GetInterfaces): Make this routine returns alll
5577 the interfaces and work around the lame differences between
5578 System.Type and System.Reflection.Emit.TypeBuilder in the results
5579 result for GetInterfaces.
5581 (ExpandInterfaces): Given an array of interface types, expand and
5582 eliminate repeated ocurrences of an interface. This expands in
5583 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5586 2002-06-21 Martin Baulig <martin@gnome.org>
5588 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5591 2002-06-21 Martin Baulig <martin@gnome.org>
5593 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5594 and called with one of the core types, return the corresponding typebuilder for
5597 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5600 2002-06-21 Martin Baulig <martin@gnome.org>
5602 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5603 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5604 (Expression.ConvertReferenceExplicit): Likewise.
5606 * expression.cs (ElementAccess.DoResolve): Likewise.
5607 (ElementAccess.DoResolveLValue): Likewise.
5609 2002-06-10 Martin Baulig <martin@gnome.org>
5611 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5612 add the "value" parameter to the parameter list.
5614 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5617 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5619 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5620 the argument to an int, uint, long or ulong, per the spec. Also
5621 catch negative constants in array creation.
5623 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5625 * class.cs: do not allow the same interface to appear twice in
5626 the definition list.
5628 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5630 * ecore.cs: don't use ldlen with System.Array.
5632 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5634 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5636 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5638 * modifiers.cs: produce correct field attributes for protected
5639 internal. Easy fix so miguel can work on ther harder stuff:-)
5641 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5643 * pending.cs: New file. Move the code from class.cs here.
5644 Support clearning the pending flag for all methods (when not doing
5645 explicit interface implementation).
5647 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5649 * rootcontext.cs: added a couple more types needed to bootstrap.
5651 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5653 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5654 constructor in the type, instead of any constructor in the type
5655 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5656 a bug in the Mono runtime when applying the params attribute).
5658 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5659 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5661 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5663 * expression.cs (Unary.ResolveOperator): Use TypeManager
5664 to resolve the type.
5666 2002-06-13 Ravi Pratap <ravi@ximian.com>
5668 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5671 * enum.cs (AddEnumMember): Add support to store the attributes associated
5672 with each member too.
5674 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5675 field builders too - this takes care of the enum member case.
5677 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5679 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5680 address-of operator on both value types and pointers.
5682 2002-06-10 Martin Baulig <martin@gnome.org>
5684 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5685 PropertyBuilder to the `property_builders' list.
5687 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5688 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5689 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5690 find any indexers which are inherited from an interface.
5692 2002-06-09 Martin Baulig <martin@gnome.org>
5694 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5695 the same type as the constant if necessary. There's also a test-130.cs
5698 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5700 * typemanager.cs (TypeManager.ChangeType): Previously known as
5701 Enum.ChangeEnumType().
5703 2002-06-09 Martin Baulig <martin@gnome.org>
5705 * expression.cs (Cast.TryReduce): Added support for consts.
5707 2002-06-08 Ravi Pratap <ravi@ximian.com>
5709 * class.cs (Accessor): Hold attributes information so we can pass
5712 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5713 Modify to pass in attributes attached to the methods.
5715 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5717 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5718 to handle the Accessor kind :-)
5720 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5722 2002-06-08 Martin Baulig <martin@gnome.org>
5724 * expression.cs (Unary.TryReduceNegative): Added support for
5727 2002-06-08 Martin Baulig <martin@gnome.org>
5729 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5730 name can't be found in the `defined_names' - the caller will do a
5731 MemberLookup in this case and thus find methods in System.Enum
5732 such as Enum.IsDefined().
5734 2002-06-08 Martin Baulig <martin@gnome.org>
5736 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5737 Convert.ChangeType() which works with TypeBuilder created types.
5738 (Enum.LookupEnumValue, Enum.Define): Use it here.
5740 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5741 `TypeBuilder.BaseType != null' check.
5742 (TypeContainer.FindMembers): Only lookup parent members if we
5743 actually have a parent.
5744 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5745 (ConstructorInitializer.Resolve): Likewise.
5747 * interface.cs (Interface.FindMembers): Added
5748 `TypeBuilder.BaseType != null' check.
5750 * rootcontext.cs (RootContext.ResolveCore): Added
5751 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5752 classes_second_stage.
5754 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5755 debug_type and trace_type when compiling with --nostdlib.
5757 2002-06-07 Martin Baulig <martin@gnome.org>
5759 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5760 (AddField): Set it to true when adding a non-static field.
5761 (DefineType): Use `have_nonstatic_fields' to find out whether we
5762 have non-static fields, not `Fields != null'.
5764 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5766 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5767 dereferencing a null on the static-field code path)
5769 2002-05-30 Martin Baulig <martin@gnome.org>
5771 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5772 to take command line arguments. Use reflection to call the new
5773 custom `Initialize' function on the symbol writer and pass it the
5774 command line arguments.
5776 * driver.cs (--debug-args): New command line argument to pass command
5777 line arguments to the symbol writer.
5779 2002-05-28 Miguel de Icaza <miguel@ximian.com>
5781 * assign.cs (DoResolve): Forgot to do the implicit conversion to
5782 the target type for indexers and properties. Thanks to Joe for
5785 2002-05-27 Miguel de Icaza <miguel@ximian.com>
5787 * typemanager.cs (MethodFlags): returns the method flags
5788 (Obsolete/ShouldIgnore) that control warning emission and whether
5789 the invocation should be made, or ignored.
5791 * expression.cs (Invocation.Emit): Remove previous hack, we should
5792 not do this on matching a base type, we should do this based on an attribute
5794 Only emit calls to System.Diagnostics.Debug and
5795 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5796 on the command line.
5798 * rootcontext.cs: Global settings for tracing and debugging.
5800 * cs-tokenizer.cs (define): New utility function to track
5801 defines. Set the global settings for TRACE and DEBUG if found.
5803 2002-05-25 Ravi Pratap <ravi@ximian.com>
5805 * interface.cs (Populate*): Pass in the TypeContainer as well as
5806 the DeclSpace as parameters so that we can create EmitContexts and
5807 then use that to apply attributes etc.
5809 (PopulateMethod, PopulateEvent, PopulateProperty)
5810 (PopulateIndexer): Apply attributes everywhere.
5812 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5815 (ApplyAttributes): Update accordingly.
5817 We now apply interface attributes for all members too.
5819 2002-05-26 Miguel de Icaza <miguel@ximian.com>
5821 * class.cs (Indexer.Define); Correctly check if we are explicit
5822 implementation (instead of checking the Name for a ".", we
5823 directly look up if the InterfaceType was specified).
5825 Delay the creation of the PropertyBuilder.
5827 Only create the PropertyBuilder if we are not an explicit
5828 interface implementation. This means that explicit interface
5829 implementation members do not participate in regular function
5830 lookups, and hence fixes another major ambiguity problem in
5831 overload resolution (that was the visible effect).
5833 (DefineMethod): Return whether we are doing an interface
5836 * typemanager.cs: Temporary hack until we get attributes in
5837 interfaces (Ravi is working on that) and we get IndexerName
5838 support in interfaces.
5840 * interface.cs: Register the indexers as properties.
5842 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5843 warning, I have verified that this is a bug in the .NET runtime
5844 (JavaScript suffers of the same problem).
5846 * typemanager.cs (MemberLookup): When looking up members for
5847 interfaces, the parent of an interface is the implicit
5848 System.Object (so we succeed in searches of Object methods in an
5849 interface method invocation. Example: IEnumerable x; x.ToString
5852 2002-05-25 Miguel de Icaza <miguel@ximian.com>
5854 * class.cs (Event): Events should also register if they do
5855 implement the methods that an interface requires.
5857 * typemanager.cs (MemberLookup); use the new GetInterfaces
5860 (GetInterfaces): The code used to lookup interfaces for a type is
5861 used in more than one place, factor it here.
5863 * driver.cs: Track the errors at the bottom of the file, we kept
5866 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5867 instance if the method we are calling is static!
5869 2002-05-24 Miguel de Icaza <miguel@ximian.com>
5871 * attribute.cs (ApplyAttributes): Make this function filter out
5872 the IndexerName attribute (as that attribute in reality is never
5873 applied) and return the string constant for the IndexerName
5876 * class.cs (TypeContainer.Emit): Validate that all the indexers
5877 have the same IndexerName attribute, and if so, set the
5878 DefaultName attribute on the class.
5880 * typemanager.cs: The return value might contain other stuff (not
5881 only methods). For instance, consider a method with an "Item"
5882 property and an Item method.
5884 * class.cs: If there is a problem with the parameter types,
5887 2002-05-24 Ravi Pratap <ravi@ximian.com>
5889 * ecore.cs (ImplicitConversionExists): Wrapper function which also
5890 looks at user defined conversion after making a call to
5891 StandardConversionExists - we need this for overload resolution.
5893 * expression.cs : Update accordingly the various method calls.
5895 This fixes 2 bugs filed against implicit user defined conversions
5897 2002-05-22 Miguel de Icaza <miguel@ximian.com>
5899 * statement.cs: Track the result of the assignment.
5901 2002-05-21 Miguel de Icaza <miguel@ximian.com>
5903 * expression.cs (MemberAccess): Improved error reporting for
5904 inaccessible members.
5906 2002-05-22 Martin Baulig <martin@gnome.org>
5908 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
5909 itself with debugging support.
5911 2002-05-22 Martin Baulig <martin@gnome.org>
5913 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5914 Removed, this isn't needed anymore.
5916 2002-05-20 Martin Baulig <martin@gnome.org>
5918 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5919 be underlying type for an enum.
5921 2002-05-20 Miguel de Icaza <miguel@ximian.com>
5923 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5924 that splits out the loading of just the core types.
5926 * rootcontext.cs (ResolveCore): Split the struct resolution in
5927 two, so we can load the enumeration underlying types before any
5930 * expression.cs (Is): Bandaid until we fix properly Switch (see
5931 bug #24985 for details).
5933 * typemanager.cs (ImplementsInterface): The hashtable will contain
5934 a null if there are no interfaces implemented.
5936 2002-05-18 Miguel de Icaza <miguel@ximian.com>
5938 * cs-parser.jay (indexer_declarator): It is fine to have array
5941 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5943 * typemanager.cs: (RegisterBuilder): New function used to register
5944 TypeBuilders that implement interfaces. Since
5945 TypeBuilder.GetInterfaces (as usual) does not work with lame
5947 (AddUserType): register interfaces.
5949 (ImplementsInterface): Use the builder_to_ifaces hash if we are
5950 dealing with TypeBuilder. Also, arrays are showing up as
5951 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5952 methods can not be invoked on them!
5954 * ecore.cs (ExplicitReferenceConversionExists): Made public.
5955 (ImplicitReferenceConversionExists): Split out from
5956 StandardConversionExists.
5958 * expression.cs (As): We were only implementing one of the three
5959 cases for the as operator. We now implement them all.
5960 (Is): Implement the various other cases for Is as well.
5962 * typemanager.cs (CACHE): New define used to control if we want or
5963 not the FindMembers cache. Seems to have a negative impact on
5964 performance currently
5966 (MemberLookup): Nested types have full acess to
5967 enclosing type members
5969 Remove code that coped with instance/static returns for events, we
5970 now catch this in RealFindMembers.
5972 (RealFindMembers): only perform static lookup if the instance
5973 lookup did not return a type or an event.
5975 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5977 * assign.cs (CompoundAssign): We pass more semantic information
5978 now to Compound Assignments than we did before: now we have all
5979 the information at hand, and now we resolve the target *before* we
5980 do the expression expansion, which allows the "CacheValue" method
5981 to have the effect we intended (before, a [x] += 1 would generate
5982 two differen ArrayAccess expressions from the ElementAccess,
5983 during the resolution process).
5985 (CompoundAssign.DoResolve): Resolve target and original_source here.
5987 2002-05-16 Miguel de Icaza <miguel@ximian.com>
5989 * expression.cs (ArrayAccess): dropped debugging information.
5991 * typemanager.cs: Small bug fix: I was always returning i_members,
5992 instead of one of i_members or s_members (depending on which had
5995 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
5996 method is invoked before any code generation takes place, and it
5997 is a mechanism to inform that the expression will be invoked more
5998 than once, and that the method should use temporary values to
5999 avoid having side effects
6001 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6003 * ecore.cs (Expression.CacheTemporaries): Provide empty default
6006 * expression.cs (Indirection, ArrayAccess): Add support for
6007 CacheTemporaries in these two bad boys.
6009 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6011 (StoreFromPtr): Handle stobj as well.
6013 * expression.cs (UnaryMutator): Share more code.
6015 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6016 down: I was not tracking the Filter function as well, which
6017 was affecting the results of the cache.
6019 2002-05-15 Miguel de Icaza <miguel@ximian.com>
6021 * attribute.cs: Remove the hack to handle the CharSet property on
6024 2002-05-14 Miguel de Icaza <miguel@ximian.com>
6026 * attribute.cs (DoResolve): More uglyness, we now only try to
6027 resolve the attribute partially, to extract the CharSet
6028 information (only if we are a StructLayout attribute). Otherwise
6030 (GetExtraTypeInfo): Add some code to conditionally kill in the
6031 future this. I am more and more convinced that the .NET
6032 framework has special code to handle the attribute setting on
6035 * expression.cs (IsParamsMethodApplicable): Revert my previous
6036 foreach change here, it was wrong.
6038 2002-05-13 Miguel de Icaza <miguel@ximian.com>
6040 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6041 (pp_expr): do not abort on unknown input, just return.
6042 (eval): abort if there are pending chars.
6044 * attribute.cs (Attribute.Resolve): Positional parameters are
6045 optional. Deal with that case.
6047 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6048 the Ansi/Unicode/Auto information for the type.
6050 (TypeContainer.DefineType): instantiate the EmitContext here, as
6051 we will be using it during the type definition (to resolve
6052 attributes) and during the emit phase.
6054 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6055 to pull type information out of the attributes
6057 (Attribute.Resolve): track the constructor builder, and allow for
6058 multiple invocations (structs and classes will use this).
6060 * ecore.cs (MemberLookupFinal): new version with all the
6061 parameters customizable.
6063 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6064 constructors. Return if the result value is null (as the error
6065 would have been flagged already by MemberLookupFinal)
6067 Do not allow instances of abstract classes or interfaces to be
6070 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6071 We have to compare the assembly property here when dealing with
6072 FamANDAssem and Assembly access modifiers, because we might be
6073 creating an assembly from *modules* (that means that we are not
6074 getting TypeBuilders for types defined in other modules that are
6075 part of this assembly).
6077 (Method.Emit): If the method is marked abstract and has a body,
6080 (TypeContainer.DefineMembers): If both the defined member and the
6081 parent name match are methods, then do not emit any warnings: let
6082 the Method.Define routine take care of flagging warnings. But if
6083 there is a mismatch (method overrides something else, or method is
6084 overriwritten by something, then emit warning).
6086 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6087 set to null, this means `do not check for the return type on the
6090 (Method.Define): set the return type for the method signature to
6091 null, so that we get methods with the same name and parameters and
6092 different return types. This is used to flag warning 114 (you are
6093 hiding a method, and you probably want to use the new/override
6096 * typemanager.cs (MemberLookup): Implemented proper access
6097 control, closing a long standing set of bug reports. The problem
6098 was that the Framework only has two bits: Public and NonPublic,
6099 and NonPublic includes private and protected methods, but we need
6100 to enforce the FamANDAssem, FamOrAssem and Family.
6102 2002-05-11 Miguel de Icaza <miguel@ximian.com>
6104 * statement.cs (GotoCase): Return true: Ammounts to giving up
6105 knowledge on whether we return or not, and letting the other case
6106 be responsible for it.
6108 2002-05-10 Miguel de Icaza <miguel@ximian.com>
6110 * driver.cs: Do not load directories for each file processed, only
6111 do it if there is a pattern.
6113 * ecore.cs: Report readonly assigns here as well, as we might have
6114 been resolved only by MemberAccess.
6116 (SimpleName.SimpleNameResolve): Also be useful for LValue
6117 resolution. We need this to propagate assign to local readonly variables
6119 * typemanager.cs: Use a ptrhashtable for the criteria, because we
6120 do not want to reuse potential criteria memory.
6122 * class.cs (MyEventBuilder): Set reflected_type;
6124 * ecore.cs (Constantify): Added support for constifying bools.
6126 (RootContext.LookupType): Added a cache for values looked up in
6127 the declaration space.
6129 * typemanager.cs (FindMembers): Now is a front-end to
6130 RealFindMembers, and provides a two-level hashtable-based cache to
6133 15% performance improvement: from 22.5 to 19.2 seconds.
6135 * expression.cs (IsParamsMethodApplicable): use foreach.
6136 (Invocation.DoResolve): ditto.
6137 (New.DoResolve): ditto.
6138 (ArrayCreation.DoResolve): ditto.
6140 * ecore.cs (FindMostEncompassingType): use foreach.
6142 * delegate.cs (NewDelegate.DoResolve): Use foreach
6144 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6145 (RemoveMethods): use foreach.
6147 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6148 nested foreach statements instead of for, and also break out of
6149 the inner loop once a match is found.
6151 (Invocation.OverloadResolve): Use foreach, simplify the code.
6153 2002-05-08 Miguel de Icaza <miguel@ximian.com>
6155 * cfold.cs (BinaryFold): During an enumeration evaluation context,
6156 we actually unwrap the expression to allow for extra information
6159 * expression.cs: Use Shr_Un on unsigned operations.
6161 2002-05-08 Ravi Pratap <ravi@ximian.com>
6163 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
6164 applicable operators was not being considered correctly. This closes
6165 the bug Miguel reported.
6167 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6169 * attribute.cs: check that the type derives from System.Attribute
6170 and report the correct error in that case (moved the duplicate code to
6171 its own method, too).
6173 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6175 * attribute.cs: lookup attribute type name as the spec says: first the
6176 bare attribute name and then name + "Attribute" (nant compiles with
6177 mcs after this fix).
6179 2002-05-07 Miguel de Icaza <miguel@ximian.com>
6181 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
6182 Because of the way we parse things, we should try to see if a
6183 UIntConstant can fit in an integer.
6185 2002-05-07 Ravi Pratap <ravi@ximian.com>
6187 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6188 when we are in an explicit context.
6190 (ConvertReferenceExplicit): When converting from Iface type S to Class
6191 T make sure the rules are implemented as an OR.
6193 * parameter.cs (ParameterType): Make it a property for now although the
6194 purpose really isn't anything immediate.
6196 * expression.cs (Is*Applicable): Do better checking on the parameter type
6197 of a ref/out parameter. The ones from the system assemblies are already
6198 marked with the correct type so we don't need to do any correction.
6200 * ecore.cs (StandardConversionExists): Conversion from Interface types to
6201 the object type is standard too so include that.
6203 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6205 * ecore.cs (StandardConversionExists): Augment with missing code:
6206 deal with IntConstant, LongConstants and Enumerations.
6208 * assign.cs: Report the error, instead of failing silently
6210 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6211 typecontainer that they are declared, because the
6212 typecontainer/namespace will have the list of using clauses that
6215 Assembly Attributes were escaping the normal registration
6218 (EmitCode): Apply attributes within an EmitContext that represents
6219 the container they were declared on.
6221 * cs-parser.jay: Track bases for structs. How did I get this wrong?
6223 2002-05-06 Ravi Pratap <ravi@ximian.com>
6225 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6226 Revamp completely - make much cleaner as we now operate only
6229 (FindMostSpecificSource, FindMostSpecificTarget): New methods
6230 to implement the logic detailed in the spec more correctly.
6232 (UserDefinedConversion): Update accordingly.
6234 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6236 * statement.cs: Return flow analysis information up.
6238 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6241 (token): Do not consume an extra character before calling
6244 2002-05-06 Piers Haken <piersh@friskit.com>
6246 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6248 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6250 * class.cs (Constructor.Emit): Set the IsStatic flag in the
6251 EmitContext during the instance constructor initializer
6252 resolution, to stop access to instance variables.
6254 This is mandated by the spec, last paragraph of the `constructor
6255 initializers' section.
6257 2002-05-05 Miguel de Icaza <miguel@ximian.com>
6259 * cs-parser.jay, class.cs (Accessor): new class used to represent
6260 an accessor (get or set). In the past we used `null' to represent
6261 a missing accessor. But this is ambiguous because there was no
6262 way to tell in abstract indexers/properties if one of them was
6265 Now there is a way of addressing that.
6267 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6268 instead of FindMembers.
6270 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6271 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6273 * attribute.cs: Treat indexers and properties as the same in terms
6274 of applying attributes
6276 * ecore.cs (FindMostEncompassedType): Use statically initialized
6277 EmptyExpressions()s like we do elsewhere to avoid creating useless
6278 objects (and we take this out of the tight loop).
6280 (GetConversionOperators): Move the code to extract the actual
6281 operators to a separate routine to clean things up.
6283 2002-05-04 Miguel de Icaza <miguel@ximian.com>
6285 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6286 events are always registered FieldBuilders.
6288 * class.cs (FieldBase): New class shared by Fields
6290 * delegate.cs: If we are a toplevel delegate, use our full name.
6291 If we are a nested delegate, then only use our tail name.
6293 2002-05-02 Ravi Pratap <ravi@ximian.com>
6295 * expression.cs (IsApplicable): Ensure that we add the "&" to
6296 ref/out types before comparing it with the type of the argument.
6298 (IsParamsMethodApplicable): Ditto.
6300 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
6303 * delegate.cs : Handle the case when we have more than one applicable
6304 method. Flag an error only when we finish checking all.
6306 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6308 * expression.cs: Add support for boolean static initializers.
6310 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6312 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6314 * parameter.cs (ComputeParameterTypes,
6315 ComputeAndDefineParameterTypes): Better error handling: now we
6316 clear the `types' cache if we fail during any of the type lookups.
6317 We also return the status code correctly to our caller
6319 * delegate.cs: If we fail to define a delegate, abort the extra
6322 * expression.cs (Binary.ResolveOperator): for
6323 operator==(object,object) and operator !=(object, object) we also
6324 have to verify that there is an implicit conversion from one to
6327 (ArrayAccess.DoResolve): Array Access can operate on
6330 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6332 * assign.cs (CompoundAssign): A new class used as a "flag" that
6333 the assignment actually is happening as part of a compound
6334 assignment operator.
6336 During compound assignment, a few new rules exist to enable things
6343 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6344 to the type of x) if y is implicitly convertible to the type of x,
6345 and the operator is a builtin operator and the return type of the
6346 operator is explicitly convertible to the type of x.
6348 * rootcontext.cs: Reset warning level to 2. 4 catches various
6349 "interesting" features in mcs, we must clean this up at some
6350 point, but currently am trying to kill other bugs ;-)
6352 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6353 in container classes as well.
6355 * expression.cs (Binary.ResolveOperator): Handle string case
6356 before anything else (as operator overloading does emit an error
6357 before doing anything else).
6359 This code could go away when we move to a table driven model, but
6360 i could not come up with a good plan last night.
6362 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6364 * typemanager.cs (CSharpName): reimplementation using regex.
6365 * class.cs: added null check for fields in Emit
6366 * rootcontext.cs: set warninglevel to 4
6368 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6370 * typemanager.cs (CSharpName): reimplemented with Lupus
6373 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6375 * statement.cs (If): correclty implement Resolve, because we were
6376 not catching sem errors in there. The same process is needed
6378 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6381 (Statement.Warning_DeadCodeFound): Factorize code.
6382 (While): Report dead code here too.
6384 (Statement): Added Resolve virtual method to allow
6385 for resolution split from the emit code.
6387 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6389 * statement.cs (EmitBoolExpression): No longer try to resolve the
6391 (MakeBoolean): New utility function that resolve, implicitly
6392 converts to boolean and tags the expression.
6395 (If, Do): Implement dead code elimination.
6396 (While): Implement loop inversion
6398 (Do, While, For, If): Resolve the expression prior to calling our
6401 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6404 - added method Report28 (warning: program has more than one entry point)
6405 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6406 - modified method Method.Define, the part at the end of the method
6408 * rootcontext.cs: added static public Location EntryPointLocation;
6410 * ../errors/cs0028.cs : Add test case for the above warning.
6413 - modified method CSharpName to allow arrays of primitive type to
6414 be printed nicely (e.g. instead of System.Int32[][] it now prints
6416 - added method CSharpSignature: returns the signature of a method
6417 in string format to be used in reporting errors, warnings, etc.
6419 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6422 2002-04-26 Ravi Pratap <ravi@ximian.com>
6424 * delegate.cs (Define): Fix extremely silly bug where I was
6425 setting the type of the 'object' parameter of the BeginInvoke
6426 method to System.IAsyncResult instead of System.Object ;-)
6428 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6430 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6433 (Constructor.Emit): return if we fail to initialize the
6434 constructor. Another door closed!
6436 * expression.cs (New.DoResolve): Improve error message (from -6 to
6437 1501). Use DeclaredOnly lookup to find the exact constructor.
6439 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6440 loop. This is useful.
6442 * cs-parser.jay: Adjust the default parameters so that destructors
6443 have the proper signature.
6445 2002-04-26 Martin Baulig <martin@gnome.org>
6447 * driver.cs (LoadAssembly): If `assembly' contains any characters
6448 which are only valid in path names and not in assembly names
6449 (currently slash, backslash and point), use Assembly.LoadFrom ()
6450 instead of Assembly.Load () on the `assembly' (before iteration
6451 over the link_paths).
6453 2002-04-26 Martin Baulig <martin@gnome.org>
6455 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6457 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6459 * class.cs (Property): use the new typemanager.MemberLookup
6461 (TypeContainer.MemberLookup): Implement using the
6462 TypeManager.MemberLookup now.
6464 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6465 and return MemberInfos, so that these can be used without an
6466 EmitContext (what we had before).
6468 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6470 * expression.cs: Fix the case where the argument to params if the
6471 type of the params. I omitted handling this before. Fixed
6473 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6475 * driver.cs: Call BootCorlib_PopulateCoreType
6477 * class.cs (Property.CheckBase): Check for properties only, not
6480 * interface.cs: Temporary hack: try/catch around the
6481 CustomAttributeBuilder, because I am getting an exception that I
6484 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6485 types whose definitions are required to be there (attributes are
6486 defined before standard types).
6488 Compute definitions as we boot the various types, as they are used
6489 immediately (value_type class will need object_type, but if we do
6490 not initialize object_type, we will pass a null, which will let
6491 the runtime pick the System.Object from the existing corlib, which
6492 is not what we want).
6494 2002-04-22 Patrik Torstensson <totte@labs2.com>
6496 * cs-tokenizer.cs: fixed a number of trim() issues.
6498 2002-04-22 Ravi Pratap <ravi@ximian.com>
6500 * expression.cs (Argument.Type): Ensure that we return the correct
6501 type when we have out or ref parameters [in which case we
6504 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6506 * class.cs (Property, Indexer): Allow extern modifier in there.
6508 * typemanager.cs (InitBaseTypes): Initializes object_type and
6509 value_type, since those will be used early on during the bootstrap
6510 process to compile corlib.
6512 (InitCoreTypes): Move code from here to InitBaseTypes.
6514 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6516 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6517 single-dimension arrays as using the ldlen opcode.
6519 Daniel Lewis discovered this optimization.
6521 * typemanager.cs: Add signature for System.Array::get_Length
6523 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6525 * statement.cs: report the error when the foreach does not apply to an
6526 array nor a collection.
6528 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6530 * expression.cs: Add implicit conversions to the operator ~.
6532 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6534 * typemanager.cs: Locate the decimal constructor.
6536 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6538 * attribute.cs: use the new property of TypeOf.
6539 * expression.cs: added 'get' property around typearg.
6541 These changes fix a build breaker reported by NickD. Is this the
6542 correct way to fix? If not, please, revert my changes and make it
6545 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6547 * attribute.cs: Add support for typeof in attribute invocations.
6548 I am not sure that this is right though.
6550 2002-04-14 Duncan Mak <duncan@ximian.com>
6552 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6553 Binary.Operator.Division case.
6555 2002-04-13 Ravi Pratap <ravi@ximian.com>
6557 * class.cs (DefineType): Ensure that we do a proper check on
6558 attribute types and also register it with the TypeManager.
6560 (TypeContainer.Targets): The default for attribute types is
6561 AttributeTargets.All.
6563 * attribute.cs (ApplyAttributes): Registering the attribute type
6564 is done elsewhere, not when we discover we have a Usage attribute.
6566 2002-04-12 Ravi Pratap <ravi@ximian.com>
6568 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6569 and get rid of is_delegate parameter.
6571 * everywhere : update.
6573 2002-04-12 Ravi Pratap <ravi@ximian.com>
6575 * cs-parser.jay (compilation_unit): Revamp completely to use
6576 some new ideas that I got from Rhys' grammar to solve the problems
6577 with assembly level attributes.
6579 (outer_declaration): New grammar production.
6581 (attribute_sections): Add.
6583 (opt_attributes): Base on attribute_sections
6585 (namespace_declaration): Allow opt_attributes to tackle the case
6586 when we have assembly level attributes - we are clever in this
6589 * attribute.cs (ApplyAttributes): Do not worry about assembly
6590 attributes in the non-global context.
6592 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6593 instead of SetGlobalAttributes.
6595 * class.cs, rootcontext.cs : Ensure we define and generate
6596 attribute types before anything else.
6598 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6599 and flag the new error -20 for the case when the attribute type
6600 does not have valid targets specified. csc does not catch this.
6602 * ../errors/errors.txt : update for error # -20
6604 2002-04-11 Ravi Pratap <ravi@ximian.com>
6606 * support.cs (InternalParameters.ParameterModifier): Do some null
6607 checking and return sane values.
6609 * class.cs (Method.Define): If we are a PInvoke method, ensure
6610 that we are static and extern. Report error # 601
6612 * ../errors/cs0601.cs : Add test case for the above error.
6614 2002-04-07 Ravi Pratap <ravi@ximian.com>
6616 * rootcontext.cs (attribute_types): We need to keep type of
6617 all attribute types separately and emit code for them first.
6619 (RegisterAttribute) : Implement.
6621 * class.cs (DefineType): Check if the current Type is a custom
6622 attribute type and register it accordingly.
6624 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6625 adding the first attribute twice and rename to
6627 (SetGlobalAttributes): this.
6629 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6632 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6633 if we are processing global arguments. Hmm, I am unsure of this.
6635 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6637 * expression.cs: added static array of strings to avoid calling
6638 Enum.ToString () for Operator in Binary. Significant recover of
6641 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6643 * class.cs (FindMembers): Allow the Builders of the various
6644 members to be null. If they are skip them. This only happens
6645 during the PInvoke declaration.
6647 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6649 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6650 failure, so we do not keep going afterwards.
6652 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6653 wanted to pass `false' as the `is_delegate' argument. If this is
6654 the case, why not use delegate_type == null to mean `is_delegate =
6655 false' and anything else as is_delegate = true.
6657 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6659 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6660 code for the section, not the beginning of the tests.
6662 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6664 * cfold.cs: Handle operator + (Enum x, Underlying x)
6666 * expression.cs (Binary): same. Warn about errors where we have
6667 Enum/Enum in operator + as well.
6669 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6672 - added support for switch(bool)
6673 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6674 - add TableSwitchEmit() to handle table-based switch statements
6676 2002-04-05 Ravi Pratap <ravi@ximian.com>
6678 * expression.cs (Invocation.OverloadResolve): Factor out code which
6679 does parameter compatibility checking with arguments so that we can
6680 re-use the code even from Delegate.VerifyApplicability
6682 (VerifyArgumentsCompat): Move above code here.
6684 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6685 and instead make a call to the above method.
6687 2002-03-31 Ravi Pratap <ravi@ximian.com>
6689 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6690 We use it to keep track of classes which are attribute types.
6692 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6694 * delegate.cs (Delegate.Define): Correctly define the types in the
6695 presence of fixed and array parameters.
6697 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6700 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6701 include NonPublic after the first iteration.
6703 * class.cs (Indexer.CheckBase): Only check if both parents are
6706 * cs-parser.jay (accessor_body): If empty, set to null.
6708 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6709 same code path here to resolve constants names that we did have in
6710 MemberAccess.DoResolve. There is too much code duplicated here.
6712 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6714 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6716 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6719 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6720 tokens, numbers and strings.
6722 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6725 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6726 asyncronous parameters and the regular parameters.
6728 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6729 specify the target directory.
6731 * expression.cs: (This.DoResolve): Simplify
6732 (As.Emit): Optimize, do not generate IsInst if the expression is
6733 always of the given type.
6735 (Is.DoResolve): Bug fix, we were reporting both always/never for
6738 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6739 creating too many unnecessary arrays.
6741 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6743 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6744 fields instead of rolling our own initializer. Takes care of all
6745 implicit conversions, and drops unnecessary static checks/argument.
6747 2002-03-31 Dick Porter <dick@ximian.com>
6749 * driver.cs: use the GetDirectories() return values properly, and
6750 use "/" as path separator.
6752 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6754 * expression.cs (Unary): Optimize - - expr into expr.
6755 (Binary): Optimize a + (-b) into a -b.
6757 * codegen.cs (CodeGen): Made all methods static.
6759 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6763 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6764 TypeBuilder property.
6766 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6769 * tree.cs: Removed the various RecordXXXX, and replaced with a
6770 single RecordDecl. Removed all the accessor methods, and just
6771 left a single access point Type
6773 * enum.cs: Rename DefineEnum to DefineType.
6775 * decl.cs: New abstract method `DefineType' used to unify the
6776 Defines for Enumerations, Interfaces, TypeContainers and
6779 (FindType): Moved LookupInterfaceOrClass here. Moved the
6780 LookupBaseClasses method that used to live in class.cs and
6781 interface.cs here, and renamed to FindType.
6783 * delegate.cs: Implement DefineType. Take advantage of the
6784 refactored pattern for locating the parent builder without taking
6785 the parent_builder argument (which we know does not work if we are
6786 nested, and triggering a toplevel definition).
6788 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6790 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6791 accessibility of a member has changed during override and report
6794 * class.cs (Method.Define, Property.Define): Only complain on
6795 overrides if the method is private, any other accessibility is
6796 fine (and since we just checked the permission is the same, we are
6799 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6800 and elif are processed always. The other pre-processing
6801 directives are only processed if we are "taking" the path
6803 2002-03-29 Martin Baulig <martin@gnome.org>
6805 * class.cs (Method.Emit): Only emit symbolic debugging info if the
6806 current location is not Null.
6808 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6809 a separate method so we can profile it.
6811 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6812 `span.Seconds' are just seconds, but no minutes or hours.
6813 (MainDriver): Profile the CodeGen.SaveSymbols calls.
6815 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6817 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6818 Remove the gratuitous set of Final:
6820 // If an interface implementation, then we can set Final.
6821 if (((flags & MethodAttributes.Abstract) == 0) &&
6822 implementing.DeclaringType.IsInterface)
6823 flags |= MethodAttributes.Final;
6825 I do not know what I was smoking when I used that.
6828 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6829 step into fixing the name resolution issues for delegates and
6830 unifying the toplevel name resolution.
6832 2002-03-28 Martin Baulig <martin@gnome.org>
6834 * class.cs (Method.Emit): If we have a symbol writer, call its
6835 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6836 tell it about the current method.
6838 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6839 writer that we're going to emit the first byte of IL code for a new
6840 statement (a new source line).
6841 (EmitContext.EmitTopBlock): If we have a symbol writer, call
6842 EmitContext.Mark() before emitting any code.
6844 * location.cs (SymbolDocument): Return null when we're Null.
6846 * statement.cs (Statement): Moved the `Location loc' variable here.
6847 (Statement.EmitBoolExpression): If we have a symbol writer, call
6848 ec.Mark() before emitting any code to tell it that we're at the
6849 beginning of a new statement.
6850 (StatementExpression): Added `Location' argument to the constructor.
6851 (Block): Added public readonly variable `StartLocation' and public
6852 variable `EndLocation'. The latter is to be set using SetEndLocation().
6853 (Block): Added constructor which takes a start and end location.
6854 (Block.SetEndLocation): New method. This sets the end location.
6855 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6856 local variables we create.
6857 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6858 each statement and do also mark the begin and end of the block.
6860 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6861 tell it the current lexer.Location, use Location.Null for the end of the
6863 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6864 current block, set its end location using SetEndLocation().
6865 (statement_expression): StatementExpression constructor now takes the
6866 lexer.Location as additional argument.
6867 (for_statement, declare_local_variables): Likewise.
6868 (declare_local_variables): When creating a new implicit block, use the
6869 new Block constructor and pass it the lexer.Location.
6871 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6873 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6874 members also on the parent interfaces recursively.
6876 2002-03-27 Miguel de Icaza <miguel@ximian.com>
6878 * report.cs: Use new formats, since Gonzalo finished the missing
6881 * expression.cs (Binary.ResolveOperator): added missing operator|
6882 operator& and operator^ for bool/bool.
6884 * cs-parser.jay: CheckDef now takes a Location argument that is
6885 used to report errors more precisly (instead of reporting the end
6886 of a definition, we try to track something which is a lot closer
6887 to the source of the problem).
6889 * cs-tokenizer.cs: Track global token use, so we can properly flag
6890 the use of #define/#undef after the first token has been seen.
6892 Also, rename the reportXXXX to Error_DescriptiveName
6894 * decl.cs (DeclSpace.IsTopLevel): Move property here from
6895 TypeContainer, so that Enum and Interface can use this too.
6897 * class.cs (TypeContainer.LookupInterfaceOrClass,
6898 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6899 `builder' argument. Typically this was used to pass the parent
6900 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6903 The problem is that a nested class could trigger the definition of
6904 a toplevel class, and the builder would be obviously wrong in that
6907 So we drop this argument, and we compute dynamically the
6908 TypeBuilder/ModuleBuilder (the correct information was available
6909 to us anyways from DeclSpace.Parent)
6911 * interface.cs (Interface.DefineInterface): Drop builder
6912 parameter cleanup like class.cs
6914 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
6917 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6920 (Try.Emit): Propagate the returns value from the statement.
6922 (Return.Emit): Even if we are leavning
6924 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6926 * modifiers.cs: Fix the computation of MethodAttributes flags.
6928 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6930 * driver.cs: allow compilation of files that start with '/'.
6931 Add a default case when checking the argument of --target.
6933 2002-03-25 Miguel de Icaza <miguel@ximian.com>
6935 * interface.cs: Implement the same search algorithm for types in
6938 * delegate.cs: Do not allow multiple definition.
6940 * Recovered ChangeLog that got accidentally amputated
6942 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6944 * rootcontext.cs: Load manually enum to allow core classes to
6945 contain enumerations.
6947 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6948 Update to new static methods in TypeManager.
6950 * typemanager.cs (GetMethod, GetConstructor): Use our
6951 implementation of FindMembers to find the members, since during
6952 corlib compilation, the types are TypeBuilders and GetMethod and
6953 GetConstructor do not work.
6955 Make all methods in TypeManager static.
6957 (InitCodeHelpers): Split the functionality from
6958 the InitCodeTypes function.
6960 * driver.cs: Call InitCodeHelpers after we have populated the
6963 * cs-parser.jay (delegate_declaration): we did not used to compute
6964 the delegate name correctly for void delegates.
6966 2002-03-24 Miguel de Icaza <miguel@ximian.com>
6968 * rootcontext.cs (RootContext): Init the interface_resolve_order
6969 and type_container_resolve_order always.
6971 (ResolveCore, BootstrapCorlib_ResolveClass,
6972 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6973 compiler when compiling with --nostdlib
6975 * class.cs (TypeContainer.DefineType): Check that our parent is
6976 not null. This test is most important when we are bootstraping
6979 * codegen.cs: Split out the symbol writing code.
6981 2002-03-25 Martin Baulig <martin@gnome.org>
6983 * driver.cs (-g): Made -g an alias for --debug.
6985 2002-03-24 Martin Baulig <martin@gnome.org>
6987 * codegen.cs (SymbolWriter): New public variable. Returns the
6988 current symbol writer.
6989 (CodeGen): Added `bool want_debugging_support' argument to the
6990 constructor. If true, tell the ModuleBuild that we want debugging
6991 support and ask it for the ISymbolWriter.
6992 (Save): If we have a symbol writer, call it's Close() method after
6993 saving the assembly.
6995 * driver.c (--debug): New command line argument to create a
6996 debugger information file.
6998 * location.cs (SymbolDocument): New public property. Returns an
6999 ISymbolDocumentWriter object for the current source file or null
7000 if we don't have a symbol writer.
7002 2002-03-21 Miguel de Icaza <miguel@ximian.com>
7004 * driver.cs (LoadAssembly): Correctly return when all the paths
7005 have been tried and not before.
7007 * statement.cs (Switch.Emit): return the actual coverage for this
7008 statement (returns/not-returns)
7010 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7011 switch of the statement if we are the last switch section. That
7012 kills two problems: try/catch problems (we used to emit an empty
7013 nop at the end) and switch statements where all branches would
7016 2002-03-19 Miguel de Icaza <miguel@ximian.com>
7018 * driver.cs: Add default assemblies (the equivalent to the
7019 Microsoft CSC.RSP file)
7021 * cs-tokenizer.cs: When updating `cols and setting it to zero,
7022 also update tokens_seen and set it to false.
7024 * driver.cs: Implement --recurse for Mike.
7026 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7027 correctly splitting out the paths.
7029 2002-03-18 Miguel de Icaza <miguel@ximian.com>
7031 * interface.cs (Interface.PopulateProperty): Instead of using
7032 `parent' as the declaration space for the set parameters, use
7035 * support.cs (InternalParameters): InternalParameters constructor
7036 takes a DeclSpace instead of a TypeContainer.
7038 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7039 types are being initialized, load the address of it before calling
7042 (New): Provide a mechanism to disable the generation of local
7043 value type temporaries when the caller will be providing us with
7044 an address to store it.
7046 (ArrayCreation.EmitDynamicInitializers): Use it.
7048 2002-03-17 Miguel de Icaza <miguel@ximian.com>
7050 * expression.cs (Invocation.EmitArguments): Only probe for array
7051 property if there is more than one argument. Sorry about that.
7053 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7056 * class.cs (Method.LabelParameters): Fix incorrect code path that
7057 prevented the `ParamArrayAttribute' from being applied to the
7060 2002-03-16 Miguel de Icaza <miguel@ximian.com>
7062 * support.cs (ReflectionParameters): Correctly compute whether the
7063 last argument is a params array. Fixes the problem with
7066 * typemanager.cs: Make the assemblies array always be non-null
7067 (empty, but non-null)
7069 * tree.cs (RecordDecl): New function that abstracts the recording
7070 of names. This reports error 101, and provides a pointer to the
7071 previous declaration. Fixes a crash in the compiler.
7073 * cs-parser.jay (constructor_declaration): Update to new grammar,
7074 and provide a constructor_body that can be empty.
7076 2002-03-15 Miguel de Icaza <miguel@ximian.com>
7078 * driver.cs: Add support for --resources.
7080 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7081 Make all types for the various array helper methods be integer.
7083 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7084 CheckState to ConvCast.
7086 (ConvCast): Now it takes a `checked' state argument, to avoid
7087 depending on the emit context for the conversion, and just using
7088 the resolve time setting.
7090 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7091 instead of Invocation.EmitArguments. We do not emit the original
7092 arguments, instead we emit those which have been converted to
7093 unsigned int expressions.
7095 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7097 * codegen.cs: ditto.
7099 * expression.cs (LocalVariableReference): Drop the use of the
7100 Store function that depended on the variable index.
7102 * statement.cs (VariableInfo): Drop the `Idx' property from this
7103 class, as this is not taking into account the indexes for
7104 temporaries tat we generate during the execution, getting the
7107 * class.cs: First emit class initializers, then call the parent
7110 * expression.cs (Binary): Fix opcode emision.
7111 (UnaryMutator.EmitCode): Support checked code generation
7113 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7114 matches for events for both the Static and Instance scans,
7115 pointing to the same element. Fix that.
7117 2002-03-14 Miguel de Icaza <miguel@ximian.com>
7119 * rootcontext.cs (ResolveTree): Always set the
7120 interface_resolve_order, because nested interfaces will be calling
7123 * class.cs (GetInterfaceOrClass): Track the same resolution
7124 process used by TypeManager.LookupType. This fixes the nested
7125 type lookups in class declarations (separate path from
7128 (TypeContainer.DefineType): Also define nested interfaces.
7129 (TypeContainer.RegisterOrder): New public function used to
7130 register the order in which child interfaces need to be closed.
7132 Nested interfaces need to be closed after their parents have been
7135 * interface.cs (InterfaceAttr): Put all the logic for computing
7136 the interface attribute here.
7138 (DefineInterface): Register our interface order with the
7139 RootContext or with the TypeContainer depending on the case.
7141 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7143 * cs-parser.jay: rework foreach statement to work with the new
7144 changes to the policy on SimpleNames.
7146 * report.cs: support Stacktrace on warnings as well.
7148 * makefile: drop --unsafe and /unsafe from the compile.
7150 2002-03-13 Ravi Pratap <ravi@ximian.com>
7152 * ecore.cs (StandardConversionExists): Modify to take an Expression
7153 as the first parameter. Ensure we do null -> reference type conversion
7156 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7157 temporary Expression objects.
7159 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7161 * interface.cs: workaround bug in method overloading resolution
7162 (there is already a bugzilla bug for it).
7164 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7166 We could also solve this problem by having a separate path for
7167 performing type lookups, instead of DoResolve, we could have a
7168 ResolveType entry point, and only participating pieces of the
7169 production (simplename, deref, array) would implement this.
7171 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7172 signal SimpleName to only resolve type names and not attempt to
7173 resolve anything else.
7175 * expression.cs (Cast): Set the flag.
7177 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7179 * class.cs: Only report 108 if there is no `new' modifier.
7181 * cs-parser.jay: rework foreach statement to work with the new
7182 changes to the policy on SimpleNames.
7184 * report.cs: support Stacktrace on warnings as well.
7186 * makefile: drop --unsafe and /unsafe from the compile.
7188 2002-03-11 Miguel de Icaza <miguel@ximian.com>
7190 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7191 lookups here, instead of doing that at parse time. This means
7192 that our grammar will not introduce `LocalVariableReferences' as
7193 expressions at this point. That solves the problem of code like
7201 This is only half the fix. The full fix requires parameters to
7202 also be handled in this way.
7204 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7205 makes the use more obvious of the DeclSpace. The
7206 ec.TypeContainer.TypeBuilder is now only used to pull the
7209 My theory is that I can get rid of the TypeBuilder completely from
7210 the EmitContext, and have typecasts where it is used (from
7211 DeclSpace to where it matters).
7213 The only pending problem is that the code that implements Aliases
7214 is on TypeContainer, and probably should go in DeclSpace.
7216 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7217 lookups here, instead of doing that at parse time. This means
7218 that our grammar will not introduce `LocalVariableReferences' as
7219 expressions at this point. That solves the problem of code like
7227 This is only half the fix. The full fix requires parameters to
7228 also be handled in this way.
7230 * class.cs (Property.DefineMethod): When implementing an interface
7231 method, set newslot, when implementing an abstract method, do not
7232 set the flag (before we tried never setting it, or always setting
7233 it, which is the difference).
7234 (Indexer.DefineMethod): same.
7235 (Method.DefineMethod): same.
7237 * ecore.cs: Only set the status used flag if we get back a Field.
7239 * attribute.cs: Temporary hack, so Paolo can keep working.
7241 2002-03-08 Ravi Pratap <ravi@ximian.com>
7243 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7244 the unmanaged type in the case we have a MarshalAs attribute.
7246 (Resolve): Handle the case when we are parsing the special MarshalAs
7247 attribute [we need to store the unmanaged type to use later]
7249 * typemanager.cs (marshal_as_attr_type): Built in type for the
7250 MarshalAs Attribute.
7252 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
7253 on parameters and accordingly set the marshalling info.
7255 2002-03-09 Miguel de Icaza <miguel@ximian.com>
7257 * class.cs: Optimizing slightly by removing redundant code after
7258 we switched to the `NoTypes' return value.
7259 (Property.DefineMethod): use NoTypes here too.
7261 This fixes the bug I introduced in my last batch of changes.
7263 2002-03-05 Ravi Pratap <ravi@ximian.com>
7265 * tree.cs (RecordEnum): Add. We now keep track of enums too.
7267 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7268 Enums since those are types too.
7270 * cs-parser.jay (enum_declaration): Record enums as we parse them.
7272 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
7273 thanks to a call during the lookup process.
7275 2002-03-07 Miguel de Icaza <miguel@ximian.com>
7277 * statement.cs (Foreach): Lots of work to accomodate a particular
7278 kind of foreach statement that I had not kept in mind. It is
7279 possible to have foreachs on classes that provide a GetEnumerator
7280 method that return objects that implement the "pattern" for using
7281 a foreach, there is no need to support GetEnumerator
7284 This is needed to compile nant.
7286 * decl.cs: Only report 114 if the member is not `Finalize' and if
7287 the warning level is at least 2.
7289 * class.cs: Moved the compare function from Method to
7292 (MethodSignature.InheritableMemberSignatureCompare): Add new
7293 filter function that is used to extract inheritable methods from a
7296 (Method.Define): Use the new `inheritable_method_signature_filter'
7299 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7302 2002-03-06 Miguel de Icaza <miguel@ximian.com>
7304 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7306 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7308 * expression.cs: Pass location information to
7309 ConvertImplicitStandard.
7311 * class.cs: Added debugging code to track return values from
7314 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7316 * expression.cs (Is.DoResolve): If either side of the `is' is an
7317 interface, do not flag the warning.
7319 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7322 * report.cs: Allow for --fatal to be used with --probe.
7324 * typemanager.cs (NoTypes): Move the definition for the empty Type
7327 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7329 (TypeContainer.DefineProxy): New function used to proxy to parent
7330 implementations when implementing interfaces.
7331 (TypeContainer.ParentImplements): used to lookup if our parent
7332 implements a public function that is required by an interface.
7333 (TypeContainer.VerifyPendingMethods): Hook this up.
7335 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7336 `modules' and `assemblies' arraylists into arrays. We only grow
7337 these are the very early start up of the program, so this improves
7338 the speedof LookupType (nicely measured).
7340 * expression.cs (MakeByteBlob): Replaced unsafe code with
7341 BitConverter, as suggested by Paolo.
7343 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7344 folding of string concatenation, but if either side is a string,
7345 and the other is not, then return null, and let the runtime use
7346 the concatenation on the string plus the object (using
7349 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7351 Constant Folding has been implemented now.
7353 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7354 the error instead on types that are not supported in one's
7357 * constant.cs (Constant and all children): New set of functions to
7358 perform implict and explicit conversions.
7360 * ecore.cs (EnumConstant): Implement the new functions to perform
7361 conversion by proxying to the child expression.
7363 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7364 own separate setting that can not be turned off from the command
7365 line using --unchecked or --checked and is only controlled using
7366 the checked/unchecked statements and expressions. This setting is
7367 used by the constant folder to flag errors.
7369 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7370 ConstantCheckState as well.
7372 During Resolve, they also have to flag the state, because the
7373 constant folder runs completely in the Resolve phase.
7375 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7378 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7380 * cfold.cs: New file, this file contains the constant folder.
7382 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7383 argument to track whether we are using the resulting address to
7384 load or store a value and provide better error messages.
7386 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7387 new AddressOf arguments.
7389 * statement.cs (Foreach.EmitCollectionForeach): Update
7391 * expression.cs (Argument.Emit): Call AddressOf with proper
7392 arguments to track usage.
7394 (New.DoEmit): Call AddressOf with new arguments.
7396 (Unary.Emit): Adjust AddressOf call.
7398 2002-03-01 Ravi Pratap <ravi@ximian.com>
7400 * cs-parser.jay (member_access): Change the case for pre-defined types
7401 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7404 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7407 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7408 essentially like methods and apply attributes like MethodImplOptions to them too.
7410 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7413 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7414 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7417 * Update code everywhere accordingly.
7419 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7421 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7423 2002-02-28 Ravi Pratap <ravi@ximian.com>
7425 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7426 try performing lookups against those instead of jumping straight into using
7427 the 'using' clauses.
7429 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7431 (LookupType): Perform lookups in implicit parents too.
7433 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7434 sequence as RootContext.LookupType.
7436 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7437 the various cases of namespace lookups into this method.
7439 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7441 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7442 in positional arguments)
7444 * class.cs (Operator): Update the AllowedModifiers to contain
7447 * cs-parser.jay: Update operator declaration to allow for the
7448 operator body to be empty.
7450 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7453 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7455 * class.cs (Method.Emit): Label parameters.
7457 * driver.cs: Return 1 or 0 as the program exit code.
7459 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7461 * expression.cs: Special case the `null' object when trying to
7462 auto-compute the type, as anything can be explicitly converted to
7465 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7466 spotting this Paolo.
7468 (Expression.ImplicitNumericConversion): Perform comparissions of
7469 the type using the underlying type in the case of an enumeration
7470 rather than using the enumeration type for the compare.
7472 Cope with the underlying == type case, which is not possible to
7475 (Expression.ConvertNumericExplicit): Perform comparissions of
7476 the type using the underlying type in the case of an enumeration
7477 rather than using the enumeration type for the compare.
7479 * driver.cs: If the user does not supply an extension, assume .exe
7481 * cs-parser.jay (if_statement): Rewrote so that we can track the
7482 location for the if statement.
7484 * expression.cs (Binary.ConstantFold): Only concat strings when
7485 the operation is "+", not everything ;-)
7487 * statement.cs (Statement.EmitBoolExpression): Take a location
7489 (If, While, Do): Track location.
7491 * expression.cs (Binary.ResolveOperator): In the object + string
7492 case, I was missing a call to ConvertImplicit
7494 2002-02-25 Ravi Pratap <ravi@ximian.com>
7496 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7497 Location arguments. Ensure we use RootContext.LookupType to do our work
7498 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7500 * interface.cs (PopulateMethod): Handle the type of the parameter being
7503 * expression.cs (Invocation.BetterFunction): Handle the case when we
7504 have a params method with no fixed arguments and a call is made with no
7507 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7509 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7510 the verbatim-string-literal
7512 * support.cs (InternalParameters.ParameterModifier): handle null
7514 (InternalParameters.ParameterType): ditto.
7516 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7517 duplicating the name of the variable parameter.
7518 (GetParameterByName): Fix bug where we were not looking up array
7519 paramters if they were the only present (thanks Paolo!).
7520 (GetParameterInfo): We only have an empty set of types if both
7521 fixed and array are set to null.
7522 (GetParameterInfo-idx): Handle FixedParameter == null
7524 * cs-parser.jay: Handle the case where there is no catch
7525 statements (missing null test).
7527 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7529 * driver.cs (MainDriver): Be conservative on our command line
7532 Catch DirectoryNotFoundException when calling GetFiles.
7534 (SplitPathAndPattern): Used to split the input specification into
7535 a path and a pattern that we can feed to Directory.GetFiles.
7537 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7539 * statement.cs (Fixed): Implement the last case of the Fixed
7540 statement (string handling).
7542 * expression.cs (StringPtr): New class used to return a char * to
7543 a string; Used by the Fixed statement.
7545 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7547 * expression.cs (Binary.ResolveOperator): Remove redundant
7548 MemberLookup pn parent type.
7549 Optimize union call, we do not need a union if the types are the same.
7550 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7553 Specialize the use of MemberLookup everywhere, instead of using
7554 the default settings.
7556 (StackAlloc): Implement stackalloc keyword.
7558 * cs-parser.jay: Add rule to parse stackalloc.
7560 * driver.cs: Handle /h, /help, /?
7562 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7563 before we supported unsafe code.
7565 * makefile: add --unsafe to the self compilation of mcs.
7567 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7569 * expression.cs (PointerArithmetic): New class that is used to
7570 perform pointer arithmetic.
7571 (Binary.Resolve): Handle pointer arithmetic
7572 Handle pointer comparission.
7573 (ArrayPtr): Utility expression class that is used to take the
7574 address of an array.
7576 (ElementAccess): Implement array access for pointers
7578 * statement.cs (Fixed): Implement fixed statement for arrays, we
7579 are missing one more case before we are done.
7581 * expression.cs (Indirection): Implement EmitAssign and set the
7582 ExprClass to Variable. This allows pointer dereferences to be
7583 treated as variables, and to have values assigned to them.
7585 * ecore.cs (Expression.StoreFromPtr): New utility function to
7586 store values dereferencing.
7588 2002-02-20 Ravi Pratap <ravi@ximian.com>
7590 * expression.cs (Binary.ResolveOperator): Ensure that we are
7591 not trying to operate on a void type - this fixes the reported
7594 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7595 the parent implementation is sealed.
7597 * ../errors/cs0239.cs : Add.
7599 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7601 * typemanager.cs (unverifiable_code_type): Corresponds to
7602 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7603 which have unsafe code in them.
7605 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7608 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7610 * cs-tokenizer.cs: Add support for @"litreal strings"
7612 Make tokenizer accept pre-processor directives
7613 on any column (remove the old C-like limitation).
7615 * rootcontext.cs (EmitCode): Emit any global attributes.
7616 (AddGlobalAttributes): Used to keep track of assembly attributes.
7618 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7620 * cs-parser.jay: Add support for global attributes.
7622 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7624 * expression.cs (Indirection): New helper class. Unary will
7625 create Indirection classes to be able to implement the
7626 IMemoryLocation interface on it.
7628 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7630 * cs-parser.jay (fixed_statement): reference the right statement.
7632 * statement.cs (Fixed.Emit): Finish implementing the fixed
7633 statement for the &x case.
7635 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7637 * class.cs (Property.Define, Method.Define): Remove newslot when
7640 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7641 wrong. NewSlot should only be used if the `new' keyword is present.
7643 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7644 locating our system dir. Sorry about this.
7646 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7648 * driver.cs (GetSystemDir): Compute correctly the location of our
7649 system assemblies. I was using the compiler directory instead of
7650 the library directory.
7652 2002-02-13 Ravi Pratap <ravi@ximian.com>
7654 * expression.cs (BetterFunction): Put back in what Miguel commented out
7655 since it is the correct fix. The problem is elsewhere ;-)
7657 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7658 parameters of the parms method are themselves compatible or not !
7660 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7661 to check that a class implements an interface before saying that an implicit
7662 conversion was allowed. Use ImplementsInterface to do the checking.
7664 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7666 * class.cs (Method.Define): Track whether we are an explicit
7667 implementation or not. And only call DefineMethodOverride if we
7668 are an explicit implementation.
7670 (Property.DefineMethod): Ditto.
7672 2002-02-11 Ravi Pratap <ravi@ximian.com>
7674 * expression.cs (BetterFunction): Catch hideous bug which was
7675 preventing us from detecting ambiguous calls due to implicit casts i.e
7678 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7680 * support.cs (Pair): Remove un-needed method. I figured why I was
7681 getting the error in cs-parser.jay, the variable in a foreach loop
7682 is readonly, and the compiler does not really treat this as a variable.
7684 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7685 instead of EQUALS in grammar.
7687 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7689 * expression.cs (Unary.DoResolve): Check whether the argument is
7692 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7694 * support.cs: Api for Pair to set a value. Despite the fact that
7695 the variables are public the MS C# compiler refuses to compile
7696 code that accesses the field if the variable is part of a foreach
7699 * statement.cs (Fixed): Begin implementation of the fixed
7702 (Block.AddVariable): Return the VariableInfo on success and null
7703 on failure instead of true/false.
7705 * cs-parser.jay (foreach): Catch errors on variables already
7706 defined (we were ignoring this value before) and properly unwind
7709 (fixed_statement): grammar for the fixed statement.
7711 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7713 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7714 pointer types to be incretemented.
7716 (SizeOf): Implement.
7718 * cs-parser.jay (pointer_member_access): Implement
7719 expr->IDENTIFIER production.
7721 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7722 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7725 (Unary): Implement indirection.
7727 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7728 use in non-unsafe context).
7730 (SimpleName.DoResolve): Check for pointers in field access on safe
7733 (Expression.LoadFromPtr): Factor the load-indirect code in this
7734 function. This was duplicated in UnboxCast and ParameterReference
7736 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7738 * expression.cs (ComposedCast): report an error if a pointer cast
7739 is used in a safe region.
7741 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7742 pointer type casts in unsafe context.
7744 * codegen.cs (EmitContext): Set up IsUnsafe.
7746 * cs-parser.jay (non_expression_type): Add productions for pointer
7749 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7750 code. We should not use force into static mode if the method is
7751 not virtual. Fixes bug in MIS
7753 * statement.cs (Do.Emit, While.Emit, For.Emit,
7754 Statement.EmitBoolExpression): Add support to Do and While to
7755 propagate infinite loop as `I do return' semantics.
7757 Improve the For case to also test for boolean constants.
7759 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7760 to the list of attributes we can add.
7762 Remove `EmitContext' argument.
7764 * class.cs (Method.Define): Apply parameter attributes.
7765 (Constructor.Define): Apply parameter attributes.
7766 (MethodCore.LabelParameters): Move here the core of labeling
7769 * support.cs (ReflectionParameters.ParameterModifier,
7770 InternalParameters.ParameterModifier): Use IsByRef on the type and
7771 only return the OUT bit for these parameters instead of in/out/ref
7774 This is because I miss-understood things. The ParameterInfo.IsIn
7775 and IsOut represent whether the parameter has the [In] and [Out]
7778 2002-01-22 Miguel de Icaza <miguel@ximian.com>
7780 * ecore.cs (FieldExpr.Emit): Release temporaries.
7782 * assign.cs (LocalTemporary.Release): new function.
7784 * codegen.cs (EmitContext.GetTemporaryStorage,
7785 EmitContext.FreeTemporaryStorage): Rework the way we deal with
7786 temporary storage. Now we can "put back" localbuilders when we
7789 2002-01-21 Miguel de Icaza <miguel@ximian.com>
7791 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7792 need to make a copy of the variable to generate verifiable code.
7794 2002-01-19 Miguel de Icaza <miguel@ximian.com>
7796 * driver.cs: Compute dynamically the system directory.
7798 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7799 Slower, but more generally useful. Used by the abstract
7800 registering implementation.
7802 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7803 the rules for the special rule on Type/instances. First check if
7804 we have the same name, and if so, try that special static path
7805 rather than the instance path.
7807 2002-01-18 Miguel de Icaza <miguel@ximian.com>
7809 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7812 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7813 Enum, ValueType, Delegate or Array for non-corlib compiles.
7815 * cs-tokenizer.cs: Catch long identifiers (645)
7817 * typemanager.cs (IndexerPropetyName): Ravi never tested this
7820 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7821 fix, we were returning too early, so we were not registering
7822 pending methods from abstract classes.
7824 Do not register pending methods if the class is abstract.
7826 * expression.cs (Conditional.DoResolve): Report circular implicit
7827 conversions when we neecd to compute it for conditional
7830 (Is.DoResolve): If the expression is always of the provided type,
7831 flag warning 183. If the expression can not ever be of the
7832 provided type flag warning 184.
7834 * class.cs: Catch 169 as well.
7836 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7839 2002-01-18 Nick Drochak <ndrochak@gol.com>
7841 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
7843 2002-01-17 Miguel de Icaza <miguel@ximian.com>
7845 * interface.cs: (PopulateMethod): Check for pointers being defined
7846 only if the unsafe context is active.
7847 (PopulateProperty): ditto.
7848 (PopulateIndexer): ditto.
7850 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7851 specified. If pointers are present, make sure that they are
7852 present in an unsafe context.
7853 (Constructor, Constructor.Define): ditto.
7854 (Field, Field.Define): ditto.
7855 (Property, Property.Define): ditto.
7856 (Event, Event.Define): ditto.
7858 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7859 hashtable if there are classes or structs defined.
7861 * expression.cs (LocalVariableReference.DoResolve): Simplify this
7862 code, as the constant resolution moved.
7864 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7865 the metadata, so we can flag error 133.
7867 * decl.cs (MemberCore.UnsafeOK): New function to test that a
7868 pointer is being declared in an unsafe context.
7870 2002-01-16 Miguel de Icaza <miguel@ximian.com>
7872 * modifiers.cs (Modifiers.Check): Require a Location argument.
7873 Report error 227 for Unsafe use.
7875 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7877 * statement.cs (For.Emit): If the test is null, then report that
7878 we do `return', as we wont reach anything afterwards.
7880 (Switch.SwitchGoverningType): Track the expression that matched
7883 * driver.cs: Allow negative numbers as an error code to flag.
7885 * cs-parser.jay: Handle 1551.
7887 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7889 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7891 * cs-parser.jay: Report 1518 (type declaration can only contain
7892 class, struct, interface, enum or delegate)
7894 (switch_label): Report 1523 (keywords `case' or `default' must
7897 (opt_switch_sections): Report 1522 (empty switch)
7899 * driver.cs: Report 1515 (response file specified multiple times)
7900 Report 1516 (Source file specified multiple times).
7902 * expression.cs (Argument.Resolve): Signal 1510
7904 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7905 access not allowed in static code)
7907 2002-01-11 Ravi Pratap <ravi@ximian.com>
7909 * typemanager.cs (IsPointerType): Utility method which we are going
7912 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7913 the object type, so we take care of that.
7915 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7917 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7918 added to non-params parameters :-)
7920 * typemanager.cs (CSharpName): Include 'void' type too.
7922 (void_ptr_type): Include in the set of core types.
7924 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
7927 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
7930 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
7931 completely forgotten about it.
7933 2002-01-10 Ravi Pratap <ravi@ximian.com>
7935 * cs-parser.jay (pointer_type): Add. This begins our implementation
7936 of parsing rules for unsafe code.
7938 (unsafe_statement): Implement.
7940 (embedded_statement): Modify to include the above.
7942 * statement.cs (Unsafe): Implement new class for unsafe blocks.
7944 * codegen.cs (EmitContext.InUnsafe): Add. This determines
7945 if the current context is an unsafe one.
7947 * cs-parser.jay (local_variable_pointer_type): Since local variable types
7948 are handled differently, we need separate rules for them.
7950 (local_variable_declaration): Update to use local_variable_pointer_type
7951 to allow variable declarations of unmanaged pointer types.
7953 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7956 * ../errors/cs0214.cs : Add.
7958 2002-01-16 Nick Drochak <ndrochak@gol.com>
7960 * makefile: remove 'response' file when cleaning.
7962 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7964 * cs-parser.jay: Report 1524.
7966 2002-01-14 Miguel de Icaza <miguel@ximian.com>
7968 * typemanager.cs (RegisterMethod): drop checking if we have
7969 registered this from here
7971 2002-01-12 Miguel de Icaza <miguel@ximian.com>
7973 * class.cs (Method.EmitDestructor): Implement calling our base
7976 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7979 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7980 this routine and will wrap the call in a try/catch block. Deal
7983 2002-01-11 Miguel de Icaza <miguel@ximian.com>
7985 * ecore.cs (Expression.MemberLookup): instead of taking a
7986 parameter `same_type' that was used to tell whether we could
7987 access private members we compute our containing type from the
7990 (FieldExpr): Added partial support for volatile fields. This does
7991 not work for volatile fields exposed from assemblies, as I can not
7992 figure out how to extract the modreq from it.
7994 Updated all the source files to use this.
7996 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7997 because it is referenced by MemberLookup very often.
7999 2002-01-09 Ravi Pratap <ravi@ximian.com>
8001 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8002 TypeBuilder.GetCustomAttributes to retrieve what we need.
8004 Get rid of redundant default_member_attr_type as this is the same as
8005 default_member_type which already exists.
8007 * interface.cs, attribute.cs : Update accordingly.
8009 2002-01-08 Miguel de Icaza <miguel@ximian.com>
8011 * typemanager.cs: Enable IndexerPropertyName again. It does not
8012 work for TYpeBuilders though. Ravi, can you please fix this?
8014 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8016 * expression.cs (Argument.Emit): Handle the case of ref objects
8017 being passed to ref functions;
8019 (ParameterReference.EmitLoad): Loads the content of the pointer
8020 without dereferencing.
8022 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8024 * cs-tokenizer.cs: Implemented the pre-processing expressions.
8026 2002-01-08 Ravi Pratap <ravi@ximian.com>
8028 * class.cs (Indexer.DefineMethod): Incorporate the interface
8029 type in the name of the method if we are doing explicit interface
8032 * expression.cs (ConversionExists): Remove as it is completely obsolete.
8034 (BetterConversion): Fix extremely trivial bug where we were referring to
8035 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8038 * ../errors/bug16.cs : Add although we have fixed it.
8040 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8042 * expression.cs (BaseIndexer): Begin implementation.
8044 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8046 * cs-parser.jay (indexer_declarator): Use qualified_identifier
8047 production directly to remove a shift/reduce, and implement
8048 explicit interface implementation.
8050 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8051 after a floating point suffix.
8053 * expression.cs (DoNumericPromotions): Improved the conversion for
8054 uint/uint. If we have a constant, we avoid doing a typecast to a
8057 * class.cs (Indexer): Implement explicit interface implementation
8060 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8062 * class.cs: make the default instance constructor public and hidebysig.
8064 2001-01-03 Ravi Pratap <ravi@ximian.com>
8066 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8067 so we can call it from elsewhere.
8069 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8070 we emit it internally if the class has a defined indexer; otherwise the user
8071 emits it by decorating the class definition with the DefaultMemberAttribute.
8073 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8074 attribute is not used on a type which defines an indexer.
8076 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8077 character when we skip whitespace.
8079 * ../errors/cs0646.cs : Add.
8081 2002-01-03 Miguel de Icaza <miguel@ximian.com>
8083 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8086 * makefile: Add practical target `mcs3.exe' which builds the third
8087 generation compiler.
8089 * expression.cs (New): Fix structures constructor calling.
8091 * class.cs (Property, Method, Indexer): Emit Final flag on the
8092 method if we are an interface implementation and we are not
8095 * ecore.cs (PropertyExpr): New public field `IsBase', tells
8096 whether this property is referencing a `base' method.
8098 * expression.cs (Invocation.EmitCall): take an extra argument:
8099 is_base, this is used to determine whether the `call' or
8100 `callvirt' opcode should be used.
8103 * delegate.cs: update EmitCall.
8105 * class.cs (Method.Define): Set NewSlot for the cases where we are
8106 not implementing an interface method.
8108 (Property.Define): ditto.
8110 2002-01-02 Miguel de Icaza <miguel@ximian.com>
8112 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8113 'r'. Allows mcs to parse itself fully.
8115 2002-01-02 Ravi Pratap <ravi@ximian.com>
8117 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8118 of the number of initializers that require the InitializeArray method.
8120 (CheckIndices): Store the Expression in all cases - not the plain value. Also
8121 update the above field where necessary.
8123 (MakeByteBlob): Update accordingly.
8125 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
8128 (EmitDynamicInitializers): Update in accordance with the new optimization.
8130 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8131 same OpCode applies.
8133 * cs-parser.jay : Fix some glaring errors I introduced.
8135 2002-01-01 Ravi Pratap <ravi@ximian.com>
8137 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8138 so that we can check for name clashes there too.
8140 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8141 for interface indexers.
8143 * interfaces.cs (Define): Emit the default member attribute.
8145 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8146 variable was being referred to while setting the value ;-)
8148 2002-01-01 Miguel de Icaza <miguel@ximian.com>
8150 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8151 byte-by-byte information when we know the data is zero.
8153 Make the block always a multiple of 4, because
8154 DefineInitializedData has a bug.
8156 * assign.cs: Fix, we should assign from the temporary, not from
8159 * expression.cs (MakeByteBlob): Fix my incorrect code.
8161 2001-12-31 Miguel de Icaza <miguel@ximian.com>
8163 * typemanager.cs (EnumToUnderlying): This function is used to get
8164 the underlying type from an enumeration, because it does not
8167 * constant.cs: Use the I4_S form for values between -128 and 127.
8169 * statement.cs (Block.LookupLabel): Looks up a label.
8170 (Block): Drop support for labeled blocks.
8172 (LabeledStatement): New kind of statement that represents a label
8175 (Goto): Finally implement this bad boy.
8177 * cs-parser.jay: Update to reflect new mechanism to implement
8180 2001-12-30 Miguel de Icaza <miguel@ximian.com>
8182 * codegen.cs (EmitContext.This): a codegen property that keeps the
8183 a single instance of this instead of creating many different this
8186 * delegate.cs (Delegate.DoResolve): Update to use the property;
8188 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8190 * expression.cs (BaseAccess.DoResolve): Ditto.
8192 2001-12-29 Ravi Pratap <ravi@ximian.com>
8194 * typemanager.cs (methodimpl_attr_type): Add to hold the type
8195 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8197 (InitCoreTypes): Update accordingly.
8199 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8200 so we can quickly store the state.
8202 (ApplyAttributes): Set the correct implementation flags
8203 for InternalCall methods.
8205 2001-12-29 Miguel de Icaza <miguel@ximian.com>
8207 * expression.cs (EmitCall): if a method is not virtual, then do
8208 not use callvirt on it.
8210 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8211 user defined stuff) requires the use of stobj, which takes an
8212 address on the stack instead of an array and an index. So emit
8213 the Ldelema operation for it.
8215 (EmitStoreOpcode): Use stobj for valuetypes.
8217 (UnaryMutator.EmitCode): Use the right 1 value depending on
8218 whether we are dealing with int64/uint64, float or doubles.
8220 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8221 constructors that I implemented last night.
8223 (Constructor.IsDefault): Fix to work properly for static
8226 * cs-parser.jay (CheckDef): report method signature errors.
8227 Update error number 103 to be 132.
8229 * decl.cs: New AdditionResult enumeration value: MethodExists.
8230 Although we do this check for methods later on in the semantic
8231 analysis, catching repeated default constructors is so easy that
8232 we catch these here.
8234 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8237 (ParameterReference.EmitAssign, Emit): handle
8240 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8241 (ArrayAccess.EmitStoreOpcode): ditto.
8243 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8245 * expression.cs (MakeByteBlob): Complete all the missing types
8246 (uint, short, ushort, byte, sbyte)
8248 * class.cs: Only init instance field initializers on instance
8251 Rename `constructors' to instance_constructors.
8253 (TypeContainer.AddConstructor): Only add constructors to the list
8254 if it is not static.
8256 Make sure that we handle default_static_constructor independently
8257 everywhere where we handle instance_constructors
8259 2001-12-28 Miguel de Icaza <miguel@ximian.com>
8261 * class.cs: Do not lookup or create a base initializer for a
8264 (ConstructorInitializer.Resolve): use the proper type to lookup
8267 * cs-parser.jay: Report error 1585 (modifiers between type and name).
8269 * enum.cs, interface.cs: Remove CloseType, this is taken care by
8272 * decl.cs: CloseType is now an virtual method, the default
8273 implementation just closes this type.
8275 2001-12-28 Ravi Pratap <ravi@ximian.com>
8277 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8278 to PreserveSig by default. Also emit HideBySig on such methods.
8280 Basically, set the defaults to standard values.
8282 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8283 argument, if candidate is better, it can't be worse than the best !
8285 (Invocation): Re-write bits to differentiate between methods being
8286 applicable in their expanded form and their normal form - for params
8289 Get rid of use_standard everywhere as only standard conversions are allowed
8290 in overload resolution.
8292 More spec conformance.
8294 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8296 * driver.cs: Add --timestamp, to see where the compiler spends
8299 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8300 `this' in static code.
8302 (SimpleName.DoResolve): Implement in terms of a helper function
8303 that allows static-references to be passed upstream to
8306 (Expression.ResolveWithSimpleName): Resolve specially simple
8307 names when called by MemberAccess to implement the special
8310 (Expression.ImplicitReferenceConversion): Handle conversions from
8311 Null to reference types before others, as Null's type is
8314 * expression.cs (Invocation.EmitCall): Handle the special case of
8315 calling methods declared on a reference type from a ValueType
8316 (Base classes System.Object and System.Enum)
8318 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8319 the left hand side is a TypeExpr, not on every enumeration.
8321 (Binary.Resolve): If types are reference types, then do a cast to
8322 object on operators != and == of both arguments.
8324 * typemanager.cs (FindMembers): Extract instance and static
8325 members if requested.
8327 * interface.cs (PopulateProperty): Use void_type instead of null
8328 as the return type for the setter method.
8330 (PopulateIndexer): ditto.
8332 2001-12-27 Ravi Pratap <ravi@ximian.com>
8334 * support.cs (ReflectionParameters): Fix minor bug where we
8335 were examining the wrong parameter for the ParamArray attribute.
8337 Cope with requests for the type of the parameter at position
8338 greater than the params parameter's. We now return the element
8339 type of the params array as that makes more sense.
8341 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8342 accordingly as we no longer have to extract the element type
8345 (Invocation.OverloadResolve): Update.
8347 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8349 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8350 against IEnumerator, test whether the return value is a descendant
8351 of the IEnumerator interface.
8353 * class.cs (Indexer.Define): Use an auxiliary method to implement
8354 the other bits of the method definition. Begin support for
8355 explicit interface implementation.
8357 (Property.DefineMethod): Use TypeManager.void_type instead of null
8358 for an empty return value.
8360 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8362 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8363 dealing with a FieldExpr which is composed of a FieldBuilder, in
8364 the code path we did extract the constant, but we should have
8365 obtained the underlying value to be able to cast it (otherwise we
8366 end up in an infinite loop, this is what Ravi was running into).
8368 (ArrayCreation.UpdateIndices): Arrays might be empty.
8370 (MemberAccess.ResolveMemberAccess): Add support for section
8371 14.5.4.1 that deals with the special case of E.I when E is a type
8372 and something else, that I can be a reference to a static member.
8374 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8375 handle a particular array type to create byte blobs, it is just
8376 something we dont generate byteblobs for.
8378 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8381 * location.cs (Push): remove the key from the hashtable that we
8382 are about to add. This happens for empty files.
8384 * driver.cs: Dispose files after we have parsed them.
8386 (tokenize): new function that only runs the tokenizer on its
8387 input, for speed testing.
8389 2001-12-26 Ravi Pratap <ravi@ximian.com>
8391 * class.cs (Event.Define): Define the private field only if there
8392 are no accessors defined.
8394 * expression.cs (ResolveMemberAccess): If there is no associated
8395 field with the event, that means we have an event defined with its
8396 own accessors and we should flag error cs0070 since transforming
8397 ourselves into a field is not valid in that case.
8399 * ecore.cs (SimpleName.DoResolve): Same as above.
8401 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8402 and charset to sane values.
8404 2001-12-25 Ravi Pratap <ravi@ximian.com>
8406 * assign.cs (DoResolve): Perform check on events only if they
8407 are being accessed outside the declaring type.
8409 * cs-parser.jay (event_declarations): Update rules to correctly
8410 set the type of the implicit parameter etc.
8412 (add_accessor, remove_accessor): Set current local parameters.
8414 * expression.cs (Binary): For delegate addition and subtraction,
8415 cast the return value from the method into the appropriate delegate
8418 2001-12-24 Ravi Pratap <ravi@ximian.com>
8420 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8421 of these as the workaround is unnecessary.
8423 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8424 delegate data - none of that is needed at all.
8426 Re-write bits to extract the instance expression and the delegate method
8429 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8432 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8433 of attaching attributes instead of duplicating code everywhere.
8435 * everywhere : Update code to do attribute emission using the above method.
8437 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8439 * expression.cs (IsParamsMethodApplicable): if there are not
8440 parameters, return immediately.
8442 * ecore.cs: The 0 literal can be implicity converted to an enum
8445 (SimpleName.DoResolve): First lookup the type, then lookup the
8448 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8449 want to get its address. If the InstanceExpression is not
8450 addressable, store the result in a temporary variable, then get
8453 * codegen.cs: Only display 219 errors on warning level or above.
8455 * expression.cs (ArrayAccess): Make it implement the
8456 IMemoryLocation interface.
8458 (Binary.DoResolve): handle the operator == (object a, object b)
8459 and operator != (object a, object b) without incurring into a
8460 BoxedCast (because 5 != o should never be performed).
8462 Handle binary enumerator operators.
8464 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8465 value type, otherwise use Ldelem_ref.
8467 Use precomputed names;
8469 (AddressOf): Implement address of
8471 * cs-parser.jay (labeled_statement): Fix recursive block
8472 addition by reworking the production.
8474 * expression.cs (New.DoEmit): New has a special case:
8476 If we are dealing with a ValueType, we have a few
8477 situations to deal with:
8479 * The target of New is a ValueType variable, that is
8480 easy, we just pass this as the variable reference
8482 * The target of New is being passed as an argument,
8483 to a boxing operation or a function that takes a
8486 In this case, we need to create a temporary variable
8487 that is the argument of New.
8490 2001-12-23 Ravi Pratap <ravi@ximian.com>
8492 * rootcontext.cs (LookupType): Check that current_type is not null before
8493 going about looking at nested types.
8495 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8496 not implement the IAssignMethod interface any more.
8498 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8499 where we tranform them into FieldExprs if they are being resolved from within
8502 * ecore.cs (SimpleName.DoResolve): Do the same here.
8504 * assign.cs (DoResolve, Emit): Clean up code considerably.
8506 * ../errors/bug10.cs : Add.
8508 * ../errors/cs0070.cs : Add.
8510 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8512 * assign.cs : Get rid of EventIsLocal everywhere.
8514 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8516 * ecore.cs (ConvertIntLiteral): finished the implementation.
8518 * statement.cs (SwitchLabel): Convert the value we are using as a
8519 key before looking up the table.
8521 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8523 * codegen.cs (EmitTopBlock): Require a Location argument now.
8525 * cs-parser.jay (constructor_declarator): We need to setup
8526 current_local_parameters before we parse the
8527 opt_constructor_initializer, to allow the variables to be bound
8528 to the constructor arguments.
8530 * rootcontext.cs (LookupType): First lookup nested classes in our
8531 class and our parents before we go looking outside our class.
8533 * expression.cs (ConstantFold): Extract/debox the values at the
8536 * rootcontext.cs (EmitCode): Resolve the constants first before we
8537 resolve the types. This is not really needed, but it helps debugging.
8539 * statement.cs: report location.
8541 * cs-parser.jay: pass location to throw statement.
8543 * driver.cs: Small bug fix.
8545 * report.cs: Updated format to be 4-zero filled digits.
8547 2001-12-22 Ravi Pratap <ravi@ximian.com>
8549 * expression.cs (CheckIndices): Fix minor bug where the wrong
8550 variable was being referred to ;-)
8552 (DoEmit): Do not call EmitStaticInitializers when the
8553 underlying type is System.Object.
8555 2001-12-21 Ravi Pratap <ravi@ximian.com>
8557 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8558 and do the usual workaround for SRE.
8560 * class.cs (MyEventBuilder.EventType): New member to get at the type
8561 of the event, quickly.
8563 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8565 * assign.cs (Assign.DoResolve): Handle the case when the target
8566 is an EventExpr and perform the necessary checks.
8568 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8571 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8573 (EventExpr): Set the type in the constructor itself since we
8574 are meant to be born fully resolved.
8576 (EventExpr.Define): Revert code I wrote earlier.
8578 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8579 instance expression is null. The instance expression is a This in that case
8580 or a null, depending on whether it is a static method or not.
8582 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8583 refers to more than one method.
8585 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8586 and accordingly flag errors.
8588 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8590 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8592 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8594 * location.cs (ToString): Provide useful rutine.
8596 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8598 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8599 objects, return the actual integral boxed.
8601 * statement.cs (SwitchLabel): define an ILLabel for each
8604 (Switch.CheckSwitch): If the value is a Literal, extract
8605 the underlying literal.
8607 Also in the unused hashtable we had, add the SwitchLabel so we can
8608 quickly look this value up.
8610 * constant.cs: Implement a bunch of new constants. Rewrite
8611 Literal based on this. Made changes everywhere to adapt to this.
8613 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8614 dereferencing array only once, and also copes with enumrations.
8616 bytes are two bytes wide, not one.
8618 (Cast): Perform constant conversions.
8620 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8621 wrappers to the literals here.
8623 * expression.cs (DoNumericPromotions): long literals can converted
8624 to ulong implicity (this is taken care of elsewhere, but I was
8627 * ecore.cs (Expression.Literalize): Make the return type Literal,
8628 to improve type checking.
8630 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8632 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8634 * literal.cs: Revert code from ravi that checked the bounds. The
8635 bounds are sane by the definition of the type itself.
8637 * typemanager.cs: Fix implementation of ImplementsInterface. We
8638 need to actually look up in our parent hierarchy for interfaces
8641 * const.cs: Use the underlying type for enumerations
8643 * delegate.cs: Compute the basename for the delegate creation,
8644 that should fix the delegate test case, and restore the correct
8645 Type Lookup semantics in rootcontext
8647 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8648 referencing a nested type with the Reflection API is using the "+"
8651 * cs-parser.jay: Do not require EOF token at the end.
8653 2001-12-20 Ravi Pratap <ravi@ximian.com>
8655 * rootcontext.cs (LookupType): Concatenate type names with
8656 a '.' instead of a '+' The test suite passes again.
8658 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8659 field of the enumeration.
8661 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8662 the case when the member is an EventExpr.
8664 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8665 static has an associated instance expression.
8667 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8669 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8671 * class.cs (Event.Define): Register event and perform appropriate checks
8674 We define the Add and Remove methods even if the use provides none because
8675 in that case, we provide default implementations ourselves.
8677 Define a private field of the type of the event. This is done by the CSC compiler
8678 and we should be doing it too ;-)
8680 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8681 More methods we use in code we generate.
8683 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8686 (InitCoreTypes): Update accordingly for the above.
8688 * class.cs (Event.Emit): Generate code for default accessors that we provide
8690 (EmitDefaultMethod): Do the job in the above.
8692 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8695 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8697 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8698 builders even if we were missing one.
8700 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8701 pass the Basename as our class name instead of the Name. The
8702 basename will be correctly composed for us.
8704 * parameter.cs (Paramters): Now takes a Location argument.
8706 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8707 make all the code call directly LookupType in RootContext and take
8708 this chance to pass the Location information everywhere.
8710 * Everywhere: pass Location information.
8712 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8714 * class.cs (Constructor.Define): Updated way of detecting the
8715 length of the parameters.
8717 (TypeContainer.DefineType): Use basename as the type name for
8720 (TypeContainer.Define): Do not recursively define types here, as
8721 definition is taken care in order by the RootContext.
8723 * tree.cs: Keep track of namespaces in a per-file basis.
8725 * parameter.cs (Parameter.ComputeSignature): Update to use
8728 (Parameters.GetSignature): ditto.
8730 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8731 instead of a TypeContainer.
8733 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8734 resolve names. Because we need to be resolve in our context, not
8737 * driver.cs: Implement response files.
8739 * class.cs (TypeContainer.DefineType): If we are defined, do not
8742 (Event.Emit): Emit the code for add/remove handlers.
8743 (Event.Define): Save the MethodBuilders for add/remove.
8745 * typemanager.cs: Use pair here too.
8747 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8748 DictionaryEntry requires the first argument to be non-null.
8750 (enum_declaration): Compute full name for registering the
8753 (delegate_declaration): Instead of using
8754 formal_parameter_list, use opt_formal_parameter_list as the list
8757 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8758 (EventParsing): New property that controls whether `add' and
8759 `remove' are returned as tokens or identifiers (for events);
8761 2001-12-19 Ravi Pratap <ravi@ximian.com>
8763 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8764 use MyEventBuilder only and let it wrap the real builder for us.
8766 (MyEventBuilder): Revamp constructor etc.
8768 Implement all operations that we perform on EventBuilder in precisely the same
8771 (FindMembers): Update to use the EventBuilder member.
8773 (Event.Emit): Update accordingly.
8775 2001-12-18 Ravi Pratap <ravi@ximian.com>
8777 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8778 by calling the appropriate methods.
8780 (GetCustomAttributes): Make stubs as they cannot possibly do anything
8783 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8785 2001-12-17 Ravi Pratap <ravi@ximian.com>
8787 * delegate.cs (Delegate.Populate): Check that the return type
8788 and various parameters types are indeed accessible.
8790 * class.cs (Constructor.Define): Same here.
8792 (Field.Define): Ditto.
8794 (Event.Define): Ditto.
8796 (Operator.Define): Check that the underlying Method defined itself
8797 correctly - so it's MethodBuilder should not be null.
8799 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8800 expression happens to be null.
8802 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8803 members but as of now we don't seem to be able to do anything really useful with it.
8805 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8806 not the EventBuilder.
8808 2001-12-18 Miguel de Icaza <miguel@ximian.com>
8810 * cs-tokenizer.cs: Add support for defines.
8811 Add support for #if, #elif, #else, #endif
8813 (eval_var): evaluates a variable.
8814 (eval): stubbed for evaluating functions.
8816 * cs-parser.jay: Pass the defines information
8818 * driver.cs: Add --define command line option.
8820 * decl.cs: Move MemberCore here.
8822 Make it the base class for DeclSpace. This allows us to catch and
8823 report 108 and 109 for everything now.
8825 * class.cs (TypeContainer.Define): Extract all the members
8826 before populating and emit the warning 108 (new keyword required
8827 to override) instead of having each member implement this.
8829 (MemberCore.Define): New abstract method, we will be using this in
8830 the warning reporting engine in Populate.
8832 (Operator.Define): Adjust to new MemberCore protocol.
8834 * const.cs (Const): This does not derive from Expression, it is a
8835 temporary object we use to create fields, it is a MemberCore.
8837 * class.cs (Method.Define): Allow the entry point to be in a
8840 * driver.cs: Rewrite the argument handler to clean it up a bit.
8842 * rootcontext.cs: Made it just an auxiliary namespace feature by
8843 making everything static.
8845 * driver.cs: Adapt code to use RootContext type name instead of
8848 * delegate.cs: Remove RootContext argument.
8850 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8853 * class.cs (Event.Define): The lookup can fail.
8855 * cs-tokenizer.cs: Begin implementation of pre-procesor.
8857 * expression.cs: Resolve the this instance before invoking the code.
8859 2001-12-17 Miguel de Icaza <miguel@ximian.com>
8861 * cs-parser.jay: Add a production in element_access that allows
8862 the thing to become a "type" reference. This way we can parse
8863 things like "(string [])" as a type.
8865 Note that this still does not handle the more complex rules of
8869 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
8871 * ecore.cs: (CopyNewMethods): new utility function used to
8872 assemble the list of methods from running FindMembers.
8874 (MemberLookup): Rework FindMembers so that
8876 2001-12-16 Miguel de Icaza <miguel@ximian.com>
8878 * class.cs (TypeContainer): Remove Delegates who fail to be
8881 * delegate.cs (Populate): Verify that we dont get null return
8882 values. TODO: Check for AsAccessible.
8884 * cs-parser.jay: Use basename to emit error 574 (destructor should
8885 have the same name as container class), not the full name.
8887 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8888 possible representation.
8890 Also implements integer type suffixes U and L.
8892 2001-12-15 Miguel de Icaza <miguel@ximian.com>
8894 * expression.cs (ArrayCreation.DoResolve): We need to do the
8895 argument resolution *always*.
8897 * decl.cs: Make this hold the namespace. Hold the root context as
8899 (LookupType): Move here.
8901 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8903 * location.cs (Row, Name): Fixed the code, it was always returning
8904 references to the first file.
8906 * interface.cs: Register properties defined through interfaces.
8908 * driver.cs: Add support for globbing on the command line
8910 * class.cs (Field): Make it derive from MemberCore as well.
8913 2001-12-15 Ravi Pratap <ravi@ximian.com>
8915 * class.cs (Event::Define): Check that the type of the event is a delegate
8916 type else flag error #66.
8918 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8921 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8922 values of EntryPoint, CharSet etc etc.
8924 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8926 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8927 be null and we should ignore this. I am not sure if this is really clean. Apparently,
8928 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8929 which needs this to do its work.
8931 * ../errors/cs0066.cs : Add.
8933 2001-12-14 Miguel de Icaza <miguel@ximian.com>
8935 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8938 * class.cs: (MethodSignature.MethodSignature): Removed hack that
8939 clears out the parameters field.
8940 (MemberSignatureCompare): Cleanup
8942 (MemberCore): New base class used to share code between MethodCore
8945 (RegisterRequiredImplementations) BindingFlags.Public requires
8946 either BindingFlags.Instace or Static. Use instance here.
8948 (Property): Refactored code to cope better with the full spec.
8950 * parameter.cs (GetParameterInfo): Return an empty array instead
8953 * class.cs (Property): Abstract or extern properties have no bodies.
8955 * parameter.cs (GetParameterInfo): return a zero-sized array.
8957 * class.cs (TypeContainer.MethodModifiersValid): Move all the
8958 method modifier validation to the typecontainer so we can reuse
8961 (MethodCore.ParameterTypes): return an empty sized array of types.
8963 (Property.Define): Test property modifier validity.
8965 Add tests for sealed/override too.
8967 (Method.Emit): abstract or extern methods have no bodies.
8969 2001-12-14 Ravi Pratap <ravi@ximian.com>
8971 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8974 (Method::Define, ::Emit): Modify accordingly.
8976 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8978 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8980 * makefile: Pass in /unsafe.
8982 2001-12-13 Miguel de Icaza <miguel@ximian.com>
8984 * class.cs (MakeKey): Kill routine.
8986 * class.cs (TypeContainer.Define): Correctly define explicit
8987 method implementations (they require the full interface name plus
8990 * typemanager.cs: Deply the PtrHashtable here and stop using the
8991 lame keys. Things work so much better.
8993 This of course broke everyone who depended on `RegisterMethod' to
8994 do the `test for existance' test. This has to be done elsewhere.
8996 * support.cs (PtrHashtable): A hashtable that avoid comparing with
8997 the object stupid Equals method (because, that like fails all over
8998 the place). We still do not use it.
9000 * class.cs (TypeContainer.SetRequiredInterface,
9001 TypeContainer.RequireMethods): Killed these two routines and moved
9002 all the functionality to RegisterRequiredImplementations.
9004 (TypeContainer.RegisterRequiredImplementations): This routine now
9005 registers all the implementations required in an array for the
9006 interfaces and abstract methods. We use an array of structures
9007 which can be computed ahead of time to reduce memory usage and we
9008 also assume that lookups are cheap as most classes will not
9009 implement too many interfaces.
9011 We also avoid creating too many MethodSignatures.
9013 (TypeContainer.IsInterfaceMethod): Update and optionally does not
9014 clear the "pending" bit if we find that there are problems with
9017 (TypeContainer.VerifyPendingMethods): Update to report errors of
9018 methods that look like implementations but are not.
9020 (TypeContainer.Define): Add support for explicit interface method
9023 2001-12-12 Miguel de Icaza <miguel@ximian.com>
9025 * typemanager.cs: Keep track of the parameters here instead of
9026 being a feature of the TypeContainer.
9028 * class.cs: Drop the registration of parameters here, as
9029 InterfaceMethods are also interface declarations.
9031 * delegate.cs: Register methods with the TypeManager not only with
9032 the TypeContainer. This code was buggy.
9034 * interface.cs: Full registation here.
9036 2001-12-11 Miguel de Icaza <miguel@ximian.com>
9038 * expression.cs: Remove reducer for binary expressions, it can not
9041 * const.cs: Put here the code that used to go into constant.cs
9043 * constant.cs: Put here the code for constants, this is a new base
9046 * literal.cs: Make Literal derive from Constant.
9048 2001-12-09 Miguel de Icaza <miguel@ximian.com>
9050 * statement.cs (Return.Emit): Report error 157 if the user
9051 attempts to return from a finally block.
9053 (Return.Emit): Instead of emitting a return, jump to the end of
9056 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9057 LocalBuilder to store the result of the function. ReturnLabel is
9058 the target where we jump.
9061 2001-12-09 Radek Doulik <rodo@ximian.com>
9063 * cs-parser.jay: remember alias in current namespace
9065 * ecore.cs (SimpleName::DoResolve): use aliases for types or
9068 * class.cs (LookupAlias): lookup alias in my_namespace
9070 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9072 (LookupAlias): lookup alias in this and if needed in parent
9075 2001-12-08 Miguel de Icaza <miguel@ximian.com>
9079 * rootcontext.cs: (ModuleBuilder) Made static, first step into
9080 making things static. I need this to avoid passing the
9081 TypeContainer when calling ParameterType.
9083 * support.cs (InternalParameters.ParameterType): Remove ugly hack
9084 that did string manipulation to compute the type and then call
9085 GetType. Use Parameter.ParameterType instead.
9087 * cs-tokenizer.cs: Consume the suffix for floating values.
9089 * expression.cs (ParameterReference): figure out whether this is a
9090 reference parameter or not. Kill an extra variable by computing
9091 the arg_idx during emission.
9093 * parameter.cs (Parameters.GetParameterInfo): New overloaded
9094 function that returns whether a parameter is an out/ref value or not.
9096 (Parameter.ParameterType): The type of the parameter (base,
9097 without ref/out applied).
9099 (Parameter.Resolve): Perform resolution here.
9100 (Parameter.ExternalType): The full type (with ref/out applied).
9102 * statement.cs (Using.Emit, Using.EmitExpression): Implement
9103 support for expressions on the using statement.
9105 2001-12-07 Miguel de Icaza <miguel@ximian.com>
9107 * statement.cs (Using.EmitLocalVariableDecls): Split the
9108 localvariable handling of the using statement.
9110 (Block.EmitMeta): Keep track of variable count across blocks. We
9111 were reusing slots on separate branches of blocks.
9113 (Try.Emit): Emit the general code block, we were not emitting it.
9115 Check the type of the declaration to be an IDisposable or
9116 something that can be implicity converted to it.
9118 Emit conversions if required.
9120 * ecore.cs (EmptyExpression): New utility class.
9121 (Expression.ImplicitConversionExists): New utility function.
9123 2001-12-06 Miguel de Icaza <miguel@ximian.com>
9125 * statement.cs (Using): Implement.
9127 * expression.cs (LocalVariableReference): Support read only variables.
9129 * statement.cs: Remove the explicit emit for the Leave opcode.
9130 (VariableInfo): Add a readonly field.
9132 2001-12-05 Miguel de Icaza <miguel@ximian.com>
9134 * ecore.cs (ConvCast): new class used to encapsulate the various
9135 explicit integer conversions that works in both checked and
9138 (Expression.ConvertNumericExplicit): Use new ConvCast class to
9139 properly generate the overflow opcodes.
9141 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9143 * statement.cs: The correct type for the EmptyExpression is the
9144 element_type, not the variable type. Ravi pointed this out.
9146 2001-12-04 Ravi Pratap <ravi@ximian.com>
9148 * class.cs (Method::Define): Handle PInvoke methods specially
9149 by using DefinePInvokeMethod instead of the usual one.
9151 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9152 above to do the task of extracting information and defining the method.
9154 2001-12-04 Ravi Pratap <ravi@ximian.com>
9156 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9157 of the condition for string type.
9159 (Emit): Move that here.
9161 (ArrayCreation::CheckIndices): Keep string literals in their expression
9164 (EmitDynamicInitializers): Handle strings appropriately.
9166 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9168 * codegen.cs (EmitContext): Replace multiple variables with a
9169 single pointer to the current Switch statement.
9171 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9174 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9178 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9181 (Foreach.Emit): Foreach on arrays was not setting
9182 up the loop variables (for break/continue).
9184 (GotoCase): Semi-implented.
9186 2001-12-03 Ravi Pratap <ravi@ximian.com>
9188 * attribute.cs (CheckAttribute): Handle system attributes by using
9189 Attribute.GetAttributes to examine information we need.
9191 (GetValidPlaces): Same here.
9193 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9195 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9197 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9199 (Method::Define): Set appropriate flags if we have a DllImport attribute.
9201 (Method::Emit): Handle the case when we are a PInvoke method.
9203 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9205 * expression.cs: Use ResolveWithSimpleName on compound names.
9207 2001-12-02 Ravi Pratap <ravi@ximian.com>
9209 * constant.cs (EmitConstant): Make sure we resolve the associated expression
9210 before trying to reduce it.
9212 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9214 * constant.cs (LookupConstantValue): Implement.
9216 (EmitConstant): Use the above in emitting the constant.
9218 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9219 that are user-defined by doing a LookupConstantValue on them.
9221 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9224 2001-11-29 Miguel de Icaza <miguel@ximian.com>
9226 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9228 (BaseAccess.DoResolve): Implement.
9230 (MemberAccess.DoResolve): Split this routine into a
9231 ResolveMemberAccess routine that can be used independently
9233 2001-11-28 Miguel de Icaza <miguel@ximian.com>
9235 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9236 As that share bits of the implementation. Is returns a boolean,
9237 while As returns the Type that is being probed.
9239 2001-12-01 Ravi Pratap <ravi@ximian.com>
9241 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9242 instead of a Literal - much easier.
9244 (EnumInTransit): Remove - utterly useless :-)
9246 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9248 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9250 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9251 chain when we have no associated expression.
9253 2001-11-30 Ravi Pratap <ravi@ximian.com>
9255 * constant.cs (Define): Use Location while reporting the errror.
9257 Also emit a warning when 'new' is used and there is no inherited
9260 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
9263 (LookupEnumValue): Implement to lookup an enum member's value and define it
9266 (Populate): Re-write accordingly to use the above routine.
9268 2001-11-27 Miguel de Icaza <miguel@ximian.com>
9270 * expression.cs (This): Fix prototype for DoResolveLValue to
9271 override the base class DoResolveLValue.
9273 * cs-parser.cs: Report errors cs574 and cs575 (destructor
9276 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9277 (we need to load the address of the field here). This fixes
9280 (FieldExpr.DoResolveLValue): Call the DoResolve
9281 function to initialize the Instance expression.
9283 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9284 correctly the GetEnumerator operation on a value type.
9286 * cs-parser.jay: Add more simple parsing error catches.
9288 * statement.cs (Switch): Add support for string switches.
9289 Handle null specially.
9291 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
9293 2001-11-28 Ravi Pratap <ravi@ximian.com>
9295 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9297 (declare_local_constant): New helper function.
9299 * statement.cs (AddConstant): Keep a separate record of constants
9301 (IsConstant): Implement to determine if a variable is a constant.
9303 (GetConstantExpression): Implement.
9305 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9307 * statement.cs (IsVariableDefined): Re-write.
9309 2001-11-27 Ravi Pratap <ravi@ximian.com>
9311 * class.cs (TypeContainer::FindMembers): Look for constants
9312 in the case when we are looking for MemberTypes.Field
9314 * expression.cs (MemberAccess::DoResolve): Check that in the
9315 case we are a FieldExpr and a Literal, we are not being accessed
9316 by an instance reference.
9318 * cs-parser.jay (local_constant_declaration): Implement.
9320 (declaration_statement): Implement for constant declarations.
9322 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9324 * statement.cs (Switch): Catch double defaults.
9326 (Switch): More work on the switch() statement
9327 implementation. It works for integral values now, need to finish
9331 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9333 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9334 integer literals into other integer literals. To be used by
9337 2001-11-24 Ravi Pratap <ravi@ximian.com>
9339 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9342 (EmitDynamicInitializers): Cope with the above since we extract data
9343 directly from ArrayData now.
9345 (ExpectInitializers): Keep track of whether initializers are mandatory
9348 (Bounds): Make it a hashtable to prevent the same dimension being
9349 recorded for every element in that dimension.
9351 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9354 Also fix bug which was causing the indices to be emitted in the reverse
9357 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9359 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9360 unfinished. They do not work, because the underlying code is
9363 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9365 * cs-parser.jay: Remove bogus fixme.
9367 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9368 on Switch statement.
9370 2001-11-23 Ravi Pratap <ravi@ximian.com>
9372 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9375 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9376 parameter. Apparently, any expression is allowed.
9378 (ValidateInitializers): Update accordingly.
9380 (CheckIndices): Fix some tricky bugs thanks to recursion.
9382 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9383 I was being completely brain-dead.
9385 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9386 and re-write acordingly.
9388 (DelegateInvocation): Re-write accordingly.
9390 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9392 (MakeByteBlob): Handle types more correctly.
9394 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9395 initialization from expressions but it is incomplete because I am a complete
9398 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9400 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9401 on If. Basically, we have to return `true' (ie, we do return to
9402 our caller) only if both branches of the if return.
9404 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9405 short-circuit operators, handle them as short circuit operators.
9407 (Cast.DoResolve): Resolve type.
9408 (Cast.Cast): Take an expression as the target type.
9410 * cs-parser.jay (cast_expression): Remove old hack that only
9411 allowed a limited set of types to be handled. Now we take a
9412 unary_expression and we resolve to a type during semantic
9415 Use the grammar productions from Rhys to handle casts (this is
9416 not complete like Rhys syntax yet, we fail to handle that corner
9417 case that C# has regarding (-x), but we will get there.
9419 2001-11-22 Ravi Pratap <ravi@ximian.com>
9421 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9422 field which is an array type.
9424 * cs-parser.jay (declare_local_variables): Support array initialization too.
9426 * typemanager.cs (MakeKey): Implement.
9428 (everywhere): Use the above appropriately.
9430 * cs-parser.jay (for_statement): Update for array initialization while
9431 declaring variables.
9433 * ecore.cs : The error message was correct, it's the variable's names that
9434 were misleading ;-) Make the code more readable.
9436 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9437 the correct type etc.
9439 (ConvertExplicit): Handle Enum types by examining the underlying type.
9441 2001-11-21 Ravi Pratap <ravi@ximian.com>
9443 * parameter.cs (GetCallingConvention): Always return
9444 CallingConventions.Standard for now.
9446 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9448 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9449 and `r' after calling DoNumericPromotions.
9451 * ecore.cs: Fix error message (the types were in the wrong order).
9453 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9454 BindingFlags.Instance as well
9456 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9457 implicit int literal conversion in an empty cast so that we
9458 propagate the right type upstream.
9460 (UnboxCast): new class used to unbox value types.
9461 (Expression.ConvertExplicit): Add explicit type conversions done
9464 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9465 the target type before applying the implicit LongLiterals to ULong
9468 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9470 * cs-parser.jay (for_statement): Reworked the way For works: now
9471 we declare manually any variables that are introduced in
9472 for_initializer to solve the problem of having out-of-band code
9473 emition (that is what got for broken).
9475 (declaration_statement): Perform the actual variable declaration
9476 that used to be done in local_variable_declaration here.
9478 (local_variable_declaration): Do not declare anything, just pass
9479 the information on a DictionaryEntry
9481 2001-11-20 Ravi Pratap <ravi@ximian.com>
9483 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9484 re-write of the logic to now make it recursive.
9486 (UpdateIndices): Re-write accordingly.
9488 Store element data in a separate ArrayData list in the above methods.
9490 (MakeByteBlob): Implement to dump the array data into a byte array.
9492 2001-11-19 Ravi Pratap <ravi@ximian.com>
9494 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9497 * constant.cs (Define): Implement.
9499 (EmitConstant): Re-write fully.
9501 Pass in location info.
9503 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9506 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9507 DictionaryEntry since we need location info too.
9509 (constant_declaration): Update accordingly.
9511 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9512 code into another method : UpdateIndices.
9514 2001-11-18 Ravi Pratap <ravi@ximian.com>
9516 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9517 some type checking etc.
9519 2001-11-17 Ravi Pratap <ravi@ximian.com>
9521 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9522 bits to provide dimension info if the user skips doing that.
9524 Update second constructor to store the rank correctly.
9526 2001-11-16 Ravi Pratap <ravi@ximian.com>
9528 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9529 and try to implement.
9531 * ../errors/cs0150.cs : Add.
9533 * ../errors/cs0178.cs : Add.
9535 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9537 * statement.cs: Implement foreach on multi-dimensional arrays.
9539 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9540 name of the params argument.
9542 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9543 initializing the array.
9545 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9546 we can use this elsewhere.
9548 * statement.cs: Finish implementation of foreach for single
9551 * cs-parser.jay: Use an out-of-band stack to pass information
9552 around, I wonder why I need this.
9554 foreach_block: Make the new foreach_block the current_block.
9556 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9557 function used to return a static Parameters structure. Used for
9558 empty parameters, as those are created very frequently.
9560 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9562 2001-11-15 Ravi Pratap <ravi@ximian.com>
9564 * interface.cs : Default modifier is private, not public. The
9565 make verify test passes again.
9567 2001-11-15 Ravi Pratap <ravi@ximian.com>
9569 * support.cs (ReflectionParameters): Fix logic to determine
9570 whether the last parameter is a params one. Test 9 passes again.
9572 * delegate.cs (Populate): Register the builders we define with
9573 RegisterParameterForBuilder. Test 19 passes again.
9575 * cs-parser.jay (property_declaration): Reference $6 instead
9576 of $$ to get at the location.
9578 (indexer_declaration): Similar stuff.
9582 * class.cs (Property): Register parameters for the Get and Set methods
9583 if they exist. Test 23 passes again.
9585 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9586 call to EmitArguments as we are sure there aren't any params arguments.
9587 Test 32 passes again.
9589 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9590 IndexOutOfRangeException.
9592 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9593 Test 33 now passes again.
9595 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9597 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9598 broke a bunch of things. Will have to come up with a better way
9599 of tracking locations.
9601 * statement.cs: Implemented foreach for single dimension arrays.
9603 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9605 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9606 an error. This removes the lookup from the critical path.
9608 * cs-parser.jay: Removed use of temporary_loc, which is completely
9611 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9613 * support.cs (ReflectionParameters.ParameterModifier): Report
9614 whether the argument is a PARAMS argument or not.
9616 * class.cs: Set the attribute `ParamArrayAttribute' on the
9619 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9620 and cons_param_array_attribute (ConstructorInfo for
9621 ParamArrayAttribute).,
9623 * codegen.cs: Emit the return using the `Return' statement, that
9624 way we can report the error correctly for missing return values.
9626 * class.cs (Method.Emit): Clean up.
9628 * expression.cs (Argument.Resolve): Take another argument: the
9629 location where this argument is used. Notice that this is not
9630 part of the "Argument" class as to reduce the size of the
9631 structure (we know the approximate location anyways).
9633 Test if the argument is a variable-reference, if not, then
9634 complain with a 206.
9636 (Argument.Emit): Emit addresses of variables.
9638 (Argument.FullDesc): Simplify.
9640 (Invocation.DoResolve): Update for Argument.Resolve.
9642 (ElementAccess.DoResolve): ditto.
9644 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9645 method should be virtual, as this method is always virtual.
9647 (NewDelegate.DoResolve): Update for Argument.Resolve.
9649 * class.cs (ConstructorInitializer.DoResolve): ditto.
9651 * attribute.cs (Attribute.Resolve): ditto.
9653 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9655 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9657 * expression.cs (ParameterReference): Drop IStackStorage and implement
9658 IAssignMethod instead.
9660 (LocalVariableReference): ditto.
9662 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9663 IAssignMethod instead.
9665 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9667 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9668 enumerations that are used in heavily used structures derive from
9669 byte in a laughable and pathetic attempt to reduce memory usage.
9670 This is the kind of pre-optimzations that you should not do at
9671 home without adult supervision.
9673 * expression.cs (UnaryMutator): New class, used to handle ++ and
9674 -- separatedly from the other unary operators. Cleans up the
9675 code, and kills the ExpressionStatement dependency in Unary.
9677 (Unary): Removed `method' and `Arguments' from this class, making
9678 it smaller, and moving it all to SimpleCall, so I can reuse this
9679 code in other locations and avoid creating a lot of transient data
9680 strucutres when not required.
9682 * cs-parser.jay: Adjust for new changes.
9684 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9686 * enum.cs (Enum.Populate): If there is a failure during
9689 * cs-parser.jay (opt_enum_base): we used to catch type errors
9690 here, but this is really incorrect. The type error should be
9691 catched during semantic analysis.
9693 2001-12-11 Ravi Pratap <ravi@ximian.com>
9695 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9696 current_local_parameters as expected since I, in my stupidity, had forgotten
9699 * attribute.cs (GetValidPlaces): Fix stupid bug.
9701 * class.cs (Method::Emit): Perform check on applicability of attributes.
9703 (Constructor::Emit): Ditto.
9705 (Field::Emit): Ditto.
9707 (Field.Location): Store location information.
9709 (Property, Event, Indexer, Operator): Ditto.
9711 * cs-parser.jay (field_declaration): Pass in location for each field.
9713 * ../errors/cs0592.cs : Add.
9715 2001-11-12 Ravi Pratap <ravi@ximian.com>
9717 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9719 (InitCoreTypes): Update accordingly.
9721 (RegisterAttrType, LookupAttr): Implement.
9723 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9724 info about the same.
9726 (Resolve): Update to populate the above as necessary.
9730 (GetValidPlaces): Helper to the above.
9732 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9734 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9736 2001-11-12 Ravi Pratap <ravi@ximian.com>
9738 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9740 * ../errors/cs0617.cs : Add.
9742 2001-11-11 Ravi Pratap <ravi@ximian.com>
9744 * enum.cs (Emit): Rename to Populate to be more consistent with what
9745 we expect it to do and when exactly it is called.
9747 * class.cs, rootcontext.cs : Update accordingly.
9749 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9750 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9752 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9754 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9755 of a fieldinfo using the above, when dealing with a FieldBuilder.
9757 2001-11-10 Ravi Pratap <ravi@ximian.com>
9759 * ../errors/cs0031.cs : Add.
9761 * ../errors/cs1008.cs : Add.
9763 * ../errrors/cs0543.cs : Add.
9765 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9768 (FindMembers): Implement.
9770 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9771 enums and delegates too.
9773 (enum_types): Rename to builder_to_enum.
9775 (delegate_types): Rename to builder_to_delegate.
9777 * delegate.cs (FindMembers): Implement.
9779 2001-11-09 Ravi Pratap <ravi@ximian.com>
9781 * typemanager.cs (IsEnumType): Implement.
9783 * enum.cs (Emit): Re-write parts to account for the underlying type
9784 better and perform checking etc.
9786 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9787 of the underlying type.
9789 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9792 * enum.cs (error31): Helper to report error #31.
9794 * cs-parser.jay (enum_declaration): Store location of each member too.
9796 * enum.cs (member_to_location): New hashtable.
9798 (AddEnumMember): Update location hashtable.
9800 (Emit): Use the location of each member while reporting errors.
9802 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9804 * cs-parser.jay: A for_initializer if is a
9805 local_variable_declaration really ammount to have an implicit
9806 block with the variable declaration and no initializer for for.
9808 * statement.cs (For.Emit): Cope with null initializers.
9810 This fixes the infinite loop on for initializers.
9812 2001-11-08 Miguel de Icaza <miguel@ximian.com>
9814 * enum.cs: More cleanup.
9816 * ecore.cs: Remove dead code.
9818 * class.cs (Property.Emit): More simplification.
9819 (Event.Emit): ditto.
9821 Reworked to have less levels of indentation.
9823 2001-11-08 Ravi Pratap <ravi@ximian.com>
9825 * class.cs (Property): Emit attributes.
9835 * enum.cs (Emit): Ditto.
9837 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9840 * class.cs (Field, Event, etc.): Move attribute generation into the
9841 Emit method everywhere.
9843 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9844 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9845 as we had no way of defining nested enums !
9847 * rootcontext.cs : Adjust code accordingly.
9849 * typemanager.cs (AddEnumType): To keep track of enum types separately.
9851 2001-11-07 Ravi Pratap <ravi@ximian.com>
9853 * expression.cs (EvalConstantExpression): Move into ecore.cs
9855 * enum.cs (Enum): Rename some members and make them public and readonly
9856 according to our convention.
9858 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9861 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9863 (Enum::Emit): Write a simple version for now which doesn't try to compute
9864 expressions. I shall modify this to be more robust in just a while.
9866 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9868 (TypeContainer::CloseType): Create the Enum types too.
9870 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9872 * expression.cs (EvalConstantExpression): Get rid of completely.
9874 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9875 user-defined values and other cases.
9877 (IsValidEnumLiteral): Helper function.
9879 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
9880 out there in the case we had a literal FieldExpr.
9882 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9884 (Literalize): Revamp a bit to take two arguments.
9886 (EnumLiteral): New class which derives from Literal to wrap enum literals.
9888 2001-11-06 Ravi Pratap <ravi@ximian.com>
9890 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9892 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9894 (Resolve): Use the above to ensure we have proper initializers.
9896 2001-11-05 Ravi Pratap <ravi@ximian.com>
9898 * expression.cs (Expression::EvalConstantExpression): New method to
9899 evaluate constant expressions.
9901 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9903 2001-11-07 Miguel de Icaza <miguel@ximian.com>
9905 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9908 (Binary.ResolveOperator): Handle operator != (object a, object b)
9909 and operator == (object a, object b);
9911 (Binary.DoNumericPromotions): Indicate whether the numeric
9912 promotion was possible.
9914 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9917 Made the ArrayAccess implement interface IAssignMethod instead of
9918 IStackStore as the order in which arguments are passed reflects
9921 * assign.cs: Instead of using expr.ExprClass to select the way of
9922 assinging, probe for the IStackStore/IAssignMethod interfaces.
9924 * typemanager.cs: Load InitializeArray definition.
9926 * rootcontext.cs (RootContext.MakeStaticData): Used to define
9927 static data that can be used to initialize arrays.
9929 2001-11-05 Miguel de Icaza <miguel@ximian.com>
9931 * expression.cs: Handle operator== and operator!= for booleans.
9933 (Conditioal.Reduce): Implement reducer for the ?: operator.
9935 (Conditional.Resolve): Implement dead code elimination.
9937 (Binary.Resolve): Catch string literals and return a new
9938 concatenated string.
9940 (Unary.Reduce): Implement reduction of unary expressions.
9942 * ecore.cs: Split out the expression core handling here.
9944 (Expression.Reduce): New method used to perform constant folding
9945 and CSE. This is needed to support constant-expressions.
9947 * statement.cs (Statement.EmitBoolExpression): Pass true and false
9948 targets, and optimize for !x.
9950 2001-11-04 Ravi Pratap <ravi@ximian.com>
9952 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9953 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9954 set custom atttributes.
9956 * literal.cs (Literal::GetValue): New abstract method to return the actual
9957 value of the literal, cast as an object.
9959 (*Literal): Implement GetValue method.
9961 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9962 expressions to the arraylist but objects of type Argument.
9964 * class.cs (TypeContainer::Emit): Emit our attributes too.
9966 (Method::Emit, Constructor::Emit): Ditto.
9968 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9969 to be ignoring earlier.
9971 2001-11-03 Ravi Pratap <ravi@ximian.com>
9973 * attribute.cs (AttributeSection::Define): Implement to do the business
9974 of constructing a CustomAttributeBuilder.
9976 (Attribute): New trivial class. Increases readability of code.
9978 * cs-parser.jay : Update accordingly.
9980 (positional_argument_list, named_argument_list, named_argument): New rules
9982 (attribute_arguments): Use the above so that we are more correct.
9984 2001-11-02 Ravi Pratap <ravi@ximian.com>
9986 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9987 to perform all checks for a method with a params parameter.
9989 (Invocation::OverloadResolve): Update to use the above method and therefore
9990 cope correctly with params method invocations.
9992 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
9995 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9996 constructors in our parent too because we can't afford to miss out on
9999 * attribute.cs (AttributeSection): New name for the class Attribute
10001 Other trivial changes to improve readability.
10003 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10004 use the new class names.
10006 2001-11-01 Ravi Pratap <ravi@ximian.com>
10008 * class.cs (Method::Define): Complete definition for params types too
10010 (Indexer::Define): Ditto.
10012 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10013 Cope everywhere with a request for info about the array parameter.
10015 2001-11-01 Ravi Pratap <ravi@ximian.com>
10017 * tree.cs (RecordNamespace): Fix up to check for the correct key.
10019 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
10020 local_variable_type to extract the string corresponding to the type.
10022 (local_variable_type): Fixup the action to use the new helper method.
10024 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
10027 * expression.cs : Clean out code which uses the above.
10029 2001-10-31 Ravi Pratap <ravi@ximian.com>
10031 * typemanager.cs (RegisterMethod): Check if we already have an existing key
10032 and bale out if necessary by returning a false.
10034 (RegisterProperty): Ditto.
10036 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10037 and print out appropriate error messages.
10039 * interface.cs (everywhere): Ditto.
10041 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10042 location to constructor.
10044 * class.cs (Property, Event, Indexer): Update accordingly.
10046 * ../errors/cs111.cs : Added.
10048 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10049 of a method, as laid down by the spec.
10051 (Invocation::OverloadResolve): Use the above method.
10053 2001-10-31 Ravi Pratap <ravi@ximian.com>
10055 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10056 now take a TypeContainer and a Parameters object.
10058 (ParameterData): Modify return type of ParameterModifier method to be
10059 Parameter.Modifier and not a string.
10061 (ReflectionParameters, InternalParameters): Update accordingly.
10063 * expression.cs (Argument::GetParameterModifier): Same here.
10065 * support.cs (InternalParameters::ParameterType): Find a better way of determining
10066 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10067 symbol in it at all so maybe this is only for now.
10069 2001-10-30 Ravi Pratap <ravi@ximian.com>
10071 * support.cs (InternalParameters): Constructor now takes an extra argument
10072 which is the actual Parameters class.
10074 (ParameterDesc): Update to provide info on ref/out modifiers.
10076 * class.cs (everywhere): Update call to InternalParameters to pass in
10077 the second argument too.
10079 * support.cs (ParameterData): Add ParameterModifier, which is a method
10080 to return the modifier info [ref/out etc]
10082 (InternalParameters, ReflectionParameters): Implement the above.
10084 * expression.cs (Argument::ParameterModifier): Similar function to return
10085 info about the argument's modifiers.
10087 (Invocation::OverloadResolve): Update to take into account matching modifiers
10090 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10091 a new SetFormalParameters object which we pass to InternalParameters.
10093 2001-10-30 Ravi Pratap <ravi@ximian.com>
10095 * expression.cs (NewArray): Merge into the ArrayCreation class.
10097 2001-10-29 Ravi Pratap <ravi@ximian.com>
10099 * expression.cs (NewArray): Merge classes NewBuiltinArray and
10100 NewUserdefinedArray into one as there wasn't much of a use in having
10103 * expression.cs (Argument): Change field's name to ArgType from Type.
10105 (Type): New readonly property which returns the proper type, taking into
10106 account ref/out modifiers.
10108 (everywhere): Adjust code accordingly for the above.
10110 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10111 whether we are emitting for a ref or out parameter.
10113 * expression.cs (Argument::Emit): Use the above field to set the state.
10115 (LocalVariableReference::Emit): Update to honour the flag and emit the
10118 * parameter.cs (Attributes): Set the correct flags for ref parameters.
10120 * expression.cs (Argument::FullDesc): New function to provide a full desc.
10122 * support.cs (ParameterData): Add method ParameterDesc to the interface.
10124 (ReflectionParameters, InternalParameters): Implement the above method.
10126 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10129 (Invocation::FullMethodDesc): Ditto.
10131 2001-10-29 Miguel de Icaza <miguel@ximian.com>
10133 * cs-parser.jay: Add extra production for the second form of array
10136 * expression.cs (ArrayCreation): Update to reflect the above
10139 * Small changes to prepare for Array initialization.
10141 2001-10-28 Miguel de Icaza <miguel@ximian.com>
10143 * typemanager.cs (ImplementsInterface): interface might be null;
10144 Deal with this problem;
10146 Also, we do store negative hits on the cache (null values), so use
10147 this instead of calling t.GetInterfaces on the type everytime.
10149 2001-10-28 Ravi Pratap <ravi@ximian.com>
10151 * typemanager.cs (IsBuiltinType): New method to help determine the same.
10153 * expression.cs (New::DoResolve): Get rid of array creation code and instead
10154 split functionality out into different classes.
10156 (New::FormArrayType): Move into NewBuiltinArray.
10158 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10161 (NewBuiltinArray): New class to handle creation of built-in arrays.
10163 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10164 account creation of one-dimensional arrays.
10166 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10168 (NewUserdefinedArray::DoResolve): Implement.
10170 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10172 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10173 we maintain inside the TypeManager. This is necessary to perform lookups on the
10176 (LookupType): Update to perform GetType on the module builders too.
10178 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10180 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10182 2001-10-23 Ravi Pratap <ravi@ximian.com>
10184 * expression.cs (New::DoResolve): Implement guts of array creation.
10186 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10188 2001-10-27 Miguel de Icaza <miguel@ximian.com>
10190 * expression.cs: Fix bug I introduced lsat night that broke
10193 (Expression.Resolve): Report a 246 error (can not resolve name)
10194 if we find a SimpleName in the stream.
10196 (Expression.ResolveLValue): Ditto.
10198 (Expression.ResolveWithSimpleName): This function is a variant of
10199 ResolveName, this one allows SimpleNames to be returned without a
10200 warning. The only consumer of SimpleNames is MemberAccess
10202 2001-10-26 Miguel de Icaza <miguel@ximian.com>
10204 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10205 might arrive here. I have my doubts that this is correct.
10207 * statement.cs (Lock): Implement lock statement.
10209 * cs-parser.jay: Small fixes to support `lock' and `using'
10211 * cs-tokenizer.cs: Remove extra space
10213 * driver.cs: New flag --checked, allows to turn on integer math
10216 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10217 Threading.Monitor.Exit
10219 2001-10-23 Miguel de Icaza <miguel@ximian.com>
10221 * expression.cs (IndexerAccess::DoResolveLValue): Set the
10222 Expression Class to be IndexerAccess.
10224 Notice that Indexer::DoResolve sets the eclass to Value.
10226 2001-10-22 Miguel de Icaza <miguel@ximian.com>
10228 * class.cs (TypeContainer::Emit): Emit code for indexers.
10230 * assign.cs (IAssignMethod): New interface implemented by Indexers
10231 and Properties for handling assignment.
10233 (Assign::Emit): Simplify and reuse code.
10235 * expression.cs (IndexerAccess, PropertyExpr): Implement
10236 IAssignMethod, clean up old code.
10238 2001-10-22 Ravi Pratap <ravi@ximian.com>
10240 * typemanager.cs (ImplementsInterface): New method to determine if a type
10241 implements a given interface. Provides a nice cache too.
10243 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10246 (ConvertReferenceExplicit): Ditto.
10248 * delegate.cs (Delegate::Populate): Update to define the parameters on the
10249 various methods, with correct names etc.
10251 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
10252 Operator.UnaryNegation.
10254 * cs-parser.jay (operator_declarator): Be a little clever in the case where
10255 we have a unary plus or minus operator.
10257 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
10260 * everywhere : update accordingly.
10262 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10265 * class.cs (Method::Define): For the case where we are implementing a method
10266 inherited from an interface, we need to set the MethodAttributes.Final flag too.
10267 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10269 2001-10-21 Ravi Pratap <ravi@ximian.com>
10271 * interface.cs (FindMembers): Implement to work around S.R.E
10274 * typemanager.cs (IsInterfaceType): Implement.
10276 (FindMembers): Update to handle interface types too.
10278 * expression.cs (ImplicitReferenceConversion): Re-write bits which
10279 use IsAssignableFrom as that is not correct - it doesn't work.
10281 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10282 and accordingly override EmitStatement.
10284 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10285 using the correct logic :-)
10287 2001-10-19 Ravi Pratap <ravi@ximian.com>
10289 * ../errors/cs-11.cs : Add to demonstrate error -11
10291 2001-10-17 Miguel de Icaza <miguel@ximian.com>
10293 * assign.cs (Assign::Resolve): Resolve right hand side first, and
10294 then pass this as a hint to ResolveLValue.
10296 * expression.cs (FieldExpr): Add Location information
10298 (FieldExpr::LValueResolve): Report assignment to readonly
10301 (Expression::ExprClassFromMemberInfo): Pass location information.
10303 (Expression::ResolveLValue): Add new method that resolves an
10306 (Expression::DoResolveLValue): Default invocation calls
10309 (Indexers): New class used to keep track of indexers in a given
10312 (IStackStore): Renamed from LValue, as it did not really describe
10313 what this did. Also ResolveLValue is gone from this interface and
10314 now is part of Expression.
10316 (ElementAccess): Depending on the element access type
10318 * typemanager.cs: Add `indexer_name_type' as a Core type
10319 (System.Runtime.CompilerServices.IndexerNameAttribute)
10321 * statement.cs (Goto): Take a location.
10323 2001-10-18 Ravi Pratap <ravi@ximian.com>
10325 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10326 if two delegates are compatible.
10328 (NewDelegate::DoResolve): Update to take care of the case when
10329 we instantiate a delegate from another delegate.
10331 * typemanager.cs (FindMembers): Don't even try to look up members
10332 of Delegate types for now.
10334 2001-10-18 Ravi Pratap <ravi@ximian.com>
10336 * delegate.cs (NewDelegate): New class to take care of delegate
10339 * expression.cs (New): Split the delegate related code out into
10340 the NewDelegate class.
10342 * delegate.cs (DelegateInvocation): New class to handle delegate
10345 * expression.cs (Invocation): Split out delegate related code into
10346 the DelegateInvocation class.
10348 2001-10-17 Ravi Pratap <ravi@ximian.com>
10350 * expression.cs (New::DoResolve): Implement delegate creation fully
10351 and according to the spec.
10353 (New::DoEmit): Update to handle delegates differently.
10355 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10356 because of which we were printing out arguments in reverse order !
10358 * delegate.cs (VerifyMethod): Implement to check if the given method
10359 matches the delegate.
10361 (FullDelegateDesc): Implement.
10363 (VerifyApplicability): Implement.
10365 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10366 delegate invocations too.
10368 (Invocation::Emit): Ditto.
10370 * ../errors/cs1593.cs : Added.
10372 * ../errors/cs1594.cs : Added.
10374 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10376 2001-10-16 Ravi Pratap <ravi@ximian.com>
10378 * typemanager.cs (intptr_type): Core type for System.IntPtr
10380 (InitCoreTypes): Update for the same.
10382 (iasyncresult_type, asynccallback_type): Ditto.
10384 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10387 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10390 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10391 the builders for the 4 members of a delegate type :-)
10393 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10396 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10398 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10400 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10402 * statement.cs (Break::Emit): Implement.
10403 (Continue::Emit): Implement.
10405 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10406 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10407 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10408 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10411 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10412 properties that track the label for the current loop (begin of the
10413 loop and end of the loop).
10415 2001-10-15 Ravi Pratap <ravi@ximian.com>
10417 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10418 use of emitting anything at all.
10420 * class.cs, rootcontext.cs : Get rid of calls to the same.
10422 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10424 (Populate): Define the constructor correctly and set the implementation
10427 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10430 (AddDelegateType): Implement.
10432 (IsDelegateType): Implement helper method.
10434 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10436 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10437 and accordingly handle it.
10439 * delegate.cs (Populate): Take TypeContainer argument.
10440 Implement bits to define the Invoke method. However, I still haven't figured out
10441 how to take care of the native int bit :-(
10443 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10444 Qualify the name of the delegate, not its return type !
10446 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10449 (StandardConversionExists): Checking for array types turns out to be recursive.
10451 (ConvertReferenceExplicit): Implement array conversion.
10453 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10455 2001-10-12 Ravi Pratap <ravi@ximian.com>
10457 * cs-parser.jay (delegate_declaration): Store the fully qualified
10458 name as it is a type declaration.
10460 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10463 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10464 as TypeContainer::DefineType.
10466 (Populate): Method in which all the definition of the various methods (Invoke)
10469 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10472 (CloseDelegate): Finally creates the delegate.
10474 * class.cs (TypeContainer::DefineType): Update to define delegates.
10475 (Populate, Emit and CloseType): Do the same thing here too.
10477 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10478 delegates in all these operations.
10480 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10482 * expression.cs: LocalTemporary: a new expression used to
10483 reference a temporary that has been created.
10485 * assign.cs: Handle PropertyAccess back here, so that we can
10486 provide the proper semantic access to properties.
10488 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10489 a few more explicit conversions.
10491 * modifiers.cs: `NEW' modifier maps to HideBySig.
10493 * expression.cs (PropertyExpr): Make this into an
10494 ExpressionStatement, and support the EmitStatement code path.
10496 Perform get/set error checking, clean up the interface.
10498 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10499 them into toplevel access objects.
10501 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10503 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10506 * typemanager.cs: Keep track here of our PropertyBuilders again to
10507 work around lameness in SRE.
10509 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10511 * expression.cs (LValue::LValueResolve): New method in the
10512 interface, used to perform a second resolution pass for LValues.
10514 (This::DoResolve): Catch the use of this in static methods.
10516 (This::LValueResolve): Implement.
10518 (This::Store): Remove warning, assigning to `this' in structures
10521 (Invocation::Emit): Deal with invocation of
10522 methods on value types. We need to pass the address to structure
10523 methods rather than the object itself. (The equivalent code to
10524 emit "this" for structures leaves the entire structure on the
10525 stack instead of a pointer to it).
10527 (ParameterReference::DoResolve): Compute the real index for the
10528 argument based on whether the method takes or not a `this' pointer
10529 (ie, the method is static).
10531 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10532 value types returned from functions when we need to invoke a
10533 method on the sturcture.
10536 2001-10-11 Ravi Pratap <ravi@ximian.com>
10538 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10539 defining the type in the Modulebuilder or Typebuilder. This is to take
10540 care of nested types which need to be defined on the TypeBuilder using
10541 DefineNestedMethod.
10543 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10544 methods in RootContext, only ported to be part of TypeContainer.
10546 (TypeContainer::GetInterfaceOrClass): Ditto.
10548 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10550 * interface.cs (Interface::DefineInterface): New method. Does exactly
10551 what RootContext.CreateInterface did earlier, only it takes care of nested types
10554 (Interface::GetInterfaces): Move from RootContext here and port.
10556 (Interface::GetInterfaceByName): Same here.
10558 * rootcontext.cs (ResolveTree): Re-write.
10560 (PopulateTypes): Re-write.
10562 * class.cs (TypeContainer::Populate): Populate nested types too.
10563 (TypeContainer::Emit): Emit nested members too.
10565 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10566 instead just use the name argument passed in as it is already fully
10569 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10570 to TypeContainer mapping to see if a type is user-defined.
10572 * class.cs (TypeContainer::CloseType): Implement.
10574 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10575 the default constructor.
10577 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10580 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10582 * interface.cs (CloseType): Create the type here.
10584 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10587 Remove all the methods which are now in TypeContainer.
10589 2001-10-10 Ravi Pratap <ravi@ximian.com>
10591 * delegate.cs (Define): Re-write bits to define the delegate
10594 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10596 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10598 * expression.cs (ImplicitReferenceConversion): handle null as well
10599 as a source to convert to any reference type.
10601 * statement.cs (Return): Perform any implicit conversions to
10602 expected return type.
10604 Validate use of return statement.
10606 * codegen.cs (EmitContext): Pass the expected return type here.
10608 * class.cs (Method, Constructor, Property): Pass expected return
10609 type to EmitContext.
10611 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10613 * expression.cs: Make DoResolve take an EmitContext instead of a
10616 Replaced `l' and `location' for `loc', for consistency.
10618 (Error, Warning): Remove unneeded Tc argument.
10620 * assign.cs, literal.cs, constant.cs: Update to new calling
10623 * codegen.cs: EmitContext now contains a flag indicating whether
10624 code is being generated in a static method or not.
10626 * cs-parser.jay: DecomposeQI, new function that replaces the old
10627 QualifiedIdentifier. Now we always decompose the assembled
10628 strings from qualified_identifier productions into a group of
10631 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10633 * rootcontext.cs: Deal with field-less struct types correctly now
10634 by passing the size option to Define Type.
10636 * class.cs: Removed hack that created one static field.
10638 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10640 * statement.cs: Moved most of the code generation here.
10642 2001-10-09 Ravi Pratap <ravi@ximian.com>
10644 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10647 (ElementAccess): Remove useless bits for now - keep checks as the spec
10650 2001-10-08 Ravi Pratap <ravi@ximian.com>
10652 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10653 and start performing checks according to the spec.
10655 2001-10-07 Ravi Pratap <ravi@ximian.com>
10657 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10658 rank_specifiers instead.
10660 (rank_specifiers): Change the order in which the rank specifiers are stored
10662 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10664 * expression.cs (ElementAccess): Implement the LValue interface too.
10666 2001-10-06 Ravi Pratap <ravi@ximian.com>
10668 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10669 except that user defined conversions are not included.
10671 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10672 perform the conversion of the return type, if necessary.
10674 (New::DoResolve): Check whether we are creating an array or an object
10675 and accordingly do the needful.
10677 (New::Emit): Same here.
10679 (New::DoResolve): Implement guts of array creation.
10681 (New::FormLookupType): Helper function.
10683 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10685 * codegen.cs: Removed most of the code generation here, and move the
10686 corresponding code generation bits to the statement classes.
10688 Added support for try/catch/finalize and throw.
10690 * cs-parser.jay: Added support for try/catch/finalize.
10692 * class.cs: Catch static methods having the flags override,
10693 virtual or abstract.
10695 * expression.cs (UserCast): This user cast was not really doing
10696 what it was supposed to do. Which is to be born in fully resolved
10697 state. Parts of the resolution were being performed at Emit time!
10701 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10703 * expression.cs: Implicity convert the result from UserCast.
10705 2001-10-05 Ravi Pratap <ravi@ximian.com>
10707 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10708 prevented it from working correctly.
10710 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10711 merely ConvertImplicit.
10713 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10715 * typemanager.cs: Make the LookupTypeContainer function static,
10716 and not per-instance.
10718 * class.cs: Make static FindMembers (the one that takes a Type
10721 * codegen.cs: Add EmitForeach here.
10723 * cs-parser.jay: Make foreach a toplevel object instead of the
10724 inline expansion, as we need to perform semantic analysis on it.
10726 2001-10-05 Ravi Pratap <ravi@ximian.com>
10728 * expression.cs (Expression::ImplicitUserConversion): Rename to
10729 UserDefinedConversion.
10731 (Expression::UserDefinedConversion): Take an extra argument specifying
10732 whether we look for explicit user conversions too.
10734 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10736 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10738 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10739 with the appropriate arguments.
10741 * cs-parser.jay (cast_expression): Record location too.
10743 * expression.cs (Cast): Record location info.
10745 (Expression::ConvertExplicit): Take location argument.
10747 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10748 to determine if we are doing explicit conversions.
10750 (UserCast::Emit): Update accordingly.
10752 (Expression::ConvertExplicit): Report an error if everything fails.
10754 * ../errors/cs0030.cs : Add.
10756 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10758 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10759 virtual and newslot bits.
10761 * class.cs (TypeContainer::RegisterRequiredImplementations):
10762 Record methods we need.
10764 (TypeContainer::MakeKey): Helper function to make keys for
10765 MethodBases, since the Methodbase key is useless.
10767 (TypeContainer::Populate): Call RegisterRequiredImplementations
10768 before defining the methods.
10770 Create a mapping for method_builders_to_methods ahead of time
10771 instead of inside a tight loop.
10773 (::RequireMethods): Accept an object as the data to set into the
10774 hashtable so we can report interface vs abstract method mismatch.
10776 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10778 * report.cs: Make all of it static.
10780 * rootcontext.cs: Drop object_type and value_type computations, as
10781 we have those in the TypeManager anyways.
10783 Drop report instance variable too, now it is a global.
10785 * driver.cs: Use try/catch on command line handling.
10787 Add --probe option to debug the error reporting system with a test
10790 * report.cs: Add support for exiting program when a probe
10791 condition is reached.
10793 2001-10-03 Ravi Pratap <ravi@ximian.com>
10795 * expression.cs (Binary::DoNumericPromotions): Fix the case when
10796 we do a forcible conversion regardless of type, to check if
10797 ForceConversion returns a null.
10799 (Binary::error19): Use location to report error.
10801 (Unary::error23): Use location here too.
10803 * ../errors/cs0019.cs : Check in.
10805 * ../errors/cs0023.cs : Check in.
10807 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10808 case of a non-null MethodInfo object with a length of 0 !
10810 (Binary::ResolveOperator): Flag error if overload resolution fails to find
10811 an applicable member - according to the spec :-)
10812 Also fix logic to find members in base types.
10814 (Unary::ResolveOperator): Same here.
10816 (Unary::report23): Change name to error23 and make first argument a TypeContainer
10817 as I was getting thoroughly confused between this and error19 :-)
10819 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10820 (::FindMostEncompassedType): Implement.
10821 (::FindMostEncompassingType): Implement.
10822 (::StandardConversionExists): Implement.
10824 (UserImplicitCast): Re-vamp. We now need info about most specific
10825 source and target types so that we can do the necessary conversions.
10827 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10828 mathematical union with no duplicates.
10830 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10832 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10833 in order from base classes to child classes, so that we can in
10834 child classes look up in our parent for method names and
10835 attributes (required for handling abstract, virtual, new, override
10836 constructs: we need to instrospect our base class, and if we dont
10837 populate the classes in order, the introspection might be
10838 incorrect. For example, a method could query its parent before
10839 the parent has any methods and would determine that the parent has
10840 no abstract methods (while it could have had them)).
10842 (RootContext::CreateType): Record the order in which we define the
10845 2001-10-02 Miguel de Icaza <miguel@ximian.com>
10847 * class.cs (TypeContainer::Populate): Also method definitions can
10848 fail now, keep track of this.
10850 (TypeContainer::FindMembers): Implement support for
10851 DeclaredOnly/noDeclaredOnly flag.
10853 (Constructor::Emit) Return the ConstructorBuilder.
10855 (Method::Emit) Return the MethodBuilder.
10856 Check for abstract or virtual methods to be public.
10858 * rootcontext.cs (RootContext::CreateType): Register all the
10859 abstract methods required for the class to be complete and the
10860 interface methods that must be implemented.
10862 * cs-parser.jay: Report error 501 (method requires body if it is
10863 not marked abstract or extern).
10865 * expression.cs (TypeOf::Emit): Implement.
10867 * typemanager.cs: runtime_handle_type, new global type.
10869 * class.cs (Property::Emit): Generate code for properties.
10871 2001-10-02 Ravi Pratap <ravi@ximian.com>
10873 * expression.cs (Unary::ResolveOperator): Find operators on base type
10874 too - we now conform exactly to the spec.
10876 (Binary::ResolveOperator): Same here.
10878 * class.cs (Operator::Define): Fix minor quirk in the tests.
10880 * ../errors/cs0215.cs : Added.
10882 * ../errors/cs0556.cs : Added.
10884 * ../errors/cs0555.cs : Added.
10886 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10888 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10889 single integer which is really efficient
10891 2001-10-01 Ravi Pratap <ravi@ximian.com>
10893 * expression.cs (Expression::ImplicitUserConversion): Use location
10894 even in the case when we are examining True operators.
10896 * class.cs (Operator::Define): Perform extensive checks to conform
10897 with the rules for operator overloading in the spec.
10899 * expression.cs (Expression::ImplicitReferenceConversion): Implement
10900 some of the other conversions mentioned in the spec.
10902 * typemanager.cs (array_type): New static member for the System.Array built-in
10905 (cloneable_interface): For System.ICloneable interface.
10907 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10908 we start resolving the tree and populating types.
10910 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10912 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10914 * expression.cs (Expression::ExprClassFromMemberInfo,
10915 Expression::Literalize): Create literal expressions from
10916 FieldInfos which are literals.
10918 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10919 type casts, because they were wrong. The test suite in tests
10922 (ImplicitNumericConversion): ushort to ulong requires a widening
10925 Int32 constant to long requires widening cast as well.
10927 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10928 for integers because the type on the stack is not i4.
10930 2001-09-30 Miguel de Icaza <miguel@ximian.com>
10932 * expression.cs (report118): require location argument.
10934 * parameter.cs: Do not dereference potential null value.
10936 * class.cs: Catch methods that lack the `new' keyword when
10937 overriding a name. Report warnings when `new' is used without
10938 anything being there to override.
10940 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10942 * class.cs: Only add constructor to hashtable if it is non-null
10943 (as now constructors can fail on define).
10945 (TypeManager, Class, Struct): Take location arguments.
10947 Catch field instance initialization in structs as errors.
10949 accepting_filter: a new filter for FindMembers that is static so
10950 that we dont create an instance per invocation.
10952 (Constructor::Define): Catch errors where a struct constructor is
10955 * cs-parser.jay: Pass location information for various new
10958 * delegate.cs (Delegate): take a location argument.
10960 * driver.cs: Do not call EmitCode if there were problesm in the
10961 Definition of the types, as many Builders wont be there.
10963 * decl.cs (Decl::Decl): Require a location argument.
10965 * cs-tokenizer.cs: Handle properly hex constants that can not fit
10966 into integers, and find the most appropiate integer for it.
10968 * literal.cs: Implement ULongLiteral.
10970 * rootcontext.cs: Provide better information about the location of
10971 failure when CreateType fails.
10973 2001-09-29 Miguel de Icaza <miguel@ximian.com>
10975 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10978 * expression.cs (Binary::CheckShiftArguments): Add missing type
10980 (Binary::ResolveOperator): Add type to the logical and and logical
10981 or, Bitwise And/Or and Exclusive Or code paths, it was missing
10984 (Binary::DoNumericPromotions): In the case where either argument
10985 is ulong (and most signed types combined with ulong cause an
10986 error) perform implicit integer constant conversions as well.
10988 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10990 * expression.cs (UserImplicitCast): Method should always be
10992 (Invocation::BetterConversion): Simplified test for IntLiteral.
10994 (Expression::ImplicitNumericConversion): Split this routine out.
10995 Put the code that performs implicit constant integer conversions
10998 (Expression::Resolve): Become a wrapper around DoResolve so we can
10999 check eclass and type being set after resolve.
11001 (Invocation::Badness): Remove this dead function
11003 (Binary::ResolveOperator): Do not compute the expensive argumnets
11004 unless we have a union for it.
11006 (Probe::Emit): Is needs to do an isinst and then
11007 compare against null.
11009 (::CanConvert): Added Location argument. If the Location argument
11010 is null (Location.Null), then we do not report errors. This is
11011 used by the `probe' mechanism of the Explicit conversion. We do
11012 not want to generate an error for something that the user
11013 explicitly requested to be casted. But the pipeline for an
11014 explicit cast first tests for potential implicit casts.
11016 So for now, if the Location is null, it means `Probe only' to
11017 avoid adding another argument. Might have to revise this
11020 (ClassCast): New class used to type cast objects into arbitrary
11021 classes (used in Explicit Reference Conversions).
11023 Implement `as' as well.
11025 Reverted all the patches from Ravi below: they were broken:
11027 * The use of `level' as a mechanism to stop recursive
11028 invocations is wrong. That was there just to catch the
11029 bug with a strack trace but not as a way of addressing
11032 To fix the problem we have to *understand* what is going
11033 on and the interactions and come up with a plan, not
11034 just get things going.
11036 * The use of the type conversion cache that I proposed
11037 last night had an open topic: How does this work across
11038 protection domains. A user defined conversion might not
11039 be public in the location where we are applying the
11040 conversion, a different conversion might be selected
11041 (ie, private A->B (better) but public B->A (worse),
11042 inside A, A->B applies, but outside it, B->A will
11045 * On top of that (ie, even if the above is solved),
11046 conversions in a cache need to be abstract. Ie, `To
11047 convert from an Int to a Short use an OpcodeCast', not
11048 `To convert from an Int to a Short use the OpcodeCast on
11049 the variable 5' (which is what this patch was doing).
11051 2001-09-28 Ravi Pratap <ravi@ximian.com>
11053 * expression.cs (Invocation::ConversionExists): Re-write to use
11054 the conversion cache
11056 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11057 cache all conversions done, not just user-defined ones.
11059 (Invocation::BetterConversion): The real culprit. Use ConversionExists
11060 to determine if a conversion exists instead of acutually trying to
11061 perform the conversion. It's faster too.
11063 (Expression::ConvertExplicit): Modify to use ConversionExists to check
11064 and only then attempt the implicit conversion.
11066 2001-09-28 Ravi Pratap <ravi@ximian.com>
11068 * expression.cs (ConvertImplicit): Use a cache for conversions
11069 already found. Check level of recursion and bail out if necessary.
11071 2001-09-28 Miguel de Icaza <miguel@ximian.com>
11073 * typemanager.cs (string_concat_string_string, string_concat_object_object):
11074 Export standard methods that we expect for string operations.
11076 * statement.cs (Block::UsageWarning): Track usage of variables and
11077 report the errors for not used variables.
11079 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11082 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11084 * codegen.cs: remove unnneded code
11086 * expression.cs: Removed BuiltinTypeAccess class
11088 Fix the order in which implicit conversions are
11091 The previous fixed dropped support for boxed conversions (adding a
11092 test to the test suite now)
11094 (UserImplicitCast::CanConvert): Remove test for source being null,
11095 that code is broken. We should not feed a null to begin with, if
11096 we do, then we should track the bug where the problem originates
11097 and not try to cover it up here.
11099 Return a resolved expression of type UserImplicitCast on success
11100 rather than true/false. Ravi: this is what I was talking about,
11101 the pattern is to use a static method as a "constructor" for
11104 Also, do not create arguments until the very last minute,
11105 otherwise we always create the arguments even for lookups that
11106 will never be performed.
11108 (UserImplicitCast::Resolve): Eliminate, objects of type
11109 UserImplicitCast are born in a fully resolved state.
11111 * typemanager.cs (InitCoreTypes): Init also value_type
11112 (System.ValueType).
11114 * expression.cs (Cast::Resolve): First resolve the child expression.
11116 (LValue): Add new method AddressOf to be used by
11119 Change the argument of Store to take an EmitContext instead of an
11120 ILGenerator, because things like FieldExpr need to be able to call
11121 their children expression to generate the instance code.
11123 (Expression::Error, Expression::Warning): Sugar functions for
11126 (Expression::MemberLookup): Accept a TypeContainer instead of a
11127 Report as the first argument.
11129 (Expression::ResolvePrimary): Killed. I still want to improve
11130 this as currently the code is just not right.
11132 (Expression::ResolveMemberAccess): Simplify, but it is still
11135 (Unary::Resolve): Catch errors in AddressOf operators.
11137 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11138 index to a byte for the short-version, or the compiler will choose
11139 the wrong Emit call, which generates the wrong data.
11141 (ParameterReference::Emit, ::Store): same.
11143 (FieldExpr::AddressOf): Implement.
11145 * typemanager.cs: TypeManager: made public variable instead of
11148 * driver.cs: document --fatal.
11150 * report.cs (ErrorMessage, WarningMessage): new names for the old
11151 Error and Warning classes.
11153 * cs-parser.jay (member_access): Turn built-in access to types
11154 into a normal simplename
11156 2001-09-27 Ravi Pratap <ravi@ximian.com>
11158 * expression.cs (Invocation::BetterConversion): Fix to cope
11159 with q being null, since this was introducing a bug.
11161 * expression.cs (ConvertImplicit): Do built-in conversions first.
11163 2001-09-27 Ravi Pratap <ravi@ximian.com>
11165 * expression.cs (UserImplicitCast::Resolve): Fix bug.
11167 2001-09-27 Ravi Pratap <ravi@ximian.com>
11169 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11170 I had introduced long ago (what's new ?).
11172 * expression.cs (UserImplicitCast::CanConvert): Static method to do
11173 the work of all the checking.
11174 (ConvertImplicit): Call CanConvert and only then create object if necessary.
11175 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11177 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11178 that is the right way.
11180 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
11181 overloading resolution. Use everywhere instead of cutting and pasting code.
11183 (Binary::ResolveOperator): Use MakeUnionSet.
11185 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
11186 we have to convert to bool types. Not complete yet.
11188 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11190 * typemanager.cs (TypeManager::CSharpName): support ushort.
11192 * expression.cs (Expression::TryImplicitIntConversion): Attempts
11193 to provide an expression that performsn an implicit constant int
11194 conversion (section 6.1.6).
11195 (Expression::ConvertImplicitRequired): Reworked to include
11196 implicit constant expression conversions.
11198 (Expression::ConvertNumericExplicit): Finished.
11200 (Invocation::Emit): If InstanceExpression is null, then it means
11201 that we perform a call on this.
11203 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11205 * expression.cs (Unary::Emit): Remove some dead code.
11206 (Probe): Implement Resolve and Emit for `is'.
11207 (Expression::ConvertImplicitRequired): Attempt to do constant
11208 expression conversions here. Maybe should be moved to
11209 ConvertImplicit, but I am not sure.
11210 (Expression::ImplicitLongConstantConversionPossible,
11211 Expression::ImplicitIntConstantConversionPossible): New functions
11212 that tell whether is it possible to apply an implicit constant
11213 expression conversion.
11215 (ConvertNumericExplicit): Started work on explicit numeric
11218 * cs-parser.jay: Update operator constants.
11220 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11221 (Parameters::GetSignature): Hook up VerifyArgs here.
11222 (Parameters::VerifyArgs): Verifies that no two arguments have the
11225 * class.cs (Operator): Update the operator names to reflect the
11226 ones that the spec expects (as we are just stringizing the
11229 * expression.cs (Unary::ResolveOperator): Fix bug: Use
11230 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11231 previous usage did only work for our methods.
11232 (Expression::ConvertImplicit): Handle decimal implicit numeric
11233 conversions as well.
11234 (Expression::InternalTypeConstructor): Used to invoke constructors
11235 on internal types for default promotions.
11237 (Unary::Emit): Implement special handling for the pre/post
11238 increment/decrement for overloaded operators, as they need to have
11239 the same semantics as the other operators.
11241 (Binary::ResolveOperator): ditto.
11242 (Invocation::ConversionExists): ditto.
11243 (UserImplicitCast::Resolve): ditto.
11245 2001-09-26 Ravi Pratap <ravi@ximian.com>
11247 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11248 operator, return after emitting body. Regression tests pass again !
11250 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11251 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11252 (Invocation::OverloadResolve): Ditto.
11253 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11255 * everywhere : update calls to the above methods accordingly.
11257 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11259 * assign.cs (Assign): Make it inherit from ExpressionStatement.
11261 * expression.cs (ExpressionStatement): New base class used for
11262 expressions that can appear in statements, so that we can provide
11263 an alternate path to generate expression that do not leave a value
11266 (Expression::Emit, and all the derivatives): We no longer return
11267 whether a value is left on the stack or not. Every expression
11268 after being emitted leaves a single value on the stack.
11270 * codegen.cs (EmitContext::EmitStatementExpression): Use the
11271 facilties of ExpressionStatement if possible.
11273 * cs-parser.jay: Update statement_expression.
11275 2001-09-25 Miguel de Icaza <miguel@ximian.com>
11277 * driver.cs: Change the wording of message
11279 2001-09-25 Ravi Pratap <ravi@ximian.com>
11281 * expression.cs (Binary::ResolveOperator): Had forgottten to set
11282 the type of the expression to the return type of the method if
11283 we have an overloaded operator match ! The regression tests pass again !
11284 (Unary::ResolveOperator): Ditto.
11286 * expression.cs (Invocation::ConversionExists): Correct the member lookup
11287 to find "op_Implicit", not "implicit" ;-)
11288 (UserImplicitCast): New class to take care of user-defined implicit conversions.
11289 (ConvertImplicit, ForceConversion): Take TypeContainer argument
11291 * everywhere : Correct calls to the above accordingly.
11293 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11294 (ConvertImplicit): Do user-defined conversion if it exists.
11296 2001-09-24 Miguel de Icaza <miguel@ximian.com>
11298 * assign.cs: track location.
11299 (Resolve): Use implicit conversions on assignment.
11301 * literal.cs: Oops. Not good, Emit of short access values should
11302 pass (Bytes) or the wrong argument will be selected.
11304 * expression.cs (Unary::Emit): Emit code for -expr.
11306 (Unary::ResolveOperator): Handle `Substract' for non-constants
11307 (substract from zero from the non-constants).
11308 Deal with Doubles as well.
11310 (Expression::ConvertImplicitRequired): New routine that reports an
11311 error if no implicit conversion exists.
11313 (Invocation::OverloadResolve): Store the converted implicit
11314 expressions if we make them
11316 2001-09-24 Ravi Pratap <ravi@ximian.com>
11318 * class.cs (ConstructorInitializer): Take a Location argument.
11319 (ConstructorBaseInitializer): Same here.
11320 (ConstructorThisInitializer): Same here.
11322 * cs-parser.jay : Update all calls accordingly.
11324 * expression.cs (Unary, Binary, New): Take location argument.
11325 Update accordingly everywhere.
11327 * cs-parser.jay : Update all calls to the above to take a location
11330 * class.cs : Ditto.
11332 2001-09-24 Ravi Pratap <ravi@ximian.com>
11334 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11335 (Invocation::BetterConversion): Same here
11336 (Invocation::ConversionExists): Ditto.
11338 (Invocation::ConversionExists): Implement.
11340 2001-09-22 Ravi Pratap <ravi@ximian.com>
11342 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11343 Also take an additional TypeContainer argument.
11345 * All over : Pass in TypeContainer as argument to OverloadResolve.
11347 * typemanager.cs (CSharpName): Update to check for the string type and return
11350 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11353 2001-09-21 Ravi Pratap <ravi@ximian.com>
11355 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11356 (Invocation::BetterFunction): Implement.
11357 (Invocation::BetterConversion): Implement.
11358 (Invocation::ConversionExists): Skeleton, no implementation yet.
11360 Okay, things work fine !
11362 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11364 * typemanager.cs: declare and load enum_type, delegate_type and
11367 * expression.cs (Expression::Emit): Now emit returns a value that
11368 tells whether a value is left on the stack or not. This strategy
11369 might be reveted tomorrow with a mechanism that would address
11370 multiple assignments.
11371 (Expression::report118): Utility routine to report mismatches on
11374 (Unary::Report23): Report impossible type/operator combination
11377 (Unary::IsIncrementableNumber): Whether the type can be
11378 incremented or decremented with add.
11379 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11381 (Unary::ResolveOperator): Implement ++, !, ~,
11383 (Invocation::Emit): Deal with new Emit convetion.
11385 * All Expression derivatives: Updated their Emit method to return
11386 whether they leave values on the stack or not.
11388 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11389 stack for expressions that are statements.
11391 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11393 * expression.cs (LValue): New interface. Must be implemented by
11395 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11398 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11399 interface for generating code, simplifies the code.
11401 2001-09-20 Ravi Pratap <ravi@ximian.com>
11403 * expression.cs (everywhere): Comment out return statements in ::Resolve
11404 methods to avoid the warnings.
11406 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11408 * driver.cs (parse): Report error 2001 if we can not open the
11411 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11414 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11417 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11418 otherwise nested blocks end up with the same index.
11420 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11422 * expression.cs: Instead of having FIXMEs in the Resolve
11423 functions, throw exceptions so it is obvious that we are facing a
11426 * cs-parser.jay (invocation_expression): Pass Location information.
11428 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11429 Use a basename for those routines because .NET does not like paths
11432 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11435 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11437 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11438 are loading the correct data types (throws an exception if not).
11439 (TypeManager::InitCoreTypes): Use CoreLookupType
11441 * expression.cs (Unary::ResolveOperator): return the child
11442 expression for expressions which are just +expr.
11443 (Unary::ResolveOperator): Return negative literals for -LITERAL
11444 expressions (otherwise they are Unary {Literal}).
11445 (Invocation::Badness): Take into account `Implicit constant
11446 expression conversions'.
11448 * literal.cs (LongLiteral): Implement long literal class.
11449 (IntLiteral): export the `Value' of the intliteral.
11451 2001-09-19 Ravi Pratap <ravi@ximian.com>
11453 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11455 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11456 instead of 'Operator'
11458 * expression.cs (Binary::ResolveOperator): Update accordingly.
11459 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11462 * cs-parser.jay (unary_expression): Update to use the new names.
11464 * gen-treedump.cs (GetUnary): Same here.
11466 * expression.cs (Unary::Resolve): Implement.
11467 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11468 operators are found instead of making noise ;-)
11469 (Unary::ResolveOperator): New method to do precisely the same thing which
11470 Binary::ResolveOperator does for Binary expressions.
11471 (Unary.method, .Arguments): Add.
11472 (Unary::OperName): Implement.
11473 (Unary::ForceConversion): Copy and Paste !
11475 * class.cs (Operator::Define): Fix a small bug for the case when we have
11478 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11479 for the inbuilt operators. Only overloading works for now ;-)
11481 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11483 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11484 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11486 * expression.cs (This::Emit): Implement.
11487 (This::Resolve): Implement.
11488 (TypeOf:Resolve): Implement.
11489 (Expression::ResolveSimpleName): Add an implicit this to instance
11491 (MemberAccess::Resolve): Deal with Parameters and Fields.
11492 Bind instance variable to Field expressions.
11493 (FieldExpr::Instance): New field used to track the expression that
11494 represents the object instance.
11495 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11497 (FieldExpr::Emit): Implement.
11499 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11500 the last instruction contains a return opcode to avoid generating
11501 the last `ret' instruction (this generates correct code, and it is
11502 nice to pass the peverify output).
11504 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11505 initializer for static and instance variables.
11506 (Constructor::Emit): Allow initializer to be null in the case of
11507 static constructors. Only emit initializer for instance
11510 (TypeContainer::FindMembers): Return a null array if there are no
11513 Also fix the code for the MemberTypes.Method branch, as it was not
11514 scanning that for operators (or tried to access null variables before).
11516 * assign.cs (Assign::Emit): Handle instance and static fields.
11520 * driver.cs: Stop compilation if there are parse errors.
11522 * cs-parser.jay (constructor_declaration): Provide default base
11523 initializer for non-static constructors.
11524 (constructor_declarator): Do not provide a default base
11525 initializers if none was specified.
11526 Catch the fact that constructors should not have parameters.
11528 * class.cs: Do not emit parent class initializers for static
11529 constructors, that should be flagged as an error.
11531 2001-09-18 Ravi Pratap <ravi@ximian.com>
11533 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11534 Move back code into TypeContainer::Populate.
11536 2001-09-18 Ravi Pratap <ravi@ximian.com>
11538 * class.cs (TypeContainer::AddConstructor): Fix the check to
11539 compare against Name, not Basename.
11540 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11542 * cs-parser.jay : Update accordingly.
11544 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11545 for methods, don't forget to look into the operators too.
11546 (RegisterMethodBuilder): Helper method to take care of this for
11547 methods, constructors and operators.
11548 (Operator::Define): Completely revamp.
11549 (Operator.OperatorMethod, MethodName): New fields.
11550 (TypeContainer::Populate): Move the registering of builders into
11551 RegisterMethodBuilder.
11552 (Operator::Emit): Re-write.
11554 * expression.cs (Binary::Emit): Comment out code path to emit method
11555 invocation stuff for the case when we have a user defined operator. I am
11556 just not able to get it right !
11558 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11560 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11563 (Expression::MemberLookup): Provide a version that allows to
11564 specify the MemberTypes and BindingFlags.
11566 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11567 so it was not fetching variable information from outer blocks.
11569 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11570 Beforefieldinit as it was buggy.
11572 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11573 that Ravi put here.
11575 * class.cs (Constructor::Emit): Only emit if block is not null.
11576 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11577 deal with this by semantically definining it as if the user had
11580 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11581 constructors as we now "emit" them at a higher level.
11583 (TypeContainer::DefineDefaultConstructor): Used to define the
11584 default constructors if none was provided.
11586 (ConstructorInitializer): Add methods Resolve and Emit.
11588 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11590 2001-09-17 Ravi Pratap <ravi@ximian.com>
11592 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11593 the default constructor builder with our hashtable for methodbuilders
11596 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11597 and argument_count is 0 in which case we have a match.
11598 (Binary::ResolveOperator): More null checking and miscellaneous coding
11601 2001-09-17 Ravi Pratap <ravi@ximian.com>
11603 * rootcontext.cs (IsNameSpace): Compare against null.
11605 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11607 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11608 and Unary::Operator.
11610 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11613 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11614 we have overloaded operators.
11615 (Binary::ResolveOperator): Implement the part which does the operator overload
11618 * class.cs (Operator::Emit): Implement.
11619 (TypeContainer::Emit): Emit the operators we have too.
11621 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11622 the case when we have a user-defined operator.
11624 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11626 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11628 2001-09-16 Ravi Pratap <ravi@ximian.com>
11630 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11631 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11632 (Constructor::Emit): Implement.
11633 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11634 if we have no work to do.
11635 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11638 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11639 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11641 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11644 2001-09-15 Ravi Pratap <ravi@ximian.com>
11646 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11648 (Tree::RecordNamespace): Method to do what the name says ;-)
11649 (Tree::Namespaces): Property to get at the namespaces hashtable.
11651 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11654 * rootcontext.cs (IsNamespace): Fixed it :-)
11656 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11658 * class.cs (TypeContainer::FindMembers): Add support for
11660 (MethodCore): New class that encapsulates both the shared aspects
11661 of a Constructor and a Method.
11662 (Method, Constructor): Factored pieces into MethodCore.
11664 * driver.cs: Added --fatal which makes errors throw exceptions.
11665 Load System assembly as well as part of the standard library.
11667 * report.cs: Allow throwing exceptions on errors for debugging.
11669 * modifiers.cs: Do not use `parent', instead use the real type
11670 container to evaluate permission settings.
11672 * class.cs: Put Ravi's patch back in. He is right, and we will
11673 have to cope with the
11675 2001-09-14 Ravi Pratap <ravi@ximian.com>
11677 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11678 FamORAssem, not FamANDAssem.
11680 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11682 * driver.cs: Added --parse option that only parses its input files
11685 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11686 incorrect. IsTopLevel is not used to tell whether an object is
11687 root_types or not (that can be achieved by testing this ==
11688 root_types). But to see if this is a top-level *class* (not
11689 necessarly our "toplevel" container).
11691 2001-09-14 Ravi Pratap <ravi@ximian.com>
11693 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11694 parent instead of a direct call to GetType.
11696 2001-09-14 Ravi Pratap <ravi@ximian.com>
11698 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11699 Modifiers.TypeAttr. This should just be a call to that method.
11701 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11702 object so that we can determine if we are top-level or not.
11704 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11707 * enum.cs (Enum::Define): Ditto.
11709 * modifiers.cs (FieldAttr): Re-write.
11711 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11712 (TypeContainer::HaveStaticConstructor): New property to provide access
11713 to precisely that info.
11715 * modifiers.cs (MethodAttr): Re-write.
11716 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11718 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11719 of top-level types as claimed.
11721 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11723 * expression.cs (MemberLookup): Fruitless attempt to lookup
11724 constructors. Maybe I need to emit default constructors? That
11725 might be it (currently .NET emits this for me automatically).
11726 (Invocation::OverloadResolve): Cope with Arguments == null.
11727 (Invocation::EmitArguments): new function, shared by the new
11728 constructor and us.
11729 (Invocation::Emit): Handle static and instance methods. Emit
11730 proper call instruction for virtual or non-virtual invocations.
11731 (New::Emit): Implement.
11732 (New::Resolve): Implement.
11733 (MemberAccess:Resolve): Implement.
11734 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11735 to track instances.
11736 (FieldExpr::Resolve): Set type.
11738 * support.cs: Handle empty arguments.
11740 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11741 SimpleLookup): Auxiliary routines to help parse a qualifier
11744 Update qualifier_identifier rule.
11746 * codegen.cs: Removed debugging messages.
11748 * class.cs: Make this a global thing, this acts just as a "key" to
11749 objects that we might have around.
11751 (Populate): Only initialize method_builders_to_methods once.
11753 * expression.cs (PropertyExpr): Initialize type from the
11756 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11757 Resolve pattern. Attempt to implicitly convert value to boolean.
11760 * expression.cs: Set the type for the int32/int32 argument case.
11761 (Binary::ResolveOperator): Set the return type to boolean for
11762 comparission operators
11764 * typemanager.cs: Remove debugging print code.
11766 (Invocation::Resolve): resolve type.
11768 * class.cs: Allocate a MemberInfo of the correct size, as the code
11769 elsewhere depends on the test to reflect the correct contents.
11771 (Method::) Keep track of parameters, due to System.Reflection holes
11773 (TypeContainer::Populate): Keep track of MethodBuilders to Method
11776 (TypeContainer::FindMembers): Use ArrayList and then copy an array
11777 of the exact size and return that.
11779 (Class::LookupMethodByBuilder): New function that maps
11780 MethodBuilders to its methods. Required to locate the information
11781 on methods because System.Reflection bit us again.
11783 * support.cs: New file, contains an interface ParameterData and
11784 two implementations: ReflectionParameters and InternalParameters
11785 used to access Parameter information. We will need to grow this
11788 * expression.cs (Invocation::GetParameterData): implement a cache
11789 and a wrapper around the ParameterData creation for methods.
11790 (Invocation::OverloadResolve): Use new code.
11792 2001-09-13 Ravi Pratap <ravi@ximian.com>
11794 * class.cs (TypeContainer::EmitField): Remove and move into
11795 (Field::Define): here and modify accordingly.
11796 (Field.FieldBuilder): New member.
11797 (TypeContainer::Populate): Update accordingly.
11798 (TypeContainer::FindMembers): Implement.
11800 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11802 * statement.cs: (VariableInfo::VariableType): New field to be
11803 initialized with the full type once it is resolved.
11805 2001-09-12 Miguel de Icaza <miguel@ximian.com>
11807 * parameter.cs (GetParameterInfo): Use a type cache to compute
11808 things only once, and to reuse this information
11810 * expression.cs (LocalVariableReference::Emit): Implement.
11811 (OpcodeCast::Emit): fix.
11813 (ParameterReference::Resolve): Implement.
11814 (ParameterReference::Emit): Implement.
11816 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11817 that are expressions need to stay as Expressions.
11819 * typemanager.cs (CSharpName): Returns the C# name of a type if
11822 * expression.cs (Expression::ConvertImplicit): New function that
11823 implements implicit type conversions.
11825 (Expression::ImplicitReferenceConversion): Implements implicit
11826 reference conversions.
11828 (EmptyCast): New type for transparent casts.
11830 (OpcodeCast): New type for casts of types that are performed with
11831 a sequence of bytecodes.
11833 (BoxedCast): New type used for casting value types into reference
11834 types. Emits a box opcode.
11836 (Binary::DoNumericPromotions): Implements numeric promotions of
11837 and computation of the Binary::Type.
11839 (Binary::EmitBranchable): Optimization.
11841 (Binary::Emit): Implement code emission for expressions.
11843 * typemanager.cs (TypeManager): Added two new core types: sbyte
11846 2001-09-12 Ravi Pratap <ravi@ximian.com>
11848 * class.cs (TypeContainer::FindMembers): Method which does exactly
11849 what Type.FindMembers does, only we don't have to use reflection. No
11850 implementation yet.
11852 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11853 typecontainer objects as we need to get at them.
11854 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11856 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11857 typecontainer object.
11859 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11860 of just a Report object.
11862 2001-09-11 Ravi Pratap <ravi@ximian.com>
11864 * class.cs (Event::Define): Go back to using the prefixes "add_" and
11866 (TypeContainer::Populate): Now define the delegates of the type too.
11867 (TypeContainer.Delegates): Property to access the list of delegates defined
11870 * delegates.cs (Delegate::Define): Implement partially.
11872 * modifiers.cs (TypeAttr): Handle more flags.
11874 2001-09-11 Ravi Pratap <ravi@ximian.com>
11876 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11878 (Operator::Define): Re-write logic to get types by using the LookupType method
11879 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11880 (Indexer::Define): Ditto.
11881 (Event::Define): Ditto.
11882 (Property::Define): Ditto.
11884 2001-09-10 Ravi Pratap <ravi@ximian.com>
11886 * class.cs (TypeContainer::Populate): Now define operators too.
11887 (TypeContainer.Operators): New property to access the list of operators
11889 (Operator.OperatorMethodBuilder): New member to hold the method builder
11890 for the operator we are defining.
11891 (Operator::Define): Implement.
11893 2001-09-10 Ravi Pratap <ravi@ximian.com>
11895 * class.cs (Event::Define): Make the prefixes of the accessor methods
11896 addOn_ and removeOn_
11898 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11899 of the location being passed in too. Ideally, this should go later since all
11900 error reporting should be done through the Report object.
11902 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11903 (Populate): Iterate thru the indexers we have and define them too.
11904 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11905 for the get and set accessors.
11906 (Indexer::Define): Implement.
11908 2001-09-09 Miguel de Icaza <miguel@ximian.com>
11910 * expression.cs (Binary::Resolve): Beginning of it. I scratched
11911 my previous implementation, did not work.
11913 * typemanager.cs: Add a couple of missing types (the longs).
11915 * literal.cs: Use TypeManager.bool_type instead of getting it.
11917 * expression.cs (EventExpr): New kind of expressions.
11918 (Expressio::ExprClassFromMemberInfo): finish
11920 2001-09-08 Miguel de Icaza <miguel@ximian.com>
11922 * assign.cs: Emit stores to static fields differently.
11924 2001-09-08 Ravi Pratap <ravi@ximian.com>
11926 * Merge in changes and adjust code to tackle conflicts. Backed out my
11927 code in Assign::Resolve ;-)
11929 2001-09-08 Ravi Pratap <ravi@ximian.com>
11931 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11932 instead Report.Error and also pass in the location.
11933 (CSharpParser::Lexer): New readonly property to return the reference
11934 to the Tokenizer object.
11935 (declare_local_variables): Use Report.Error with location instead of plain
11939 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11940 (Operator.CheckBinaryOperator): Ditto.
11942 * cs-parser.jay (operator_declarator): Update accordingly.
11944 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11945 (CheckBinaryOperator): Same here.
11947 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11948 on the name without any prefixes of namespace names etc. This is because we
11949 already might have something already fully qualified like
11950 'System.Console.WriteLine'
11952 * assign.cs (Resolve): Begin implementation. Stuck ;-)
11954 2001-09-07 Ravi Pratap <ravi@ximian.com>
11956 * cs-tokenizer.cs (location): Return a string which also contains
11959 * expression.cs (ElementAccess): New class for expressions of the
11960 type 'element access.'
11961 (BaseAccess): New class for expressions of the type 'base access.'
11962 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11965 * cs-parser.jay (element_access): Implement action.
11966 (base_access): Implement actions.
11967 (checked_expression, unchecked_expression): Implement.
11969 * cs-parser.jay (local_variable_type): Correct and implement.
11970 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11972 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11974 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11975 name and the specifiers.
11977 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11979 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
11980 making them all public ;-)
11982 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11985 2001-09-07 Miguel de Icaza <miguel@ximian.com>
11987 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11989 (FieldExpr, PropertyExprs): New resolved expressions.
11990 (SimpleName::MemberStaticCheck): Perform static checks for access
11991 to non-static fields on static methods. Maybe this should be
11992 generalized for MemberAccesses.
11993 (SimpleName::ResolveSimpleName): More work on simple name
11996 * cs-parser.jay (primary_expression/qualified_identifier): track
11997 the parameter index.
11999 * codegen.cs (CodeGen::Save): Catch save exception, report error.
12000 (EmitContext::EmitBoolExpression): Chain to expression generation
12001 instead of temporary hack.
12002 (::EmitStatementExpression): Put generic expression code generation.
12004 * assign.cs (Assign::Emit): Implement variable assignments to
12005 local variables, parameters and fields.
12007 2001-09-06 Miguel de Icaza <miguel@ximian.com>
12009 * statement.cs (Block::GetVariableInfo): New method, returns the
12010 VariableInfo for a variable name in a block.
12011 (Block::GetVariableType): Implement in terms of GetVariableInfo
12013 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12014 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12016 2001-09-06 Ravi Pratap <ravi@ximian.com>
12018 * cs-parser.jay (operator_declaration): Continue on my quest : update
12019 to take attributes argument.
12020 (event_declaration): Ditto.
12021 (enum_declaration): Ditto.
12022 (indexer_declaration): Ditto.
12024 * class.cs (Operator::Operator): Update constructor accordingly.
12025 (Event::Event): Ditto.
12027 * delegate.cs (Delegate::Delegate): Same here.
12029 * enum.cs (Enum::Enum): Same here.
12031 2001-09-05 Ravi Pratap <ravi@ximian.com>
12033 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12035 * ../tests/cs0658.cs : New file to demonstrate error 0658.
12037 * attribute.cs (Attributes): New class to encapsulate all attributes which were
12038 being passed around as an arraylist.
12039 (Attributes::AddAttribute): Method to add attribute sections.
12041 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12042 (struct_declaration): Update accordingly.
12043 (constant_declaration): Update.
12044 (field_declaration): Update.
12045 (method_header): Update.
12046 (fixed_parameter): Update.
12047 (parameter_array): Ditto.
12048 (property_declaration): Ditto.
12049 (destructor_declaration): Ditto.
12051 * class.cs (Struct::Struct): Update constructors accordingly.
12052 (Class::Class): Ditto.
12053 (Field::Field): Ditto.
12054 (Method::Method): Ditto.
12055 (Property::Property): Ditto.
12056 (TypeContainer::OptAttribute): update property's return type.
12058 * interface.cs (Interface.opt_attributes): New member.
12059 (Interface::Interface): Update to take the extra Attributes argument.
12061 * parameter.cs (Parameter::Parameter): Ditto.
12063 * constant.cs (Constant::Constant): Ditto.
12065 * interface.cs (InterfaceMemberBase): New OptAttributes field.
12066 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
12067 the attributes as a parameter.
12068 (InterfaceProperty): Update constructor call.
12069 (InterfaceEvent): Ditto.
12070 (InterfaceMethod): Ditto.
12071 (InterfaceIndexer): Ditto.
12073 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
12074 pass the attributes too.
12075 (interface_event_declaration): Ditto.
12076 (interface_property_declaration): Ditto.
12077 (interface_method_declaration): Ditto.
12078 (interface_declaration): Ditto.
12080 2001-09-05 Miguel de Icaza <miguel@ximian.com>
12082 * class.cs (Method::Define): Track the "static Main" definition to
12083 create an entry point.
12085 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12086 EntryPoint if we find it.
12088 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12089 (EmitContext::ig): Make this variable public.
12091 * driver.cs: Make the default output file be the first file name
12092 with the .exe extension.
12094 Detect empty compilations
12096 Handle various kinds of output targets. Handle --target and
12097 rename -t to --dumper.
12099 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12100 methods inherited from Expression return now an Expression. This
12101 will is used during the tree rewriting as we resolve them during
12104 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12105 the spec. Missing entirely is the information about
12106 accessability of elements of it.
12108 (Expression::ExprClassFromMemberInfo): New constructor for
12109 Expressions that creates a fully initialized Expression based on
12110 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12113 (Invocation::Resolve): Begin implementing resolution of invocations.
12115 * literal.cs (StringLiteral): Implement Emit.
12117 2001-09-05 Ravi Pratap <ravi@ximian.com>
12119 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12122 2001-09-04 Ravi Pratap <ravi@ximian.com>
12124 * cs-parser.jay (attribute_arguments): Implement actions.
12125 (attribute): Fix bug in production. Implement action.
12126 (attribute_list): Implement.
12127 (attribute_target): Implement.
12128 (attribute_target_specifier, opt_target_specifier): Implement
12129 (CheckAttributeTarget): New method to check if the attribute target
12131 (attribute_section): Implement.
12132 (opt_attributes): Implement.
12134 * attribute.cs : New file to handle attributes.
12135 (Attribute): Class to hold attribute info.
12137 * cs-parser.jay (opt_attribute_target_specifier): Remove production
12138 (attribute_section): Modify production to use 2 different rules to
12139 achieve the same thing. 1 s/r conflict down !
12140 Clean out commented, useless, non-reducing dimension_separator rules.
12142 * class.cs (TypeContainer.attributes): New member to hold list
12143 of attributes for a type.
12144 (Struct::Struct): Modify to take one more argument, the attribute list.
12145 (Class::Class): Ditto.
12146 (Field::Field): Ditto.
12147 (Method::Method): Ditto.
12148 (Property::Property): Ditto.
12150 * cs-parser.jay (struct_declaration): Update constructor call to
12151 pass in the attributes too.
12152 (class_declaration): Ditto.
12153 (constant_declaration): Ditto.
12154 (field_declaration): Ditto.
12155 (method_header): Ditto.
12156 (fixed_parameter): Ditto.
12157 (parameter_array): Ditto.
12158 (property_declaration): Ditto.
12160 * constant.cs (Constant::Constant): Update constructor similarly.
12161 Use System.Collections.
12163 * parameter.cs (Parameter::Parameter): Update as above.
12165 2001-09-02 Ravi Pratap <ravi@ximian.com>
12167 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12168 (TypeContainer.delegates): New member to hold list of delegates.
12170 * cs-parser.jay (delegate_declaration): Implement the action correctly
12171 this time as I seem to be on crack ;-)
12173 2001-09-02 Miguel de Icaza <miguel@ximian.com>
12175 * rootcontext.cs (RootContext::IsNamespace): new function, used to
12176 tell whether an identifier represents a namespace.
12178 * expression.cs (NamespaceExpr): A namespace expression, used only
12179 temporarly during expression resolution.
12180 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12181 utility functions to resolve names on expressions.
12183 2001-09-01 Miguel de Icaza <miguel@ximian.com>
12185 * codegen.cs: Add hook for StatementExpressions.
12187 * class.cs: Fix inverted test for static flag in methods.
12189 2001-09-02 Ravi Pratap <ravi@ximian.com>
12191 * class.cs (Operator::CheckUnaryOperator): Correct error number used
12192 to make it coincide with MS' number.
12193 (Operator::CheckBinaryOperator): Ditto.
12195 * ../errors/errors.txt : Remove error numbers added earlier.
12197 * ../errors/cs1019.cs : Test case for error # 1019
12199 * ../errros/cs1020.cs : Test case for error # 1020
12201 * cs-parser.jay : Clean out commented cruft.
12202 (dimension_separators, dimension_separator): Comment out. Ostensibly not
12203 used anywhere - non-reducing rule.
12204 (namespace_declarations): Non-reducing rule - comment out.
12206 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12207 with TypeContainer::AddEnum.
12209 * delegate.cs : New file for delegate handling classes.
12210 (Delegate): Class for declaring delegates.
12212 * makefile : Update.
12214 * cs-parser.jay (delegate_declaration): Implement.
12216 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
12218 * class.cs (Event::Define): Implement.
12219 (Event.EventBuilder): New member.
12221 * class.cs (TypeContainer::Populate): Update to define all enums and events
12223 (Events): New property for the events arraylist we hold. Shouldn't we move to using
12224 readonly fields for all these cases ?
12226 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12228 * class.cs (Property): Revamp to use the convention of making fields readonly.
12229 Accordingly modify code elsewhere.
12231 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12232 the Define method of the Property class.
12234 * class.cs : Clean up applied patch and update references to variables etc. Fix
12236 (TypeContainer::Populate): Update to define all the properties we have. Also
12237 define all enumerations.
12239 * enum.cs (Define): Implement.
12241 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12243 * cs-parser.jay (overloadable_operator): The semantic value is an
12244 enum of the Operator class.
12245 (operator_declarator): Implement actions.
12246 (operator_declaration): Implement.
12248 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12249 validity of definitions.
12250 (Operator::CheckBinaryOperator): Static method to check for binary operators
12251 (TypeContainer::AddOperator): New method to add an operator to a type.
12253 * cs-parser.jay (indexer_declaration): Added line to actually call the
12254 AddIndexer method so it gets added ;-)
12256 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
12257 already taken care of by the MS compiler ?
12259 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12261 * class.cs (Operator): New class for operator declarations.
12262 (Operator::OpType): Enum for the various operators.
12264 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12266 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12267 ostensibly handle this in semantic analysis.
12269 * cs-parser.jay (general_catch_clause): Comment out
12270 (specific_catch_clauses, specific_catch_clause): Ditto.
12271 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12272 (catch_args, opt_catch_args): New productions.
12273 (catch_clause): Rewrite to use the new productions above
12274 (catch_clauses): Modify accordingly.
12275 (opt_catch_clauses): New production to use in try_statement
12276 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12277 and re-write the code in the actions to extract the specific and
12278 general catch clauses by being a little smart ;-)
12280 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12281 Hooray, try and catch statements parse fine !
12283 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12285 * statement.cs (Block::GetVariableType): Fix logic to extract the type
12286 string from the hashtable of variables.
12288 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12289 I end up making that mistake ;-)
12290 (catch_clauses): Fixed gross error which made Key and Value of the
12291 DictionaryEntry the same : $1 !!
12293 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12295 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12297 * cs-parser.jay (event_declaration): Correct to remove the semicolon
12298 when the add and remove accessors are specified.
12300 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12302 * cs-parser.jay (IndexerDeclaration): New helper class to hold
12303 information about indexer_declarator.
12304 (indexer_declarator): Implement actions.
12305 (parsing_indexer): New local boolean used to keep track of whether
12306 we are parsing indexers or properties. This is necessary because
12307 implicit_parameters come into picture even for the get accessor in the
12308 case of an indexer.
12309 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12311 * class.cs (Indexer): New class for indexer declarations.
12312 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12313 (TypeContainer::indexers): New member to hold list of indexers for the
12316 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12318 * cs-parser.jay (add_accessor_declaration): Implement action.
12319 (remove_accessor_declaration): Implement action.
12320 (event_accessors_declaration): Implement
12321 (variable_declarators): swap statements for first rule - trivial.
12323 * class.cs (Event): New class to hold information about event
12325 (TypeContainer::AddEvent): New method to add an event to a type
12326 (TypeContainer::events): New member to hold list of events.
12328 * cs-parser.jay (event_declaration): Implement actions.
12330 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12332 * cs-parser.jay (dim_separators): Implement. Make it a string
12333 concatenating all the commas together, just as they appear.
12334 (opt_dim_separators): Modify accordingly
12335 (rank_specifiers): Update accordingly. Basically do the same
12336 thing - instead, collect the brackets here.
12337 (opt_rank_sepcifiers): Modify accordingly.
12338 (array_type): Modify to actually return the complete type string
12339 instead of ignoring the rank_specifiers.
12340 (expression_list): Implement to collect the expressions
12341 (variable_initializer): Implement. We make it a list of expressions
12342 essentially so that we can handle the array_initializer case neatly too.
12343 (variable_initializer_list): Implement.
12344 (array_initializer): Make it a list of variable_initializers
12345 (opt_array_initializer): Modify accordingly.
12347 * expression.cs (New::NType): Add enumeration to help us
12348 keep track of whether we have an object/delegate creation
12349 or an array creation.
12350 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12351 members to hold data about array creation.
12352 (New:New): Modify to update NewType
12353 (New:New): New Overloaded contructor for the array creation
12356 * cs-parser.jay (array_creation_expression): Implement to call
12357 the overloaded New constructor.
12359 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12361 * class.cs (TypeContainer::Constructors): Return member
12362 constructors instead of returning null.
12364 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12366 * typemanager.cs (InitCoreTypes): Initialize the various core
12367 types after we have populated the type manager with the user
12368 defined types (this distinction will be important later while
12369 compiling corlib.dll)
12371 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12372 on Expression Classification. Now all expressions have a method
12373 `Resolve' and a method `Emit'.
12375 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12376 generation from working. Also add some temporary debugging
12379 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12381 * codegen.cs: Lots of code generation pieces. This is only the
12382 beginning, will continue tomorrow with more touches of polish. We
12383 handle the fundamentals of if, while, do, for, return. Others are
12384 trickier and I need to start working on invocations soon.
12386 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12389 * codegen.cs (EmitContext): New struct, used during code
12390 emission to keep a context. Most of the code generation will be
12393 * cs-parser.jay: Add embedded blocks to the list of statements of
12394 this block. So code generation proceeds in a top down fashion.
12396 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12398 * statement.cs: Add support for multiple child blocks.
12400 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12402 * codegen.cs (EmitCode): New function, will emit the code for a
12403 Block of code given a TypeContainer and its ILGenerator.
12405 * statement.cs (Block): Standard public readonly optimization.
12406 (Block::Block constructors): Link children.
12407 (Block::Child): Child Linker.
12408 (Block::EmitVariables): Emits IL variable declarations.
12410 * class.cs: Drop support for MethodGroups here, delay until
12412 (Method::): Applied the same simplification that I did before, and
12413 move from Properties to public readonly fields.
12414 (Method::ParameterTypes): Returns the parameter types for the
12415 function, and implements a cache that will be useful later when I
12416 do error checking and the semantic analysis on the methods is
12418 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12419 and made a method, optional argument tells whether this is a class
12420 or a structure to apply the `has-this' bit.
12421 (Method::GetCallingConvention): Implement, returns the calling
12423 (Method::Define): Defines the type, a second pass is performed
12424 later to populate the methods.
12426 (Constructor::ParameterTypes): implement a cache similar to the
12427 one on Method::ParameterTypes, useful later when we do semantic
12430 (TypeContainer::EmitMethod): New method. Emits methods.
12432 * expression.cs: Removed MethodGroup class from here.
12434 * parameter.cs (Parameters::GetCallingConvention): new method.
12436 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12438 * class.cs (TypeContainer::Populate): Drop RootContext from the
12441 (Constructor::CallingConvention): Returns the calling convention.
12442 (Constructor::ParameterTypes): Returns the constructor parameter
12445 (TypeContainer::AddConstructor): Keep track of default constructor
12446 and the default static constructor.
12448 (Constructor::) Another class that starts using `public readonly'
12449 instead of properties.
12451 (Constructor::IsDefault): Whether this is a default constructor.
12453 (Field::) use readonly public fields instead of properties also.
12455 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12456 track of static constructors; If none is used, turn on
12457 BeforeFieldInit in the TypeAttributes.
12459 * cs-parser.jay (opt_argument_list): now the return can be null
12460 for the cases where there are no arguments.
12462 (constructor_declarator): If there is no implicit `base' or
12463 `this', then invoke the default parent constructor.
12465 * modifiers.cs (MethodAttr): New static function maps a set of
12466 modifiers flags into a MethodAttributes enum
12467 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12468 MethodAttr, TypeAttr to represent the various mappings where the
12469 modifiers are used.
12470 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12472 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12474 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12477 * interface.cs (PopulateIndexer): Implemented the code generator
12478 for interface indexers.
12480 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12482 * interface.cs (InterfaceMemberBase): Now we track the new status
12485 (PopulateProperty): Implement property population. Woohoo! Got
12486 Methods and Properties going today.
12488 Removed all the properties for interfaces, and replaced them with
12489 `public readonly' fields.
12491 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12493 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12494 initialize their hashtables/arraylists only when they are needed
12495 instead of doing this always.
12497 * parameter.cs: Handle refs and out parameters.
12499 * cs-parser.jay: Use an ArrayList to construct the arguments
12500 instead of the ParameterCollection, and then cast that to a
12503 * parameter.cs: Drop the use of ParameterCollection and use
12504 instead arrays of Parameters.
12506 (GetParameterInfo): Use the Type, not the Name when resolving
12509 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12511 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12512 and instead use public readonly fields.
12514 * class.cs: Put back walking code for type containers.
12516 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12518 * class.cs (MakeConstant): Code to define constants.
12520 * rootcontext.cs (LookupType): New function. Used to locate types
12523 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12525 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12526 this System.Reflection code is. Kudos to Microsoft
12528 * typemanager.cs: Implement a type cache and avoid loading all
12529 types at boot time. Wrap in LookupType the internals. This made
12530 the compiler so much faster. Wow. I rule!
12532 * driver.cs: Make sure we always load mscorlib first (for
12533 debugging purposes, nothing really important).
12535 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12536 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12538 * rootcontext.cs: Lookup types on their namespace; Lookup types
12539 on namespaces that have been imported using the `using' keyword.
12541 * class.cs (TypeContainer::TypeAttr): Virtualize.
12542 (Class::TypeAttr): Return attributes suitable for this bad boy.
12543 (Struct::TypeAttr): ditto.
12544 Handle nested classes.
12545 (TypeContainer::) Remove all the type visiting code, it is now
12546 replaced with the rootcontext.cs code
12548 * rootcontext.cs (GetClassBases): Added support for structs.
12550 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12552 * interface.cs, statement.cs, class.cs, parameter.cs,
12553 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12554 Drop use of TypeRefs, and use strings instead.
12556 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12560 * class.cs (Struct::Struct): set the SEALED flags after
12561 checking the modifiers.
12562 (TypeContainer::TypeAttr): new property, returns the
12563 TypeAttributes for a class.
12565 * cs-parser.jay (type_list): Oops, list production was creating a
12566 new list of base types.
12568 * rootcontext.cs (StdLib): New property.
12569 (GetInterfaceTypeByName): returns an interface by type name, and
12570 encapsulates error handling here.
12571 (GetInterfaces): simplified.
12572 (ResolveTree): Encapsulated all the tree resolution here.
12573 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12576 * driver.cs: Add support for --nostdlib, to avoid loading the
12577 default assemblies.
12578 (Main): Do not put tree resolution here.
12580 * rootcontext.cs: Beginning of the class resolution.
12582 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12584 * rootcontext.cs: Provide better error reporting.
12586 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12588 * rootcontext.cs (CreateInterface): Handle the case where there
12589 are no parent interfaces.
12591 (CloseTypes): Routine to flush types at the end.
12592 (CreateInterface): Track types.
12593 (GetInterfaces): Returns an array of Types from the list of
12594 defined interfaces.
12596 * typemanager.c (AddUserType): Mechanism to track user types (puts
12597 the type on the global type hash, and allows us to close it at the
12600 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12602 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12603 RecordInterface instead.
12605 * cs-parser.jay: Updated to reflect changes above.
12607 * decl.cs (Definition): Keep track of the TypeBuilder type that
12608 represents this type here. Not sure we will use it in the long
12609 run, but wont hurt for now.
12611 * driver.cs: Smaller changes to accomodate the new code.
12613 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12616 * rootcontext.cs (CreateInterface): New method, used to create
12617 the System.TypeBuilder type for interfaces.
12618 (ResolveInterfaces): new entry point to resolve the interface
12620 (CodeGen): Property, used to keep track of the code generator.
12622 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12624 * cs-parser.jay: Add a second production for delegate_declaration
12627 (enum_body): Put an opt_comma here instead of putting it on
12628 enum_body or enum_member_declarations so we can handle trailing
12629 commas on enumeration members. Gets rid of a shift/reduce.
12631 (type_list): Need a COMMA in the middle.
12633 (indexer_declaration): Tell tokenizer to recognize get/set
12635 * Remove old targets.
12637 * Re-add the parser target.
12639 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12641 * cs-parser.jay: Add precendence rules for a number of operators
12642 ot reduce the number of shift/reduce conflicts in the grammar.
12644 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12646 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12649 Get rid of old crufty code.
12651 * rootcontext.cs: Use this to keep track of the parsed
12652 representation and the defined types available to the program.
12654 * gen-treedump.cs: adjust for new convention.
12656 * type.cs: Split out the type manager, and the assembly builder
12659 * typemanager.cs: the type manager will live here now.
12661 * cil-codegen.cs: And the code generator here.
12663 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12665 * makefile: Fixed up for easy making.
12667 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12669 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12672 (unary_expression): Expand pre_increment_expression and
12673 post_decrement_expression to reduce a shift/reduce.
12675 2001-07-11 Simon Cozens
12677 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12679 Improve allow_keyword_as_indent name.
12681 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12683 * Adjustments for Beta2.
12685 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12687 * decl.cs: Added `Define' abstract method.
12688 (InTransit): new property, used to catch recursive definitions.
12690 * interface.cs: Implement `Define'.
12692 * modifiers.cs: Map Modifiers.constants to
12693 System.Reflection.TypeAttribute flags.
12695 * class.cs: Keep track of types and user-defined types.
12696 (BuilderInit): New method for creating an assembly
12697 (ResolveType): New function to launch the resolution process, only
12698 used by interfaces for now.
12700 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12701 that are inserted into the name space.
12703 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12705 * ARGH. I have screwed up my tree so many times due to the use of
12706 rsync rather than using CVS. Going to fix this at once.
12708 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12711 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12713 * Experiment successful: Use System.Type rather that our own
12716 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12718 * cs-parser.jay: Removed nsAliases from here.
12720 Use new namespaces, handle `using XXX;'
12722 * namespace.cs: Reimplemented namespace handling, use a recursive
12723 definition of the class. Now we can keep track of using clauses
12724 and catch invalid using clauses.
12726 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12728 * gen-treedump.cs: Adapted for all the renaming.
12730 * expression.cs (Expression): this class now has a Type property
12731 which returns an expression Type.
12733 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12734 `Type', as this has a different meaning now in the base
12736 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12738 * interface.cs, class.cs: Removed from all the sources the
12739 references to signature computation, as we can not do method
12740 signature computation during the parsing time, as we are not
12741 trying to solve at that point distinguishing:
12745 void a (NS.Blah x) {}
12748 Which depending on the context might be valid or not, as we do not
12749 know if Blah is the same thing as NS.Blah at that point.
12751 * Redid everything so the code uses TypeRefs now instead of
12752 Types. TypeRefs are just temporary type placeholders, that need
12753 to be resolved. They initially have a pointer to a string and the
12754 current scope in which they are used. This is used later by the
12755 compiler to resolve the reference to an actual Type.
12757 * DeclSpace is no longer a CIR.Type, and neither are
12758 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12759 are all DeclSpaces, but no Types.
12761 * type.cs (TypeRefManager): This implements the TypeRef manager,
12762 which keeps track of all the types that need to be resolved after
12763 the parsing has finished.
12765 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12767 * ARGH. We are going to have to store `foreach' as a class rather
12768 than resolving it, as we need to verify error 1579 after name
12769 resolution. *OR* we could keep a flag that says `This request to
12770 IEnumerator comes from a foreach statement' which we can then use
12771 to generate the error.
12773 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12775 * class.cs (TypeContainer.AddMethod): we now add methods to the
12776 MethodGroup instead of the method hashtable.
12778 * expression.cs: Add MethodGroup abstraction, which gets us one
12779 step closer to the specification in the way we handle method
12782 * cs-parser.jay (primary_expression): qualified_identifier now
12783 tried to match up an identifier to a local variable reference or
12784 to a parameter reference.
12786 current_local_parameters is now a parser global variable that
12787 points to the current parameters for the block, used during name
12790 (property_declaration): Now creates an implicit `value' argument to
12793 2001-05-09 Miguel de Icaza <miguel@ximian.com>
12795 * parameter.cs: Do not use `param' arguments as part of the
12796 signature, per the spec.
12798 2001-05-08 Miguel de Icaza <miguel@ximian.com>
12800 * decl.cs: Base class for classes, structs and interfaces. This
12801 is the "Declaration Space"
12803 * cs-parser.jay: Use CheckDef for checking declaration errors
12804 instead of having one on each function.
12806 * class.cs: Factor out some code for handling error handling in
12807 accordance to the "Declarations" section in the "Basic Concepts"
12808 chapter in the ECMA C# spec.
12810 * interface.cs: Make all interface member classes derive from
12811 InterfaceMemberBase.
12813 2001-05-07 Miguel de Icaza <miguel@ximian.com>
12815 * Many things: all interfaces are parsed and generated in
12816 gen-treedump. Support for member variables, constructors,
12817 destructors, properties, constants is there.
12819 Beginning of the IL backend, but very little done, just there for
12822 2001-04-29 Miguel de Icaza <miguel@ximian.com>
12824 * cs-parser.jay: Fix labeled statement.
12826 * cs-tokenizer.cs (escape): Escape " and ' always.
12827 ref_line, ref_name: keep track of the line/filename as instructed
12828 by #line by the compiler.
12831 2001-04-27 Miguel de Icaza <miguel@ximian.com>
12833 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12834 to match the values in System.CodeDOM.
12836 Divid renamed to Divide.
12838 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12840 (Statements.set): remove.
12842 * System.CodeDOM/CodeCatchClause.cs: always have a valid
12845 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12846 falseStatements always have valid values.
12848 * cs-parser.jay: Use System.CodeDOM now.