1 2003-10-20 Nick Drochak <ndrochak@gol.com>
3 * ecore.cs: Fix typo and build. Needed another right paren.
5 2003-10-19 Miguel de Icaza <miguel@ximian.com>
7 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
8 `internal' case regular and protected, but not allowing protected
9 to be evaluated later. Bug 49840
11 2003-10-15 Miguel de Icaza <miguel@ximian.com>
13 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
14 to kb.Nlast, and not the kb.nFirst to isolate the switch
17 Extract the underlying type, so enumerations of long/ulong are
18 treated like long/ulong.
20 2003-10-14 Miguel de Icaza <miguel@ximian.com>
22 * expression.cs (New): Overload the meaning of RequestedType to
23 track the possible creation of the NewDelegate type, since
24 DoResolve is invoked more than once for new constructors on field
27 See bugs: #48800 and #37014
29 * cs-parser.jay (declare_local_constants): Take an arraylist
30 instead of a single constant.
32 (local_constant_declaration): It should take a
33 constant_declarators, not a constant_declarator. Fixes 49487
35 * convert.cs: Fix error report.
37 2003-10-13 Jackson Harper <jackson@ximian.com>
39 * typemanager.cs (TypeToCoreType): Add float and double this fixes
42 2003-10-09 Martin Baulig <martin@ximian.com>
44 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
46 (MethodCore.DoDefineParameters): Removed the TypeContainer
47 argument; use the DeclSpace which was passed to the .ctor instead.
48 (MethodCore.CheckParameter): Take a DeclSpace instead of a
49 TypeContainer; we only need a DeclSpace here.
51 2003-10-09 Martin Baulig <martin@ximian.com>
53 * class.cs (MethodData): Added additional `DeclSpace ds' argument
55 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
58 2003-10-09 Martin Baulig <martin@ximian.com>
60 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
61 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
62 AsAccessible(), moved them as well.
64 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
66 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
68 * cs-parser.jay : Renamed yyName to yyNames related to jay.
70 2003-10-07 Miguel de Icaza <miguel@ximian.com>
72 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
73 generation for >=, as spotted by Paolo, bug 48679.
74 Patch from David Waite.
76 * cs-tokenizer.cs: Add handling for #pragma.
78 * cs-parser.jay: Allow for both yield and yield return in the
79 syntax. The anti-cobolization of C# fight will go on!
81 * class.cs (TypeBuilder.DefineType): Catch error condition here
82 (Parent.DefineType erroring out and returning null).
84 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
85 coping with enumerations variables, we were mistakenly processing
86 them as a regular value type instead of built-in types. Fixes the
89 * typemanager.cs (IsBuiltinOrEnum): New method.
91 2003-09-30 Miguel de Icaza <miguel@ximian.com>
93 * cs-parser.jay: Upgrade: yield now needs the return clause.
95 2003-09-19 Martin Baulig <martin@ximian.com>
97 * decl.cs (MemberCache.SetupCacheForInterface): Take a
98 `MemberCache parent' argument. Normally, an interface doesn't
99 have a parent type except System.Object, but we use this in gmcs
100 for generic type parameters.
102 2003-09-18 Martin Baulig <martin@ximian.com>
104 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
105 on `type.IsInterface'; don't check whether the type has a parent
106 to determine whether it's an interface.
108 2003-09-15 Martin Baulig <martin@ximian.com>
110 * class.cs (TypeContainer.DefineType): Added an error flag to
111 avoid reporting duplicate CS0146's ("class definition is
114 * driver.cs (Driver.MainDriver): Abort if
115 RootContext.ResolveTree() reported any errors.
117 2003-09-07 Martin Baulig <martin@ximian.com>
119 * report.cs (Error, Warning): Added overloaded versions which take
120 a `params object[] args' and call String.Format().
122 2003-09-07 Martin Baulig <martin@ximian.com>
124 * decl.cs (DeclSpace..ctor): Don't call
125 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
126 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
127 (DeclSpace.RecordDecl): New method.
129 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
131 2003-09-02 Ravi Pratap <ravi@ximian.com>
133 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
134 value attributes to be applied to ParameterBuilders.
136 * class.cs (MethodCore.LabelParameters): Make static and more
137 generic so that it can be used from other places - like interface
138 methods, for instance.
140 * interface.cs (Interface.Emit): Call LabelParameters before
141 emitting attributes on the InterfaceMethod.
143 2003-08-26 Martin Baulig <martin@ximian.com>
145 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
146 resolving aliases; fixes #47927.
148 2003-08-26 Martin Baulig <martin@ximian.com>
150 * statement.cs (Using.DoResolve): This is internally emitting a
151 try/finally clause, so we need to set ec.NeedExplicitReturn if we
152 do not always return. Fixes #47681.
154 2003-08-26 Martin Baulig <martin@ximian.com>
156 * decl.cs (MemberCore): Moved WarningNotHiding(),
157 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
159 (AdditionResult): Make this nested in DeclSpace.
160 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
161 argument; call NamespaceEntry.Define() unless we're nested in a
164 * namespace.cs (Namespace.DefineName): New public function. This
165 is called from DeclSpace's .ctor to add
166 (Namespace.Lookup): Include DeclSpaces in the lookup.
168 * class.cs (Operator): Derive from MemberBase, not MemberCore.
170 * const.cs (Const): Derive from MemberBase, not MemberCore.
172 2003-08-25 Martin Baulig <martin@ximian.com>
174 * convert.cs (Convert.ExplicitReferenceConversion): When
175 converting from an interface type to a class, unbox if the target
176 type is a struct type. Fixes #47822.
178 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
180 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
183 2003-08-22 Martin Baulig <martin@ximian.com>
185 * class.cs (TypeManager.DefineType): When defining a nested type,
186 call DefineType() on our parent; fixes #47801.
188 2003-08-22 Martin Baulig <martin@ximian.com>
190 * class.cs (MethodData.Define): While checking if a method is an
191 interface implementation, improve the test a bit more to fix #47654.
193 2003-08-22 Martin Baulig <martin@ximian.com>
195 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
196 correctly; fixes #47722.
198 2003-08-22 Martin Baulig <martin@ximian.com>
200 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
201 LocalVariableReference, ensure it's not read-only. Fixes #47536.
203 * statement.cs (Fixed.DoResolve): Make all variables read-only.
205 2003-08-22 Martin Baulig <martin@ximian.com>
207 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
208 can only be assigned in static constructors. Fixes #47161.
210 2003-08-22 Martin Baulig <martin@ximian.com>
212 Rewrote and improved the flow analysis code.
214 * flowbranching.cs (FlowBranching): Make this class abstract.
215 (FlowBranching.CreateBranching): New static function to create a
217 (FlowBranchingBlock, FlowBranchingException): New classes.
218 (FlowBranching.UsageVector.Type): New public readonly field.
219 (FlowBranching.UsageVector.Breaks): Removed the setter.
220 (FlowBranching.UsageVector.Returns): Removed the setter.
221 (FlowBranching.UsageVector): Added Break(), Return(),
222 NeverReachable() and Throw() methods to modify the reachability.
223 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
224 done by FlowBranching.Merge().
225 (FlowBranching.UsageVector.MergeChild): New method; merges the
226 merge result into the current vector.
227 (FlowBranching.Merge): New abstract method to merge a branching.
229 2003-08-12 Martin Baulig <martin@ximian.com>
231 * expression.cs (Indirection.CacheTemporaries): Create the
232 LocalTemporary with the pointer type, not its element type.
234 2003-08-10 Miguel de Icaza <miguel@ximian.com>
236 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
237 token was a keyword or not.
239 Add `error' options where an IDENTIFIER was expected; Provide
240 CheckToken and CheckIdentifierToken convenience error reporting
243 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
245 * decl.cs: Rename `NamespaceEntry Namespace' public field into
246 NameSpaceEntry NameSpaceEntry.
248 (LookupInterfaceOrClass): Avoid creating a full qualified name
249 from namespace and name: avoid doing lookups when we know the
250 namespace is non-existant. Use new Tree.LookupByNamespace which
251 looks up DeclSpaces based on their namespace, name pair.
253 * driver.cs: Provide a new `parser verbose' to display the
254 exception thrown during parsing. This is turned off by default
255 now, so the output of a failure from mcs is more graceful.
257 * namespace.cs: Track all the namespaces defined in a hashtable
260 (IsNamespace): New method
262 2003-08-09 Miguel de Icaza <miguel@ximian.com>
264 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
265 we know that we need to concatenate (full typename can never be
270 * statement.cs: Use a bitfield; Do not initialize to null things
271 which are done by the constructor by default.
273 * cs-parser.jay: bug fix, parameter was 4, not 3.
275 * expression.cs: Just use the property;
277 * statement.cs: No need for GetVariableInfo method.
279 2003-08-08 Martin Baulig <martin@ximian.com>
281 * flowanalysis.cs (FlowReturns): This is now nested in the
282 `FlowBranching' class.
283 (MyBitVector): Moved this here from statement.cs.
284 (FlowBranching.SiblingType): New enum type.
285 (FlowBranching.CreateSibling): Added `SiblingType' argument.
287 2003-08-07 Martin Baulig <martin@ximian.com>
289 * flowanalysis.cs (FlowBranchingType): This is now nested in the
290 `FlowBranching' class and called `BranchingType'.
292 2003-08-07 Martin Baulig <martin@ximian.com>
294 * flowanalysis.cs: Moved all the control flow analysis code into
297 2003-08-07 Martin Baulig <martin@ximian.com>
299 * assign.cs (Assign.DoResolve): `target' must either be an
300 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
303 2003-08-07 Miguel de Icaza <miguel@ximian.com>
305 * expression.cs (BinaryMethod): This kind of expression is created by the
306 Binary class if it determines that the operator has to be handled
309 (BinaryDelegate): This kind of expression is created if we are
310 dealing with a + or - operator on delegates.
312 (Binary): remove method, argumetns, and DelegateOperator: when
313 dealing with methods,
315 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
317 * statement.cs (Block): use bitfields for the three extra booleans
318 we had in use. Remove unused topblock parameter.
320 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
322 * assign.cs: Drop extra unneeded tests.
324 2003-08-06 Miguel de Icaza <miguel@ximian.com>
326 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
328 * statement.cs (Foreach): Use VariableStorage instead of
331 * codegen.cs (VariableStorage): New class used by clients that
332 require a variable stored: locals or fields for variables that
333 need to live across yield.
335 Maybe provide a convenience api for EmitThis+EmitLoad?
337 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
340 2003-08-05 Miguel de Icaza <miguel@ximian.com>
342 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
343 RemapParameterLValue): New methods that are used to turn a
344 precomputed FieldInfo into an expression like this:
348 The idea is to use this instead of making LocalVariableReference
349 have more than one meaning.
351 * cs-parser.jay: Add error production to BASE.
353 * ecore.cs: Deal with TypeManager.GetField returning null, which
354 is now a valid return value.
356 (FieldExprNoAddress): New expression for Fields whose address can
359 * expression.cs (LocalVariableReference): During the resolve
360 phases, create new expressions if we are in a remapping context.
361 Remove code that dealt with remapping here.
363 (ParameterReference): same.
365 (ProxyInstance): New expression, like the `This' expression, but
366 it is born fully resolved. We know what we are doing, so remove
367 the errors that are targeted to user-provided uses of `this'.
369 * statement.cs (Foreach): our variable is now stored as an
370 Expression; During resolution, follow the protocol, dont just
371 assume it will return this.
373 2003-08-06 Martin Baulig <martin@ximian.com>
375 * support.cs (SeekableStreamReader.cs): New public class.
377 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
378 SeekableStreamReader instead of the normal StreamReader.
380 2003-08-04 Martin Baulig <martin@ximian.com>
382 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
383 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
384 deambiguate casts and delegate invocations.
385 (parenthesized_expression): Use the new tokens to ensure this is
386 not a cast of method invocation.
388 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
389 when reading a `)' and Deambiguate_CloseParens () was previously
392 * expression.cs (ParenthesizedExpression): New class. This is
393 just used for the CS0075 test.
394 (Binary.DoResolve): Check for CS0075.
396 2003-07-29 Ravi Pratap <ravi@ximian.com>
398 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
399 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
400 reference comparison.
402 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
403 examine the ReturnType for equality - this is necessary in the
404 cases of implicit and explicit operators whose signature also
405 includes the return type.
407 2003-07-26 Miguel de Icaza <miguel@ximian.com>
409 * namespace.cs: Cache the result of the namespace computation,
410 instead of computing it every time.
412 2003-07-24 Miguel de Icaza <miguel@ximian.com>
414 * decl.cs: Use a global arraylist that we reuse over invocations
415 to avoid excesive memory consumption. Reduces memory usage on an
416 mcs compile by one meg (45 average).
418 * typemanager.cs (LookupTypeReflection): In .NET pointers are
419 private, work around that.
421 2003-07-23 Miguel de Icaza <miguel@ximian.com>
423 * literal.cs (IntLiteral): Define Zero and One static literals.
425 * cs-parser.jay (integer_literal): use static literals to reduce
426 memory usage for the most used literals (0, 1 and -1). 211kb
427 reduced in memory usage.
429 Replace all calls to `new ArrayList' with `new
430 ArrayList(4)' which is a good average number for most allocations,
431 and also requires only 16 bytes of memory for its buffer by
434 This reduced MCS memory usage in seven megabytes for the RSS after
437 2003-07-28 Ravi Pratap <ravi@ximian.com>
439 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
440 handle params methods the correct way by forming only one
441 applicable set with params and normal methods in them. Earlier we
442 were looking at params methods only if we found no normal methods
443 which was not the correct thing to do.
445 (Invocation.BetterFunction): Take separate arguments indicating
446 when candidate and the best method are params methods in their
449 This fixes bugs #43367 and #46199.
451 * attribute.cs: Documentation updates.
453 (CheckAttribute): Rename to CheckAttributeTarget.
454 (GetValidPlaces): Rename to GetValidTargets.
456 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
457 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
461 2003-07-28 Martin Baulig <martin@ximian.com>
463 * class.cs (TypeContainer.DefineMembers): Use the base type's full
464 name when looking up the base class of a nested class. Fixes #46977.
466 2003-07-26 Martin Baulig <martin@ximian.com>
468 * expression.cs (Indexers.Indexer): New nested struct; contains
469 getter, setter and the indexer's type.
470 (Indexers.Properties): This is now an ArrayList of
472 (IndexerAccess.DoResolveLValue): Correctly set the type if the
473 indexer doesn't have any getters.
475 * assign.cs (Assign.DoResolve): Also do the implicit conversions
476 for embedded property and indexer assignments.
478 2003-07-26 Martin Baulig <martin@ximian.com>
480 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
481 preprocessor directive is not the first non-whitespace character
484 2003-07-26 Martin Baulig <martin@ximian.com>
486 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
487 namespace parsing, follow the spec more closely.
489 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
490 NamespaceEntry.Lookup().
492 2003-07-25 Martin Baulig <martin@ximian.com>
494 * MethodCore.cs (OverridesSomething): New public field; it's set
495 from TypeContainer.DefineMembers if this method overrides
496 something (which doesn't need to be a method). Fix #39462.
498 2003-07-25 Ravi Pratap <ravi@ximian.com>
500 * typemanager.cs (GetMembers): Ensure that the list of members is
501 reversed. This keeps things in sync.
503 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
504 find an AttributeUsage attribute.
506 * expression.cs (Invocation.OverloadResolve): Perform the check
507 which disallows Invoke to be directly called on a Delegate.
509 (Error_InvokeOnDelegate): Report error cs1533.
511 2003-07-25 Martin Baulig <martin@ximian.com>
513 * expression.cs (Indexers.GetIndexersForType): Only look in the
514 interface hierarchy if the requested type is already an
515 interface. Fixes #46788 while keeping #46502 fixed.
517 2003-07-25 Martin Baulig <martin@ximian.com>
519 * class.cs (TypeContainer.DefineMembers): Check whether all
520 readonly fields have been assigned and report warning CS0649 if
523 * statement.cs (LocalInfo.IsFixed): Always return true if this is
526 2003-07-24 Ravi Pratap <ravi@ximian.com>
528 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
529 returned from GetMethods to make things consistent with the
530 assumptions MCS makes about ordering of methods.
532 This should comprehensively fix bug #45127 and it does :-)
534 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
535 ordering is actually reverse.
537 * Clean up some debug messages I left lying around.
539 * interface.cs (Populate*): Get rid of code which emits attributes
540 since the stage in which we emit attributes is the 'Emit' stage,
541 not the define stage.
543 (Emit): Move attribute emission for interface members here.
545 2003-07-22 Ravi Pratap <ravi@ximian.com>
547 * expression.cs (Invocation.OverloadResolve): Follow the spec more
548 closely: we eliminate methods in base types when we have an
549 applicable method in a top-level type.
551 Please see section 14.5.5.1 for an exact description of what goes
554 This fixes bug #45127 and a host of other related to corlib compilation.
556 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
557 array is the method corresponding to the top-level type (this is
558 because of the changes made to icall.c) so we change this
561 (MethodGroupExpr.Name): This too.
563 * typemanager.cs (GetElementType): New method which does the right
564 thing when compiling corlib.
566 * everywhere: Make use of the above in the relevant places.
568 2003-07-22 Martin Baulig <martin@ximian.com>
570 * cs-parser.jay (invocation_expression): Moved
571 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
572 `cast_expression', but create a InvocationOrCast which later
573 resolves to either an Invocation or a Cast.
575 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
576 method; call this before EmitStatement() to make sure that this
577 expression can be used as a statement.
579 * expression.cs (InvocationOrCast): New class; resolves to either
580 an Invocation or a Cast.
582 * statement.cs (StatementExpression): Call ResolveStatement() on
583 the ExpressionStatement before emitting it.
585 2003-07-21 Martin Baulig <martin@ximian.com>
587 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
588 `ref' and `out' attributes match; fixes #46220.
589 (MemberAccess.ResolveMemberAccess): You can't reference a type
590 through an expression; fixes #33180.
591 (Indexers.GetIndexersForType): Don't return the indexers from
592 interfaces the class implements; fixes #46502.
594 2003-07-21 Martin Baulig <martin@ximian.com>
596 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
597 CS0661 checks; fixes bug #30442.
599 2003-07-21 Martin Baulig <martin@ximian.com>
601 * decl.cs (AdditionResult): Added `Error'.
603 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
605 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
606 makes cs0031.cs actually work.
608 2003-07-20 Martin Baulig <martin@ximian.com>
610 * namespace.cs: Fixed that bug which caused a crash when compiling
613 2003-07-20 Miguel de Icaza <miguel@ximian.com>
615 * typemanager.cs (LookupTypeReflection): Never expose types which
616 are NotPublic, NestedPrivate, NestedAssembly, or
617 NestedFamANDAssem. We used to return these, and later do a check
618 that would report a meaningful error, but the problem is that we
619 would not get the real match, if there was a name override.
621 2003-07-18 Miguel de Icaza <miguel@ximian.com>
623 * namespace.cs (Namespace, Name): Do not compute the namespace
624 name dynamically, compute it in the constructor. This reduced
625 memory usage by 1697 KB.
627 * driver.cs: Use --pause to pause at the end.
629 2003-07-17 Peter Williams <peter@newton.cx>
631 * Makefile: Change the name of the test target so that it doesn't
632 conflict with the recursive test target.
634 2003-07-17 Miguel de Icaza <miguel@ximian.com>
636 * expression.cs (LocalVariableReference.Emit, EmitAssign,
637 AddressOf): Do not use EmitThis, that was wrong, use the actual
640 2003-07-15 Miguel de Icaza <miguel@ximian.com>
642 * class.cs (MethodData.Define): While checking if a method is an
643 interface implementation, improve the test: If we are not public
644 (use new test here: use the computed MethodAttributes directly,
645 instead of the parsed modifier flags) check if the `implementing'
646 method comes from an interface or not.
648 * pending.cs (VerifyPendingMethods): Slightly better error
651 * makefile: add test target that does the mcs bootstrap.
653 2003-07-16 Ravi Pratap <ravi@ximian.com>
655 * interface.cs (Define): Do nothing here since there are no
656 members to populate etc. Move the attribute emission out of here
657 since this was just totally the wrong place to put it. Attribute
658 application happens during the 'Emit' phase, not in the 'Define'
661 (Emit): Add this method and move the attribute emission here
663 * rootcontext.cs (EmitCode): Call the Emit method on interface
666 2003-07-14 Ravi Pratap M <ravi@ximian.com>
668 * expression.cs (OverloadResolve): Report error only if Location
669 is not 'Null' which means that there was a probe going on.
671 2003-07-14 Martin Baulig <martin@ximian.com>
673 * expression.cs (ConditionalLogicalOperator): New public class to
674 implement user defined conditional logical operators.
675 This is section 14.11.2 in the spec and bug #40505.
677 2003-07-14 Martin Baulig <martin@ximian.com>
679 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
681 2003-07-14 Martin Baulig <martin@ximian.com>
683 * codegen.cs (EmitContext.InFixedInitializer): New public field.
685 * ecore.cs (IVariable.VerifyFixed): New interface method.
687 * expression.cs (Unary.ResolveOperator): When resolving the `&'
688 operator, check whether the variable is actually fixed. Fixes bug
689 #36055. Set a variable definitely assigned when taking its
690 address as required by the spec.
692 * statement.cs (LocalInfo.IsFixed): New field.
693 (LocalInfo.MakePinned): Set `IsFixed' to true.
695 2003-07-14 Ravi Pratap M <ravi@ximian.com>
697 * attribute.cs (Attribute.Resolve): While doing a Member lookup
698 for .ctors, ensure that we only ask for members declared in the
699 attribute type (BindingFlags.DeclaredOnly).
703 * expression.cs (Error_WrongNumArguments): Report error 1501
704 correctly the way CSC does.
706 2003-07-13 Martin Baulig <martin@ximian.com>
708 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
709 lookup on the fully qualified name, to make things like "X.X" work
710 where "X.X" is a fully qualified type name, but we also have a
711 namespace "X" in the using list. Fixes #41975.
713 2003-07-13 Martin Baulig <martin@ximian.com>
715 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
716 function. If we're a CompoundAssign, we need to create an embedded
717 CompoundAssign, not an embedded Assign.
718 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
721 2003-07-13 Martin Baulig <martin@ximian.com>
723 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
724 work to fix bug #46088.
726 2003-07-13 Ravi Pratap <ravi@ximian.com>
728 * class.cs (Operator.Emit): Do not emit attributes here - it is
729 taken care of by the Method class that we delegate too. This takes
732 2003-07-10 Martin Baulig <martin@ximian.com>
734 * expression.cs (TypeOfVoid): New class.
735 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
737 2003-07-10 Martin Baulig <martin@ximian.com>
739 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
742 2003-07-10 Martin Baulig <martin@ximian.com>
744 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
745 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
747 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
749 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
751 2003-07-10 Martin Baulig <martin@ximian.com>
753 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
754 of decimal. Fixes #42850.
756 NOTE: I also fixed the created byte blob, but this doesn't work on
757 the MS runtime and csc never produces any byte blobs for decimal
760 2003-07-10 Martin Baulig <martin@ximian.com>
762 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
763 structs; fixes #32068.
764 (Block.AddChildVariableNames): Fixed #44302.
766 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
768 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
770 2003-07-07 Miguel de Icaza <miguel@ximian.com>
772 * attribute.cs: And this test is onger needed.
774 2003-07-08 Martin Baulig <martin@ximian.com>
776 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
777 inaccessible types. Fixes #36313.
779 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
781 * namespace.cs (NamespaceEntry): Create implicit entries for all
782 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
783 implicit entries for N1.N2 and N1.
785 2003-07-08 Martin Baulig <martin@ximian.com>
787 Rewrote the handling of namespaces to fix a lot of the issues
788 wrt. `using' aliases etc.
790 * namespace.cs (Namespace): Splitted this class into a
791 per-assembly `Namespace' and a per-file `NamespaceEntry'.
793 * typemanager.cs (TypeManager.IsNamespace): Removed.
794 (TypeManager.ComputeNamespaces): Only compute namespaces from
795 loaded assemblies here, not the namespaces from the assembly we're
798 2003-07-08 Martin Baulig <martin@ximian.com>
800 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
802 2003-07-07 Miguel de Icaza <miguel@ximian.com>
804 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
807 I thought about the memory savings here, but LookupTypeReflection
808 is used under already very constrained scenarios. Compiling
809 corlib or mcs only exposes one hit, so it would not really reduce
810 any memory consumption.
812 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
814 * typemanager.cs: fixes bug #45889 by only adding public types from
815 other assemblies to the list of known types.
817 2003-07-07 Miguel de Icaza <miguel@ximian.com>
819 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
820 on the type we resolved.
822 2003-07-05 Martin Baulig <martin@ximian.com>
824 * pending.cs (PendingImplementation.ParentImplements): Don't
825 create the proxy if the parent is abstract.
827 * class.cs (TypeContainer.DefineIndexers): Process explicit
828 interface implementations first. Fixes #37714.
830 2003-07-04 Miguel de Icaza <miguel@ximian.com>
832 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
833 defined recursively; but since we modify the input parameters
834 (left is set to `this' temporarily), we reset this value if the
835 left_is_explicit is false, which gives the original semantics to
838 * literal.cs (NullPointer): new class used to represent a null
839 literal in a pointer context.
841 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
842 type is a pointer, use a NullPointer object instead of a
843 NullLiteral. Closes 43687
845 (ExplicitConversion): Convert pointer values using
846 the conv opcode to the proper type.
848 * ecore.cs (New): change ValueTypeVariable property into a method,
849 that returns whether the valuetype is suitable for being used.
851 * expression.cs (Binary.DoNumericPromotions): Only return if we
852 the int constant was a valid uint, and we can return both left and
853 right as uints. If not, we continue processing, to trigger the
854 type conversion. This fixes 39018.
856 * statement.cs (Block.EmitMeta): During constant resolution, set
857 the CurrentBlock property on the emitcontext, so that we resolve
860 2003-07-02 Martin Baulig <martin@ximian.com>
862 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
863 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
865 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
866 than emitting it here.
868 * statement.cs: Fixed some more flow analysis bugs.
870 2003-07-02 Martin Baulig <martin@ximian.com>
872 * class.cs (MethodData.Define): When implementing interface
873 methods, set Final unless we're Virtual.
875 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
876 check work for interface methods.
878 2003-07-01 Martin Baulig <martin@ximian.com>
880 * ecore.cs (EmitContext.This): Replaced this property with a
881 GetThis() method which takes a Location argument. This ensures
882 that we get the correct error location for a CS0188.
884 2003-07-01 Miguel de Icaza <miguel@ximian.com>
886 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
887 ImplicitStandardConversion.
889 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
891 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
893 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
896 2003-06-30 Miguel de Icaza <miguel@ximian.com>
898 * class.cs (Constructor.Define): Turn off initlocals for unsafe
901 (MethodData.Define): Turn off initlocals for unsafe methods.
903 2003-06-29 Miguel de Icaza <miguel@ximian.com>
905 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
906 complete; Fixes #37521.
908 * delegate.cs: Use Modifiers.TypeAttr to compute the
909 TypeAttributes, instead of rolling our own. This makes the flags
910 correct for the delegates.
912 2003-06-28 Miguel de Icaza <miguel@ximian.com>
914 * class.cs (Constructor.Define): Set the private flag for static
915 constructors as well.
917 * cs-parser.jay (statement_expression): Set the return value to
918 null, to avoid a crash when we catch an error.
920 2003-06-24 Miguel de Icaza <miguel@ximian.com>
922 * cs-parser.jay: Applied patch from Jackson that adds support for
923 extern and unsafe modifiers to destructor declarations.
925 * expression.cs: Report error 21 if the user is trying to index a
928 * driver.cs: Add an error message, suggested by the bug report.
930 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
931 if we do not have a ": this ()" constructor initializer. Fixes 45149
933 2003-06-14 Miguel de Icaza <miguel@ximian.com>
935 * namespace.cs: Add some information to reduce FAQs.
937 2003-06-13 Miguel de Icaza <miguel@ximian.com>
939 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
940 underlying enumeration types. Fixes #43915.
942 * expression.cs: Treat ushort/short as legal values to be used in
945 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
947 * delegate.cs: transfer custom attributes for paramenters from
948 the delegate declaration to Invoke and BeginInvoke.
950 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
952 * attribute.cs: handle custom marshalers and emit marshal info
955 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
957 * makefile.gnu: Added anonymous.cs to the compiler sources.
959 2003-05-28 Miguel de Icaza <miguel@ximian.com>
961 * iterators.cs: Change the name of the proxy class to include two
964 * cs-parser.jay: Update grammar to include anonymous methods.
966 * anonymous.cs: new file.
968 2003-05-27 Miguel de Icaza <miguel@ximian.com>
970 * class.cs (Field.Define): Add missing test for pointers and
973 2003-05-27 Ravi Pratap <ravi@ximian.com>
975 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
976 we use the stobj opcode.
978 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
979 since it wasn't the correct fix.
981 It still is puzzling that we are required to use stobj for IntPtr
982 which seems to be a ValueType.
984 2003-05-26 Miguel de Icaza <miguel@ximian.com>
986 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
987 during regular simple name resolution. Now, the trick is that
988 instead of returning for processing the simplename, we do a
989 TypeManager.LookupType (ie, a rooted lookup as opposed to a
990 contextual lookup type). If a match is found, return that, if
991 not, return for further composition.
993 This fixes long-standing 30485.
995 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
996 using the address to initialize an object, do an Stobj instead of
997 using the regular Stelem.
999 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1000 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1001 Because if we are a BaseIndexerAccess that value will be true.
1004 * statement.cs (GotoCase.Resolve): Return after reporting an
1005 error, do not attempt to continue.
1007 * expression.cs (PointerArithmetic.Emit): If our operand is a
1008 long, convert our constants to match the operand before
1009 multiplying. Convert to I type before adding. Fixes 43670.
1011 2003-05-14 Ravi Pratap <ravi@ximian.com>
1013 * enum.cs (ImplicitConversionExists) : Rename to
1014 ImplicitEnumConversionExists to remove ambiguity.
1016 * ecore.cs (NullCast): New type of cast expression class which
1017 basically is very similar to EmptyCast with the difference being
1018 it still is a constant since it is used only to cast a null to
1022 * convert.cs (ImplicitReferenceConversion): When casting a null
1023 literal, we return a NullCast.
1025 * literal.cs (NullLiteralTyped): Remove - I don't see why this
1026 should be around anymore.
1028 The renaming (reported was slightly wrong). Corrections:
1030 ConvertImplicitStandard -> ImplicitConversionStandard
1031 ConvertExplicitStandard -> ExplicitConversionStandard
1033 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1034 before passing them in !
1036 * convert.cs (ImplicitConversionStandard): When comparing for
1037 equal expr and target types, ensure that expr is not a
1040 In general, we must not be checking (expr_type ==
1041 target_type) in the top level conversion methods
1042 (ImplicitConversion, ExplicitConversion etc). This checking is
1043 done in the methods that they delegate to.
1045 2003-05-20 Miguel de Icaza <miguel@ximian.com>
1047 * convert.cs: Move Error_CannotConvertType,
1048 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1049 ImplicitNumericConversion, ImplicitConversionExists,
1050 ImplicitUserConversionExists, StandardConversionExists,
1051 FindMostEncompassedType, FindMostSpecificSource,
1052 FindMostSpecificTarget, ImplicitUserConversion,
1053 ExplicitUserConversion, GetConversionOperators,
1054 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1055 TryImplicitIntConversion, Error_CannotConvertImplicit,
1056 ConvertImplicitRequired, ConvertNumericExplicit,
1057 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1058 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1061 Perform the following renames:
1063 StandardConversionExists -> ImplicitStandardConversionExists
1064 ConvertImplicit -> ImplicitConversion
1065 ConvertImplicitStandard -> ImplicitStandardConversion
1066 TryImplicitIntConversion -> ImplicitIntConversion
1067 ConvertImplicitRequired -> ImplicitConversionRequired
1068 ConvertNumericExplicit -> ExplicitNumericConversion
1069 ConvertReferenceExplicit -> ExplicitReferenceConversion
1070 ConvertExplicit -> ExplicitConversion
1071 ConvertExplicitStandard -> ExplicitStandardConversion
1073 2003-05-19 Martin Baulig <martin@ximian.com>
1075 * statement.cs (TypeInfo.StructInfo): Made this type protected.
1076 (TypeInfo): Added support for structs having structs as fields.
1078 * ecore.cs (FieldExpr): Implement IVariable.
1079 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1080 VariableInfo for the field.
1082 2003-05-18 Martin Baulig <martin@ximian.com>
1084 * expression.cs (This.DoResolve): Report a CS0027 if we're
1085 emitting a field initializer.
1087 2003-05-18 Martin Baulig <martin@ximian.com>
1089 * expression.cs (This.ResolveBase): New public function.
1090 (This.DoResolve): Check for CS0188.
1092 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1095 * ecore.cs (MethodGroupExpr.DoResolve): Set the
1096 `instance_expression' to null if we don't have any non-static
1099 2003-05-18 Martin Baulig <martin@ximian.com>
1101 Reworked the way how local variables and parameters are handled by
1102 the flow analysis code.
1104 * statement.cs (TypeInfo, VariableMap): New public classes.
1105 (VariableInfo): New public class. This is now responsible for
1106 checking whether a variable has been assigned. It is used for
1107 parameters and local variables.
1108 (Block.EmitMeta): Take the InternalParameters as argument; compute
1109 the layout of the flow vectors here.
1110 (Block.LocalMap, Block.ParameterMap): New public properties.
1111 (FlowBranching): The .ctor doesn't get the InternalParameters
1112 anymore since Block.EmitMeta() now computes the layout of the flow
1114 (MyStructInfo): This class is now known as `StructInfo' and nested
1115 in `TypeInfo'; we don't access this directly anymore.
1117 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1118 property and removed IsAssigned(), IsFieldAssigned(),
1119 SetAssigned() and SetFieldAssigned(); we now call them on the
1120 VariableInfo so we don't need to duplicate this code everywhere.
1122 * expression.cs (ParameterReference): Added `Block block' argument
1124 (LocalVariableReference, ParameterReference, This): The new
1125 VariableInfo class is now responsible for all the definite
1128 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1129 IsParameterAssigned, SetParameterAssigned): Removed.
1131 2003-05-18 Martin Baulig <martin@ximian.com>
1133 * typemanager.cs (InitCoreTypes): Try calling
1134 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1135 the 3-args-version. Corlib now also needs our `void_type'.
1136 (GetMethod): Added overloaded version which takes an optional
1137 `bool report_errors' to allow lookups of optional methods.
1139 2003-05-12 Martin Baulig <martin@ximian.com>
1141 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1142 only used for locals and not for parameters.
1144 2003-05-12 Miguel de Icaza <miguel@ximian.com>
1146 * support.cs (InternalParameters.ParameterType): Return the
1147 ExternalType of the parameter.
1149 * parameter.cs (Parameter.ExternalType): drop the two arguments,
1152 2003-05-11 Miguel de Icaza <miguel@ximian.com>
1154 * class.cs (MethodData.Define): Do not set the `newslot' on
1155 interface members, if they are also flagged as "override".
1157 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1158 better code for ++i and i++. This only works for static fields
1159 and local variables.
1161 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1162 want to pull the DeclSpace out of the builder_to_declspace instead
1163 of the TypeBuilder (like in TypeContainer.FindMembers).
1165 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1166 instead of LookupTypeContainer. Fixes the crash on .NET for
1167 looking up interface members.
1169 * const.cs: Create our own emit context during the Definition
1170 stage, so that constants are evaluated in the proper context, when
1171 a recursive definition happens.
1173 2003-05-11 Martin Baulig <martin@ximian.com>
1175 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
1176 new block for a switch section.
1177 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1178 the adding/lookup in the switch block. Fixes #39828.
1180 2003-05-09 Miguel de Icaza <miguel@ximian.com>
1182 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1183 functionality: I needed to convert the data after I had performed
1184 the add/sub operation into the operands type size.
1186 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1187 pass the type for the box operation, otherwise the resulting
1188 object would have been of type object.
1190 (BoxedCast): Add constructor to specify the type to box as.
1192 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1194 * iterators.cs: I was reusing the `count' variable inadvertently,
1195 take steps to not allow this to happen.
1197 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1199 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1200 by creating an array at the point where the params starts and
1201 putting all those arguments there, then adjusting the size of the
1204 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1206 * expression.cs (New.AddressOf): Implement interface
1207 IMemoryLocation. This is used when the `new' operator is used in
1208 the context of an invocation to a method on a value type.
1210 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1213 * namespace.cs: Also check the using aliases here.
1215 * driver.cs: Move the test for using validity after the types have
1216 been entered, so we do a single pass that also includes the using
1219 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1220 in the regular case. CreateSiblingForFinally is doing extra
1223 * attribute.cs (GetAttributeArgumentExpression): Store the result
1224 on an out value, and use the return value to indicate failure
1225 instead of using null (which is a valid return for Constant.GetValue).
1227 * statement.cs: Perform the analysis flow for the increment
1228 portion after the statement, because this will be the real flow of
1229 execution. Fixes #42385
1231 * codegen.cs (EmitContext.EmitArgument,
1232 EmitContext.EmitStoreArgument): New helper functions when the
1233 RemapToProxy flag is set.
1235 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1238 Add support for remapping parameters.
1240 * iterators.cs: Propagate parameter values; Store parameter
1241 values in the proxy classes.
1243 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1245 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1246 need a proxy reference; I do not know what I was thinking
1248 * cs-parser.jay (constructor_initializer): catch another error,
1249 and display nice message.
1251 (field_declaration): catch void field declaration
1252 to flag a better error.
1254 * class.cs (MemberBase.CheckBase): Report an error instead of a
1255 warning if a new protected member is declared in a struct.
1256 (Field.Define): catch the error of readonly/volatile.
1258 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1260 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1261 volatile variable is taken
1263 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1265 * statement.cs (Fixed.Resolve): Report an error if we are not in
1268 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1270 * typemanager.cs: reuse the code that handles type clashes for
1271 delegates and enumerations.
1273 * class.cs (Report28): Always report.
1275 * expression.cs (EncodeAsAttribute): Allow nulls here.
1277 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1279 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1280 the functionality for testing whether an expression is valid for
1281 an attribute here. Also handle the case of arrays of elements
1284 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1285 encoding a linear array into an array of objects that are suitable
1286 to be passed to an CustomAttributeBuilder.
1288 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1290 * ecore.cs: (FieldExpr): Handle field remapping here.
1292 * iteratators.cs: Pass the instance variable (if the method is an
1293 instance method) to the constructors, so we can access the field
1294 variables on the class.
1296 TODO: Test this with structs. I think the THIS variable on
1297 structs might have to be a pointer, and not a refenrece
1299 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1301 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1302 local variables to fields in a proxy class.
1304 * iterators.cs (PopulateProxy): Rename our internal fields to
1306 Create a <THIS> field if we are an instance method, so we can
1307 reference our parent container variables.
1308 (MapVariable): Called back from the EmitContext code to enter a
1309 new variable to field mapping into the proxy class (we just create
1313 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1314 for using the remapped locals to fields.
1316 I placed the code here, because that gives the same semantics to
1317 local variables, and only changes the Emit code.
1319 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1320 statements inside iterators.
1321 (VariableInfo): Add a FieldBuilder for the cases when we are
1322 remapping local variables to fields in a proxy class
1324 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1325 current_block != null.
1327 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1328 not cope with strings, as it has been moved to the
1329 TableSwitchEmit. Fixed bug in switch generation.
1331 * expression.cs (New.DoResolve): Provide more context for the user
1332 when reporting an error.
1334 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1337 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1338 check the permissions for it. Note than in a type-resolution
1339 context the check was already present in DeclSpace.ResolveType,
1340 but was missing from the MemberAccess.
1342 (ArrayCreation.CheckIndices): warn if the user has
1343 more nested levels of expressions, but there are no more
1344 dimensions specified. Avoids crash on bug 41906.
1346 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1348 * statement.cs (Block): replace Implicit bool, for a generic
1350 New flag: `Unchecked'. This is used during the EmitMeta phase
1351 (which is out-of-line with the regular Resolve/Emit process for a
1352 statement, as this is done ahead of time, but still gets a chance
1353 to call constant resolve).
1355 (Block.Flags): new enum for adding a new flag.
1357 (Block.EmitMeta): track the state of unchecked.
1359 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1360 to enable constant resolution to work there as well.
1362 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1364 * typemanager.cs (ienumerable_type): Also look up
1365 System.Collections.IEnumerable.
1367 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1369 TODO: Test more than one conditional per method.
1371 * class.cs (Indexer.Define): Report the location where the user is
1372 referencing the unsupported feature.
1374 (MethodData): Overload the use of `conditionals' to
1375 minimize the creation of needless ArrayLists. This saves roughly
1376 212kb on my machine.
1378 (Method): Implement the new IIteratorContainer interface.
1379 (Method.SetYields): Implement the method by setting the ModFlags
1380 to contain METHOD_YIELDS.
1382 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1383 which just got set to null.
1385 * iterators.cs: New file.
1387 (Yield, YieldBreak): New statements.
1389 * statement.cs (Return.Resolve): Flag an error if we are used in
1392 * codegen.cs (InIterator): New flag set if the code is being
1393 compiled in an iterator method.
1395 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1396 internal modifier, and we just use it to avoid adding extra
1397 fields, as this is seldom used.
1399 * cs-parser.jay: Add yield_statement (yield and yield break).
1401 * driver.cs: New flag -v2 to turn on version 2 features.
1403 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1404 hashtable when v2 is enabled.
1406 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1408 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1409 there is already a namespace defined with this name.
1411 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1412 people upgraded their corlibs.
1414 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1415 always use fully qualified types, no need to use the compiler
1418 (TypeManager.IsNamespace): Use binarysearch.
1420 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1421 AddDelegate): I did not quite use the new IsValid API properly: I
1422 have to pass the short-name and the fullname. I was passing only
1423 the basename instead of the fullname sometimes.
1425 (TypeContainer.DefineType): call NamespaceClash.
1427 * interface.cs (Interface.DefineType): use NamespaceClash before
1430 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1433 * enum.cs: (Enum.DefineType): use NamespaceClash before
1436 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1437 speed increase. First, use the negative_hits cache when we get a
1438 negative. Second, add the type with its full original name
1439 instead of the new . and + encoded name (reflection uses + to
1440 separate type from a nested type). Use LookupTypeReflection
1441 directly which bypasses the type->name hashtable (that we already
1442 know does not contain the type.
1444 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1445 location/container type.
1447 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1449 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1451 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1453 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1454 method is being referenced in the method group from a static
1455 context, and report error 120 if so.
1457 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1460 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1461 is created, we create the A namespace).
1463 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1466 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1468 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1469 invocation to ModuleBuilder.GetType with the same values will
1470 return a new type instance, so we need to cache its return
1473 * expression.cs (Binary.ResolveOperator): Only allow the compare
1474 operators on enums if they are of the same type.
1476 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1477 types of ValueType on their own case. Before we were giving them
1478 the same treatment as objects.
1480 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1481 fullname. Short name is used to compare against container name.
1482 Fullname is used to check against defined namespace names.
1484 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1485 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1487 (Method.CheckBase): Call parent.
1488 (MemberBase.CheckBase): Check for protected members on sealed
1490 (PropertyBase.CheckBase): Call parent.
1491 (Field.Define): Call parent.
1493 * report.cs: Negative error codes are now mapped to 8000 - code,
1494 so that the display is render more nicely.
1496 * typemanager.cs: Do not use try/catch, instead report a regular
1499 (GetPointerType, GetReferenceType): These methods provide
1500 mechanisms to obtain the T* and T& from a T. We had the code
1501 previously scattered around the code base, and it also used
1502 TypeManager.LookupType that would go through plenty of caches.
1503 This one goes directly to the type source.
1505 In some places we did the Type.GetType followed by
1506 ModuleBuilder.GetType, but not in others, so this unifies the
1509 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1510 statements now that we have namespace information.
1512 * typemanager.cs (IsNamespace): New method, returns whether the
1513 string presented is a namespace or not.
1515 (ComputeNamespaces): New public entry point, computes the list of
1516 available namespaces, using the GetNamespaces API call in Mono, or
1517 the slower version in MS.NET.
1519 Now before we start the semantic analysis phase, we have a
1520 complete list of namespaces including everything that the user has
1523 Deleted old code to cache namespaces in .nsc files.
1525 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1527 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1528 class/struct location definition Location for the implicit
1529 constructor location.
1531 (Operator.Define): Use the location of the operator for the
1532 implicit Method definition.
1534 (Constructor.Emit): use the constructor location for the implicit
1535 base initializer constructor.
1537 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1538 and the Expression class now contains two new methods:
1540 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1541 isolate type lookup from the rest of the resolution process.
1543 Since we use Expressions to hold type definitions due to the way
1544 we parse the input we have historically overloaded Resolve to
1545 perform the Type lookups if a special flag is passed. Now this is
1546 eliminated and two methods take their place.
1548 The differences in the two methods between xStep and xTerminal is
1549 that xStep is involved in our current lookup system that uses
1550 SimpleNames to compose a name, while xTerminal is used just to
1551 catch the case where the simplename lookup failed.
1553 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1555 * expression.cs (ResolveMemberAccess): Remove redundant code.
1556 TypeExpr expressions are always born fully resolved.
1558 * interface.cs (PopulateMethod): Do not lookup the types twice.
1559 We were doing it once during SemanticAnalysis and once during
1562 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1563 in local variable type definitions, were being returned as a
1564 SimpleName (we decomposed everything into a string), that is
1565 because primary_expression was being used instead of a type in the
1566 grammar (reduce/reduce conflicts).
1568 The part that was wrong is that we converted the expression into a
1569 string (an oversimplification in one hand, compounded with primary
1570 expressions doing string concatenation).
1576 Would return "A.B.C[]" as a SimpleName. This stopped things like
1577 using clauses from working on this particular context. And a type
1578 was being matched directly against "A.B.C[]".
1580 We now use the correct approach, and allow for ComposedCast to be
1581 part of the unary expression. So the "A.B.C []" become a composed
1582 cast of "A.B.C" (as a nested group of MemberAccess with a
1583 SimpleName at the end) plus the rank composition "[]".
1587 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1589 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1590 for the access level checking.
1592 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1593 `TypeContainer container', because I kept getting confused when I
1594 was debugging this code.
1596 * expression.cs (Indexers): Instead of tracking getters/setters,
1597 we now track them in parallel. We create one arraylist less, but
1598 most importantly it is possible now for the LValue code to find a
1599 matching get for a set.
1601 (IndexerAccess.DoResolveLValue): Update the code.
1602 GetIndexersForType has been modified already to extract all the
1603 indexers from a type. The code assumed it did not.
1605 Also make the code set the correct return type for the indexer.
1606 This was fixed a long time ago for properties, but was missing for
1607 indexers. It used to be void_type.
1609 (Binary.Emit): Test first for doubles instead of
1610 floats, as they are more common.
1612 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1613 when dealing with floats and the <=, >= operators. This fixes bug
1616 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1617 to load the array value by emitting a load on the foreach variable
1618 type. This was incorrect.
1620 We now emit the code to load an element using the the array
1621 variable type, and then we emit the conversion operator.
1625 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1627 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1629 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1631 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1632 test for protection before we test for signatures.
1634 (MethodSignature.ToString): implement.
1636 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1637 to the case where we reduced into a LongConstant.
1639 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1640 depend on whether the information is acurrate, because the
1641 Microsoft runtime will always claim that the array type is public,
1642 regardless of the real state.
1644 If the type is a pointer, another problem happens: the type is
1645 reported as non-public in Microsoft.
1647 In both cases we have to call CheckAccessLevel recursively with
1648 the underlying type as the argument to be tested.
1650 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1652 * assign.cs (Assign.Emit): If we are dealing with a compound
1653 assignment expression, we should use the code path that stores the
1654 intermediate result in a temporary value. This fixes #40903.
1656 *expression.cs (Indirection.ToString): Provide ToString method for
1659 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
1661 * class.cs: Null out fields holding references to Block objects so
1662 they can be garbage collected.
1664 * expression.cs (OverloadResolve): Remove unused local.
1666 2003-04-07 Martin Baulig <martin@ximian.com>
1668 * codegen.cs (EmitContext.CurrentFile): New public field.
1669 (EmitContext.Mark): Use the CurrentFile to check whether the
1670 location is in the correct file.
1671 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1673 2003-04-07 Martin Baulig <martin@ximian.com>
1675 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1677 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1678 location. [FIXME: The location argument which gets passed to this
1679 method is sometimes wrong!]
1681 2003-04-07 Nick Drochak <ndrochak@gol.com>
1683 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1685 2003-04-07 Miguel de Icaza <miguel@ximian.com>
1687 * expression.cs (Indirection.EmitAssign): We were using the
1688 temporary, but returning immediately instead of continuing the
1691 2003-04-06 Martin Baulig <martin@ximian.com>
1693 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1694 if it's a nested child, but also deriving from the outer class.
1697 * typemanager.cs (IsNestedChildOf): Make this work if it's a
1698 nested child, but also deriving from the outer class. See
1700 (FilterWithClosure): We may access private members of the outer
1701 class if we're a nested child and deriving from the outer class.
1702 (RealMemberLookup): Only set `closure_private_ok' if the
1703 `original_bf' contained BindingFlags.NonPublic.
1705 2003-04-05 Martin Baulig <martin@ximian.com>
1707 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1709 2003-04-02 Miguel de Icaza <miguel@ximian.com>
1711 * class.cs (Event.Define): Do not allow abstract events to have
1714 2003-04-01 Miguel de Icaza <miguel@ximian.com>
1716 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1717 block in event declarations.
1719 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1720 value type, get its address.
1722 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1723 leaving a class on the stack instead of a boolean value (int
1724 0/1). Change the code so we compare against null, and then the
1725 result against zero.
1727 * class.cs (TypeContainer.GetClassBases): We were checking for the
1728 parent class being sealed too late.
1730 * expression.cs (Binary.Emit): For <= and >= when dealing with
1731 floating point values, use cgt.un and clt.un instead of cgt and
1734 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
1736 * statement.cs: Apply the same optimization as MS: skip the
1737 GetEnumerator returning an IEnumerator, and use the one returning a
1738 CharEnumerator instead. This allows us to avoid the try-finally block
1741 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
1743 * cs-parser.jay: Attributes cannot be applied to
1744 namespaces. Fixes #40473
1746 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1749 (Add*): check if the name is valid using the full name for constants,
1750 fields, properties and events.
1752 2003-03-28 Miguel de Icaza <miguel@ximian.com>
1754 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1755 char constants to be part of the enumeration.
1757 * expression.cs (Conditional.DoResolve): Add support for operator
1758 true. Implements the missing functionality from 14.12
1760 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1761 operator true/false as required by the spec.
1763 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1764 implicit conversion to boolean.
1766 * statement.cs (Statement.ResolveBoolean): A boolean expression is
1767 also one where the type implements `operator true'.
1769 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1770 get an expression that will invoke operator true based on an
1773 (GetConversionOperators): Removed the hack that called op_True
1776 (Expression.ResolveBoolean): Move this from Statement.
1778 2003-03-17 Miguel de Icaza <miguel@ximian.com>
1780 * ecore.cs (FieldExpr): do not allow initialization of initonly
1781 fields on derived classes
1783 2003-03-13 Martin Baulig <martin@ximian.com>
1785 * statement.cs (Block.Emit): Call ig.BeginScope() and
1786 ig.EndScope() when compiling with debugging info; call
1787 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1789 2003-03-08 Miguel de Icaza <miguel@ximian.com>
1791 * expression.cs (Indexers): Do not construct immediately, allow
1792 for new members to be appended as we go. Fixes 38143
1794 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1796 * expression.cs: save/restore context when resolving an unchecked
1799 2003-03-05 Miguel de Icaza <miguel@ximian.com>
1801 * cfold.cs: Catch division by zero in modulus operator during
1804 2003-03-03 Miguel de Icaza <miguel@ximian.com>
1806 * interface.cs (Interface.DefineMembers): Avoid defining members
1809 2003-02-27 Miguel de Icaza <miguel@ximian.com>
1811 * driver.cs: handle the +/- options for -noconfig
1813 * statement.cs (Unckeched.Resolve): Also track the state of
1814 unchecked in the Resolve phase.
1816 2003-02-27 Martin Baulig <martin@ximian.com>
1818 * ecore.cs (Expression.MemberLookup): Don't create a
1819 MethodGroupExpr for something which is not a method. Fixes #38291.
1821 2003-02-25 Miguel de Icaza <miguel@ximian.com>
1823 * class.cs (MemberBase.CheckParameters): Also check that the type
1824 is unmanaged if it is a pointer.
1826 * expression.cs (SizeOf.Resolve): Add location information.
1828 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1829 a managed type is declared.
1831 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1832 parameter modifiers as well. Fixes bug 38606
1834 * class.cs: Very sad. Am backing out the speed up changes
1835 introduced by the ArrayList -> Array in the TypeContainer, as they
1836 were not actually that much faster, and introduced a bug (no error
1837 reports on duplicated methods).
1839 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1840 source first, this will guarantee that we have a valid expression
1841 before calling in lower levels functions that will require a
1842 resolved object. Then use this original_source in the
1843 target.ResolveLValue instead of the original source that was
1846 Another change. Use target.Resolve instead of LValueResolve.
1847 Although we are resolving for LValues, we will let the Assign code
1848 take care of that (it will be called again from Resolve). This
1849 basically allows code like this:
1851 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1852 class Y { void A (X x) { x [0] += o; }
1854 The problem was that the indexer was trying to resolve for
1855 set_Item (idx, object o) and never finding one. The real set_Item
1856 was set_Item (idx, X). By delaying the process we get the right
1861 2003-02-23 Martin Baulig <martin@ximian.com>
1863 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1864 while calling DoEmit ().
1866 * codegen.cs (EmitContext.Mark): Don't mark locations in other
1867 source files; if you use the #line directive inside a method, the
1868 compiler stops emitting line numbers for the debugger until it
1869 reaches the end of the method or another #line directive which
1870 restores the original file.
1872 2003-02-23 Martin Baulig <martin@ximian.com>
1874 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1876 2003-02-23 Martin Baulig <martin@ximian.com>
1878 * statement.cs (Block.AddChildVariableNames): We need to call this
1879 recursively, not just for our immediate children.
1881 2003-02-23 Martin Baulig <martin@ximian.com>
1883 * class.cs (Event.Define): Always make the field private, like csc does.
1885 * typemanager.cs (TypeManager.RealMemberLookup): Make events
1886 actually work, fixes bug #37521.
1888 2003-02-23 Miguel de Icaza <miguel@ximian.com>
1890 * delegate.cs: When creating the various temporary "Parameters"
1891 classes, make sure that we call the ComputeAndDefineParameterTypes
1892 on those new parameters (just like we do with the formal ones), to
1893 allow them to be resolved in the context of the DeclSpace.
1895 This fixes the bug that Dick observed in Bugzilla #38530.
1897 2003-02-22 Miguel de Icaza <miguel@ximian.com>
1899 * expression.cs (ResolveMemberAccess): When resolving a constant,
1900 do not attempt to pull a constant if the value was not able to
1901 generate a valid constant.
1903 * const.cs (LookupConstantValue): Do not report more errors than required.
1905 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1907 * expression.cs: fixes bug #38328.
1909 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1911 * class.cs: Changed all the various members that can be part of a
1912 class from being an ArrayList to be an Array of the right type.
1913 During the DefineType type_list, interface_list, delegate_list and
1914 enum_list are turned into types, interfaces, delegates and enums
1917 And during the member population, indexer_list, event_list,
1918 constant_list, field_list, instance_constructor_list, method_list,
1919 operator_list and property_list are turned into their real arrays.
1921 Although we could probably perform this operation earlier, for
1922 good error reporting we need to keep the lists and remove the
1923 lists for longer than required.
1925 This optimization was triggered by Paolo profiling the compiler
1926 speed on the output of `gen-sample-program.pl' perl script.
1928 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
1929 not crash in methods like MemberLookupFailed that use this field.
1931 This problem arises when the compiler fails to resolve a type
1932 during interface type definition for example.
1934 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1936 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
1937 inherit from System.Object, so we have to stop at null, not only
1938 when reaching System.Object.
1940 2003-02-17 Miguel de Icaza <miguel@ximian.com>
1942 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
1943 DeclaredOnly because the parent indexer might have had a different
1944 name, but did not loop until the top of the hierarchy was reached.
1946 The problem this one fixes is 35492: when a class implemented an
1947 indexer from an interface, we were getting the interface method
1948 (which was abstract) and we were flagging an error (can not invoke
1951 This also keeps bug 33089 functioning, and test-148 functioning.
1953 * typemanager.cs (IsSpecialMethod): The correct way of figuring
1954 out if a method is special is to see if it is declared in a
1955 property or event, or whether it is one of the predefined operator
1956 names. This should fix correctly #36804.
1958 2003-02-15 Miguel de Icaza <miguel@ximian.com>
1960 The goal here is to remove the dependency on EmptyCast.Peel ().
1961 Killing it completely.
1963 The problem is that currently in a number of places where
1964 constants are expected, we have to "probe" for an EmptyCast, and
1965 Peel, which is not the correct thing to do, as this will be
1966 repetitive and will likely lead to errors.
1968 The idea is to remove any EmptyCasts that are used in casts that
1969 can be reduced to constants, so we only have to cope with
1972 This bug hunt was triggered by Bug 37363 and the desire to remove
1973 the duplicate pattern where we were "peeling" emptycasts to check
1974 whether they were constants. Now constants will always be
1977 * ecore.cs: Use an enumconstant here instead of wrapping with
1980 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1981 throwing me off. By handling this we can get rid of a few hacks.
1983 * statement.cs (Switch): Removed Peel() code.
1985 2003-02-14 Miguel de Icaza <miguel@ximian.com>
1987 * class.cs: Location information for error 508
1989 * expression.cs (New.DoResolve): Add a guard against double
1990 resolution of an expression.
1992 The New DoResolve might be called twice when initializing field
1993 expressions (see EmitFieldInitializers, the call to
1994 GetInitializerExpression will perform a resolve on the expression,
1995 and later the assign will trigger another resolution
1997 This leads to bugs (#37014)
1999 * delegate.cs: The signature for EndInvoke should contain any ref
2000 or out parameters as well. We were not doing this in the past.
2002 * class.cs (Field.Define): Do not overwrite the type definition
2003 inside the `volatile' group. Turns out that volatile enumerations
2004 were changing the type here to perform a validity test, which
2007 2003-02-12 Miguel de Icaza <miguel@ximian.com>
2009 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2010 and structs, we do not want to load the instance variable
2012 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2013 enum_type has to be handled like an object reference (implicit
2014 conversions exists from this to object), but the regular IsClass
2015 and IsValueType tests will never return true for this one.
2017 Also we use TypeManager.IsValueType instead of type.IsValueType,
2018 just for consistency with the rest of the code (this is only
2019 needed if we ever use the construct exposed by test-180.cs inside
2020 corlib, which we dont today).
2022 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
2024 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2027 2003-02-09 Martin Baulig <martin@ximian.com>
2029 * namespace.cs (Namespace..ctor): Added SourceFile argument.
2030 (Namespace.DefineNamespaces): New static public method; this is
2031 called when we're compiling with debugging to add all namespaces
2034 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2035 pass it to the Namespace's .ctor.
2037 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2038 and MethodBase arguments; pass the namespace ID to the symwriter;
2039 pass the MethodBase instead of the token to the symwriter.
2040 (SymbolWriter.DefineNamespace): New method to add a namespace to
2043 2003-02-09 Martin Baulig <martin@ximian.com>
2045 * symbolwriter.cs: New file. This is a wrapper around
2046 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
2047 methods here in near future.
2049 2003-02-09 Martin Baulig <martin@ximian.com>
2051 * codegen.cs (EmitContext.Mark): Just pass the arguments to
2052 ILGenerator.MarkSequencePoint() which are actually used by the
2055 2003-02-09 Martin Baulig <martin@ximian.com>
2057 * location.cs (SourceFile): New public sealed class. This
2058 contains the name and an index which is used in the location's token.
2059 (Location): Reserve an appropriate number of bits in the token for
2060 the source file instead of walking over that list, this gives us a
2061 really huge performance improvement when compiling with debugging.
2063 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2064 `SourceFile' argument instead of a string.
2065 (Driver.ProcessFile): Add all the files via Location.AddFile(),
2066 but don't parse/tokenize here, we need to generate the list of all
2067 source files before we do that.
2068 (Driver.ProcessFiles): New static function. Parses/tokenizes all
2071 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2072 instead of a string.
2074 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2077 2003-02-09 Martin Baulig <martin@ximian.com>
2079 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2080 filename on `#line default'.
2082 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2084 * statement.cs: don't clear the pinned var when the fixed statement
2085 returns from the method (fixes bug#37752).
2087 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2089 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
2092 2003-02-07 Martin Baulig <martin@ximian.com>
2094 * driver.cs: Removed the `--debug-args' command line argument.
2096 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2097 automatically by the AsssemblyBuilder.
2098 (CodeGen.InitializeSymbolWriter): We don't need to call any
2099 initialization function on the symbol writer anymore. This method
2100 doesn't take any arguments.
2102 2003-02-03 Miguel de Icaza <miguel@ximian.com>
2104 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2105 from referenced assemblies as well.
2107 2003-02-02 Martin Baulig <martin@ximian.com>
2109 * class.cs (MethodData.Emit): Generate debugging info for external methods.
2111 2003-02-02 Martin Baulig <martin@ximian.com>
2113 * class.cs (Constructor.Emit): Open the symbol writer before
2114 emitting the constructor initializer.
2115 (ConstructorInitializer.Emit): Call ec.Mark() to allow
2116 single-stepping through constructor initializers.
2118 2003-01-30 Miguel de Icaza <miguel@ximian.com>
2120 * class.cs: Handle error 549: do not allow virtual methods in
2123 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2125 * decl.cs: Check access levels when resolving types
2127 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2129 * statement.cs: Add parameters and locals set in catch blocks that might
2130 return to set vector
2132 2003-01-29 Miguel de Icaza <miguel@ximian.com>
2134 * class.cs (Operator): Set the SpecialName flags for operators.
2136 * expression.cs (Invocation.DoResolve): Only block calls to
2137 accessors and operators on SpecialName methods.
2139 (Cast.TryReduce): Handle conversions from char constants.
2142 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2144 * statement.cs: small memory and time optimization in FlowBranching.
2146 2003-01-28 Pedro Mart <yoros@wanadoo.es>
2148 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2149 problem that the last fix but in the other sid (Set).
2151 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2152 access when there is no indexer in the hierarchy.
2154 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2156 * class.cs: Combine some if statements.
2158 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2160 * driver.cs: fixed bug #37187.
2162 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
2164 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2165 any indexer, it's needed to build a list with all the indexers in the
2166 hierarchy (AllGetters), else we have problems. Fixes #35653.
2168 2003-01-23 Miguel de Icaza <miguel@ximian.com>
2170 * class.cs (MethodData.Define): It is wrong for an interface
2171 implementation to be static in both cases: explicit and implicit.
2172 We were only handling this in one case.
2174 Improve the if situation there to not have negations.
2176 * class.cs (Field.Define): Turns out that we do not need to check
2177 the unsafe bit on field definition, only on usage. Remove the test.
2179 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2181 * driver.cs: use assembly.Location instead of Codebase (the latest
2182 patch made mcs fail when using MS assemblies).
2184 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
2186 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2187 get the path to *corlib.dll.
2189 2003-01-21 Nick Drochak <ndrochak@gol.com>
2193 * typemanager.cs: Remove compiler warnings
2195 2003-01-20 Duncan Mak <duncan@ximian.com>
2197 * AssemblyInfo.cs: Bump the version number to 0.19.
2199 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2201 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2203 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2205 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2207 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2209 * cs-parser.jay: Small fix: we were not comparing the constructor
2210 name correctly. Thanks to Zoltan for the initial pointer.
2212 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2214 * cs-tokenizer.cs: Set file name when specified with #line
2216 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2218 * cs-parser.jay: Only perform the constructor checks here if we
2219 are named like the class; This will help provider a better
2220 error. The constructor path is taken when a type definition is
2221 not found, but most likely the user forgot to add the type, so
2222 report that rather than the constructor error.
2224 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2226 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2229 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2231 * cs-parser.jay: Add cleanup call.
2233 2003-01-13 Duncan Mak <duncan@ximian.com>
2235 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2236 consistent with other methods.
2238 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2240 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2242 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2244 * attribute.cs: only set GuidAttr to true when we have a
2247 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2251 * typemanager.cs: fixes to allow mcs compile corlib with the new
2252 Type.IsSubclassOf fix.
2254 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2256 * expression.cs (LocalVariableReference.DoResolve): Classify a
2257 constant as a value, not as a variable. Also, set the type for
2260 * cs-parser.jay (fixed_statement): take a type instead of a
2261 pointer_type, so we can produce a better error message later.
2263 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2266 (For.DoEmit): Make inifinite loops have a
2267 non-conditional branch back.
2269 (Fixed.DoEmit): First populate the pinned variables, then emit the
2270 statement, then clear the variables. Before I was emitting the
2271 code once for each fixed piece.
2274 2003-01-08 Martin Baulig <martin@ximian.com>
2276 * statement.cs (FlowBranching.MergeChild): A break in a
2277 SWITCH_SECTION does not leave a loop. Fixes #36155.
2279 2003-01-08 Martin Baulig <martin@ximian.com>
2281 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2282 lives in the same number space than `param_map'. Fixes #36154.
2284 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2286 * cs-parser.jay (constructor_declaration): Set the
2287 Constructor.ModFlags before probing for it. This makes the
2288 compiler report 514, 515 and 132 (the code was there, but got
2291 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2292 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2293 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2295 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2297 * enum.cs: create the enum static fields using the enum type.
2299 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2301 * class.cs: don't try to create the ParamBuilder for the return
2302 type if it's not needed (and handle it breaking for the ms runtime
2305 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2307 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2309 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2311 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2312 the command. This showed up while compiling the JANET source
2313 code, which used \r as its only newline separator.
2315 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2317 * class.cs (Method.Define): If we are an operator (because it
2318 reuses our code), then set the SpecialName and HideBySig. #36128
2320 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2322 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2323 exception, report error 120 `object reference required'.
2325 * driver.cs: Add --pause option, used during to measure the size
2326 of the process as it goes with --timestamp.
2328 * expression.cs (Invocation.DoResolve): Do not allow methods with
2329 SpecialName to be invoked.
2331 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2333 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2334 number before adding it.
2336 2002-12-21 Ravi Pratap <ravi@ximian.com>
2338 * ecore.cs (StandardImplicitConversion): When in an unsafe
2339 context, we allow conversion between void * to any other pointer
2340 type. This fixes bug #35973.
2342 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2344 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2345 is not thrown when extensionless outputs are used
2347 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2349 * rootcontext.cs: fixed compilation of corlib.
2351 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2353 * attribute.cs (Attributes.Contains): Add new method.
2355 * class.cs (MethodCore.LabelParameters): if the parameter is an
2356 `out' parameter, check that no attribute `[In]' has been passed.
2358 * enum.cs: Handle the `value__' name in an enumeration.
2360 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2362 * decl.cs: Added special case to allow overrides on "protected
2365 2002-12-18 Ravi Pratap <ravi@ximian.com>
2367 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2368 since it makes much more sense.
2370 (Attributes.ctor): Don't require a Location parameter.
2372 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2374 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2375 since we already have that information per attribute.
2377 * everywhere : make appropriate changes.
2379 * class.cs (LabelParameters): Write the code which actually
2380 applies attributes to the return type. We can't do this on the MS
2381 .NET runtime so we flag a warning in the case an exception is
2384 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2386 * const.cs: Handle implicit null conversions here too.
2388 2002-12-17 Ravi Pratap <ravi@ximian.com>
2390 * class.cs (MethodCore.LabelParameters): Remove the extra
2391 Type [] parameter since it is completely unnecessary. Instead
2392 pass in the method's attributes so that we can extract
2393 the "return" attribute.
2395 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2397 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2398 of ignoring it and letting the compile continue.
2400 * typemanager.cs (ChangeType): use an extra argument to return an
2401 error condition instead of throwing an exception.
2403 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2405 * expression.cs (Unary.TryReduce): mimic the code for the regular
2406 code path. Perform an implicit cast in the cases where we can
2407 implicitly convert to one of the integral types, and then reduce
2408 based on that constant. This fixes bug #35483.
2410 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2412 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2414 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2416 * namespace.cs: fixed bug #35489.
2418 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2420 * class.cs: Remove some dead code.
2422 * cs-parser.jay: Estimate the number of methods needed
2423 (RootContext.MethodCount);
2425 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2426 numbers instead of StringBuilders.
2428 * support.cs (PtrHashtable): Add constructor with initial size;
2429 We can now reduce reallocations of the method table.
2431 2002-12-10 Ravi Pratap <ravi@ximian.com>
2433 * attribute.cs (ApplyAttributes): Keep track of the emitted
2434 attributes on a per-target basis. This fixes bug #35413.
2436 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2438 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2439 default to the Windows 1252 encoding.
2441 (UnixParseOption): Support version, thanks to Alp for the missing
2444 * AssemblyInfo.cs: Add nice assembly information.
2446 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2449 * cs-parser.jay: Allow a trailing comma before the close bracked
2450 in the attribute_section production.
2452 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2453 address of the instance was being taken, I will take this out,
2454 because we take the address of the object immediately here.
2456 2002-12-09 Ravi Pratap <ravi@ximian.com>
2458 * typemanager.cs (AreMultipleAllowed): Take care of the most
2459 obvious case where attribute type is not in the current assembly -
2462 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2464 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2465 definitions, instead of doing that afterwards.
2467 Also we use a nice little hack, depending on the constructor, we
2468 know if we are a "composed" name or a simple name. Hence, we
2469 avoid the IndexOf test, and we avoid
2471 * codegen.cs: Add code to assist in a bug reporter to track down
2472 the source of a compiler crash.
2474 2002-12-07 Ravi Pratap <ravi@ximian.com>
2476 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2477 types have been emitted for a given element and flag an error
2478 if something which does not have AllowMultiple set is used more
2481 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2482 attribute types and their corresponding AllowMultiple properties
2484 (AreMultipleAllowed): Check the property for a given type.
2486 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2487 property in the case we have a TypeContainer.
2489 (Attributes.AddAttribute): Detect duplicates and just skip on
2490 adding them. This trivial fix catches a pretty gross error in our
2491 attribute emission - global attributes were being emitted twice!
2493 Bugzilla bug #33187 is now fixed.
2495 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2497 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2500 * expression.cs (Binary.ResolveOperator): I can only use the
2501 Concat (string, string, string) and Concat (string, string,
2502 string, string) if the child is actually a concatenation of
2505 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2507 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2508 context where we need a 2-character lookahead.
2510 * pending.cs (PendingImplementation): Rework so we can keep track
2511 of interface types all the time, and flag those which were
2512 implemented by parents as optional.
2514 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2516 * expression.cs (Binary.ResolveOperator): Use
2517 String.Concat(string,string,string) or
2518 String.Concat(string,string,string,string) when possible.
2520 * typemanager: More helper methods.
2523 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2525 * pending.cs: remove the bogus return from GetMissingInterfaces()
2526 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2528 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2530 * namespace.cs: avoid duplicated 'using xxx' being added to
2531 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2532 when we get more than one 'using' statement for the same namespace.
2533 Report a CS0105 warning for it.
2535 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2537 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2538 of calling getChar/putback, uses internal knowledge of it.
2540 (xtoken): Reorder tokenizer so most common patterns are checked
2541 first. This reduces the compilation time in another 5% (from 8.11s
2542 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2544 The parsing time is 22% of the compilation in mcs, and from that
2545 64% is spent on the tokenization process.
2547 I tried using a binary search for keywords, but this is slower
2548 than the hashtable. Another option would be to do a couple of
2551 * Not use a StringBuilder, instead use an array of chars,
2552 with a set value. Notice that this way we could catch
2553 the 645 error without having to do it *afterwards*.
2555 * We could write a hand-parser to avoid the hashtable
2556 compares altogether.
2558 The identifier consumption process takes 37% of the tokenization
2559 time. Another 15% is spent on is_number. 56% of the time spent
2560 on is_number is spent on Int64.Parse:
2562 * We could probably choose based on the string length to
2563 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2566 Another 3% is spend on wrapping `xtoken' in the `token' function.
2568 Handle 0xa0 as whitespace (#34752)
2570 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2572 * typemanager.cs (IsCLRType): New routine to tell whether a type
2573 is one of the builtin types.
2575 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2576 typecode in more places instead of doing pointer comparissions.
2577 We could leverage some knowledge about the way the typecodes are
2580 New code to cache namespaces in assemblies, it is currently not
2581 invoked, to be used soon.
2583 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2585 * expression.cs (Binary.ResolveOperator): specially handle
2586 strings, and do not perform user-defined operator overloading for
2589 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2591 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2592 internalcall as it is a pretty simple operation; Avoid whenever
2593 possible to call Char.IsLetter.
2595 (consume_identifier): Cut by half the number of
2596 hashtable calls by merging the is_keyword and GetKeyword behavior.
2598 Do not short-circuit, because if we do, we
2599 report errors (ie, #if false && true would produce an invalid
2603 2002-11-24 Martin Baulig <martin@ximian.com>
2605 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2606 check constant ranges and report a CS0221. Fixes #33186.
2608 2002-11-24 Martin Baulig <martin@ximian.com>
2610 * cs-parser.jay: Make this work for uninitialized variable
2611 declarations in the `for' initializer. Fixes #32416.
2613 2002-11-24 Martin Baulig <martin@ximian.com>
2615 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2616 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2618 2002-11-24 Martin Baulig <martin@ximian.com>
2620 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2621 argument; if true, we also check for user-defined conversions.
2622 This is only needed if both arguments are of a user-defined type.
2623 Fixes #30443, added test-175.cs.
2624 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2626 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2628 2002-11-24 Martin Baulig <martin@ximian.com>
2630 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2631 function to get the store opcode.
2632 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2633 only emit the Ldelema if the store opcode is Stobj. You must run
2634 both test-34 and test-167 to test this. Fixes #34529.
2636 2002-11-23 Martin Baulig <martin@ximian.com>
2638 * ecore.cs (Expression.MemberLookup): Added additional
2639 `qualifier_type' argument which is used when we're being called
2640 from MemberAccess.DoResolve() and null if we're called from a
2642 (Expression.MemberLookupFailed): New method to report errors; this
2643 does the CS1540 check and reports the correct error message.
2645 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2646 argument for the CS1540 check and redone the way how we're dealing
2647 with private members. See the comment in the source code for details.
2648 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2649 `closure_start_type' to `closure_qualifier_type' and check whether
2650 it's not null. It was not this filter being broken, it was just
2651 being called with the wrong arguments.
2653 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2654 and pass it the correct `qualifier_type'; this also does the error
2657 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2659 * expression.cs (Invocation.EmitParams): If the we are dealing
2660 with a non-built-in value type, load its address as well.
2662 (ArrayCreation): Use a a pretty constant instead
2663 of the hardcoded value 2. Use 6 instead of 2 for the number of
2664 static initializers.
2666 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2667 because they are not really value types, just glorified integers.
2669 * driver.cs: Do not append .exe, the CSC compiler does not do it.
2671 * ecore.cs: Remove redundant code for enumerations, make them use
2672 the same code path as everything else, fixes the casting issue
2673 with enumerations in Windows.Forms.
2675 * attribute.cs: Do only cast to string if it is a string, the
2676 validation happens later.
2678 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2679 people upgrade their corlibs.
2681 * ecore.cs: Oops, enumerations were not following the entire code path
2683 2002-11-21 Miguel de Icaza <miguel@ximian.com>
2685 * typemanager.cs (FilterWithClosure): Commented out the test for
2686 1540 in typemanager.cs, as it has problems when accessing
2687 protected methods from a parent class (see test-174.cs).
2689 * attribute.cs (Attribute.ValidateGuid): new method.
2690 (Attribute.Resolve): Use above.
2692 2002-11-19 Miguel de Icaza <miguel@ximian.com>
2694 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2696 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2697 handling for enumerations, as we only needed the TypeContainer
2698 functionality to begin with (this is required for the fix below to
2699 work for enums that reference constants in a container class for
2702 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2704 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2705 a valid TypeBuilder to perform lookups on.o
2707 * class.cs (InheritableMemberSignatureCompare): Use true in the
2708 call to GetGetMethod and GetSetMethod, because we are comparing
2709 the signature, and we need to get the methods *even* if they are
2712 (PropertyBase.CheckBase): ditto.
2714 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2715 GotoCase.Resolve): Use Peel on EmpytCasts.
2717 * ecore.cs (EmptyCast): drop child, add Peel method.
2719 2002-11-17 Martin Baulig <martin@ximian.com>
2721 * ecore.cs (EmptyCast.Child): New public property.
2723 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2724 label resolved to an EmptyCast. Fixes #34162.
2725 (GotoCase.Resolve): Likewise.
2726 (Block.EmitMeta): Likewise.
2728 2002-11-17 Martin Baulig <martin@ximian.com>
2730 * expression.cs (Invocation.BetterConversion): Prefer int over
2731 uint; short over ushort; long over ulong for integer literals.
2732 Use ImplicitConversionExists instead of StandardConversionExists
2733 since we also need to check for user-defined implicit conversions.
2734 Fixes #34165. Added test-173.cs.
2736 2002-11-16 Martin Baulig <martin@ximian.com>
2738 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2739 with the `true' and `false' literals. Fixes #33151.
2741 2002-11-16 Martin Baulig <martin@ximian.com>
2743 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2744 October 22nd; don't do the cs1540 check for static members.
2746 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2747 now using our own filter here and doing the cs1540 check again.
2749 2002-11-16 Martin Baulig <martin@ximian.com>
2751 * support.cs (InternalParameters): Don't crash if we don't have
2752 any fixed parameters. Fixes #33532.
2754 2002-11-16 Martin Baulig <martin@ximian.com>
2756 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2757 when looking up static methods to make this work on Windows.
2760 2002-11-16 Martin Baulig <martin@ximian.com>
2762 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2763 a setter rather than using PropertyInfo.CanWrite.
2765 2002-11-15 Nick Drochak <ndrochak@gol.com>
2767 * class.cs: Allow acces to block member by subclasses. Fixes build
2770 2002-11-14 Martin Baulig <martin@ximian.com>
2772 * class.cs (Constructor.Emit): Added the extern/block check.
2775 2002-11-14 Martin Baulig <martin@ximian.com>
2777 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2778 iteration while looking for indexers, this is needed because the
2779 indexer may have a different name in our base classes. Fixed the
2780 error reporting (no indexers at all, not get accessor, no
2781 overloaded match). Fixes bug #33089.
2782 (IndexerAccess.DoResolveLValue): Likewise.
2784 2002-11-14 Martin Baulig <martin@ximian.com>
2786 * class.cs (PropertyBase.CheckBase): Make this work for multiple
2787 indexers. Fixes the first part of bug #33089.
2788 (MethodSignature.InheritableMemberSignatureCompare): Added support
2791 2002-11-13 Ravi Pratap <ravi@ximian.com>
2793 * attribute.cs (Attribute.Resolve): Catch the
2794 NullReferenceException and report it since it isn't supposed to
2797 2002-11-12 Miguel de Icaza <miguel@ximian.com>
2799 * expression.cs (Binary.EmitBranchable): Also handle the cases for
2800 LogicalOr and LogicalAnd that can benefit from recursively
2801 handling EmitBranchable. The code now should be nice for Paolo.
2803 2002-11-08 Miguel de Icaza <miguel@ximian.com>
2805 * typemanager.cs (LookupType): Added a negative-hit hashtable for
2806 the Type lookups, as we perform quite a number of lookups on
2807 non-Types. This can be removed once we can deterministically tell
2808 whether we have a type or a namespace in advance.
2810 But this might require special hacks from our corlib.
2814 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2815 and double which avoids a conversion from an integer to a double.
2817 * expression.cs: tiny optimization, avoid calling IsConstant,
2818 because it effectively performs the lookup twice.
2820 2002-11-06 Miguel de Icaza <miguel@ximian.com>
2822 But a bogus return here to keep the semantics of the old code
2823 until the Mono runtime is fixed.
2825 * pending.cs (GetMissingInterfaces): New method used to remove all
2826 the interfaces that are already implemented by our parent
2827 classes from the list of pending methods.
2829 * interface.cs: Add checks for calls after ResolveTypeExpr.
2831 2002-11-05 Miguel de Icaza <miguel@ximian.com>
2833 * class.cs (Class.Emit): Report warning 67: event not used if the
2834 warning level is beyond 3.
2836 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2837 being a NullLiteral.
2839 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2842 * class.cs (TypeContainer.GetClassBases): Cover a missing code
2843 path that might fail if a type can not be resolved.
2845 * expression.cs (Binary.Emit): Emit unsigned versions of the
2848 * driver.cs: use error 5.
2850 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2852 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2854 2002-11-01 Miguel de Icaza <miguel@ximian.com>
2856 * cs-parser.jay (switch_section): A beautiful patch from Martin
2857 Baulig that fixed 33094.
2859 2002-10-31 Miguel de Icaza <miguel@ximian.com>
2861 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2862 Check whether the base is abstract and report an error if so.
2864 * expression.cs (IndexerAccess.DoResolveLValue,
2865 IndexerAccess.DoResolve): ditto.
2867 (Invocation.DoResolve): ditto.
2869 (Invocation.FullMethodDesc): Improve the report string.
2871 * statement.cs (Block): Eliminate IsVariableDefined as it is
2872 basically just a wrapper for GetVariableInfo.
2874 * ecore.cs (SimpleName): Use new
2876 * support.cs (ReflectionParamter.ParameterType): We unwrap the
2877 type, as we return the actual parameter ref/unref state on a
2880 2002-10-30 Miguel de Icaza <miguel@ximian.com>
2882 * support.cs: Return proper flags REF/OUT fixing the previous
2885 * expression.cs: Reverted last patch, that was wrong. Is_ref is
2886 not used to mean `ref' but `ref or out' in ParameterReference
2888 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
2889 full type signature instead of calling TypeManger.CSharpName
2892 * support.cs (InternalParameters.ParameterDesc): Do not compare
2893 directly to the modflags, because REF/OUT will actually be bitsets
2896 * delegate.cs (VerifyMethod): Check also the modifiers.
2898 * cs-tokenizer.cs: Fix bug where floating point values with an
2899 exponent where a sign was missing was ignored.
2901 * driver.cs: Allow multiple assemblies to be specified in a single
2904 2002-10-28 Miguel de Icaza <miguel@ximian.com>
2906 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
2907 because identifiers after a parenthesis would end up in this kind
2908 of production, and we needed to desamiguate it for having casts
2911 (UserDefinedType *) xxx
2913 2002-10-24 Miguel de Icaza <miguel@ximian.com>
2915 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
2916 we should set on the Bindingflags.NonPublic, but not turn on
2917 private_ok. private_ok controls whether a Private member is
2918 returned (this is chekced on the filter routine), while the
2919 BindingFlags.NonPublic just controls whether private/protected
2920 will be allowed. This fixes the problem part of the problem of
2921 private properties being allowed to be used in derived classes.
2923 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
2924 so we can call the children DoResolveLValue method (this will
2925 properly signal errors on lvalue assignments to base properties)
2927 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
2928 getter are null, and we have a property info, we know that this
2929 happened because the lookup failed, so we report an error 122 for
2930 protection level violation.
2932 We also silently return if setter and getter are null in the
2933 resolve functions, this condition only happens if we have flagged
2934 the error before. This is the other half of the problem.
2936 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
2937 not have accessibility information, that is why we were returning
2938 true in the filter function in typemanager.cs.
2940 To properly report 122 (property is inaccessible because of its
2941 protection level) correctly, we report this error in ResolveAccess
2942 by failing if both the setter and the getter are lacking (ie, the
2945 DoResolve and DoLResolve have been modified to check for both
2946 setter/getter being null and returning silently, the reason being
2947 that I did not want to put the knowledge about this error in upper
2950 int old = Report.Errors;
2951 x = new PropertyExpr (...);
2952 if (old != Report.Errors)
2957 So the property expr is returned, but it is invalid, so the error
2958 will be flagged during the resolve process.
2960 * class.cs: Remove InheritablePropertySignatureCompare from the
2961 class, as we no longer depend on the property signature to compute
2962 whether it is possible to implement a method or not.
2964 The reason is that calling PropertyInfo.GetGetMethod will return
2965 null (in .NET, in Mono it works, and we should change this), in
2966 cases where the Get Method does not exist in that particular
2971 class X { public virtual int A { get { return 1; } } }
2973 class Z : Y { public override int A { get { return 2; } } }
2975 Would fail in Z because the parent (Y) would not have the property
2976 defined. So we avoid this completely now (because the alternative
2977 fix was ugly and slow), and we now depend exclusively on the
2980 (PropertyBase.CheckBase): Use a method-base mechanism to find our
2981 reference method, instead of using the property.
2983 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2984 routines are gone now.
2986 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2987 names, they were incorrectly named.
2989 * cs-tokenizer.cs: Return are more gentle token on failure.
2991 * pending.cs (PendingImplementation.InterfaceMethod): This routine
2992 had an out-of-sync index variable, which caused it to remove from
2993 the list of pending methods the wrong method sometimes.
2995 2002-10-22 Miguel de Icaza <miguel@ximian.com>
2997 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2998 CanWrite, because those refer to this particular instance of the
2999 property, and do not take into account the fact that we can
3000 override single members of a property.
3002 Constructor requires an EmitContext. The resolution process does
3003 not happen here, but we need to compute the accessors before,
3004 because the resolution does not always happen for properties.
3006 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3007 subclass, before we did not update this flag, but we did update
3010 (GetAccessors): Drop this routine, as it did not work in the
3011 presence of partially overwritten set/get methods.
3013 Notice that this broke the cs1540 detection, but that will require
3016 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3020 * driver.cs: issue a warning instead of an error if we don't support
3021 debugging for the platform. Also ignore a couple of errors that may
3022 arise when trying to write the symbols. Undo my previous patch.
3024 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3026 * driver.cs: ignore /debug switch except for Unix platforms.
3028 2002-10-23 Nick Drochak <ndrochak@gol.com>
3030 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3032 2002-10-21 Miguel de Icaza <miguel@ximian.com>
3034 * driver.cs: Do not make mcs-debug conditional, so we do not break
3037 * statement.cs (UsageVector.MergeChildren): I would like Martin to
3038 review this patch. But basically after all the children variables
3039 have been merged, the value of "Breaks" was not being set to
3040 new_breaks for Switch blocks. I think that it should be set after
3041 it has executed. Currently I set this to the value of new_breaks,
3042 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3043 conservative, but I do not understand this code very well.
3045 I did not break anything in the build, so that is good ;-)
3047 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3049 2002-10-20 Mark Crichton <crichton@gimp.org>
3051 * cfold.cs: Fixed compile blocker. Really fixed it this time.
3053 2002-10-20 Nick Drochak <ndrochak@gol.com>
3055 * cfold.cs: Fixed compile blocker.
3057 2002-10-20 Miguel de Icaza <miguel@ximian.com>
3059 * driver.cs: I was chekcing the key, not the file.
3061 2002-10-19 Ravi Pratap <ravi@ximian.com>
3063 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3064 message that we were generating - we just need to silently return
3067 2002-10-19 Miguel de Icaza <miguel@ximian.com>
3069 * class.cs (Event.Define): Change my previous commit, as this
3070 breaks the debugger. This is a temporary hack, as it seems like
3071 the compiler is generating events incorrectly to begin with.
3073 * expression.cs (Binary.ResolveOperator): Added support for
3074 "U operator - (E x, E y)"
3076 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3079 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3080 init-only variables, but this path did not take into account that
3081 there might be also instance readonly variables. Correct this
3084 This fixes bug 32253
3086 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3089 * driver.cs: Change the extension for modules to `netmodule'
3091 * cs-parser.jay: Improved slightly the location tracking for
3092 the debugger symbols.
3094 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3095 modifiers that were specified instead of the hardcoded value
3096 (FamAndAssem). This was basically ignoring the static modifier,
3097 and others. Fixes 32429.
3099 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3100 fixed a bug in the process (32476)
3102 * expression.cs (ArrayAccess.EmitAssign): Patch from
3103 hwang_rob@yahoo.ca that fixes bug 31834.3
3105 2002-10-18 Miguel de Icaza <miguel@ximian.com>
3107 * driver.cs: Make the module extension .netmodule.
3109 2002-10-16 Miguel de Icaza <miguel@ximian.com>
3111 * driver.cs: Report an error if the resource file is not found
3112 instead of crashing.
3114 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3115 false, like Emit does.
3117 2002-10-16 Nick Drochak <ndrochak@gol.com>
3119 * typemanager.cs: Remove unused private member. Also reported mcs
3120 bug to report this as a warning like csc.
3122 2002-10-15 Martin Baulig <martin@gnome.org>
3124 * statement.cs (Statement.Emit): Made this a virtual method; emits
3125 the line number info and calls DoEmit().
3126 (Statement.DoEmit): New protected abstract method, formerly knows
3127 as Statement.Emit().
3129 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3131 2002-10-11 Miguel de Icaza <miguel@ximian.com>
3133 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3134 have fixed a remaining problem: not every AddXXXX was adding a
3135 fully qualified name.
3137 Now everyone registers a fully qualified name in the DeclSpace as
3138 being defined instead of the partial name.
3140 Downsides: we are slower than we need to be due to the excess
3141 copies and the names being registered this way.
3143 The reason for this is that we currently depend (on the corlib
3144 bootstrap for instance) that types are fully qualified, because
3145 we dump all the types in the namespace, and we should really have
3146 types inserted into the proper namespace, so we can only store the
3147 basenames in the defined_names array.
3149 2002-10-10 Martin Baulig <martin@gnome.org>
3151 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3152 from bug #31834, see the bug report for a testcase which is
3155 2002-10-10 Martin Baulig <martin@gnome.org>
3157 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3158 flow analysis code for this.
3160 * statement.cs (Do, While, For): Tell the flow analysis code about
3162 (FlowBranching.UsageVector): Added support for infinite loops.
3163 (Block.Resolve): Moved the dead code elimination here and use flow
3166 2002-10-09 Miguel de Icaza <miguel@ximian.com>
3168 * class.cs (Field.Define): Catch cycles on struct type
3171 * typemanager.cs (IsUnmanagedtype): Do not recursively check
3172 fields if the fields are static. We only need to check instance
3175 * expression.cs (As.DoResolve): Test for reference type.
3177 * statement.cs (Using.ResolveExpression): Use
3178 ConvertImplicitRequired, not ConvertImplicit which reports an
3180 (Using.ResolveLocalVariableDecls): ditto.
3182 * expression.cs (Binary.ResolveOperator): Report errors in a few
3183 places where we had to.
3185 * typemanager.cs (IsUnmanagedtype): Finish implementation.
3187 2002-10-08 Miguel de Icaza <miguel@ximian.com>
3189 * expression.cs: Use StoreFromPtr instead of extracting the type
3190 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3192 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3193 an enumeration value to a System.Enum, but System.Enum is not a
3194 value type, but an class type, so we need to box.
3196 (Expression.ConvertExplicit): One codepath could return
3197 errors but not flag them. Fix this. Fixes #31853
3199 * parameter.cs (Resolve): Do not allow void as a parameter type.
3201 2002-10-06 Martin Baulig <martin@gnome.org>
3203 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3204 if it's a class type and not a struct. Fixes #31815.
3206 2002-10-06 Martin Baulig <martin@gnome.org>
3208 * statement.cs: Reworked the flow analysis code a bit to make it
3209 usable for dead code elimination.
3211 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3213 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3215 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3217 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3218 to fix the test 165, will investigate deeper.
3220 2002-10-04 Martin Baulig <martin@gnome.org>
3222 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3223 finally blocks actually work.
3224 (Try.Resolve): We don't need to create a sibling for `finally' if
3225 there is no finally block.
3227 2002-10-04 Martin Baulig <martin@gnome.org>
3229 * class.cs (Constructor.Define): The default accessibility for a
3230 non-default constructor is private, not public.
3232 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3234 * class.cs (Constructor): Make AllowedModifiers public, add
3237 * cs-parser.jay: Perform the modifiers test here, as the
3238 constructor for the Constructor class usually receives a zero
3239 because of the way we create it (first we create, later we
3240 customize, and we were never checking the modifiers).
3242 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3243 is a version of LookupTypeReflection that includes the type-name
3244 cache. This can be used as a fast path for functions that know
3245 the fully qualified name and are only calling into *.GetType() to
3246 obtain a composed type.
3248 This is also used by TypeManager.LookupType during its type
3251 (LookupType): We now also track the real type name, as sometimes
3252 we can get a quey for the real type name from things like
3253 ComposedCast. This fixes bug 31422.
3255 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3256 complete type fullname, it does not have to go through the type
3257 resolution system to obtain the composed version of the type (for
3258 obtaining arrays or pointers).
3260 (Conditional.Emit): Use the EmitBoolExpression to
3261 generate nicer code, as requested by Paolo.
3263 (ArrayCreation.CheckIndices): Use the patch from
3264 hwang_rob@yahoo.ca to validate the array initializers.
3266 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3268 * class.cs (ConstructorInitializer.Emit): simplify code by using
3269 Invocation.EmitCall, and at the same time, fix the bugs in calling
3270 parent constructors that took variable arguments.
3272 * ecore.cs (Expression.ConvertNumericExplicit,
3273 Expression.ImplicitNumericConversion): Remove the code that
3274 manually wrapped decimal (InternalTypeConstructor call is now gone
3277 * expression.cs (Cast.TryReduce): Also handle decimal types when
3278 trying to perform a constant fold on the type.
3280 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3282 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3283 that only turned off an error report, and did nothing else.
3285 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3287 * driver.cs: Handle and ignore /fullpaths
3289 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3291 * expression.cs (Binary.ResolveOperator): Catch the case where
3292 DoNumericPromotions returns true,
3294 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3296 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3298 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3301 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3303 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3304 conversion exists, but it is also required that the conversion be
3305 performed. This manifested in "(Type64Enum) 2".
3307 * class.cs (TypeManager.AddMethod): The fix is not to change
3308 AddEnum, because that one was using a fully qualified name (every
3309 DeclSpace derivative does), but to change the AddMethod routine
3310 that was using an un-namespaced name. This now correctly reports
3311 the duplicated name.
3313 Revert patch until I can properly fix it. The issue
3314 is that we have a shared Type space across all namespaces
3315 currently, which is wrong.
3317 Options include making the Namespace a DeclSpace, and merge
3318 current_namespace/current_container in the parser.
3320 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3322 * cs-parser.jay: Improve error reporting when we get a different
3323 kind of expression in local_variable_type and
3324 local_variable_pointer_type.
3326 Propagate this to avoid missleading errors being reported.
3328 * ecore.cs (ImplicitReferenceConversion): treat
3329 TypeManager.value_type as a target just like object_type. As
3334 Is valid, and needs to result in the int 1 being boxed before it
3335 is assigned to the value type v.
3337 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3338 to validate the enumeration name.
3340 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3341 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3342 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3344 * ecore.cs (TryImplicitIntConversion): When doing an
3345 implicit-enumeration-conversion, check if the type is 64-bits and
3346 perform a conversion before passing to EnumConstant.
3348 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3350 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3351 report ambiguous type references. Unlike the MS version, we
3352 report what the ambiguity is. Innovation at work ;-)
3354 (DeclSpace.FindType): Require a location argument to
3355 display when we display an ambiguous error.
3357 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3359 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3361 * expression.cs (EmitDynamicInitializers): Apply patch from
3362 hwang_rob@yahoo.ca that fixes the order in which we emit our
3365 2002-09-21 Martin Baulig <martin@gnome.org>
3367 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3368 delegate takes no arguments.
3370 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3372 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3375 * expression.cs: Extract the underlying type.
3377 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3379 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3381 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3383 * class.cs (TypeContainer.DefineType): We can not use the nice
3384 PackingSize with the size set to 1 DefineType method, because it
3385 will not allow us to define the interfaces that the struct
3388 This completes the fixing of bug 27287
3390 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3391 means also structs. This fixes part of the problem.
3392 (Expresion.ImplicitReferenceConversionExists): ditto.
3394 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3395 error if there were no errors reported during the type lookup
3396 process, to avoid duplicates or redundant errors. Without this
3397 you would get an ambiguous errors plus a type not found. We have
3398 beaten the user enough with the first error.
3400 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3403 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3404 during the resolution process, stop the lookup, this avoids
3405 repeated error reports (same error twice).
3407 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3409 * typemanager.cs (LookupType): Redo the type lookup code to match
3410 the needs of System.Reflection.
3412 The issue is that System.Reflection requires references to nested
3413 types to begin with a "+" sign instead of a dot. So toplevel
3414 types look like: "NameSpace.TopLevelClass", and nested ones look
3415 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3418 2002-09-19 Martin Baulig <martin@gnome.org>
3420 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3421 says that a method always returns or always throws an exception,
3422 don't report the CS0161.
3424 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3425 set `Returns = new_returns'.
3427 2002-09-19 Martin Baulig <martin@gnome.org>
3429 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3430 to an enum constant, check for a CS0176.
3432 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3434 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3435 for operators that must be in pairs and report errors.
3437 * ecore.cs (SimpleName.DoResolveType): During the initial type
3438 resolution process, when we define types recursively, we must
3439 check first for types in our current scope before we perform
3440 lookups in the enclosing scopes.
3442 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3444 (Invocation.VerifyArgumentsCompat): Call
3445 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3446 I thought we were supposed to always call this, but there are a
3447 few places in the code where we dont do it.
3449 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3451 * driver.cs: Add support in -linkres and -resource to specify the
3452 name of the identifier.
3454 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3456 * ecore.cs (StandardConversionExists): Sync with the conversion
3457 code: allow anything-* to void* conversions.
3459 (FindMostSpecificSource): Use an Expression argument
3460 instead of a Type, because we might be handed over a Literal which
3461 gets a few more implicit conversions that plain types do not. So
3462 this information was being lost.
3464 Also, we drop the temporary type-holder expression when not
3467 2002-09-17 Martin Baulig <martin@gnome.org>
3469 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3470 this is an explicit interface implementation.
3472 2002-09-17 Martin Baulig <martin@gnome.org>
3474 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3475 different `IndexerName' attributes.
3477 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3478 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3479 virtual CommonResolve().
3481 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3483 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3484 and convert that to the UnderlyingType.
3486 * statement.cs (Foreach.Resolve): Indexers are just like variables
3487 or PropertyAccesses.
3489 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3490 inside quoted strings, we were not doing this before.
3492 2002-09-16 Martin Baulig <martin@gnome.org>
3494 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3495 resolve it. This is needed for the definite assignment check of the
3496 instance expression, fixes bug #29846.
3497 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3499 2002-09-16 Nick Drochak <ndrochak@gol.com>
3501 * parameter.cs: Fix compile error. Cannot reference static member
3502 from an instance object. Is this an mcs bug?
3504 2002-09-14 Martin Baulig <martin@gnome.org>
3506 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3507 multiple times. Fixes bug #30295, added test-166.cs.
3509 2002-09-14 Martin Baulig <martin@gnome.org>
3511 * statement.cs (Block.Emit): Don't emit unreachable code.
3512 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3514 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3516 2002-09-14 Martin Baulig <martin@gnome.org>
3518 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3521 2002-09-14 Martin Baulig <martin@gnome.org>
3523 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3524 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3525 be false on the ms runtime.
3527 2002-09-13 Martin Baulig <martin@gnome.org>
3529 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3530 the CS0038 error message.
3532 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3534 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3535 constant inside, return it.
3537 2002-09-12 Martin Baulig <martin@gnome.org>
3539 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3540 implicit conversion can be done between enum types.
3542 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3543 check whether an implicit conversion to the current enum's UnderlyingType
3544 exists and report an error if not.
3546 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3547 without debugging support.
3549 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3550 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3552 2002-09-12 Martin Baulig <martin@gnome.org>
3554 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3556 * ecore.cs (IMemberExpr.DeclaringType): New property.
3557 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3558 nonstatic member of an outer type (CS0038).
3560 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3562 * driver.cs: Activate the using-error detector at warning level
3563 4 (at least for MS-compatible APIs).
3565 * namespace.cs (VerifyUsing): Small buglett fix.
3567 * pending.cs (PendingImplementation): pass the container pointer.
3569 * interface.cs (GetMethods): Allow for recursive definition. Long
3570 term, I would like to move every type to support recursive
3571 definitions, not the current ordering mechanism that we have right
3574 The situation is this: Attributes are handled before interfaces,
3575 so we can apply attributes to interfaces. But some attributes
3576 implement interfaces, we will now handle the simple cases
3577 (recursive definitions will just get an error).
3579 * parameter.cs: Only invalidate types at the end if we fail to
3582 2002-09-09 Martin Baulig <martin@gnome.org>
3584 * ecore.cs (PropertyExpr.Emit): Also check for
3585 TypeManager.system_int_array_get_length so this'll also work when
3586 compiling corlib. Fixes #30003.
3588 2002-09-09 Martin Baulig <martin@gnome.org>
3590 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3591 and throw an exception if we can't get the type's size. Fixed #30040,
3594 2002-09-09 Martin Baulig <martin@gnome.org>
3596 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3598 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3599 context. Fixes bug #30027.
3601 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3602 virtual functions. Fixes bug #30043, added test-164.cs.
3604 2002-09-08 Ravi Pratap <ravi@ximian.com>
3606 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3608 2002-09-08 Nick Drochak <ndrochak@gol.com>
3610 * driver.cs: Use an object to get the windows codepage since it's not a
3613 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3615 * statement.cs (For.Emit): for infinite loops (test == null)
3616 return whether there is a break inside, not always "true".
3618 * namespace.cs (UsingEntry): New struct to hold the name of the
3619 using definition, the location where it is defined, and whether it
3620 has been used in a successful type lookup.
3622 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3627 2002-09-06 Ravi Pratap <ravi@ximian.com>
3629 * attribute.cs : Fix incorrect code which relied on catching
3630 a NullReferenceException to detect a null being passed in
3631 where an object was expected.
3633 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3635 * statement.cs (Try): flag the catch variable as assigned
3637 * expression.cs (Cast): Simplified by using ResolveType instead of
3640 * statement.cs (Catch): Fix bug by using ResolveType.
3642 2002-09-06 Ravi Pratap <ravi@ximian.com>
3644 * expression.cs (BetterConversion): Special case for when we have
3645 a NullLiteral as the argument and we have to choose between string
3646 and object types - we choose string the way csc does.
3648 * attribute.cs (Attribute.Resolve): Catch the
3649 NullReferenceException and report error #182 since the Mono
3650 runtime no more has the bug and having this exception raised means
3651 we tried to select a constructor which takes an object and is
3654 2002-09-05 Ravi Pratap <ravi@ximian.com>
3656 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3657 message (1502, 1503) when we can't locate a method after overload
3658 resolution. This is much more informative and closes the bug
3661 * interface.cs (PopulateMethod): Return if there are no argument
3662 types. Fixes a NullReferenceException bug.
3664 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3665 expressions too. Previously we were checking only in one place for
3666 positional arguments leaving out named arguments.
3668 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3669 type to the enum type is not allowed. Remove code corresponding to
3672 (ConvertNumericExplicit): Allow explicit conversions from
3673 the underlying type to enum type. This precisely follows the spec
3674 and closes a bug filed by Gonzalo.
3676 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3679 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3681 2002-09-03 Miguel de Icaza <miguel@ximian.com>
3683 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3684 it was important that we stored the right value after the
3685 reduction in `converted'.
3687 2002-09-04 Martin Baulig <martin@gnome.org>
3689 * location.cs (Location.SymbolDocument): Use full pathnames for the
3692 2002-08-30 Miguel de Icaza <miguel@ximian.com>
3694 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3695 of the expression resolve mechanism, because that will catch the
3696 SimpleName error failures.
3698 (Conditional): If we can not resolve the
3699 expression, return, do not crash.
3701 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3704 (location): display token name instead of its number.
3706 2002-08-28 Martin Baulig <martin@gnome.org>
3708 * expression.cs (Binary.ResolveOperator): Don't silently return
3709 but return an error if an operator cannot be applied between two
3712 2002-08-28 Martin Baulig <martin@gnome.org>
3714 * class.cs (Constructor.Define): Set the permission attributes
3715 correctly instead of making all constructors public.
3717 2002-08-28 Martin Baulig <martin@gnome.org>
3719 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3720 for private members before reporting a CS0103; if we find anything,
3723 2002-08-28 Martin Baulig <martin@gnome.org>
3725 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3726 to check whether `closure_start_type == closure_invocation_type',
3727 we also need to check whether `m.DeclaringType == closure_invocation_type'
3728 before bypassing the permission checks. We might be accessing
3729 protected/private members from the base class.
3730 (TypeManager.RealMemberLookup): Only set private_ok if private
3731 members were requested via BindingFlags.NonPublic.
3733 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3735 * expression.cs (MemberAccess.ResolveMemberAccess): Set
3736 MethodGroupExpr.IsExplicitImpl if appropriate.
3737 (Invocation.DoResolve): Don't report the CS0120 for explicit
3738 interface implementations.
3740 2002-08-27 Martin Baulig <martin@gnome.org>
3742 * expression.cs (Invocation.DoResolve): If this is a static
3743 method and we don't have an InstanceExpression, we must report
3746 2002-08-25 Martin Baulig <martin@gnome.org>
3748 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3749 `==' between a valuetype and an object.
3751 2002-08-25 Miguel de Icaza <miguel@ximian.com>
3753 * ecore.cs (TypeExpr): Provide a ToString method.
3755 2002-08-24 Martin Baulig <martin@gnome.org>
3757 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3758 now called proggie.dbg and it's a binary file.
3760 2002-08-23 Martin Baulig <martin@gnome.org>
3762 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3764 2002-08-23 Martin Baulig <martin@gnome.org>
3766 * struct.cs (MyStructInfo.ctor): Make this work with empty
3767 structs; it's not allowed to use foreach() on null.
3769 2002-08-23 Martin Baulig <martin@gnome.org>
3771 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3772 writer the full pathname of the generated assembly.
3774 2002-08-23 Martin Baulig <martin@gnome.org>
3776 * statements.cs (FlowBranching.UsageVector.MergeChildren):
3777 A `finally' block never returns or breaks; improved handling of
3780 2002-08-23 Martin Baulig <martin@gnome.org>
3782 * statement.cs (Throw.Resolve): Allow `throw null'.
3784 2002-08-23 Martin Baulig <martin@gnome.org>
3786 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3787 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3788 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
3789 MemberLookup would return a wrong event if this is an explicit
3790 interface implementation and the class has an event with the same
3793 2002-08-23 Martin Baulig <martin@gnome.org>
3795 * statement.cs (Block.AddChildVariableNames): New public method.
3796 (Block.AddChildVariableName): Likewise.
3797 (Block.IsVariableNameUsedInChildBlock): Likewise.
3798 (Block.AddVariable): Check whether a variable name has already
3799 been used in a child block.
3801 * cs-parser.jay (declare_local_variables): Mark all variable names
3802 from the current block as being used in a child block in the
3805 2002-08-23 Martin Baulig <martin@gnome.org>
3807 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3808 find the symbol writer.
3810 * driver.cs: csc also allows the arguments to /define being
3811 separated by commas, not only by semicolons.
3813 2002-08-23 Martin Baulig <martin@gnome.org>
3815 * interface.cs (Interface.GetMembers): Added static check for events.
3817 2002-08-15 Martin Baulig <martin@gnome.org>
3819 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3820 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3822 * ecore.cs (Expression.MemberLookup): Added documentation and explained
3823 why the MethodData.EmitDestructor() change was necessary.
3825 2002-08-20 Martin Baulig <martin@gnome.org>
3827 * class.cs (TypeContainer.FindMembers): Added static check for events.
3829 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3831 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3832 use Type.GetEvents(), not Type.FindMembers().
3834 2002-08-20 Martin Baulig <martin@gnome.org>
3836 * decl.cs (MemberCache): Added a special method cache which will
3837 be used for method-only searched. This ensures that a method
3838 search will return a MethodInfo with the correct ReflectedType for
3841 2002-08-20 Martin Baulig <martin@gnome.org>
3843 * decl.cs (DeclSpace.FindMembers): Made this public.
3845 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3847 * delegate.cs: fixed build on windows.
3848 [FIXME: Filed as bug #29150: MCS must report these errors.]
3850 2002-08-19 Ravi Pratap <ravi@ximian.com>
3852 * ecore.cs (StandardConversionExists): Return a false
3853 if we are trying to convert the void type to anything else
3854 since that is not allowed.
3856 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3857 we flag error 70 in the event an event is trying to be accessed
3858 directly from outside the declaring type.
3860 2002-08-20 Martin Baulig <martin@gnome.org>
3862 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3863 MemberCache from typemanager.cs to decl.cs.
3865 2002-08-19 Martin Baulig <martin@gnome.org>
3867 * class.cs (TypeContainer): Implement IMemberContainer.
3868 (TypeContainer.DefineMembers): Create the MemberCache.
3869 (TypeContainer.FindMembers): Do better BindingFlags checking; only
3870 return public members if BindingFlags.Public was given, check
3871 whether members are static.
3873 2002-08-16 Martin Baulig <martin@gnome.org>
3875 * decl.cs (DeclSpace.Define): Splitted this in Define and
3876 DefineMembers. DefineMembers is called first and initializes the
3879 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
3880 DefineMembers() on all our DeclSpaces.
3882 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3883 but call DefineMembers() on all nested interfaces. We call their
3884 Define() in our new Define() function.
3886 * interface.cs (Interface): Implement IMemberContainer.
3887 (Interface.Define): Moved all code except the attribute stuf to
3889 (Interface.DefineMembers): Initialize the member cache.
3891 * typemanager.cs (IMemberFinder): Removed this interface, we don't
3892 need this anymore since we can use MemberCache.FindMembers directly.
3894 2002-08-19 Martin Baulig <martin@gnome.org>
3896 * typemanager.cs (MemberCache): When creating the cache for an
3897 interface type, add all inherited members.
3898 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
3899 to `out bool used_cache' and documented it.
3900 (TypeManager.MemberLookup): If we already used the cache in the first
3901 iteration, we don't need to do the interfaces check.
3903 2002-08-19 Martin Baulig <martin@gnome.org>
3905 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
3906 here from IMemberFinder and don't implement this interface anymore.
3907 (DeclSpace.MemberCache): Moved here from IMemberFinder.
3909 * typemanager.cs (IMemberFinder): This interface is now only used by
3910 classes which actually support the member cache.
3911 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
3912 since we only put DeclSpaces into this Hashtable.
3913 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
3914 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
3916 2002-08-16 Martin Baulig <martin@gnome.org>
3918 * typemanager.cs (ICachingMemberFinder): Removed.
3919 (IMemberFinder.MemberCache): New property.
3920 (TypeManager.FindMembers): Merged this with RealFindMembers().
3921 This function will never be called from TypeManager.MemberLookup()
3922 so we can't use the cache here, just the IMemberFinder.
3923 (TypeManager.MemberLookup_FindMembers): Check whether the
3924 IMemberFinder has a MemberCache and call the cache's FindMembers
3926 (MemberCache): Rewrote larger parts of this yet another time and
3927 cleaned it up a bit.
3929 2002-08-15 Miguel de Icaza <miguel@ximian.com>
3931 * driver.cs (LoadArgs): Support quoting.
3933 (Usage): Show the CSC-like command line arguments.
3935 Improved a few error messages.
3937 2002-08-15 Martin Baulig <martin@gnome.org>
3939 * typemanager.cs (IMemberContainer.Type): New property.
3940 (IMemberContainer.IsInterface): New property.
3942 The following changes are conditional to BROKEN_RUNTIME, which is
3943 defined at the top of the file.
3945 * typemanager.cs (MemberCache.MemberCache): Don't add the base
3946 class'es members, but add all members from TypeHandle.ObjectType
3947 if we're an interface.
3948 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
3949 is the current type.
3950 (MemberCache.CacheEntry.Container): Removed this field.
3951 (TypeHandle.GetMembers): Include inherited members.
3953 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3955 * typemanager.cs: fixed compilation and added a comment on a field that
3958 2002-08-15 Martin Baulig <martin@gnome.org>
3960 * class.cs (ConstructorInitializer.Resolve): In the
3961 Expression.MemberLookup call, use the queried_type as
3964 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
3965 declared' attribute, it's always true.
3966 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3967 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3968 temporary wrapper for FindMembers which tells MemberLookup whether
3969 members from the base classes are included in the return value.
3970 This will go away soon.
3971 (TypeManager.MemberLookup): Use this temporary hack here; once the
3972 new MemberCache is completed, we don't need to do the DeclaredOnly
3973 looping here anymore since the MemberCache will take care of this.
3974 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3975 (MemberCache): When creating the MemberCache for a class, get
3976 members from the current class and all its base classes.
3977 (MemberCache.CacheEntry.Container): New field. This is a
3978 temporary hack until the Mono runtime is fixed to distinguish
3979 between ReflectedType and DeclaringType. It allows us to use MCS
3980 with both the MS runtime and the unfixed Mono runtime without
3981 problems and without accecting performance.
3982 (MemberCache.SearchMembers): The DeclaredOnly looping from
3983 TypeManager.MemberLookup is now done here.
3985 2002-08-14 Martin Baulig <martin@gnome.org>
3987 * statement.cs (MyStructInfo.MyStructInfo): Don't call
3988 Type.GetFields on dynamic types but get the fields from the
3989 corresponding TypeContainer.
3990 (MyStructInfo.GetStructInfo): Added check for enum types.
3992 * typemanager.cs (MemberList.IsSynchronized): Implemented.
3993 (MemberList.SyncRoot): Implemented.
3994 (TypeManager.FilterWithClosure): No need to check permissions if
3995 closure_start_type == closure_invocation_type, don't crash if
3996 closure_invocation_type is null.
3998 2002-08-13 Martin Baulig <martin@gnome.org>
4000 Rewrote TypeContainer.FindMembers to use a member cache. This
4001 gives us a speed increase of about 35% for the self-hosting MCS
4002 build and of about 15-20% for the class libs (both on GNU/Linux).
4004 * report.cs (Timer): New class to get enhanced profiling. This
4005 whole class is "TIMER" conditional since it remarkably slows down
4008 * class.cs (MemberList): New class. This is an IList wrapper
4009 which we're now using instead of passing MemberInfo[]'s around to
4010 avoid copying this array unnecessarily.
4011 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4012 (ICachingMemberFinder, IMemberContainer): New interface.
4013 (TypeManager.FilterWithClosure): If `criteria' is null, the name
4014 has already been checked, otherwise use it for the name comparision.
4015 (TypeManager.FindMembers): Renamed to RealMemberFinder and
4016 provided wrapper which tries to use ICachingMemberFinder.FindMembers
4017 if possible. Returns a MemberList, not a MemberInfo [].
4018 (TypeHandle): New class, implements IMemberContainer. We create
4019 one instance of this class per type, it contains a MemberCache
4020 which is used to do the member lookups.
4021 (MemberCache): New class. Each instance of this class contains
4022 all members of a type and a name-based hash table.
4023 (MemberCache.FindMembers): This is our new member lookup
4024 function. First, it looks up all members of the requested name in
4025 the hash table. Then, it walks this list and sorts out all
4026 applicable members and returns them.
4028 2002-08-13 Martin Baulig <martin@gnome.org>
4030 In addition to a nice code cleanup, this gives us a performance
4031 increase of about 1.4% on GNU/Linux - not much, but it's already
4032 half a second for the self-hosting MCS compilation.
4034 * typemanager.cs (IMemberFinder): New interface. It is used by
4035 TypeManager.FindMembers to call FindMembers on a TypeContainer,
4036 Enum, Delegate or Interface.
4037 (TypeManager.finder_to_member_finder): New PtrHashtable.
4038 (TypeManager.finder_to_container): Removed.
4039 (TypeManager.finder_to_delegate): Removed.
4040 (TypeManager.finder_to_interface): Removed.
4041 (TypeManager.finder_to_enum): Removed.
4043 * interface.cs (Interface): Implement IMemberFinder.
4045 * delegate.cs (Delegate): Implement IMemberFinder.
4047 * enum.cs (Enum): Implement IMemberFinder.
4049 * class.cs (TypeContainer): Implement IMemberFinder.
4051 2002-08-12 Martin Baulig <martin@gnome.org>
4053 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4055 2002-08-12 Martin Baulig <martin@gnome.org>
4057 * ecore.cs (ITypeExpression): New interface for expressions which
4059 (TypeExpression): Renamed to TypeLookupExpression.
4060 (Expression.DoResolve): If we're doing a types-only lookup, the
4061 expression must implement the ITypeExpression interface and we
4062 call DoResolveType() on it.
4063 (SimpleName): Implement the new ITypeExpression interface.
4064 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4065 hack, the situation that we're only looking up types can't happen
4066 anymore when this method is called. Moved the type lookup code to
4067 DoResolveType() and call it.
4068 (SimpleName.DoResolveType): This ITypeExpression interface method
4069 is now doing the types-only lookup.
4070 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4071 (ResolveFlags): Added MaskExprClass.
4073 * expression.cs (MemberAccess): Implement the ITypeExpression
4075 (MemberAccess.DoResolve): Added support for a types-only lookup
4076 when we're called via ITypeExpression.DoResolveType().
4077 (ComposedCast): Implement the ITypeExpression interface.
4079 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
4080 Expression.Resolve() with ResolveFlags.Type instead.
4082 2002-08-12 Martin Baulig <martin@gnome.org>
4084 * interface.cs (Interface.Define): Apply attributes.
4086 * attribute.cs (Attribute.ApplyAttributes): Added support for
4087 interface attributes.
4089 2002-08-11 Martin Baulig <martin@gnome.org>
4091 * statement.cs (Block.Emit): Only check the "this" variable if we
4092 do not always throw an exception.
4094 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4095 whether the property has a set accessor.
4097 2002-08-11 Martin Baulig <martin@gnome.org>
4099 Added control flow analysis support for structs.
4101 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4102 with control flow analysis turned off.
4103 (IVariable): New interface.
4104 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4105 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4106 (FieldExpr.DoResolve): Resolve the instance expression with flow
4107 analysis turned off and do the definite assignment check after the
4108 resolving when we know what the expression will resolve to.
4110 * expression.cs (LocalVariableReference, ParameterReference):
4111 Implement the new IVariable interface, only call the flow analysis
4112 code if ec.DoFlowAnalysis is true.
4113 (This): Added constructor which takes a Block argument. Implement
4114 the new IVariable interface.
4115 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4116 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4117 This does the definite assignment checks for struct members.
4119 * class.cs (Constructor.Emit): If this is a non-static `struct'
4120 constructor which doesn't have any initializer, call
4121 Block.AddThisVariable() to tell the flow analysis code that all
4122 struct elements must be initialized before control returns from
4125 * statement.cs (MyStructInfo): New public class.
4126 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4127 argument to this indexer. If non-zero, check an individual struct
4128 member, not the whole struct.
4129 (FlowBranching.CheckOutParameters): Check struct members.
4130 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4131 overloaded versions of these methods which take an additional
4132 `int field_idx' argument to check struct members.
4133 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4134 overloaded versions of these methods which take an additional
4135 `string field_name' argument to check struct member.s
4136 (VariableInfo): Implement the IVariable interface.
4137 (VariableInfo.StructInfo): New public property. Returns the
4138 MyStructInfo instance of the variable if it's a struct or null.
4139 (Block.AddThisVariable): New public method. This is called from
4140 Constructor.Emit() for non-static `struct' constructor which do
4141 not have any initializer. It creates a special variable for the
4142 "this" instance variable which will be checked by the flow
4143 analysis code to ensure that all of the struct's fields are
4144 initialized before control returns from the constructor.
4145 (UsageVector): Added support for struct members. If a
4146 variable/parameter is a struct with N members, we reserve a slot
4147 in the usage vector for each member. A struct is considered fully
4148 initialized if either the struct itself (slot 0) or all its
4149 members are initialized.
4151 2002-08-08 Martin Baulig <martin@gnome.org>
4153 * driver.cs (Driver.MainDriver): Only report an error CS5001
4154 if there were no compilation errors.
4156 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4157 `UnsafeContext' property to determine whether the parent is in
4158 unsafe context rather than checking the parent's ModFlags:
4159 classes nested in an unsafe class are unsafe as well.
4161 2002-08-08 Martin Baulig <martin@gnome.org>
4163 * statement.cs (UsageVector.MergeChildren): Distinguish between
4164 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4165 we return. Added test17() and test18() to test-154.cs.
4167 2002-08-08 Martin Baulig <martin@gnome.org>
4169 * typemanager.cs (TypeManager.FilterWithClosure): If we have
4170 Family access, make sure the invoking type isn't a subclass of the
4171 queried type (that'd be a CS1540).
4173 * ecore.cs (Expression.MemberLookup): Added overloaded version of
4174 this method which takes an additional `Type invocation_type'.
4176 * expression.cs (BaseAccess.DoResolve): Use the base type as
4177 invocation and query type.
4178 (MemberAccess.DoResolve): If the lookup failed and we're about to
4179 report a CS0122, try a lookup with the ec.ContainerType - if this
4180 succeeds, we must report a CS1540.
4182 2002-08-08 Martin Baulig <martin@gnome.org>
4184 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4185 (MethodGroupExpr): Implement the IMemberExpr interface.
4187 * expression (MemberAccess.ResolveMemberAccess): No need to have
4188 any special code for MethodGroupExprs anymore, they're now
4191 2002-08-08 Martin Baulig <martin@gnome.org>
4193 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4194 Family, FamANDAssem and FamORAssem permissions.
4195 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4197 2002-08-08 Martin Baulig <martin@gnome.org>
4199 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4200 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4203 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4205 * driver.cs: implemented /resource option to embed managed resources.
4207 2002-08-07 Martin Baulig <martin@gnome.org>
4209 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4210 (FieldBase.HasFieldInitializer): New public property.
4211 (FieldBase.GetInitializerExpression): New public method. Resolves and
4212 returns the field initializer and makes sure it is only resolved once.
4213 (TypeContainer.EmitFieldInitializers): Call
4214 FieldBase.GetInitializerExpression to get the initializer, this ensures
4215 that it isn't resolved multiple times.
4217 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4218 the resolving process (SimpleName/MemberLookup) that we're currently
4219 emitting a field initializer (which must not access any instance members,
4220 this is an error CS0236).
4222 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4223 argument, if the `IsFieldInitializer' flag is set, we must report and
4224 error CS0236 and not an error CS0120.
4226 2002-08-07 Martin Baulig <martin@gnome.org>
4228 * ecore.cs (IMemberExpr): New public interface.
4229 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4230 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4231 if the expression is an IMemberExpr.
4233 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4234 to be null, implicitly default to `this' if we're non-static in
4235 this case. Simplified the code a lot by using the new IMemberExpr
4236 interface. Also fixed bug #28176 here.
4238 2002-08-06 Martin Baulig <martin@gnome.org>
4240 * cs-parser.jay (SimpleLookup): Removed. We need to create
4241 ParameterReferences during semantic analysis so that we can do a
4242 type-only search when resolving Cast, TypeOf and SizeOf.
4243 (block): Pass the `current_local_parameters' to the Block's
4246 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4247 argument to the constructor.
4248 (ConstructorInitializer.Resolve): Create a temporary implicit
4249 block with the parameters.
4251 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4252 references here if we aren't doing a type-only search.
4254 * statement.cs (Block): Added constructor which takes a
4255 `Parameters parameters' argument.
4256 (Block.Parameters): New public property.
4258 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4259 to `Parameters' and made it public readonly.
4261 2002-08-06 Martin Baulig <martin@gnome.org>
4263 * ecore.cs (Expression.Warning): Made this public as well.
4265 * report.cs (Report.Debug): Print the contents of collections.
4267 2002-08-06 Martin Baulig <martin@gnome.org>
4269 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4270 used to tell Resolve() which kinds of expressions it may return.
4271 (Expression.Resolve): Added overloaded version of this method which
4272 takes a `ResolveFlags flags' argument. This can be used to tell
4273 Resolve() which kinds of expressions it may return. Reports a
4275 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4276 ResolveFlags.SimpleName.
4277 (Expression.Error118): Added overloaded version of this method which
4278 takes a `ResolveFlags flags' argument. It uses the flags to determine
4279 which kinds of expressions are allowed.
4281 * expression.cs (Argument.ResolveMethodGroup): New public method.
4282 Resolves an argument, but allows a MethodGroup to be returned.
4283 This is used when invoking a delegate.
4285 * TODO: Updated a bit.
4287 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4289 Fixed compilation with csc.
4291 * ecore.cs: Expression.Error made public. Is this correct? Should
4292 Warning be made public too?
4294 * expression.cs: use ea.Location instead of ea.loc.
4295 [FIXME: Filed as bug #28607: MCS must report these errors.]
4297 2002-08-06 Martin Baulig <martin@gnome.org>
4299 * ecore.cs (Expression.loc): Moved the location here instead of
4300 duplicating it in all derived classes.
4301 (Expression.Location): New public property.
4302 (Expression.Error, Expression.Warning): Made them non-static and
4303 removed the location argument.
4304 (Expression.Warning): Added overloaded version which takes an
4305 `int level' argument.
4306 (Expression.Error118): Make this non-static and removed the
4307 expression and location arguments.
4308 (TypeExpr): Added location argument to the constructor.
4310 * expression.cs (StaticCallExpr): Added location argument to
4312 (Indirection, PointerArithmetic): Likewise.
4313 (CheckedExpr, UnCheckedExpr): Likewise.
4314 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4315 (StringPtr): Likewise.
4318 2002-08-05 Martin Baulig <martin@gnome.org>
4320 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4322 * assign.cs (Assign.DoResolve): Check whether the source
4323 expression is a value or variable.
4325 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4326 while resolving the corresponding blocks.
4328 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4329 an error, don't silently return null.
4331 * statement.cs (Block.AddVariable): Do the error reporting here
4332 and distinguish between CS0128 and CS0136.
4333 (Block.DoResolve): Report all unused labels (warning CS0164).
4334 (LabeledStatement): Pass the location to the constructor.
4335 (LabeledStatement.HasBeenReferenced): New property.
4336 (LabeledStatement.Resolve): Set it to true here.
4338 * statement.cs (Return.Emit): Return success even after reporting
4339 a type mismatch error (CS0126 or CS0127), this is what csc does and
4340 it avoids confusing the users with any consecutive errors.
4342 2002-08-05 Martin Baulig <martin@gnome.org>
4344 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4346 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4348 * expression.cs (MemberAccess.DoResolve): Silently return if an
4349 error has already been reported.
4351 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4352 error has already been reported.
4354 2002-08-05 Martin Baulig <martin@gnome.org>
4356 * statement.cs (UsageVector): Only initialize the `parameters'
4357 vector if we actually have any "out" parameters.
4359 2002-08-05 Martin Baulig <martin@gnome.org>
4361 * expression.cs (Binary.ResolveOperator): When combining delegates,
4362 they must have the same type.
4364 2002-08-05 Martin Baulig <martin@gnome.org>
4366 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4367 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4368 work with the ms runtime and we also don't need it: if we're a
4369 PropertyBuilder and not in the `indexer_arguments' hash, then we
4370 are a property and not an indexer.
4372 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4373 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4374 since the latter one doesn't work with the ms runtime.
4376 2002-08-03 Martin Baulig <martin@gnome.org>
4378 Fixed bugs #27998 and #22735.
4380 * class.cs (Method.IsOperator): New public field.
4381 (Method.CheckBase): Report CS0111 if there's already a method
4382 with the same parameters in the current class. Report CS0508 when
4383 attempting to change the return type of an inherited method.
4384 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4385 and it's not marked abstract or extern.
4386 (PropertyBase): New abstract base class for Property and Indexer.
4387 (PropertyBase.CheckBase): Moved here from Property and made it work
4389 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4390 the same so we can reuse it there.
4391 (Property, Indexer): Derive from PropertyBase.
4392 (MethodSignature.inheritable_property_signature_filter): New delegate
4393 to find properties and indexers.
4395 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4396 argument and improved error reporting.
4398 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4399 EmptyReadOnlyParameters and made it a property.
4401 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4402 version of this method which takes a `PropertyInfo indexer'.
4403 (TypeManager.RegisterIndexer): New method.
4405 * class.cs: Added myself as author of this file :-)
4407 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4409 * class.cs: fixed compilation on windoze.
4411 2002-08-03 Martin Baulig <martin@gnome.org>
4413 * interface.cs (Interface.GetInterfaceBases): Check whether all
4414 base interfaces are at least as accessible than the current one.
4416 * class.cs (TypeContainer.GetClassBases): Check whether base types
4417 are at least as accessible than the current type.
4418 (TypeContainer.AsAccessible): Implemented and made non-static.
4419 (MemberBase.CheckParameters): Report errors if the accessibility
4422 * delegate.cs (Delegate.Delegate): The default visibility is
4423 internal for top-level types and private for nested types.
4424 (Delegate.Define): Report errors if the accessibility checks fail.
4426 * enum.cs (Enum.Enum): The default visibility is internal for
4427 top-level types and private for nested types.
4428 (Enum.DefineType): Compute the correct visibility.
4430 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4431 function which takes a `bool is_toplevel' instead of a TypeContainer.
4433 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4436 2002-08-02 Martin Baulig <martin@gnome.org>
4438 * expression.cs (LocalVariableReferenc): Added constructor which
4439 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4440 (LocalVariableReference.IsReadOnly): New property.
4441 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4442 variable is readonly, use our own readonly flag to do this; you can
4443 use the new constructor to get a writable reference to a read-only
4446 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4447 reference to the local variable.
4449 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4451 * rootcontext.cs (ResolveCore): Also include System.Exception
4453 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4454 we reach an EmptyStatement.
4456 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4459 * expression.cs (Binary.ResolveOperator): Check error result in
4462 use brtrue/brfalse directly and avoid compares to null.
4464 2002-08-02 Martin Baulig <martin@gnome.org>
4466 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4467 Fixes bug #28407, added test-155.cs.
4469 2002-08-01 Martin Baulig <martin@gnome.org>
4471 * class.cs (Event.EmitDefaultMethod): Make this work with static
4472 events. Fixes #28311, added verify-3.cs.
4474 2002-08-01 Martin Baulig <martin@gnome.org>
4476 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4477 `is_disposable' fields.
4478 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4479 `hm.is_disposable' if we're using the collection pattern.
4480 (Foreach.EmitCollectionForeach): Use the correct type for the
4481 enumerator's local variable, only emit the try/finally block if
4482 necessary (fixes #27713).
4484 2002-08-01 Martin Baulig <martin@gnome.org>
4486 * ecore.cs (Expression.report118): Renamed to Error118 and made
4489 * statement.cs (Throw.Resolve): Check whether the expression is of
4490 the correct type (CS0118) and whether the type derives from
4491 System.Exception (CS0155).
4492 (Catch.Resolve): New method. Do the type lookup here and check
4493 whether it derives from System.Exception (CS0155).
4494 (Catch.CatchType, Catch.IsGeneral): New public properties.
4496 * typemanager.cs (TypeManager.exception_type): Added.
4498 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4500 * driver.cs: Updated About function.
4502 2002-07-31 Martin Baulig <martin@gnome.org>
4504 Implemented Control Flow Analysis.
4506 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4507 (EmitContext.CurrentBranching): Added.
4508 (EmitContext.StartFlowBranching): Added.
4509 (EmitContext.EndFlowBranching): Added.
4510 (EmitContext.KillFlowBranching): Added.
4511 (EmitContext.IsVariableAssigned): Added.
4512 (EmitContext.SetVariableAssigned): Added.
4513 (EmitContext.IsParameterAssigned): Added.
4514 (EmitContext.SetParameterAssigned): Added.
4515 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4516 Added control flow analysis stuff here.
4518 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4519 resolve the expression as lvalue.
4520 (LocalVariableReference.DoResolve): Check whether the variable has
4521 already been assigned.
4522 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4523 the parameter as assigned here.
4524 (ParameterReference.DoResolve): Check whether the parameter has already
4526 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4527 expression as lvalue.
4529 * statement.cs (FlowBranching): New class for the flow analysis code.
4530 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4531 (LabeledStatement.IsDefined): New public property.
4532 (LabeledStatement.AddUsageVector): New public method to tell flow
4533 analyis that the label may be reached via a forward jump.
4534 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4536 (VariableInfo.Number): New public field. This is used by flow analysis
4537 to number all locals of a block.
4538 (Block.CountVariables): New public property. This is the number of
4539 local variables in this block (including the locals from all parent
4541 (Block.EmitMeta): Number all the variables.
4543 * statement.cs: Added flow analysis support to all classes.
4545 2002-07-31 Martin Baulig <martin@gnome.org>
4547 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4548 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4549 then use this argument.
4551 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4553 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4554 use this to specify /define options.
4556 2002-07-29 Martin Baulig <martin@gnome.org>
4558 * statement.cs (Fixed): Moved all code that does variable lookups
4559 and resolvings from Emit to Resolve.
4561 * statement.cs (For): Moved all code that does variable lookups
4562 and resolvings from Emit to Resolve.
4564 * statement.cs (Using): Moved all code that does variable lookups
4565 and resolvings from Emit to Resolve.
4567 2002-07-29 Martin Baulig <martin@gnome.org>
4569 * attribute.cs (Attribute.Resolve): Explicitly catch a
4570 System.NullReferenceException when creating the
4571 CustromAttributeBuilder and report a different warning message.
4573 2002-07-29 Martin Baulig <martin@gnome.org>
4575 * support.cs (ParameterData.ParameterName): Added method to
4576 get the name of a parameter.
4578 * typemanager.cs (TypeManager.IsValueType): New public method.
4580 2002-07-29 Martin Baulig <martin@gnome.org>
4582 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4583 is a flag which specifies that it's either ref or out.
4584 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4585 the out parameter to `out Parameter.Modifier mod', also set the
4586 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4588 * support.cs (InternalParameters.ParameterModifier): Distinguish
4589 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4590 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4592 * expression.cs (Argument.GetParameterModifier): Distinguish
4593 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4594 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4596 2002-07-29 Martin Baulig <martin@gnome.org>
4598 * expression.cs (ParameterReference.ParameterReference): Added
4599 `Location loc' argument to the constructor.
4601 * cs-parser.jay: Pass location to ParameterReference.
4603 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4605 * statement.cs (Try): Initialize the location.
4607 * cs-parser.jay: pass location to Try.
4609 * expression.cs (Unary.Reduce): Change the prototype to return
4610 whether a constant fold could be performed or not. The result is
4611 returned in an out parameters. In the case of Indirection and
4612 AddressOf, we want to perform the full tests.
4614 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4616 * statement.cs (Statement.Emit): Flag dead code.
4618 2002-07-27 Andrew Birkett <andy@nobugs.org>
4620 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4622 2002-07-27 Martin Baulig <martin@gnome.org>
4624 * class.cs (MethodData.Define): Put back call to
4625 TypeManager.AddMethod(), accidentally commented this out.
4627 * report.cs (Debug): New public method to print debugging information,
4628 this is `[Conditional ("DEBUG")]'.
4630 2002-07-26 Martin Baulig <martin@gnome.org>
4632 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4633 (switch_statement): Push the current_block to the switch_stack and
4634 pop it again when we're done with the switch.
4635 (switch_section): The new block is a child of the current_block.
4636 Fixes bug #24007, added test-152.cs.
4638 2002-07-27 Martin Baulig <martin@gnome.org>
4640 * expression.cs (Invocation.EmitArguments): When calling a varargs
4641 function with only its fixed arguments, we need to pass an empty
4644 2002-07-27 Martin Baulig <martin@gnome.org>
4646 Mono 0.13 has been released.
4648 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4650 * driver.cs: Rename --resource to --linkres, because that is what
4651 we do currently, we dont support --resource yet.
4653 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4655 2002-07-25 Martin Baulig <martin@gnome.org>
4657 * class.cs (MethodData): New public class. This is a `method builder'
4658 class for a method or one accessor of a Property/Indexer/Event.
4659 (MethodData.GetMethodFlags): Moved here from MemberBase.
4660 (MethodData.ApplyAttributes): Likewise.
4661 (MethodData.ApplyObsoleteAttribute): Likewise.
4662 (MethodData.ApplyConditionalAttribute): Likewise.
4663 (MethodData.ApplyDllImportAttribute): Likewise.
4664 (MethodData.CheckAbstractAndExternal): Likewise.
4665 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4666 (MethodData.Emit): Formerly known as Method.Emit().
4667 (MemberBase): Moved everything which was specific to a single
4668 accessor/method to MethodData.
4669 (Method): Create a new MethodData and call Define() and Emit() on it.
4670 (Property, Indexer, Event): Create a new MethodData objects for each
4671 accessor and call Define() and Emit() on them.
4673 2002-07-25 Martin Baulig <martin@gnome.org>
4675 Made MethodCore derive from MemberBase to reuse the code from there.
4676 MemberBase now also checks for attributes.
4678 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4679 (MemberBase.GetMethodFlags): Moved here from class Method and marked
4681 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4682 `CallingConventions cc' and `Attributes opt_attrs' arguments.
4683 (MemberBase.ApplyAttributes): New virtual method; applies the
4684 attributes to a method or accessor.
4685 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4686 (MemberBase.ApplyConditionalAttribute): Likewise.
4687 (MemberBase.ApplyDllImportAttribute): Likewise.
4688 (MemberBase.CheckAbstractAndExternal): Likewise.
4689 (MethodCore.ParameterTypes): This is now a property instead of a
4690 method, it's initialized from DoDefineParameters().
4691 (MethodCore.ParameterInfo): Removed the set accessor.
4692 (MethodCore.DoDefineParameters): New protected virtual method to
4693 initialize ParameterTypes and ParameterInfo.
4694 (Method.GetReturnType): We can now simply return the MemberType.
4695 (Method.GetMethodFlags): Override the MemberBase version and add
4696 the conditional flags.
4697 (Method.CheckBase): Moved some code from Define() here, call
4698 DoDefineParameters() here.
4699 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4700 here to avoid some larger code duplication.
4701 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4702 ensure that abstract and external accessors don't declare a body.
4704 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4705 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4706 lookup in the attribute's parent classes, so we need to abort as soon
4707 as we found the first match.
4708 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4709 the attribute has no arguments.
4711 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4714 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4716 * cs-parser.jay: reverted previous patch.
4718 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4720 * cs-parser.jay: fixed bug #22119.
4722 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4724 * attribute.cs: fixed compilation. The error was:
4725 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
4726 be assigned to before control leaves the current method."
4727 [FIXME: Filed as bug #28186: MCS must report this error.]
4729 2002-07-25 Martin Baulig <martin@gnome.org>
4731 * attribute.cs (Attribute.Conditional_GetConditionName): New static
4732 method to pull the condition name ouf of a Conditional attribute.
4733 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4734 the obsolete message and error flag out of an Obsolete attribute.
4736 * class.cs (Method.GetMethodFlags): New public method to get the
4737 TypeManager.MethodFlags for this method.
4738 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4740 (Method.Define): Get and apply the Obsolete and Conditional attributes;
4741 if we're overriding a virtual function, set the new private variable
4742 `parent_method'; call the new TypeManager.AddMethod().
4744 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
4745 the MethodBuilder and the Method in a PtrHashtable.
4746 (TypeManager.builder_to_method): Added for this purpose.
4747 (TypeManager.MethodFlags): Added IsObsoleteError.
4748 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
4749 Obsolete and Conditional arguments in MethodBuilders. If we discover
4750 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4751 the message from the attribute.
4753 2002-07-24 Martin Baulig <martin@gnome.org>
4755 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4756 preprocessor directives, ensure that the argument to #define/#undef is
4757 exactly one identifier and that it's actually an identifier.
4759 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4762 2002-07-24 Martin Baulig <martin@gnome.org>
4764 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4765 initialize it to TypeManager.object_type in the constructor.
4766 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4767 of the `hm.get_current' method if we're using the collection pattern.
4768 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4769 for the explicit conversion to make it work when we're using the collection
4770 pattern and the `Current' property has a different return type than `object'.
4773 2002-07-24 Martin Baulig <martin@gnome.org>
4775 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4776 does not match, but don't report any errors. This method is called in
4777 order for all methods in a MethodGroupExpr until a matching method is
4778 found, so we don't want to bail out if the first method doesn't match.
4779 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4780 matches, report the 123. Fixes #28070.
4782 2002-07-24 Martin Baulig <martin@gnome.org>
4784 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4785 TypeManager.TypeToCoreType() to the top of the method so the
4786 following equality checks will work. Fixes #28107.
4788 2002-07-24 Martin Baulig <martin@gnome.org>
4790 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4791 operand is of type uint, and the other operand is of type sbyte,
4792 short or int, the operands are converted to type long." -
4793 Actually do what this comment already told us. Fixes bug #28106,
4796 2002-07-24 Martin Baulig <martin@gnome.org>
4798 * class.cs (MethodBase): New abstract class. This is now a base
4799 class for Property, Indexer and Event to avoid some code duplication
4800 in their Define() and DefineMethods() methods.
4801 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4802 generic methods for Define() and DefineMethods().
4803 (FieldBase): Derive from MemberBase, not MemberCore.
4804 (Property): Derive from MemberBase, not MemberCore.
4805 (Property.DefineMethod): Moved all the code from this method to the
4806 new MethodBase.DefineAccessor(), just call it with appropriate
4808 (Property.Define): Call the new Property.DoDefine(), this does some
4809 sanity checks and we don't need to duplicate the code everywhere.
4810 (Event): Derive from MemberBase, not MemberCore.
4811 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4812 accessors, this will also make them work with interface events.
4813 (Indexer): Derive from MemberBase, not MemberCore.
4814 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4815 (Indexer.Define): Use the new MethodBase functions.
4817 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4818 argument to the constructor.
4819 (Interface.FindMembers): Added support for interface events.
4820 (Interface.PopluateEvent): Implemented.
4822 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
4824 2002-07-22 Miguel de Icaza <miguel@ximian.com>
4826 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4827 but this is required to check for a method name being the same as
4828 the containing class.
4832 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4834 * interface.cs: initialize variable.
4836 2002-07-23 Martin Baulig <martin@gnome.org>
4838 Implemented the IndexerName attribute in interfaces.
4840 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4841 name if this is an explicit interface implementation.
4842 (Indexer.InterfaceIndexerName): New public variable. If we're
4843 implementing an interface indexer, this is the IndexerName in that
4844 interface. Otherwise, it's the IndexerName.
4845 (Indexer.DefineMethod): If we're implementing interface indexer,
4846 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
4847 and Pending.ImplementIndexer methods.
4848 (Indexer.Define): Also define the PropertyBuilder if we're
4849 implementing an interface indexer and this is neither an explicit
4850 interface implementation nor do the IndexerName match the one in
4853 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4854 If a method is defined here, then we always need to create a proxy
4855 for it. This is used when implementing interface indexers.
4856 (Pending.IsInterfaceIndexer): New public method.
4857 (Pending.ImplementIndexer): New public method.
4858 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4859 This is used when implementing interface indexers to define a proxy
4861 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4862 define a proxy if necessary.
4864 * interface.cs (Interface.IndexerName): New public variable.
4865 (Interface.PopulateIndexer): Set the IndexerName.
4866 (Interface.DefineIndexers): New private method. Populate all the
4867 indexers and make sure their IndexerNames match.
4869 * typemanager.cs (IndexerPropertyName): Added support for interface
4872 2002-07-22 Martin Baulig <martin@gnome.org>
4874 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4875 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4876 ret if HasReturnLabel.
4877 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4880 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4881 and set the ec.LoopBeginTryCatchLevel.
4882 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4883 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
4884 the current ec.TryCatchLevel, the branch goes out of an exception
4885 block. In this case, we need to use Leave and not Br.
4887 2002-07-22 Martin Baulig <martin@gnome.org>
4889 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
4890 block unless the block does not always return or it is contained in
4891 another try { ... } catch { ... } block. Fixes bug #26506.
4892 Added verify-1.cs to the test suite.
4894 2002-07-22 Martin Baulig <martin@gnome.org>
4896 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
4897 then we do not always return. Fixes bug #24985.
4899 2002-07-22 Martin Baulig <martin@gnome.org>
4901 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
4902 lookup on a per-class level; ie. walk up the class hierarchy until we
4903 found at least one applicable method, then choose the best among them.
4904 Fixes bug #24463 and test-29.cs.
4906 2002-07-22 Martin Baulig <martin@gnome.org>
4908 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
4909 return types of the methods. The return type is not part of the
4910 signature and we must not check it to make the `new' modifier work.
4911 Fixes bug #27999, also added test-147.cs.
4912 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
4914 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
4915 on the method's return type.
4917 2002-07-21 Martin Baulig <martin@gnome.org>
4919 * assign.cs: Make this work if the rightmost source is a constant and
4920 we need to do an implicit type conversion. Also adding a few more tests
4921 to test-38.cs which should have caught this.
4923 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
4924 target in the makefile for this. The makefile.gnu is primarily intended
4925 for end-users who don't want to debug the compiler.
4927 2002-07-21 Martin Baulig <martin@gnome.org>
4929 * assign.cs: Improved the Assign class so it can now handle embedded
4930 assignments (X = Y = Z = something). As a side-effect this'll now also
4931 consume less local variables. test-38.cs now passes with MCS, added
4932 a few new test cases to that test.
4934 2002-07-20 Martin Baulig <martin@gnome.org>
4936 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
4937 instructions. Fixes bug #27977, also added test-146.cs.
4939 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4941 * cs-tokenizer.cs: fixed getHex ().
4943 2002-07-19 Martin Baulig <martin@gnome.org>
4945 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
4946 not Type.GetType() to lookup the array type. This is needed when
4947 we're constructing an array of a user-defined type.
4948 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
4949 single-dimensional arrays, but also for single-dimensial arrays of
4952 2002-07-19 Martin Baulig <martin@gnome.org>
4954 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
4955 this function is called, it's not allowed to share LocalBuilders
4958 2002-07-19 Martin Baulig <martin@gnome.org>
4960 * expression.cs (Argument.Resolve): Report an error 118 when trying
4961 to pass a type as argument.
4963 2002-07-18 Martin Baulig <martin@gnome.org>
4965 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
4966 Conv_R_Un for the signed `long' type.
4968 2002-07-15 Miguel de Icaza <miguel@ximian.com>
4970 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4971 `expr' for the temporary result, as that will fail if we do
4972 multiple resolves on the same expression.
4974 2002-07-05 Miguel de Icaza <miguel@ximian.com>
4976 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4977 ec.TypeContainer for looking up aliases.
4979 * class.cs (TypeContainer): Remove LookupAlias from here.
4981 * decl.cs (DeclSpace); Move here.
4983 2002-07-01 Miguel de Icaza <miguel@ximian.com>
4985 * class.cs (FindMembers): Only call filter if the constructor
4986 bulider is not null.
4988 Also handle delegates in `NestedTypes' now. Now we will perform
4989 type lookups using the standard resolution process. This also
4992 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4993 This uses Expressions (the limited kind that can be parsed by the
4994 tree) instead of strings.
4996 * expression.cs (ComposedCast.ToString): Implement, used to flag
4997 errors since now we have to render expressions.
4999 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
5002 * ecore.cs (SimpleName.ToString): ditto.
5004 * cs-parser.jay: Instead of using strings to assemble types, use
5005 Expressions to assemble the type (using SimpleName, ComposedCast,
5006 MemberAccess). This should fix the type lookups in declarations,
5007 because we were using a different code path for this.
5009 * statement.cs (Block.Resolve): Continue processing statements
5010 even when there is an error.
5012 2002-07-17 Miguel de Icaza <miguel@ximian.com>
5014 * class.cs (Event.Define): Also remove the `remove' method from
5015 the list of pending items.
5017 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5018 generate more compact code.
5020 2002-07-17 Martin Baulig <martin@gnome.org>
5022 * const.cs (Const.LookupConstantValue): Add support for constant
5023 `unchecked' and `checked' expressions.
5024 Also adding test case test-140.cs for this.
5026 2002-07-17 Martin Baulig <martin@gnome.org>
5028 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5029 check whether mi.ReturnType implements the IEnumerator interface; the
5030 `==' and the IsAssignableFrom() will fail in this situation.
5032 2002-07-16 Ravi Pratap <ravi@ximian.com>
5034 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
5037 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5039 * expression.cs: fixed bug #27811.
5041 2002-07-14 Miguel de Icaza <miguel@ximian.com>
5043 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5044 Molaro: when we are a ref, the value already contains a pointer
5045 value, do not take the address of it.
5047 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5048 * removed mb-parser.jay and mb-tokenizer.cs
5050 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5052 * expression.cs: check against the building corlib void type.
5054 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5056 * ecore.cs: fix for valuetype static readonly fields: when
5057 initializing them, we need their address, not the address of a copy.
5059 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5061 * typemanager.cs: register also enum_type in corlib.
5063 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5065 * class.cs: allow calling this (but not base) initializers in structs.
5067 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5069 * ecore.cs: make sure we compare against the building base types
5072 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5074 * typemanager.cs: fix TypeToCoreType() to handle void and object
5075 (corlib gets no more typerefs after this change).
5077 2002-07-12 Miguel de Icaza <miguel@ximian.com>
5079 * expression.cs (ArrayCreation.EmitArrayArguments): use
5080 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5082 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5083 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
5084 array indexes, the runtime actually forbids them.
5086 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5087 for array arguments here.
5089 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5090 instead of the default for ValueTypes.
5092 (New.DoEmit): Use IsValueType instead of
5093 IsSubclassOf (value_type)
5094 (New.DoResolve): ditto.
5095 (Invocation.EmitCall): ditto.
5097 * assign.cs (Assign): ditto.
5099 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5100 Statements *are* currently doing part of their resolution during
5103 Expressions do always resolve during resolve, but statements are
5104 only required to propagate resolution to their children.
5106 2002-07-11 Miguel de Icaza <miguel@ximian.com>
5108 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5110 (LoadAssembly): Do not add the dll if it is already specified
5112 (MainDriver): Add the System directory to the link path at the end,
5113 after all the other -L arguments.
5115 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5116 wrong opcode for loading bytes and bools (ldelem.i1 instead of
5117 ldelem.u1) and using the opposite for sbytes.
5119 This fixes Digger, and we can finally run it.
5121 * driver.cs (UnixParseOption): Move the option parsing here.
5122 (CSCParseOption): Implement CSC-like parsing of options.
5124 We now support both modes of operation, the old Unix way, and the
5125 new CSC-like way. This should help those who wanted to make cross
5128 The only thing broken is that /r:, /reference: and /lib: are not
5129 implemented, because I want to make those have the same semantics
5130 as the CSC compiler has, and kill once and for all the confussion
5131 around this. Will be doing this tomorrow.
5133 * statement.cs (Unsafe.Resolve): The state is checked during
5134 resolve, not emit, so we have to set the flags for IsUnsfe here.
5136 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5138 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5139 not catch the Error_ObjectRefRequired in SimpleName (as it is
5140 possible to have a class/instance variable name that later gets
5141 deambiguated), we have to check this here.
5143 2002-07-10 Ravi Pratap <ravi@ximian.com>
5145 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5146 make static and put into Expression.
5148 (Event.Define): Register the private field of the event with the
5149 TypeManager so that GetFieldFromEvent can get at it.
5151 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5152 keep track of the private field associated with an event which
5155 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5158 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5160 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5162 * expression.cs (Binary.EmitBranchable): this routine emits the
5163 Binary expression in a branchable context. This basically means:
5164 we need to branch somewhere, not just get the value on the stack.
5166 This works together with Statement.EmitBoolExpression.
5168 * statement.cs (Statement.EmitBoolExpression): Use
5171 2002-07-09 Miguel de Icaza <miguel@ximian.com>
5173 * statement.cs (For): Reduce the number of jumps in loops.
5175 (For): Implement loop inversion for the For statement.
5177 (Break): We can be breaking out of a Try/Catch controlled section
5178 (foreach might have an implicit try/catch clause), so we need to
5179 use Leave instead of Br.
5181 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5182 now). If the instace expression supports IMemoryLocation, we use
5183 the AddressOf method from the IMemoryLocation to extract the
5184 address instead of emitting the instance.
5186 This showed up with `This', as we were emitting the instance
5187 always (Emit) instead of the Address of This. Particularly
5188 interesting when This is a value type, as we dont want the Emit
5189 effect (which was to load the object).
5191 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5193 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5195 * statement.cs (Checked): Set the CheckedState during the resolve
5196 process too, as the ConvCast operations track the checked state on
5197 the resolve process, and not emit.
5199 * cs-parser.jay (namespace_member_declaration): Flag that we have
5200 found a declaration when we do. This is used to flag error 1529
5202 * driver.cs: Report ok when we display the help only.
5204 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5206 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5208 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5210 * cs-tokenizer.cs (define): We also have to track locally the
5211 defines. AllDefines is just used for the Conditional Attribute,
5212 but we also need the local defines for the current source code.
5214 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5216 * statement.cs (While, For, Do): These loops can exit through a
5217 Break statement, use this information to tell whether the
5218 statement is the last piece of code.
5220 (Break): Flag that we break.
5222 * codegen.cs (EmitContexts): New `Breaks' state variable.
5224 2002-07-03 Martin Baulig <martin@gnome.org>
5226 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5227 modifiers in method declarations in structs. Otherwise, you won't
5228 be able to override things like Object.Equals().
5230 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5232 * class.cs (Method, Property, Indexer): Do not allow the public
5233 modifier to be used in explicit interface implementations.
5235 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5236 override modifiers in method declarations in structs
5238 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5240 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5241 integer or real overflow, report an error
5243 2002-07-02 Martin Baulig <martin@gnome.org>
5245 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5246 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5247 to tell the runtime about our newly created System.Object and
5248 System.ValueType types.
5250 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5252 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5253 struct instead of Ldarg/Starg.
5255 2002-07-02 Martin Baulig <martin@gnome.org>
5257 * expression.cs (Indirection.Indirection): Call
5258 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5260 2002-07-02 Martin Baulig <martin@gnome.org>
5262 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5263 ValueType, call TypeManager.TypeToCoreType() on it.
5264 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5265 the OpCodes.Newarr argument.
5267 2002-07-02 Martin Baulig <martin@gnome.org>
5269 * expression.cs (Invocation.EmitCall): When compiling corlib,
5270 replace all calls to the system's System.Array type to calls to
5271 the newly created one.
5273 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5274 System.Array methods.
5275 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5276 from the system's System.Array type which must be replaced.
5278 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5280 * typemanager.cs: load unverifiable_code_ctor so we can build
5281 corlib using the correct type. Avoid using GetTypeCode() with
5283 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5284 TypeManager.object_type to allow building corlib.
5286 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5288 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5290 2002-07-01 Martin Baulig <martin@gnome.org>
5292 * class.cs: Make the last change actually work, we need to check
5293 whether `ifaces != null' to avoid a crash.
5295 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5297 * class.cs: when we build structs without fields that implement
5298 interfaces, we need to add the interfaces separately, since there is
5299 no API to both set the size and add the interfaces at type creation
5302 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5304 * expression.cs: the dimension arguments to the array constructors
5305 need to be converted if they are a long.
5307 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5309 * class.cs: don't emit ldarg.0 if there is no parent constructor
5310 (fixes showstopper for corlib).
5312 2002-06-29 Martin Baulig <martin@gnome.org>
5314 MCS now compiles corlib on GNU/Linux :-)
5316 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5317 ie. check for MethodImplOptions.InternalCall.
5319 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5320 and TypeManager.attribute_type are null, so we must explicitly check
5321 whether parent is not null to find out whether it's an attribute type.
5322 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5323 and SetBuilder, not only if the property is neither abstract nor external.
5324 This is necessary to set the MethodImplOptions on the accessor methods.
5325 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5326 SetBuilder, see Property.Emit().
5328 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5329 populate "System.Object", "System.ValueType" and "System.Attribute" since
5330 they've already been populated from BootCorlib_PopulateCoreTypes().
5332 2002-06-29 Martin Baulig <martin@gnome.org>
5334 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5335 is the NullLiteral, we also need to make sure that target_type is not
5338 2002-06-29 Martin Baulig <martin@gnome.org>
5340 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5341 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5342 before calling BootstrapCorlib_ResolveDelegate ().
5344 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5346 * statement.cs: fixed build-breaker. All tests passed ok.
5348 2002-06-27 Martin Baulig <martin@gnome.org>
5350 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5351 for System.Decimal when compiling corlib.
5353 2002-06-27 Martin Baulig <martin@gnome.org>
5355 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5356 switch blocks which contain nothing but a default clause.
5358 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5360 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5362 2002-06-27 Martin Baulig <martin@gnome.org>
5364 * ecore.cs (PropertyExpr.PropertyExpr): Call
5365 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5367 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5368 is already a TypeBuilder.
5370 2002-06-27 Martin Baulig <martin@gnome.org>
5372 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5373 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5374 the "from an array-type to System.Array" case. This makes it work
5375 when compiling corlib.
5377 2002-06-27 Martin Baulig <martin@gnome.org>
5379 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5380 non-static PropertyExpr, set its InstanceExpression. This makes
5381 the `ICollection.Count' property work in System/Array.cs.
5383 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5385 * driver.cs: Made error handling more consistent. Errors now
5386 tracked by Report class, so many methods which used to return int
5387 now return void. Main() now prints success/failure and
5388 errors/warnings message.
5390 Renamed '--probe' compiler argument to '--expect-error'. Removed
5391 the magic number return values (123 and 124). Now, if the
5392 expected error occurs, the compiler exits with success (exit value
5393 0). If the compilation completes without seeing that particular
5394 error, the compiler exits with failure (exit value 1). The
5395 makefile in mcs/errors has been changed to handle the new behaviour.
5397 * report.cs: Made 'expected error' number a property and renamed
5398 it from 'Probe' to 'ExpectedError'.
5400 * genericparser.cs: Removed error handling support, since it is
5401 now all done by Report class.
5403 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5404 class, so parse() no longer returns an int.
5406 * namespace.cs: Use Report.Error instead of GenericParser.error
5408 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5410 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5411 TypeContainer.AddOperator): At the front of the list put the
5412 explicit implementations, so they get resolved/defined first.
5414 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5416 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5417 interface type is implemented by this TypeContainer. Used during
5418 explicit interface implementation.
5420 (Property.Define, Indexer.Define, Method.Define): Validate that
5421 the given interface in the explicit implementation is one of the
5422 base classes for the containing type.
5424 Also if we are explicitly implementing an interface, but there is
5425 no match in the pending implementation table, report an error.
5427 (Property.Define): Only define the property if we are
5428 not explicitly implementing a property from an interface. Use the
5429 correct name also for those properties (the same CSC uses,
5430 although that is really not needed).
5432 (Property.Emit): Do not emit attributes for explicitly implemented
5433 properties, as there is no TypeBuilder.
5435 (Indexer.Emit): ditto.
5437 Hiding then means that we do not really *implement* a pending
5438 implementation, which makes code fail.
5440 2002-06-22 Martin Baulig <martin@gnome.org>
5442 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5443 the return value of Object.GetType(). [FIXME: we need to do this whenever
5444 we get a type back from the reflection library].
5446 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5448 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5450 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5452 * attribute.cs: Return null if we can not look up the type.
5454 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5455 the interface types found.
5457 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5458 interface types found.
5460 * typemanager.cs (GetInterfaces): Make this routine returns alll
5461 the interfaces and work around the lame differences between
5462 System.Type and System.Reflection.Emit.TypeBuilder in the results
5463 result for GetInterfaces.
5465 (ExpandInterfaces): Given an array of interface types, expand and
5466 eliminate repeated ocurrences of an interface. This expands in
5467 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5470 2002-06-21 Martin Baulig <martin@gnome.org>
5472 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5475 2002-06-21 Martin Baulig <martin@gnome.org>
5477 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5478 and called with one of the core types, return the corresponding typebuilder for
5481 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5484 2002-06-21 Martin Baulig <martin@gnome.org>
5486 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5487 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5488 (Expression.ConvertReferenceExplicit): Likewise.
5490 * expression.cs (ElementAccess.DoResolve): Likewise.
5491 (ElementAccess.DoResolveLValue): Likewise.
5493 2002-06-10 Martin Baulig <martin@gnome.org>
5495 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5496 add the "value" parameter to the parameter list.
5498 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5501 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5503 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5504 the argument to an int, uint, long or ulong, per the spec. Also
5505 catch negative constants in array creation.
5507 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5509 * class.cs: do not allow the same interface to appear twice in
5510 the definition list.
5512 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5514 * ecore.cs: don't use ldlen with System.Array.
5516 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5518 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5520 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5522 * modifiers.cs: produce correct field attributes for protected
5523 internal. Easy fix so miguel can work on ther harder stuff:-)
5525 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5527 * pending.cs: New file. Move the code from class.cs here.
5528 Support clearning the pending flag for all methods (when not doing
5529 explicit interface implementation).
5531 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5533 * rootcontext.cs: added a couple more types needed to bootstrap.
5535 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5537 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5538 constructor in the type, instead of any constructor in the type
5539 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5540 a bug in the Mono runtime when applying the params attribute).
5542 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5543 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5545 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5547 * expression.cs (Unary.ResolveOperator): Use TypeManager
5548 to resolve the type.
5550 2002-06-13 Ravi Pratap <ravi@ximian.com>
5552 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5555 * enum.cs (AddEnumMember): Add support to store the attributes associated
5556 with each member too.
5558 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5559 field builders too - this takes care of the enum member case.
5561 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5563 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5564 address-of operator on both value types and pointers.
5566 2002-06-10 Martin Baulig <martin@gnome.org>
5568 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5569 PropertyBuilder to the `property_builders' list.
5571 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5572 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5573 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5574 find any indexers which are inherited from an interface.
5576 2002-06-09 Martin Baulig <martin@gnome.org>
5578 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5579 the same type as the constant if necessary. There's also a test-130.cs
5582 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5584 * typemanager.cs (TypeManager.ChangeType): Previously known as
5585 Enum.ChangeEnumType().
5587 2002-06-09 Martin Baulig <martin@gnome.org>
5589 * expression.cs (Cast.TryReduce): Added support for consts.
5591 2002-06-08 Ravi Pratap <ravi@ximian.com>
5593 * class.cs (Accessor): Hold attributes information so we can pass
5596 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5597 Modify to pass in attributes attached to the methods.
5599 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5601 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5602 to handle the Accessor kind :-)
5604 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5606 2002-06-08 Martin Baulig <martin@gnome.org>
5608 * expression.cs (Unary.TryReduceNegative): Added support for
5611 2002-06-08 Martin Baulig <martin@gnome.org>
5613 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5614 name can't be found in the `defined_names' - the caller will do a
5615 MemberLookup in this case and thus find methods in System.Enum
5616 such as Enum.IsDefined().
5618 2002-06-08 Martin Baulig <martin@gnome.org>
5620 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5621 Convert.ChangeType() which works with TypeBuilder created types.
5622 (Enum.LookupEnumValue, Enum.Define): Use it here.
5624 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5625 `TypeBuilder.BaseType != null' check.
5626 (TypeContainer.FindMembers): Only lookup parent members if we
5627 actually have a parent.
5628 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5629 (ConstructorInitializer.Resolve): Likewise.
5631 * interface.cs (Interface.FindMembers): Added
5632 `TypeBuilder.BaseType != null' check.
5634 * rootcontext.cs (RootContext.ResolveCore): Added
5635 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5636 classes_second_stage.
5638 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5639 debug_type and trace_type when compiling with --nostdlib.
5641 2002-06-07 Martin Baulig <martin@gnome.org>
5643 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5644 (AddField): Set it to true when adding a non-static field.
5645 (DefineType): Use `have_nonstatic_fields' to find out whether we
5646 have non-static fields, not `Fields != null'.
5648 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5650 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5651 dereferencing a null on the static-field code path)
5653 2002-05-30 Martin Baulig <martin@gnome.org>
5655 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5656 to take command line arguments. Use reflection to call the new
5657 custom `Initialize' function on the symbol writer and pass it the
5658 command line arguments.
5660 * driver.cs (--debug-args): New command line argument to pass command
5661 line arguments to the symbol writer.
5663 2002-05-28 Miguel de Icaza <miguel@ximian.com>
5665 * assign.cs (DoResolve): Forgot to do the implicit conversion to
5666 the target type for indexers and properties. Thanks to Joe for
5669 2002-05-27 Miguel de Icaza <miguel@ximian.com>
5671 * typemanager.cs (MethodFlags): returns the method flags
5672 (Obsolete/ShouldIgnore) that control warning emission and whether
5673 the invocation should be made, or ignored.
5675 * expression.cs (Invocation.Emit): Remove previous hack, we should
5676 not do this on matching a base type, we should do this based on an attribute
5678 Only emit calls to System.Diagnostics.Debug and
5679 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5680 on the command line.
5682 * rootcontext.cs: Global settings for tracing and debugging.
5684 * cs-tokenizer.cs (define): New utility function to track
5685 defines. Set the global settings for TRACE and DEBUG if found.
5687 2002-05-25 Ravi Pratap <ravi@ximian.com>
5689 * interface.cs (Populate*): Pass in the TypeContainer as well as
5690 the DeclSpace as parameters so that we can create EmitContexts and
5691 then use that to apply attributes etc.
5693 (PopulateMethod, PopulateEvent, PopulateProperty)
5694 (PopulateIndexer): Apply attributes everywhere.
5696 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5699 (ApplyAttributes): Update accordingly.
5701 We now apply interface attributes for all members too.
5703 2002-05-26 Miguel de Icaza <miguel@ximian.com>
5705 * class.cs (Indexer.Define); Correctly check if we are explicit
5706 implementation (instead of checking the Name for a ".", we
5707 directly look up if the InterfaceType was specified).
5709 Delay the creation of the PropertyBuilder.
5711 Only create the PropertyBuilder if we are not an explicit
5712 interface implementation. This means that explicit interface
5713 implementation members do not participate in regular function
5714 lookups, and hence fixes another major ambiguity problem in
5715 overload resolution (that was the visible effect).
5717 (DefineMethod): Return whether we are doing an interface
5720 * typemanager.cs: Temporary hack until we get attributes in
5721 interfaces (Ravi is working on that) and we get IndexerName
5722 support in interfaces.
5724 * interface.cs: Register the indexers as properties.
5726 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5727 warning, I have verified that this is a bug in the .NET runtime
5728 (JavaScript suffers of the same problem).
5730 * typemanager.cs (MemberLookup): When looking up members for
5731 interfaces, the parent of an interface is the implicit
5732 System.Object (so we succeed in searches of Object methods in an
5733 interface method invocation. Example: IEnumerable x; x.ToString
5736 2002-05-25 Miguel de Icaza <miguel@ximian.com>
5738 * class.cs (Event): Events should also register if they do
5739 implement the methods that an interface requires.
5741 * typemanager.cs (MemberLookup); use the new GetInterfaces
5744 (GetInterfaces): The code used to lookup interfaces for a type is
5745 used in more than one place, factor it here.
5747 * driver.cs: Track the errors at the bottom of the file, we kept
5750 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5751 instance if the method we are calling is static!
5753 2002-05-24 Miguel de Icaza <miguel@ximian.com>
5755 * attribute.cs (ApplyAttributes): Make this function filter out
5756 the IndexerName attribute (as that attribute in reality is never
5757 applied) and return the string constant for the IndexerName
5760 * class.cs (TypeContainer.Emit): Validate that all the indexers
5761 have the same IndexerName attribute, and if so, set the
5762 DefaultName attribute on the class.
5764 * typemanager.cs: The return value might contain other stuff (not
5765 only methods). For instance, consider a method with an "Item"
5766 property and an Item method.
5768 * class.cs: If there is a problem with the parameter types,
5771 2002-05-24 Ravi Pratap <ravi@ximian.com>
5773 * ecore.cs (ImplicitConversionExists): Wrapper function which also
5774 looks at user defined conversion after making a call to
5775 StandardConversionExists - we need this for overload resolution.
5777 * expression.cs : Update accordingly the various method calls.
5779 This fixes 2 bugs filed against implicit user defined conversions
5781 2002-05-22 Miguel de Icaza <miguel@ximian.com>
5783 * statement.cs: Track the result of the assignment.
5785 2002-05-21 Miguel de Icaza <miguel@ximian.com>
5787 * expression.cs (MemberAccess): Improved error reporting for
5788 inaccessible members.
5790 2002-05-22 Martin Baulig <martin@gnome.org>
5792 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
5793 itself with debugging support.
5795 2002-05-22 Martin Baulig <martin@gnome.org>
5797 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5798 Removed, this isn't needed anymore.
5800 2002-05-20 Martin Baulig <martin@gnome.org>
5802 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5803 be underlying type for an enum.
5805 2002-05-20 Miguel de Icaza <miguel@ximian.com>
5807 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5808 that splits out the loading of just the core types.
5810 * rootcontext.cs (ResolveCore): Split the struct resolution in
5811 two, so we can load the enumeration underlying types before any
5814 * expression.cs (Is): Bandaid until we fix properly Switch (see
5815 bug #24985 for details).
5817 * typemanager.cs (ImplementsInterface): The hashtable will contain
5818 a null if there are no interfaces implemented.
5820 2002-05-18 Miguel de Icaza <miguel@ximian.com>
5822 * cs-parser.jay (indexer_declarator): It is fine to have array
5825 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5827 * typemanager.cs: (RegisterBuilder): New function used to register
5828 TypeBuilders that implement interfaces. Since
5829 TypeBuilder.GetInterfaces (as usual) does not work with lame
5831 (AddUserType): register interfaces.
5833 (ImplementsInterface): Use the builder_to_ifaces hash if we are
5834 dealing with TypeBuilder. Also, arrays are showing up as
5835 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5836 methods can not be invoked on them!
5838 * ecore.cs (ExplicitReferenceConversionExists): Made public.
5839 (ImplicitReferenceConversionExists): Split out from
5840 StandardConversionExists.
5842 * expression.cs (As): We were only implementing one of the three
5843 cases for the as operator. We now implement them all.
5844 (Is): Implement the various other cases for Is as well.
5846 * typemanager.cs (CACHE): New define used to control if we want or
5847 not the FindMembers cache. Seems to have a negative impact on
5848 performance currently
5850 (MemberLookup): Nested types have full acess to
5851 enclosing type members
5853 Remove code that coped with instance/static returns for events, we
5854 now catch this in RealFindMembers.
5856 (RealFindMembers): only perform static lookup if the instance
5857 lookup did not return a type or an event.
5859 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5861 * assign.cs (CompoundAssign): We pass more semantic information
5862 now to Compound Assignments than we did before: now we have all
5863 the information at hand, and now we resolve the target *before* we
5864 do the expression expansion, which allows the "CacheValue" method
5865 to have the effect we intended (before, a [x] += 1 would generate
5866 two differen ArrayAccess expressions from the ElementAccess,
5867 during the resolution process).
5869 (CompoundAssign.DoResolve): Resolve target and original_source here.
5871 2002-05-16 Miguel de Icaza <miguel@ximian.com>
5873 * expression.cs (ArrayAccess): dropped debugging information.
5875 * typemanager.cs: Small bug fix: I was always returning i_members,
5876 instead of one of i_members or s_members (depending on which had
5879 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
5880 method is invoked before any code generation takes place, and it
5881 is a mechanism to inform that the expression will be invoked more
5882 than once, and that the method should use temporary values to
5883 avoid having side effects
5885 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
5887 * ecore.cs (Expression.CacheTemporaries): Provide empty default
5890 * expression.cs (Indirection, ArrayAccess): Add support for
5891 CacheTemporaries in these two bad boys.
5893 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
5895 (StoreFromPtr): Handle stobj as well.
5897 * expression.cs (UnaryMutator): Share more code.
5899 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
5900 down: I was not tracking the Filter function as well, which
5901 was affecting the results of the cache.
5903 2002-05-15 Miguel de Icaza <miguel@ximian.com>
5905 * attribute.cs: Remove the hack to handle the CharSet property on
5908 2002-05-14 Miguel de Icaza <miguel@ximian.com>
5910 * attribute.cs (DoResolve): More uglyness, we now only try to
5911 resolve the attribute partially, to extract the CharSet
5912 information (only if we are a StructLayout attribute). Otherwise
5914 (GetExtraTypeInfo): Add some code to conditionally kill in the
5915 future this. I am more and more convinced that the .NET
5916 framework has special code to handle the attribute setting on
5919 * expression.cs (IsParamsMethodApplicable): Revert my previous
5920 foreach change here, it was wrong.
5922 2002-05-13 Miguel de Icaza <miguel@ximian.com>
5924 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
5925 (pp_expr): do not abort on unknown input, just return.
5926 (eval): abort if there are pending chars.
5928 * attribute.cs (Attribute.Resolve): Positional parameters are
5929 optional. Deal with that case.
5931 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
5932 the Ansi/Unicode/Auto information for the type.
5934 (TypeContainer.DefineType): instantiate the EmitContext here, as
5935 we will be using it during the type definition (to resolve
5936 attributes) and during the emit phase.
5938 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
5939 to pull type information out of the attributes
5941 (Attribute.Resolve): track the constructor builder, and allow for
5942 multiple invocations (structs and classes will use this).
5944 * ecore.cs (MemberLookupFinal): new version with all the
5945 parameters customizable.
5947 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
5948 constructors. Return if the result value is null (as the error
5949 would have been flagged already by MemberLookupFinal)
5951 Do not allow instances of abstract classes or interfaces to be
5954 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
5955 We have to compare the assembly property here when dealing with
5956 FamANDAssem and Assembly access modifiers, because we might be
5957 creating an assembly from *modules* (that means that we are not
5958 getting TypeBuilders for types defined in other modules that are
5959 part of this assembly).
5961 (Method.Emit): If the method is marked abstract and has a body,
5964 (TypeContainer.DefineMembers): If both the defined member and the
5965 parent name match are methods, then do not emit any warnings: let
5966 the Method.Define routine take care of flagging warnings. But if
5967 there is a mismatch (method overrides something else, or method is
5968 overriwritten by something, then emit warning).
5970 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5971 set to null, this means `do not check for the return type on the
5974 (Method.Define): set the return type for the method signature to
5975 null, so that we get methods with the same name and parameters and
5976 different return types. This is used to flag warning 114 (you are
5977 hiding a method, and you probably want to use the new/override
5980 * typemanager.cs (MemberLookup): Implemented proper access
5981 control, closing a long standing set of bug reports. The problem
5982 was that the Framework only has two bits: Public and NonPublic,
5983 and NonPublic includes private and protected methods, but we need
5984 to enforce the FamANDAssem, FamOrAssem and Family.
5986 2002-05-11 Miguel de Icaza <miguel@ximian.com>
5988 * statement.cs (GotoCase): Return true: Ammounts to giving up
5989 knowledge on whether we return or not, and letting the other case
5990 be responsible for it.
5992 2002-05-10 Miguel de Icaza <miguel@ximian.com>
5994 * driver.cs: Do not load directories for each file processed, only
5995 do it if there is a pattern.
5997 * ecore.cs: Report readonly assigns here as well, as we might have
5998 been resolved only by MemberAccess.
6000 (SimpleName.SimpleNameResolve): Also be useful for LValue
6001 resolution. We need this to propagate assign to local readonly variables
6003 * typemanager.cs: Use a ptrhashtable for the criteria, because we
6004 do not want to reuse potential criteria memory.
6006 * class.cs (MyEventBuilder): Set reflected_type;
6008 * ecore.cs (Constantify): Added support for constifying bools.
6010 (RootContext.LookupType): Added a cache for values looked up in
6011 the declaration space.
6013 * typemanager.cs (FindMembers): Now is a front-end to
6014 RealFindMembers, and provides a two-level hashtable-based cache to
6017 15% performance improvement: from 22.5 to 19.2 seconds.
6019 * expression.cs (IsParamsMethodApplicable): use foreach.
6020 (Invocation.DoResolve): ditto.
6021 (New.DoResolve): ditto.
6022 (ArrayCreation.DoResolve): ditto.
6024 * ecore.cs (FindMostEncompassingType): use foreach.
6026 * delegate.cs (NewDelegate.DoResolve): Use foreach
6028 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6029 (RemoveMethods): use foreach.
6031 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6032 nested foreach statements instead of for, and also break out of
6033 the inner loop once a match is found.
6035 (Invocation.OverloadResolve): Use foreach, simplify the code.
6037 2002-05-08 Miguel de Icaza <miguel@ximian.com>
6039 * cfold.cs (BinaryFold): During an enumeration evaluation context,
6040 we actually unwrap the expression to allow for extra information
6043 * expression.cs: Use Shr_Un on unsigned operations.
6045 2002-05-08 Ravi Pratap <ravi@ximian.com>
6047 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
6048 applicable operators was not being considered correctly. This closes
6049 the bug Miguel reported.
6051 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6053 * attribute.cs: check that the type derives from System.Attribute
6054 and report the correct error in that case (moved the duplicate code to
6055 its own method, too).
6057 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6059 * attribute.cs: lookup attribute type name as the spec says: first the
6060 bare attribute name and then name + "Attribute" (nant compiles with
6061 mcs after this fix).
6063 2002-05-07 Miguel de Icaza <miguel@ximian.com>
6065 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
6066 Because of the way we parse things, we should try to see if a
6067 UIntConstant can fit in an integer.
6069 2002-05-07 Ravi Pratap <ravi@ximian.com>
6071 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6072 when we are in an explicit context.
6074 (ConvertReferenceExplicit): When converting from Iface type S to Class
6075 T make sure the rules are implemented as an OR.
6077 * parameter.cs (ParameterType): Make it a property for now although the
6078 purpose really isn't anything immediate.
6080 * expression.cs (Is*Applicable): Do better checking on the parameter type
6081 of a ref/out parameter. The ones from the system assemblies are already
6082 marked with the correct type so we don't need to do any correction.
6084 * ecore.cs (StandardConversionExists): Conversion from Interface types to
6085 the object type is standard too so include that.
6087 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6089 * ecore.cs (StandardConversionExists): Augment with missing code:
6090 deal with IntConstant, LongConstants and Enumerations.
6092 * assign.cs: Report the error, instead of failing silently
6094 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6095 typecontainer that they are declared, because the
6096 typecontainer/namespace will have the list of using clauses that
6099 Assembly Attributes were escaping the normal registration
6102 (EmitCode): Apply attributes within an EmitContext that represents
6103 the container they were declared on.
6105 * cs-parser.jay: Track bases for structs. How did I get this wrong?
6107 2002-05-06 Ravi Pratap <ravi@ximian.com>
6109 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6110 Revamp completely - make much cleaner as we now operate only
6113 (FindMostSpecificSource, FindMostSpecificTarget): New methods
6114 to implement the logic detailed in the spec more correctly.
6116 (UserDefinedConversion): Update accordingly.
6118 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6120 * statement.cs: Return flow analysis information up.
6122 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6125 (token): Do not consume an extra character before calling
6128 2002-05-06 Piers Haken <piersh@friskit.com>
6130 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6132 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6134 * class.cs (Constructor.Emit): Set the IsStatic flag in the
6135 EmitContext during the instance constructor initializer
6136 resolution, to stop access to instance variables.
6138 This is mandated by the spec, last paragraph of the `constructor
6139 initializers' section.
6141 2002-05-05 Miguel de Icaza <miguel@ximian.com>
6143 * cs-parser.jay, class.cs (Accessor): new class used to represent
6144 an accessor (get or set). In the past we used `null' to represent
6145 a missing accessor. But this is ambiguous because there was no
6146 way to tell in abstract indexers/properties if one of them was
6149 Now there is a way of addressing that.
6151 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6152 instead of FindMembers.
6154 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6155 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6157 * attribute.cs: Treat indexers and properties as the same in terms
6158 of applying attributes
6160 * ecore.cs (FindMostEncompassedType): Use statically initialized
6161 EmptyExpressions()s like we do elsewhere to avoid creating useless
6162 objects (and we take this out of the tight loop).
6164 (GetConversionOperators): Move the code to extract the actual
6165 operators to a separate routine to clean things up.
6167 2002-05-04 Miguel de Icaza <miguel@ximian.com>
6169 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6170 events are always registered FieldBuilders.
6172 * class.cs (FieldBase): New class shared by Fields
6174 * delegate.cs: If we are a toplevel delegate, use our full name.
6175 If we are a nested delegate, then only use our tail name.
6177 2002-05-02 Ravi Pratap <ravi@ximian.com>
6179 * expression.cs (IsApplicable): Ensure that we add the "&" to
6180 ref/out types before comparing it with the type of the argument.
6182 (IsParamsMethodApplicable): Ditto.
6184 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
6187 * delegate.cs : Handle the case when we have more than one applicable
6188 method. Flag an error only when we finish checking all.
6190 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6192 * expression.cs: Add support for boolean static initializers.
6194 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6196 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6198 * parameter.cs (ComputeParameterTypes,
6199 ComputeAndDefineParameterTypes): Better error handling: now we
6200 clear the `types' cache if we fail during any of the type lookups.
6201 We also return the status code correctly to our caller
6203 * delegate.cs: If we fail to define a delegate, abort the extra
6206 * expression.cs (Binary.ResolveOperator): for
6207 operator==(object,object) and operator !=(object, object) we also
6208 have to verify that there is an implicit conversion from one to
6211 (ArrayAccess.DoResolve): Array Access can operate on
6214 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6216 * assign.cs (CompoundAssign): A new class used as a "flag" that
6217 the assignment actually is happening as part of a compound
6218 assignment operator.
6220 During compound assignment, a few new rules exist to enable things
6227 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6228 to the type of x) if y is implicitly convertible to the type of x,
6229 and the operator is a builtin operator and the return type of the
6230 operator is explicitly convertible to the type of x.
6232 * rootcontext.cs: Reset warning level to 2. 4 catches various
6233 "interesting" features in mcs, we must clean this up at some
6234 point, but currently am trying to kill other bugs ;-)
6236 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6237 in container classes as well.
6239 * expression.cs (Binary.ResolveOperator): Handle string case
6240 before anything else (as operator overloading does emit an error
6241 before doing anything else).
6243 This code could go away when we move to a table driven model, but
6244 i could not come up with a good plan last night.
6246 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6248 * typemanager.cs (CSharpName): reimplementation using regex.
6249 * class.cs: added null check for fields in Emit
6250 * rootcontext.cs: set warninglevel to 4
6252 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6254 * typemanager.cs (CSharpName): reimplemented with Lupus
6257 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6259 * statement.cs (If): correclty implement Resolve, because we were
6260 not catching sem errors in there. The same process is needed
6262 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6265 (Statement.Warning_DeadCodeFound): Factorize code.
6266 (While): Report dead code here too.
6268 (Statement): Added Resolve virtual method to allow
6269 for resolution split from the emit code.
6271 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6273 * statement.cs (EmitBoolExpression): No longer try to resolve the
6275 (MakeBoolean): New utility function that resolve, implicitly
6276 converts to boolean and tags the expression.
6279 (If, Do): Implement dead code elimination.
6280 (While): Implement loop inversion
6282 (Do, While, For, If): Resolve the expression prior to calling our
6285 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6288 - added method Report28 (warning: program has more than one entry point)
6289 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6290 - modified method Method.Define, the part at the end of the method
6292 * rootcontext.cs: added static public Location EntryPointLocation;
6294 * ../errors/cs0028.cs : Add test case for the above warning.
6297 - modified method CSharpName to allow arrays of primitive type to
6298 be printed nicely (e.g. instead of System.Int32[][] it now prints
6300 - added method CSharpSignature: returns the signature of a method
6301 in string format to be used in reporting errors, warnings, etc.
6303 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6306 2002-04-26 Ravi Pratap <ravi@ximian.com>
6308 * delegate.cs (Define): Fix extremely silly bug where I was
6309 setting the type of the 'object' parameter of the BeginInvoke
6310 method to System.IAsyncResult instead of System.Object ;-)
6312 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6314 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6317 (Constructor.Emit): return if we fail to initialize the
6318 constructor. Another door closed!
6320 * expression.cs (New.DoResolve): Improve error message (from -6 to
6321 1501). Use DeclaredOnly lookup to find the exact constructor.
6323 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6324 loop. This is useful.
6326 * cs-parser.jay: Adjust the default parameters so that destructors
6327 have the proper signature.
6329 2002-04-26 Martin Baulig <martin@gnome.org>
6331 * driver.cs (LoadAssembly): If `assembly' contains any characters
6332 which are only valid in path names and not in assembly names
6333 (currently slash, backslash and point), use Assembly.LoadFrom ()
6334 instead of Assembly.Load () on the `assembly' (before iteration
6335 over the link_paths).
6337 2002-04-26 Martin Baulig <martin@gnome.org>
6339 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6341 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6343 * class.cs (Property): use the new typemanager.MemberLookup
6345 (TypeContainer.MemberLookup): Implement using the
6346 TypeManager.MemberLookup now.
6348 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6349 and return MemberInfos, so that these can be used without an
6350 EmitContext (what we had before).
6352 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6354 * expression.cs: Fix the case where the argument to params if the
6355 type of the params. I omitted handling this before. Fixed
6357 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6359 * driver.cs: Call BootCorlib_PopulateCoreType
6361 * class.cs (Property.CheckBase): Check for properties only, not
6364 * interface.cs: Temporary hack: try/catch around the
6365 CustomAttributeBuilder, because I am getting an exception that I
6368 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6369 types whose definitions are required to be there (attributes are
6370 defined before standard types).
6372 Compute definitions as we boot the various types, as they are used
6373 immediately (value_type class will need object_type, but if we do
6374 not initialize object_type, we will pass a null, which will let
6375 the runtime pick the System.Object from the existing corlib, which
6376 is not what we want).
6378 2002-04-22 Patrik Torstensson <totte@labs2.com>
6380 * cs-tokenizer.cs: fixed a number of trim() issues.
6382 2002-04-22 Ravi Pratap <ravi@ximian.com>
6384 * expression.cs (Argument.Type): Ensure that we return the correct
6385 type when we have out or ref parameters [in which case we
6388 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6390 * class.cs (Property, Indexer): Allow extern modifier in there.
6392 * typemanager.cs (InitBaseTypes): Initializes object_type and
6393 value_type, since those will be used early on during the bootstrap
6394 process to compile corlib.
6396 (InitCoreTypes): Move code from here to InitBaseTypes.
6398 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6400 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6401 single-dimension arrays as using the ldlen opcode.
6403 Daniel Lewis discovered this optimization.
6405 * typemanager.cs: Add signature for System.Array::get_Length
6407 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6409 * statement.cs: report the error when the foreach does not apply to an
6410 array nor a collection.
6412 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6414 * expression.cs: Add implicit conversions to the operator ~.
6416 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6418 * typemanager.cs: Locate the decimal constructor.
6420 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6422 * attribute.cs: use the new property of TypeOf.
6423 * expression.cs: added 'get' property around typearg.
6425 These changes fix a build breaker reported by NickD. Is this the
6426 correct way to fix? If not, please, revert my changes and make it
6429 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6431 * attribute.cs: Add support for typeof in attribute invocations.
6432 I am not sure that this is right though.
6434 2002-04-14 Duncan Mak <duncan@ximian.com>
6436 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6437 Binary.Operator.Division case.
6439 2002-04-13 Ravi Pratap <ravi@ximian.com>
6441 * class.cs (DefineType): Ensure that we do a proper check on
6442 attribute types and also register it with the TypeManager.
6444 (TypeContainer.Targets): The default for attribute types is
6445 AttributeTargets.All.
6447 * attribute.cs (ApplyAttributes): Registering the attribute type
6448 is done elsewhere, not when we discover we have a Usage attribute.
6450 2002-04-12 Ravi Pratap <ravi@ximian.com>
6452 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6453 and get rid of is_delegate parameter.
6455 * everywhere : update.
6457 2002-04-12 Ravi Pratap <ravi@ximian.com>
6459 * cs-parser.jay (compilation_unit): Revamp completely to use
6460 some new ideas that I got from Rhys' grammar to solve the problems
6461 with assembly level attributes.
6463 (outer_declaration): New grammar production.
6465 (attribute_sections): Add.
6467 (opt_attributes): Base on attribute_sections
6469 (namespace_declaration): Allow opt_attributes to tackle the case
6470 when we have assembly level attributes - we are clever in this
6473 * attribute.cs (ApplyAttributes): Do not worry about assembly
6474 attributes in the non-global context.
6476 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6477 instead of SetGlobalAttributes.
6479 * class.cs, rootcontext.cs : Ensure we define and generate
6480 attribute types before anything else.
6482 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6483 and flag the new error -20 for the case when the attribute type
6484 does not have valid targets specified. csc does not catch this.
6486 * ../errors/errors.txt : update for error # -20
6488 2002-04-11 Ravi Pratap <ravi@ximian.com>
6490 * support.cs (InternalParameters.ParameterModifier): Do some null
6491 checking and return sane values.
6493 * class.cs (Method.Define): If we are a PInvoke method, ensure
6494 that we are static and extern. Report error # 601
6496 * ../errors/cs0601.cs : Add test case for the above error.
6498 2002-04-07 Ravi Pratap <ravi@ximian.com>
6500 * rootcontext.cs (attribute_types): We need to keep type of
6501 all attribute types separately and emit code for them first.
6503 (RegisterAttribute) : Implement.
6505 * class.cs (DefineType): Check if the current Type is a custom
6506 attribute type and register it accordingly.
6508 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6509 adding the first attribute twice and rename to
6511 (SetGlobalAttributes): this.
6513 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6516 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6517 if we are processing global arguments. Hmm, I am unsure of this.
6519 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6521 * expression.cs: added static array of strings to avoid calling
6522 Enum.ToString () for Operator in Binary. Significant recover of
6525 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6527 * class.cs (FindMembers): Allow the Builders of the various
6528 members to be null. If they are skip them. This only happens
6529 during the PInvoke declaration.
6531 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6533 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6534 failure, so we do not keep going afterwards.
6536 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6537 wanted to pass `false' as the `is_delegate' argument. If this is
6538 the case, why not use delegate_type == null to mean `is_delegate =
6539 false' and anything else as is_delegate = true.
6541 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6543 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6544 code for the section, not the beginning of the tests.
6546 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6548 * cfold.cs: Handle operator + (Enum x, Underlying x)
6550 * expression.cs (Binary): same. Warn about errors where we have
6551 Enum/Enum in operator + as well.
6553 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6556 - added support for switch(bool)
6557 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6558 - add TableSwitchEmit() to handle table-based switch statements
6560 2002-04-05 Ravi Pratap <ravi@ximian.com>
6562 * expression.cs (Invocation.OverloadResolve): Factor out code which
6563 does parameter compatibility checking with arguments so that we can
6564 re-use the code even from Delegate.VerifyApplicability
6566 (VerifyArgumentsCompat): Move above code here.
6568 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6569 and instead make a call to the above method.
6571 2002-03-31 Ravi Pratap <ravi@ximian.com>
6573 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6574 We use it to keep track of classes which are attribute types.
6576 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6578 * delegate.cs (Delegate.Define): Correctly define the types in the
6579 presence of fixed and array parameters.
6581 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6584 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6585 include NonPublic after the first iteration.
6587 * class.cs (Indexer.CheckBase): Only check if both parents are
6590 * cs-parser.jay (accessor_body): If empty, set to null.
6592 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6593 same code path here to resolve constants names that we did have in
6594 MemberAccess.DoResolve. There is too much code duplicated here.
6596 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6598 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6600 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6603 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6604 tokens, numbers and strings.
6606 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6609 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6610 asyncronous parameters and the regular parameters.
6612 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6613 specify the target directory.
6615 * expression.cs: (This.DoResolve): Simplify
6616 (As.Emit): Optimize, do not generate IsInst if the expression is
6617 always of the given type.
6619 (Is.DoResolve): Bug fix, we were reporting both always/never for
6622 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6623 creating too many unnecessary arrays.
6625 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6627 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6628 fields instead of rolling our own initializer. Takes care of all
6629 implicit conversions, and drops unnecessary static checks/argument.
6631 2002-03-31 Dick Porter <dick@ximian.com>
6633 * driver.cs: use the GetDirectories() return values properly, and
6634 use "/" as path separator.
6636 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6638 * expression.cs (Unary): Optimize - - expr into expr.
6639 (Binary): Optimize a + (-b) into a -b.
6641 * codegen.cs (CodeGen): Made all methods static.
6643 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6647 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6648 TypeBuilder property.
6650 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6653 * tree.cs: Removed the various RecordXXXX, and replaced with a
6654 single RecordDecl. Removed all the accessor methods, and just
6655 left a single access point Type
6657 * enum.cs: Rename DefineEnum to DefineType.
6659 * decl.cs: New abstract method `DefineType' used to unify the
6660 Defines for Enumerations, Interfaces, TypeContainers and
6663 (FindType): Moved LookupInterfaceOrClass here. Moved the
6664 LookupBaseClasses method that used to live in class.cs and
6665 interface.cs here, and renamed to FindType.
6667 * delegate.cs: Implement DefineType. Take advantage of the
6668 refactored pattern for locating the parent builder without taking
6669 the parent_builder argument (which we know does not work if we are
6670 nested, and triggering a toplevel definition).
6672 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6674 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6675 accessibility of a member has changed during override and report
6678 * class.cs (Method.Define, Property.Define): Only complain on
6679 overrides if the method is private, any other accessibility is
6680 fine (and since we just checked the permission is the same, we are
6683 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6684 and elif are processed always. The other pre-processing
6685 directives are only processed if we are "taking" the path
6687 2002-03-29 Martin Baulig <martin@gnome.org>
6689 * class.cs (Method.Emit): Only emit symbolic debugging info if the
6690 current location is not Null.
6692 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6693 a separate method so we can profile it.
6695 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6696 `span.Seconds' are just seconds, but no minutes or hours.
6697 (MainDriver): Profile the CodeGen.SaveSymbols calls.
6699 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6701 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6702 Remove the gratuitous set of Final:
6704 // If an interface implementation, then we can set Final.
6705 if (((flags & MethodAttributes.Abstract) == 0) &&
6706 implementing.DeclaringType.IsInterface)
6707 flags |= MethodAttributes.Final;
6709 I do not know what I was smoking when I used that.
6712 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6713 step into fixing the name resolution issues for delegates and
6714 unifying the toplevel name resolution.
6716 2002-03-28 Martin Baulig <martin@gnome.org>
6718 * class.cs (Method.Emit): If we have a symbol writer, call its
6719 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6720 tell it about the current method.
6722 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6723 writer that we're going to emit the first byte of IL code for a new
6724 statement (a new source line).
6725 (EmitContext.EmitTopBlock): If we have a symbol writer, call
6726 EmitContext.Mark() before emitting any code.
6728 * location.cs (SymbolDocument): Return null when we're Null.
6730 * statement.cs (Statement): Moved the `Location loc' variable here.
6731 (Statement.EmitBoolExpression): If we have a symbol writer, call
6732 ec.Mark() before emitting any code to tell it that we're at the
6733 beginning of a new statement.
6734 (StatementExpression): Added `Location' argument to the constructor.
6735 (Block): Added public readonly variable `StartLocation' and public
6736 variable `EndLocation'. The latter is to be set using SetEndLocation().
6737 (Block): Added constructor which takes a start and end location.
6738 (Block.SetEndLocation): New method. This sets the end location.
6739 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6740 local variables we create.
6741 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6742 each statement and do also mark the begin and end of the block.
6744 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6745 tell it the current lexer.Location, use Location.Null for the end of the
6747 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6748 current block, set its end location using SetEndLocation().
6749 (statement_expression): StatementExpression constructor now takes the
6750 lexer.Location as additional argument.
6751 (for_statement, declare_local_variables): Likewise.
6752 (declare_local_variables): When creating a new implicit block, use the
6753 new Block constructor and pass it the lexer.Location.
6755 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6757 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6758 members also on the parent interfaces recursively.
6760 2002-03-27 Miguel de Icaza <miguel@ximian.com>
6762 * report.cs: Use new formats, since Gonzalo finished the missing
6765 * expression.cs (Binary.ResolveOperator): added missing operator|
6766 operator& and operator^ for bool/bool.
6768 * cs-parser.jay: CheckDef now takes a Location argument that is
6769 used to report errors more precisly (instead of reporting the end
6770 of a definition, we try to track something which is a lot closer
6771 to the source of the problem).
6773 * cs-tokenizer.cs: Track global token use, so we can properly flag
6774 the use of #define/#undef after the first token has been seen.
6776 Also, rename the reportXXXX to Error_DescriptiveName
6778 * decl.cs (DeclSpace.IsTopLevel): Move property here from
6779 TypeContainer, so that Enum and Interface can use this too.
6781 * class.cs (TypeContainer.LookupInterfaceOrClass,
6782 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6783 `builder' argument. Typically this was used to pass the parent
6784 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6787 The problem is that a nested class could trigger the definition of
6788 a toplevel class, and the builder would be obviously wrong in that
6791 So we drop this argument, and we compute dynamically the
6792 TypeBuilder/ModuleBuilder (the correct information was available
6793 to us anyways from DeclSpace.Parent)
6795 * interface.cs (Interface.DefineInterface): Drop builder
6796 parameter cleanup like class.cs
6798 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
6801 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6804 (Try.Emit): Propagate the returns value from the statement.
6806 (Return.Emit): Even if we are leavning
6808 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6810 * modifiers.cs: Fix the computation of MethodAttributes flags.
6812 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6814 * driver.cs: allow compilation of files that start with '/'.
6815 Add a default case when checking the argument of --target.
6817 2002-03-25 Miguel de Icaza <miguel@ximian.com>
6819 * interface.cs: Implement the same search algorithm for types in
6822 * delegate.cs: Do not allow multiple definition.
6824 * Recovered ChangeLog that got accidentally amputated
6826 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6828 * rootcontext.cs: Load manually enum to allow core classes to
6829 contain enumerations.
6831 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6832 Update to new static methods in TypeManager.
6834 * typemanager.cs (GetMethod, GetConstructor): Use our
6835 implementation of FindMembers to find the members, since during
6836 corlib compilation, the types are TypeBuilders and GetMethod and
6837 GetConstructor do not work.
6839 Make all methods in TypeManager static.
6841 (InitCodeHelpers): Split the functionality from
6842 the InitCodeTypes function.
6844 * driver.cs: Call InitCodeHelpers after we have populated the
6847 * cs-parser.jay (delegate_declaration): we did not used to compute
6848 the delegate name correctly for void delegates.
6850 2002-03-24 Miguel de Icaza <miguel@ximian.com>
6852 * rootcontext.cs (RootContext): Init the interface_resolve_order
6853 and type_container_resolve_order always.
6855 (ResolveCore, BootstrapCorlib_ResolveClass,
6856 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6857 compiler when compiling with --nostdlib
6859 * class.cs (TypeContainer.DefineType): Check that our parent is
6860 not null. This test is most important when we are bootstraping
6863 * codegen.cs: Split out the symbol writing code.
6865 2002-03-25 Martin Baulig <martin@gnome.org>
6867 * driver.cs (-g): Made -g an alias for --debug.
6869 2002-03-24 Martin Baulig <martin@gnome.org>
6871 * codegen.cs (SymbolWriter): New public variable. Returns the
6872 current symbol writer.
6873 (CodeGen): Added `bool want_debugging_support' argument to the
6874 constructor. If true, tell the ModuleBuild that we want debugging
6875 support and ask it for the ISymbolWriter.
6876 (Save): If we have a symbol writer, call it's Close() method after
6877 saving the assembly.
6879 * driver.c (--debug): New command line argument to create a
6880 debugger information file.
6882 * location.cs (SymbolDocument): New public property. Returns an
6883 ISymbolDocumentWriter object for the current source file or null
6884 if we don't have a symbol writer.
6886 2002-03-21 Miguel de Icaza <miguel@ximian.com>
6888 * driver.cs (LoadAssembly): Correctly return when all the paths
6889 have been tried and not before.
6891 * statement.cs (Switch.Emit): return the actual coverage for this
6892 statement (returns/not-returns)
6894 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
6895 switch of the statement if we are the last switch section. That
6896 kills two problems: try/catch problems (we used to emit an empty
6897 nop at the end) and switch statements where all branches would
6900 2002-03-19 Miguel de Icaza <miguel@ximian.com>
6902 * driver.cs: Add default assemblies (the equivalent to the
6903 Microsoft CSC.RSP file)
6905 * cs-tokenizer.cs: When updating `cols and setting it to zero,
6906 also update tokens_seen and set it to false.
6908 * driver.cs: Implement --recurse for Mike.
6910 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
6911 correctly splitting out the paths.
6913 2002-03-18 Miguel de Icaza <miguel@ximian.com>
6915 * interface.cs (Interface.PopulateProperty): Instead of using
6916 `parent' as the declaration space for the set parameters, use
6919 * support.cs (InternalParameters): InternalParameters constructor
6920 takes a DeclSpace instead of a TypeContainer.
6922 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
6923 types are being initialized, load the address of it before calling
6926 (New): Provide a mechanism to disable the generation of local
6927 value type temporaries when the caller will be providing us with
6928 an address to store it.
6930 (ArrayCreation.EmitDynamicInitializers): Use it.
6932 2002-03-17 Miguel de Icaza <miguel@ximian.com>
6934 * expression.cs (Invocation.EmitArguments): Only probe for array
6935 property if there is more than one argument. Sorry about that.
6937 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
6940 * class.cs (Method.LabelParameters): Fix incorrect code path that
6941 prevented the `ParamArrayAttribute' from being applied to the
6944 2002-03-16 Miguel de Icaza <miguel@ximian.com>
6946 * support.cs (ReflectionParameters): Correctly compute whether the
6947 last argument is a params array. Fixes the problem with
6950 * typemanager.cs: Make the assemblies array always be non-null
6951 (empty, but non-null)
6953 * tree.cs (RecordDecl): New function that abstracts the recording
6954 of names. This reports error 101, and provides a pointer to the
6955 previous declaration. Fixes a crash in the compiler.
6957 * cs-parser.jay (constructor_declaration): Update to new grammar,
6958 and provide a constructor_body that can be empty.
6960 2002-03-15 Miguel de Icaza <miguel@ximian.com>
6962 * driver.cs: Add support for --resources.
6964 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6965 Make all types for the various array helper methods be integer.
6967 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6968 CheckState to ConvCast.
6970 (ConvCast): Now it takes a `checked' state argument, to avoid
6971 depending on the emit context for the conversion, and just using
6972 the resolve time setting.
6974 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6975 instead of Invocation.EmitArguments. We do not emit the original
6976 arguments, instead we emit those which have been converted to
6977 unsigned int expressions.
6979 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6981 * codegen.cs: ditto.
6983 * expression.cs (LocalVariableReference): Drop the use of the
6984 Store function that depended on the variable index.
6986 * statement.cs (VariableInfo): Drop the `Idx' property from this
6987 class, as this is not taking into account the indexes for
6988 temporaries tat we generate during the execution, getting the
6991 * class.cs: First emit class initializers, then call the parent
6994 * expression.cs (Binary): Fix opcode emision.
6995 (UnaryMutator.EmitCode): Support checked code generation
6997 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6998 matches for events for both the Static and Instance scans,
6999 pointing to the same element. Fix that.
7001 2002-03-14 Miguel de Icaza <miguel@ximian.com>
7003 * rootcontext.cs (ResolveTree): Always set the
7004 interface_resolve_order, because nested interfaces will be calling
7007 * class.cs (GetInterfaceOrClass): Track the same resolution
7008 process used by TypeManager.LookupType. This fixes the nested
7009 type lookups in class declarations (separate path from
7012 (TypeContainer.DefineType): Also define nested interfaces.
7013 (TypeContainer.RegisterOrder): New public function used to
7014 register the order in which child interfaces need to be closed.
7016 Nested interfaces need to be closed after their parents have been
7019 * interface.cs (InterfaceAttr): Put all the logic for computing
7020 the interface attribute here.
7022 (DefineInterface): Register our interface order with the
7023 RootContext or with the TypeContainer depending on the case.
7025 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7027 * cs-parser.jay: rework foreach statement to work with the new
7028 changes to the policy on SimpleNames.
7030 * report.cs: support Stacktrace on warnings as well.
7032 * makefile: drop --unsafe and /unsafe from the compile.
7034 2002-03-13 Ravi Pratap <ravi@ximian.com>
7036 * ecore.cs (StandardConversionExists): Modify to take an Expression
7037 as the first parameter. Ensure we do null -> reference type conversion
7040 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7041 temporary Expression objects.
7043 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7045 * interface.cs: workaround bug in method overloading resolution
7046 (there is already a bugzilla bug for it).
7048 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7050 We could also solve this problem by having a separate path for
7051 performing type lookups, instead of DoResolve, we could have a
7052 ResolveType entry point, and only participating pieces of the
7053 production (simplename, deref, array) would implement this.
7055 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7056 signal SimpleName to only resolve type names and not attempt to
7057 resolve anything else.
7059 * expression.cs (Cast): Set the flag.
7061 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7063 * class.cs: Only report 108 if there is no `new' modifier.
7065 * cs-parser.jay: rework foreach statement to work with the new
7066 changes to the policy on SimpleNames.
7068 * report.cs: support Stacktrace on warnings as well.
7070 * makefile: drop --unsafe and /unsafe from the compile.
7072 2002-03-11 Miguel de Icaza <miguel@ximian.com>
7074 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7075 lookups here, instead of doing that at parse time. This means
7076 that our grammar will not introduce `LocalVariableReferences' as
7077 expressions at this point. That solves the problem of code like
7085 This is only half the fix. The full fix requires parameters to
7086 also be handled in this way.
7088 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7089 makes the use more obvious of the DeclSpace. The
7090 ec.TypeContainer.TypeBuilder is now only used to pull the
7093 My theory is that I can get rid of the TypeBuilder completely from
7094 the EmitContext, and have typecasts where it is used (from
7095 DeclSpace to where it matters).
7097 The only pending problem is that the code that implements Aliases
7098 is on TypeContainer, and probably should go in DeclSpace.
7100 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7101 lookups here, instead of doing that at parse time. This means
7102 that our grammar will not introduce `LocalVariableReferences' as
7103 expressions at this point. That solves the problem of code like
7111 This is only half the fix. The full fix requires parameters to
7112 also be handled in this way.
7114 * class.cs (Property.DefineMethod): When implementing an interface
7115 method, set newslot, when implementing an abstract method, do not
7116 set the flag (before we tried never setting it, or always setting
7117 it, which is the difference).
7118 (Indexer.DefineMethod): same.
7119 (Method.DefineMethod): same.
7121 * ecore.cs: Only set the status used flag if we get back a Field.
7123 * attribute.cs: Temporary hack, so Paolo can keep working.
7125 2002-03-08 Ravi Pratap <ravi@ximian.com>
7127 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7128 the unmanaged type in the case we have a MarshalAs attribute.
7130 (Resolve): Handle the case when we are parsing the special MarshalAs
7131 attribute [we need to store the unmanaged type to use later]
7133 * typemanager.cs (marshal_as_attr_type): Built in type for the
7134 MarshalAs Attribute.
7136 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
7137 on parameters and accordingly set the marshalling info.
7139 2002-03-09 Miguel de Icaza <miguel@ximian.com>
7141 * class.cs: Optimizing slightly by removing redundant code after
7142 we switched to the `NoTypes' return value.
7143 (Property.DefineMethod): use NoTypes here too.
7145 This fixes the bug I introduced in my last batch of changes.
7147 2002-03-05 Ravi Pratap <ravi@ximian.com>
7149 * tree.cs (RecordEnum): Add. We now keep track of enums too.
7151 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7152 Enums since those are types too.
7154 * cs-parser.jay (enum_declaration): Record enums as we parse them.
7156 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
7157 thanks to a call during the lookup process.
7159 2002-03-07 Miguel de Icaza <miguel@ximian.com>
7161 * statement.cs (Foreach): Lots of work to accomodate a particular
7162 kind of foreach statement that I had not kept in mind. It is
7163 possible to have foreachs on classes that provide a GetEnumerator
7164 method that return objects that implement the "pattern" for using
7165 a foreach, there is no need to support GetEnumerator
7168 This is needed to compile nant.
7170 * decl.cs: Only report 114 if the member is not `Finalize' and if
7171 the warning level is at least 2.
7173 * class.cs: Moved the compare function from Method to
7176 (MethodSignature.InheritableMemberSignatureCompare): Add new
7177 filter function that is used to extract inheritable methods from a
7180 (Method.Define): Use the new `inheritable_method_signature_filter'
7183 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7186 2002-03-06 Miguel de Icaza <miguel@ximian.com>
7188 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7190 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7192 * expression.cs: Pass location information to
7193 ConvertImplicitStandard.
7195 * class.cs: Added debugging code to track return values from
7198 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7200 * expression.cs (Is.DoResolve): If either side of the `is' is an
7201 interface, do not flag the warning.
7203 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7206 * report.cs: Allow for --fatal to be used with --probe.
7208 * typemanager.cs (NoTypes): Move the definition for the empty Type
7211 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7213 (TypeContainer.DefineProxy): New function used to proxy to parent
7214 implementations when implementing interfaces.
7215 (TypeContainer.ParentImplements): used to lookup if our parent
7216 implements a public function that is required by an interface.
7217 (TypeContainer.VerifyPendingMethods): Hook this up.
7219 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7220 `modules' and `assemblies' arraylists into arrays. We only grow
7221 these are the very early start up of the program, so this improves
7222 the speedof LookupType (nicely measured).
7224 * expression.cs (MakeByteBlob): Replaced unsafe code with
7225 BitConverter, as suggested by Paolo.
7227 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7228 folding of string concatenation, but if either side is a string,
7229 and the other is not, then return null, and let the runtime use
7230 the concatenation on the string plus the object (using
7233 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7235 Constant Folding has been implemented now.
7237 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7238 the error instead on types that are not supported in one's
7241 * constant.cs (Constant and all children): New set of functions to
7242 perform implict and explicit conversions.
7244 * ecore.cs (EnumConstant): Implement the new functions to perform
7245 conversion by proxying to the child expression.
7247 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7248 own separate setting that can not be turned off from the command
7249 line using --unchecked or --checked and is only controlled using
7250 the checked/unchecked statements and expressions. This setting is
7251 used by the constant folder to flag errors.
7253 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7254 ConstantCheckState as well.
7256 During Resolve, they also have to flag the state, because the
7257 constant folder runs completely in the Resolve phase.
7259 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7262 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7264 * cfold.cs: New file, this file contains the constant folder.
7266 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7267 argument to track whether we are using the resulting address to
7268 load or store a value and provide better error messages.
7270 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7271 new AddressOf arguments.
7273 * statement.cs (Foreach.EmitCollectionForeach): Update
7275 * expression.cs (Argument.Emit): Call AddressOf with proper
7276 arguments to track usage.
7278 (New.DoEmit): Call AddressOf with new arguments.
7280 (Unary.Emit): Adjust AddressOf call.
7282 2002-03-01 Ravi Pratap <ravi@ximian.com>
7284 * cs-parser.jay (member_access): Change the case for pre-defined types
7285 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7288 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7291 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7292 essentially like methods and apply attributes like MethodImplOptions to them too.
7294 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7297 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7298 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7301 * Update code everywhere accordingly.
7303 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7305 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7307 2002-02-28 Ravi Pratap <ravi@ximian.com>
7309 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7310 try performing lookups against those instead of jumping straight into using
7311 the 'using' clauses.
7313 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7315 (LookupType): Perform lookups in implicit parents too.
7317 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7318 sequence as RootContext.LookupType.
7320 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7321 the various cases of namespace lookups into this method.
7323 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7325 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7326 in positional arguments)
7328 * class.cs (Operator): Update the AllowedModifiers to contain
7331 * cs-parser.jay: Update operator declaration to allow for the
7332 operator body to be empty.
7334 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7337 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7339 * class.cs (Method.Emit): Label parameters.
7341 * driver.cs: Return 1 or 0 as the program exit code.
7343 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7345 * expression.cs: Special case the `null' object when trying to
7346 auto-compute the type, as anything can be explicitly converted to
7349 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7350 spotting this Paolo.
7352 (Expression.ImplicitNumericConversion): Perform comparissions of
7353 the type using the underlying type in the case of an enumeration
7354 rather than using the enumeration type for the compare.
7356 Cope with the underlying == type case, which is not possible to
7359 (Expression.ConvertNumericExplicit): Perform comparissions of
7360 the type using the underlying type in the case of an enumeration
7361 rather than using the enumeration type for the compare.
7363 * driver.cs: If the user does not supply an extension, assume .exe
7365 * cs-parser.jay (if_statement): Rewrote so that we can track the
7366 location for the if statement.
7368 * expression.cs (Binary.ConstantFold): Only concat strings when
7369 the operation is "+", not everything ;-)
7371 * statement.cs (Statement.EmitBoolExpression): Take a location
7373 (If, While, Do): Track location.
7375 * expression.cs (Binary.ResolveOperator): In the object + string
7376 case, I was missing a call to ConvertImplicit
7378 2002-02-25 Ravi Pratap <ravi@ximian.com>
7380 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7381 Location arguments. Ensure we use RootContext.LookupType to do our work
7382 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7384 * interface.cs (PopulateMethod): Handle the type of the parameter being
7387 * expression.cs (Invocation.BetterFunction): Handle the case when we
7388 have a params method with no fixed arguments and a call is made with no
7391 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7393 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7394 the verbatim-string-literal
7396 * support.cs (InternalParameters.ParameterModifier): handle null
7398 (InternalParameters.ParameterType): ditto.
7400 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7401 duplicating the name of the variable parameter.
7402 (GetParameterByName): Fix bug where we were not looking up array
7403 paramters if they were the only present (thanks Paolo!).
7404 (GetParameterInfo): We only have an empty set of types if both
7405 fixed and array are set to null.
7406 (GetParameterInfo-idx): Handle FixedParameter == null
7408 * cs-parser.jay: Handle the case where there is no catch
7409 statements (missing null test).
7411 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7413 * driver.cs (MainDriver): Be conservative on our command line
7416 Catch DirectoryNotFoundException when calling GetFiles.
7418 (SplitPathAndPattern): Used to split the input specification into
7419 a path and a pattern that we can feed to Directory.GetFiles.
7421 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7423 * statement.cs (Fixed): Implement the last case of the Fixed
7424 statement (string handling).
7426 * expression.cs (StringPtr): New class used to return a char * to
7427 a string; Used by the Fixed statement.
7429 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7431 * expression.cs (Binary.ResolveOperator): Remove redundant
7432 MemberLookup pn parent type.
7433 Optimize union call, we do not need a union if the types are the same.
7434 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7437 Specialize the use of MemberLookup everywhere, instead of using
7438 the default settings.
7440 (StackAlloc): Implement stackalloc keyword.
7442 * cs-parser.jay: Add rule to parse stackalloc.
7444 * driver.cs: Handle /h, /help, /?
7446 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7447 before we supported unsafe code.
7449 * makefile: add --unsafe to the self compilation of mcs.
7451 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7453 * expression.cs (PointerArithmetic): New class that is used to
7454 perform pointer arithmetic.
7455 (Binary.Resolve): Handle pointer arithmetic
7456 Handle pointer comparission.
7457 (ArrayPtr): Utility expression class that is used to take the
7458 address of an array.
7460 (ElementAccess): Implement array access for pointers
7462 * statement.cs (Fixed): Implement fixed statement for arrays, we
7463 are missing one more case before we are done.
7465 * expression.cs (Indirection): Implement EmitAssign and set the
7466 ExprClass to Variable. This allows pointer dereferences to be
7467 treated as variables, and to have values assigned to them.
7469 * ecore.cs (Expression.StoreFromPtr): New utility function to
7470 store values dereferencing.
7472 2002-02-20 Ravi Pratap <ravi@ximian.com>
7474 * expression.cs (Binary.ResolveOperator): Ensure that we are
7475 not trying to operate on a void type - this fixes the reported
7478 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7479 the parent implementation is sealed.
7481 * ../errors/cs0239.cs : Add.
7483 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7485 * typemanager.cs (unverifiable_code_type): Corresponds to
7486 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7487 which have unsafe code in them.
7489 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7492 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7494 * cs-tokenizer.cs: Add support for @"litreal strings"
7496 Make tokenizer accept pre-processor directives
7497 on any column (remove the old C-like limitation).
7499 * rootcontext.cs (EmitCode): Emit any global attributes.
7500 (AddGlobalAttributes): Used to keep track of assembly attributes.
7502 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7504 * cs-parser.jay: Add support for global attributes.
7506 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7508 * expression.cs (Indirection): New helper class. Unary will
7509 create Indirection classes to be able to implement the
7510 IMemoryLocation interface on it.
7512 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7514 * cs-parser.jay (fixed_statement): reference the right statement.
7516 * statement.cs (Fixed.Emit): Finish implementing the fixed
7517 statement for the &x case.
7519 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7521 * class.cs (Property.Define, Method.Define): Remove newslot when
7524 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7525 wrong. NewSlot should only be used if the `new' keyword is present.
7527 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7528 locating our system dir. Sorry about this.
7530 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7532 * driver.cs (GetSystemDir): Compute correctly the location of our
7533 system assemblies. I was using the compiler directory instead of
7534 the library directory.
7536 2002-02-13 Ravi Pratap <ravi@ximian.com>
7538 * expression.cs (BetterFunction): Put back in what Miguel commented out
7539 since it is the correct fix. The problem is elsewhere ;-)
7541 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7542 parameters of the parms method are themselves compatible or not !
7544 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7545 to check that a class implements an interface before saying that an implicit
7546 conversion was allowed. Use ImplementsInterface to do the checking.
7548 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7550 * class.cs (Method.Define): Track whether we are an explicit
7551 implementation or not. And only call DefineMethodOverride if we
7552 are an explicit implementation.
7554 (Property.DefineMethod): Ditto.
7556 2002-02-11 Ravi Pratap <ravi@ximian.com>
7558 * expression.cs (BetterFunction): Catch hideous bug which was
7559 preventing us from detecting ambiguous calls due to implicit casts i.e
7562 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7564 * support.cs (Pair): Remove un-needed method. I figured why I was
7565 getting the error in cs-parser.jay, the variable in a foreach loop
7566 is readonly, and the compiler does not really treat this as a variable.
7568 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7569 instead of EQUALS in grammar.
7571 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7573 * expression.cs (Unary.DoResolve): Check whether the argument is
7576 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7578 * support.cs: Api for Pair to set a value. Despite the fact that
7579 the variables are public the MS C# compiler refuses to compile
7580 code that accesses the field if the variable is part of a foreach
7583 * statement.cs (Fixed): Begin implementation of the fixed
7586 (Block.AddVariable): Return the VariableInfo on success and null
7587 on failure instead of true/false.
7589 * cs-parser.jay (foreach): Catch errors on variables already
7590 defined (we were ignoring this value before) and properly unwind
7593 (fixed_statement): grammar for the fixed statement.
7595 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7597 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7598 pointer types to be incretemented.
7600 (SizeOf): Implement.
7602 * cs-parser.jay (pointer_member_access): Implement
7603 expr->IDENTIFIER production.
7605 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7606 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7609 (Unary): Implement indirection.
7611 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7612 use in non-unsafe context).
7614 (SimpleName.DoResolve): Check for pointers in field access on safe
7617 (Expression.LoadFromPtr): Factor the load-indirect code in this
7618 function. This was duplicated in UnboxCast and ParameterReference
7620 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7622 * expression.cs (ComposedCast): report an error if a pointer cast
7623 is used in a safe region.
7625 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7626 pointer type casts in unsafe context.
7628 * codegen.cs (EmitContext): Set up IsUnsafe.
7630 * cs-parser.jay (non_expression_type): Add productions for pointer
7633 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7634 code. We should not use force into static mode if the method is
7635 not virtual. Fixes bug in MIS
7637 * statement.cs (Do.Emit, While.Emit, For.Emit,
7638 Statement.EmitBoolExpression): Add support to Do and While to
7639 propagate infinite loop as `I do return' semantics.
7641 Improve the For case to also test for boolean constants.
7643 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7644 to the list of attributes we can add.
7646 Remove `EmitContext' argument.
7648 * class.cs (Method.Define): Apply parameter attributes.
7649 (Constructor.Define): Apply parameter attributes.
7650 (MethodCore.LabelParameters): Move here the core of labeling
7653 * support.cs (ReflectionParameters.ParameterModifier,
7654 InternalParameters.ParameterModifier): Use IsByRef on the type and
7655 only return the OUT bit for these parameters instead of in/out/ref
7658 This is because I miss-understood things. The ParameterInfo.IsIn
7659 and IsOut represent whether the parameter has the [In] and [Out]
7662 2002-01-22 Miguel de Icaza <miguel@ximian.com>
7664 * ecore.cs (FieldExpr.Emit): Release temporaries.
7666 * assign.cs (LocalTemporary.Release): new function.
7668 * codegen.cs (EmitContext.GetTemporaryStorage,
7669 EmitContext.FreeTemporaryStorage): Rework the way we deal with
7670 temporary storage. Now we can "put back" localbuilders when we
7673 2002-01-21 Miguel de Icaza <miguel@ximian.com>
7675 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7676 need to make a copy of the variable to generate verifiable code.
7678 2002-01-19 Miguel de Icaza <miguel@ximian.com>
7680 * driver.cs: Compute dynamically the system directory.
7682 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7683 Slower, but more generally useful. Used by the abstract
7684 registering implementation.
7686 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7687 the rules for the special rule on Type/instances. First check if
7688 we have the same name, and if so, try that special static path
7689 rather than the instance path.
7691 2002-01-18 Miguel de Icaza <miguel@ximian.com>
7693 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7696 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7697 Enum, ValueType, Delegate or Array for non-corlib compiles.
7699 * cs-tokenizer.cs: Catch long identifiers (645)
7701 * typemanager.cs (IndexerPropetyName): Ravi never tested this
7704 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7705 fix, we were returning too early, so we were not registering
7706 pending methods from abstract classes.
7708 Do not register pending methods if the class is abstract.
7710 * expression.cs (Conditional.DoResolve): Report circular implicit
7711 conversions when we neecd to compute it for conditional
7714 (Is.DoResolve): If the expression is always of the provided type,
7715 flag warning 183. If the expression can not ever be of the
7716 provided type flag warning 184.
7718 * class.cs: Catch 169 as well.
7720 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7723 2002-01-18 Nick Drochak <ndrochak@gol.com>
7725 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
7727 2002-01-17 Miguel de Icaza <miguel@ximian.com>
7729 * interface.cs: (PopulateMethod): Check for pointers being defined
7730 only if the unsafe context is active.
7731 (PopulateProperty): ditto.
7732 (PopulateIndexer): ditto.
7734 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7735 specified. If pointers are present, make sure that they are
7736 present in an unsafe context.
7737 (Constructor, Constructor.Define): ditto.
7738 (Field, Field.Define): ditto.
7739 (Property, Property.Define): ditto.
7740 (Event, Event.Define): ditto.
7742 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7743 hashtable if there are classes or structs defined.
7745 * expression.cs (LocalVariableReference.DoResolve): Simplify this
7746 code, as the constant resolution moved.
7748 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7749 the metadata, so we can flag error 133.
7751 * decl.cs (MemberCore.UnsafeOK): New function to test that a
7752 pointer is being declared in an unsafe context.
7754 2002-01-16 Miguel de Icaza <miguel@ximian.com>
7756 * modifiers.cs (Modifiers.Check): Require a Location argument.
7757 Report error 227 for Unsafe use.
7759 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7761 * statement.cs (For.Emit): If the test is null, then report that
7762 we do `return', as we wont reach anything afterwards.
7764 (Switch.SwitchGoverningType): Track the expression that matched
7767 * driver.cs: Allow negative numbers as an error code to flag.
7769 * cs-parser.jay: Handle 1551.
7771 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7773 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7775 * cs-parser.jay: Report 1518 (type declaration can only contain
7776 class, struct, interface, enum or delegate)
7778 (switch_label): Report 1523 (keywords `case' or `default' must
7781 (opt_switch_sections): Report 1522 (empty switch)
7783 * driver.cs: Report 1515 (response file specified multiple times)
7784 Report 1516 (Source file specified multiple times).
7786 * expression.cs (Argument.Resolve): Signal 1510
7788 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7789 access not allowed in static code)
7791 2002-01-11 Ravi Pratap <ravi@ximian.com>
7793 * typemanager.cs (IsPointerType): Utility method which we are going
7796 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7797 the object type, so we take care of that.
7799 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7801 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7802 added to non-params parameters :-)
7804 * typemanager.cs (CSharpName): Include 'void' type too.
7806 (void_ptr_type): Include in the set of core types.
7808 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
7811 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
7814 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
7815 completely forgotten about it.
7817 2002-01-10 Ravi Pratap <ravi@ximian.com>
7819 * cs-parser.jay (pointer_type): Add. This begins our implementation
7820 of parsing rules for unsafe code.
7822 (unsafe_statement): Implement.
7824 (embedded_statement): Modify to include the above.
7826 * statement.cs (Unsafe): Implement new class for unsafe blocks.
7828 * codegen.cs (EmitContext.InUnsafe): Add. This determines
7829 if the current context is an unsafe one.
7831 * cs-parser.jay (local_variable_pointer_type): Since local variable types
7832 are handled differently, we need separate rules for them.
7834 (local_variable_declaration): Update to use local_variable_pointer_type
7835 to allow variable declarations of unmanaged pointer types.
7837 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7840 * ../errors/cs0214.cs : Add.
7842 2002-01-16 Nick Drochak <ndrochak@gol.com>
7844 * makefile: remove 'response' file when cleaning.
7846 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7848 * cs-parser.jay: Report 1524.
7850 2002-01-14 Miguel de Icaza <miguel@ximian.com>
7852 * typemanager.cs (RegisterMethod): drop checking if we have
7853 registered this from here
7855 2002-01-12 Miguel de Icaza <miguel@ximian.com>
7857 * class.cs (Method.EmitDestructor): Implement calling our base
7860 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7863 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7864 this routine and will wrap the call in a try/catch block. Deal
7867 2002-01-11 Miguel de Icaza <miguel@ximian.com>
7869 * ecore.cs (Expression.MemberLookup): instead of taking a
7870 parameter `same_type' that was used to tell whether we could
7871 access private members we compute our containing type from the
7874 (FieldExpr): Added partial support for volatile fields. This does
7875 not work for volatile fields exposed from assemblies, as I can not
7876 figure out how to extract the modreq from it.
7878 Updated all the source files to use this.
7880 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7881 because it is referenced by MemberLookup very often.
7883 2002-01-09 Ravi Pratap <ravi@ximian.com>
7885 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
7886 TypeBuilder.GetCustomAttributes to retrieve what we need.
7888 Get rid of redundant default_member_attr_type as this is the same as
7889 default_member_type which already exists.
7891 * interface.cs, attribute.cs : Update accordingly.
7893 2002-01-08 Miguel de Icaza <miguel@ximian.com>
7895 * typemanager.cs: Enable IndexerPropertyName again. It does not
7896 work for TYpeBuilders though. Ravi, can you please fix this?
7898 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
7900 * expression.cs (Argument.Emit): Handle the case of ref objects
7901 being passed to ref functions;
7903 (ParameterReference.EmitLoad): Loads the content of the pointer
7904 without dereferencing.
7906 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7908 * cs-tokenizer.cs: Implemented the pre-processing expressions.
7910 2002-01-08 Ravi Pratap <ravi@ximian.com>
7912 * class.cs (Indexer.DefineMethod): Incorporate the interface
7913 type in the name of the method if we are doing explicit interface
7916 * expression.cs (ConversionExists): Remove as it is completely obsolete.
7918 (BetterConversion): Fix extremely trivial bug where we were referring to
7919 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
7922 * ../errors/bug16.cs : Add although we have fixed it.
7924 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7926 * expression.cs (BaseIndexer): Begin implementation.
7928 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
7930 * cs-parser.jay (indexer_declarator): Use qualified_identifier
7931 production directly to remove a shift/reduce, and implement
7932 explicit interface implementation.
7934 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
7935 after a floating point suffix.
7937 * expression.cs (DoNumericPromotions): Improved the conversion for
7938 uint/uint. If we have a constant, we avoid doing a typecast to a
7941 * class.cs (Indexer): Implement explicit interface implementation
7944 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
7946 * class.cs: make the default instance constructor public and hidebysig.
7948 2001-01-03 Ravi Pratap <ravi@ximian.com>
7950 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
7951 so we can call it from elsewhere.
7953 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
7954 we emit it internally if the class has a defined indexer; otherwise the user
7955 emits it by decorating the class definition with the DefaultMemberAttribute.
7957 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
7958 attribute is not used on a type which defines an indexer.
7960 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
7961 character when we skip whitespace.
7963 * ../errors/cs0646.cs : Add.
7965 2002-01-03 Miguel de Icaza <miguel@ximian.com>
7967 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7970 * makefile: Add practical target `mcs3.exe' which builds the third
7971 generation compiler.
7973 * expression.cs (New): Fix structures constructor calling.
7975 * class.cs (Property, Method, Indexer): Emit Final flag on the
7976 method if we are an interface implementation and we are not
7979 * ecore.cs (PropertyExpr): New public field `IsBase', tells
7980 whether this property is referencing a `base' method.
7982 * expression.cs (Invocation.EmitCall): take an extra argument:
7983 is_base, this is used to determine whether the `call' or
7984 `callvirt' opcode should be used.
7987 * delegate.cs: update EmitCall.
7989 * class.cs (Method.Define): Set NewSlot for the cases where we are
7990 not implementing an interface method.
7992 (Property.Define): ditto.
7994 2002-01-02 Miguel de Icaza <miguel@ximian.com>
7996 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7997 'r'. Allows mcs to parse itself fully.
7999 2002-01-02 Ravi Pratap <ravi@ximian.com>
8001 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8002 of the number of initializers that require the InitializeArray method.
8004 (CheckIndices): Store the Expression in all cases - not the plain value. Also
8005 update the above field where necessary.
8007 (MakeByteBlob): Update accordingly.
8009 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
8012 (EmitDynamicInitializers): Update in accordance with the new optimization.
8014 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8015 same OpCode applies.
8017 * cs-parser.jay : Fix some glaring errors I introduced.
8019 2002-01-01 Ravi Pratap <ravi@ximian.com>
8021 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8022 so that we can check for name clashes there too.
8024 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8025 for interface indexers.
8027 * interfaces.cs (Define): Emit the default member attribute.
8029 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8030 variable was being referred to while setting the value ;-)
8032 2002-01-01 Miguel de Icaza <miguel@ximian.com>
8034 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8035 byte-by-byte information when we know the data is zero.
8037 Make the block always a multiple of 4, because
8038 DefineInitializedData has a bug.
8040 * assign.cs: Fix, we should assign from the temporary, not from
8043 * expression.cs (MakeByteBlob): Fix my incorrect code.
8045 2001-12-31 Miguel de Icaza <miguel@ximian.com>
8047 * typemanager.cs (EnumToUnderlying): This function is used to get
8048 the underlying type from an enumeration, because it does not
8051 * constant.cs: Use the I4_S form for values between -128 and 127.
8053 * statement.cs (Block.LookupLabel): Looks up a label.
8054 (Block): Drop support for labeled blocks.
8056 (LabeledStatement): New kind of statement that represents a label
8059 (Goto): Finally implement this bad boy.
8061 * cs-parser.jay: Update to reflect new mechanism to implement
8064 2001-12-30 Miguel de Icaza <miguel@ximian.com>
8066 * codegen.cs (EmitContext.This): a codegen property that keeps the
8067 a single instance of this instead of creating many different this
8070 * delegate.cs (Delegate.DoResolve): Update to use the property;
8072 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8074 * expression.cs (BaseAccess.DoResolve): Ditto.
8076 2001-12-29 Ravi Pratap <ravi@ximian.com>
8078 * typemanager.cs (methodimpl_attr_type): Add to hold the type
8079 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8081 (InitCoreTypes): Update accordingly.
8083 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8084 so we can quickly store the state.
8086 (ApplyAttributes): Set the correct implementation flags
8087 for InternalCall methods.
8089 2001-12-29 Miguel de Icaza <miguel@ximian.com>
8091 * expression.cs (EmitCall): if a method is not virtual, then do
8092 not use callvirt on it.
8094 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8095 user defined stuff) requires the use of stobj, which takes an
8096 address on the stack instead of an array and an index. So emit
8097 the Ldelema operation for it.
8099 (EmitStoreOpcode): Use stobj for valuetypes.
8101 (UnaryMutator.EmitCode): Use the right 1 value depending on
8102 whether we are dealing with int64/uint64, float or doubles.
8104 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8105 constructors that I implemented last night.
8107 (Constructor.IsDefault): Fix to work properly for static
8110 * cs-parser.jay (CheckDef): report method signature errors.
8111 Update error number 103 to be 132.
8113 * decl.cs: New AdditionResult enumeration value: MethodExists.
8114 Although we do this check for methods later on in the semantic
8115 analysis, catching repeated default constructors is so easy that
8116 we catch these here.
8118 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8121 (ParameterReference.EmitAssign, Emit): handle
8124 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8125 (ArrayAccess.EmitStoreOpcode): ditto.
8127 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8129 * expression.cs (MakeByteBlob): Complete all the missing types
8130 (uint, short, ushort, byte, sbyte)
8132 * class.cs: Only init instance field initializers on instance
8135 Rename `constructors' to instance_constructors.
8137 (TypeContainer.AddConstructor): Only add constructors to the list
8138 if it is not static.
8140 Make sure that we handle default_static_constructor independently
8141 everywhere where we handle instance_constructors
8143 2001-12-28 Miguel de Icaza <miguel@ximian.com>
8145 * class.cs: Do not lookup or create a base initializer for a
8148 (ConstructorInitializer.Resolve): use the proper type to lookup
8151 * cs-parser.jay: Report error 1585 (modifiers between type and name).
8153 * enum.cs, interface.cs: Remove CloseType, this is taken care by
8156 * decl.cs: CloseType is now an virtual method, the default
8157 implementation just closes this type.
8159 2001-12-28 Ravi Pratap <ravi@ximian.com>
8161 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8162 to PreserveSig by default. Also emit HideBySig on such methods.
8164 Basically, set the defaults to standard values.
8166 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8167 argument, if candidate is better, it can't be worse than the best !
8169 (Invocation): Re-write bits to differentiate between methods being
8170 applicable in their expanded form and their normal form - for params
8173 Get rid of use_standard everywhere as only standard conversions are allowed
8174 in overload resolution.
8176 More spec conformance.
8178 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8180 * driver.cs: Add --timestamp, to see where the compiler spends
8183 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8184 `this' in static code.
8186 (SimpleName.DoResolve): Implement in terms of a helper function
8187 that allows static-references to be passed upstream to
8190 (Expression.ResolveWithSimpleName): Resolve specially simple
8191 names when called by MemberAccess to implement the special
8194 (Expression.ImplicitReferenceConversion): Handle conversions from
8195 Null to reference types before others, as Null's type is
8198 * expression.cs (Invocation.EmitCall): Handle the special case of
8199 calling methods declared on a reference type from a ValueType
8200 (Base classes System.Object and System.Enum)
8202 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8203 the left hand side is a TypeExpr, not on every enumeration.
8205 (Binary.Resolve): If types are reference types, then do a cast to
8206 object on operators != and == of both arguments.
8208 * typemanager.cs (FindMembers): Extract instance and static
8209 members if requested.
8211 * interface.cs (PopulateProperty): Use void_type instead of null
8212 as the return type for the setter method.
8214 (PopulateIndexer): ditto.
8216 2001-12-27 Ravi Pratap <ravi@ximian.com>
8218 * support.cs (ReflectionParameters): Fix minor bug where we
8219 were examining the wrong parameter for the ParamArray attribute.
8221 Cope with requests for the type of the parameter at position
8222 greater than the params parameter's. We now return the element
8223 type of the params array as that makes more sense.
8225 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8226 accordingly as we no longer have to extract the element type
8229 (Invocation.OverloadResolve): Update.
8231 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8233 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8234 against IEnumerator, test whether the return value is a descendant
8235 of the IEnumerator interface.
8237 * class.cs (Indexer.Define): Use an auxiliary method to implement
8238 the other bits of the method definition. Begin support for
8239 explicit interface implementation.
8241 (Property.DefineMethod): Use TypeManager.void_type instead of null
8242 for an empty return value.
8244 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8246 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8247 dealing with a FieldExpr which is composed of a FieldBuilder, in
8248 the code path we did extract the constant, but we should have
8249 obtained the underlying value to be able to cast it (otherwise we
8250 end up in an infinite loop, this is what Ravi was running into).
8252 (ArrayCreation.UpdateIndices): Arrays might be empty.
8254 (MemberAccess.ResolveMemberAccess): Add support for section
8255 14.5.4.1 that deals with the special case of E.I when E is a type
8256 and something else, that I can be a reference to a static member.
8258 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8259 handle a particular array type to create byte blobs, it is just
8260 something we dont generate byteblobs for.
8262 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8265 * location.cs (Push): remove the key from the hashtable that we
8266 are about to add. This happens for empty files.
8268 * driver.cs: Dispose files after we have parsed them.
8270 (tokenize): new function that only runs the tokenizer on its
8271 input, for speed testing.
8273 2001-12-26 Ravi Pratap <ravi@ximian.com>
8275 * class.cs (Event.Define): Define the private field only if there
8276 are no accessors defined.
8278 * expression.cs (ResolveMemberAccess): If there is no associated
8279 field with the event, that means we have an event defined with its
8280 own accessors and we should flag error cs0070 since transforming
8281 ourselves into a field is not valid in that case.
8283 * ecore.cs (SimpleName.DoResolve): Same as above.
8285 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8286 and charset to sane values.
8288 2001-12-25 Ravi Pratap <ravi@ximian.com>
8290 * assign.cs (DoResolve): Perform check on events only if they
8291 are being accessed outside the declaring type.
8293 * cs-parser.jay (event_declarations): Update rules to correctly
8294 set the type of the implicit parameter etc.
8296 (add_accessor, remove_accessor): Set current local parameters.
8298 * expression.cs (Binary): For delegate addition and subtraction,
8299 cast the return value from the method into the appropriate delegate
8302 2001-12-24 Ravi Pratap <ravi@ximian.com>
8304 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8305 of these as the workaround is unnecessary.
8307 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8308 delegate data - none of that is needed at all.
8310 Re-write bits to extract the instance expression and the delegate method
8313 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8316 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8317 of attaching attributes instead of duplicating code everywhere.
8319 * everywhere : Update code to do attribute emission using the above method.
8321 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8323 * expression.cs (IsParamsMethodApplicable): if there are not
8324 parameters, return immediately.
8326 * ecore.cs: The 0 literal can be implicity converted to an enum
8329 (SimpleName.DoResolve): First lookup the type, then lookup the
8332 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8333 want to get its address. If the InstanceExpression is not
8334 addressable, store the result in a temporary variable, then get
8337 * codegen.cs: Only display 219 errors on warning level or above.
8339 * expression.cs (ArrayAccess): Make it implement the
8340 IMemoryLocation interface.
8342 (Binary.DoResolve): handle the operator == (object a, object b)
8343 and operator != (object a, object b) without incurring into a
8344 BoxedCast (because 5 != o should never be performed).
8346 Handle binary enumerator operators.
8348 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8349 value type, otherwise use Ldelem_ref.
8351 Use precomputed names;
8353 (AddressOf): Implement address of
8355 * cs-parser.jay (labeled_statement): Fix recursive block
8356 addition by reworking the production.
8358 * expression.cs (New.DoEmit): New has a special case:
8360 If we are dealing with a ValueType, we have a few
8361 situations to deal with:
8363 * The target of New is a ValueType variable, that is
8364 easy, we just pass this as the variable reference
8366 * The target of New is being passed as an argument,
8367 to a boxing operation or a function that takes a
8370 In this case, we need to create a temporary variable
8371 that is the argument of New.
8374 2001-12-23 Ravi Pratap <ravi@ximian.com>
8376 * rootcontext.cs (LookupType): Check that current_type is not null before
8377 going about looking at nested types.
8379 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8380 not implement the IAssignMethod interface any more.
8382 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8383 where we tranform them into FieldExprs if they are being resolved from within
8386 * ecore.cs (SimpleName.DoResolve): Do the same here.
8388 * assign.cs (DoResolve, Emit): Clean up code considerably.
8390 * ../errors/bug10.cs : Add.
8392 * ../errors/cs0070.cs : Add.
8394 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8396 * assign.cs : Get rid of EventIsLocal everywhere.
8398 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8400 * ecore.cs (ConvertIntLiteral): finished the implementation.
8402 * statement.cs (SwitchLabel): Convert the value we are using as a
8403 key before looking up the table.
8405 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8407 * codegen.cs (EmitTopBlock): Require a Location argument now.
8409 * cs-parser.jay (constructor_declarator): We need to setup
8410 current_local_parameters before we parse the
8411 opt_constructor_initializer, to allow the variables to be bound
8412 to the constructor arguments.
8414 * rootcontext.cs (LookupType): First lookup nested classes in our
8415 class and our parents before we go looking outside our class.
8417 * expression.cs (ConstantFold): Extract/debox the values at the
8420 * rootcontext.cs (EmitCode): Resolve the constants first before we
8421 resolve the types. This is not really needed, but it helps debugging.
8423 * statement.cs: report location.
8425 * cs-parser.jay: pass location to throw statement.
8427 * driver.cs: Small bug fix.
8429 * report.cs: Updated format to be 4-zero filled digits.
8431 2001-12-22 Ravi Pratap <ravi@ximian.com>
8433 * expression.cs (CheckIndices): Fix minor bug where the wrong
8434 variable was being referred to ;-)
8436 (DoEmit): Do not call EmitStaticInitializers when the
8437 underlying type is System.Object.
8439 2001-12-21 Ravi Pratap <ravi@ximian.com>
8441 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8442 and do the usual workaround for SRE.
8444 * class.cs (MyEventBuilder.EventType): New member to get at the type
8445 of the event, quickly.
8447 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8449 * assign.cs (Assign.DoResolve): Handle the case when the target
8450 is an EventExpr and perform the necessary checks.
8452 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8455 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8457 (EventExpr): Set the type in the constructor itself since we
8458 are meant to be born fully resolved.
8460 (EventExpr.Define): Revert code I wrote earlier.
8462 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8463 instance expression is null. The instance expression is a This in that case
8464 or a null, depending on whether it is a static method or not.
8466 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8467 refers to more than one method.
8469 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8470 and accordingly flag errors.
8472 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8474 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8476 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8478 * location.cs (ToString): Provide useful rutine.
8480 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8482 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8483 objects, return the actual integral boxed.
8485 * statement.cs (SwitchLabel): define an ILLabel for each
8488 (Switch.CheckSwitch): If the value is a Literal, extract
8489 the underlying literal.
8491 Also in the unused hashtable we had, add the SwitchLabel so we can
8492 quickly look this value up.
8494 * constant.cs: Implement a bunch of new constants. Rewrite
8495 Literal based on this. Made changes everywhere to adapt to this.
8497 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8498 dereferencing array only once, and also copes with enumrations.
8500 bytes are two bytes wide, not one.
8502 (Cast): Perform constant conversions.
8504 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8505 wrappers to the literals here.
8507 * expression.cs (DoNumericPromotions): long literals can converted
8508 to ulong implicity (this is taken care of elsewhere, but I was
8511 * ecore.cs (Expression.Literalize): Make the return type Literal,
8512 to improve type checking.
8514 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8516 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8518 * literal.cs: Revert code from ravi that checked the bounds. The
8519 bounds are sane by the definition of the type itself.
8521 * typemanager.cs: Fix implementation of ImplementsInterface. We
8522 need to actually look up in our parent hierarchy for interfaces
8525 * const.cs: Use the underlying type for enumerations
8527 * delegate.cs: Compute the basename for the delegate creation,
8528 that should fix the delegate test case, and restore the correct
8529 Type Lookup semantics in rootcontext
8531 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8532 referencing a nested type with the Reflection API is using the "+"
8535 * cs-parser.jay: Do not require EOF token at the end.
8537 2001-12-20 Ravi Pratap <ravi@ximian.com>
8539 * rootcontext.cs (LookupType): Concatenate type names with
8540 a '.' instead of a '+' The test suite passes again.
8542 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8543 field of the enumeration.
8545 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8546 the case when the member is an EventExpr.
8548 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8549 static has an associated instance expression.
8551 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8553 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8555 * class.cs (Event.Define): Register event and perform appropriate checks
8558 We define the Add and Remove methods even if the use provides none because
8559 in that case, we provide default implementations ourselves.
8561 Define a private field of the type of the event. This is done by the CSC compiler
8562 and we should be doing it too ;-)
8564 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8565 More methods we use in code we generate.
8567 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8570 (InitCoreTypes): Update accordingly for the above.
8572 * class.cs (Event.Emit): Generate code for default accessors that we provide
8574 (EmitDefaultMethod): Do the job in the above.
8576 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8579 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8581 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8582 builders even if we were missing one.
8584 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8585 pass the Basename as our class name instead of the Name. The
8586 basename will be correctly composed for us.
8588 * parameter.cs (Paramters): Now takes a Location argument.
8590 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8591 make all the code call directly LookupType in RootContext and take
8592 this chance to pass the Location information everywhere.
8594 * Everywhere: pass Location information.
8596 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8598 * class.cs (Constructor.Define): Updated way of detecting the
8599 length of the parameters.
8601 (TypeContainer.DefineType): Use basename as the type name for
8604 (TypeContainer.Define): Do not recursively define types here, as
8605 definition is taken care in order by the RootContext.
8607 * tree.cs: Keep track of namespaces in a per-file basis.
8609 * parameter.cs (Parameter.ComputeSignature): Update to use
8612 (Parameters.GetSignature): ditto.
8614 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8615 instead of a TypeContainer.
8617 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8618 resolve names. Because we need to be resolve in our context, not
8621 * driver.cs: Implement response files.
8623 * class.cs (TypeContainer.DefineType): If we are defined, do not
8626 (Event.Emit): Emit the code for add/remove handlers.
8627 (Event.Define): Save the MethodBuilders for add/remove.
8629 * typemanager.cs: Use pair here too.
8631 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8632 DictionaryEntry requires the first argument to be non-null.
8634 (enum_declaration): Compute full name for registering the
8637 (delegate_declaration): Instead of using
8638 formal_parameter_list, use opt_formal_parameter_list as the list
8641 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8642 (EventParsing): New property that controls whether `add' and
8643 `remove' are returned as tokens or identifiers (for events);
8645 2001-12-19 Ravi Pratap <ravi@ximian.com>
8647 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8648 use MyEventBuilder only and let it wrap the real builder for us.
8650 (MyEventBuilder): Revamp constructor etc.
8652 Implement all operations that we perform on EventBuilder in precisely the same
8655 (FindMembers): Update to use the EventBuilder member.
8657 (Event.Emit): Update accordingly.
8659 2001-12-18 Ravi Pratap <ravi@ximian.com>
8661 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8662 by calling the appropriate methods.
8664 (GetCustomAttributes): Make stubs as they cannot possibly do anything
8667 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8669 2001-12-17 Ravi Pratap <ravi@ximian.com>
8671 * delegate.cs (Delegate.Populate): Check that the return type
8672 and various parameters types are indeed accessible.
8674 * class.cs (Constructor.Define): Same here.
8676 (Field.Define): Ditto.
8678 (Event.Define): Ditto.
8680 (Operator.Define): Check that the underlying Method defined itself
8681 correctly - so it's MethodBuilder should not be null.
8683 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8684 expression happens to be null.
8686 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8687 members but as of now we don't seem to be able to do anything really useful with it.
8689 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8690 not the EventBuilder.
8692 2001-12-18 Miguel de Icaza <miguel@ximian.com>
8694 * cs-tokenizer.cs: Add support for defines.
8695 Add support for #if, #elif, #else, #endif
8697 (eval_var): evaluates a variable.
8698 (eval): stubbed for evaluating functions.
8700 * cs-parser.jay: Pass the defines information
8702 * driver.cs: Add --define command line option.
8704 * decl.cs: Move MemberCore here.
8706 Make it the base class for DeclSpace. This allows us to catch and
8707 report 108 and 109 for everything now.
8709 * class.cs (TypeContainer.Define): Extract all the members
8710 before populating and emit the warning 108 (new keyword required
8711 to override) instead of having each member implement this.
8713 (MemberCore.Define): New abstract method, we will be using this in
8714 the warning reporting engine in Populate.
8716 (Operator.Define): Adjust to new MemberCore protocol.
8718 * const.cs (Const): This does not derive from Expression, it is a
8719 temporary object we use to create fields, it is a MemberCore.
8721 * class.cs (Method.Define): Allow the entry point to be in a
8724 * driver.cs: Rewrite the argument handler to clean it up a bit.
8726 * rootcontext.cs: Made it just an auxiliary namespace feature by
8727 making everything static.
8729 * driver.cs: Adapt code to use RootContext type name instead of
8732 * delegate.cs: Remove RootContext argument.
8734 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8737 * class.cs (Event.Define): The lookup can fail.
8739 * cs-tokenizer.cs: Begin implementation of pre-procesor.
8741 * expression.cs: Resolve the this instance before invoking the code.
8743 2001-12-17 Miguel de Icaza <miguel@ximian.com>
8745 * cs-parser.jay: Add a production in element_access that allows
8746 the thing to become a "type" reference. This way we can parse
8747 things like "(string [])" as a type.
8749 Note that this still does not handle the more complex rules of
8753 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
8755 * ecore.cs: (CopyNewMethods): new utility function used to
8756 assemble the list of methods from running FindMembers.
8758 (MemberLookup): Rework FindMembers so that
8760 2001-12-16 Miguel de Icaza <miguel@ximian.com>
8762 * class.cs (TypeContainer): Remove Delegates who fail to be
8765 * delegate.cs (Populate): Verify that we dont get null return
8766 values. TODO: Check for AsAccessible.
8768 * cs-parser.jay: Use basename to emit error 574 (destructor should
8769 have the same name as container class), not the full name.
8771 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8772 possible representation.
8774 Also implements integer type suffixes U and L.
8776 2001-12-15 Miguel de Icaza <miguel@ximian.com>
8778 * expression.cs (ArrayCreation.DoResolve): We need to do the
8779 argument resolution *always*.
8781 * decl.cs: Make this hold the namespace. Hold the root context as
8783 (LookupType): Move here.
8785 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8787 * location.cs (Row, Name): Fixed the code, it was always returning
8788 references to the first file.
8790 * interface.cs: Register properties defined through interfaces.
8792 * driver.cs: Add support for globbing on the command line
8794 * class.cs (Field): Make it derive from MemberCore as well.
8797 2001-12-15 Ravi Pratap <ravi@ximian.com>
8799 * class.cs (Event::Define): Check that the type of the event is a delegate
8800 type else flag error #66.
8802 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8805 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8806 values of EntryPoint, CharSet etc etc.
8808 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8810 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8811 be null and we should ignore this. I am not sure if this is really clean. Apparently,
8812 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8813 which needs this to do its work.
8815 * ../errors/cs0066.cs : Add.
8817 2001-12-14 Miguel de Icaza <miguel@ximian.com>
8819 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8822 * class.cs: (MethodSignature.MethodSignature): Removed hack that
8823 clears out the parameters field.
8824 (MemberSignatureCompare): Cleanup
8826 (MemberCore): New base class used to share code between MethodCore
8829 (RegisterRequiredImplementations) BindingFlags.Public requires
8830 either BindingFlags.Instace or Static. Use instance here.
8832 (Property): Refactored code to cope better with the full spec.
8834 * parameter.cs (GetParameterInfo): Return an empty array instead
8837 * class.cs (Property): Abstract or extern properties have no bodies.
8839 * parameter.cs (GetParameterInfo): return a zero-sized array.
8841 * class.cs (TypeContainer.MethodModifiersValid): Move all the
8842 method modifier validation to the typecontainer so we can reuse
8845 (MethodCore.ParameterTypes): return an empty sized array of types.
8847 (Property.Define): Test property modifier validity.
8849 Add tests for sealed/override too.
8851 (Method.Emit): abstract or extern methods have no bodies.
8853 2001-12-14 Ravi Pratap <ravi@ximian.com>
8855 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8858 (Method::Define, ::Emit): Modify accordingly.
8860 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8862 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8864 * makefile: Pass in /unsafe.
8866 2001-12-13 Miguel de Icaza <miguel@ximian.com>
8868 * class.cs (MakeKey): Kill routine.
8870 * class.cs (TypeContainer.Define): Correctly define explicit
8871 method implementations (they require the full interface name plus
8874 * typemanager.cs: Deply the PtrHashtable here and stop using the
8875 lame keys. Things work so much better.
8877 This of course broke everyone who depended on `RegisterMethod' to
8878 do the `test for existance' test. This has to be done elsewhere.
8880 * support.cs (PtrHashtable): A hashtable that avoid comparing with
8881 the object stupid Equals method (because, that like fails all over
8882 the place). We still do not use it.
8884 * class.cs (TypeContainer.SetRequiredInterface,
8885 TypeContainer.RequireMethods): Killed these two routines and moved
8886 all the functionality to RegisterRequiredImplementations.
8888 (TypeContainer.RegisterRequiredImplementations): This routine now
8889 registers all the implementations required in an array for the
8890 interfaces and abstract methods. We use an array of structures
8891 which can be computed ahead of time to reduce memory usage and we
8892 also assume that lookups are cheap as most classes will not
8893 implement too many interfaces.
8895 We also avoid creating too many MethodSignatures.
8897 (TypeContainer.IsInterfaceMethod): Update and optionally does not
8898 clear the "pending" bit if we find that there are problems with
8901 (TypeContainer.VerifyPendingMethods): Update to report errors of
8902 methods that look like implementations but are not.
8904 (TypeContainer.Define): Add support for explicit interface method
8907 2001-12-12 Miguel de Icaza <miguel@ximian.com>
8909 * typemanager.cs: Keep track of the parameters here instead of
8910 being a feature of the TypeContainer.
8912 * class.cs: Drop the registration of parameters here, as
8913 InterfaceMethods are also interface declarations.
8915 * delegate.cs: Register methods with the TypeManager not only with
8916 the TypeContainer. This code was buggy.
8918 * interface.cs: Full registation here.
8920 2001-12-11 Miguel de Icaza <miguel@ximian.com>
8922 * expression.cs: Remove reducer for binary expressions, it can not
8925 * const.cs: Put here the code that used to go into constant.cs
8927 * constant.cs: Put here the code for constants, this is a new base
8930 * literal.cs: Make Literal derive from Constant.
8932 2001-12-09 Miguel de Icaza <miguel@ximian.com>
8934 * statement.cs (Return.Emit): Report error 157 if the user
8935 attempts to return from a finally block.
8937 (Return.Emit): Instead of emitting a return, jump to the end of
8940 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
8941 LocalBuilder to store the result of the function. ReturnLabel is
8942 the target where we jump.
8945 2001-12-09 Radek Doulik <rodo@ximian.com>
8947 * cs-parser.jay: remember alias in current namespace
8949 * ecore.cs (SimpleName::DoResolve): use aliases for types or
8952 * class.cs (LookupAlias): lookup alias in my_namespace
8954 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
8956 (LookupAlias): lookup alias in this and if needed in parent
8959 2001-12-08 Miguel de Icaza <miguel@ximian.com>
8963 * rootcontext.cs: (ModuleBuilder) Made static, first step into
8964 making things static. I need this to avoid passing the
8965 TypeContainer when calling ParameterType.
8967 * support.cs (InternalParameters.ParameterType): Remove ugly hack
8968 that did string manipulation to compute the type and then call
8969 GetType. Use Parameter.ParameterType instead.
8971 * cs-tokenizer.cs: Consume the suffix for floating values.
8973 * expression.cs (ParameterReference): figure out whether this is a
8974 reference parameter or not. Kill an extra variable by computing
8975 the arg_idx during emission.
8977 * parameter.cs (Parameters.GetParameterInfo): New overloaded
8978 function that returns whether a parameter is an out/ref value or not.
8980 (Parameter.ParameterType): The type of the parameter (base,
8981 without ref/out applied).
8983 (Parameter.Resolve): Perform resolution here.
8984 (Parameter.ExternalType): The full type (with ref/out applied).
8986 * statement.cs (Using.Emit, Using.EmitExpression): Implement
8987 support for expressions on the using statement.
8989 2001-12-07 Miguel de Icaza <miguel@ximian.com>
8991 * statement.cs (Using.EmitLocalVariableDecls): Split the
8992 localvariable handling of the using statement.
8994 (Block.EmitMeta): Keep track of variable count across blocks. We
8995 were reusing slots on separate branches of blocks.
8997 (Try.Emit): Emit the general code block, we were not emitting it.
8999 Check the type of the declaration to be an IDisposable or
9000 something that can be implicity converted to it.
9002 Emit conversions if required.
9004 * ecore.cs (EmptyExpression): New utility class.
9005 (Expression.ImplicitConversionExists): New utility function.
9007 2001-12-06 Miguel de Icaza <miguel@ximian.com>
9009 * statement.cs (Using): Implement.
9011 * expression.cs (LocalVariableReference): Support read only variables.
9013 * statement.cs: Remove the explicit emit for the Leave opcode.
9014 (VariableInfo): Add a readonly field.
9016 2001-12-05 Miguel de Icaza <miguel@ximian.com>
9018 * ecore.cs (ConvCast): new class used to encapsulate the various
9019 explicit integer conversions that works in both checked and
9022 (Expression.ConvertNumericExplicit): Use new ConvCast class to
9023 properly generate the overflow opcodes.
9025 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9027 * statement.cs: The correct type for the EmptyExpression is the
9028 element_type, not the variable type. Ravi pointed this out.
9030 2001-12-04 Ravi Pratap <ravi@ximian.com>
9032 * class.cs (Method::Define): Handle PInvoke methods specially
9033 by using DefinePInvokeMethod instead of the usual one.
9035 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9036 above to do the task of extracting information and defining the method.
9038 2001-12-04 Ravi Pratap <ravi@ximian.com>
9040 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9041 of the condition for string type.
9043 (Emit): Move that here.
9045 (ArrayCreation::CheckIndices): Keep string literals in their expression
9048 (EmitDynamicInitializers): Handle strings appropriately.
9050 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9052 * codegen.cs (EmitContext): Replace multiple variables with a
9053 single pointer to the current Switch statement.
9055 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9058 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9062 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9065 (Foreach.Emit): Foreach on arrays was not setting
9066 up the loop variables (for break/continue).
9068 (GotoCase): Semi-implented.
9070 2001-12-03 Ravi Pratap <ravi@ximian.com>
9072 * attribute.cs (CheckAttribute): Handle system attributes by using
9073 Attribute.GetAttributes to examine information we need.
9075 (GetValidPlaces): Same here.
9077 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9079 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9081 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9083 (Method::Define): Set appropriate flags if we have a DllImport attribute.
9085 (Method::Emit): Handle the case when we are a PInvoke method.
9087 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9089 * expression.cs: Use ResolveWithSimpleName on compound names.
9091 2001-12-02 Ravi Pratap <ravi@ximian.com>
9093 * constant.cs (EmitConstant): Make sure we resolve the associated expression
9094 before trying to reduce it.
9096 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9098 * constant.cs (LookupConstantValue): Implement.
9100 (EmitConstant): Use the above in emitting the constant.
9102 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9103 that are user-defined by doing a LookupConstantValue on them.
9105 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9108 2001-11-29 Miguel de Icaza <miguel@ximian.com>
9110 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9112 (BaseAccess.DoResolve): Implement.
9114 (MemberAccess.DoResolve): Split this routine into a
9115 ResolveMemberAccess routine that can be used independently
9117 2001-11-28 Miguel de Icaza <miguel@ximian.com>
9119 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9120 As that share bits of the implementation. Is returns a boolean,
9121 while As returns the Type that is being probed.
9123 2001-12-01 Ravi Pratap <ravi@ximian.com>
9125 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9126 instead of a Literal - much easier.
9128 (EnumInTransit): Remove - utterly useless :-)
9130 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9132 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9134 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9135 chain when we have no associated expression.
9137 2001-11-30 Ravi Pratap <ravi@ximian.com>
9139 * constant.cs (Define): Use Location while reporting the errror.
9141 Also emit a warning when 'new' is used and there is no inherited
9144 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
9147 (LookupEnumValue): Implement to lookup an enum member's value and define it
9150 (Populate): Re-write accordingly to use the above routine.
9152 2001-11-27 Miguel de Icaza <miguel@ximian.com>
9154 * expression.cs (This): Fix prototype for DoResolveLValue to
9155 override the base class DoResolveLValue.
9157 * cs-parser.cs: Report errors cs574 and cs575 (destructor
9160 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9161 (we need to load the address of the field here). This fixes
9164 (FieldExpr.DoResolveLValue): Call the DoResolve
9165 function to initialize the Instance expression.
9167 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9168 correctly the GetEnumerator operation on a value type.
9170 * cs-parser.jay: Add more simple parsing error catches.
9172 * statement.cs (Switch): Add support for string switches.
9173 Handle null specially.
9175 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
9177 2001-11-28 Ravi Pratap <ravi@ximian.com>
9179 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9181 (declare_local_constant): New helper function.
9183 * statement.cs (AddConstant): Keep a separate record of constants
9185 (IsConstant): Implement to determine if a variable is a constant.
9187 (GetConstantExpression): Implement.
9189 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9191 * statement.cs (IsVariableDefined): Re-write.
9193 2001-11-27 Ravi Pratap <ravi@ximian.com>
9195 * class.cs (TypeContainer::FindMembers): Look for constants
9196 in the case when we are looking for MemberTypes.Field
9198 * expression.cs (MemberAccess::DoResolve): Check that in the
9199 case we are a FieldExpr and a Literal, we are not being accessed
9200 by an instance reference.
9202 * cs-parser.jay (local_constant_declaration): Implement.
9204 (declaration_statement): Implement for constant declarations.
9206 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9208 * statement.cs (Switch): Catch double defaults.
9210 (Switch): More work on the switch() statement
9211 implementation. It works for integral values now, need to finish
9215 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9217 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9218 integer literals into other integer literals. To be used by
9221 2001-11-24 Ravi Pratap <ravi@ximian.com>
9223 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9226 (EmitDynamicInitializers): Cope with the above since we extract data
9227 directly from ArrayData now.
9229 (ExpectInitializers): Keep track of whether initializers are mandatory
9232 (Bounds): Make it a hashtable to prevent the same dimension being
9233 recorded for every element in that dimension.
9235 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9238 Also fix bug which was causing the indices to be emitted in the reverse
9241 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9243 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9244 unfinished. They do not work, because the underlying code is
9247 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9249 * cs-parser.jay: Remove bogus fixme.
9251 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9252 on Switch statement.
9254 2001-11-23 Ravi Pratap <ravi@ximian.com>
9256 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9259 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9260 parameter. Apparently, any expression is allowed.
9262 (ValidateInitializers): Update accordingly.
9264 (CheckIndices): Fix some tricky bugs thanks to recursion.
9266 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9267 I was being completely brain-dead.
9269 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9270 and re-write acordingly.
9272 (DelegateInvocation): Re-write accordingly.
9274 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9276 (MakeByteBlob): Handle types more correctly.
9278 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9279 initialization from expressions but it is incomplete because I am a complete
9282 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9284 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9285 on If. Basically, we have to return `true' (ie, we do return to
9286 our caller) only if both branches of the if return.
9288 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9289 short-circuit operators, handle them as short circuit operators.
9291 (Cast.DoResolve): Resolve type.
9292 (Cast.Cast): Take an expression as the target type.
9294 * cs-parser.jay (cast_expression): Remove old hack that only
9295 allowed a limited set of types to be handled. Now we take a
9296 unary_expression and we resolve to a type during semantic
9299 Use the grammar productions from Rhys to handle casts (this is
9300 not complete like Rhys syntax yet, we fail to handle that corner
9301 case that C# has regarding (-x), but we will get there.
9303 2001-11-22 Ravi Pratap <ravi@ximian.com>
9305 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9306 field which is an array type.
9308 * cs-parser.jay (declare_local_variables): Support array initialization too.
9310 * typemanager.cs (MakeKey): Implement.
9312 (everywhere): Use the above appropriately.
9314 * cs-parser.jay (for_statement): Update for array initialization while
9315 declaring variables.
9317 * ecore.cs : The error message was correct, it's the variable's names that
9318 were misleading ;-) Make the code more readable.
9320 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9321 the correct type etc.
9323 (ConvertExplicit): Handle Enum types by examining the underlying type.
9325 2001-11-21 Ravi Pratap <ravi@ximian.com>
9327 * parameter.cs (GetCallingConvention): Always return
9328 CallingConventions.Standard for now.
9330 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9332 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9333 and `r' after calling DoNumericPromotions.
9335 * ecore.cs: Fix error message (the types were in the wrong order).
9337 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9338 BindingFlags.Instance as well
9340 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9341 implicit int literal conversion in an empty cast so that we
9342 propagate the right type upstream.
9344 (UnboxCast): new class used to unbox value types.
9345 (Expression.ConvertExplicit): Add explicit type conversions done
9348 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9349 the target type before applying the implicit LongLiterals to ULong
9352 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9354 * cs-parser.jay (for_statement): Reworked the way For works: now
9355 we declare manually any variables that are introduced in
9356 for_initializer to solve the problem of having out-of-band code
9357 emition (that is what got for broken).
9359 (declaration_statement): Perform the actual variable declaration
9360 that used to be done in local_variable_declaration here.
9362 (local_variable_declaration): Do not declare anything, just pass
9363 the information on a DictionaryEntry
9365 2001-11-20 Ravi Pratap <ravi@ximian.com>
9367 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9368 re-write of the logic to now make it recursive.
9370 (UpdateIndices): Re-write accordingly.
9372 Store element data in a separate ArrayData list in the above methods.
9374 (MakeByteBlob): Implement to dump the array data into a byte array.
9376 2001-11-19 Ravi Pratap <ravi@ximian.com>
9378 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9381 * constant.cs (Define): Implement.
9383 (EmitConstant): Re-write fully.
9385 Pass in location info.
9387 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9390 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9391 DictionaryEntry since we need location info too.
9393 (constant_declaration): Update accordingly.
9395 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9396 code into another method : UpdateIndices.
9398 2001-11-18 Ravi Pratap <ravi@ximian.com>
9400 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9401 some type checking etc.
9403 2001-11-17 Ravi Pratap <ravi@ximian.com>
9405 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9406 bits to provide dimension info if the user skips doing that.
9408 Update second constructor to store the rank correctly.
9410 2001-11-16 Ravi Pratap <ravi@ximian.com>
9412 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9413 and try to implement.
9415 * ../errors/cs0150.cs : Add.
9417 * ../errors/cs0178.cs : Add.
9419 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9421 * statement.cs: Implement foreach on multi-dimensional arrays.
9423 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9424 name of the params argument.
9426 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9427 initializing the array.
9429 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9430 we can use this elsewhere.
9432 * statement.cs: Finish implementation of foreach for single
9435 * cs-parser.jay: Use an out-of-band stack to pass information
9436 around, I wonder why I need this.
9438 foreach_block: Make the new foreach_block the current_block.
9440 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9441 function used to return a static Parameters structure. Used for
9442 empty parameters, as those are created very frequently.
9444 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9446 2001-11-15 Ravi Pratap <ravi@ximian.com>
9448 * interface.cs : Default modifier is private, not public. The
9449 make verify test passes again.
9451 2001-11-15 Ravi Pratap <ravi@ximian.com>
9453 * support.cs (ReflectionParameters): Fix logic to determine
9454 whether the last parameter is a params one. Test 9 passes again.
9456 * delegate.cs (Populate): Register the builders we define with
9457 RegisterParameterForBuilder. Test 19 passes again.
9459 * cs-parser.jay (property_declaration): Reference $6 instead
9460 of $$ to get at the location.
9462 (indexer_declaration): Similar stuff.
9466 * class.cs (Property): Register parameters for the Get and Set methods
9467 if they exist. Test 23 passes again.
9469 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9470 call to EmitArguments as we are sure there aren't any params arguments.
9471 Test 32 passes again.
9473 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9474 IndexOutOfRangeException.
9476 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9477 Test 33 now passes again.
9479 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9481 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9482 broke a bunch of things. Will have to come up with a better way
9483 of tracking locations.
9485 * statement.cs: Implemented foreach for single dimension arrays.
9487 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9489 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9490 an error. This removes the lookup from the critical path.
9492 * cs-parser.jay: Removed use of temporary_loc, which is completely
9495 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9497 * support.cs (ReflectionParameters.ParameterModifier): Report
9498 whether the argument is a PARAMS argument or not.
9500 * class.cs: Set the attribute `ParamArrayAttribute' on the
9503 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9504 and cons_param_array_attribute (ConstructorInfo for
9505 ParamArrayAttribute).,
9507 * codegen.cs: Emit the return using the `Return' statement, that
9508 way we can report the error correctly for missing return values.
9510 * class.cs (Method.Emit): Clean up.
9512 * expression.cs (Argument.Resolve): Take another argument: the
9513 location where this argument is used. Notice that this is not
9514 part of the "Argument" class as to reduce the size of the
9515 structure (we know the approximate location anyways).
9517 Test if the argument is a variable-reference, if not, then
9518 complain with a 206.
9520 (Argument.Emit): Emit addresses of variables.
9522 (Argument.FullDesc): Simplify.
9524 (Invocation.DoResolve): Update for Argument.Resolve.
9526 (ElementAccess.DoResolve): ditto.
9528 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9529 method should be virtual, as this method is always virtual.
9531 (NewDelegate.DoResolve): Update for Argument.Resolve.
9533 * class.cs (ConstructorInitializer.DoResolve): ditto.
9535 * attribute.cs (Attribute.Resolve): ditto.
9537 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9539 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9541 * expression.cs (ParameterReference): Drop IStackStorage and implement
9542 IAssignMethod instead.
9544 (LocalVariableReference): ditto.
9546 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9547 IAssignMethod instead.
9549 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9551 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9552 enumerations that are used in heavily used structures derive from
9553 byte in a laughable and pathetic attempt to reduce memory usage.
9554 This is the kind of pre-optimzations that you should not do at
9555 home without adult supervision.
9557 * expression.cs (UnaryMutator): New class, used to handle ++ and
9558 -- separatedly from the other unary operators. Cleans up the
9559 code, and kills the ExpressionStatement dependency in Unary.
9561 (Unary): Removed `method' and `Arguments' from this class, making
9562 it smaller, and moving it all to SimpleCall, so I can reuse this
9563 code in other locations and avoid creating a lot of transient data
9564 strucutres when not required.
9566 * cs-parser.jay: Adjust for new changes.
9568 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9570 * enum.cs (Enum.Populate): If there is a failure during
9573 * cs-parser.jay (opt_enum_base): we used to catch type errors
9574 here, but this is really incorrect. The type error should be
9575 catched during semantic analysis.
9577 2001-12-11 Ravi Pratap <ravi@ximian.com>
9579 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9580 current_local_parameters as expected since I, in my stupidity, had forgotten
9583 * attribute.cs (GetValidPlaces): Fix stupid bug.
9585 * class.cs (Method::Emit): Perform check on applicability of attributes.
9587 (Constructor::Emit): Ditto.
9589 (Field::Emit): Ditto.
9591 (Field.Location): Store location information.
9593 (Property, Event, Indexer, Operator): Ditto.
9595 * cs-parser.jay (field_declaration): Pass in location for each field.
9597 * ../errors/cs0592.cs : Add.
9599 2001-11-12 Ravi Pratap <ravi@ximian.com>
9601 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9603 (InitCoreTypes): Update accordingly.
9605 (RegisterAttrType, LookupAttr): Implement.
9607 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9608 info about the same.
9610 (Resolve): Update to populate the above as necessary.
9614 (GetValidPlaces): Helper to the above.
9616 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9618 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9620 2001-11-12 Ravi Pratap <ravi@ximian.com>
9622 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9624 * ../errors/cs0617.cs : Add.
9626 2001-11-11 Ravi Pratap <ravi@ximian.com>
9628 * enum.cs (Emit): Rename to Populate to be more consistent with what
9629 we expect it to do and when exactly it is called.
9631 * class.cs, rootcontext.cs : Update accordingly.
9633 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9634 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9636 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9638 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9639 of a fieldinfo using the above, when dealing with a FieldBuilder.
9641 2001-11-10 Ravi Pratap <ravi@ximian.com>
9643 * ../errors/cs0031.cs : Add.
9645 * ../errors/cs1008.cs : Add.
9647 * ../errrors/cs0543.cs : Add.
9649 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9652 (FindMembers): Implement.
9654 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9655 enums and delegates too.
9657 (enum_types): Rename to builder_to_enum.
9659 (delegate_types): Rename to builder_to_delegate.
9661 * delegate.cs (FindMembers): Implement.
9663 2001-11-09 Ravi Pratap <ravi@ximian.com>
9665 * typemanager.cs (IsEnumType): Implement.
9667 * enum.cs (Emit): Re-write parts to account for the underlying type
9668 better and perform checking etc.
9670 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9671 of the underlying type.
9673 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9676 * enum.cs (error31): Helper to report error #31.
9678 * cs-parser.jay (enum_declaration): Store location of each member too.
9680 * enum.cs (member_to_location): New hashtable.
9682 (AddEnumMember): Update location hashtable.
9684 (Emit): Use the location of each member while reporting errors.
9686 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9688 * cs-parser.jay: A for_initializer if is a
9689 local_variable_declaration really ammount to have an implicit
9690 block with the variable declaration and no initializer for for.
9692 * statement.cs (For.Emit): Cope with null initializers.
9694 This fixes the infinite loop on for initializers.
9696 2001-11-08 Miguel de Icaza <miguel@ximian.com>
9698 * enum.cs: More cleanup.
9700 * ecore.cs: Remove dead code.
9702 * class.cs (Property.Emit): More simplification.
9703 (Event.Emit): ditto.
9705 Reworked to have less levels of indentation.
9707 2001-11-08 Ravi Pratap <ravi@ximian.com>
9709 * class.cs (Property): Emit attributes.
9719 * enum.cs (Emit): Ditto.
9721 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9724 * class.cs (Field, Event, etc.): Move attribute generation into the
9725 Emit method everywhere.
9727 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9728 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9729 as we had no way of defining nested enums !
9731 * rootcontext.cs : Adjust code accordingly.
9733 * typemanager.cs (AddEnumType): To keep track of enum types separately.
9735 2001-11-07 Ravi Pratap <ravi@ximian.com>
9737 * expression.cs (EvalConstantExpression): Move into ecore.cs
9739 * enum.cs (Enum): Rename some members and make them public and readonly
9740 according to our convention.
9742 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9745 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9747 (Enum::Emit): Write a simple version for now which doesn't try to compute
9748 expressions. I shall modify this to be more robust in just a while.
9750 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9752 (TypeContainer::CloseType): Create the Enum types too.
9754 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9756 * expression.cs (EvalConstantExpression): Get rid of completely.
9758 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9759 user-defined values and other cases.
9761 (IsValidEnumLiteral): Helper function.
9763 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
9764 out there in the case we had a literal FieldExpr.
9766 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9768 (Literalize): Revamp a bit to take two arguments.
9770 (EnumLiteral): New class which derives from Literal to wrap enum literals.
9772 2001-11-06 Ravi Pratap <ravi@ximian.com>
9774 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9776 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9778 (Resolve): Use the above to ensure we have proper initializers.
9780 2001-11-05 Ravi Pratap <ravi@ximian.com>
9782 * expression.cs (Expression::EvalConstantExpression): New method to
9783 evaluate constant expressions.
9785 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9787 2001-11-07 Miguel de Icaza <miguel@ximian.com>
9789 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9792 (Binary.ResolveOperator): Handle operator != (object a, object b)
9793 and operator == (object a, object b);
9795 (Binary.DoNumericPromotions): Indicate whether the numeric
9796 promotion was possible.
9798 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9801 Made the ArrayAccess implement interface IAssignMethod instead of
9802 IStackStore as the order in which arguments are passed reflects
9805 * assign.cs: Instead of using expr.ExprClass to select the way of
9806 assinging, probe for the IStackStore/IAssignMethod interfaces.
9808 * typemanager.cs: Load InitializeArray definition.
9810 * rootcontext.cs (RootContext.MakeStaticData): Used to define
9811 static data that can be used to initialize arrays.
9813 2001-11-05 Miguel de Icaza <miguel@ximian.com>
9815 * expression.cs: Handle operator== and operator!= for booleans.
9817 (Conditioal.Reduce): Implement reducer for the ?: operator.
9819 (Conditional.Resolve): Implement dead code elimination.
9821 (Binary.Resolve): Catch string literals and return a new
9822 concatenated string.
9824 (Unary.Reduce): Implement reduction of unary expressions.
9826 * ecore.cs: Split out the expression core handling here.
9828 (Expression.Reduce): New method used to perform constant folding
9829 and CSE. This is needed to support constant-expressions.
9831 * statement.cs (Statement.EmitBoolExpression): Pass true and false
9832 targets, and optimize for !x.
9834 2001-11-04 Ravi Pratap <ravi@ximian.com>
9836 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9837 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9838 set custom atttributes.
9840 * literal.cs (Literal::GetValue): New abstract method to return the actual
9841 value of the literal, cast as an object.
9843 (*Literal): Implement GetValue method.
9845 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9846 expressions to the arraylist but objects of type Argument.
9848 * class.cs (TypeContainer::Emit): Emit our attributes too.
9850 (Method::Emit, Constructor::Emit): Ditto.
9852 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9853 to be ignoring earlier.
9855 2001-11-03 Ravi Pratap <ravi@ximian.com>
9857 * attribute.cs (AttributeSection::Define): Implement to do the business
9858 of constructing a CustomAttributeBuilder.
9860 (Attribute): New trivial class. Increases readability of code.
9862 * cs-parser.jay : Update accordingly.
9864 (positional_argument_list, named_argument_list, named_argument): New rules
9866 (attribute_arguments): Use the above so that we are more correct.
9868 2001-11-02 Ravi Pratap <ravi@ximian.com>
9870 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9871 to perform all checks for a method with a params parameter.
9873 (Invocation::OverloadResolve): Update to use the above method and therefore
9874 cope correctly with params method invocations.
9876 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
9879 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9880 constructors in our parent too because we can't afford to miss out on
9883 * attribute.cs (AttributeSection): New name for the class Attribute
9885 Other trivial changes to improve readability.
9887 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
9888 use the new class names.
9890 2001-11-01 Ravi Pratap <ravi@ximian.com>
9892 * class.cs (Method::Define): Complete definition for params types too
9894 (Indexer::Define): Ditto.
9896 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
9897 Cope everywhere with a request for info about the array parameter.
9899 2001-11-01 Ravi Pratap <ravi@ximian.com>
9901 * tree.cs (RecordNamespace): Fix up to check for the correct key.
9903 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
9904 local_variable_type to extract the string corresponding to the type.
9906 (local_variable_type): Fixup the action to use the new helper method.
9908 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
9911 * expression.cs : Clean out code which uses the above.
9913 2001-10-31 Ravi Pratap <ravi@ximian.com>
9915 * typemanager.cs (RegisterMethod): Check if we already have an existing key
9916 and bale out if necessary by returning a false.
9918 (RegisterProperty): Ditto.
9920 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
9921 and print out appropriate error messages.
9923 * interface.cs (everywhere): Ditto.
9925 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
9926 location to constructor.
9928 * class.cs (Property, Event, Indexer): Update accordingly.
9930 * ../errors/cs111.cs : Added.
9932 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
9933 of a method, as laid down by the spec.
9935 (Invocation::OverloadResolve): Use the above method.
9937 2001-10-31 Ravi Pratap <ravi@ximian.com>
9939 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
9940 now take a TypeContainer and a Parameters object.
9942 (ParameterData): Modify return type of ParameterModifier method to be
9943 Parameter.Modifier and not a string.
9945 (ReflectionParameters, InternalParameters): Update accordingly.
9947 * expression.cs (Argument::GetParameterModifier): Same here.
9949 * support.cs (InternalParameters::ParameterType): Find a better way of determining
9950 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
9951 symbol in it at all so maybe this is only for now.
9953 2001-10-30 Ravi Pratap <ravi@ximian.com>
9955 * support.cs (InternalParameters): Constructor now takes an extra argument
9956 which is the actual Parameters class.
9958 (ParameterDesc): Update to provide info on ref/out modifiers.
9960 * class.cs (everywhere): Update call to InternalParameters to pass in
9961 the second argument too.
9963 * support.cs (ParameterData): Add ParameterModifier, which is a method
9964 to return the modifier info [ref/out etc]
9966 (InternalParameters, ReflectionParameters): Implement the above.
9968 * expression.cs (Argument::ParameterModifier): Similar function to return
9969 info about the argument's modifiers.
9971 (Invocation::OverloadResolve): Update to take into account matching modifiers
9974 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9975 a new SetFormalParameters object which we pass to InternalParameters.
9977 2001-10-30 Ravi Pratap <ravi@ximian.com>
9979 * expression.cs (NewArray): Merge into the ArrayCreation class.
9981 2001-10-29 Ravi Pratap <ravi@ximian.com>
9983 * expression.cs (NewArray): Merge classes NewBuiltinArray and
9984 NewUserdefinedArray into one as there wasn't much of a use in having
9987 * expression.cs (Argument): Change field's name to ArgType from Type.
9989 (Type): New readonly property which returns the proper type, taking into
9990 account ref/out modifiers.
9992 (everywhere): Adjust code accordingly for the above.
9994 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9995 whether we are emitting for a ref or out parameter.
9997 * expression.cs (Argument::Emit): Use the above field to set the state.
9999 (LocalVariableReference::Emit): Update to honour the flag and emit the
10002 * parameter.cs (Attributes): Set the correct flags for ref parameters.
10004 * expression.cs (Argument::FullDesc): New function to provide a full desc.
10006 * support.cs (ParameterData): Add method ParameterDesc to the interface.
10008 (ReflectionParameters, InternalParameters): Implement the above method.
10010 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10013 (Invocation::FullMethodDesc): Ditto.
10015 2001-10-29 Miguel de Icaza <miguel@ximian.com>
10017 * cs-parser.jay: Add extra production for the second form of array
10020 * expression.cs (ArrayCreation): Update to reflect the above
10023 * Small changes to prepare for Array initialization.
10025 2001-10-28 Miguel de Icaza <miguel@ximian.com>
10027 * typemanager.cs (ImplementsInterface): interface might be null;
10028 Deal with this problem;
10030 Also, we do store negative hits on the cache (null values), so use
10031 this instead of calling t.GetInterfaces on the type everytime.
10033 2001-10-28 Ravi Pratap <ravi@ximian.com>
10035 * typemanager.cs (IsBuiltinType): New method to help determine the same.
10037 * expression.cs (New::DoResolve): Get rid of array creation code and instead
10038 split functionality out into different classes.
10040 (New::FormArrayType): Move into NewBuiltinArray.
10042 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10045 (NewBuiltinArray): New class to handle creation of built-in arrays.
10047 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10048 account creation of one-dimensional arrays.
10050 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10052 (NewUserdefinedArray::DoResolve): Implement.
10054 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10056 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10057 we maintain inside the TypeManager. This is necessary to perform lookups on the
10060 (LookupType): Update to perform GetType on the module builders too.
10062 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10064 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10066 2001-10-23 Ravi Pratap <ravi@ximian.com>
10068 * expression.cs (New::DoResolve): Implement guts of array creation.
10070 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10072 2001-10-27 Miguel de Icaza <miguel@ximian.com>
10074 * expression.cs: Fix bug I introduced lsat night that broke
10077 (Expression.Resolve): Report a 246 error (can not resolve name)
10078 if we find a SimpleName in the stream.
10080 (Expression.ResolveLValue): Ditto.
10082 (Expression.ResolveWithSimpleName): This function is a variant of
10083 ResolveName, this one allows SimpleNames to be returned without a
10084 warning. The only consumer of SimpleNames is MemberAccess
10086 2001-10-26 Miguel de Icaza <miguel@ximian.com>
10088 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10089 might arrive here. I have my doubts that this is correct.
10091 * statement.cs (Lock): Implement lock statement.
10093 * cs-parser.jay: Small fixes to support `lock' and `using'
10095 * cs-tokenizer.cs: Remove extra space
10097 * driver.cs: New flag --checked, allows to turn on integer math
10100 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10101 Threading.Monitor.Exit
10103 2001-10-23 Miguel de Icaza <miguel@ximian.com>
10105 * expression.cs (IndexerAccess::DoResolveLValue): Set the
10106 Expression Class to be IndexerAccess.
10108 Notice that Indexer::DoResolve sets the eclass to Value.
10110 2001-10-22 Miguel de Icaza <miguel@ximian.com>
10112 * class.cs (TypeContainer::Emit): Emit code for indexers.
10114 * assign.cs (IAssignMethod): New interface implemented by Indexers
10115 and Properties for handling assignment.
10117 (Assign::Emit): Simplify and reuse code.
10119 * expression.cs (IndexerAccess, PropertyExpr): Implement
10120 IAssignMethod, clean up old code.
10122 2001-10-22 Ravi Pratap <ravi@ximian.com>
10124 * typemanager.cs (ImplementsInterface): New method to determine if a type
10125 implements a given interface. Provides a nice cache too.
10127 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10130 (ConvertReferenceExplicit): Ditto.
10132 * delegate.cs (Delegate::Populate): Update to define the parameters on the
10133 various methods, with correct names etc.
10135 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
10136 Operator.UnaryNegation.
10138 * cs-parser.jay (operator_declarator): Be a little clever in the case where
10139 we have a unary plus or minus operator.
10141 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
10144 * everywhere : update accordingly.
10146 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10149 * class.cs (Method::Define): For the case where we are implementing a method
10150 inherited from an interface, we need to set the MethodAttributes.Final flag too.
10151 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10153 2001-10-21 Ravi Pratap <ravi@ximian.com>
10155 * interface.cs (FindMembers): Implement to work around S.R.E
10158 * typemanager.cs (IsInterfaceType): Implement.
10160 (FindMembers): Update to handle interface types too.
10162 * expression.cs (ImplicitReferenceConversion): Re-write bits which
10163 use IsAssignableFrom as that is not correct - it doesn't work.
10165 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10166 and accordingly override EmitStatement.
10168 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10169 using the correct logic :-)
10171 2001-10-19 Ravi Pratap <ravi@ximian.com>
10173 * ../errors/cs-11.cs : Add to demonstrate error -11
10175 2001-10-17 Miguel de Icaza <miguel@ximian.com>
10177 * assign.cs (Assign::Resolve): Resolve right hand side first, and
10178 then pass this as a hint to ResolveLValue.
10180 * expression.cs (FieldExpr): Add Location information
10182 (FieldExpr::LValueResolve): Report assignment to readonly
10185 (Expression::ExprClassFromMemberInfo): Pass location information.
10187 (Expression::ResolveLValue): Add new method that resolves an
10190 (Expression::DoResolveLValue): Default invocation calls
10193 (Indexers): New class used to keep track of indexers in a given
10196 (IStackStore): Renamed from LValue, as it did not really describe
10197 what this did. Also ResolveLValue is gone from this interface and
10198 now is part of Expression.
10200 (ElementAccess): Depending on the element access type
10202 * typemanager.cs: Add `indexer_name_type' as a Core type
10203 (System.Runtime.CompilerServices.IndexerNameAttribute)
10205 * statement.cs (Goto): Take a location.
10207 2001-10-18 Ravi Pratap <ravi@ximian.com>
10209 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10210 if two delegates are compatible.
10212 (NewDelegate::DoResolve): Update to take care of the case when
10213 we instantiate a delegate from another delegate.
10215 * typemanager.cs (FindMembers): Don't even try to look up members
10216 of Delegate types for now.
10218 2001-10-18 Ravi Pratap <ravi@ximian.com>
10220 * delegate.cs (NewDelegate): New class to take care of delegate
10223 * expression.cs (New): Split the delegate related code out into
10224 the NewDelegate class.
10226 * delegate.cs (DelegateInvocation): New class to handle delegate
10229 * expression.cs (Invocation): Split out delegate related code into
10230 the DelegateInvocation class.
10232 2001-10-17 Ravi Pratap <ravi@ximian.com>
10234 * expression.cs (New::DoResolve): Implement delegate creation fully
10235 and according to the spec.
10237 (New::DoEmit): Update to handle delegates differently.
10239 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10240 because of which we were printing out arguments in reverse order !
10242 * delegate.cs (VerifyMethod): Implement to check if the given method
10243 matches the delegate.
10245 (FullDelegateDesc): Implement.
10247 (VerifyApplicability): Implement.
10249 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10250 delegate invocations too.
10252 (Invocation::Emit): Ditto.
10254 * ../errors/cs1593.cs : Added.
10256 * ../errors/cs1594.cs : Added.
10258 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10260 2001-10-16 Ravi Pratap <ravi@ximian.com>
10262 * typemanager.cs (intptr_type): Core type for System.IntPtr
10264 (InitCoreTypes): Update for the same.
10266 (iasyncresult_type, asynccallback_type): Ditto.
10268 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10271 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10274 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10275 the builders for the 4 members of a delegate type :-)
10277 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10280 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10282 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10284 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10286 * statement.cs (Break::Emit): Implement.
10287 (Continue::Emit): Implement.
10289 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10290 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10291 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10292 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10295 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10296 properties that track the label for the current loop (begin of the
10297 loop and end of the loop).
10299 2001-10-15 Ravi Pratap <ravi@ximian.com>
10301 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10302 use of emitting anything at all.
10304 * class.cs, rootcontext.cs : Get rid of calls to the same.
10306 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10308 (Populate): Define the constructor correctly and set the implementation
10311 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10314 (AddDelegateType): Implement.
10316 (IsDelegateType): Implement helper method.
10318 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10320 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10321 and accordingly handle it.
10323 * delegate.cs (Populate): Take TypeContainer argument.
10324 Implement bits to define the Invoke method. However, I still haven't figured out
10325 how to take care of the native int bit :-(
10327 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10328 Qualify the name of the delegate, not its return type !
10330 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10333 (StandardConversionExists): Checking for array types turns out to be recursive.
10335 (ConvertReferenceExplicit): Implement array conversion.
10337 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10339 2001-10-12 Ravi Pratap <ravi@ximian.com>
10341 * cs-parser.jay (delegate_declaration): Store the fully qualified
10342 name as it is a type declaration.
10344 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10347 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10348 as TypeContainer::DefineType.
10350 (Populate): Method in which all the definition of the various methods (Invoke)
10353 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10356 (CloseDelegate): Finally creates the delegate.
10358 * class.cs (TypeContainer::DefineType): Update to define delegates.
10359 (Populate, Emit and CloseType): Do the same thing here too.
10361 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10362 delegates in all these operations.
10364 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10366 * expression.cs: LocalTemporary: a new expression used to
10367 reference a temporary that has been created.
10369 * assign.cs: Handle PropertyAccess back here, so that we can
10370 provide the proper semantic access to properties.
10372 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10373 a few more explicit conversions.
10375 * modifiers.cs: `NEW' modifier maps to HideBySig.
10377 * expression.cs (PropertyExpr): Make this into an
10378 ExpressionStatement, and support the EmitStatement code path.
10380 Perform get/set error checking, clean up the interface.
10382 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10383 them into toplevel access objects.
10385 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10387 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10390 * typemanager.cs: Keep track here of our PropertyBuilders again to
10391 work around lameness in SRE.
10393 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10395 * expression.cs (LValue::LValueResolve): New method in the
10396 interface, used to perform a second resolution pass for LValues.
10398 (This::DoResolve): Catch the use of this in static methods.
10400 (This::LValueResolve): Implement.
10402 (This::Store): Remove warning, assigning to `this' in structures
10405 (Invocation::Emit): Deal with invocation of
10406 methods on value types. We need to pass the address to structure
10407 methods rather than the object itself. (The equivalent code to
10408 emit "this" for structures leaves the entire structure on the
10409 stack instead of a pointer to it).
10411 (ParameterReference::DoResolve): Compute the real index for the
10412 argument based on whether the method takes or not a `this' pointer
10413 (ie, the method is static).
10415 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10416 value types returned from functions when we need to invoke a
10417 method on the sturcture.
10420 2001-10-11 Ravi Pratap <ravi@ximian.com>
10422 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10423 defining the type in the Modulebuilder or Typebuilder. This is to take
10424 care of nested types which need to be defined on the TypeBuilder using
10425 DefineNestedMethod.
10427 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10428 methods in RootContext, only ported to be part of TypeContainer.
10430 (TypeContainer::GetInterfaceOrClass): Ditto.
10432 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10434 * interface.cs (Interface::DefineInterface): New method. Does exactly
10435 what RootContext.CreateInterface did earlier, only it takes care of nested types
10438 (Interface::GetInterfaces): Move from RootContext here and port.
10440 (Interface::GetInterfaceByName): Same here.
10442 * rootcontext.cs (ResolveTree): Re-write.
10444 (PopulateTypes): Re-write.
10446 * class.cs (TypeContainer::Populate): Populate nested types too.
10447 (TypeContainer::Emit): Emit nested members too.
10449 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10450 instead just use the name argument passed in as it is already fully
10453 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10454 to TypeContainer mapping to see if a type is user-defined.
10456 * class.cs (TypeContainer::CloseType): Implement.
10458 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10459 the default constructor.
10461 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10464 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10466 * interface.cs (CloseType): Create the type here.
10468 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10471 Remove all the methods which are now in TypeContainer.
10473 2001-10-10 Ravi Pratap <ravi@ximian.com>
10475 * delegate.cs (Define): Re-write bits to define the delegate
10478 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10480 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10482 * expression.cs (ImplicitReferenceConversion): handle null as well
10483 as a source to convert to any reference type.
10485 * statement.cs (Return): Perform any implicit conversions to
10486 expected return type.
10488 Validate use of return statement.
10490 * codegen.cs (EmitContext): Pass the expected return type here.
10492 * class.cs (Method, Constructor, Property): Pass expected return
10493 type to EmitContext.
10495 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10497 * expression.cs: Make DoResolve take an EmitContext instead of a
10500 Replaced `l' and `location' for `loc', for consistency.
10502 (Error, Warning): Remove unneeded Tc argument.
10504 * assign.cs, literal.cs, constant.cs: Update to new calling
10507 * codegen.cs: EmitContext now contains a flag indicating whether
10508 code is being generated in a static method or not.
10510 * cs-parser.jay: DecomposeQI, new function that replaces the old
10511 QualifiedIdentifier. Now we always decompose the assembled
10512 strings from qualified_identifier productions into a group of
10515 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10517 * rootcontext.cs: Deal with field-less struct types correctly now
10518 by passing the size option to Define Type.
10520 * class.cs: Removed hack that created one static field.
10522 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10524 * statement.cs: Moved most of the code generation here.
10526 2001-10-09 Ravi Pratap <ravi@ximian.com>
10528 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10531 (ElementAccess): Remove useless bits for now - keep checks as the spec
10534 2001-10-08 Ravi Pratap <ravi@ximian.com>
10536 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10537 and start performing checks according to the spec.
10539 2001-10-07 Ravi Pratap <ravi@ximian.com>
10541 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10542 rank_specifiers instead.
10544 (rank_specifiers): Change the order in which the rank specifiers are stored
10546 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10548 * expression.cs (ElementAccess): Implement the LValue interface too.
10550 2001-10-06 Ravi Pratap <ravi@ximian.com>
10552 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10553 except that user defined conversions are not included.
10555 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10556 perform the conversion of the return type, if necessary.
10558 (New::DoResolve): Check whether we are creating an array or an object
10559 and accordingly do the needful.
10561 (New::Emit): Same here.
10563 (New::DoResolve): Implement guts of array creation.
10565 (New::FormLookupType): Helper function.
10567 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10569 * codegen.cs: Removed most of the code generation here, and move the
10570 corresponding code generation bits to the statement classes.
10572 Added support for try/catch/finalize and throw.
10574 * cs-parser.jay: Added support for try/catch/finalize.
10576 * class.cs: Catch static methods having the flags override,
10577 virtual or abstract.
10579 * expression.cs (UserCast): This user cast was not really doing
10580 what it was supposed to do. Which is to be born in fully resolved
10581 state. Parts of the resolution were being performed at Emit time!
10585 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10587 * expression.cs: Implicity convert the result from UserCast.
10589 2001-10-05 Ravi Pratap <ravi@ximian.com>
10591 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10592 prevented it from working correctly.
10594 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10595 merely ConvertImplicit.
10597 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10599 * typemanager.cs: Make the LookupTypeContainer function static,
10600 and not per-instance.
10602 * class.cs: Make static FindMembers (the one that takes a Type
10605 * codegen.cs: Add EmitForeach here.
10607 * cs-parser.jay: Make foreach a toplevel object instead of the
10608 inline expansion, as we need to perform semantic analysis on it.
10610 2001-10-05 Ravi Pratap <ravi@ximian.com>
10612 * expression.cs (Expression::ImplicitUserConversion): Rename to
10613 UserDefinedConversion.
10615 (Expression::UserDefinedConversion): Take an extra argument specifying
10616 whether we look for explicit user conversions too.
10618 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10620 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10622 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10623 with the appropriate arguments.
10625 * cs-parser.jay (cast_expression): Record location too.
10627 * expression.cs (Cast): Record location info.
10629 (Expression::ConvertExplicit): Take location argument.
10631 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10632 to determine if we are doing explicit conversions.
10634 (UserCast::Emit): Update accordingly.
10636 (Expression::ConvertExplicit): Report an error if everything fails.
10638 * ../errors/cs0030.cs : Add.
10640 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10642 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10643 virtual and newslot bits.
10645 * class.cs (TypeContainer::RegisterRequiredImplementations):
10646 Record methods we need.
10648 (TypeContainer::MakeKey): Helper function to make keys for
10649 MethodBases, since the Methodbase key is useless.
10651 (TypeContainer::Populate): Call RegisterRequiredImplementations
10652 before defining the methods.
10654 Create a mapping for method_builders_to_methods ahead of time
10655 instead of inside a tight loop.
10657 (::RequireMethods): Accept an object as the data to set into the
10658 hashtable so we can report interface vs abstract method mismatch.
10660 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10662 * report.cs: Make all of it static.
10664 * rootcontext.cs: Drop object_type and value_type computations, as
10665 we have those in the TypeManager anyways.
10667 Drop report instance variable too, now it is a global.
10669 * driver.cs: Use try/catch on command line handling.
10671 Add --probe option to debug the error reporting system with a test
10674 * report.cs: Add support for exiting program when a probe
10675 condition is reached.
10677 2001-10-03 Ravi Pratap <ravi@ximian.com>
10679 * expression.cs (Binary::DoNumericPromotions): Fix the case when
10680 we do a forcible conversion regardless of type, to check if
10681 ForceConversion returns a null.
10683 (Binary::error19): Use location to report error.
10685 (Unary::error23): Use location here too.
10687 * ../errors/cs0019.cs : Check in.
10689 * ../errors/cs0023.cs : Check in.
10691 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10692 case of a non-null MethodInfo object with a length of 0 !
10694 (Binary::ResolveOperator): Flag error if overload resolution fails to find
10695 an applicable member - according to the spec :-)
10696 Also fix logic to find members in base types.
10698 (Unary::ResolveOperator): Same here.
10700 (Unary::report23): Change name to error23 and make first argument a TypeContainer
10701 as I was getting thoroughly confused between this and error19 :-)
10703 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10704 (::FindMostEncompassedType): Implement.
10705 (::FindMostEncompassingType): Implement.
10706 (::StandardConversionExists): Implement.
10708 (UserImplicitCast): Re-vamp. We now need info about most specific
10709 source and target types so that we can do the necessary conversions.
10711 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10712 mathematical union with no duplicates.
10714 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10716 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10717 in order from base classes to child classes, so that we can in
10718 child classes look up in our parent for method names and
10719 attributes (required for handling abstract, virtual, new, override
10720 constructs: we need to instrospect our base class, and if we dont
10721 populate the classes in order, the introspection might be
10722 incorrect. For example, a method could query its parent before
10723 the parent has any methods and would determine that the parent has
10724 no abstract methods (while it could have had them)).
10726 (RootContext::CreateType): Record the order in which we define the
10729 2001-10-02 Miguel de Icaza <miguel@ximian.com>
10731 * class.cs (TypeContainer::Populate): Also method definitions can
10732 fail now, keep track of this.
10734 (TypeContainer::FindMembers): Implement support for
10735 DeclaredOnly/noDeclaredOnly flag.
10737 (Constructor::Emit) Return the ConstructorBuilder.
10739 (Method::Emit) Return the MethodBuilder.
10740 Check for abstract or virtual methods to be public.
10742 * rootcontext.cs (RootContext::CreateType): Register all the
10743 abstract methods required for the class to be complete and the
10744 interface methods that must be implemented.
10746 * cs-parser.jay: Report error 501 (method requires body if it is
10747 not marked abstract or extern).
10749 * expression.cs (TypeOf::Emit): Implement.
10751 * typemanager.cs: runtime_handle_type, new global type.
10753 * class.cs (Property::Emit): Generate code for properties.
10755 2001-10-02 Ravi Pratap <ravi@ximian.com>
10757 * expression.cs (Unary::ResolveOperator): Find operators on base type
10758 too - we now conform exactly to the spec.
10760 (Binary::ResolveOperator): Same here.
10762 * class.cs (Operator::Define): Fix minor quirk in the tests.
10764 * ../errors/cs0215.cs : Added.
10766 * ../errors/cs0556.cs : Added.
10768 * ../errors/cs0555.cs : Added.
10770 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10772 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10773 single integer which is really efficient
10775 2001-10-01 Ravi Pratap <ravi@ximian.com>
10777 * expression.cs (Expression::ImplicitUserConversion): Use location
10778 even in the case when we are examining True operators.
10780 * class.cs (Operator::Define): Perform extensive checks to conform
10781 with the rules for operator overloading in the spec.
10783 * expression.cs (Expression::ImplicitReferenceConversion): Implement
10784 some of the other conversions mentioned in the spec.
10786 * typemanager.cs (array_type): New static member for the System.Array built-in
10789 (cloneable_interface): For System.ICloneable interface.
10791 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10792 we start resolving the tree and populating types.
10794 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10796 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10798 * expression.cs (Expression::ExprClassFromMemberInfo,
10799 Expression::Literalize): Create literal expressions from
10800 FieldInfos which are literals.
10802 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10803 type casts, because they were wrong. The test suite in tests
10806 (ImplicitNumericConversion): ushort to ulong requires a widening
10809 Int32 constant to long requires widening cast as well.
10811 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10812 for integers because the type on the stack is not i4.
10814 2001-09-30 Miguel de Icaza <miguel@ximian.com>
10816 * expression.cs (report118): require location argument.
10818 * parameter.cs: Do not dereference potential null value.
10820 * class.cs: Catch methods that lack the `new' keyword when
10821 overriding a name. Report warnings when `new' is used without
10822 anything being there to override.
10824 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10826 * class.cs: Only add constructor to hashtable if it is non-null
10827 (as now constructors can fail on define).
10829 (TypeManager, Class, Struct): Take location arguments.
10831 Catch field instance initialization in structs as errors.
10833 accepting_filter: a new filter for FindMembers that is static so
10834 that we dont create an instance per invocation.
10836 (Constructor::Define): Catch errors where a struct constructor is
10839 * cs-parser.jay: Pass location information for various new
10842 * delegate.cs (Delegate): take a location argument.
10844 * driver.cs: Do not call EmitCode if there were problesm in the
10845 Definition of the types, as many Builders wont be there.
10847 * decl.cs (Decl::Decl): Require a location argument.
10849 * cs-tokenizer.cs: Handle properly hex constants that can not fit
10850 into integers, and find the most appropiate integer for it.
10852 * literal.cs: Implement ULongLiteral.
10854 * rootcontext.cs: Provide better information about the location of
10855 failure when CreateType fails.
10857 2001-09-29 Miguel de Icaza <miguel@ximian.com>
10859 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10862 * expression.cs (Binary::CheckShiftArguments): Add missing type
10864 (Binary::ResolveOperator): Add type to the logical and and logical
10865 or, Bitwise And/Or and Exclusive Or code paths, it was missing
10868 (Binary::DoNumericPromotions): In the case where either argument
10869 is ulong (and most signed types combined with ulong cause an
10870 error) perform implicit integer constant conversions as well.
10872 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10874 * expression.cs (UserImplicitCast): Method should always be
10876 (Invocation::BetterConversion): Simplified test for IntLiteral.
10878 (Expression::ImplicitNumericConversion): Split this routine out.
10879 Put the code that performs implicit constant integer conversions
10882 (Expression::Resolve): Become a wrapper around DoResolve so we can
10883 check eclass and type being set after resolve.
10885 (Invocation::Badness): Remove this dead function
10887 (Binary::ResolveOperator): Do not compute the expensive argumnets
10888 unless we have a union for it.
10890 (Probe::Emit): Is needs to do an isinst and then
10891 compare against null.
10893 (::CanConvert): Added Location argument. If the Location argument
10894 is null (Location.Null), then we do not report errors. This is
10895 used by the `probe' mechanism of the Explicit conversion. We do
10896 not want to generate an error for something that the user
10897 explicitly requested to be casted. But the pipeline for an
10898 explicit cast first tests for potential implicit casts.
10900 So for now, if the Location is null, it means `Probe only' to
10901 avoid adding another argument. Might have to revise this
10904 (ClassCast): New class used to type cast objects into arbitrary
10905 classes (used in Explicit Reference Conversions).
10907 Implement `as' as well.
10909 Reverted all the patches from Ravi below: they were broken:
10911 * The use of `level' as a mechanism to stop recursive
10912 invocations is wrong. That was there just to catch the
10913 bug with a strack trace but not as a way of addressing
10916 To fix the problem we have to *understand* what is going
10917 on and the interactions and come up with a plan, not
10918 just get things going.
10920 * The use of the type conversion cache that I proposed
10921 last night had an open topic: How does this work across
10922 protection domains. A user defined conversion might not
10923 be public in the location where we are applying the
10924 conversion, a different conversion might be selected
10925 (ie, private A->B (better) but public B->A (worse),
10926 inside A, A->B applies, but outside it, B->A will
10929 * On top of that (ie, even if the above is solved),
10930 conversions in a cache need to be abstract. Ie, `To
10931 convert from an Int to a Short use an OpcodeCast', not
10932 `To convert from an Int to a Short use the OpcodeCast on
10933 the variable 5' (which is what this patch was doing).
10935 2001-09-28 Ravi Pratap <ravi@ximian.com>
10937 * expression.cs (Invocation::ConversionExists): Re-write to use
10938 the conversion cache
10940 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
10941 cache all conversions done, not just user-defined ones.
10943 (Invocation::BetterConversion): The real culprit. Use ConversionExists
10944 to determine if a conversion exists instead of acutually trying to
10945 perform the conversion. It's faster too.
10947 (Expression::ConvertExplicit): Modify to use ConversionExists to check
10948 and only then attempt the implicit conversion.
10950 2001-09-28 Ravi Pratap <ravi@ximian.com>
10952 * expression.cs (ConvertImplicit): Use a cache for conversions
10953 already found. Check level of recursion and bail out if necessary.
10955 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10957 * typemanager.cs (string_concat_string_string, string_concat_object_object):
10958 Export standard methods that we expect for string operations.
10960 * statement.cs (Block::UsageWarning): Track usage of variables and
10961 report the errors for not used variables.
10963 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
10966 2001-09-27 Miguel de Icaza <miguel@ximian.com>
10968 * codegen.cs: remove unnneded code
10970 * expression.cs: Removed BuiltinTypeAccess class
10972 Fix the order in which implicit conversions are
10975 The previous fixed dropped support for boxed conversions (adding a
10976 test to the test suite now)
10978 (UserImplicitCast::CanConvert): Remove test for source being null,
10979 that code is broken. We should not feed a null to begin with, if
10980 we do, then we should track the bug where the problem originates
10981 and not try to cover it up here.
10983 Return a resolved expression of type UserImplicitCast on success
10984 rather than true/false. Ravi: this is what I was talking about,
10985 the pattern is to use a static method as a "constructor" for
10988 Also, do not create arguments until the very last minute,
10989 otherwise we always create the arguments even for lookups that
10990 will never be performed.
10992 (UserImplicitCast::Resolve): Eliminate, objects of type
10993 UserImplicitCast are born in a fully resolved state.
10995 * typemanager.cs (InitCoreTypes): Init also value_type
10996 (System.ValueType).
10998 * expression.cs (Cast::Resolve): First resolve the child expression.
11000 (LValue): Add new method AddressOf to be used by
11003 Change the argument of Store to take an EmitContext instead of an
11004 ILGenerator, because things like FieldExpr need to be able to call
11005 their children expression to generate the instance code.
11007 (Expression::Error, Expression::Warning): Sugar functions for
11010 (Expression::MemberLookup): Accept a TypeContainer instead of a
11011 Report as the first argument.
11013 (Expression::ResolvePrimary): Killed. I still want to improve
11014 this as currently the code is just not right.
11016 (Expression::ResolveMemberAccess): Simplify, but it is still
11019 (Unary::Resolve): Catch errors in AddressOf operators.
11021 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11022 index to a byte for the short-version, or the compiler will choose
11023 the wrong Emit call, which generates the wrong data.
11025 (ParameterReference::Emit, ::Store): same.
11027 (FieldExpr::AddressOf): Implement.
11029 * typemanager.cs: TypeManager: made public variable instead of
11032 * driver.cs: document --fatal.
11034 * report.cs (ErrorMessage, WarningMessage): new names for the old
11035 Error and Warning classes.
11037 * cs-parser.jay (member_access): Turn built-in access to types
11038 into a normal simplename
11040 2001-09-27 Ravi Pratap <ravi@ximian.com>
11042 * expression.cs (Invocation::BetterConversion): Fix to cope
11043 with q being null, since this was introducing a bug.
11045 * expression.cs (ConvertImplicit): Do built-in conversions first.
11047 2001-09-27 Ravi Pratap <ravi@ximian.com>
11049 * expression.cs (UserImplicitCast::Resolve): Fix bug.
11051 2001-09-27 Ravi Pratap <ravi@ximian.com>
11053 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11054 I had introduced long ago (what's new ?).
11056 * expression.cs (UserImplicitCast::CanConvert): Static method to do
11057 the work of all the checking.
11058 (ConvertImplicit): Call CanConvert and only then create object if necessary.
11059 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11061 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11062 that is the right way.
11064 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
11065 overloading resolution. Use everywhere instead of cutting and pasting code.
11067 (Binary::ResolveOperator): Use MakeUnionSet.
11069 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
11070 we have to convert to bool types. Not complete yet.
11072 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11074 * typemanager.cs (TypeManager::CSharpName): support ushort.
11076 * expression.cs (Expression::TryImplicitIntConversion): Attempts
11077 to provide an expression that performsn an implicit constant int
11078 conversion (section 6.1.6).
11079 (Expression::ConvertImplicitRequired): Reworked to include
11080 implicit constant expression conversions.
11082 (Expression::ConvertNumericExplicit): Finished.
11084 (Invocation::Emit): If InstanceExpression is null, then it means
11085 that we perform a call on this.
11087 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11089 * expression.cs (Unary::Emit): Remove some dead code.
11090 (Probe): Implement Resolve and Emit for `is'.
11091 (Expression::ConvertImplicitRequired): Attempt to do constant
11092 expression conversions here. Maybe should be moved to
11093 ConvertImplicit, but I am not sure.
11094 (Expression::ImplicitLongConstantConversionPossible,
11095 Expression::ImplicitIntConstantConversionPossible): New functions
11096 that tell whether is it possible to apply an implicit constant
11097 expression conversion.
11099 (ConvertNumericExplicit): Started work on explicit numeric
11102 * cs-parser.jay: Update operator constants.
11104 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11105 (Parameters::GetSignature): Hook up VerifyArgs here.
11106 (Parameters::VerifyArgs): Verifies that no two arguments have the
11109 * class.cs (Operator): Update the operator names to reflect the
11110 ones that the spec expects (as we are just stringizing the
11113 * expression.cs (Unary::ResolveOperator): Fix bug: Use
11114 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11115 previous usage did only work for our methods.
11116 (Expression::ConvertImplicit): Handle decimal implicit numeric
11117 conversions as well.
11118 (Expression::InternalTypeConstructor): Used to invoke constructors
11119 on internal types for default promotions.
11121 (Unary::Emit): Implement special handling for the pre/post
11122 increment/decrement for overloaded operators, as they need to have
11123 the same semantics as the other operators.
11125 (Binary::ResolveOperator): ditto.
11126 (Invocation::ConversionExists): ditto.
11127 (UserImplicitCast::Resolve): ditto.
11129 2001-09-26 Ravi Pratap <ravi@ximian.com>
11131 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11132 operator, return after emitting body. Regression tests pass again !
11134 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11135 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11136 (Invocation::OverloadResolve): Ditto.
11137 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11139 * everywhere : update calls to the above methods accordingly.
11141 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11143 * assign.cs (Assign): Make it inherit from ExpressionStatement.
11145 * expression.cs (ExpressionStatement): New base class used for
11146 expressions that can appear in statements, so that we can provide
11147 an alternate path to generate expression that do not leave a value
11150 (Expression::Emit, and all the derivatives): We no longer return
11151 whether a value is left on the stack or not. Every expression
11152 after being emitted leaves a single value on the stack.
11154 * codegen.cs (EmitContext::EmitStatementExpression): Use the
11155 facilties of ExpressionStatement if possible.
11157 * cs-parser.jay: Update statement_expression.
11159 2001-09-25 Miguel de Icaza <miguel@ximian.com>
11161 * driver.cs: Change the wording of message
11163 2001-09-25 Ravi Pratap <ravi@ximian.com>
11165 * expression.cs (Binary::ResolveOperator): Had forgottten to set
11166 the type of the expression to the return type of the method if
11167 we have an overloaded operator match ! The regression tests pass again !
11168 (Unary::ResolveOperator): Ditto.
11170 * expression.cs (Invocation::ConversionExists): Correct the member lookup
11171 to find "op_Implicit", not "implicit" ;-)
11172 (UserImplicitCast): New class to take care of user-defined implicit conversions.
11173 (ConvertImplicit, ForceConversion): Take TypeContainer argument
11175 * everywhere : Correct calls to the above accordingly.
11177 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11178 (ConvertImplicit): Do user-defined conversion if it exists.
11180 2001-09-24 Miguel de Icaza <miguel@ximian.com>
11182 * assign.cs: track location.
11183 (Resolve): Use implicit conversions on assignment.
11185 * literal.cs: Oops. Not good, Emit of short access values should
11186 pass (Bytes) or the wrong argument will be selected.
11188 * expression.cs (Unary::Emit): Emit code for -expr.
11190 (Unary::ResolveOperator): Handle `Substract' for non-constants
11191 (substract from zero from the non-constants).
11192 Deal with Doubles as well.
11194 (Expression::ConvertImplicitRequired): New routine that reports an
11195 error if no implicit conversion exists.
11197 (Invocation::OverloadResolve): Store the converted implicit
11198 expressions if we make them
11200 2001-09-24 Ravi Pratap <ravi@ximian.com>
11202 * class.cs (ConstructorInitializer): Take a Location argument.
11203 (ConstructorBaseInitializer): Same here.
11204 (ConstructorThisInitializer): Same here.
11206 * cs-parser.jay : Update all calls accordingly.
11208 * expression.cs (Unary, Binary, New): Take location argument.
11209 Update accordingly everywhere.
11211 * cs-parser.jay : Update all calls to the above to take a location
11214 * class.cs : Ditto.
11216 2001-09-24 Ravi Pratap <ravi@ximian.com>
11218 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11219 (Invocation::BetterConversion): Same here
11220 (Invocation::ConversionExists): Ditto.
11222 (Invocation::ConversionExists): Implement.
11224 2001-09-22 Ravi Pratap <ravi@ximian.com>
11226 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11227 Also take an additional TypeContainer argument.
11229 * All over : Pass in TypeContainer as argument to OverloadResolve.
11231 * typemanager.cs (CSharpName): Update to check for the string type and return
11234 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11237 2001-09-21 Ravi Pratap <ravi@ximian.com>
11239 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11240 (Invocation::BetterFunction): Implement.
11241 (Invocation::BetterConversion): Implement.
11242 (Invocation::ConversionExists): Skeleton, no implementation yet.
11244 Okay, things work fine !
11246 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11248 * typemanager.cs: declare and load enum_type, delegate_type and
11251 * expression.cs (Expression::Emit): Now emit returns a value that
11252 tells whether a value is left on the stack or not. This strategy
11253 might be reveted tomorrow with a mechanism that would address
11254 multiple assignments.
11255 (Expression::report118): Utility routine to report mismatches on
11258 (Unary::Report23): Report impossible type/operator combination
11261 (Unary::IsIncrementableNumber): Whether the type can be
11262 incremented or decremented with add.
11263 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11265 (Unary::ResolveOperator): Implement ++, !, ~,
11267 (Invocation::Emit): Deal with new Emit convetion.
11269 * All Expression derivatives: Updated their Emit method to return
11270 whether they leave values on the stack or not.
11272 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11273 stack for expressions that are statements.
11275 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11277 * expression.cs (LValue): New interface. Must be implemented by
11279 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11282 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11283 interface for generating code, simplifies the code.
11285 2001-09-20 Ravi Pratap <ravi@ximian.com>
11287 * expression.cs (everywhere): Comment out return statements in ::Resolve
11288 methods to avoid the warnings.
11290 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11292 * driver.cs (parse): Report error 2001 if we can not open the
11295 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11298 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11301 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11302 otherwise nested blocks end up with the same index.
11304 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11306 * expression.cs: Instead of having FIXMEs in the Resolve
11307 functions, throw exceptions so it is obvious that we are facing a
11310 * cs-parser.jay (invocation_expression): Pass Location information.
11312 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11313 Use a basename for those routines because .NET does not like paths
11316 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11319 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11321 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11322 are loading the correct data types (throws an exception if not).
11323 (TypeManager::InitCoreTypes): Use CoreLookupType
11325 * expression.cs (Unary::ResolveOperator): return the child
11326 expression for expressions which are just +expr.
11327 (Unary::ResolveOperator): Return negative literals for -LITERAL
11328 expressions (otherwise they are Unary {Literal}).
11329 (Invocation::Badness): Take into account `Implicit constant
11330 expression conversions'.
11332 * literal.cs (LongLiteral): Implement long literal class.
11333 (IntLiteral): export the `Value' of the intliteral.
11335 2001-09-19 Ravi Pratap <ravi@ximian.com>
11337 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11339 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11340 instead of 'Operator'
11342 * expression.cs (Binary::ResolveOperator): Update accordingly.
11343 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11346 * cs-parser.jay (unary_expression): Update to use the new names.
11348 * gen-treedump.cs (GetUnary): Same here.
11350 * expression.cs (Unary::Resolve): Implement.
11351 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11352 operators are found instead of making noise ;-)
11353 (Unary::ResolveOperator): New method to do precisely the same thing which
11354 Binary::ResolveOperator does for Binary expressions.
11355 (Unary.method, .Arguments): Add.
11356 (Unary::OperName): Implement.
11357 (Unary::ForceConversion): Copy and Paste !
11359 * class.cs (Operator::Define): Fix a small bug for the case when we have
11362 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11363 for the inbuilt operators. Only overloading works for now ;-)
11365 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11367 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11368 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11370 * expression.cs (This::Emit): Implement.
11371 (This::Resolve): Implement.
11372 (TypeOf:Resolve): Implement.
11373 (Expression::ResolveSimpleName): Add an implicit this to instance
11375 (MemberAccess::Resolve): Deal with Parameters and Fields.
11376 Bind instance variable to Field expressions.
11377 (FieldExpr::Instance): New field used to track the expression that
11378 represents the object instance.
11379 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11381 (FieldExpr::Emit): Implement.
11383 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11384 the last instruction contains a return opcode to avoid generating
11385 the last `ret' instruction (this generates correct code, and it is
11386 nice to pass the peverify output).
11388 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11389 initializer for static and instance variables.
11390 (Constructor::Emit): Allow initializer to be null in the case of
11391 static constructors. Only emit initializer for instance
11394 (TypeContainer::FindMembers): Return a null array if there are no
11397 Also fix the code for the MemberTypes.Method branch, as it was not
11398 scanning that for operators (or tried to access null variables before).
11400 * assign.cs (Assign::Emit): Handle instance and static fields.
11404 * driver.cs: Stop compilation if there are parse errors.
11406 * cs-parser.jay (constructor_declaration): Provide default base
11407 initializer for non-static constructors.
11408 (constructor_declarator): Do not provide a default base
11409 initializers if none was specified.
11410 Catch the fact that constructors should not have parameters.
11412 * class.cs: Do not emit parent class initializers for static
11413 constructors, that should be flagged as an error.
11415 2001-09-18 Ravi Pratap <ravi@ximian.com>
11417 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11418 Move back code into TypeContainer::Populate.
11420 2001-09-18 Ravi Pratap <ravi@ximian.com>
11422 * class.cs (TypeContainer::AddConstructor): Fix the check to
11423 compare against Name, not Basename.
11424 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11426 * cs-parser.jay : Update accordingly.
11428 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11429 for methods, don't forget to look into the operators too.
11430 (RegisterMethodBuilder): Helper method to take care of this for
11431 methods, constructors and operators.
11432 (Operator::Define): Completely revamp.
11433 (Operator.OperatorMethod, MethodName): New fields.
11434 (TypeContainer::Populate): Move the registering of builders into
11435 RegisterMethodBuilder.
11436 (Operator::Emit): Re-write.
11438 * expression.cs (Binary::Emit): Comment out code path to emit method
11439 invocation stuff for the case when we have a user defined operator. I am
11440 just not able to get it right !
11442 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11444 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11447 (Expression::MemberLookup): Provide a version that allows to
11448 specify the MemberTypes and BindingFlags.
11450 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11451 so it was not fetching variable information from outer blocks.
11453 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11454 Beforefieldinit as it was buggy.
11456 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11457 that Ravi put here.
11459 * class.cs (Constructor::Emit): Only emit if block is not null.
11460 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11461 deal with this by semantically definining it as if the user had
11464 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11465 constructors as we now "emit" them at a higher level.
11467 (TypeContainer::DefineDefaultConstructor): Used to define the
11468 default constructors if none was provided.
11470 (ConstructorInitializer): Add methods Resolve and Emit.
11472 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11474 2001-09-17 Ravi Pratap <ravi@ximian.com>
11476 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11477 the default constructor builder with our hashtable for methodbuilders
11480 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11481 and argument_count is 0 in which case we have a match.
11482 (Binary::ResolveOperator): More null checking and miscellaneous coding
11485 2001-09-17 Ravi Pratap <ravi@ximian.com>
11487 * rootcontext.cs (IsNameSpace): Compare against null.
11489 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11491 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11492 and Unary::Operator.
11494 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11497 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11498 we have overloaded operators.
11499 (Binary::ResolveOperator): Implement the part which does the operator overload
11502 * class.cs (Operator::Emit): Implement.
11503 (TypeContainer::Emit): Emit the operators we have too.
11505 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11506 the case when we have a user-defined operator.
11508 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11510 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11512 2001-09-16 Ravi Pratap <ravi@ximian.com>
11514 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11515 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11516 (Constructor::Emit): Implement.
11517 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11518 if we have no work to do.
11519 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11522 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11523 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11525 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11528 2001-09-15 Ravi Pratap <ravi@ximian.com>
11530 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11532 (Tree::RecordNamespace): Method to do what the name says ;-)
11533 (Tree::Namespaces): Property to get at the namespaces hashtable.
11535 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11538 * rootcontext.cs (IsNamespace): Fixed it :-)
11540 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11542 * class.cs (TypeContainer::FindMembers): Add support for
11544 (MethodCore): New class that encapsulates both the shared aspects
11545 of a Constructor and a Method.
11546 (Method, Constructor): Factored pieces into MethodCore.
11548 * driver.cs: Added --fatal which makes errors throw exceptions.
11549 Load System assembly as well as part of the standard library.
11551 * report.cs: Allow throwing exceptions on errors for debugging.
11553 * modifiers.cs: Do not use `parent', instead use the real type
11554 container to evaluate permission settings.
11556 * class.cs: Put Ravi's patch back in. He is right, and we will
11557 have to cope with the
11559 2001-09-14 Ravi Pratap <ravi@ximian.com>
11561 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11562 FamORAssem, not FamANDAssem.
11564 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11566 * driver.cs: Added --parse option that only parses its input files
11569 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11570 incorrect. IsTopLevel is not used to tell whether an object is
11571 root_types or not (that can be achieved by testing this ==
11572 root_types). But to see if this is a top-level *class* (not
11573 necessarly our "toplevel" container).
11575 2001-09-14 Ravi Pratap <ravi@ximian.com>
11577 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11578 parent instead of a direct call to GetType.
11580 2001-09-14 Ravi Pratap <ravi@ximian.com>
11582 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11583 Modifiers.TypeAttr. This should just be a call to that method.
11585 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11586 object so that we can determine if we are top-level or not.
11588 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11591 * enum.cs (Enum::Define): Ditto.
11593 * modifiers.cs (FieldAttr): Re-write.
11595 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11596 (TypeContainer::HaveStaticConstructor): New property to provide access
11597 to precisely that info.
11599 * modifiers.cs (MethodAttr): Re-write.
11600 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11602 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11603 of top-level types as claimed.
11605 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11607 * expression.cs (MemberLookup): Fruitless attempt to lookup
11608 constructors. Maybe I need to emit default constructors? That
11609 might be it (currently .NET emits this for me automatically).
11610 (Invocation::OverloadResolve): Cope with Arguments == null.
11611 (Invocation::EmitArguments): new function, shared by the new
11612 constructor and us.
11613 (Invocation::Emit): Handle static and instance methods. Emit
11614 proper call instruction for virtual or non-virtual invocations.
11615 (New::Emit): Implement.
11616 (New::Resolve): Implement.
11617 (MemberAccess:Resolve): Implement.
11618 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11619 to track instances.
11620 (FieldExpr::Resolve): Set type.
11622 * support.cs: Handle empty arguments.
11624 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11625 SimpleLookup): Auxiliary routines to help parse a qualifier
11628 Update qualifier_identifier rule.
11630 * codegen.cs: Removed debugging messages.
11632 * class.cs: Make this a global thing, this acts just as a "key" to
11633 objects that we might have around.
11635 (Populate): Only initialize method_builders_to_methods once.
11637 * expression.cs (PropertyExpr): Initialize type from the
11640 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11641 Resolve pattern. Attempt to implicitly convert value to boolean.
11644 * expression.cs: Set the type for the int32/int32 argument case.
11645 (Binary::ResolveOperator): Set the return type to boolean for
11646 comparission operators
11648 * typemanager.cs: Remove debugging print code.
11650 (Invocation::Resolve): resolve type.
11652 * class.cs: Allocate a MemberInfo of the correct size, as the code
11653 elsewhere depends on the test to reflect the correct contents.
11655 (Method::) Keep track of parameters, due to System.Reflection holes
11657 (TypeContainer::Populate): Keep track of MethodBuilders to Method
11660 (TypeContainer::FindMembers): Use ArrayList and then copy an array
11661 of the exact size and return that.
11663 (Class::LookupMethodByBuilder): New function that maps
11664 MethodBuilders to its methods. Required to locate the information
11665 on methods because System.Reflection bit us again.
11667 * support.cs: New file, contains an interface ParameterData and
11668 two implementations: ReflectionParameters and InternalParameters
11669 used to access Parameter information. We will need to grow this
11672 * expression.cs (Invocation::GetParameterData): implement a cache
11673 and a wrapper around the ParameterData creation for methods.
11674 (Invocation::OverloadResolve): Use new code.
11676 2001-09-13 Ravi Pratap <ravi@ximian.com>
11678 * class.cs (TypeContainer::EmitField): Remove and move into
11679 (Field::Define): here and modify accordingly.
11680 (Field.FieldBuilder): New member.
11681 (TypeContainer::Populate): Update accordingly.
11682 (TypeContainer::FindMembers): Implement.
11684 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11686 * statement.cs: (VariableInfo::VariableType): New field to be
11687 initialized with the full type once it is resolved.
11689 2001-09-12 Miguel de Icaza <miguel@ximian.com>
11691 * parameter.cs (GetParameterInfo): Use a type cache to compute
11692 things only once, and to reuse this information
11694 * expression.cs (LocalVariableReference::Emit): Implement.
11695 (OpcodeCast::Emit): fix.
11697 (ParameterReference::Resolve): Implement.
11698 (ParameterReference::Emit): Implement.
11700 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11701 that are expressions need to stay as Expressions.
11703 * typemanager.cs (CSharpName): Returns the C# name of a type if
11706 * expression.cs (Expression::ConvertImplicit): New function that
11707 implements implicit type conversions.
11709 (Expression::ImplicitReferenceConversion): Implements implicit
11710 reference conversions.
11712 (EmptyCast): New type for transparent casts.
11714 (OpcodeCast): New type for casts of types that are performed with
11715 a sequence of bytecodes.
11717 (BoxedCast): New type used for casting value types into reference
11718 types. Emits a box opcode.
11720 (Binary::DoNumericPromotions): Implements numeric promotions of
11721 and computation of the Binary::Type.
11723 (Binary::EmitBranchable): Optimization.
11725 (Binary::Emit): Implement code emission for expressions.
11727 * typemanager.cs (TypeManager): Added two new core types: sbyte
11730 2001-09-12 Ravi Pratap <ravi@ximian.com>
11732 * class.cs (TypeContainer::FindMembers): Method which does exactly
11733 what Type.FindMembers does, only we don't have to use reflection. No
11734 implementation yet.
11736 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11737 typecontainer objects as we need to get at them.
11738 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11740 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11741 typecontainer object.
11743 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11744 of just a Report object.
11746 2001-09-11 Ravi Pratap <ravi@ximian.com>
11748 * class.cs (Event::Define): Go back to using the prefixes "add_" and
11750 (TypeContainer::Populate): Now define the delegates of the type too.
11751 (TypeContainer.Delegates): Property to access the list of delegates defined
11754 * delegates.cs (Delegate::Define): Implement partially.
11756 * modifiers.cs (TypeAttr): Handle more flags.
11758 2001-09-11 Ravi Pratap <ravi@ximian.com>
11760 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11762 (Operator::Define): Re-write logic to get types by using the LookupType method
11763 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11764 (Indexer::Define): Ditto.
11765 (Event::Define): Ditto.
11766 (Property::Define): Ditto.
11768 2001-09-10 Ravi Pratap <ravi@ximian.com>
11770 * class.cs (TypeContainer::Populate): Now define operators too.
11771 (TypeContainer.Operators): New property to access the list of operators
11773 (Operator.OperatorMethodBuilder): New member to hold the method builder
11774 for the operator we are defining.
11775 (Operator::Define): Implement.
11777 2001-09-10 Ravi Pratap <ravi@ximian.com>
11779 * class.cs (Event::Define): Make the prefixes of the accessor methods
11780 addOn_ and removeOn_
11782 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11783 of the location being passed in too. Ideally, this should go later since all
11784 error reporting should be done through the Report object.
11786 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11787 (Populate): Iterate thru the indexers we have and define them too.
11788 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11789 for the get and set accessors.
11790 (Indexer::Define): Implement.
11792 2001-09-09 Miguel de Icaza <miguel@ximian.com>
11794 * expression.cs (Binary::Resolve): Beginning of it. I scratched
11795 my previous implementation, did not work.
11797 * typemanager.cs: Add a couple of missing types (the longs).
11799 * literal.cs: Use TypeManager.bool_type instead of getting it.
11801 * expression.cs (EventExpr): New kind of expressions.
11802 (Expressio::ExprClassFromMemberInfo): finish
11804 2001-09-08 Miguel de Icaza <miguel@ximian.com>
11806 * assign.cs: Emit stores to static fields differently.
11808 2001-09-08 Ravi Pratap <ravi@ximian.com>
11810 * Merge in changes and adjust code to tackle conflicts. Backed out my
11811 code in Assign::Resolve ;-)
11813 2001-09-08 Ravi Pratap <ravi@ximian.com>
11815 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11816 instead Report.Error and also pass in the location.
11817 (CSharpParser::Lexer): New readonly property to return the reference
11818 to the Tokenizer object.
11819 (declare_local_variables): Use Report.Error with location instead of plain
11823 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11824 (Operator.CheckBinaryOperator): Ditto.
11826 * cs-parser.jay (operator_declarator): Update accordingly.
11828 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11829 (CheckBinaryOperator): Same here.
11831 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11832 on the name without any prefixes of namespace names etc. This is because we
11833 already might have something already fully qualified like
11834 'System.Console.WriteLine'
11836 * assign.cs (Resolve): Begin implementation. Stuck ;-)
11838 2001-09-07 Ravi Pratap <ravi@ximian.com>
11840 * cs-tokenizer.cs (location): Return a string which also contains
11843 * expression.cs (ElementAccess): New class for expressions of the
11844 type 'element access.'
11845 (BaseAccess): New class for expressions of the type 'base access.'
11846 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11849 * cs-parser.jay (element_access): Implement action.
11850 (base_access): Implement actions.
11851 (checked_expression, unchecked_expression): Implement.
11853 * cs-parser.jay (local_variable_type): Correct and implement.
11854 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11856 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11858 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11859 name and the specifiers.
11861 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11863 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
11864 making them all public ;-)
11866 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11869 2001-09-07 Miguel de Icaza <miguel@ximian.com>
11871 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11873 (FieldExpr, PropertyExprs): New resolved expressions.
11874 (SimpleName::MemberStaticCheck): Perform static checks for access
11875 to non-static fields on static methods. Maybe this should be
11876 generalized for MemberAccesses.
11877 (SimpleName::ResolveSimpleName): More work on simple name
11880 * cs-parser.jay (primary_expression/qualified_identifier): track
11881 the parameter index.
11883 * codegen.cs (CodeGen::Save): Catch save exception, report error.
11884 (EmitContext::EmitBoolExpression): Chain to expression generation
11885 instead of temporary hack.
11886 (::EmitStatementExpression): Put generic expression code generation.
11888 * assign.cs (Assign::Emit): Implement variable assignments to
11889 local variables, parameters and fields.
11891 2001-09-06 Miguel de Icaza <miguel@ximian.com>
11893 * statement.cs (Block::GetVariableInfo): New method, returns the
11894 VariableInfo for a variable name in a block.
11895 (Block::GetVariableType): Implement in terms of GetVariableInfo
11897 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
11898 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
11900 2001-09-06 Ravi Pratap <ravi@ximian.com>
11902 * cs-parser.jay (operator_declaration): Continue on my quest : update
11903 to take attributes argument.
11904 (event_declaration): Ditto.
11905 (enum_declaration): Ditto.
11906 (indexer_declaration): Ditto.
11908 * class.cs (Operator::Operator): Update constructor accordingly.
11909 (Event::Event): Ditto.
11911 * delegate.cs (Delegate::Delegate): Same here.
11913 * enum.cs (Enum::Enum): Same here.
11915 2001-09-05 Ravi Pratap <ravi@ximian.com>
11917 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
11919 * ../tests/cs0658.cs : New file to demonstrate error 0658.
11921 * attribute.cs (Attributes): New class to encapsulate all attributes which were
11922 being passed around as an arraylist.
11923 (Attributes::AddAttribute): Method to add attribute sections.
11925 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
11926 (struct_declaration): Update accordingly.
11927 (constant_declaration): Update.
11928 (field_declaration): Update.
11929 (method_header): Update.
11930 (fixed_parameter): Update.
11931 (parameter_array): Ditto.
11932 (property_declaration): Ditto.
11933 (destructor_declaration): Ditto.
11935 * class.cs (Struct::Struct): Update constructors accordingly.
11936 (Class::Class): Ditto.
11937 (Field::Field): Ditto.
11938 (Method::Method): Ditto.
11939 (Property::Property): Ditto.
11940 (TypeContainer::OptAttribute): update property's return type.
11942 * interface.cs (Interface.opt_attributes): New member.
11943 (Interface::Interface): Update to take the extra Attributes argument.
11945 * parameter.cs (Parameter::Parameter): Ditto.
11947 * constant.cs (Constant::Constant): Ditto.
11949 * interface.cs (InterfaceMemberBase): New OptAttributes field.
11950 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
11951 the attributes as a parameter.
11952 (InterfaceProperty): Update constructor call.
11953 (InterfaceEvent): Ditto.
11954 (InterfaceMethod): Ditto.
11955 (InterfaceIndexer): Ditto.
11957 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
11958 pass the attributes too.
11959 (interface_event_declaration): Ditto.
11960 (interface_property_declaration): Ditto.
11961 (interface_method_declaration): Ditto.
11962 (interface_declaration): Ditto.
11964 2001-09-05 Miguel de Icaza <miguel@ximian.com>
11966 * class.cs (Method::Define): Track the "static Main" definition to
11967 create an entry point.
11969 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11970 EntryPoint if we find it.
11972 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11973 (EmitContext::ig): Make this variable public.
11975 * driver.cs: Make the default output file be the first file name
11976 with the .exe extension.
11978 Detect empty compilations
11980 Handle various kinds of output targets. Handle --target and
11981 rename -t to --dumper.
11983 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11984 methods inherited from Expression return now an Expression. This
11985 will is used during the tree rewriting as we resolve them during
11988 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11989 the spec. Missing entirely is the information about
11990 accessability of elements of it.
11992 (Expression::ExprClassFromMemberInfo): New constructor for
11993 Expressions that creates a fully initialized Expression based on
11994 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11997 (Invocation::Resolve): Begin implementing resolution of invocations.
11999 * literal.cs (StringLiteral): Implement Emit.
12001 2001-09-05 Ravi Pratap <ravi@ximian.com>
12003 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12006 2001-09-04 Ravi Pratap <ravi@ximian.com>
12008 * cs-parser.jay (attribute_arguments): Implement actions.
12009 (attribute): Fix bug in production. Implement action.
12010 (attribute_list): Implement.
12011 (attribute_target): Implement.
12012 (attribute_target_specifier, opt_target_specifier): Implement
12013 (CheckAttributeTarget): New method to check if the attribute target
12015 (attribute_section): Implement.
12016 (opt_attributes): Implement.
12018 * attribute.cs : New file to handle attributes.
12019 (Attribute): Class to hold attribute info.
12021 * cs-parser.jay (opt_attribute_target_specifier): Remove production
12022 (attribute_section): Modify production to use 2 different rules to
12023 achieve the same thing. 1 s/r conflict down !
12024 Clean out commented, useless, non-reducing dimension_separator rules.
12026 * class.cs (TypeContainer.attributes): New member to hold list
12027 of attributes for a type.
12028 (Struct::Struct): Modify to take one more argument, the attribute list.
12029 (Class::Class): Ditto.
12030 (Field::Field): Ditto.
12031 (Method::Method): Ditto.
12032 (Property::Property): Ditto.
12034 * cs-parser.jay (struct_declaration): Update constructor call to
12035 pass in the attributes too.
12036 (class_declaration): Ditto.
12037 (constant_declaration): Ditto.
12038 (field_declaration): Ditto.
12039 (method_header): Ditto.
12040 (fixed_parameter): Ditto.
12041 (parameter_array): Ditto.
12042 (property_declaration): Ditto.
12044 * constant.cs (Constant::Constant): Update constructor similarly.
12045 Use System.Collections.
12047 * parameter.cs (Parameter::Parameter): Update as above.
12049 2001-09-02 Ravi Pratap <ravi@ximian.com>
12051 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12052 (TypeContainer.delegates): New member to hold list of delegates.
12054 * cs-parser.jay (delegate_declaration): Implement the action correctly
12055 this time as I seem to be on crack ;-)
12057 2001-09-02 Miguel de Icaza <miguel@ximian.com>
12059 * rootcontext.cs (RootContext::IsNamespace): new function, used to
12060 tell whether an identifier represents a namespace.
12062 * expression.cs (NamespaceExpr): A namespace expression, used only
12063 temporarly during expression resolution.
12064 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12065 utility functions to resolve names on expressions.
12067 2001-09-01 Miguel de Icaza <miguel@ximian.com>
12069 * codegen.cs: Add hook for StatementExpressions.
12071 * class.cs: Fix inverted test for static flag in methods.
12073 2001-09-02 Ravi Pratap <ravi@ximian.com>
12075 * class.cs (Operator::CheckUnaryOperator): Correct error number used
12076 to make it coincide with MS' number.
12077 (Operator::CheckBinaryOperator): Ditto.
12079 * ../errors/errors.txt : Remove error numbers added earlier.
12081 * ../errors/cs1019.cs : Test case for error # 1019
12083 * ../errros/cs1020.cs : Test case for error # 1020
12085 * cs-parser.jay : Clean out commented cruft.
12086 (dimension_separators, dimension_separator): Comment out. Ostensibly not
12087 used anywhere - non-reducing rule.
12088 (namespace_declarations): Non-reducing rule - comment out.
12090 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12091 with TypeContainer::AddEnum.
12093 * delegate.cs : New file for delegate handling classes.
12094 (Delegate): Class for declaring delegates.
12096 * makefile : Update.
12098 * cs-parser.jay (delegate_declaration): Implement.
12100 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
12102 * class.cs (Event::Define): Implement.
12103 (Event.EventBuilder): New member.
12105 * class.cs (TypeContainer::Populate): Update to define all enums and events
12107 (Events): New property for the events arraylist we hold. Shouldn't we move to using
12108 readonly fields for all these cases ?
12110 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12112 * class.cs (Property): Revamp to use the convention of making fields readonly.
12113 Accordingly modify code elsewhere.
12115 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12116 the Define method of the Property class.
12118 * class.cs : Clean up applied patch and update references to variables etc. Fix
12120 (TypeContainer::Populate): Update to define all the properties we have. Also
12121 define all enumerations.
12123 * enum.cs (Define): Implement.
12125 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12127 * cs-parser.jay (overloadable_operator): The semantic value is an
12128 enum of the Operator class.
12129 (operator_declarator): Implement actions.
12130 (operator_declaration): Implement.
12132 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12133 validity of definitions.
12134 (Operator::CheckBinaryOperator): Static method to check for binary operators
12135 (TypeContainer::AddOperator): New method to add an operator to a type.
12137 * cs-parser.jay (indexer_declaration): Added line to actually call the
12138 AddIndexer method so it gets added ;-)
12140 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
12141 already taken care of by the MS compiler ?
12143 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12145 * class.cs (Operator): New class for operator declarations.
12146 (Operator::OpType): Enum for the various operators.
12148 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12150 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12151 ostensibly handle this in semantic analysis.
12153 * cs-parser.jay (general_catch_clause): Comment out
12154 (specific_catch_clauses, specific_catch_clause): Ditto.
12155 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12156 (catch_args, opt_catch_args): New productions.
12157 (catch_clause): Rewrite to use the new productions above
12158 (catch_clauses): Modify accordingly.
12159 (opt_catch_clauses): New production to use in try_statement
12160 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12161 and re-write the code in the actions to extract the specific and
12162 general catch clauses by being a little smart ;-)
12164 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12165 Hooray, try and catch statements parse fine !
12167 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12169 * statement.cs (Block::GetVariableType): Fix logic to extract the type
12170 string from the hashtable of variables.
12172 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12173 I end up making that mistake ;-)
12174 (catch_clauses): Fixed gross error which made Key and Value of the
12175 DictionaryEntry the same : $1 !!
12177 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12179 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12181 * cs-parser.jay (event_declaration): Correct to remove the semicolon
12182 when the add and remove accessors are specified.
12184 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12186 * cs-parser.jay (IndexerDeclaration): New helper class to hold
12187 information about indexer_declarator.
12188 (indexer_declarator): Implement actions.
12189 (parsing_indexer): New local boolean used to keep track of whether
12190 we are parsing indexers or properties. This is necessary because
12191 implicit_parameters come into picture even for the get accessor in the
12192 case of an indexer.
12193 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12195 * class.cs (Indexer): New class for indexer declarations.
12196 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12197 (TypeContainer::indexers): New member to hold list of indexers for the
12200 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12202 * cs-parser.jay (add_accessor_declaration): Implement action.
12203 (remove_accessor_declaration): Implement action.
12204 (event_accessors_declaration): Implement
12205 (variable_declarators): swap statements for first rule - trivial.
12207 * class.cs (Event): New class to hold information about event
12209 (TypeContainer::AddEvent): New method to add an event to a type
12210 (TypeContainer::events): New member to hold list of events.
12212 * cs-parser.jay (event_declaration): Implement actions.
12214 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12216 * cs-parser.jay (dim_separators): Implement. Make it a string
12217 concatenating all the commas together, just as they appear.
12218 (opt_dim_separators): Modify accordingly
12219 (rank_specifiers): Update accordingly. Basically do the same
12220 thing - instead, collect the brackets here.
12221 (opt_rank_sepcifiers): Modify accordingly.
12222 (array_type): Modify to actually return the complete type string
12223 instead of ignoring the rank_specifiers.
12224 (expression_list): Implement to collect the expressions
12225 (variable_initializer): Implement. We make it a list of expressions
12226 essentially so that we can handle the array_initializer case neatly too.
12227 (variable_initializer_list): Implement.
12228 (array_initializer): Make it a list of variable_initializers
12229 (opt_array_initializer): Modify accordingly.
12231 * expression.cs (New::NType): Add enumeration to help us
12232 keep track of whether we have an object/delegate creation
12233 or an array creation.
12234 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12235 members to hold data about array creation.
12236 (New:New): Modify to update NewType
12237 (New:New): New Overloaded contructor for the array creation
12240 * cs-parser.jay (array_creation_expression): Implement to call
12241 the overloaded New constructor.
12243 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12245 * class.cs (TypeContainer::Constructors): Return member
12246 constructors instead of returning null.
12248 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12250 * typemanager.cs (InitCoreTypes): Initialize the various core
12251 types after we have populated the type manager with the user
12252 defined types (this distinction will be important later while
12253 compiling corlib.dll)
12255 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12256 on Expression Classification. Now all expressions have a method
12257 `Resolve' and a method `Emit'.
12259 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12260 generation from working. Also add some temporary debugging
12263 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12265 * codegen.cs: Lots of code generation pieces. This is only the
12266 beginning, will continue tomorrow with more touches of polish. We
12267 handle the fundamentals of if, while, do, for, return. Others are
12268 trickier and I need to start working on invocations soon.
12270 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12273 * codegen.cs (EmitContext): New struct, used during code
12274 emission to keep a context. Most of the code generation will be
12277 * cs-parser.jay: Add embedded blocks to the list of statements of
12278 this block. So code generation proceeds in a top down fashion.
12280 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12282 * statement.cs: Add support for multiple child blocks.
12284 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12286 * codegen.cs (EmitCode): New function, will emit the code for a
12287 Block of code given a TypeContainer and its ILGenerator.
12289 * statement.cs (Block): Standard public readonly optimization.
12290 (Block::Block constructors): Link children.
12291 (Block::Child): Child Linker.
12292 (Block::EmitVariables): Emits IL variable declarations.
12294 * class.cs: Drop support for MethodGroups here, delay until
12296 (Method::): Applied the same simplification that I did before, and
12297 move from Properties to public readonly fields.
12298 (Method::ParameterTypes): Returns the parameter types for the
12299 function, and implements a cache that will be useful later when I
12300 do error checking and the semantic analysis on the methods is
12302 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12303 and made a method, optional argument tells whether this is a class
12304 or a structure to apply the `has-this' bit.
12305 (Method::GetCallingConvention): Implement, returns the calling
12307 (Method::Define): Defines the type, a second pass is performed
12308 later to populate the methods.
12310 (Constructor::ParameterTypes): implement a cache similar to the
12311 one on Method::ParameterTypes, useful later when we do semantic
12314 (TypeContainer::EmitMethod): New method. Emits methods.
12316 * expression.cs: Removed MethodGroup class from here.
12318 * parameter.cs (Parameters::GetCallingConvention): new method.
12320 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12322 * class.cs (TypeContainer::Populate): Drop RootContext from the
12325 (Constructor::CallingConvention): Returns the calling convention.
12326 (Constructor::ParameterTypes): Returns the constructor parameter
12329 (TypeContainer::AddConstructor): Keep track of default constructor
12330 and the default static constructor.
12332 (Constructor::) Another class that starts using `public readonly'
12333 instead of properties.
12335 (Constructor::IsDefault): Whether this is a default constructor.
12337 (Field::) use readonly public fields instead of properties also.
12339 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12340 track of static constructors; If none is used, turn on
12341 BeforeFieldInit in the TypeAttributes.
12343 * cs-parser.jay (opt_argument_list): now the return can be null
12344 for the cases where there are no arguments.
12346 (constructor_declarator): If there is no implicit `base' or
12347 `this', then invoke the default parent constructor.
12349 * modifiers.cs (MethodAttr): New static function maps a set of
12350 modifiers flags into a MethodAttributes enum
12351 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12352 MethodAttr, TypeAttr to represent the various mappings where the
12353 modifiers are used.
12354 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12356 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12358 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12361 * interface.cs (PopulateIndexer): Implemented the code generator
12362 for interface indexers.
12364 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12366 * interface.cs (InterfaceMemberBase): Now we track the new status
12369 (PopulateProperty): Implement property population. Woohoo! Got
12370 Methods and Properties going today.
12372 Removed all the properties for interfaces, and replaced them with
12373 `public readonly' fields.
12375 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12377 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12378 initialize their hashtables/arraylists only when they are needed
12379 instead of doing this always.
12381 * parameter.cs: Handle refs and out parameters.
12383 * cs-parser.jay: Use an ArrayList to construct the arguments
12384 instead of the ParameterCollection, and then cast that to a
12387 * parameter.cs: Drop the use of ParameterCollection and use
12388 instead arrays of Parameters.
12390 (GetParameterInfo): Use the Type, not the Name when resolving
12393 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12395 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12396 and instead use public readonly fields.
12398 * class.cs: Put back walking code for type containers.
12400 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12402 * class.cs (MakeConstant): Code to define constants.
12404 * rootcontext.cs (LookupType): New function. Used to locate types
12407 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12409 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12410 this System.Reflection code is. Kudos to Microsoft
12412 * typemanager.cs: Implement a type cache and avoid loading all
12413 types at boot time. Wrap in LookupType the internals. This made
12414 the compiler so much faster. Wow. I rule!
12416 * driver.cs: Make sure we always load mscorlib first (for
12417 debugging purposes, nothing really important).
12419 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12420 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12422 * rootcontext.cs: Lookup types on their namespace; Lookup types
12423 on namespaces that have been imported using the `using' keyword.
12425 * class.cs (TypeContainer::TypeAttr): Virtualize.
12426 (Class::TypeAttr): Return attributes suitable for this bad boy.
12427 (Struct::TypeAttr): ditto.
12428 Handle nested classes.
12429 (TypeContainer::) Remove all the type visiting code, it is now
12430 replaced with the rootcontext.cs code
12432 * rootcontext.cs (GetClassBases): Added support for structs.
12434 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12436 * interface.cs, statement.cs, class.cs, parameter.cs,
12437 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12438 Drop use of TypeRefs, and use strings instead.
12440 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12444 * class.cs (Struct::Struct): set the SEALED flags after
12445 checking the modifiers.
12446 (TypeContainer::TypeAttr): new property, returns the
12447 TypeAttributes for a class.
12449 * cs-parser.jay (type_list): Oops, list production was creating a
12450 new list of base types.
12452 * rootcontext.cs (StdLib): New property.
12453 (GetInterfaceTypeByName): returns an interface by type name, and
12454 encapsulates error handling here.
12455 (GetInterfaces): simplified.
12456 (ResolveTree): Encapsulated all the tree resolution here.
12457 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12460 * driver.cs: Add support for --nostdlib, to avoid loading the
12461 default assemblies.
12462 (Main): Do not put tree resolution here.
12464 * rootcontext.cs: Beginning of the class resolution.
12466 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12468 * rootcontext.cs: Provide better error reporting.
12470 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12472 * rootcontext.cs (CreateInterface): Handle the case where there
12473 are no parent interfaces.
12475 (CloseTypes): Routine to flush types at the end.
12476 (CreateInterface): Track types.
12477 (GetInterfaces): Returns an array of Types from the list of
12478 defined interfaces.
12480 * typemanager.c (AddUserType): Mechanism to track user types (puts
12481 the type on the global type hash, and allows us to close it at the
12484 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12486 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12487 RecordInterface instead.
12489 * cs-parser.jay: Updated to reflect changes above.
12491 * decl.cs (Definition): Keep track of the TypeBuilder type that
12492 represents this type here. Not sure we will use it in the long
12493 run, but wont hurt for now.
12495 * driver.cs: Smaller changes to accomodate the new code.
12497 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12500 * rootcontext.cs (CreateInterface): New method, used to create
12501 the System.TypeBuilder type for interfaces.
12502 (ResolveInterfaces): new entry point to resolve the interface
12504 (CodeGen): Property, used to keep track of the code generator.
12506 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12508 * cs-parser.jay: Add a second production for delegate_declaration
12511 (enum_body): Put an opt_comma here instead of putting it on
12512 enum_body or enum_member_declarations so we can handle trailing
12513 commas on enumeration members. Gets rid of a shift/reduce.
12515 (type_list): Need a COMMA in the middle.
12517 (indexer_declaration): Tell tokenizer to recognize get/set
12519 * Remove old targets.
12521 * Re-add the parser target.
12523 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12525 * cs-parser.jay: Add precendence rules for a number of operators
12526 ot reduce the number of shift/reduce conflicts in the grammar.
12528 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12530 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12533 Get rid of old crufty code.
12535 * rootcontext.cs: Use this to keep track of the parsed
12536 representation and the defined types available to the program.
12538 * gen-treedump.cs: adjust for new convention.
12540 * type.cs: Split out the type manager, and the assembly builder
12543 * typemanager.cs: the type manager will live here now.
12545 * cil-codegen.cs: And the code generator here.
12547 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12549 * makefile: Fixed up for easy making.
12551 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12553 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12556 (unary_expression): Expand pre_increment_expression and
12557 post_decrement_expression to reduce a shift/reduce.
12559 2001-07-11 Simon Cozens
12561 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12563 Improve allow_keyword_as_indent name.
12565 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12567 * Adjustments for Beta2.
12569 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12571 * decl.cs: Added `Define' abstract method.
12572 (InTransit): new property, used to catch recursive definitions.
12574 * interface.cs: Implement `Define'.
12576 * modifiers.cs: Map Modifiers.constants to
12577 System.Reflection.TypeAttribute flags.
12579 * class.cs: Keep track of types and user-defined types.
12580 (BuilderInit): New method for creating an assembly
12581 (ResolveType): New function to launch the resolution process, only
12582 used by interfaces for now.
12584 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12585 that are inserted into the name space.
12587 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12589 * ARGH. I have screwed up my tree so many times due to the use of
12590 rsync rather than using CVS. Going to fix this at once.
12592 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12595 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12597 * Experiment successful: Use System.Type rather that our own
12600 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12602 * cs-parser.jay: Removed nsAliases from here.
12604 Use new namespaces, handle `using XXX;'
12606 * namespace.cs: Reimplemented namespace handling, use a recursive
12607 definition of the class. Now we can keep track of using clauses
12608 and catch invalid using clauses.
12610 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12612 * gen-treedump.cs: Adapted for all the renaming.
12614 * expression.cs (Expression): this class now has a Type property
12615 which returns an expression Type.
12617 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12618 `Type', as this has a different meaning now in the base
12620 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12622 * interface.cs, class.cs: Removed from all the sources the
12623 references to signature computation, as we can not do method
12624 signature computation during the parsing time, as we are not
12625 trying to solve at that point distinguishing:
12629 void a (NS.Blah x) {}
12632 Which depending on the context might be valid or not, as we do not
12633 know if Blah is the same thing as NS.Blah at that point.
12635 * Redid everything so the code uses TypeRefs now instead of
12636 Types. TypeRefs are just temporary type placeholders, that need
12637 to be resolved. They initially have a pointer to a string and the
12638 current scope in which they are used. This is used later by the
12639 compiler to resolve the reference to an actual Type.
12641 * DeclSpace is no longer a CIR.Type, and neither are
12642 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12643 are all DeclSpaces, but no Types.
12645 * type.cs (TypeRefManager): This implements the TypeRef manager,
12646 which keeps track of all the types that need to be resolved after
12647 the parsing has finished.
12649 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12651 * ARGH. We are going to have to store `foreach' as a class rather
12652 than resolving it, as we need to verify error 1579 after name
12653 resolution. *OR* we could keep a flag that says `This request to
12654 IEnumerator comes from a foreach statement' which we can then use
12655 to generate the error.
12657 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12659 * class.cs (TypeContainer.AddMethod): we now add methods to the
12660 MethodGroup instead of the method hashtable.
12662 * expression.cs: Add MethodGroup abstraction, which gets us one
12663 step closer to the specification in the way we handle method
12666 * cs-parser.jay (primary_expression): qualified_identifier now
12667 tried to match up an identifier to a local variable reference or
12668 to a parameter reference.
12670 current_local_parameters is now a parser global variable that
12671 points to the current parameters for the block, used during name
12674 (property_declaration): Now creates an implicit `value' argument to
12677 2001-05-09 Miguel de Icaza <miguel@ximian.com>
12679 * parameter.cs: Do not use `param' arguments as part of the
12680 signature, per the spec.
12682 2001-05-08 Miguel de Icaza <miguel@ximian.com>
12684 * decl.cs: Base class for classes, structs and interfaces. This
12685 is the "Declaration Space"
12687 * cs-parser.jay: Use CheckDef for checking declaration errors
12688 instead of having one on each function.
12690 * class.cs: Factor out some code for handling error handling in
12691 accordance to the "Declarations" section in the "Basic Concepts"
12692 chapter in the ECMA C# spec.
12694 * interface.cs: Make all interface member classes derive from
12695 InterfaceMemberBase.
12697 2001-05-07 Miguel de Icaza <miguel@ximian.com>
12699 * Many things: all interfaces are parsed and generated in
12700 gen-treedump. Support for member variables, constructors,
12701 destructors, properties, constants is there.
12703 Beginning of the IL backend, but very little done, just there for
12706 2001-04-29 Miguel de Icaza <miguel@ximian.com>
12708 * cs-parser.jay: Fix labeled statement.
12710 * cs-tokenizer.cs (escape): Escape " and ' always.
12711 ref_line, ref_name: keep track of the line/filename as instructed
12712 by #line by the compiler.
12715 2001-04-27 Miguel de Icaza <miguel@ximian.com>
12717 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12718 to match the values in System.CodeDOM.
12720 Divid renamed to Divide.
12722 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12724 (Statements.set): remove.
12726 * System.CodeDOM/CodeCatchClause.cs: always have a valid
12729 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12730 falseStatements always have valid values.
12732 * cs-parser.jay: Use System.CodeDOM now.