1 2003-08-22 Martin Baulig <martin@ximian.com>
3 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4 correctly; fixes #47722.
6 2003-08-22 Martin Baulig <martin@ximian.com>
8 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9 LocalVariableReference, ensure it's not read-only. Fixes #47536.
11 * statement.cs (Fixed.DoResolve): Make all variables read-only.
13 2003-08-22 Martin Baulig <martin@ximian.com>
15 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
16 can only be assigned in static constructors. Fixes #47161.
18 2003-08-22 Martin Baulig <martin@ximian.com>
20 Rewrote and improved the flow analysis code.
22 * flowbranching.cs (FlowBranching): Make this class abstract.
23 (FlowBranching.CreateBranching): New static function to create a
25 (FlowBranchingBlock, FlowBranchingException): New classes.
26 (FlowBranching.UsageVector.Type): New public readonly field.
27 (FlowBranching.UsageVector.Breaks): Removed the setter.
28 (FlowBranching.UsageVector.Returns): Removed the setter.
29 (FlowBranching.UsageVector): Added Break(), Return(),
30 NeverReachable() and Throw() methods to modify the reachability.
31 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
32 done by FlowBranching.Merge().
33 (FlowBranching.UsageVector.MergeChild): New method; merges the
34 merge result into the current vector.
35 (FlowBranching.Merge): New abstract method to merge a branching.
37 2003-08-12 Martin Baulig <martin@ximian.com>
39 * expression.cs (Indirection.CacheTemporaries): Create the
40 LocalTemporary with the pointer type, not its element type.
42 2003-08-10 Miguel de Icaza <miguel@ximian.com>
44 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
45 token was a keyword or not.
47 Add `error' options where an IDENTIFIER was expected; Provide
48 CheckToken and CheckIdentifierToken convenience error reporting
51 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
53 * decl.cs: Rename `NamespaceEntry Namespace' public field into
54 NameSpaceEntry NameSpaceEntry.
56 (LookupInterfaceOrClass): Avoid creating a full qualified name
57 from namespace and name: avoid doing lookups when we know the
58 namespace is non-existant. Use new Tree.LookupByNamespace which
59 looks up DeclSpaces based on their namespace, name pair.
61 * driver.cs: Provide a new `parser verbose' to display the
62 exception thrown during parsing. This is turned off by default
63 now, so the output of a failure from mcs is more graceful.
65 * namespace.cs: Track all the namespaces defined in a hashtable
68 (IsNamespace): New method
70 2003-08-09 Miguel de Icaza <miguel@ximian.com>
72 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
73 we know that we need to concatenate (full typename can never be
78 * statement.cs: Use a bitfield; Do not initialize to null things
79 which are done by the constructor by default.
81 * cs-parser.jay: bug fix, parameter was 4, not 3.
83 * expression.cs: Just use the property;
85 * statement.cs: No need for GetVariableInfo method.
87 2003-08-08 Martin Baulig <martin@ximian.com>
89 * flowanalysis.cs (FlowReturns): This is now nested in the
90 `FlowBranching' class.
91 (MyBitVector): Moved this here from statement.cs.
92 (FlowBranching.SiblingType): New enum type.
93 (FlowBranching.CreateSibling): Added `SiblingType' argument.
95 2003-08-07 Martin Baulig <martin@ximian.com>
97 * flowanalysis.cs (FlowBranchingType): This is now nested in the
98 `FlowBranching' class and called `BranchingType'.
100 2003-08-07 Martin Baulig <martin@ximian.com>
102 * flowanalysis.cs: Moved all the control flow analysis code into
105 2003-08-07 Martin Baulig <martin@ximian.com>
107 * assign.cs (Assign.DoResolve): `target' must either be an
108 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
111 2003-08-07 Miguel de Icaza <miguel@ximian.com>
113 * expression.cs (BinaryMethod): This kind of expression is created by the
114 Binary class if it determines that the operator has to be handled
117 (BinaryDelegate): This kind of expression is created if we are
118 dealing with a + or - operator on delegates.
120 (Binary): remove method, argumetns, and DelegateOperator: when
121 dealing with methods,
123 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
125 * statement.cs (Block): use bitfields for the three extra booleans
126 we had in use. Remove unused topblock parameter.
128 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
130 * assign.cs: Drop extra unneeded tests.
132 2003-08-06 Miguel de Icaza <miguel@ximian.com>
134 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
136 * statement.cs (Foreach): Use VariableStorage instead of
139 * codegen.cs (VariableStorage): New class used by clients that
140 require a variable stored: locals or fields for variables that
141 need to live across yield.
143 Maybe provide a convenience api for EmitThis+EmitLoad?
145 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
148 2003-08-05 Miguel de Icaza <miguel@ximian.com>
150 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
151 RemapParameterLValue): New methods that are used to turn a
152 precomputed FieldInfo into an expression like this:
156 The idea is to use this instead of making LocalVariableReference
157 have more than one meaning.
159 * cs-parser.jay: Add error production to BASE.
161 * ecore.cs: Deal with TypeManager.GetField returning null, which
162 is now a valid return value.
164 (FieldExprNoAddress): New expression for Fields whose address can
167 * expression.cs (LocalVariableReference): During the resolve
168 phases, create new expressions if we are in a remapping context.
169 Remove code that dealt with remapping here.
171 (ParameterReference): same.
173 (ProxyInstance): New expression, like the `This' expression, but
174 it is born fully resolved. We know what we are doing, so remove
175 the errors that are targeted to user-provided uses of `this'.
177 * statement.cs (Foreach): our variable is now stored as an
178 Expression; During resolution, follow the protocol, dont just
179 assume it will return this.
181 2003-08-06 Martin Baulig <martin@ximian.com>
183 * support.cs (SeekableStreamReader.cs): New public class.
185 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
186 SeekableStreamReader instead of the normal StreamReader.
188 2003-08-04 Martin Baulig <martin@ximian.com>
190 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
191 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
192 deambiguate casts and delegate invocations.
193 (parenthesized_expression): Use the new tokens to ensure this is
194 not a cast of method invocation.
196 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
197 when reading a `)' and Deambiguate_CloseParens () was previously
200 * expression.cs (ParenthesizedExpression): New class. This is
201 just used for the CS0075 test.
202 (Binary.DoResolve): Check for CS0075.
204 2003-07-29 Ravi Pratap <ravi@ximian.com>
206 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
207 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
208 reference comparison.
210 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
211 examine the ReturnType for equality - this is necessary in the
212 cases of implicit and explicit operators whose signature also
213 includes the return type.
215 2003-07-26 Miguel de Icaza <miguel@ximian.com>
217 * namespace.cs: Cache the result of the namespace computation,
218 instead of computing it every time.
220 2003-07-24 Miguel de Icaza <miguel@ximian.com>
222 * decl.cs: Use a global arraylist that we reuse over invocations
223 to avoid excesive memory consumption. Reduces memory usage on an
224 mcs compile by one meg (45 average).
226 * typemanager.cs (LookupTypeReflection): In .NET pointers are
227 private, work around that.
229 2003-07-23 Miguel de Icaza <miguel@ximian.com>
231 * literal.cs (IntLiteral): Define Zero and One static literals.
233 * cs-parser.jay (integer_literal): use static literals to reduce
234 memory usage for the most used literals (0, 1 and -1). 211kb
235 reduced in memory usage.
237 Replace all calls to `new ArrayList' with `new
238 ArrayList(4)' which is a good average number for most allocations,
239 and also requires only 16 bytes of memory for its buffer by
242 This reduced MCS memory usage in seven megabytes for the RSS after
245 2003-07-28 Ravi Pratap <ravi@ximian.com>
247 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
248 handle params methods the correct way by forming only one
249 applicable set with params and normal methods in them. Earlier we
250 were looking at params methods only if we found no normal methods
251 which was not the correct thing to do.
253 (Invocation.BetterFunction): Take separate arguments indicating
254 when candidate and the best method are params methods in their
257 This fixes bugs #43367 and #46199.
259 * attribute.cs: Documentation updates.
261 (CheckAttribute): Rename to CheckAttributeTarget.
262 (GetValidPlaces): Rename to GetValidTargets.
264 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
265 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
269 2003-07-28 Martin Baulig <martin@ximian.com>
271 * class.cs (TypeContainer.DefineMembers): Use the base type's full
272 name when looking up the base class of a nested class. Fixes #46977.
274 2003-07-26 Martin Baulig <martin@ximian.com>
276 * expression.cs (Indexers.Indexer): New nested struct; contains
277 getter, setter and the indexer's type.
278 (Indexers.Properties): This is now an ArrayList of
280 (IndexerAccess.DoResolveLValue): Correctly set the type if the
281 indexer doesn't have any getters.
283 * assign.cs (Assign.DoResolve): Also do the implicit conversions
284 for embedded property and indexer assignments.
286 2003-07-26 Martin Baulig <martin@ximian.com>
288 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
289 preprocessor directive is not the first non-whitespace character
292 2003-07-26 Martin Baulig <martin@ximian.com>
294 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
295 namespace parsing, follow the spec more closely.
297 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
298 NamespaceEntry.Lookup().
300 2003-07-25 Martin Baulig <martin@ximian.com>
302 * MethodCore.cs (OverridesSomething): New public field; it's set
303 from TypeContainer.DefineMembers if this method overrides
304 something (which doesn't need to be a method). Fix #39462.
306 2003-07-25 Ravi Pratap <ravi@ximian.com>
308 * typemanager.cs (GetMembers): Ensure that the list of members is
309 reversed. This keeps things in sync.
311 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
312 find an AttributeUsage attribute.
314 * expression.cs (Invocation.OverloadResolve): Perform the check
315 which disallows Invoke to be directly called on a Delegate.
317 (Error_InvokeOnDelegate): Report error cs1533.
319 2003-07-25 Martin Baulig <martin@ximian.com>
321 * expression.cs (Indexers.GetIndexersForType): Only look in the
322 interface hierarchy if the requested type is already an
323 interface. Fixes #46788 while keeping #46502 fixed.
325 2003-07-25 Martin Baulig <martin@ximian.com>
327 * class.cs (TypeContainer.DefineMembers): Check whether all
328 readonly fields have been assigned and report warning CS0649 if
331 * statement.cs (LocalInfo.IsFixed): Always return true if this is
334 2003-07-24 Ravi Pratap <ravi@ximian.com>
336 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
337 returned from GetMethods to make things consistent with the
338 assumptions MCS makes about ordering of methods.
340 This should comprehensively fix bug #45127 and it does :-)
342 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
343 ordering is actually reverse.
345 * Clean up some debug messages I left lying around.
347 * interface.cs (Populate*): Get rid of code which emits attributes
348 since the stage in which we emit attributes is the 'Emit' stage,
349 not the define stage.
351 (Emit): Move attribute emission for interface members here.
353 2003-07-22 Ravi Pratap <ravi@ximian.com>
355 * expression.cs (Invocation.OverloadResolve): Follow the spec more
356 closely: we eliminate methods in base types when we have an
357 applicable method in a top-level type.
359 Please see section 14.5.5.1 for an exact description of what goes
362 This fixes bug #45127 and a host of other related to corlib compilation.
364 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
365 array is the method corresponding to the top-level type (this is
366 because of the changes made to icall.c) so we change this
369 (MethodGroupExpr.Name): This too.
371 * typemanager.cs (GetElementType): New method which does the right
372 thing when compiling corlib.
374 * everywhere: Make use of the above in the relevant places.
376 2003-07-22 Martin Baulig <martin@ximian.com>
378 * cs-parser.jay (invocation_expression): Moved
379 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
380 `cast_expression', but create a InvocationOrCast which later
381 resolves to either an Invocation or a Cast.
383 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
384 method; call this before EmitStatement() to make sure that this
385 expression can be used as a statement.
387 * expression.cs (InvocationOrCast): New class; resolves to either
388 an Invocation or a Cast.
390 * statement.cs (StatementExpression): Call ResolveStatement() on
391 the ExpressionStatement before emitting it.
393 2003-07-21 Martin Baulig <martin@ximian.com>
395 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
396 `ref' and `out' attributes match; fixes #46220.
397 (MemberAccess.ResolveMemberAccess): You can't reference a type
398 through an expression; fixes #33180.
399 (Indexers.GetIndexersForType): Don't return the indexers from
400 interfaces the class implements; fixes #46502.
402 2003-07-21 Martin Baulig <martin@ximian.com>
404 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
405 CS0661 checks; fixes bug #30442.
407 2003-07-21 Martin Baulig <martin@ximian.com>
409 * decl.cs (AdditionResult): Added `Error'.
411 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
413 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
414 makes cs0031.cs actually work.
416 2003-07-20 Martin Baulig <martin@ximian.com>
418 * namespace.cs: Fixed that bug which caused a crash when compiling
421 2003-07-20 Miguel de Icaza <miguel@ximian.com>
423 * typemanager.cs (LookupTypeReflection): Never expose types which
424 are NotPublic, NestedPrivate, NestedAssembly, or
425 NestedFamANDAssem. We used to return these, and later do a check
426 that would report a meaningful error, but the problem is that we
427 would not get the real match, if there was a name override.
429 2003-07-18 Miguel de Icaza <miguel@ximian.com>
431 * namespace.cs (Namespace, Name): Do not compute the namespace
432 name dynamically, compute it in the constructor. This reduced
433 memory usage by 1697 KB.
435 * driver.cs: Use --pause to pause at the end.
437 2003-07-17 Peter Williams <peter@newton.cx>
439 * Makefile: Change the name of the test target so that it doesn't
440 conflict with the recursive test target.
442 2003-07-17 Miguel de Icaza <miguel@ximian.com>
444 * expression.cs (LocalVariableReference.Emit, EmitAssign,
445 AddressOf): Do not use EmitThis, that was wrong, use the actual
448 2003-07-15 Miguel de Icaza <miguel@ximian.com>
450 * class.cs (MethodData.Define): While checking if a method is an
451 interface implementation, improve the test: If we are not public
452 (use new test here: use the computed MethodAttributes directly,
453 instead of the parsed modifier flags) check if the `implementing'
454 method comes from an interface or not.
456 * pending.cs (VerifyPendingMethods): Slightly better error
459 * makefile: add test target that does the mcs bootstrap.
461 2003-07-16 Ravi Pratap <ravi@ximian.com>
463 * interface.cs (Define): Do nothing here since there are no
464 members to populate etc. Move the attribute emission out of here
465 since this was just totally the wrong place to put it. Attribute
466 application happens during the 'Emit' phase, not in the 'Define'
469 (Emit): Add this method and move the attribute emission here
471 * rootcontext.cs (EmitCode): Call the Emit method on interface
474 2003-07-14 Ravi Pratap M <ravi@ximian.com>
476 * expression.cs (OverloadResolve): Report error only if Location
477 is not 'Null' which means that there was a probe going on.
479 2003-07-14 Martin Baulig <martin@ximian.com>
481 * expression.cs (ConditionalLogicalOperator): New public class to
482 implement user defined conditional logical operators.
483 This is section 14.11.2 in the spec and bug #40505.
485 2003-07-14 Martin Baulig <martin@ximian.com>
487 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
489 2003-07-14 Martin Baulig <martin@ximian.com>
491 * codegen.cs (EmitContext.InFixedInitializer): New public field.
493 * ecore.cs (IVariable.VerifyFixed): New interface method.
495 * expression.cs (Unary.ResolveOperator): When resolving the `&'
496 operator, check whether the variable is actually fixed. Fixes bug
497 #36055. Set a variable definitely assigned when taking its
498 address as required by the spec.
500 * statement.cs (LocalInfo.IsFixed): New field.
501 (LocalInfo.MakePinned): Set `IsFixed' to true.
503 2003-07-14 Ravi Pratap M <ravi@ximian.com>
505 * attribute.cs (Attribute.Resolve): While doing a Member lookup
506 for .ctors, ensure that we only ask for members declared in the
507 attribute type (BindingFlags.DeclaredOnly).
511 * expression.cs (Error_WrongNumArguments): Report error 1501
512 correctly the way CSC does.
514 2003-07-13 Martin Baulig <martin@ximian.com>
516 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
517 lookup on the fully qualified name, to make things like "X.X" work
518 where "X.X" is a fully qualified type name, but we also have a
519 namespace "X" in the using list. Fixes #41975.
521 2003-07-13 Martin Baulig <martin@ximian.com>
523 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
524 function. If we're a CompoundAssign, we need to create an embedded
525 CompoundAssign, not an embedded Assign.
526 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
529 2003-07-13 Martin Baulig <martin@ximian.com>
531 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
532 work to fix bug #46088.
534 2003-07-13 Ravi Pratap <ravi@ximian.com>
536 * class.cs (Operator.Emit): Do not emit attributes here - it is
537 taken care of by the Method class that we delegate too. This takes
540 2003-07-10 Martin Baulig <martin@ximian.com>
542 * expression.cs (TypeOfVoid): New class.
543 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
545 2003-07-10 Martin Baulig <martin@ximian.com>
547 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
550 2003-07-10 Martin Baulig <martin@ximian.com>
552 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
553 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
555 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
557 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
559 2003-07-10 Martin Baulig <martin@ximian.com>
561 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
562 of decimal. Fixes #42850.
564 NOTE: I also fixed the created byte blob, but this doesn't work on
565 the MS runtime and csc never produces any byte blobs for decimal
568 2003-07-10 Martin Baulig <martin@ximian.com>
570 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
571 structs; fixes #32068.
572 (Block.AddChildVariableNames): Fixed #44302.
574 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
576 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
578 2003-07-07 Miguel de Icaza <miguel@ximian.com>
580 * attribute.cs: And this test is onger needed.
582 2003-07-08 Martin Baulig <martin@ximian.com>
584 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
585 inaccessible types. Fixes #36313.
587 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
589 * namespace.cs (NamespaceEntry): Create implicit entries for all
590 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
591 implicit entries for N1.N2 and N1.
593 2003-07-08 Martin Baulig <martin@ximian.com>
595 Rewrote the handling of namespaces to fix a lot of the issues
596 wrt. `using' aliases etc.
598 * namespace.cs (Namespace): Splitted this class into a
599 per-assembly `Namespace' and a per-file `NamespaceEntry'.
601 * typemanager.cs (TypeManager.IsNamespace): Removed.
602 (TypeManager.ComputeNamespaces): Only compute namespaces from
603 loaded assemblies here, not the namespaces from the assembly we're
606 2003-07-08 Martin Baulig <martin@ximian.com>
608 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
610 2003-07-07 Miguel de Icaza <miguel@ximian.com>
612 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
615 I thought about the memory savings here, but LookupTypeReflection
616 is used under already very constrained scenarios. Compiling
617 corlib or mcs only exposes one hit, so it would not really reduce
618 any memory consumption.
620 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
622 * typemanager.cs: fixes bug #45889 by only adding public types from
623 other assemblies to the list of known types.
625 2003-07-07 Miguel de Icaza <miguel@ximian.com>
627 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
628 on the type we resolved.
630 2003-07-05 Martin Baulig <martin@ximian.com>
632 * pending.cs (PendingImplementation.ParentImplements): Don't
633 create the proxy if the parent is abstract.
635 * class.cs (TypeContainer.DefineIndexers): Process explicit
636 interface implementations first. Fixes #37714.
638 2003-07-04 Miguel de Icaza <miguel@ximian.com>
640 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
641 defined recursively; but since we modify the input parameters
642 (left is set to `this' temporarily), we reset this value if the
643 left_is_explicit is false, which gives the original semantics to
646 * literal.cs (NullPointer): new class used to represent a null
647 literal in a pointer context.
649 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
650 type is a pointer, use a NullPointer object instead of a
651 NullLiteral. Closes 43687
653 (ExplicitConversion): Convert pointer values using
654 the conv opcode to the proper type.
656 * ecore.cs (New): change ValueTypeVariable property into a method,
657 that returns whether the valuetype is suitable for being used.
659 * expression.cs (Binary.DoNumericPromotions): Only return if we
660 the int constant was a valid uint, and we can return both left and
661 right as uints. If not, we continue processing, to trigger the
662 type conversion. This fixes 39018.
664 * statement.cs (Block.EmitMeta): During constant resolution, set
665 the CurrentBlock property on the emitcontext, so that we resolve
668 2003-07-02 Martin Baulig <martin@ximian.com>
670 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
671 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
673 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
674 than emitting it here.
676 * statement.cs: Fixed some more flow analysis bugs.
678 2003-07-02 Martin Baulig <martin@ximian.com>
680 * class.cs (MethodData.Define): When implementing interface
681 methods, set Final unless we're Virtual.
683 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
684 check work for interface methods.
686 2003-07-01 Martin Baulig <martin@ximian.com>
688 * ecore.cs (EmitContext.This): Replaced this property with a
689 GetThis() method which takes a Location argument. This ensures
690 that we get the correct error location for a CS0188.
692 2003-07-01 Miguel de Icaza <miguel@ximian.com>
694 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
695 ImplicitStandardConversion.
697 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
699 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
701 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
704 2003-06-30 Miguel de Icaza <miguel@ximian.com>
706 * class.cs (Constructor.Define): Turn off initlocals for unsafe
709 (MethodData.Define): Turn off initlocals for unsafe methods.
711 2003-06-29 Miguel de Icaza <miguel@ximian.com>
713 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
714 complete; Fixes #37521.
716 * delegate.cs: Use Modifiers.TypeAttr to compute the
717 TypeAttributes, instead of rolling our own. This makes the flags
718 correct for the delegates.
720 2003-06-28 Miguel de Icaza <miguel@ximian.com>
722 * class.cs (Constructor.Define): Set the private flag for static
723 constructors as well.
725 * cs-parser.jay (statement_expression): Set the return value to
726 null, to avoid a crash when we catch an error.
728 2003-06-24 Miguel de Icaza <miguel@ximian.com>
730 * cs-parser.jay: Applied patch from Jackson that adds support for
731 extern and unsafe modifiers to destructor declarations.
733 * expression.cs: Report error 21 if the user is trying to index a
736 * driver.cs: Add an error message, suggested by the bug report.
738 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
739 if we do not have a ": this ()" constructor initializer. Fixes 45149
741 2003-06-14 Miguel de Icaza <miguel@ximian.com>
743 * namespace.cs: Add some information to reduce FAQs.
745 2003-06-13 Miguel de Icaza <miguel@ximian.com>
747 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
748 underlying enumeration types. Fixes #43915.
750 * expression.cs: Treat ushort/short as legal values to be used in
753 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
755 * delegate.cs: transfer custom attributes for paramenters from
756 the delegate declaration to Invoke and BeginInvoke.
758 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
760 * attribute.cs: handle custom marshalers and emit marshal info
763 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
765 * makefile.gnu: Added anonymous.cs to the compiler sources.
767 2003-05-28 Miguel de Icaza <miguel@ximian.com>
769 * iterators.cs: Change the name of the proxy class to include two
772 * cs-parser.jay: Update grammar to include anonymous methods.
774 * anonymous.cs: new file.
776 2003-05-27 Miguel de Icaza <miguel@ximian.com>
778 * class.cs (Field.Define): Add missing test for pointers and
781 2003-05-27 Ravi Pratap <ravi@ximian.com>
783 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
784 we use the stobj opcode.
786 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
787 since it wasn't the correct fix.
789 It still is puzzling that we are required to use stobj for IntPtr
790 which seems to be a ValueType.
792 2003-05-26 Miguel de Icaza <miguel@ximian.com>
794 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
795 during regular simple name resolution. Now, the trick is that
796 instead of returning for processing the simplename, we do a
797 TypeManager.LookupType (ie, a rooted lookup as opposed to a
798 contextual lookup type). If a match is found, return that, if
799 not, return for further composition.
801 This fixes long-standing 30485.
803 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
804 using the address to initialize an object, do an Stobj instead of
805 using the regular Stelem.
807 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
808 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
809 Because if we are a BaseIndexerAccess that value will be true.
812 * statement.cs (GotoCase.Resolve): Return after reporting an
813 error, do not attempt to continue.
815 * expression.cs (PointerArithmetic.Emit): If our operand is a
816 long, convert our constants to match the operand before
817 multiplying. Convert to I type before adding. Fixes 43670.
819 2003-05-14 Ravi Pratap <ravi@ximian.com>
821 * enum.cs (ImplicitConversionExists) : Rename to
822 ImplicitEnumConversionExists to remove ambiguity.
824 * ecore.cs (NullCast): New type of cast expression class which
825 basically is very similar to EmptyCast with the difference being
826 it still is a constant since it is used only to cast a null to
830 * convert.cs (ImplicitReferenceConversion): When casting a null
831 literal, we return a NullCast.
833 * literal.cs (NullLiteralTyped): Remove - I don't see why this
834 should be around anymore.
836 The renaming (reported was slightly wrong). Corrections:
838 ConvertImplicitStandard -> ImplicitConversionStandard
839 ConvertExplicitStandard -> ExplicitConversionStandard
841 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
842 before passing them in !
844 * convert.cs (ImplicitConversionStandard): When comparing for
845 equal expr and target types, ensure that expr is not a
848 In general, we must not be checking (expr_type ==
849 target_type) in the top level conversion methods
850 (ImplicitConversion, ExplicitConversion etc). This checking is
851 done in the methods that they delegate to.
853 2003-05-20 Miguel de Icaza <miguel@ximian.com>
855 * convert.cs: Move Error_CannotConvertType,
856 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
857 ImplicitNumericConversion, ImplicitConversionExists,
858 ImplicitUserConversionExists, StandardConversionExists,
859 FindMostEncompassedType, FindMostSpecificSource,
860 FindMostSpecificTarget, ImplicitUserConversion,
861 ExplicitUserConversion, GetConversionOperators,
862 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
863 TryImplicitIntConversion, Error_CannotConvertImplicit,
864 ConvertImplicitRequired, ConvertNumericExplicit,
865 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
866 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
869 Perform the following renames:
871 StandardConversionExists -> ImplicitStandardConversionExists
872 ConvertImplicit -> ImplicitConversion
873 ConvertImplicitStandard -> ImplicitStandardConversion
874 TryImplicitIntConversion -> ImplicitIntConversion
875 ConvertImplicitRequired -> ImplicitConversionRequired
876 ConvertNumericExplicit -> ExplicitNumericConversion
877 ConvertReferenceExplicit -> ExplicitReferenceConversion
878 ConvertExplicit -> ExplicitConversion
879 ConvertExplicitStandard -> ExplicitStandardConversion
881 2003-05-19 Martin Baulig <martin@ximian.com>
883 * statement.cs (TypeInfo.StructInfo): Made this type protected.
884 (TypeInfo): Added support for structs having structs as fields.
886 * ecore.cs (FieldExpr): Implement IVariable.
887 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
888 VariableInfo for the field.
890 2003-05-18 Martin Baulig <martin@ximian.com>
892 * expression.cs (This.DoResolve): Report a CS0027 if we're
893 emitting a field initializer.
895 2003-05-18 Martin Baulig <martin@ximian.com>
897 * expression.cs (This.ResolveBase): New public function.
898 (This.DoResolve): Check for CS0188.
900 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
903 * ecore.cs (MethodGroupExpr.DoResolve): Set the
904 `instance_expression' to null if we don't have any non-static
907 2003-05-18 Martin Baulig <martin@ximian.com>
909 Reworked the way how local variables and parameters are handled by
910 the flow analysis code.
912 * statement.cs (TypeInfo, VariableMap): New public classes.
913 (VariableInfo): New public class. This is now responsible for
914 checking whether a variable has been assigned. It is used for
915 parameters and local variables.
916 (Block.EmitMeta): Take the InternalParameters as argument; compute
917 the layout of the flow vectors here.
918 (Block.LocalMap, Block.ParameterMap): New public properties.
919 (FlowBranching): The .ctor doesn't get the InternalParameters
920 anymore since Block.EmitMeta() now computes the layout of the flow
922 (MyStructInfo): This class is now known as `StructInfo' and nested
923 in `TypeInfo'; we don't access this directly anymore.
925 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
926 property and removed IsAssigned(), IsFieldAssigned(),
927 SetAssigned() and SetFieldAssigned(); we now call them on the
928 VariableInfo so we don't need to duplicate this code everywhere.
930 * expression.cs (ParameterReference): Added `Block block' argument
932 (LocalVariableReference, ParameterReference, This): The new
933 VariableInfo class is now responsible for all the definite
936 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
937 IsParameterAssigned, SetParameterAssigned): Removed.
939 2003-05-18 Martin Baulig <martin@ximian.com>
941 * typemanager.cs (InitCoreTypes): Try calling
942 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
943 the 3-args-version. Corlib now also needs our `void_type'.
944 (GetMethod): Added overloaded version which takes an optional
945 `bool report_errors' to allow lookups of optional methods.
947 2003-05-12 Martin Baulig <martin@ximian.com>
949 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
950 only used for locals and not for parameters.
952 2003-05-12 Miguel de Icaza <miguel@ximian.com>
954 * support.cs (InternalParameters.ParameterType): Return the
955 ExternalType of the parameter.
957 * parameter.cs (Parameter.ExternalType): drop the two arguments,
960 2003-05-11 Miguel de Icaza <miguel@ximian.com>
962 * class.cs (MethodData.Define): Do not set the `newslot' on
963 interface members, if they are also flagged as "override".
965 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
966 better code for ++i and i++. This only works for static fields
969 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
970 want to pull the DeclSpace out of the builder_to_declspace instead
971 of the TypeBuilder (like in TypeContainer.FindMembers).
973 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
974 instead of LookupTypeContainer. Fixes the crash on .NET for
975 looking up interface members.
977 * const.cs: Create our own emit context during the Definition
978 stage, so that constants are evaluated in the proper context, when
979 a recursive definition happens.
981 2003-05-11 Martin Baulig <martin@ximian.com>
983 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
984 new block for a switch section.
985 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
986 the adding/lookup in the switch block. Fixes #39828.
988 2003-05-09 Miguel de Icaza <miguel@ximian.com>
990 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
991 functionality: I needed to convert the data after I had performed
992 the add/sub operation into the operands type size.
994 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
995 pass the type for the box operation, otherwise the resulting
996 object would have been of type object.
998 (BoxedCast): Add constructor to specify the type to box as.
1000 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1002 * iterators.cs: I was reusing the `count' variable inadvertently,
1003 take steps to not allow this to happen.
1005 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1007 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1008 by creating an array at the point where the params starts and
1009 putting all those arguments there, then adjusting the size of the
1012 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1014 * expression.cs (New.AddressOf): Implement interface
1015 IMemoryLocation. This is used when the `new' operator is used in
1016 the context of an invocation to a method on a value type.
1018 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1021 * namespace.cs: Also check the using aliases here.
1023 * driver.cs: Move the test for using validity after the types have
1024 been entered, so we do a single pass that also includes the using
1027 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1028 in the regular case. CreateSiblingForFinally is doing extra
1031 * attribute.cs (GetAttributeArgumentExpression): Store the result
1032 on an out value, and use the return value to indicate failure
1033 instead of using null (which is a valid return for Constant.GetValue).
1035 * statement.cs: Perform the analysis flow for the increment
1036 portion after the statement, because this will be the real flow of
1037 execution. Fixes #42385
1039 * codegen.cs (EmitContext.EmitArgument,
1040 EmitContext.EmitStoreArgument): New helper functions when the
1041 RemapToProxy flag is set.
1043 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1046 Add support for remapping parameters.
1048 * iterators.cs: Propagate parameter values; Store parameter
1049 values in the proxy classes.
1051 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1053 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1054 need a proxy reference; I do not know what I was thinking
1056 * cs-parser.jay (constructor_initializer): catch another error,
1057 and display nice message.
1059 (field_declaration): catch void field declaration
1060 to flag a better error.
1062 * class.cs (MemberBase.CheckBase): Report an error instead of a
1063 warning if a new protected member is declared in a struct.
1064 (Field.Define): catch the error of readonly/volatile.
1066 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1068 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1069 volatile variable is taken
1071 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1073 * statement.cs (Fixed.Resolve): Report an error if we are not in
1076 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1078 * typemanager.cs: reuse the code that handles type clashes for
1079 delegates and enumerations.
1081 * class.cs (Report28): Always report.
1083 * expression.cs (EncodeAsAttribute): Allow nulls here.
1085 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1087 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1088 the functionality for testing whether an expression is valid for
1089 an attribute here. Also handle the case of arrays of elements
1092 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1093 encoding a linear array into an array of objects that are suitable
1094 to be passed to an CustomAttributeBuilder.
1096 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1098 * ecore.cs: (FieldExpr): Handle field remapping here.
1100 * iteratators.cs: Pass the instance variable (if the method is an
1101 instance method) to the constructors, so we can access the field
1102 variables on the class.
1104 TODO: Test this with structs. I think the THIS variable on
1105 structs might have to be a pointer, and not a refenrece
1107 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1109 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1110 local variables to fields in a proxy class.
1112 * iterators.cs (PopulateProxy): Rename our internal fields to
1114 Create a <THIS> field if we are an instance method, so we can
1115 reference our parent container variables.
1116 (MapVariable): Called back from the EmitContext code to enter a
1117 new variable to field mapping into the proxy class (we just create
1121 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1122 for using the remapped locals to fields.
1124 I placed the code here, because that gives the same semantics to
1125 local variables, and only changes the Emit code.
1127 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1128 statements inside iterators.
1129 (VariableInfo): Add a FieldBuilder for the cases when we are
1130 remapping local variables to fields in a proxy class
1132 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1133 current_block != null.
1135 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1136 not cope with strings, as it has been moved to the
1137 TableSwitchEmit. Fixed bug in switch generation.
1139 * expression.cs (New.DoResolve): Provide more context for the user
1140 when reporting an error.
1142 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1145 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1146 check the permissions for it. Note than in a type-resolution
1147 context the check was already present in DeclSpace.ResolveType,
1148 but was missing from the MemberAccess.
1150 (ArrayCreation.CheckIndices): warn if the user has
1151 more nested levels of expressions, but there are no more
1152 dimensions specified. Avoids crash on bug 41906.
1154 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1156 * statement.cs (Block): replace Implicit bool, for a generic
1158 New flag: `Unchecked'. This is used during the EmitMeta phase
1159 (which is out-of-line with the regular Resolve/Emit process for a
1160 statement, as this is done ahead of time, but still gets a chance
1161 to call constant resolve).
1163 (Block.Flags): new enum for adding a new flag.
1165 (Block.EmitMeta): track the state of unchecked.
1167 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1168 to enable constant resolution to work there as well.
1170 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1172 * typemanager.cs (ienumerable_type): Also look up
1173 System.Collections.IEnumerable.
1175 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1177 TODO: Test more than one conditional per method.
1179 * class.cs (Indexer.Define): Report the location where the user is
1180 referencing the unsupported feature.
1182 (MethodData): Overload the use of `conditionals' to
1183 minimize the creation of needless ArrayLists. This saves roughly
1184 212kb on my machine.
1186 (Method): Implement the new IIteratorContainer interface.
1187 (Method.SetYields): Implement the method by setting the ModFlags
1188 to contain METHOD_YIELDS.
1190 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1191 which just got set to null.
1193 * iterators.cs: New file.
1195 (Yield, YieldBreak): New statements.
1197 * statement.cs (Return.Resolve): Flag an error if we are used in
1200 * codegen.cs (InIterator): New flag set if the code is being
1201 compiled in an iterator method.
1203 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1204 internal modifier, and we just use it to avoid adding extra
1205 fields, as this is seldom used.
1207 * cs-parser.jay: Add yield_statement (yield and yield break).
1209 * driver.cs: New flag -v2 to turn on version 2 features.
1211 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1212 hashtable when v2 is enabled.
1214 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1216 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1217 there is already a namespace defined with this name.
1219 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1220 people upgraded their corlibs.
1222 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1223 always use fully qualified types, no need to use the compiler
1226 (TypeManager.IsNamespace): Use binarysearch.
1228 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1229 AddDelegate): I did not quite use the new IsValid API properly: I
1230 have to pass the short-name and the fullname. I was passing only
1231 the basename instead of the fullname sometimes.
1233 (TypeContainer.DefineType): call NamespaceClash.
1235 * interface.cs (Interface.DefineType): use NamespaceClash before
1238 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1241 * enum.cs: (Enum.DefineType): use NamespaceClash before
1244 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1245 speed increase. First, use the negative_hits cache when we get a
1246 negative. Second, add the type with its full original name
1247 instead of the new . and + encoded name (reflection uses + to
1248 separate type from a nested type). Use LookupTypeReflection
1249 directly which bypasses the type->name hashtable (that we already
1250 know does not contain the type.
1252 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1253 location/container type.
1255 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1257 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1259 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1261 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1262 method is being referenced in the method group from a static
1263 context, and report error 120 if so.
1265 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1268 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1269 is created, we create the A namespace).
1271 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1274 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1276 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1277 invocation to ModuleBuilder.GetType with the same values will
1278 return a new type instance, so we need to cache its return
1281 * expression.cs (Binary.ResolveOperator): Only allow the compare
1282 operators on enums if they are of the same type.
1284 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1285 types of ValueType on their own case. Before we were giving them
1286 the same treatment as objects.
1288 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1289 fullname. Short name is used to compare against container name.
1290 Fullname is used to check against defined namespace names.
1292 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1293 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1295 (Method.CheckBase): Call parent.
1296 (MemberBase.CheckBase): Check for protected members on sealed
1298 (PropertyBase.CheckBase): Call parent.
1299 (Field.Define): Call parent.
1301 * report.cs: Negative error codes are now mapped to 8000 - code,
1302 so that the display is render more nicely.
1304 * typemanager.cs: Do not use try/catch, instead report a regular
1307 (GetPointerType, GetReferenceType): These methods provide
1308 mechanisms to obtain the T* and T& from a T. We had the code
1309 previously scattered around the code base, and it also used
1310 TypeManager.LookupType that would go through plenty of caches.
1311 This one goes directly to the type source.
1313 In some places we did the Type.GetType followed by
1314 ModuleBuilder.GetType, but not in others, so this unifies the
1317 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1318 statements now that we have namespace information.
1320 * typemanager.cs (IsNamespace): New method, returns whether the
1321 string presented is a namespace or not.
1323 (ComputeNamespaces): New public entry point, computes the list of
1324 available namespaces, using the GetNamespaces API call in Mono, or
1325 the slower version in MS.NET.
1327 Now before we start the semantic analysis phase, we have a
1328 complete list of namespaces including everything that the user has
1331 Deleted old code to cache namespaces in .nsc files.
1333 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1335 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1336 class/struct location definition Location for the implicit
1337 constructor location.
1339 (Operator.Define): Use the location of the operator for the
1340 implicit Method definition.
1342 (Constructor.Emit): use the constructor location for the implicit
1343 base initializer constructor.
1345 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1346 and the Expression class now contains two new methods:
1348 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1349 isolate type lookup from the rest of the resolution process.
1351 Since we use Expressions to hold type definitions due to the way
1352 we parse the input we have historically overloaded Resolve to
1353 perform the Type lookups if a special flag is passed. Now this is
1354 eliminated and two methods take their place.
1356 The differences in the two methods between xStep and xTerminal is
1357 that xStep is involved in our current lookup system that uses
1358 SimpleNames to compose a name, while xTerminal is used just to
1359 catch the case where the simplename lookup failed.
1361 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1363 * expression.cs (ResolveMemberAccess): Remove redundant code.
1364 TypeExpr expressions are always born fully resolved.
1366 * interface.cs (PopulateMethod): Do not lookup the types twice.
1367 We were doing it once during SemanticAnalysis and once during
1370 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1371 in local variable type definitions, were being returned as a
1372 SimpleName (we decomposed everything into a string), that is
1373 because primary_expression was being used instead of a type in the
1374 grammar (reduce/reduce conflicts).
1376 The part that was wrong is that we converted the expression into a
1377 string (an oversimplification in one hand, compounded with primary
1378 expressions doing string concatenation).
1384 Would return "A.B.C[]" as a SimpleName. This stopped things like
1385 using clauses from working on this particular context. And a type
1386 was being matched directly against "A.B.C[]".
1388 We now use the correct approach, and allow for ComposedCast to be
1389 part of the unary expression. So the "A.B.C []" become a composed
1390 cast of "A.B.C" (as a nested group of MemberAccess with a
1391 SimpleName at the end) plus the rank composition "[]".
1395 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1397 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1398 for the access level checking.
1400 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1401 `TypeContainer container', because I kept getting confused when I
1402 was debugging this code.
1404 * expression.cs (Indexers): Instead of tracking getters/setters,
1405 we now track them in parallel. We create one arraylist less, but
1406 most importantly it is possible now for the LValue code to find a
1407 matching get for a set.
1409 (IndexerAccess.DoResolveLValue): Update the code.
1410 GetIndexersForType has been modified already to extract all the
1411 indexers from a type. The code assumed it did not.
1413 Also make the code set the correct return type for the indexer.
1414 This was fixed a long time ago for properties, but was missing for
1415 indexers. It used to be void_type.
1417 (Binary.Emit): Test first for doubles instead of
1418 floats, as they are more common.
1420 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1421 when dealing with floats and the <=, >= operators. This fixes bug
1424 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1425 to load the array value by emitting a load on the foreach variable
1426 type. This was incorrect.
1428 We now emit the code to load an element using the the array
1429 variable type, and then we emit the conversion operator.
1433 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1435 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1437 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1439 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1440 test for protection before we test for signatures.
1442 (MethodSignature.ToString): implement.
1444 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1445 to the case where we reduced into a LongConstant.
1447 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1448 depend on whether the information is acurrate, because the
1449 Microsoft runtime will always claim that the array type is public,
1450 regardless of the real state.
1452 If the type is a pointer, another problem happens: the type is
1453 reported as non-public in Microsoft.
1455 In both cases we have to call CheckAccessLevel recursively with
1456 the underlying type as the argument to be tested.
1458 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1460 * assign.cs (Assign.Emit): If we are dealing with a compound
1461 assignment expression, we should use the code path that stores the
1462 intermediate result in a temporary value. This fixes #40903.
1464 *expression.cs (Indirection.ToString): Provide ToString method for
1467 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
1469 * class.cs: Null out fields holding references to Block objects so
1470 they can be garbage collected.
1472 * expression.cs (OverloadResolve): Remove unused local.
1474 2003-04-07 Martin Baulig <martin@ximian.com>
1476 * codegen.cs (EmitContext.CurrentFile): New public field.
1477 (EmitContext.Mark): Use the CurrentFile to check whether the
1478 location is in the correct file.
1479 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1481 2003-04-07 Martin Baulig <martin@ximian.com>
1483 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1485 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1486 location. [FIXME: The location argument which gets passed to this
1487 method is sometimes wrong!]
1489 2003-04-07 Nick Drochak <ndrochak@gol.com>
1491 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1493 2003-04-07 Miguel de Icaza <miguel@ximian.com>
1495 * expression.cs (Indirection.EmitAssign): We were using the
1496 temporary, but returning immediately instead of continuing the
1499 2003-04-06 Martin Baulig <martin@ximian.com>
1501 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1502 if it's a nested child, but also deriving from the outer class.
1505 * typemanager.cs (IsNestedChildOf): Make this work if it's a
1506 nested child, but also deriving from the outer class. See
1508 (FilterWithClosure): We may access private members of the outer
1509 class if we're a nested child and deriving from the outer class.
1510 (RealMemberLookup): Only set `closure_private_ok' if the
1511 `original_bf' contained BindingFlags.NonPublic.
1513 2003-04-05 Martin Baulig <martin@ximian.com>
1515 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1517 2003-04-02 Miguel de Icaza <miguel@ximian.com>
1519 * class.cs (Event.Define): Do not allow abstract events to have
1522 2003-04-01 Miguel de Icaza <miguel@ximian.com>
1524 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1525 block in event declarations.
1527 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1528 value type, get its address.
1530 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1531 leaving a class on the stack instead of a boolean value (int
1532 0/1). Change the code so we compare against null, and then the
1533 result against zero.
1535 * class.cs (TypeContainer.GetClassBases): We were checking for the
1536 parent class being sealed too late.
1538 * expression.cs (Binary.Emit): For <= and >= when dealing with
1539 floating point values, use cgt.un and clt.un instead of cgt and
1542 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
1544 * statement.cs: Apply the same optimization as MS: skip the
1545 GetEnumerator returning an IEnumerator, and use the one returning a
1546 CharEnumerator instead. This allows us to avoid the try-finally block
1549 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
1551 * cs-parser.jay: Attributes cannot be applied to
1552 namespaces. Fixes #40473
1554 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1557 (Add*): check if the name is valid using the full name for constants,
1558 fields, properties and events.
1560 2003-03-28 Miguel de Icaza <miguel@ximian.com>
1562 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1563 char constants to be part of the enumeration.
1565 * expression.cs (Conditional.DoResolve): Add support for operator
1566 true. Implements the missing functionality from 14.12
1568 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1569 operator true/false as required by the spec.
1571 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1572 implicit conversion to boolean.
1574 * statement.cs (Statement.ResolveBoolean): A boolean expression is
1575 also one where the type implements `operator true'.
1577 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1578 get an expression that will invoke operator true based on an
1581 (GetConversionOperators): Removed the hack that called op_True
1584 (Expression.ResolveBoolean): Move this from Statement.
1586 2003-03-17 Miguel de Icaza <miguel@ximian.com>
1588 * ecore.cs (FieldExpr): do not allow initialization of initonly
1589 fields on derived classes
1591 2003-03-13 Martin Baulig <martin@ximian.com>
1593 * statement.cs (Block.Emit): Call ig.BeginScope() and
1594 ig.EndScope() when compiling with debugging info; call
1595 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1597 2003-03-08 Miguel de Icaza <miguel@ximian.com>
1599 * expression.cs (Indexers): Do not construct immediately, allow
1600 for new members to be appended as we go. Fixes 38143
1602 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1604 * expression.cs: save/restore context when resolving an unchecked
1607 2003-03-05 Miguel de Icaza <miguel@ximian.com>
1609 * cfold.cs: Catch division by zero in modulus operator during
1612 2003-03-03 Miguel de Icaza <miguel@ximian.com>
1614 * interface.cs (Interface.DefineMembers): Avoid defining members
1617 2003-02-27 Miguel de Icaza <miguel@ximian.com>
1619 * driver.cs: handle the +/- options for -noconfig
1621 * statement.cs (Unckeched.Resolve): Also track the state of
1622 unchecked in the Resolve phase.
1624 2003-02-27 Martin Baulig <martin@ximian.com>
1626 * ecore.cs (Expression.MemberLookup): Don't create a
1627 MethodGroupExpr for something which is not a method. Fixes #38291.
1629 2003-02-25 Miguel de Icaza <miguel@ximian.com>
1631 * class.cs (MemberBase.CheckParameters): Also check that the type
1632 is unmanaged if it is a pointer.
1634 * expression.cs (SizeOf.Resolve): Add location information.
1636 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1637 a managed type is declared.
1639 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1640 parameter modifiers as well. Fixes bug 38606
1642 * class.cs: Very sad. Am backing out the speed up changes
1643 introduced by the ArrayList -> Array in the TypeContainer, as they
1644 were not actually that much faster, and introduced a bug (no error
1645 reports on duplicated methods).
1647 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1648 source first, this will guarantee that we have a valid expression
1649 before calling in lower levels functions that will require a
1650 resolved object. Then use this original_source in the
1651 target.ResolveLValue instead of the original source that was
1654 Another change. Use target.Resolve instead of LValueResolve.
1655 Although we are resolving for LValues, we will let the Assign code
1656 take care of that (it will be called again from Resolve). This
1657 basically allows code like this:
1659 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1660 class Y { void A (X x) { x [0] += o; }
1662 The problem was that the indexer was trying to resolve for
1663 set_Item (idx, object o) and never finding one. The real set_Item
1664 was set_Item (idx, X). By delaying the process we get the right
1669 2003-02-23 Martin Baulig <martin@ximian.com>
1671 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1672 while calling DoEmit ().
1674 * codegen.cs (EmitContext.Mark): Don't mark locations in other
1675 source files; if you use the #line directive inside a method, the
1676 compiler stops emitting line numbers for the debugger until it
1677 reaches the end of the method or another #line directive which
1678 restores the original file.
1680 2003-02-23 Martin Baulig <martin@ximian.com>
1682 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1684 2003-02-23 Martin Baulig <martin@ximian.com>
1686 * statement.cs (Block.AddChildVariableNames): We need to call this
1687 recursively, not just for our immediate children.
1689 2003-02-23 Martin Baulig <martin@ximian.com>
1691 * class.cs (Event.Define): Always make the field private, like csc does.
1693 * typemanager.cs (TypeManager.RealMemberLookup): Make events
1694 actually work, fixes bug #37521.
1696 2003-02-23 Miguel de Icaza <miguel@ximian.com>
1698 * delegate.cs: When creating the various temporary "Parameters"
1699 classes, make sure that we call the ComputeAndDefineParameterTypes
1700 on those new parameters (just like we do with the formal ones), to
1701 allow them to be resolved in the context of the DeclSpace.
1703 This fixes the bug that Dick observed in Bugzilla #38530.
1705 2003-02-22 Miguel de Icaza <miguel@ximian.com>
1707 * expression.cs (ResolveMemberAccess): When resolving a constant,
1708 do not attempt to pull a constant if the value was not able to
1709 generate a valid constant.
1711 * const.cs (LookupConstantValue): Do not report more errors than required.
1713 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1715 * expression.cs: fixes bug #38328.
1717 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1719 * class.cs: Changed all the various members that can be part of a
1720 class from being an ArrayList to be an Array of the right type.
1721 During the DefineType type_list, interface_list, delegate_list and
1722 enum_list are turned into types, interfaces, delegates and enums
1725 And during the member population, indexer_list, event_list,
1726 constant_list, field_list, instance_constructor_list, method_list,
1727 operator_list and property_list are turned into their real arrays.
1729 Although we could probably perform this operation earlier, for
1730 good error reporting we need to keep the lists and remove the
1731 lists for longer than required.
1733 This optimization was triggered by Paolo profiling the compiler
1734 speed on the output of `gen-sample-program.pl' perl script.
1736 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
1737 not crash in methods like MemberLookupFailed that use this field.
1739 This problem arises when the compiler fails to resolve a type
1740 during interface type definition for example.
1742 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1744 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
1745 inherit from System.Object, so we have to stop at null, not only
1746 when reaching System.Object.
1748 2003-02-17 Miguel de Icaza <miguel@ximian.com>
1750 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
1751 DeclaredOnly because the parent indexer might have had a different
1752 name, but did not loop until the top of the hierarchy was reached.
1754 The problem this one fixes is 35492: when a class implemented an
1755 indexer from an interface, we were getting the interface method
1756 (which was abstract) and we were flagging an error (can not invoke
1759 This also keeps bug 33089 functioning, and test-148 functioning.
1761 * typemanager.cs (IsSpecialMethod): The correct way of figuring
1762 out if a method is special is to see if it is declared in a
1763 property or event, or whether it is one of the predefined operator
1764 names. This should fix correctly #36804.
1766 2003-02-15 Miguel de Icaza <miguel@ximian.com>
1768 The goal here is to remove the dependency on EmptyCast.Peel ().
1769 Killing it completely.
1771 The problem is that currently in a number of places where
1772 constants are expected, we have to "probe" for an EmptyCast, and
1773 Peel, which is not the correct thing to do, as this will be
1774 repetitive and will likely lead to errors.
1776 The idea is to remove any EmptyCasts that are used in casts that
1777 can be reduced to constants, so we only have to cope with
1780 This bug hunt was triggered by Bug 37363 and the desire to remove
1781 the duplicate pattern where we were "peeling" emptycasts to check
1782 whether they were constants. Now constants will always be
1785 * ecore.cs: Use an enumconstant here instead of wrapping with
1788 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1789 throwing me off. By handling this we can get rid of a few hacks.
1791 * statement.cs (Switch): Removed Peel() code.
1793 2003-02-14 Miguel de Icaza <miguel@ximian.com>
1795 * class.cs: Location information for error 508
1797 * expression.cs (New.DoResolve): Add a guard against double
1798 resolution of an expression.
1800 The New DoResolve might be called twice when initializing field
1801 expressions (see EmitFieldInitializers, the call to
1802 GetInitializerExpression will perform a resolve on the expression,
1803 and later the assign will trigger another resolution
1805 This leads to bugs (#37014)
1807 * delegate.cs: The signature for EndInvoke should contain any ref
1808 or out parameters as well. We were not doing this in the past.
1810 * class.cs (Field.Define): Do not overwrite the type definition
1811 inside the `volatile' group. Turns out that volatile enumerations
1812 were changing the type here to perform a validity test, which
1815 2003-02-12 Miguel de Icaza <miguel@ximian.com>
1817 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
1818 and structs, we do not want to load the instance variable
1820 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
1821 enum_type has to be handled like an object reference (implicit
1822 conversions exists from this to object), but the regular IsClass
1823 and IsValueType tests will never return true for this one.
1825 Also we use TypeManager.IsValueType instead of type.IsValueType,
1826 just for consistency with the rest of the code (this is only
1827 needed if we ever use the construct exposed by test-180.cs inside
1828 corlib, which we dont today).
1830 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
1832 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
1835 2003-02-09 Martin Baulig <martin@ximian.com>
1837 * namespace.cs (Namespace..ctor): Added SourceFile argument.
1838 (Namespace.DefineNamespaces): New static public method; this is
1839 called when we're compiling with debugging to add all namespaces
1842 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
1843 pass it to the Namespace's .ctor.
1845 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
1846 and MethodBase arguments; pass the namespace ID to the symwriter;
1847 pass the MethodBase instead of the token to the symwriter.
1848 (SymbolWriter.DefineNamespace): New method to add a namespace to
1851 2003-02-09 Martin Baulig <martin@ximian.com>
1853 * symbolwriter.cs: New file. This is a wrapper around
1854 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
1855 methods here in near future.
1857 2003-02-09 Martin Baulig <martin@ximian.com>
1859 * codegen.cs (EmitContext.Mark): Just pass the arguments to
1860 ILGenerator.MarkSequencePoint() which are actually used by the
1863 2003-02-09 Martin Baulig <martin@ximian.com>
1865 * location.cs (SourceFile): New public sealed class. This
1866 contains the name and an index which is used in the location's token.
1867 (Location): Reserve an appropriate number of bits in the token for
1868 the source file instead of walking over that list, this gives us a
1869 really huge performance improvement when compiling with debugging.
1871 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
1872 `SourceFile' argument instead of a string.
1873 (Driver.ProcessFile): Add all the files via Location.AddFile(),
1874 but don't parse/tokenize here, we need to generate the list of all
1875 source files before we do that.
1876 (Driver.ProcessFiles): New static function. Parses/tokenizes all
1879 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
1880 instead of a string.
1882 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
1885 2003-02-09 Martin Baulig <martin@ximian.com>
1887 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
1888 filename on `#line default'.
1890 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
1892 * statement.cs: don't clear the pinned var when the fixed statement
1893 returns from the method (fixes bug#37752).
1895 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
1897 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
1900 2003-02-07 Martin Baulig <martin@ximian.com>
1902 * driver.cs: Removed the `--debug-args' command line argument.
1904 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
1905 automatically by the AsssemblyBuilder.
1906 (CodeGen.InitializeSymbolWriter): We don't need to call any
1907 initialization function on the symbol writer anymore. This method
1908 doesn't take any arguments.
1910 2003-02-03 Miguel de Icaza <miguel@ximian.com>
1912 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
1913 from referenced assemblies as well.
1915 2003-02-02 Martin Baulig <martin@ximian.com>
1917 * class.cs (MethodData.Emit): Generate debugging info for external methods.
1919 2003-02-02 Martin Baulig <martin@ximian.com>
1921 * class.cs (Constructor.Emit): Open the symbol writer before
1922 emitting the constructor initializer.
1923 (ConstructorInitializer.Emit): Call ec.Mark() to allow
1924 single-stepping through constructor initializers.
1926 2003-01-30 Miguel de Icaza <miguel@ximian.com>
1928 * class.cs: Handle error 549: do not allow virtual methods in
1931 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
1933 * decl.cs: Check access levels when resolving types
1935 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
1937 * statement.cs: Add parameters and locals set in catch blocks that might
1938 return to set vector
1940 2003-01-29 Miguel de Icaza <miguel@ximian.com>
1942 * class.cs (Operator): Set the SpecialName flags for operators.
1944 * expression.cs (Invocation.DoResolve): Only block calls to
1945 accessors and operators on SpecialName methods.
1947 (Cast.TryReduce): Handle conversions from char constants.
1950 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
1952 * statement.cs: small memory and time optimization in FlowBranching.
1954 2003-01-28 Pedro Mart <yoros@wanadoo.es>
1956 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
1957 problem that the last fix but in the other sid (Set).
1959 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
1960 access when there is no indexer in the hierarchy.
1962 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
1964 * class.cs: Combine some if statements.
1966 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1968 * driver.cs: fixed bug #37187.
1970 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
1972 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
1973 any indexer, it's needed to build a list with all the indexers in the
1974 hierarchy (AllGetters), else we have problems. Fixes #35653.
1976 2003-01-23 Miguel de Icaza <miguel@ximian.com>
1978 * class.cs (MethodData.Define): It is wrong for an interface
1979 implementation to be static in both cases: explicit and implicit.
1980 We were only handling this in one case.
1982 Improve the if situation there to not have negations.
1984 * class.cs (Field.Define): Turns out that we do not need to check
1985 the unsafe bit on field definition, only on usage. Remove the test.
1987 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1989 * driver.cs: use assembly.Location instead of Codebase (the latest
1990 patch made mcs fail when using MS assemblies).
1992 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
1994 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1995 get the path to *corlib.dll.
1997 2003-01-21 Nick Drochak <ndrochak@gol.com>
2001 * typemanager.cs: Remove compiler warnings
2003 2003-01-20 Duncan Mak <duncan@ximian.com>
2005 * AssemblyInfo.cs: Bump the version number to 0.19.
2007 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2009 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2011 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2013 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2015 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2017 * cs-parser.jay: Small fix: we were not comparing the constructor
2018 name correctly. Thanks to Zoltan for the initial pointer.
2020 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2022 * cs-tokenizer.cs: Set file name when specified with #line
2024 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2026 * cs-parser.jay: Only perform the constructor checks here if we
2027 are named like the class; This will help provider a better
2028 error. The constructor path is taken when a type definition is
2029 not found, but most likely the user forgot to add the type, so
2030 report that rather than the constructor error.
2032 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2034 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2037 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2039 * cs-parser.jay: Add cleanup call.
2041 2003-01-13 Duncan Mak <duncan@ximian.com>
2043 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2044 consistent with other methods.
2046 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2048 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2050 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2052 * attribute.cs: only set GuidAttr to true when we have a
2055 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2059 * typemanager.cs: fixes to allow mcs compile corlib with the new
2060 Type.IsSubclassOf fix.
2062 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2064 * expression.cs (LocalVariableReference.DoResolve): Classify a
2065 constant as a value, not as a variable. Also, set the type for
2068 * cs-parser.jay (fixed_statement): take a type instead of a
2069 pointer_type, so we can produce a better error message later.
2071 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2074 (For.DoEmit): Make inifinite loops have a
2075 non-conditional branch back.
2077 (Fixed.DoEmit): First populate the pinned variables, then emit the
2078 statement, then clear the variables. Before I was emitting the
2079 code once for each fixed piece.
2082 2003-01-08 Martin Baulig <martin@ximian.com>
2084 * statement.cs (FlowBranching.MergeChild): A break in a
2085 SWITCH_SECTION does not leave a loop. Fixes #36155.
2087 2003-01-08 Martin Baulig <martin@ximian.com>
2089 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2090 lives in the same number space than `param_map'. Fixes #36154.
2092 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2094 * cs-parser.jay (constructor_declaration): Set the
2095 Constructor.ModFlags before probing for it. This makes the
2096 compiler report 514, 515 and 132 (the code was there, but got
2099 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2100 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2101 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2103 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2105 * enum.cs: create the enum static fields using the enum type.
2107 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2109 * class.cs: don't try to create the ParamBuilder for the return
2110 type if it's not needed (and handle it breaking for the ms runtime
2113 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2115 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2117 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2119 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2120 the command. This showed up while compiling the JANET source
2121 code, which used \r as its only newline separator.
2123 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2125 * class.cs (Method.Define): If we are an operator (because it
2126 reuses our code), then set the SpecialName and HideBySig. #36128
2128 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2130 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2131 exception, report error 120 `object reference required'.
2133 * driver.cs: Add --pause option, used during to measure the size
2134 of the process as it goes with --timestamp.
2136 * expression.cs (Invocation.DoResolve): Do not allow methods with
2137 SpecialName to be invoked.
2139 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2141 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2142 number before adding it.
2144 2002-12-21 Ravi Pratap <ravi@ximian.com>
2146 * ecore.cs (StandardImplicitConversion): When in an unsafe
2147 context, we allow conversion between void * to any other pointer
2148 type. This fixes bug #35973.
2150 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2152 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2153 is not thrown when extensionless outputs are used
2155 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2157 * rootcontext.cs: fixed compilation of corlib.
2159 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2161 * attribute.cs (Attributes.Contains): Add new method.
2163 * class.cs (MethodCore.LabelParameters): if the parameter is an
2164 `out' parameter, check that no attribute `[In]' has been passed.
2166 * enum.cs: Handle the `value__' name in an enumeration.
2168 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2170 * decl.cs: Added special case to allow overrides on "protected
2173 2002-12-18 Ravi Pratap <ravi@ximian.com>
2175 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2176 since it makes much more sense.
2178 (Attributes.ctor): Don't require a Location parameter.
2180 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2182 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2183 since we already have that information per attribute.
2185 * everywhere : make appropriate changes.
2187 * class.cs (LabelParameters): Write the code which actually
2188 applies attributes to the return type. We can't do this on the MS
2189 .NET runtime so we flag a warning in the case an exception is
2192 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2194 * const.cs: Handle implicit null conversions here too.
2196 2002-12-17 Ravi Pratap <ravi@ximian.com>
2198 * class.cs (MethodCore.LabelParameters): Remove the extra
2199 Type [] parameter since it is completely unnecessary. Instead
2200 pass in the method's attributes so that we can extract
2201 the "return" attribute.
2203 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2205 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2206 of ignoring it and letting the compile continue.
2208 * typemanager.cs (ChangeType): use an extra argument to return an
2209 error condition instead of throwing an exception.
2211 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2213 * expression.cs (Unary.TryReduce): mimic the code for the regular
2214 code path. Perform an implicit cast in the cases where we can
2215 implicitly convert to one of the integral types, and then reduce
2216 based on that constant. This fixes bug #35483.
2218 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2220 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2222 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2224 * namespace.cs: fixed bug #35489.
2226 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2228 * class.cs: Remove some dead code.
2230 * cs-parser.jay: Estimate the number of methods needed
2231 (RootContext.MethodCount);
2233 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2234 numbers instead of StringBuilders.
2236 * support.cs (PtrHashtable): Add constructor with initial size;
2237 We can now reduce reallocations of the method table.
2239 2002-12-10 Ravi Pratap <ravi@ximian.com>
2241 * attribute.cs (ApplyAttributes): Keep track of the emitted
2242 attributes on a per-target basis. This fixes bug #35413.
2244 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2246 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2247 default to the Windows 1252 encoding.
2249 (UnixParseOption): Support version, thanks to Alp for the missing
2252 * AssemblyInfo.cs: Add nice assembly information.
2254 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2257 * cs-parser.jay: Allow a trailing comma before the close bracked
2258 in the attribute_section production.
2260 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2261 address of the instance was being taken, I will take this out,
2262 because we take the address of the object immediately here.
2264 2002-12-09 Ravi Pratap <ravi@ximian.com>
2266 * typemanager.cs (AreMultipleAllowed): Take care of the most
2267 obvious case where attribute type is not in the current assembly -
2270 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2272 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2273 definitions, instead of doing that afterwards.
2275 Also we use a nice little hack, depending on the constructor, we
2276 know if we are a "composed" name or a simple name. Hence, we
2277 avoid the IndexOf test, and we avoid
2279 * codegen.cs: Add code to assist in a bug reporter to track down
2280 the source of a compiler crash.
2282 2002-12-07 Ravi Pratap <ravi@ximian.com>
2284 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2285 types have been emitted for a given element and flag an error
2286 if something which does not have AllowMultiple set is used more
2289 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2290 attribute types and their corresponding AllowMultiple properties
2292 (AreMultipleAllowed): Check the property for a given type.
2294 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2295 property in the case we have a TypeContainer.
2297 (Attributes.AddAttribute): Detect duplicates and just skip on
2298 adding them. This trivial fix catches a pretty gross error in our
2299 attribute emission - global attributes were being emitted twice!
2301 Bugzilla bug #33187 is now fixed.
2303 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2305 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2308 * expression.cs (Binary.ResolveOperator): I can only use the
2309 Concat (string, string, string) and Concat (string, string,
2310 string, string) if the child is actually a concatenation of
2313 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2315 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2316 context where we need a 2-character lookahead.
2318 * pending.cs (PendingImplementation): Rework so we can keep track
2319 of interface types all the time, and flag those which were
2320 implemented by parents as optional.
2322 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2324 * expression.cs (Binary.ResolveOperator): Use
2325 String.Concat(string,string,string) or
2326 String.Concat(string,string,string,string) when possible.
2328 * typemanager: More helper methods.
2331 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2333 * pending.cs: remove the bogus return from GetMissingInterfaces()
2334 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2336 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2338 * namespace.cs: avoid duplicated 'using xxx' being added to
2339 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2340 when we get more than one 'using' statement for the same namespace.
2341 Report a CS0105 warning for it.
2343 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2345 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2346 of calling getChar/putback, uses internal knowledge of it.
2348 (xtoken): Reorder tokenizer so most common patterns are checked
2349 first. This reduces the compilation time in another 5% (from 8.11s
2350 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2352 The parsing time is 22% of the compilation in mcs, and from that
2353 64% is spent on the tokenization process.
2355 I tried using a binary search for keywords, but this is slower
2356 than the hashtable. Another option would be to do a couple of
2359 * Not use a StringBuilder, instead use an array of chars,
2360 with a set value. Notice that this way we could catch
2361 the 645 error without having to do it *afterwards*.
2363 * We could write a hand-parser to avoid the hashtable
2364 compares altogether.
2366 The identifier consumption process takes 37% of the tokenization
2367 time. Another 15% is spent on is_number. 56% of the time spent
2368 on is_number is spent on Int64.Parse:
2370 * We could probably choose based on the string length to
2371 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2374 Another 3% is spend on wrapping `xtoken' in the `token' function.
2376 Handle 0xa0 as whitespace (#34752)
2378 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2380 * typemanager.cs (IsCLRType): New routine to tell whether a type
2381 is one of the builtin types.
2383 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2384 typecode in more places instead of doing pointer comparissions.
2385 We could leverage some knowledge about the way the typecodes are
2388 New code to cache namespaces in assemblies, it is currently not
2389 invoked, to be used soon.
2391 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2393 * expression.cs (Binary.ResolveOperator): specially handle
2394 strings, and do not perform user-defined operator overloading for
2397 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2399 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2400 internalcall as it is a pretty simple operation; Avoid whenever
2401 possible to call Char.IsLetter.
2403 (consume_identifier): Cut by half the number of
2404 hashtable calls by merging the is_keyword and GetKeyword behavior.
2406 Do not short-circuit, because if we do, we
2407 report errors (ie, #if false && true would produce an invalid
2411 2002-11-24 Martin Baulig <martin@ximian.com>
2413 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2414 check constant ranges and report a CS0221. Fixes #33186.
2416 2002-11-24 Martin Baulig <martin@ximian.com>
2418 * cs-parser.jay: Make this work for uninitialized variable
2419 declarations in the `for' initializer. Fixes #32416.
2421 2002-11-24 Martin Baulig <martin@ximian.com>
2423 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2424 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2426 2002-11-24 Martin Baulig <martin@ximian.com>
2428 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2429 argument; if true, we also check for user-defined conversions.
2430 This is only needed if both arguments are of a user-defined type.
2431 Fixes #30443, added test-175.cs.
2432 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2434 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2436 2002-11-24 Martin Baulig <martin@ximian.com>
2438 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2439 function to get the store opcode.
2440 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2441 only emit the Ldelema if the store opcode is Stobj. You must run
2442 both test-34 and test-167 to test this. Fixes #34529.
2444 2002-11-23 Martin Baulig <martin@ximian.com>
2446 * ecore.cs (Expression.MemberLookup): Added additional
2447 `qualifier_type' argument which is used when we're being called
2448 from MemberAccess.DoResolve() and null if we're called from a
2450 (Expression.MemberLookupFailed): New method to report errors; this
2451 does the CS1540 check and reports the correct error message.
2453 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2454 argument for the CS1540 check and redone the way how we're dealing
2455 with private members. See the comment in the source code for details.
2456 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2457 `closure_start_type' to `closure_qualifier_type' and check whether
2458 it's not null. It was not this filter being broken, it was just
2459 being called with the wrong arguments.
2461 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2462 and pass it the correct `qualifier_type'; this also does the error
2465 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2467 * expression.cs (Invocation.EmitParams): If the we are dealing
2468 with a non-built-in value type, load its address as well.
2470 (ArrayCreation): Use a a pretty constant instead
2471 of the hardcoded value 2. Use 6 instead of 2 for the number of
2472 static initializers.
2474 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2475 because they are not really value types, just glorified integers.
2477 * driver.cs: Do not append .exe, the CSC compiler does not do it.
2479 * ecore.cs: Remove redundant code for enumerations, make them use
2480 the same code path as everything else, fixes the casting issue
2481 with enumerations in Windows.Forms.
2483 * attribute.cs: Do only cast to string if it is a string, the
2484 validation happens later.
2486 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2487 people upgrade their corlibs.
2489 * ecore.cs: Oops, enumerations were not following the entire code path
2491 2002-11-21 Miguel de Icaza <miguel@ximian.com>
2493 * typemanager.cs (FilterWithClosure): Commented out the test for
2494 1540 in typemanager.cs, as it has problems when accessing
2495 protected methods from a parent class (see test-174.cs).
2497 * attribute.cs (Attribute.ValidateGuid): new method.
2498 (Attribute.Resolve): Use above.
2500 2002-11-19 Miguel de Icaza <miguel@ximian.com>
2502 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2504 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2505 handling for enumerations, as we only needed the TypeContainer
2506 functionality to begin with (this is required for the fix below to
2507 work for enums that reference constants in a container class for
2510 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2512 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2513 a valid TypeBuilder to perform lookups on.o
2515 * class.cs (InheritableMemberSignatureCompare): Use true in the
2516 call to GetGetMethod and GetSetMethod, because we are comparing
2517 the signature, and we need to get the methods *even* if they are
2520 (PropertyBase.CheckBase): ditto.
2522 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2523 GotoCase.Resolve): Use Peel on EmpytCasts.
2525 * ecore.cs (EmptyCast): drop child, add Peel method.
2527 2002-11-17 Martin Baulig <martin@ximian.com>
2529 * ecore.cs (EmptyCast.Child): New public property.
2531 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2532 label resolved to an EmptyCast. Fixes #34162.
2533 (GotoCase.Resolve): Likewise.
2534 (Block.EmitMeta): Likewise.
2536 2002-11-17 Martin Baulig <martin@ximian.com>
2538 * expression.cs (Invocation.BetterConversion): Prefer int over
2539 uint; short over ushort; long over ulong for integer literals.
2540 Use ImplicitConversionExists instead of StandardConversionExists
2541 since we also need to check for user-defined implicit conversions.
2542 Fixes #34165. Added test-173.cs.
2544 2002-11-16 Martin Baulig <martin@ximian.com>
2546 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2547 with the `true' and `false' literals. Fixes #33151.
2549 2002-11-16 Martin Baulig <martin@ximian.com>
2551 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2552 October 22nd; don't do the cs1540 check for static members.
2554 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2555 now using our own filter here and doing the cs1540 check again.
2557 2002-11-16 Martin Baulig <martin@ximian.com>
2559 * support.cs (InternalParameters): Don't crash if we don't have
2560 any fixed parameters. Fixes #33532.
2562 2002-11-16 Martin Baulig <martin@ximian.com>
2564 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2565 when looking up static methods to make this work on Windows.
2568 2002-11-16 Martin Baulig <martin@ximian.com>
2570 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2571 a setter rather than using PropertyInfo.CanWrite.
2573 2002-11-15 Nick Drochak <ndrochak@gol.com>
2575 * class.cs: Allow acces to block member by subclasses. Fixes build
2578 2002-11-14 Martin Baulig <martin@ximian.com>
2580 * class.cs (Constructor.Emit): Added the extern/block check.
2583 2002-11-14 Martin Baulig <martin@ximian.com>
2585 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2586 iteration while looking for indexers, this is needed because the
2587 indexer may have a different name in our base classes. Fixed the
2588 error reporting (no indexers at all, not get accessor, no
2589 overloaded match). Fixes bug #33089.
2590 (IndexerAccess.DoResolveLValue): Likewise.
2592 2002-11-14 Martin Baulig <martin@ximian.com>
2594 * class.cs (PropertyBase.CheckBase): Make this work for multiple
2595 indexers. Fixes the first part of bug #33089.
2596 (MethodSignature.InheritableMemberSignatureCompare): Added support
2599 2002-11-13 Ravi Pratap <ravi@ximian.com>
2601 * attribute.cs (Attribute.Resolve): Catch the
2602 NullReferenceException and report it since it isn't supposed to
2605 2002-11-12 Miguel de Icaza <miguel@ximian.com>
2607 * expression.cs (Binary.EmitBranchable): Also handle the cases for
2608 LogicalOr and LogicalAnd that can benefit from recursively
2609 handling EmitBranchable. The code now should be nice for Paolo.
2611 2002-11-08 Miguel de Icaza <miguel@ximian.com>
2613 * typemanager.cs (LookupType): Added a negative-hit hashtable for
2614 the Type lookups, as we perform quite a number of lookups on
2615 non-Types. This can be removed once we can deterministically tell
2616 whether we have a type or a namespace in advance.
2618 But this might require special hacks from our corlib.
2622 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2623 and double which avoids a conversion from an integer to a double.
2625 * expression.cs: tiny optimization, avoid calling IsConstant,
2626 because it effectively performs the lookup twice.
2628 2002-11-06 Miguel de Icaza <miguel@ximian.com>
2630 But a bogus return here to keep the semantics of the old code
2631 until the Mono runtime is fixed.
2633 * pending.cs (GetMissingInterfaces): New method used to remove all
2634 the interfaces that are already implemented by our parent
2635 classes from the list of pending methods.
2637 * interface.cs: Add checks for calls after ResolveTypeExpr.
2639 2002-11-05 Miguel de Icaza <miguel@ximian.com>
2641 * class.cs (Class.Emit): Report warning 67: event not used if the
2642 warning level is beyond 3.
2644 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2645 being a NullLiteral.
2647 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2650 * class.cs (TypeContainer.GetClassBases): Cover a missing code
2651 path that might fail if a type can not be resolved.
2653 * expression.cs (Binary.Emit): Emit unsigned versions of the
2656 * driver.cs: use error 5.
2658 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2660 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2662 2002-11-01 Miguel de Icaza <miguel@ximian.com>
2664 * cs-parser.jay (switch_section): A beautiful patch from Martin
2665 Baulig that fixed 33094.
2667 2002-10-31 Miguel de Icaza <miguel@ximian.com>
2669 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2670 Check whether the base is abstract and report an error if so.
2672 * expression.cs (IndexerAccess.DoResolveLValue,
2673 IndexerAccess.DoResolve): ditto.
2675 (Invocation.DoResolve): ditto.
2677 (Invocation.FullMethodDesc): Improve the report string.
2679 * statement.cs (Block): Eliminate IsVariableDefined as it is
2680 basically just a wrapper for GetVariableInfo.
2682 * ecore.cs (SimpleName): Use new
2684 * support.cs (ReflectionParamter.ParameterType): We unwrap the
2685 type, as we return the actual parameter ref/unref state on a
2688 2002-10-30 Miguel de Icaza <miguel@ximian.com>
2690 * support.cs: Return proper flags REF/OUT fixing the previous
2693 * expression.cs: Reverted last patch, that was wrong. Is_ref is
2694 not used to mean `ref' but `ref or out' in ParameterReference
2696 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
2697 full type signature instead of calling TypeManger.CSharpName
2700 * support.cs (InternalParameters.ParameterDesc): Do not compare
2701 directly to the modflags, because REF/OUT will actually be bitsets
2704 * delegate.cs (VerifyMethod): Check also the modifiers.
2706 * cs-tokenizer.cs: Fix bug where floating point values with an
2707 exponent where a sign was missing was ignored.
2709 * driver.cs: Allow multiple assemblies to be specified in a single
2712 2002-10-28 Miguel de Icaza <miguel@ximian.com>
2714 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
2715 because identifiers after a parenthesis would end up in this kind
2716 of production, and we needed to desamiguate it for having casts
2719 (UserDefinedType *) xxx
2721 2002-10-24 Miguel de Icaza <miguel@ximian.com>
2723 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
2724 we should set on the Bindingflags.NonPublic, but not turn on
2725 private_ok. private_ok controls whether a Private member is
2726 returned (this is chekced on the filter routine), while the
2727 BindingFlags.NonPublic just controls whether private/protected
2728 will be allowed. This fixes the problem part of the problem of
2729 private properties being allowed to be used in derived classes.
2731 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
2732 so we can call the children DoResolveLValue method (this will
2733 properly signal errors on lvalue assignments to base properties)
2735 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
2736 getter are null, and we have a property info, we know that this
2737 happened because the lookup failed, so we report an error 122 for
2738 protection level violation.
2740 We also silently return if setter and getter are null in the
2741 resolve functions, this condition only happens if we have flagged
2742 the error before. This is the other half of the problem.
2744 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
2745 not have accessibility information, that is why we were returning
2746 true in the filter function in typemanager.cs.
2748 To properly report 122 (property is inaccessible because of its
2749 protection level) correctly, we report this error in ResolveAccess
2750 by failing if both the setter and the getter are lacking (ie, the
2753 DoResolve and DoLResolve have been modified to check for both
2754 setter/getter being null and returning silently, the reason being
2755 that I did not want to put the knowledge about this error in upper
2758 int old = Report.Errors;
2759 x = new PropertyExpr (...);
2760 if (old != Report.Errors)
2765 So the property expr is returned, but it is invalid, so the error
2766 will be flagged during the resolve process.
2768 * class.cs: Remove InheritablePropertySignatureCompare from the
2769 class, as we no longer depend on the property signature to compute
2770 whether it is possible to implement a method or not.
2772 The reason is that calling PropertyInfo.GetGetMethod will return
2773 null (in .NET, in Mono it works, and we should change this), in
2774 cases where the Get Method does not exist in that particular
2779 class X { public virtual int A { get { return 1; } } }
2781 class Z : Y { public override int A { get { return 2; } } }
2783 Would fail in Z because the parent (Y) would not have the property
2784 defined. So we avoid this completely now (because the alternative
2785 fix was ugly and slow), and we now depend exclusively on the
2788 (PropertyBase.CheckBase): Use a method-base mechanism to find our
2789 reference method, instead of using the property.
2791 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2792 routines are gone now.
2794 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2795 names, they were incorrectly named.
2797 * cs-tokenizer.cs: Return are more gentle token on failure.
2799 * pending.cs (PendingImplementation.InterfaceMethod): This routine
2800 had an out-of-sync index variable, which caused it to remove from
2801 the list of pending methods the wrong method sometimes.
2803 2002-10-22 Miguel de Icaza <miguel@ximian.com>
2805 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2806 CanWrite, because those refer to this particular instance of the
2807 property, and do not take into account the fact that we can
2808 override single members of a property.
2810 Constructor requires an EmitContext. The resolution process does
2811 not happen here, but we need to compute the accessors before,
2812 because the resolution does not always happen for properties.
2814 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
2815 subclass, before we did not update this flag, but we did update
2818 (GetAccessors): Drop this routine, as it did not work in the
2819 presence of partially overwritten set/get methods.
2821 Notice that this broke the cs1540 detection, but that will require
2824 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2828 * driver.cs: issue a warning instead of an error if we don't support
2829 debugging for the platform. Also ignore a couple of errors that may
2830 arise when trying to write the symbols. Undo my previous patch.
2832 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2834 * driver.cs: ignore /debug switch except for Unix platforms.
2836 2002-10-23 Nick Drochak <ndrochak@gol.com>
2838 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
2840 2002-10-21 Miguel de Icaza <miguel@ximian.com>
2842 * driver.cs: Do not make mcs-debug conditional, so we do not break
2845 * statement.cs (UsageVector.MergeChildren): I would like Martin to
2846 review this patch. But basically after all the children variables
2847 have been merged, the value of "Breaks" was not being set to
2848 new_breaks for Switch blocks. I think that it should be set after
2849 it has executed. Currently I set this to the value of new_breaks,
2850 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
2851 conservative, but I do not understand this code very well.
2853 I did not break anything in the build, so that is good ;-)
2855 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
2857 2002-10-20 Mark Crichton <crichton@gimp.org>
2859 * cfold.cs: Fixed compile blocker. Really fixed it this time.
2861 2002-10-20 Nick Drochak <ndrochak@gol.com>
2863 * cfold.cs: Fixed compile blocker.
2865 2002-10-20 Miguel de Icaza <miguel@ximian.com>
2867 * driver.cs: I was chekcing the key, not the file.
2869 2002-10-19 Ravi Pratap <ravi@ximian.com>
2871 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
2872 message that we were generating - we just need to silently return
2875 2002-10-19 Miguel de Icaza <miguel@ximian.com>
2877 * class.cs (Event.Define): Change my previous commit, as this
2878 breaks the debugger. This is a temporary hack, as it seems like
2879 the compiler is generating events incorrectly to begin with.
2881 * expression.cs (Binary.ResolveOperator): Added support for
2882 "U operator - (E x, E y)"
2884 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
2887 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
2888 init-only variables, but this path did not take into account that
2889 there might be also instance readonly variables. Correct this
2892 This fixes bug 32253
2894 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
2897 * driver.cs: Change the extension for modules to `netmodule'
2899 * cs-parser.jay: Improved slightly the location tracking for
2900 the debugger symbols.
2902 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
2903 modifiers that were specified instead of the hardcoded value
2904 (FamAndAssem). This was basically ignoring the static modifier,
2905 and others. Fixes 32429.
2907 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
2908 fixed a bug in the process (32476)
2910 * expression.cs (ArrayAccess.EmitAssign): Patch from
2911 hwang_rob@yahoo.ca that fixes bug 31834.3
2913 2002-10-18 Miguel de Icaza <miguel@ximian.com>
2915 * driver.cs: Make the module extension .netmodule.
2917 2002-10-16 Miguel de Icaza <miguel@ximian.com>
2919 * driver.cs: Report an error if the resource file is not found
2920 instead of crashing.
2922 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
2923 false, like Emit does.
2925 2002-10-16 Nick Drochak <ndrochak@gol.com>
2927 * typemanager.cs: Remove unused private member. Also reported mcs
2928 bug to report this as a warning like csc.
2930 2002-10-15 Martin Baulig <martin@gnome.org>
2932 * statement.cs (Statement.Emit): Made this a virtual method; emits
2933 the line number info and calls DoEmit().
2934 (Statement.DoEmit): New protected abstract method, formerly knows
2935 as Statement.Emit().
2937 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
2939 2002-10-11 Miguel de Icaza <miguel@ximian.com>
2941 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
2942 have fixed a remaining problem: not every AddXXXX was adding a
2943 fully qualified name.
2945 Now everyone registers a fully qualified name in the DeclSpace as
2946 being defined instead of the partial name.
2948 Downsides: we are slower than we need to be due to the excess
2949 copies and the names being registered this way.
2951 The reason for this is that we currently depend (on the corlib
2952 bootstrap for instance) that types are fully qualified, because
2953 we dump all the types in the namespace, and we should really have
2954 types inserted into the proper namespace, so we can only store the
2955 basenames in the defined_names array.
2957 2002-10-10 Martin Baulig <martin@gnome.org>
2959 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
2960 from bug #31834, see the bug report for a testcase which is
2963 2002-10-10 Martin Baulig <martin@gnome.org>
2965 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
2966 flow analysis code for this.
2968 * statement.cs (Do, While, For): Tell the flow analysis code about
2970 (FlowBranching.UsageVector): Added support for infinite loops.
2971 (Block.Resolve): Moved the dead code elimination here and use flow
2974 2002-10-09 Miguel de Icaza <miguel@ximian.com>
2976 * class.cs (Field.Define): Catch cycles on struct type
2979 * typemanager.cs (IsUnmanagedtype): Do not recursively check
2980 fields if the fields are static. We only need to check instance
2983 * expression.cs (As.DoResolve): Test for reference type.
2985 * statement.cs (Using.ResolveExpression): Use
2986 ConvertImplicitRequired, not ConvertImplicit which reports an
2988 (Using.ResolveLocalVariableDecls): ditto.
2990 * expression.cs (Binary.ResolveOperator): Report errors in a few
2991 places where we had to.
2993 * typemanager.cs (IsUnmanagedtype): Finish implementation.
2995 2002-10-08 Miguel de Icaza <miguel@ximian.com>
2997 * expression.cs: Use StoreFromPtr instead of extracting the type
2998 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3000 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3001 an enumeration value to a System.Enum, but System.Enum is not a
3002 value type, but an class type, so we need to box.
3004 (Expression.ConvertExplicit): One codepath could return
3005 errors but not flag them. Fix this. Fixes #31853
3007 * parameter.cs (Resolve): Do not allow void as a parameter type.
3009 2002-10-06 Martin Baulig <martin@gnome.org>
3011 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3012 if it's a class type and not a struct. Fixes #31815.
3014 2002-10-06 Martin Baulig <martin@gnome.org>
3016 * statement.cs: Reworked the flow analysis code a bit to make it
3017 usable for dead code elimination.
3019 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3021 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3023 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3025 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3026 to fix the test 165, will investigate deeper.
3028 2002-10-04 Martin Baulig <martin@gnome.org>
3030 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3031 finally blocks actually work.
3032 (Try.Resolve): We don't need to create a sibling for `finally' if
3033 there is no finally block.
3035 2002-10-04 Martin Baulig <martin@gnome.org>
3037 * class.cs (Constructor.Define): The default accessibility for a
3038 non-default constructor is private, not public.
3040 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3042 * class.cs (Constructor): Make AllowedModifiers public, add
3045 * cs-parser.jay: Perform the modifiers test here, as the
3046 constructor for the Constructor class usually receives a zero
3047 because of the way we create it (first we create, later we
3048 customize, and we were never checking the modifiers).
3050 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3051 is a version of LookupTypeReflection that includes the type-name
3052 cache. This can be used as a fast path for functions that know
3053 the fully qualified name and are only calling into *.GetType() to
3054 obtain a composed type.
3056 This is also used by TypeManager.LookupType during its type
3059 (LookupType): We now also track the real type name, as sometimes
3060 we can get a quey for the real type name from things like
3061 ComposedCast. This fixes bug 31422.
3063 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3064 complete type fullname, it does not have to go through the type
3065 resolution system to obtain the composed version of the type (for
3066 obtaining arrays or pointers).
3068 (Conditional.Emit): Use the EmitBoolExpression to
3069 generate nicer code, as requested by Paolo.
3071 (ArrayCreation.CheckIndices): Use the patch from
3072 hwang_rob@yahoo.ca to validate the array initializers.
3074 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3076 * class.cs (ConstructorInitializer.Emit): simplify code by using
3077 Invocation.EmitCall, and at the same time, fix the bugs in calling
3078 parent constructors that took variable arguments.
3080 * ecore.cs (Expression.ConvertNumericExplicit,
3081 Expression.ImplicitNumericConversion): Remove the code that
3082 manually wrapped decimal (InternalTypeConstructor call is now gone
3085 * expression.cs (Cast.TryReduce): Also handle decimal types when
3086 trying to perform a constant fold on the type.
3088 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3090 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3091 that only turned off an error report, and did nothing else.
3093 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3095 * driver.cs: Handle and ignore /fullpaths
3097 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3099 * expression.cs (Binary.ResolveOperator): Catch the case where
3100 DoNumericPromotions returns true,
3102 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3104 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3106 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3109 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3111 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3112 conversion exists, but it is also required that the conversion be
3113 performed. This manifested in "(Type64Enum) 2".
3115 * class.cs (TypeManager.AddMethod): The fix is not to change
3116 AddEnum, because that one was using a fully qualified name (every
3117 DeclSpace derivative does), but to change the AddMethod routine
3118 that was using an un-namespaced name. This now correctly reports
3119 the duplicated name.
3121 Revert patch until I can properly fix it. The issue
3122 is that we have a shared Type space across all namespaces
3123 currently, which is wrong.
3125 Options include making the Namespace a DeclSpace, and merge
3126 current_namespace/current_container in the parser.
3128 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3130 * cs-parser.jay: Improve error reporting when we get a different
3131 kind of expression in local_variable_type and
3132 local_variable_pointer_type.
3134 Propagate this to avoid missleading errors being reported.
3136 * ecore.cs (ImplicitReferenceConversion): treat
3137 TypeManager.value_type as a target just like object_type. As
3142 Is valid, and needs to result in the int 1 being boxed before it
3143 is assigned to the value type v.
3145 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3146 to validate the enumeration name.
3148 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3149 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3150 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3152 * ecore.cs (TryImplicitIntConversion): When doing an
3153 implicit-enumeration-conversion, check if the type is 64-bits and
3154 perform a conversion before passing to EnumConstant.
3156 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3158 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3159 report ambiguous type references. Unlike the MS version, we
3160 report what the ambiguity is. Innovation at work ;-)
3162 (DeclSpace.FindType): Require a location argument to
3163 display when we display an ambiguous error.
3165 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3167 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3169 * expression.cs (EmitDynamicInitializers): Apply patch from
3170 hwang_rob@yahoo.ca that fixes the order in which we emit our
3173 2002-09-21 Martin Baulig <martin@gnome.org>
3175 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3176 delegate takes no arguments.
3178 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3180 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3183 * expression.cs: Extract the underlying type.
3185 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3187 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3189 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3191 * class.cs (TypeContainer.DefineType): We can not use the nice
3192 PackingSize with the size set to 1 DefineType method, because it
3193 will not allow us to define the interfaces that the struct
3196 This completes the fixing of bug 27287
3198 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3199 means also structs. This fixes part of the problem.
3200 (Expresion.ImplicitReferenceConversionExists): ditto.
3202 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3203 error if there were no errors reported during the type lookup
3204 process, to avoid duplicates or redundant errors. Without this
3205 you would get an ambiguous errors plus a type not found. We have
3206 beaten the user enough with the first error.
3208 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3211 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3212 during the resolution process, stop the lookup, this avoids
3213 repeated error reports (same error twice).
3215 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3217 * typemanager.cs (LookupType): Redo the type lookup code to match
3218 the needs of System.Reflection.
3220 The issue is that System.Reflection requires references to nested
3221 types to begin with a "+" sign instead of a dot. So toplevel
3222 types look like: "NameSpace.TopLevelClass", and nested ones look
3223 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3226 2002-09-19 Martin Baulig <martin@gnome.org>
3228 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3229 says that a method always returns or always throws an exception,
3230 don't report the CS0161.
3232 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3233 set `Returns = new_returns'.
3235 2002-09-19 Martin Baulig <martin@gnome.org>
3237 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3238 to an enum constant, check for a CS0176.
3240 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3242 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3243 for operators that must be in pairs and report errors.
3245 * ecore.cs (SimpleName.DoResolveType): During the initial type
3246 resolution process, when we define types recursively, we must
3247 check first for types in our current scope before we perform
3248 lookups in the enclosing scopes.
3250 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3252 (Invocation.VerifyArgumentsCompat): Call
3253 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3254 I thought we were supposed to always call this, but there are a
3255 few places in the code where we dont do it.
3257 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3259 * driver.cs: Add support in -linkres and -resource to specify the
3260 name of the identifier.
3262 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3264 * ecore.cs (StandardConversionExists): Sync with the conversion
3265 code: allow anything-* to void* conversions.
3267 (FindMostSpecificSource): Use an Expression argument
3268 instead of a Type, because we might be handed over a Literal which
3269 gets a few more implicit conversions that plain types do not. So
3270 this information was being lost.
3272 Also, we drop the temporary type-holder expression when not
3275 2002-09-17 Martin Baulig <martin@gnome.org>
3277 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3278 this is an explicit interface implementation.
3280 2002-09-17 Martin Baulig <martin@gnome.org>
3282 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3283 different `IndexerName' attributes.
3285 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3286 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3287 virtual CommonResolve().
3289 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3291 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3292 and convert that to the UnderlyingType.
3294 * statement.cs (Foreach.Resolve): Indexers are just like variables
3295 or PropertyAccesses.
3297 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3298 inside quoted strings, we were not doing this before.
3300 2002-09-16 Martin Baulig <martin@gnome.org>
3302 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3303 resolve it. This is needed for the definite assignment check of the
3304 instance expression, fixes bug #29846.
3305 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3307 2002-09-16 Nick Drochak <ndrochak@gol.com>
3309 * parameter.cs: Fix compile error. Cannot reference static member
3310 from an instance object. Is this an mcs bug?
3312 2002-09-14 Martin Baulig <martin@gnome.org>
3314 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3315 multiple times. Fixes bug #30295, added test-166.cs.
3317 2002-09-14 Martin Baulig <martin@gnome.org>
3319 * statement.cs (Block.Emit): Don't emit unreachable code.
3320 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3322 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3324 2002-09-14 Martin Baulig <martin@gnome.org>
3326 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3329 2002-09-14 Martin Baulig <martin@gnome.org>
3331 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3332 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3333 be false on the ms runtime.
3335 2002-09-13 Martin Baulig <martin@gnome.org>
3337 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3338 the CS0038 error message.
3340 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3342 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3343 constant inside, return it.
3345 2002-09-12 Martin Baulig <martin@gnome.org>
3347 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3348 implicit conversion can be done between enum types.
3350 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3351 check whether an implicit conversion to the current enum's UnderlyingType
3352 exists and report an error if not.
3354 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3355 without debugging support.
3357 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3358 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3360 2002-09-12 Martin Baulig <martin@gnome.org>
3362 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3364 * ecore.cs (IMemberExpr.DeclaringType): New property.
3365 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3366 nonstatic member of an outer type (CS0038).
3368 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3370 * driver.cs: Activate the using-error detector at warning level
3371 4 (at least for MS-compatible APIs).
3373 * namespace.cs (VerifyUsing): Small buglett fix.
3375 * pending.cs (PendingImplementation): pass the container pointer.
3377 * interface.cs (GetMethods): Allow for recursive definition. Long
3378 term, I would like to move every type to support recursive
3379 definitions, not the current ordering mechanism that we have right
3382 The situation is this: Attributes are handled before interfaces,
3383 so we can apply attributes to interfaces. But some attributes
3384 implement interfaces, we will now handle the simple cases
3385 (recursive definitions will just get an error).
3387 * parameter.cs: Only invalidate types at the end if we fail to
3390 2002-09-09 Martin Baulig <martin@gnome.org>
3392 * ecore.cs (PropertyExpr.Emit): Also check for
3393 TypeManager.system_int_array_get_length so this'll also work when
3394 compiling corlib. Fixes #30003.
3396 2002-09-09 Martin Baulig <martin@gnome.org>
3398 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3399 and throw an exception if we can't get the type's size. Fixed #30040,
3402 2002-09-09 Martin Baulig <martin@gnome.org>
3404 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3406 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3407 context. Fixes bug #30027.
3409 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3410 virtual functions. Fixes bug #30043, added test-164.cs.
3412 2002-09-08 Ravi Pratap <ravi@ximian.com>
3414 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3416 2002-09-08 Nick Drochak <ndrochak@gol.com>
3418 * driver.cs: Use an object to get the windows codepage since it's not a
3421 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3423 * statement.cs (For.Emit): for infinite loops (test == null)
3424 return whether there is a break inside, not always "true".
3426 * namespace.cs (UsingEntry): New struct to hold the name of the
3427 using definition, the location where it is defined, and whether it
3428 has been used in a successful type lookup.
3430 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3435 2002-09-06 Ravi Pratap <ravi@ximian.com>
3437 * attribute.cs : Fix incorrect code which relied on catching
3438 a NullReferenceException to detect a null being passed in
3439 where an object was expected.
3441 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3443 * statement.cs (Try): flag the catch variable as assigned
3445 * expression.cs (Cast): Simplified by using ResolveType instead of
3448 * statement.cs (Catch): Fix bug by using ResolveType.
3450 2002-09-06 Ravi Pratap <ravi@ximian.com>
3452 * expression.cs (BetterConversion): Special case for when we have
3453 a NullLiteral as the argument and we have to choose between string
3454 and object types - we choose string the way csc does.
3456 * attribute.cs (Attribute.Resolve): Catch the
3457 NullReferenceException and report error #182 since the Mono
3458 runtime no more has the bug and having this exception raised means
3459 we tried to select a constructor which takes an object and is
3462 2002-09-05 Ravi Pratap <ravi@ximian.com>
3464 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3465 message (1502, 1503) when we can't locate a method after overload
3466 resolution. This is much more informative and closes the bug
3469 * interface.cs (PopulateMethod): Return if there are no argument
3470 types. Fixes a NullReferenceException bug.
3472 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3473 expressions too. Previously we were checking only in one place for
3474 positional arguments leaving out named arguments.
3476 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3477 type to the enum type is not allowed. Remove code corresponding to
3480 (ConvertNumericExplicit): Allow explicit conversions from
3481 the underlying type to enum type. This precisely follows the spec
3482 and closes a bug filed by Gonzalo.
3484 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3487 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3489 2002-09-03 Miguel de Icaza <miguel@ximian.com>
3491 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3492 it was important that we stored the right value after the
3493 reduction in `converted'.
3495 2002-09-04 Martin Baulig <martin@gnome.org>
3497 * location.cs (Location.SymbolDocument): Use full pathnames for the
3500 2002-08-30 Miguel de Icaza <miguel@ximian.com>
3502 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3503 of the expression resolve mechanism, because that will catch the
3504 SimpleName error failures.
3506 (Conditional): If we can not resolve the
3507 expression, return, do not crash.
3509 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3512 (location): display token name instead of its number.
3514 2002-08-28 Martin Baulig <martin@gnome.org>
3516 * expression.cs (Binary.ResolveOperator): Don't silently return
3517 but return an error if an operator cannot be applied between two
3520 2002-08-28 Martin Baulig <martin@gnome.org>
3522 * class.cs (Constructor.Define): Set the permission attributes
3523 correctly instead of making all constructors public.
3525 2002-08-28 Martin Baulig <martin@gnome.org>
3527 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3528 for private members before reporting a CS0103; if we find anything,
3531 2002-08-28 Martin Baulig <martin@gnome.org>
3533 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3534 to check whether `closure_start_type == closure_invocation_type',
3535 we also need to check whether `m.DeclaringType == closure_invocation_type'
3536 before bypassing the permission checks. We might be accessing
3537 protected/private members from the base class.
3538 (TypeManager.RealMemberLookup): Only set private_ok if private
3539 members were requested via BindingFlags.NonPublic.
3541 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3543 * expression.cs (MemberAccess.ResolveMemberAccess): Set
3544 MethodGroupExpr.IsExplicitImpl if appropriate.
3545 (Invocation.DoResolve): Don't report the CS0120 for explicit
3546 interface implementations.
3548 2002-08-27 Martin Baulig <martin@gnome.org>
3550 * expression.cs (Invocation.DoResolve): If this is a static
3551 method and we don't have an InstanceExpression, we must report
3554 2002-08-25 Martin Baulig <martin@gnome.org>
3556 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3557 `==' between a valuetype and an object.
3559 2002-08-25 Miguel de Icaza <miguel@ximian.com>
3561 * ecore.cs (TypeExpr): Provide a ToString method.
3563 2002-08-24 Martin Baulig <martin@gnome.org>
3565 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3566 now called proggie.dbg and it's a binary file.
3568 2002-08-23 Martin Baulig <martin@gnome.org>
3570 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3572 2002-08-23 Martin Baulig <martin@gnome.org>
3574 * struct.cs (MyStructInfo.ctor): Make this work with empty
3575 structs; it's not allowed to use foreach() on null.
3577 2002-08-23 Martin Baulig <martin@gnome.org>
3579 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3580 writer the full pathname of the generated assembly.
3582 2002-08-23 Martin Baulig <martin@gnome.org>
3584 * statements.cs (FlowBranching.UsageVector.MergeChildren):
3585 A `finally' block never returns or breaks; improved handling of
3588 2002-08-23 Martin Baulig <martin@gnome.org>
3590 * statement.cs (Throw.Resolve): Allow `throw null'.
3592 2002-08-23 Martin Baulig <martin@gnome.org>
3594 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3595 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3596 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
3597 MemberLookup would return a wrong event if this is an explicit
3598 interface implementation and the class has an event with the same
3601 2002-08-23 Martin Baulig <martin@gnome.org>
3603 * statement.cs (Block.AddChildVariableNames): New public method.
3604 (Block.AddChildVariableName): Likewise.
3605 (Block.IsVariableNameUsedInChildBlock): Likewise.
3606 (Block.AddVariable): Check whether a variable name has already
3607 been used in a child block.
3609 * cs-parser.jay (declare_local_variables): Mark all variable names
3610 from the current block as being used in a child block in the
3613 2002-08-23 Martin Baulig <martin@gnome.org>
3615 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3616 find the symbol writer.
3618 * driver.cs: csc also allows the arguments to /define being
3619 separated by commas, not only by semicolons.
3621 2002-08-23 Martin Baulig <martin@gnome.org>
3623 * interface.cs (Interface.GetMembers): Added static check for events.
3625 2002-08-15 Martin Baulig <martin@gnome.org>
3627 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3628 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3630 * ecore.cs (Expression.MemberLookup): Added documentation and explained
3631 why the MethodData.EmitDestructor() change was necessary.
3633 2002-08-20 Martin Baulig <martin@gnome.org>
3635 * class.cs (TypeContainer.FindMembers): Added static check for events.
3637 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3639 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3640 use Type.GetEvents(), not Type.FindMembers().
3642 2002-08-20 Martin Baulig <martin@gnome.org>
3644 * decl.cs (MemberCache): Added a special method cache which will
3645 be used for method-only searched. This ensures that a method
3646 search will return a MethodInfo with the correct ReflectedType for
3649 2002-08-20 Martin Baulig <martin@gnome.org>
3651 * decl.cs (DeclSpace.FindMembers): Made this public.
3653 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3655 * delegate.cs: fixed build on windows.
3656 [FIXME: Filed as bug #29150: MCS must report these errors.]
3658 2002-08-19 Ravi Pratap <ravi@ximian.com>
3660 * ecore.cs (StandardConversionExists): Return a false
3661 if we are trying to convert the void type to anything else
3662 since that is not allowed.
3664 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3665 we flag error 70 in the event an event is trying to be accessed
3666 directly from outside the declaring type.
3668 2002-08-20 Martin Baulig <martin@gnome.org>
3670 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3671 MemberCache from typemanager.cs to decl.cs.
3673 2002-08-19 Martin Baulig <martin@gnome.org>
3675 * class.cs (TypeContainer): Implement IMemberContainer.
3676 (TypeContainer.DefineMembers): Create the MemberCache.
3677 (TypeContainer.FindMembers): Do better BindingFlags checking; only
3678 return public members if BindingFlags.Public was given, check
3679 whether members are static.
3681 2002-08-16 Martin Baulig <martin@gnome.org>
3683 * decl.cs (DeclSpace.Define): Splitted this in Define and
3684 DefineMembers. DefineMembers is called first and initializes the
3687 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
3688 DefineMembers() on all our DeclSpaces.
3690 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3691 but call DefineMembers() on all nested interfaces. We call their
3692 Define() in our new Define() function.
3694 * interface.cs (Interface): Implement IMemberContainer.
3695 (Interface.Define): Moved all code except the attribute stuf to
3697 (Interface.DefineMembers): Initialize the member cache.
3699 * typemanager.cs (IMemberFinder): Removed this interface, we don't
3700 need this anymore since we can use MemberCache.FindMembers directly.
3702 2002-08-19 Martin Baulig <martin@gnome.org>
3704 * typemanager.cs (MemberCache): When creating the cache for an
3705 interface type, add all inherited members.
3706 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
3707 to `out bool used_cache' and documented it.
3708 (TypeManager.MemberLookup): If we already used the cache in the first
3709 iteration, we don't need to do the interfaces check.
3711 2002-08-19 Martin Baulig <martin@gnome.org>
3713 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
3714 here from IMemberFinder and don't implement this interface anymore.
3715 (DeclSpace.MemberCache): Moved here from IMemberFinder.
3717 * typemanager.cs (IMemberFinder): This interface is now only used by
3718 classes which actually support the member cache.
3719 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
3720 since we only put DeclSpaces into this Hashtable.
3721 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
3722 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
3724 2002-08-16 Martin Baulig <martin@gnome.org>
3726 * typemanager.cs (ICachingMemberFinder): Removed.
3727 (IMemberFinder.MemberCache): New property.
3728 (TypeManager.FindMembers): Merged this with RealFindMembers().
3729 This function will never be called from TypeManager.MemberLookup()
3730 so we can't use the cache here, just the IMemberFinder.
3731 (TypeManager.MemberLookup_FindMembers): Check whether the
3732 IMemberFinder has a MemberCache and call the cache's FindMembers
3734 (MemberCache): Rewrote larger parts of this yet another time and
3735 cleaned it up a bit.
3737 2002-08-15 Miguel de Icaza <miguel@ximian.com>
3739 * driver.cs (LoadArgs): Support quoting.
3741 (Usage): Show the CSC-like command line arguments.
3743 Improved a few error messages.
3745 2002-08-15 Martin Baulig <martin@gnome.org>
3747 * typemanager.cs (IMemberContainer.Type): New property.
3748 (IMemberContainer.IsInterface): New property.
3750 The following changes are conditional to BROKEN_RUNTIME, which is
3751 defined at the top of the file.
3753 * typemanager.cs (MemberCache.MemberCache): Don't add the base
3754 class'es members, but add all members from TypeHandle.ObjectType
3755 if we're an interface.
3756 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
3757 is the current type.
3758 (MemberCache.CacheEntry.Container): Removed this field.
3759 (TypeHandle.GetMembers): Include inherited members.
3761 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3763 * typemanager.cs: fixed compilation and added a comment on a field that
3766 2002-08-15 Martin Baulig <martin@gnome.org>
3768 * class.cs (ConstructorInitializer.Resolve): In the
3769 Expression.MemberLookup call, use the queried_type as
3772 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
3773 declared' attribute, it's always true.
3774 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3775 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3776 temporary wrapper for FindMembers which tells MemberLookup whether
3777 members from the base classes are included in the return value.
3778 This will go away soon.
3779 (TypeManager.MemberLookup): Use this temporary hack here; once the
3780 new MemberCache is completed, we don't need to do the DeclaredOnly
3781 looping here anymore since the MemberCache will take care of this.
3782 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3783 (MemberCache): When creating the MemberCache for a class, get
3784 members from the current class and all its base classes.
3785 (MemberCache.CacheEntry.Container): New field. This is a
3786 temporary hack until the Mono runtime is fixed to distinguish
3787 between ReflectedType and DeclaringType. It allows us to use MCS
3788 with both the MS runtime and the unfixed Mono runtime without
3789 problems and without accecting performance.
3790 (MemberCache.SearchMembers): The DeclaredOnly looping from
3791 TypeManager.MemberLookup is now done here.
3793 2002-08-14 Martin Baulig <martin@gnome.org>
3795 * statement.cs (MyStructInfo.MyStructInfo): Don't call
3796 Type.GetFields on dynamic types but get the fields from the
3797 corresponding TypeContainer.
3798 (MyStructInfo.GetStructInfo): Added check for enum types.
3800 * typemanager.cs (MemberList.IsSynchronized): Implemented.
3801 (MemberList.SyncRoot): Implemented.
3802 (TypeManager.FilterWithClosure): No need to check permissions if
3803 closure_start_type == closure_invocation_type, don't crash if
3804 closure_invocation_type is null.
3806 2002-08-13 Martin Baulig <martin@gnome.org>
3808 Rewrote TypeContainer.FindMembers to use a member cache. This
3809 gives us a speed increase of about 35% for the self-hosting MCS
3810 build and of about 15-20% for the class libs (both on GNU/Linux).
3812 * report.cs (Timer): New class to get enhanced profiling. This
3813 whole class is "TIMER" conditional since it remarkably slows down
3816 * class.cs (MemberList): New class. This is an IList wrapper
3817 which we're now using instead of passing MemberInfo[]'s around to
3818 avoid copying this array unnecessarily.
3819 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
3820 (ICachingMemberFinder, IMemberContainer): New interface.
3821 (TypeManager.FilterWithClosure): If `criteria' is null, the name
3822 has already been checked, otherwise use it for the name comparision.
3823 (TypeManager.FindMembers): Renamed to RealMemberFinder and
3824 provided wrapper which tries to use ICachingMemberFinder.FindMembers
3825 if possible. Returns a MemberList, not a MemberInfo [].
3826 (TypeHandle): New class, implements IMemberContainer. We create
3827 one instance of this class per type, it contains a MemberCache
3828 which is used to do the member lookups.
3829 (MemberCache): New class. Each instance of this class contains
3830 all members of a type and a name-based hash table.
3831 (MemberCache.FindMembers): This is our new member lookup
3832 function. First, it looks up all members of the requested name in
3833 the hash table. Then, it walks this list and sorts out all
3834 applicable members and returns them.
3836 2002-08-13 Martin Baulig <martin@gnome.org>
3838 In addition to a nice code cleanup, this gives us a performance
3839 increase of about 1.4% on GNU/Linux - not much, but it's already
3840 half a second for the self-hosting MCS compilation.
3842 * typemanager.cs (IMemberFinder): New interface. It is used by
3843 TypeManager.FindMembers to call FindMembers on a TypeContainer,
3844 Enum, Delegate or Interface.
3845 (TypeManager.finder_to_member_finder): New PtrHashtable.
3846 (TypeManager.finder_to_container): Removed.
3847 (TypeManager.finder_to_delegate): Removed.
3848 (TypeManager.finder_to_interface): Removed.
3849 (TypeManager.finder_to_enum): Removed.
3851 * interface.cs (Interface): Implement IMemberFinder.
3853 * delegate.cs (Delegate): Implement IMemberFinder.
3855 * enum.cs (Enum): Implement IMemberFinder.
3857 * class.cs (TypeContainer): Implement IMemberFinder.
3859 2002-08-12 Martin Baulig <martin@gnome.org>
3861 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
3863 2002-08-12 Martin Baulig <martin@gnome.org>
3865 * ecore.cs (ITypeExpression): New interface for expressions which
3867 (TypeExpression): Renamed to TypeLookupExpression.
3868 (Expression.DoResolve): If we're doing a types-only lookup, the
3869 expression must implement the ITypeExpression interface and we
3870 call DoResolveType() on it.
3871 (SimpleName): Implement the new ITypeExpression interface.
3872 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
3873 hack, the situation that we're only looking up types can't happen
3874 anymore when this method is called. Moved the type lookup code to
3875 DoResolveType() and call it.
3876 (SimpleName.DoResolveType): This ITypeExpression interface method
3877 is now doing the types-only lookup.
3878 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
3879 (ResolveFlags): Added MaskExprClass.
3881 * expression.cs (MemberAccess): Implement the ITypeExpression
3883 (MemberAccess.DoResolve): Added support for a types-only lookup
3884 when we're called via ITypeExpression.DoResolveType().
3885 (ComposedCast): Implement the ITypeExpression interface.
3887 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
3888 Expression.Resolve() with ResolveFlags.Type instead.
3890 2002-08-12 Martin Baulig <martin@gnome.org>
3892 * interface.cs (Interface.Define): Apply attributes.
3894 * attribute.cs (Attribute.ApplyAttributes): Added support for
3895 interface attributes.
3897 2002-08-11 Martin Baulig <martin@gnome.org>
3899 * statement.cs (Block.Emit): Only check the "this" variable if we
3900 do not always throw an exception.
3902 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
3903 whether the property has a set accessor.
3905 2002-08-11 Martin Baulig <martin@gnome.org>
3907 Added control flow analysis support for structs.
3909 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
3910 with control flow analysis turned off.
3911 (IVariable): New interface.
3912 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
3913 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
3914 (FieldExpr.DoResolve): Resolve the instance expression with flow
3915 analysis turned off and do the definite assignment check after the
3916 resolving when we know what the expression will resolve to.
3918 * expression.cs (LocalVariableReference, ParameterReference):
3919 Implement the new IVariable interface, only call the flow analysis
3920 code if ec.DoFlowAnalysis is true.
3921 (This): Added constructor which takes a Block argument. Implement
3922 the new IVariable interface.
3923 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
3924 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
3925 This does the definite assignment checks for struct members.
3927 * class.cs (Constructor.Emit): If this is a non-static `struct'
3928 constructor which doesn't have any initializer, call
3929 Block.AddThisVariable() to tell the flow analysis code that all
3930 struct elements must be initialized before control returns from
3933 * statement.cs (MyStructInfo): New public class.
3934 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
3935 argument to this indexer. If non-zero, check an individual struct
3936 member, not the whole struct.
3937 (FlowBranching.CheckOutParameters): Check struct members.
3938 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
3939 overloaded versions of these methods which take an additional
3940 `int field_idx' argument to check struct members.
3941 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
3942 overloaded versions of these methods which take an additional
3943 `string field_name' argument to check struct member.s
3944 (VariableInfo): Implement the IVariable interface.
3945 (VariableInfo.StructInfo): New public property. Returns the
3946 MyStructInfo instance of the variable if it's a struct or null.
3947 (Block.AddThisVariable): New public method. This is called from
3948 Constructor.Emit() for non-static `struct' constructor which do
3949 not have any initializer. It creates a special variable for the
3950 "this" instance variable which will be checked by the flow
3951 analysis code to ensure that all of the struct's fields are
3952 initialized before control returns from the constructor.
3953 (UsageVector): Added support for struct members. If a
3954 variable/parameter is a struct with N members, we reserve a slot
3955 in the usage vector for each member. A struct is considered fully
3956 initialized if either the struct itself (slot 0) or all its
3957 members are initialized.
3959 2002-08-08 Martin Baulig <martin@gnome.org>
3961 * driver.cs (Driver.MainDriver): Only report an error CS5001
3962 if there were no compilation errors.
3964 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
3965 `UnsafeContext' property to determine whether the parent is in
3966 unsafe context rather than checking the parent's ModFlags:
3967 classes nested in an unsafe class are unsafe as well.
3969 2002-08-08 Martin Baulig <martin@gnome.org>
3971 * statement.cs (UsageVector.MergeChildren): Distinguish between
3972 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
3973 we return. Added test17() and test18() to test-154.cs.
3975 2002-08-08 Martin Baulig <martin@gnome.org>
3977 * typemanager.cs (TypeManager.FilterWithClosure): If we have
3978 Family access, make sure the invoking type isn't a subclass of the
3979 queried type (that'd be a CS1540).
3981 * ecore.cs (Expression.MemberLookup): Added overloaded version of
3982 this method which takes an additional `Type invocation_type'.
3984 * expression.cs (BaseAccess.DoResolve): Use the base type as
3985 invocation and query type.
3986 (MemberAccess.DoResolve): If the lookup failed and we're about to
3987 report a CS0122, try a lookup with the ec.ContainerType - if this
3988 succeeds, we must report a CS1540.
3990 2002-08-08 Martin Baulig <martin@gnome.org>
3992 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3993 (MethodGroupExpr): Implement the IMemberExpr interface.
3995 * expression (MemberAccess.ResolveMemberAccess): No need to have
3996 any special code for MethodGroupExprs anymore, they're now
3999 2002-08-08 Martin Baulig <martin@gnome.org>
4001 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4002 Family, FamANDAssem and FamORAssem permissions.
4003 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4005 2002-08-08 Martin Baulig <martin@gnome.org>
4007 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4008 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4011 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4013 * driver.cs: implemented /resource option to embed managed resources.
4015 2002-08-07 Martin Baulig <martin@gnome.org>
4017 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4018 (FieldBase.HasFieldInitializer): New public property.
4019 (FieldBase.GetInitializerExpression): New public method. Resolves and
4020 returns the field initializer and makes sure it is only resolved once.
4021 (TypeContainer.EmitFieldInitializers): Call
4022 FieldBase.GetInitializerExpression to get the initializer, this ensures
4023 that it isn't resolved multiple times.
4025 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4026 the resolving process (SimpleName/MemberLookup) that we're currently
4027 emitting a field initializer (which must not access any instance members,
4028 this is an error CS0236).
4030 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4031 argument, if the `IsFieldInitializer' flag is set, we must report and
4032 error CS0236 and not an error CS0120.
4034 2002-08-07 Martin Baulig <martin@gnome.org>
4036 * ecore.cs (IMemberExpr): New public interface.
4037 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4038 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4039 if the expression is an IMemberExpr.
4041 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4042 to be null, implicitly default to `this' if we're non-static in
4043 this case. Simplified the code a lot by using the new IMemberExpr
4044 interface. Also fixed bug #28176 here.
4046 2002-08-06 Martin Baulig <martin@gnome.org>
4048 * cs-parser.jay (SimpleLookup): Removed. We need to create
4049 ParameterReferences during semantic analysis so that we can do a
4050 type-only search when resolving Cast, TypeOf and SizeOf.
4051 (block): Pass the `current_local_parameters' to the Block's
4054 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4055 argument to the constructor.
4056 (ConstructorInitializer.Resolve): Create a temporary implicit
4057 block with the parameters.
4059 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4060 references here if we aren't doing a type-only search.
4062 * statement.cs (Block): Added constructor which takes a
4063 `Parameters parameters' argument.
4064 (Block.Parameters): New public property.
4066 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4067 to `Parameters' and made it public readonly.
4069 2002-08-06 Martin Baulig <martin@gnome.org>
4071 * ecore.cs (Expression.Warning): Made this public as well.
4073 * report.cs (Report.Debug): Print the contents of collections.
4075 2002-08-06 Martin Baulig <martin@gnome.org>
4077 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4078 used to tell Resolve() which kinds of expressions it may return.
4079 (Expression.Resolve): Added overloaded version of this method which
4080 takes a `ResolveFlags flags' argument. This can be used to tell
4081 Resolve() which kinds of expressions it may return. Reports a
4083 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4084 ResolveFlags.SimpleName.
4085 (Expression.Error118): Added overloaded version of this method which
4086 takes a `ResolveFlags flags' argument. It uses the flags to determine
4087 which kinds of expressions are allowed.
4089 * expression.cs (Argument.ResolveMethodGroup): New public method.
4090 Resolves an argument, but allows a MethodGroup to be returned.
4091 This is used when invoking a delegate.
4093 * TODO: Updated a bit.
4095 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4097 Fixed compilation with csc.
4099 * ecore.cs: Expression.Error made public. Is this correct? Should
4100 Warning be made public too?
4102 * expression.cs: use ea.Location instead of ea.loc.
4103 [FIXME: Filed as bug #28607: MCS must report these errors.]
4105 2002-08-06 Martin Baulig <martin@gnome.org>
4107 * ecore.cs (Expression.loc): Moved the location here instead of
4108 duplicating it in all derived classes.
4109 (Expression.Location): New public property.
4110 (Expression.Error, Expression.Warning): Made them non-static and
4111 removed the location argument.
4112 (Expression.Warning): Added overloaded version which takes an
4113 `int level' argument.
4114 (Expression.Error118): Make this non-static and removed the
4115 expression and location arguments.
4116 (TypeExpr): Added location argument to the constructor.
4118 * expression.cs (StaticCallExpr): Added location argument to
4120 (Indirection, PointerArithmetic): Likewise.
4121 (CheckedExpr, UnCheckedExpr): Likewise.
4122 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4123 (StringPtr): Likewise.
4126 2002-08-05 Martin Baulig <martin@gnome.org>
4128 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4130 * assign.cs (Assign.DoResolve): Check whether the source
4131 expression is a value or variable.
4133 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4134 while resolving the corresponding blocks.
4136 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4137 an error, don't silently return null.
4139 * statement.cs (Block.AddVariable): Do the error reporting here
4140 and distinguish between CS0128 and CS0136.
4141 (Block.DoResolve): Report all unused labels (warning CS0164).
4142 (LabeledStatement): Pass the location to the constructor.
4143 (LabeledStatement.HasBeenReferenced): New property.
4144 (LabeledStatement.Resolve): Set it to true here.
4146 * statement.cs (Return.Emit): Return success even after reporting
4147 a type mismatch error (CS0126 or CS0127), this is what csc does and
4148 it avoids confusing the users with any consecutive errors.
4150 2002-08-05 Martin Baulig <martin@gnome.org>
4152 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4154 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4156 * expression.cs (MemberAccess.DoResolve): Silently return if an
4157 error has already been reported.
4159 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4160 error has already been reported.
4162 2002-08-05 Martin Baulig <martin@gnome.org>
4164 * statement.cs (UsageVector): Only initialize the `parameters'
4165 vector if we actually have any "out" parameters.
4167 2002-08-05 Martin Baulig <martin@gnome.org>
4169 * expression.cs (Binary.ResolveOperator): When combining delegates,
4170 they must have the same type.
4172 2002-08-05 Martin Baulig <martin@gnome.org>
4174 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4175 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4176 work with the ms runtime and we also don't need it: if we're a
4177 PropertyBuilder and not in the `indexer_arguments' hash, then we
4178 are a property and not an indexer.
4180 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4181 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4182 since the latter one doesn't work with the ms runtime.
4184 2002-08-03 Martin Baulig <martin@gnome.org>
4186 Fixed bugs #27998 and #22735.
4188 * class.cs (Method.IsOperator): New public field.
4189 (Method.CheckBase): Report CS0111 if there's already a method
4190 with the same parameters in the current class. Report CS0508 when
4191 attempting to change the return type of an inherited method.
4192 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4193 and it's not marked abstract or extern.
4194 (PropertyBase): New abstract base class for Property and Indexer.
4195 (PropertyBase.CheckBase): Moved here from Property and made it work
4197 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4198 the same so we can reuse it there.
4199 (Property, Indexer): Derive from PropertyBase.
4200 (MethodSignature.inheritable_property_signature_filter): New delegate
4201 to find properties and indexers.
4203 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4204 argument and improved error reporting.
4206 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4207 EmptyReadOnlyParameters and made it a property.
4209 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4210 version of this method which takes a `PropertyInfo indexer'.
4211 (TypeManager.RegisterIndexer): New method.
4213 * class.cs: Added myself as author of this file :-)
4215 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4217 * class.cs: fixed compilation on windoze.
4219 2002-08-03 Martin Baulig <martin@gnome.org>
4221 * interface.cs (Interface.GetInterfaceBases): Check whether all
4222 base interfaces are at least as accessible than the current one.
4224 * class.cs (TypeContainer.GetClassBases): Check whether base types
4225 are at least as accessible than the current type.
4226 (TypeContainer.AsAccessible): Implemented and made non-static.
4227 (MemberBase.CheckParameters): Report errors if the accessibility
4230 * delegate.cs (Delegate.Delegate): The default visibility is
4231 internal for top-level types and private for nested types.
4232 (Delegate.Define): Report errors if the accessibility checks fail.
4234 * enum.cs (Enum.Enum): The default visibility is internal for
4235 top-level types and private for nested types.
4236 (Enum.DefineType): Compute the correct visibility.
4238 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4239 function which takes a `bool is_toplevel' instead of a TypeContainer.
4241 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4244 2002-08-02 Martin Baulig <martin@gnome.org>
4246 * expression.cs (LocalVariableReferenc): Added constructor which
4247 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4248 (LocalVariableReference.IsReadOnly): New property.
4249 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4250 variable is readonly, use our own readonly flag to do this; you can
4251 use the new constructor to get a writable reference to a read-only
4254 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4255 reference to the local variable.
4257 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4259 * rootcontext.cs (ResolveCore): Also include System.Exception
4261 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4262 we reach an EmptyStatement.
4264 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4267 * expression.cs (Binary.ResolveOperator): Check error result in
4270 use brtrue/brfalse directly and avoid compares to null.
4272 2002-08-02 Martin Baulig <martin@gnome.org>
4274 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4275 Fixes bug #28407, added test-155.cs.
4277 2002-08-01 Martin Baulig <martin@gnome.org>
4279 * class.cs (Event.EmitDefaultMethod): Make this work with static
4280 events. Fixes #28311, added verify-3.cs.
4282 2002-08-01 Martin Baulig <martin@gnome.org>
4284 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4285 `is_disposable' fields.
4286 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4287 `hm.is_disposable' if we're using the collection pattern.
4288 (Foreach.EmitCollectionForeach): Use the correct type for the
4289 enumerator's local variable, only emit the try/finally block if
4290 necessary (fixes #27713).
4292 2002-08-01 Martin Baulig <martin@gnome.org>
4294 * ecore.cs (Expression.report118): Renamed to Error118 and made
4297 * statement.cs (Throw.Resolve): Check whether the expression is of
4298 the correct type (CS0118) and whether the type derives from
4299 System.Exception (CS0155).
4300 (Catch.Resolve): New method. Do the type lookup here and check
4301 whether it derives from System.Exception (CS0155).
4302 (Catch.CatchType, Catch.IsGeneral): New public properties.
4304 * typemanager.cs (TypeManager.exception_type): Added.
4306 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4308 * driver.cs: Updated About function.
4310 2002-07-31 Martin Baulig <martin@gnome.org>
4312 Implemented Control Flow Analysis.
4314 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4315 (EmitContext.CurrentBranching): Added.
4316 (EmitContext.StartFlowBranching): Added.
4317 (EmitContext.EndFlowBranching): Added.
4318 (EmitContext.KillFlowBranching): Added.
4319 (EmitContext.IsVariableAssigned): Added.
4320 (EmitContext.SetVariableAssigned): Added.
4321 (EmitContext.IsParameterAssigned): Added.
4322 (EmitContext.SetParameterAssigned): Added.
4323 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4324 Added control flow analysis stuff here.
4326 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4327 resolve the expression as lvalue.
4328 (LocalVariableReference.DoResolve): Check whether the variable has
4329 already been assigned.
4330 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4331 the parameter as assigned here.
4332 (ParameterReference.DoResolve): Check whether the parameter has already
4334 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4335 expression as lvalue.
4337 * statement.cs (FlowBranching): New class for the flow analysis code.
4338 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4339 (LabeledStatement.IsDefined): New public property.
4340 (LabeledStatement.AddUsageVector): New public method to tell flow
4341 analyis that the label may be reached via a forward jump.
4342 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4344 (VariableInfo.Number): New public field. This is used by flow analysis
4345 to number all locals of a block.
4346 (Block.CountVariables): New public property. This is the number of
4347 local variables in this block (including the locals from all parent
4349 (Block.EmitMeta): Number all the variables.
4351 * statement.cs: Added flow analysis support to all classes.
4353 2002-07-31 Martin Baulig <martin@gnome.org>
4355 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4356 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4357 then use this argument.
4359 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4361 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4362 use this to specify /define options.
4364 2002-07-29 Martin Baulig <martin@gnome.org>
4366 * statement.cs (Fixed): Moved all code that does variable lookups
4367 and resolvings from Emit to Resolve.
4369 * statement.cs (For): Moved all code that does variable lookups
4370 and resolvings from Emit to Resolve.
4372 * statement.cs (Using): Moved all code that does variable lookups
4373 and resolvings from Emit to Resolve.
4375 2002-07-29 Martin Baulig <martin@gnome.org>
4377 * attribute.cs (Attribute.Resolve): Explicitly catch a
4378 System.NullReferenceException when creating the
4379 CustromAttributeBuilder and report a different warning message.
4381 2002-07-29 Martin Baulig <martin@gnome.org>
4383 * support.cs (ParameterData.ParameterName): Added method to
4384 get the name of a parameter.
4386 * typemanager.cs (TypeManager.IsValueType): New public method.
4388 2002-07-29 Martin Baulig <martin@gnome.org>
4390 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4391 is a flag which specifies that it's either ref or out.
4392 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4393 the out parameter to `out Parameter.Modifier mod', also set the
4394 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4396 * support.cs (InternalParameters.ParameterModifier): Distinguish
4397 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4398 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4400 * expression.cs (Argument.GetParameterModifier): Distinguish
4401 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4402 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4404 2002-07-29 Martin Baulig <martin@gnome.org>
4406 * expression.cs (ParameterReference.ParameterReference): Added
4407 `Location loc' argument to the constructor.
4409 * cs-parser.jay: Pass location to ParameterReference.
4411 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4413 * statement.cs (Try): Initialize the location.
4415 * cs-parser.jay: pass location to Try.
4417 * expression.cs (Unary.Reduce): Change the prototype to return
4418 whether a constant fold could be performed or not. The result is
4419 returned in an out parameters. In the case of Indirection and
4420 AddressOf, we want to perform the full tests.
4422 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4424 * statement.cs (Statement.Emit): Flag dead code.
4426 2002-07-27 Andrew Birkett <andy@nobugs.org>
4428 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4430 2002-07-27 Martin Baulig <martin@gnome.org>
4432 * class.cs (MethodData.Define): Put back call to
4433 TypeManager.AddMethod(), accidentally commented this out.
4435 * report.cs (Debug): New public method to print debugging information,
4436 this is `[Conditional ("DEBUG")]'.
4438 2002-07-26 Martin Baulig <martin@gnome.org>
4440 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4441 (switch_statement): Push the current_block to the switch_stack and
4442 pop it again when we're done with the switch.
4443 (switch_section): The new block is a child of the current_block.
4444 Fixes bug #24007, added test-152.cs.
4446 2002-07-27 Martin Baulig <martin@gnome.org>
4448 * expression.cs (Invocation.EmitArguments): When calling a varargs
4449 function with only its fixed arguments, we need to pass an empty
4452 2002-07-27 Martin Baulig <martin@gnome.org>
4454 Mono 0.13 has been released.
4456 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4458 * driver.cs: Rename --resource to --linkres, because that is what
4459 we do currently, we dont support --resource yet.
4461 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4463 2002-07-25 Martin Baulig <martin@gnome.org>
4465 * class.cs (MethodData): New public class. This is a `method builder'
4466 class for a method or one accessor of a Property/Indexer/Event.
4467 (MethodData.GetMethodFlags): Moved here from MemberBase.
4468 (MethodData.ApplyAttributes): Likewise.
4469 (MethodData.ApplyObsoleteAttribute): Likewise.
4470 (MethodData.ApplyConditionalAttribute): Likewise.
4471 (MethodData.ApplyDllImportAttribute): Likewise.
4472 (MethodData.CheckAbstractAndExternal): Likewise.
4473 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4474 (MethodData.Emit): Formerly known as Method.Emit().
4475 (MemberBase): Moved everything which was specific to a single
4476 accessor/method to MethodData.
4477 (Method): Create a new MethodData and call Define() and Emit() on it.
4478 (Property, Indexer, Event): Create a new MethodData objects for each
4479 accessor and call Define() and Emit() on them.
4481 2002-07-25 Martin Baulig <martin@gnome.org>
4483 Made MethodCore derive from MemberBase to reuse the code from there.
4484 MemberBase now also checks for attributes.
4486 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4487 (MemberBase.GetMethodFlags): Moved here from class Method and marked
4489 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4490 `CallingConventions cc' and `Attributes opt_attrs' arguments.
4491 (MemberBase.ApplyAttributes): New virtual method; applies the
4492 attributes to a method or accessor.
4493 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4494 (MemberBase.ApplyConditionalAttribute): Likewise.
4495 (MemberBase.ApplyDllImportAttribute): Likewise.
4496 (MemberBase.CheckAbstractAndExternal): Likewise.
4497 (MethodCore.ParameterTypes): This is now a property instead of a
4498 method, it's initialized from DoDefineParameters().
4499 (MethodCore.ParameterInfo): Removed the set accessor.
4500 (MethodCore.DoDefineParameters): New protected virtual method to
4501 initialize ParameterTypes and ParameterInfo.
4502 (Method.GetReturnType): We can now simply return the MemberType.
4503 (Method.GetMethodFlags): Override the MemberBase version and add
4504 the conditional flags.
4505 (Method.CheckBase): Moved some code from Define() here, call
4506 DoDefineParameters() here.
4507 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4508 here to avoid some larger code duplication.
4509 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4510 ensure that abstract and external accessors don't declare a body.
4512 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4513 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4514 lookup in the attribute's parent classes, so we need to abort as soon
4515 as we found the first match.
4516 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4517 the attribute has no arguments.
4519 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4522 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4524 * cs-parser.jay: reverted previous patch.
4526 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4528 * cs-parser.jay: fixed bug #22119.
4530 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4532 * attribute.cs: fixed compilation. The error was:
4533 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
4534 be assigned to before control leaves the current method."
4535 [FIXME: Filed as bug #28186: MCS must report this error.]
4537 2002-07-25 Martin Baulig <martin@gnome.org>
4539 * attribute.cs (Attribute.Conditional_GetConditionName): New static
4540 method to pull the condition name ouf of a Conditional attribute.
4541 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4542 the obsolete message and error flag out of an Obsolete attribute.
4544 * class.cs (Method.GetMethodFlags): New public method to get the
4545 TypeManager.MethodFlags for this method.
4546 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4548 (Method.Define): Get and apply the Obsolete and Conditional attributes;
4549 if we're overriding a virtual function, set the new private variable
4550 `parent_method'; call the new TypeManager.AddMethod().
4552 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
4553 the MethodBuilder and the Method in a PtrHashtable.
4554 (TypeManager.builder_to_method): Added for this purpose.
4555 (TypeManager.MethodFlags): Added IsObsoleteError.
4556 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
4557 Obsolete and Conditional arguments in MethodBuilders. If we discover
4558 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4559 the message from the attribute.
4561 2002-07-24 Martin Baulig <martin@gnome.org>
4563 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4564 preprocessor directives, ensure that the argument to #define/#undef is
4565 exactly one identifier and that it's actually an identifier.
4567 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4570 2002-07-24 Martin Baulig <martin@gnome.org>
4572 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4573 initialize it to TypeManager.object_type in the constructor.
4574 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4575 of the `hm.get_current' method if we're using the collection pattern.
4576 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4577 for the explicit conversion to make it work when we're using the collection
4578 pattern and the `Current' property has a different return type than `object'.
4581 2002-07-24 Martin Baulig <martin@gnome.org>
4583 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4584 does not match, but don't report any errors. This method is called in
4585 order for all methods in a MethodGroupExpr until a matching method is
4586 found, so we don't want to bail out if the first method doesn't match.
4587 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4588 matches, report the 123. Fixes #28070.
4590 2002-07-24 Martin Baulig <martin@gnome.org>
4592 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4593 TypeManager.TypeToCoreType() to the top of the method so the
4594 following equality checks will work. Fixes #28107.
4596 2002-07-24 Martin Baulig <martin@gnome.org>
4598 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4599 operand is of type uint, and the other operand is of type sbyte,
4600 short or int, the operands are converted to type long." -
4601 Actually do what this comment already told us. Fixes bug #28106,
4604 2002-07-24 Martin Baulig <martin@gnome.org>
4606 * class.cs (MethodBase): New abstract class. This is now a base
4607 class for Property, Indexer and Event to avoid some code duplication
4608 in their Define() and DefineMethods() methods.
4609 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4610 generic methods for Define() and DefineMethods().
4611 (FieldBase): Derive from MemberBase, not MemberCore.
4612 (Property): Derive from MemberBase, not MemberCore.
4613 (Property.DefineMethod): Moved all the code from this method to the
4614 new MethodBase.DefineAccessor(), just call it with appropriate
4616 (Property.Define): Call the new Property.DoDefine(), this does some
4617 sanity checks and we don't need to duplicate the code everywhere.
4618 (Event): Derive from MemberBase, not MemberCore.
4619 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4620 accessors, this will also make them work with interface events.
4621 (Indexer): Derive from MemberBase, not MemberCore.
4622 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4623 (Indexer.Define): Use the new MethodBase functions.
4625 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4626 argument to the constructor.
4627 (Interface.FindMembers): Added support for interface events.
4628 (Interface.PopluateEvent): Implemented.
4630 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
4632 2002-07-22 Miguel de Icaza <miguel@ximian.com>
4634 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4635 but this is required to check for a method name being the same as
4636 the containing class.
4640 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4642 * interface.cs: initialize variable.
4644 2002-07-23 Martin Baulig <martin@gnome.org>
4646 Implemented the IndexerName attribute in interfaces.
4648 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4649 name if this is an explicit interface implementation.
4650 (Indexer.InterfaceIndexerName): New public variable. If we're
4651 implementing an interface indexer, this is the IndexerName in that
4652 interface. Otherwise, it's the IndexerName.
4653 (Indexer.DefineMethod): If we're implementing interface indexer,
4654 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
4655 and Pending.ImplementIndexer methods.
4656 (Indexer.Define): Also define the PropertyBuilder if we're
4657 implementing an interface indexer and this is neither an explicit
4658 interface implementation nor do the IndexerName match the one in
4661 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4662 If a method is defined here, then we always need to create a proxy
4663 for it. This is used when implementing interface indexers.
4664 (Pending.IsInterfaceIndexer): New public method.
4665 (Pending.ImplementIndexer): New public method.
4666 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4667 This is used when implementing interface indexers to define a proxy
4669 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4670 define a proxy if necessary.
4672 * interface.cs (Interface.IndexerName): New public variable.
4673 (Interface.PopulateIndexer): Set the IndexerName.
4674 (Interface.DefineIndexers): New private method. Populate all the
4675 indexers and make sure their IndexerNames match.
4677 * typemanager.cs (IndexerPropertyName): Added support for interface
4680 2002-07-22 Martin Baulig <martin@gnome.org>
4682 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4683 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4684 ret if HasReturnLabel.
4685 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4688 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4689 and set the ec.LoopBeginTryCatchLevel.
4690 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4691 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
4692 the current ec.TryCatchLevel, the branch goes out of an exception
4693 block. In this case, we need to use Leave and not Br.
4695 2002-07-22 Martin Baulig <martin@gnome.org>
4697 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
4698 block unless the block does not always return or it is contained in
4699 another try { ... } catch { ... } block. Fixes bug #26506.
4700 Added verify-1.cs to the test suite.
4702 2002-07-22 Martin Baulig <martin@gnome.org>
4704 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
4705 then we do not always return. Fixes bug #24985.
4707 2002-07-22 Martin Baulig <martin@gnome.org>
4709 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
4710 lookup on a per-class level; ie. walk up the class hierarchy until we
4711 found at least one applicable method, then choose the best among them.
4712 Fixes bug #24463 and test-29.cs.
4714 2002-07-22 Martin Baulig <martin@gnome.org>
4716 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
4717 return types of the methods. The return type is not part of the
4718 signature and we must not check it to make the `new' modifier work.
4719 Fixes bug #27999, also added test-147.cs.
4720 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
4722 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
4723 on the method's return type.
4725 2002-07-21 Martin Baulig <martin@gnome.org>
4727 * assign.cs: Make this work if the rightmost source is a constant and
4728 we need to do an implicit type conversion. Also adding a few more tests
4729 to test-38.cs which should have caught this.
4731 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
4732 target in the makefile for this. The makefile.gnu is primarily intended
4733 for end-users who don't want to debug the compiler.
4735 2002-07-21 Martin Baulig <martin@gnome.org>
4737 * assign.cs: Improved the Assign class so it can now handle embedded
4738 assignments (X = Y = Z = something). As a side-effect this'll now also
4739 consume less local variables. test-38.cs now passes with MCS, added
4740 a few new test cases to that test.
4742 2002-07-20 Martin Baulig <martin@gnome.org>
4744 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
4745 instructions. Fixes bug #27977, also added test-146.cs.
4747 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4749 * cs-tokenizer.cs: fixed getHex ().
4751 2002-07-19 Martin Baulig <martin@gnome.org>
4753 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
4754 not Type.GetType() to lookup the array type. This is needed when
4755 we're constructing an array of a user-defined type.
4756 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
4757 single-dimensional arrays, but also for single-dimensial arrays of
4760 2002-07-19 Martin Baulig <martin@gnome.org>
4762 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
4763 this function is called, it's not allowed to share LocalBuilders
4766 2002-07-19 Martin Baulig <martin@gnome.org>
4768 * expression.cs (Argument.Resolve): Report an error 118 when trying
4769 to pass a type as argument.
4771 2002-07-18 Martin Baulig <martin@gnome.org>
4773 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
4774 Conv_R_Un for the signed `long' type.
4776 2002-07-15 Miguel de Icaza <miguel@ximian.com>
4778 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4779 `expr' for the temporary result, as that will fail if we do
4780 multiple resolves on the same expression.
4782 2002-07-05 Miguel de Icaza <miguel@ximian.com>
4784 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4785 ec.TypeContainer for looking up aliases.
4787 * class.cs (TypeContainer): Remove LookupAlias from here.
4789 * decl.cs (DeclSpace); Move here.
4791 2002-07-01 Miguel de Icaza <miguel@ximian.com>
4793 * class.cs (FindMembers): Only call filter if the constructor
4794 bulider is not null.
4796 Also handle delegates in `NestedTypes' now. Now we will perform
4797 type lookups using the standard resolution process. This also
4800 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4801 This uses Expressions (the limited kind that can be parsed by the
4802 tree) instead of strings.
4804 * expression.cs (ComposedCast.ToString): Implement, used to flag
4805 errors since now we have to render expressions.
4807 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
4810 * ecore.cs (SimpleName.ToString): ditto.
4812 * cs-parser.jay: Instead of using strings to assemble types, use
4813 Expressions to assemble the type (using SimpleName, ComposedCast,
4814 MemberAccess). This should fix the type lookups in declarations,
4815 because we were using a different code path for this.
4817 * statement.cs (Block.Resolve): Continue processing statements
4818 even when there is an error.
4820 2002-07-17 Miguel de Icaza <miguel@ximian.com>
4822 * class.cs (Event.Define): Also remove the `remove' method from
4823 the list of pending items.
4825 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
4826 generate more compact code.
4828 2002-07-17 Martin Baulig <martin@gnome.org>
4830 * const.cs (Const.LookupConstantValue): Add support for constant
4831 `unchecked' and `checked' expressions.
4832 Also adding test case test-140.cs for this.
4834 2002-07-17 Martin Baulig <martin@gnome.org>
4836 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
4837 check whether mi.ReturnType implements the IEnumerator interface; the
4838 `==' and the IsAssignableFrom() will fail in this situation.
4840 2002-07-16 Ravi Pratap <ravi@ximian.com>
4842 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
4845 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4847 * expression.cs: fixed bug #27811.
4849 2002-07-14 Miguel de Icaza <miguel@ximian.com>
4851 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
4852 Molaro: when we are a ref, the value already contains a pointer
4853 value, do not take the address of it.
4855 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4856 * removed mb-parser.jay and mb-tokenizer.cs
4858 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4860 * expression.cs: check against the building corlib void type.
4862 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
4864 * ecore.cs: fix for valuetype static readonly fields: when
4865 initializing them, we need their address, not the address of a copy.
4867 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
4869 * typemanager.cs: register also enum_type in corlib.
4871 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4873 * class.cs: allow calling this (but not base) initializers in structs.
4875 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
4877 * ecore.cs: make sure we compare against the building base types
4880 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
4882 * typemanager.cs: fix TypeToCoreType() to handle void and object
4883 (corlib gets no more typerefs after this change).
4885 2002-07-12 Miguel de Icaza <miguel@ximian.com>
4887 * expression.cs (ArrayCreation.EmitArrayArguments): use
4888 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
4890 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
4891 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
4892 array indexes, the runtime actually forbids them.
4894 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
4895 for array arguments here.
4897 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
4898 instead of the default for ValueTypes.
4900 (New.DoEmit): Use IsValueType instead of
4901 IsSubclassOf (value_type)
4902 (New.DoResolve): ditto.
4903 (Invocation.EmitCall): ditto.
4905 * assign.cs (Assign): ditto.
4907 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
4908 Statements *are* currently doing part of their resolution during
4911 Expressions do always resolve during resolve, but statements are
4912 only required to propagate resolution to their children.
4914 2002-07-11 Miguel de Icaza <miguel@ximian.com>
4916 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
4918 (LoadAssembly): Do not add the dll if it is already specified
4920 (MainDriver): Add the System directory to the link path at the end,
4921 after all the other -L arguments.
4923 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
4924 wrong opcode for loading bytes and bools (ldelem.i1 instead of
4925 ldelem.u1) and using the opposite for sbytes.
4927 This fixes Digger, and we can finally run it.
4929 * driver.cs (UnixParseOption): Move the option parsing here.
4930 (CSCParseOption): Implement CSC-like parsing of options.
4932 We now support both modes of operation, the old Unix way, and the
4933 new CSC-like way. This should help those who wanted to make cross
4936 The only thing broken is that /r:, /reference: and /lib: are not
4937 implemented, because I want to make those have the same semantics
4938 as the CSC compiler has, and kill once and for all the confussion
4939 around this. Will be doing this tomorrow.
4941 * statement.cs (Unsafe.Resolve): The state is checked during
4942 resolve, not emit, so we have to set the flags for IsUnsfe here.
4944 2002-07-10 Miguel de Icaza <miguel@ximian.com>
4946 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
4947 not catch the Error_ObjectRefRequired in SimpleName (as it is
4948 possible to have a class/instance variable name that later gets
4949 deambiguated), we have to check this here.
4951 2002-07-10 Ravi Pratap <ravi@ximian.com>
4953 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
4954 make static and put into Expression.
4956 (Event.Define): Register the private field of the event with the
4957 TypeManager so that GetFieldFromEvent can get at it.
4959 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
4960 keep track of the private field associated with an event which
4963 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
4966 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
4968 2002-07-10 Miguel de Icaza <miguel@ximian.com>
4970 * expression.cs (Binary.EmitBranchable): this routine emits the
4971 Binary expression in a branchable context. This basically means:
4972 we need to branch somewhere, not just get the value on the stack.
4974 This works together with Statement.EmitBoolExpression.
4976 * statement.cs (Statement.EmitBoolExpression): Use
4979 2002-07-09 Miguel de Icaza <miguel@ximian.com>
4981 * statement.cs (For): Reduce the number of jumps in loops.
4983 (For): Implement loop inversion for the For statement.
4985 (Break): We can be breaking out of a Try/Catch controlled section
4986 (foreach might have an implicit try/catch clause), so we need to
4987 use Leave instead of Br.
4989 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4990 now). If the instace expression supports IMemoryLocation, we use
4991 the AddressOf method from the IMemoryLocation to extract the
4992 address instead of emitting the instance.
4994 This showed up with `This', as we were emitting the instance
4995 always (Emit) instead of the Address of This. Particularly
4996 interesting when This is a value type, as we dont want the Emit
4997 effect (which was to load the object).
4999 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5001 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5003 * statement.cs (Checked): Set the CheckedState during the resolve
5004 process too, as the ConvCast operations track the checked state on
5005 the resolve process, and not emit.
5007 * cs-parser.jay (namespace_member_declaration): Flag that we have
5008 found a declaration when we do. This is used to flag error 1529
5010 * driver.cs: Report ok when we display the help only.
5012 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5014 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5016 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5018 * cs-tokenizer.cs (define): We also have to track locally the
5019 defines. AllDefines is just used for the Conditional Attribute,
5020 but we also need the local defines for the current source code.
5022 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5024 * statement.cs (While, For, Do): These loops can exit through a
5025 Break statement, use this information to tell whether the
5026 statement is the last piece of code.
5028 (Break): Flag that we break.
5030 * codegen.cs (EmitContexts): New `Breaks' state variable.
5032 2002-07-03 Martin Baulig <martin@gnome.org>
5034 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5035 modifiers in method declarations in structs. Otherwise, you won't
5036 be able to override things like Object.Equals().
5038 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5040 * class.cs (Method, Property, Indexer): Do not allow the public
5041 modifier to be used in explicit interface implementations.
5043 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5044 override modifiers in method declarations in structs
5046 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5048 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5049 integer or real overflow, report an error
5051 2002-07-02 Martin Baulig <martin@gnome.org>
5053 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5054 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5055 to tell the runtime about our newly created System.Object and
5056 System.ValueType types.
5058 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5060 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5061 struct instead of Ldarg/Starg.
5063 2002-07-02 Martin Baulig <martin@gnome.org>
5065 * expression.cs (Indirection.Indirection): Call
5066 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5068 2002-07-02 Martin Baulig <martin@gnome.org>
5070 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5071 ValueType, call TypeManager.TypeToCoreType() on it.
5072 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5073 the OpCodes.Newarr argument.
5075 2002-07-02 Martin Baulig <martin@gnome.org>
5077 * expression.cs (Invocation.EmitCall): When compiling corlib,
5078 replace all calls to the system's System.Array type to calls to
5079 the newly created one.
5081 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5082 System.Array methods.
5083 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5084 from the system's System.Array type which must be replaced.
5086 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5088 * typemanager.cs: load unverifiable_code_ctor so we can build
5089 corlib using the correct type. Avoid using GetTypeCode() with
5091 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5092 TypeManager.object_type to allow building corlib.
5094 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5096 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5098 2002-07-01 Martin Baulig <martin@gnome.org>
5100 * class.cs: Make the last change actually work, we need to check
5101 whether `ifaces != null' to avoid a crash.
5103 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5105 * class.cs: when we build structs without fields that implement
5106 interfaces, we need to add the interfaces separately, since there is
5107 no API to both set the size and add the interfaces at type creation
5110 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5112 * expression.cs: the dimension arguments to the array constructors
5113 need to be converted if they are a long.
5115 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5117 * class.cs: don't emit ldarg.0 if there is no parent constructor
5118 (fixes showstopper for corlib).
5120 2002-06-29 Martin Baulig <martin@gnome.org>
5122 MCS now compiles corlib on GNU/Linux :-)
5124 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5125 ie. check for MethodImplOptions.InternalCall.
5127 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5128 and TypeManager.attribute_type are null, so we must explicitly check
5129 whether parent is not null to find out whether it's an attribute type.
5130 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5131 and SetBuilder, not only if the property is neither abstract nor external.
5132 This is necessary to set the MethodImplOptions on the accessor methods.
5133 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5134 SetBuilder, see Property.Emit().
5136 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5137 populate "System.Object", "System.ValueType" and "System.Attribute" since
5138 they've already been populated from BootCorlib_PopulateCoreTypes().
5140 2002-06-29 Martin Baulig <martin@gnome.org>
5142 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5143 is the NullLiteral, we also need to make sure that target_type is not
5146 2002-06-29 Martin Baulig <martin@gnome.org>
5148 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5149 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5150 before calling BootstrapCorlib_ResolveDelegate ().
5152 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5154 * statement.cs: fixed build-breaker. All tests passed ok.
5156 2002-06-27 Martin Baulig <martin@gnome.org>
5158 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5159 for System.Decimal when compiling corlib.
5161 2002-06-27 Martin Baulig <martin@gnome.org>
5163 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5164 switch blocks which contain nothing but a default clause.
5166 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5168 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5170 2002-06-27 Martin Baulig <martin@gnome.org>
5172 * ecore.cs (PropertyExpr.PropertyExpr): Call
5173 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5175 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5176 is already a TypeBuilder.
5178 2002-06-27 Martin Baulig <martin@gnome.org>
5180 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5181 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5182 the "from an array-type to System.Array" case. This makes it work
5183 when compiling corlib.
5185 2002-06-27 Martin Baulig <martin@gnome.org>
5187 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5188 non-static PropertyExpr, set its InstanceExpression. This makes
5189 the `ICollection.Count' property work in System/Array.cs.
5191 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5193 * driver.cs: Made error handling more consistent. Errors now
5194 tracked by Report class, so many methods which used to return int
5195 now return void. Main() now prints success/failure and
5196 errors/warnings message.
5198 Renamed '--probe' compiler argument to '--expect-error'. Removed
5199 the magic number return values (123 and 124). Now, if the
5200 expected error occurs, the compiler exits with success (exit value
5201 0). If the compilation completes without seeing that particular
5202 error, the compiler exits with failure (exit value 1). The
5203 makefile in mcs/errors has been changed to handle the new behaviour.
5205 * report.cs: Made 'expected error' number a property and renamed
5206 it from 'Probe' to 'ExpectedError'.
5208 * genericparser.cs: Removed error handling support, since it is
5209 now all done by Report class.
5211 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5212 class, so parse() no longer returns an int.
5214 * namespace.cs: Use Report.Error instead of GenericParser.error
5216 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5218 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5219 TypeContainer.AddOperator): At the front of the list put the
5220 explicit implementations, so they get resolved/defined first.
5222 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5224 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5225 interface type is implemented by this TypeContainer. Used during
5226 explicit interface implementation.
5228 (Property.Define, Indexer.Define, Method.Define): Validate that
5229 the given interface in the explicit implementation is one of the
5230 base classes for the containing type.
5232 Also if we are explicitly implementing an interface, but there is
5233 no match in the pending implementation table, report an error.
5235 (Property.Define): Only define the property if we are
5236 not explicitly implementing a property from an interface. Use the
5237 correct name also for those properties (the same CSC uses,
5238 although that is really not needed).
5240 (Property.Emit): Do not emit attributes for explicitly implemented
5241 properties, as there is no TypeBuilder.
5243 (Indexer.Emit): ditto.
5245 Hiding then means that we do not really *implement* a pending
5246 implementation, which makes code fail.
5248 2002-06-22 Martin Baulig <martin@gnome.org>
5250 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5251 the return value of Object.GetType(). [FIXME: we need to do this whenever
5252 we get a type back from the reflection library].
5254 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5256 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5258 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5260 * attribute.cs: Return null if we can not look up the type.
5262 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5263 the interface types found.
5265 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5266 interface types found.
5268 * typemanager.cs (GetInterfaces): Make this routine returns alll
5269 the interfaces and work around the lame differences between
5270 System.Type and System.Reflection.Emit.TypeBuilder in the results
5271 result for GetInterfaces.
5273 (ExpandInterfaces): Given an array of interface types, expand and
5274 eliminate repeated ocurrences of an interface. This expands in
5275 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5278 2002-06-21 Martin Baulig <martin@gnome.org>
5280 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5283 2002-06-21 Martin Baulig <martin@gnome.org>
5285 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5286 and called with one of the core types, return the corresponding typebuilder for
5289 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5292 2002-06-21 Martin Baulig <martin@gnome.org>
5294 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5295 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5296 (Expression.ConvertReferenceExplicit): Likewise.
5298 * expression.cs (ElementAccess.DoResolve): Likewise.
5299 (ElementAccess.DoResolveLValue): Likewise.
5301 2002-06-10 Martin Baulig <martin@gnome.org>
5303 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5304 add the "value" parameter to the parameter list.
5306 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5309 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5311 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5312 the argument to an int, uint, long or ulong, per the spec. Also
5313 catch negative constants in array creation.
5315 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5317 * class.cs: do not allow the same interface to appear twice in
5318 the definition list.
5320 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5322 * ecore.cs: don't use ldlen with System.Array.
5324 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5326 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5328 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5330 * modifiers.cs: produce correct field attributes for protected
5331 internal. Easy fix so miguel can work on ther harder stuff:-)
5333 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5335 * pending.cs: New file. Move the code from class.cs here.
5336 Support clearning the pending flag for all methods (when not doing
5337 explicit interface implementation).
5339 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5341 * rootcontext.cs: added a couple more types needed to bootstrap.
5343 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5345 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5346 constructor in the type, instead of any constructor in the type
5347 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5348 a bug in the Mono runtime when applying the params attribute).
5350 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5351 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5353 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5355 * expression.cs (Unary.ResolveOperator): Use TypeManager
5356 to resolve the type.
5358 2002-06-13 Ravi Pratap <ravi@ximian.com>
5360 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5363 * enum.cs (AddEnumMember): Add support to store the attributes associated
5364 with each member too.
5366 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5367 field builders too - this takes care of the enum member case.
5369 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5371 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5372 address-of operator on both value types and pointers.
5374 2002-06-10 Martin Baulig <martin@gnome.org>
5376 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5377 PropertyBuilder to the `property_builders' list.
5379 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5380 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5381 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5382 find any indexers which are inherited from an interface.
5384 2002-06-09 Martin Baulig <martin@gnome.org>
5386 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5387 the same type as the constant if necessary. There's also a test-130.cs
5390 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5392 * typemanager.cs (TypeManager.ChangeType): Previously known as
5393 Enum.ChangeEnumType().
5395 2002-06-09 Martin Baulig <martin@gnome.org>
5397 * expression.cs (Cast.TryReduce): Added support for consts.
5399 2002-06-08 Ravi Pratap <ravi@ximian.com>
5401 * class.cs (Accessor): Hold attributes information so we can pass
5404 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5405 Modify to pass in attributes attached to the methods.
5407 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5409 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5410 to handle the Accessor kind :-)
5412 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5414 2002-06-08 Martin Baulig <martin@gnome.org>
5416 * expression.cs (Unary.TryReduceNegative): Added support for
5419 2002-06-08 Martin Baulig <martin@gnome.org>
5421 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5422 name can't be found in the `defined_names' - the caller will do a
5423 MemberLookup in this case and thus find methods in System.Enum
5424 such as Enum.IsDefined().
5426 2002-06-08 Martin Baulig <martin@gnome.org>
5428 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5429 Convert.ChangeType() which works with TypeBuilder created types.
5430 (Enum.LookupEnumValue, Enum.Define): Use it here.
5432 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5433 `TypeBuilder.BaseType != null' check.
5434 (TypeContainer.FindMembers): Only lookup parent members if we
5435 actually have a parent.
5436 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5437 (ConstructorInitializer.Resolve): Likewise.
5439 * interface.cs (Interface.FindMembers): Added
5440 `TypeBuilder.BaseType != null' check.
5442 * rootcontext.cs (RootContext.ResolveCore): Added
5443 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5444 classes_second_stage.
5446 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5447 debug_type and trace_type when compiling with --nostdlib.
5449 2002-06-07 Martin Baulig <martin@gnome.org>
5451 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5452 (AddField): Set it to true when adding a non-static field.
5453 (DefineType): Use `have_nonstatic_fields' to find out whether we
5454 have non-static fields, not `Fields != null'.
5456 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5458 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5459 dereferencing a null on the static-field code path)
5461 2002-05-30 Martin Baulig <martin@gnome.org>
5463 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5464 to take command line arguments. Use reflection to call the new
5465 custom `Initialize' function on the symbol writer and pass it the
5466 command line arguments.
5468 * driver.cs (--debug-args): New command line argument to pass command
5469 line arguments to the symbol writer.
5471 2002-05-28 Miguel de Icaza <miguel@ximian.com>
5473 * assign.cs (DoResolve): Forgot to do the implicit conversion to
5474 the target type for indexers and properties. Thanks to Joe for
5477 2002-05-27 Miguel de Icaza <miguel@ximian.com>
5479 * typemanager.cs (MethodFlags): returns the method flags
5480 (Obsolete/ShouldIgnore) that control warning emission and whether
5481 the invocation should be made, or ignored.
5483 * expression.cs (Invocation.Emit): Remove previous hack, we should
5484 not do this on matching a base type, we should do this based on an attribute
5486 Only emit calls to System.Diagnostics.Debug and
5487 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5488 on the command line.
5490 * rootcontext.cs: Global settings for tracing and debugging.
5492 * cs-tokenizer.cs (define): New utility function to track
5493 defines. Set the global settings for TRACE and DEBUG if found.
5495 2002-05-25 Ravi Pratap <ravi@ximian.com>
5497 * interface.cs (Populate*): Pass in the TypeContainer as well as
5498 the DeclSpace as parameters so that we can create EmitContexts and
5499 then use that to apply attributes etc.
5501 (PopulateMethod, PopulateEvent, PopulateProperty)
5502 (PopulateIndexer): Apply attributes everywhere.
5504 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5507 (ApplyAttributes): Update accordingly.
5509 We now apply interface attributes for all members too.
5511 2002-05-26 Miguel de Icaza <miguel@ximian.com>
5513 * class.cs (Indexer.Define); Correctly check if we are explicit
5514 implementation (instead of checking the Name for a ".", we
5515 directly look up if the InterfaceType was specified).
5517 Delay the creation of the PropertyBuilder.
5519 Only create the PropertyBuilder if we are not an explicit
5520 interface implementation. This means that explicit interface
5521 implementation members do not participate in regular function
5522 lookups, and hence fixes another major ambiguity problem in
5523 overload resolution (that was the visible effect).
5525 (DefineMethod): Return whether we are doing an interface
5528 * typemanager.cs: Temporary hack until we get attributes in
5529 interfaces (Ravi is working on that) and we get IndexerName
5530 support in interfaces.
5532 * interface.cs: Register the indexers as properties.
5534 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5535 warning, I have verified that this is a bug in the .NET runtime
5536 (JavaScript suffers of the same problem).
5538 * typemanager.cs (MemberLookup): When looking up members for
5539 interfaces, the parent of an interface is the implicit
5540 System.Object (so we succeed in searches of Object methods in an
5541 interface method invocation. Example: IEnumerable x; x.ToString
5544 2002-05-25 Miguel de Icaza <miguel@ximian.com>
5546 * class.cs (Event): Events should also register if they do
5547 implement the methods that an interface requires.
5549 * typemanager.cs (MemberLookup); use the new GetInterfaces
5552 (GetInterfaces): The code used to lookup interfaces for a type is
5553 used in more than one place, factor it here.
5555 * driver.cs: Track the errors at the bottom of the file, we kept
5558 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5559 instance if the method we are calling is static!
5561 2002-05-24 Miguel de Icaza <miguel@ximian.com>
5563 * attribute.cs (ApplyAttributes): Make this function filter out
5564 the IndexerName attribute (as that attribute in reality is never
5565 applied) and return the string constant for the IndexerName
5568 * class.cs (TypeContainer.Emit): Validate that all the indexers
5569 have the same IndexerName attribute, and if so, set the
5570 DefaultName attribute on the class.
5572 * typemanager.cs: The return value might contain other stuff (not
5573 only methods). For instance, consider a method with an "Item"
5574 property and an Item method.
5576 * class.cs: If there is a problem with the parameter types,
5579 2002-05-24 Ravi Pratap <ravi@ximian.com>
5581 * ecore.cs (ImplicitConversionExists): Wrapper function which also
5582 looks at user defined conversion after making a call to
5583 StandardConversionExists - we need this for overload resolution.
5585 * expression.cs : Update accordingly the various method calls.
5587 This fixes 2 bugs filed against implicit user defined conversions
5589 2002-05-22 Miguel de Icaza <miguel@ximian.com>
5591 * statement.cs: Track the result of the assignment.
5593 2002-05-21 Miguel de Icaza <miguel@ximian.com>
5595 * expression.cs (MemberAccess): Improved error reporting for
5596 inaccessible members.
5598 2002-05-22 Martin Baulig <martin@gnome.org>
5600 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
5601 itself with debugging support.
5603 2002-05-22 Martin Baulig <martin@gnome.org>
5605 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5606 Removed, this isn't needed anymore.
5608 2002-05-20 Martin Baulig <martin@gnome.org>
5610 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5611 be underlying type for an enum.
5613 2002-05-20 Miguel de Icaza <miguel@ximian.com>
5615 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5616 that splits out the loading of just the core types.
5618 * rootcontext.cs (ResolveCore): Split the struct resolution in
5619 two, so we can load the enumeration underlying types before any
5622 * expression.cs (Is): Bandaid until we fix properly Switch (see
5623 bug #24985 for details).
5625 * typemanager.cs (ImplementsInterface): The hashtable will contain
5626 a null if there are no interfaces implemented.
5628 2002-05-18 Miguel de Icaza <miguel@ximian.com>
5630 * cs-parser.jay (indexer_declarator): It is fine to have array
5633 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5635 * typemanager.cs: (RegisterBuilder): New function used to register
5636 TypeBuilders that implement interfaces. Since
5637 TypeBuilder.GetInterfaces (as usual) does not work with lame
5639 (AddUserType): register interfaces.
5641 (ImplementsInterface): Use the builder_to_ifaces hash if we are
5642 dealing with TypeBuilder. Also, arrays are showing up as
5643 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5644 methods can not be invoked on them!
5646 * ecore.cs (ExplicitReferenceConversionExists): Made public.
5647 (ImplicitReferenceConversionExists): Split out from
5648 StandardConversionExists.
5650 * expression.cs (As): We were only implementing one of the three
5651 cases for the as operator. We now implement them all.
5652 (Is): Implement the various other cases for Is as well.
5654 * typemanager.cs (CACHE): New define used to control if we want or
5655 not the FindMembers cache. Seems to have a negative impact on
5656 performance currently
5658 (MemberLookup): Nested types have full acess to
5659 enclosing type members
5661 Remove code that coped with instance/static returns for events, we
5662 now catch this in RealFindMembers.
5664 (RealFindMembers): only perform static lookup if the instance
5665 lookup did not return a type or an event.
5667 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5669 * assign.cs (CompoundAssign): We pass more semantic information
5670 now to Compound Assignments than we did before: now we have all
5671 the information at hand, and now we resolve the target *before* we
5672 do the expression expansion, which allows the "CacheValue" method
5673 to have the effect we intended (before, a [x] += 1 would generate
5674 two differen ArrayAccess expressions from the ElementAccess,
5675 during the resolution process).
5677 (CompoundAssign.DoResolve): Resolve target and original_source here.
5679 2002-05-16 Miguel de Icaza <miguel@ximian.com>
5681 * expression.cs (ArrayAccess): dropped debugging information.
5683 * typemanager.cs: Small bug fix: I was always returning i_members,
5684 instead of one of i_members or s_members (depending on which had
5687 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
5688 method is invoked before any code generation takes place, and it
5689 is a mechanism to inform that the expression will be invoked more
5690 than once, and that the method should use temporary values to
5691 avoid having side effects
5693 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
5695 * ecore.cs (Expression.CacheTemporaries): Provide empty default
5698 * expression.cs (Indirection, ArrayAccess): Add support for
5699 CacheTemporaries in these two bad boys.
5701 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
5703 (StoreFromPtr): Handle stobj as well.
5705 * expression.cs (UnaryMutator): Share more code.
5707 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
5708 down: I was not tracking the Filter function as well, which
5709 was affecting the results of the cache.
5711 2002-05-15 Miguel de Icaza <miguel@ximian.com>
5713 * attribute.cs: Remove the hack to handle the CharSet property on
5716 2002-05-14 Miguel de Icaza <miguel@ximian.com>
5718 * attribute.cs (DoResolve): More uglyness, we now only try to
5719 resolve the attribute partially, to extract the CharSet
5720 information (only if we are a StructLayout attribute). Otherwise
5722 (GetExtraTypeInfo): Add some code to conditionally kill in the
5723 future this. I am more and more convinced that the .NET
5724 framework has special code to handle the attribute setting on
5727 * expression.cs (IsParamsMethodApplicable): Revert my previous
5728 foreach change here, it was wrong.
5730 2002-05-13 Miguel de Icaza <miguel@ximian.com>
5732 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
5733 (pp_expr): do not abort on unknown input, just return.
5734 (eval): abort if there are pending chars.
5736 * attribute.cs (Attribute.Resolve): Positional parameters are
5737 optional. Deal with that case.
5739 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
5740 the Ansi/Unicode/Auto information for the type.
5742 (TypeContainer.DefineType): instantiate the EmitContext here, as
5743 we will be using it during the type definition (to resolve
5744 attributes) and during the emit phase.
5746 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
5747 to pull type information out of the attributes
5749 (Attribute.Resolve): track the constructor builder, and allow for
5750 multiple invocations (structs and classes will use this).
5752 * ecore.cs (MemberLookupFinal): new version with all the
5753 parameters customizable.
5755 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
5756 constructors. Return if the result value is null (as the error
5757 would have been flagged already by MemberLookupFinal)
5759 Do not allow instances of abstract classes or interfaces to be
5762 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
5763 We have to compare the assembly property here when dealing with
5764 FamANDAssem and Assembly access modifiers, because we might be
5765 creating an assembly from *modules* (that means that we are not
5766 getting TypeBuilders for types defined in other modules that are
5767 part of this assembly).
5769 (Method.Emit): If the method is marked abstract and has a body,
5772 (TypeContainer.DefineMembers): If both the defined member and the
5773 parent name match are methods, then do not emit any warnings: let
5774 the Method.Define routine take care of flagging warnings. But if
5775 there is a mismatch (method overrides something else, or method is
5776 overriwritten by something, then emit warning).
5778 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5779 set to null, this means `do not check for the return type on the
5782 (Method.Define): set the return type for the method signature to
5783 null, so that we get methods with the same name and parameters and
5784 different return types. This is used to flag warning 114 (you are
5785 hiding a method, and you probably want to use the new/override
5788 * typemanager.cs (MemberLookup): Implemented proper access
5789 control, closing a long standing set of bug reports. The problem
5790 was that the Framework only has two bits: Public and NonPublic,
5791 and NonPublic includes private and protected methods, but we need
5792 to enforce the FamANDAssem, FamOrAssem and Family.
5794 2002-05-11 Miguel de Icaza <miguel@ximian.com>
5796 * statement.cs (GotoCase): Return true: Ammounts to giving up
5797 knowledge on whether we return or not, and letting the other case
5798 be responsible for it.
5800 2002-05-10 Miguel de Icaza <miguel@ximian.com>
5802 * driver.cs: Do not load directories for each file processed, only
5803 do it if there is a pattern.
5805 * ecore.cs: Report readonly assigns here as well, as we might have
5806 been resolved only by MemberAccess.
5808 (SimpleName.SimpleNameResolve): Also be useful for LValue
5809 resolution. We need this to propagate assign to local readonly variables
5811 * typemanager.cs: Use a ptrhashtable for the criteria, because we
5812 do not want to reuse potential criteria memory.
5814 * class.cs (MyEventBuilder): Set reflected_type;
5816 * ecore.cs (Constantify): Added support for constifying bools.
5818 (RootContext.LookupType): Added a cache for values looked up in
5819 the declaration space.
5821 * typemanager.cs (FindMembers): Now is a front-end to
5822 RealFindMembers, and provides a two-level hashtable-based cache to
5825 15% performance improvement: from 22.5 to 19.2 seconds.
5827 * expression.cs (IsParamsMethodApplicable): use foreach.
5828 (Invocation.DoResolve): ditto.
5829 (New.DoResolve): ditto.
5830 (ArrayCreation.DoResolve): ditto.
5832 * ecore.cs (FindMostEncompassingType): use foreach.
5834 * delegate.cs (NewDelegate.DoResolve): Use foreach
5836 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
5837 (RemoveMethods): use foreach.
5839 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
5840 nested foreach statements instead of for, and also break out of
5841 the inner loop once a match is found.
5843 (Invocation.OverloadResolve): Use foreach, simplify the code.
5845 2002-05-08 Miguel de Icaza <miguel@ximian.com>
5847 * cfold.cs (BinaryFold): During an enumeration evaluation context,
5848 we actually unwrap the expression to allow for extra information
5851 * expression.cs: Use Shr_Un on unsigned operations.
5853 2002-05-08 Ravi Pratap <ravi@ximian.com>
5855 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
5856 applicable operators was not being considered correctly. This closes
5857 the bug Miguel reported.
5859 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
5861 * attribute.cs: check that the type derives from System.Attribute
5862 and report the correct error in that case (moved the duplicate code to
5863 its own method, too).
5865 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
5867 * attribute.cs: lookup attribute type name as the spec says: first the
5868 bare attribute name and then name + "Attribute" (nant compiles with
5869 mcs after this fix).
5871 2002-05-07 Miguel de Icaza <miguel@ximian.com>
5873 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
5874 Because of the way we parse things, we should try to see if a
5875 UIntConstant can fit in an integer.
5877 2002-05-07 Ravi Pratap <ravi@ximian.com>
5879 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
5880 when we are in an explicit context.
5882 (ConvertReferenceExplicit): When converting from Iface type S to Class
5883 T make sure the rules are implemented as an OR.
5885 * parameter.cs (ParameterType): Make it a property for now although the
5886 purpose really isn't anything immediate.
5888 * expression.cs (Is*Applicable): Do better checking on the parameter type
5889 of a ref/out parameter. The ones from the system assemblies are already
5890 marked with the correct type so we don't need to do any correction.
5892 * ecore.cs (StandardConversionExists): Conversion from Interface types to
5893 the object type is standard too so include that.
5895 2002-05-06 Miguel de Icaza <miguel@ximian.com>
5897 * ecore.cs (StandardConversionExists): Augment with missing code:
5898 deal with IntConstant, LongConstants and Enumerations.
5900 * assign.cs: Report the error, instead of failing silently
5902 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
5903 typecontainer that they are declared, because the
5904 typecontainer/namespace will have the list of using clauses that
5907 Assembly Attributes were escaping the normal registration
5910 (EmitCode): Apply attributes within an EmitContext that represents
5911 the container they were declared on.
5913 * cs-parser.jay: Track bases for structs. How did I get this wrong?
5915 2002-05-06 Ravi Pratap <ravi@ximian.com>
5917 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
5918 Revamp completely - make much cleaner as we now operate only
5921 (FindMostSpecificSource, FindMostSpecificTarget): New methods
5922 to implement the logic detailed in the spec more correctly.
5924 (UserDefinedConversion): Update accordingly.
5926 2002-05-06 Miguel de Icaza <miguel@ximian.com>
5928 * statement.cs: Return flow analysis information up.
5930 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
5933 (token): Do not consume an extra character before calling
5936 2002-05-06 Piers Haken <piersh@friskit.com>
5938 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
5940 2002-05-06 Miguel de Icaza <miguel@ximian.com>
5942 * class.cs (Constructor.Emit): Set the IsStatic flag in the
5943 EmitContext during the instance constructor initializer
5944 resolution, to stop access to instance variables.
5946 This is mandated by the spec, last paragraph of the `constructor
5947 initializers' section.
5949 2002-05-05 Miguel de Icaza <miguel@ximian.com>
5951 * cs-parser.jay, class.cs (Accessor): new class used to represent
5952 an accessor (get or set). In the past we used `null' to represent
5953 a missing accessor. But this is ambiguous because there was no
5954 way to tell in abstract indexers/properties if one of them was
5957 Now there is a way of addressing that.
5959 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
5960 instead of FindMembers.
5962 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
5963 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
5965 * attribute.cs: Treat indexers and properties as the same in terms
5966 of applying attributes
5968 * ecore.cs (FindMostEncompassedType): Use statically initialized
5969 EmptyExpressions()s like we do elsewhere to avoid creating useless
5970 objects (and we take this out of the tight loop).
5972 (GetConversionOperators): Move the code to extract the actual
5973 operators to a separate routine to clean things up.
5975 2002-05-04 Miguel de Icaza <miguel@ximian.com>
5977 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5978 events are always registered FieldBuilders.
5980 * class.cs (FieldBase): New class shared by Fields
5982 * delegate.cs: If we are a toplevel delegate, use our full name.
5983 If we are a nested delegate, then only use our tail name.
5985 2002-05-02 Ravi Pratap <ravi@ximian.com>
5987 * expression.cs (IsApplicable): Ensure that we add the "&" to
5988 ref/out types before comparing it with the type of the argument.
5990 (IsParamsMethodApplicable): Ditto.
5992 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
5995 * delegate.cs : Handle the case when we have more than one applicable
5996 method. Flag an error only when we finish checking all.
5998 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6000 * expression.cs: Add support for boolean static initializers.
6002 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6004 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6006 * parameter.cs (ComputeParameterTypes,
6007 ComputeAndDefineParameterTypes): Better error handling: now we
6008 clear the `types' cache if we fail during any of the type lookups.
6009 We also return the status code correctly to our caller
6011 * delegate.cs: If we fail to define a delegate, abort the extra
6014 * expression.cs (Binary.ResolveOperator): for
6015 operator==(object,object) and operator !=(object, object) we also
6016 have to verify that there is an implicit conversion from one to
6019 (ArrayAccess.DoResolve): Array Access can operate on
6022 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6024 * assign.cs (CompoundAssign): A new class used as a "flag" that
6025 the assignment actually is happening as part of a compound
6026 assignment operator.
6028 During compound assignment, a few new rules exist to enable things
6035 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6036 to the type of x) if y is implicitly convertible to the type of x,
6037 and the operator is a builtin operator and the return type of the
6038 operator is explicitly convertible to the type of x.
6040 * rootcontext.cs: Reset warning level to 2. 4 catches various
6041 "interesting" features in mcs, we must clean this up at some
6042 point, but currently am trying to kill other bugs ;-)
6044 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6045 in container classes as well.
6047 * expression.cs (Binary.ResolveOperator): Handle string case
6048 before anything else (as operator overloading does emit an error
6049 before doing anything else).
6051 This code could go away when we move to a table driven model, but
6052 i could not come up with a good plan last night.
6054 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6056 * typemanager.cs (CSharpName): reimplementation using regex.
6057 * class.cs: added null check for fields in Emit
6058 * rootcontext.cs: set warninglevel to 4
6060 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6062 * typemanager.cs (CSharpName): reimplemented with Lupus
6065 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6067 * statement.cs (If): correclty implement Resolve, because we were
6068 not catching sem errors in there. The same process is needed
6070 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6073 (Statement.Warning_DeadCodeFound): Factorize code.
6074 (While): Report dead code here too.
6076 (Statement): Added Resolve virtual method to allow
6077 for resolution split from the emit code.
6079 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6081 * statement.cs (EmitBoolExpression): No longer try to resolve the
6083 (MakeBoolean): New utility function that resolve, implicitly
6084 converts to boolean and tags the expression.
6087 (If, Do): Implement dead code elimination.
6088 (While): Implement loop inversion
6090 (Do, While, For, If): Resolve the expression prior to calling our
6093 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6096 - added method Report28 (warning: program has more than one entry point)
6097 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6098 - modified method Method.Define, the part at the end of the method
6100 * rootcontext.cs: added static public Location EntryPointLocation;
6102 * ../errors/cs0028.cs : Add test case for the above warning.
6105 - modified method CSharpName to allow arrays of primitive type to
6106 be printed nicely (e.g. instead of System.Int32[][] it now prints
6108 - added method CSharpSignature: returns the signature of a method
6109 in string format to be used in reporting errors, warnings, etc.
6111 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6114 2002-04-26 Ravi Pratap <ravi@ximian.com>
6116 * delegate.cs (Define): Fix extremely silly bug where I was
6117 setting the type of the 'object' parameter of the BeginInvoke
6118 method to System.IAsyncResult instead of System.Object ;-)
6120 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6122 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6125 (Constructor.Emit): return if we fail to initialize the
6126 constructor. Another door closed!
6128 * expression.cs (New.DoResolve): Improve error message (from -6 to
6129 1501). Use DeclaredOnly lookup to find the exact constructor.
6131 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6132 loop. This is useful.
6134 * cs-parser.jay: Adjust the default parameters so that destructors
6135 have the proper signature.
6137 2002-04-26 Martin Baulig <martin@gnome.org>
6139 * driver.cs (LoadAssembly): If `assembly' contains any characters
6140 which are only valid in path names and not in assembly names
6141 (currently slash, backslash and point), use Assembly.LoadFrom ()
6142 instead of Assembly.Load () on the `assembly' (before iteration
6143 over the link_paths).
6145 2002-04-26 Martin Baulig <martin@gnome.org>
6147 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6149 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6151 * class.cs (Property): use the new typemanager.MemberLookup
6153 (TypeContainer.MemberLookup): Implement using the
6154 TypeManager.MemberLookup now.
6156 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6157 and return MemberInfos, so that these can be used without an
6158 EmitContext (what we had before).
6160 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6162 * expression.cs: Fix the case where the argument to params if the
6163 type of the params. I omitted handling this before. Fixed
6165 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6167 * driver.cs: Call BootCorlib_PopulateCoreType
6169 * class.cs (Property.CheckBase): Check for properties only, not
6172 * interface.cs: Temporary hack: try/catch around the
6173 CustomAttributeBuilder, because I am getting an exception that I
6176 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6177 types whose definitions are required to be there (attributes are
6178 defined before standard types).
6180 Compute definitions as we boot the various types, as they are used
6181 immediately (value_type class will need object_type, but if we do
6182 not initialize object_type, we will pass a null, which will let
6183 the runtime pick the System.Object from the existing corlib, which
6184 is not what we want).
6186 2002-04-22 Patrik Torstensson <totte@labs2.com>
6188 * cs-tokenizer.cs: fixed a number of trim() issues.
6190 2002-04-22 Ravi Pratap <ravi@ximian.com>
6192 * expression.cs (Argument.Type): Ensure that we return the correct
6193 type when we have out or ref parameters [in which case we
6196 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6198 * class.cs (Property, Indexer): Allow extern modifier in there.
6200 * typemanager.cs (InitBaseTypes): Initializes object_type and
6201 value_type, since those will be used early on during the bootstrap
6202 process to compile corlib.
6204 (InitCoreTypes): Move code from here to InitBaseTypes.
6206 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6208 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6209 single-dimension arrays as using the ldlen opcode.
6211 Daniel Lewis discovered this optimization.
6213 * typemanager.cs: Add signature for System.Array::get_Length
6215 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6217 * statement.cs: report the error when the foreach does not apply to an
6218 array nor a collection.
6220 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6222 * expression.cs: Add implicit conversions to the operator ~.
6224 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6226 * typemanager.cs: Locate the decimal constructor.
6228 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6230 * attribute.cs: use the new property of TypeOf.
6231 * expression.cs: added 'get' property around typearg.
6233 These changes fix a build breaker reported by NickD. Is this the
6234 correct way to fix? If not, please, revert my changes and make it
6237 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6239 * attribute.cs: Add support for typeof in attribute invocations.
6240 I am not sure that this is right though.
6242 2002-04-14 Duncan Mak <duncan@ximian.com>
6244 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6245 Binary.Operator.Division case.
6247 2002-04-13 Ravi Pratap <ravi@ximian.com>
6249 * class.cs (DefineType): Ensure that we do a proper check on
6250 attribute types and also register it with the TypeManager.
6252 (TypeContainer.Targets): The default for attribute types is
6253 AttributeTargets.All.
6255 * attribute.cs (ApplyAttributes): Registering the attribute type
6256 is done elsewhere, not when we discover we have a Usage attribute.
6258 2002-04-12 Ravi Pratap <ravi@ximian.com>
6260 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6261 and get rid of is_delegate parameter.
6263 * everywhere : update.
6265 2002-04-12 Ravi Pratap <ravi@ximian.com>
6267 * cs-parser.jay (compilation_unit): Revamp completely to use
6268 some new ideas that I got from Rhys' grammar to solve the problems
6269 with assembly level attributes.
6271 (outer_declaration): New grammar production.
6273 (attribute_sections): Add.
6275 (opt_attributes): Base on attribute_sections
6277 (namespace_declaration): Allow opt_attributes to tackle the case
6278 when we have assembly level attributes - we are clever in this
6281 * attribute.cs (ApplyAttributes): Do not worry about assembly
6282 attributes in the non-global context.
6284 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6285 instead of SetGlobalAttributes.
6287 * class.cs, rootcontext.cs : Ensure we define and generate
6288 attribute types before anything else.
6290 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6291 and flag the new error -20 for the case when the attribute type
6292 does not have valid targets specified. csc does not catch this.
6294 * ../errors/errors.txt : update for error # -20
6296 2002-04-11 Ravi Pratap <ravi@ximian.com>
6298 * support.cs (InternalParameters.ParameterModifier): Do some null
6299 checking and return sane values.
6301 * class.cs (Method.Define): If we are a PInvoke method, ensure
6302 that we are static and extern. Report error # 601
6304 * ../errors/cs0601.cs : Add test case for the above error.
6306 2002-04-07 Ravi Pratap <ravi@ximian.com>
6308 * rootcontext.cs (attribute_types): We need to keep type of
6309 all attribute types separately and emit code for them first.
6311 (RegisterAttribute) : Implement.
6313 * class.cs (DefineType): Check if the current Type is a custom
6314 attribute type and register it accordingly.
6316 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6317 adding the first attribute twice and rename to
6319 (SetGlobalAttributes): this.
6321 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6324 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6325 if we are processing global arguments. Hmm, I am unsure of this.
6327 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6329 * expression.cs: added static array of strings to avoid calling
6330 Enum.ToString () for Operator in Binary. Significant recover of
6333 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6335 * class.cs (FindMembers): Allow the Builders of the various
6336 members to be null. If they are skip them. This only happens
6337 during the PInvoke declaration.
6339 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6341 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6342 failure, so we do not keep going afterwards.
6344 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6345 wanted to pass `false' as the `is_delegate' argument. If this is
6346 the case, why not use delegate_type == null to mean `is_delegate =
6347 false' and anything else as is_delegate = true.
6349 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6351 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6352 code for the section, not the beginning of the tests.
6354 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6356 * cfold.cs: Handle operator + (Enum x, Underlying x)
6358 * expression.cs (Binary): same. Warn about errors where we have
6359 Enum/Enum in operator + as well.
6361 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6364 - added support for switch(bool)
6365 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6366 - add TableSwitchEmit() to handle table-based switch statements
6368 2002-04-05 Ravi Pratap <ravi@ximian.com>
6370 * expression.cs (Invocation.OverloadResolve): Factor out code which
6371 does parameter compatibility checking with arguments so that we can
6372 re-use the code even from Delegate.VerifyApplicability
6374 (VerifyArgumentsCompat): Move above code here.
6376 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6377 and instead make a call to the above method.
6379 2002-03-31 Ravi Pratap <ravi@ximian.com>
6381 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6382 We use it to keep track of classes which are attribute types.
6384 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6386 * delegate.cs (Delegate.Define): Correctly define the types in the
6387 presence of fixed and array parameters.
6389 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6392 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6393 include NonPublic after the first iteration.
6395 * class.cs (Indexer.CheckBase): Only check if both parents are
6398 * cs-parser.jay (accessor_body): If empty, set to null.
6400 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6401 same code path here to resolve constants names that we did have in
6402 MemberAccess.DoResolve. There is too much code duplicated here.
6404 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6406 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6408 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6411 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6412 tokens, numbers and strings.
6414 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6417 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6418 asyncronous parameters and the regular parameters.
6420 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6421 specify the target directory.
6423 * expression.cs: (This.DoResolve): Simplify
6424 (As.Emit): Optimize, do not generate IsInst if the expression is
6425 always of the given type.
6427 (Is.DoResolve): Bug fix, we were reporting both always/never for
6430 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6431 creating too many unnecessary arrays.
6433 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6435 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6436 fields instead of rolling our own initializer. Takes care of all
6437 implicit conversions, and drops unnecessary static checks/argument.
6439 2002-03-31 Dick Porter <dick@ximian.com>
6441 * driver.cs: use the GetDirectories() return values properly, and
6442 use "/" as path separator.
6444 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6446 * expression.cs (Unary): Optimize - - expr into expr.
6447 (Binary): Optimize a + (-b) into a -b.
6449 * codegen.cs (CodeGen): Made all methods static.
6451 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6455 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6456 TypeBuilder property.
6458 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6461 * tree.cs: Removed the various RecordXXXX, and replaced with a
6462 single RecordDecl. Removed all the accessor methods, and just
6463 left a single access point Type
6465 * enum.cs: Rename DefineEnum to DefineType.
6467 * decl.cs: New abstract method `DefineType' used to unify the
6468 Defines for Enumerations, Interfaces, TypeContainers and
6471 (FindType): Moved LookupInterfaceOrClass here. Moved the
6472 LookupBaseClasses method that used to live in class.cs and
6473 interface.cs here, and renamed to FindType.
6475 * delegate.cs: Implement DefineType. Take advantage of the
6476 refactored pattern for locating the parent builder without taking
6477 the parent_builder argument (which we know does not work if we are
6478 nested, and triggering a toplevel definition).
6480 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6482 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6483 accessibility of a member has changed during override and report
6486 * class.cs (Method.Define, Property.Define): Only complain on
6487 overrides if the method is private, any other accessibility is
6488 fine (and since we just checked the permission is the same, we are
6491 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6492 and elif are processed always. The other pre-processing
6493 directives are only processed if we are "taking" the path
6495 2002-03-29 Martin Baulig <martin@gnome.org>
6497 * class.cs (Method.Emit): Only emit symbolic debugging info if the
6498 current location is not Null.
6500 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6501 a separate method so we can profile it.
6503 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6504 `span.Seconds' are just seconds, but no minutes or hours.
6505 (MainDriver): Profile the CodeGen.SaveSymbols calls.
6507 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6509 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6510 Remove the gratuitous set of Final:
6512 // If an interface implementation, then we can set Final.
6513 if (((flags & MethodAttributes.Abstract) == 0) &&
6514 implementing.DeclaringType.IsInterface)
6515 flags |= MethodAttributes.Final;
6517 I do not know what I was smoking when I used that.
6520 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6521 step into fixing the name resolution issues for delegates and
6522 unifying the toplevel name resolution.
6524 2002-03-28 Martin Baulig <martin@gnome.org>
6526 * class.cs (Method.Emit): If we have a symbol writer, call its
6527 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6528 tell it about the current method.
6530 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6531 writer that we're going to emit the first byte of IL code for a new
6532 statement (a new source line).
6533 (EmitContext.EmitTopBlock): If we have a symbol writer, call
6534 EmitContext.Mark() before emitting any code.
6536 * location.cs (SymbolDocument): Return null when we're Null.
6538 * statement.cs (Statement): Moved the `Location loc' variable here.
6539 (Statement.EmitBoolExpression): If we have a symbol writer, call
6540 ec.Mark() before emitting any code to tell it that we're at the
6541 beginning of a new statement.
6542 (StatementExpression): Added `Location' argument to the constructor.
6543 (Block): Added public readonly variable `StartLocation' and public
6544 variable `EndLocation'. The latter is to be set using SetEndLocation().
6545 (Block): Added constructor which takes a start and end location.
6546 (Block.SetEndLocation): New method. This sets the end location.
6547 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6548 local variables we create.
6549 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6550 each statement and do also mark the begin and end of the block.
6552 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6553 tell it the current lexer.Location, use Location.Null for the end of the
6555 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6556 current block, set its end location using SetEndLocation().
6557 (statement_expression): StatementExpression constructor now takes the
6558 lexer.Location as additional argument.
6559 (for_statement, declare_local_variables): Likewise.
6560 (declare_local_variables): When creating a new implicit block, use the
6561 new Block constructor and pass it the lexer.Location.
6563 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6565 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6566 members also on the parent interfaces recursively.
6568 2002-03-27 Miguel de Icaza <miguel@ximian.com>
6570 * report.cs: Use new formats, since Gonzalo finished the missing
6573 * expression.cs (Binary.ResolveOperator): added missing operator|
6574 operator& and operator^ for bool/bool.
6576 * cs-parser.jay: CheckDef now takes a Location argument that is
6577 used to report errors more precisly (instead of reporting the end
6578 of a definition, we try to track something which is a lot closer
6579 to the source of the problem).
6581 * cs-tokenizer.cs: Track global token use, so we can properly flag
6582 the use of #define/#undef after the first token has been seen.
6584 Also, rename the reportXXXX to Error_DescriptiveName
6586 * decl.cs (DeclSpace.IsTopLevel): Move property here from
6587 TypeContainer, so that Enum and Interface can use this too.
6589 * class.cs (TypeContainer.LookupInterfaceOrClass,
6590 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6591 `builder' argument. Typically this was used to pass the parent
6592 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6595 The problem is that a nested class could trigger the definition of
6596 a toplevel class, and the builder would be obviously wrong in that
6599 So we drop this argument, and we compute dynamically the
6600 TypeBuilder/ModuleBuilder (the correct information was available
6601 to us anyways from DeclSpace.Parent)
6603 * interface.cs (Interface.DefineInterface): Drop builder
6604 parameter cleanup like class.cs
6606 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
6609 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6612 (Try.Emit): Propagate the returns value from the statement.
6614 (Return.Emit): Even if we are leavning
6616 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6618 * modifiers.cs: Fix the computation of MethodAttributes flags.
6620 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6622 * driver.cs: allow compilation of files that start with '/'.
6623 Add a default case when checking the argument of --target.
6625 2002-03-25 Miguel de Icaza <miguel@ximian.com>
6627 * interface.cs: Implement the same search algorithm for types in
6630 * delegate.cs: Do not allow multiple definition.
6632 * Recovered ChangeLog that got accidentally amputated
6634 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6636 * rootcontext.cs: Load manually enum to allow core classes to
6637 contain enumerations.
6639 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6640 Update to new static methods in TypeManager.
6642 * typemanager.cs (GetMethod, GetConstructor): Use our
6643 implementation of FindMembers to find the members, since during
6644 corlib compilation, the types are TypeBuilders and GetMethod and
6645 GetConstructor do not work.
6647 Make all methods in TypeManager static.
6649 (InitCodeHelpers): Split the functionality from
6650 the InitCodeTypes function.
6652 * driver.cs: Call InitCodeHelpers after we have populated the
6655 * cs-parser.jay (delegate_declaration): we did not used to compute
6656 the delegate name correctly for void delegates.
6658 2002-03-24 Miguel de Icaza <miguel@ximian.com>
6660 * rootcontext.cs (RootContext): Init the interface_resolve_order
6661 and type_container_resolve_order always.
6663 (ResolveCore, BootstrapCorlib_ResolveClass,
6664 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6665 compiler when compiling with --nostdlib
6667 * class.cs (TypeContainer.DefineType): Check that our parent is
6668 not null. This test is most important when we are bootstraping
6671 * codegen.cs: Split out the symbol writing code.
6673 2002-03-25 Martin Baulig <martin@gnome.org>
6675 * driver.cs (-g): Made -g an alias for --debug.
6677 2002-03-24 Martin Baulig <martin@gnome.org>
6679 * codegen.cs (SymbolWriter): New public variable. Returns the
6680 current symbol writer.
6681 (CodeGen): Added `bool want_debugging_support' argument to the
6682 constructor. If true, tell the ModuleBuild that we want debugging
6683 support and ask it for the ISymbolWriter.
6684 (Save): If we have a symbol writer, call it's Close() method after
6685 saving the assembly.
6687 * driver.c (--debug): New command line argument to create a
6688 debugger information file.
6690 * location.cs (SymbolDocument): New public property. Returns an
6691 ISymbolDocumentWriter object for the current source file or null
6692 if we don't have a symbol writer.
6694 2002-03-21 Miguel de Icaza <miguel@ximian.com>
6696 * driver.cs (LoadAssembly): Correctly return when all the paths
6697 have been tried and not before.
6699 * statement.cs (Switch.Emit): return the actual coverage for this
6700 statement (returns/not-returns)
6702 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
6703 switch of the statement if we are the last switch section. That
6704 kills two problems: try/catch problems (we used to emit an empty
6705 nop at the end) and switch statements where all branches would
6708 2002-03-19 Miguel de Icaza <miguel@ximian.com>
6710 * driver.cs: Add default assemblies (the equivalent to the
6711 Microsoft CSC.RSP file)
6713 * cs-tokenizer.cs: When updating `cols and setting it to zero,
6714 also update tokens_seen and set it to false.
6716 * driver.cs: Implement --recurse for Mike.
6718 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
6719 correctly splitting out the paths.
6721 2002-03-18 Miguel de Icaza <miguel@ximian.com>
6723 * interface.cs (Interface.PopulateProperty): Instead of using
6724 `parent' as the declaration space for the set parameters, use
6727 * support.cs (InternalParameters): InternalParameters constructor
6728 takes a DeclSpace instead of a TypeContainer.
6730 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
6731 types are being initialized, load the address of it before calling
6734 (New): Provide a mechanism to disable the generation of local
6735 value type temporaries when the caller will be providing us with
6736 an address to store it.
6738 (ArrayCreation.EmitDynamicInitializers): Use it.
6740 2002-03-17 Miguel de Icaza <miguel@ximian.com>
6742 * expression.cs (Invocation.EmitArguments): Only probe for array
6743 property if there is more than one argument. Sorry about that.
6745 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
6748 * class.cs (Method.LabelParameters): Fix incorrect code path that
6749 prevented the `ParamArrayAttribute' from being applied to the
6752 2002-03-16 Miguel de Icaza <miguel@ximian.com>
6754 * support.cs (ReflectionParameters): Correctly compute whether the
6755 last argument is a params array. Fixes the problem with
6758 * typemanager.cs: Make the assemblies array always be non-null
6759 (empty, but non-null)
6761 * tree.cs (RecordDecl): New function that abstracts the recording
6762 of names. This reports error 101, and provides a pointer to the
6763 previous declaration. Fixes a crash in the compiler.
6765 * cs-parser.jay (constructor_declaration): Update to new grammar,
6766 and provide a constructor_body that can be empty.
6768 2002-03-15 Miguel de Icaza <miguel@ximian.com>
6770 * driver.cs: Add support for --resources.
6772 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6773 Make all types for the various array helper methods be integer.
6775 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6776 CheckState to ConvCast.
6778 (ConvCast): Now it takes a `checked' state argument, to avoid
6779 depending on the emit context for the conversion, and just using
6780 the resolve time setting.
6782 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6783 instead of Invocation.EmitArguments. We do not emit the original
6784 arguments, instead we emit those which have been converted to
6785 unsigned int expressions.
6787 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6789 * codegen.cs: ditto.
6791 * expression.cs (LocalVariableReference): Drop the use of the
6792 Store function that depended on the variable index.
6794 * statement.cs (VariableInfo): Drop the `Idx' property from this
6795 class, as this is not taking into account the indexes for
6796 temporaries tat we generate during the execution, getting the
6799 * class.cs: First emit class initializers, then call the parent
6802 * expression.cs (Binary): Fix opcode emision.
6803 (UnaryMutator.EmitCode): Support checked code generation
6805 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6806 matches for events for both the Static and Instance scans,
6807 pointing to the same element. Fix that.
6809 2002-03-14 Miguel de Icaza <miguel@ximian.com>
6811 * rootcontext.cs (ResolveTree): Always set the
6812 interface_resolve_order, because nested interfaces will be calling
6815 * class.cs (GetInterfaceOrClass): Track the same resolution
6816 process used by TypeManager.LookupType. This fixes the nested
6817 type lookups in class declarations (separate path from
6820 (TypeContainer.DefineType): Also define nested interfaces.
6821 (TypeContainer.RegisterOrder): New public function used to
6822 register the order in which child interfaces need to be closed.
6824 Nested interfaces need to be closed after their parents have been
6827 * interface.cs (InterfaceAttr): Put all the logic for computing
6828 the interface attribute here.
6830 (DefineInterface): Register our interface order with the
6831 RootContext or with the TypeContainer depending on the case.
6833 2002-03-12 Miguel de Icaza <miguel@ximian.com>
6835 * cs-parser.jay: rework foreach statement to work with the new
6836 changes to the policy on SimpleNames.
6838 * report.cs: support Stacktrace on warnings as well.
6840 * makefile: drop --unsafe and /unsafe from the compile.
6842 2002-03-13 Ravi Pratap <ravi@ximian.com>
6844 * ecore.cs (StandardConversionExists): Modify to take an Expression
6845 as the first parameter. Ensure we do null -> reference type conversion
6848 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
6849 temporary Expression objects.
6851 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
6853 * interface.cs: workaround bug in method overloading resolution
6854 (there is already a bugzilla bug for it).
6856 2002-03-12 Miguel de Icaza <miguel@ximian.com>
6858 We could also solve this problem by having a separate path for
6859 performing type lookups, instead of DoResolve, we could have a
6860 ResolveType entry point, and only participating pieces of the
6861 production (simplename, deref, array) would implement this.
6863 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
6864 signal SimpleName to only resolve type names and not attempt to
6865 resolve anything else.
6867 * expression.cs (Cast): Set the flag.
6869 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
6871 * class.cs: Only report 108 if there is no `new' modifier.
6873 * cs-parser.jay: rework foreach statement to work with the new
6874 changes to the policy on SimpleNames.
6876 * report.cs: support Stacktrace on warnings as well.
6878 * makefile: drop --unsafe and /unsafe from the compile.
6880 2002-03-11 Miguel de Icaza <miguel@ximian.com>
6882 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6883 lookups here, instead of doing that at parse time. This means
6884 that our grammar will not introduce `LocalVariableReferences' as
6885 expressions at this point. That solves the problem of code like
6893 This is only half the fix. The full fix requires parameters to
6894 also be handled in this way.
6896 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
6897 makes the use more obvious of the DeclSpace. The
6898 ec.TypeContainer.TypeBuilder is now only used to pull the
6901 My theory is that I can get rid of the TypeBuilder completely from
6902 the EmitContext, and have typecasts where it is used (from
6903 DeclSpace to where it matters).
6905 The only pending problem is that the code that implements Aliases
6906 is on TypeContainer, and probably should go in DeclSpace.
6908 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6909 lookups here, instead of doing that at parse time. This means
6910 that our grammar will not introduce `LocalVariableReferences' as
6911 expressions at this point. That solves the problem of code like
6919 This is only half the fix. The full fix requires parameters to
6920 also be handled in this way.
6922 * class.cs (Property.DefineMethod): When implementing an interface
6923 method, set newslot, when implementing an abstract method, do not
6924 set the flag (before we tried never setting it, or always setting
6925 it, which is the difference).
6926 (Indexer.DefineMethod): same.
6927 (Method.DefineMethod): same.
6929 * ecore.cs: Only set the status used flag if we get back a Field.
6931 * attribute.cs: Temporary hack, so Paolo can keep working.
6933 2002-03-08 Ravi Pratap <ravi@ximian.com>
6935 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
6936 the unmanaged type in the case we have a MarshalAs attribute.
6938 (Resolve): Handle the case when we are parsing the special MarshalAs
6939 attribute [we need to store the unmanaged type to use later]
6941 * typemanager.cs (marshal_as_attr_type): Built in type for the
6942 MarshalAs Attribute.
6944 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
6945 on parameters and accordingly set the marshalling info.
6947 2002-03-09 Miguel de Icaza <miguel@ximian.com>
6949 * class.cs: Optimizing slightly by removing redundant code after
6950 we switched to the `NoTypes' return value.
6951 (Property.DefineMethod): use NoTypes here too.
6953 This fixes the bug I introduced in my last batch of changes.
6955 2002-03-05 Ravi Pratap <ravi@ximian.com>
6957 * tree.cs (RecordEnum): Add. We now keep track of enums too.
6959 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
6960 Enums since those are types too.
6962 * cs-parser.jay (enum_declaration): Record enums as we parse them.
6964 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
6965 thanks to a call during the lookup process.
6967 2002-03-07 Miguel de Icaza <miguel@ximian.com>
6969 * statement.cs (Foreach): Lots of work to accomodate a particular
6970 kind of foreach statement that I had not kept in mind. It is
6971 possible to have foreachs on classes that provide a GetEnumerator
6972 method that return objects that implement the "pattern" for using
6973 a foreach, there is no need to support GetEnumerator
6976 This is needed to compile nant.
6978 * decl.cs: Only report 114 if the member is not `Finalize' and if
6979 the warning level is at least 2.
6981 * class.cs: Moved the compare function from Method to
6984 (MethodSignature.InheritableMemberSignatureCompare): Add new
6985 filter function that is used to extract inheritable methods from a
6988 (Method.Define): Use the new `inheritable_method_signature_filter'
6991 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6994 2002-03-06 Miguel de Icaza <miguel@ximian.com>
6996 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6998 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7000 * expression.cs: Pass location information to
7001 ConvertImplicitStandard.
7003 * class.cs: Added debugging code to track return values from
7006 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7008 * expression.cs (Is.DoResolve): If either side of the `is' is an
7009 interface, do not flag the warning.
7011 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7014 * report.cs: Allow for --fatal to be used with --probe.
7016 * typemanager.cs (NoTypes): Move the definition for the empty Type
7019 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7021 (TypeContainer.DefineProxy): New function used to proxy to parent
7022 implementations when implementing interfaces.
7023 (TypeContainer.ParentImplements): used to lookup if our parent
7024 implements a public function that is required by an interface.
7025 (TypeContainer.VerifyPendingMethods): Hook this up.
7027 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7028 `modules' and `assemblies' arraylists into arrays. We only grow
7029 these are the very early start up of the program, so this improves
7030 the speedof LookupType (nicely measured).
7032 * expression.cs (MakeByteBlob): Replaced unsafe code with
7033 BitConverter, as suggested by Paolo.
7035 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7036 folding of string concatenation, but if either side is a string,
7037 and the other is not, then return null, and let the runtime use
7038 the concatenation on the string plus the object (using
7041 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7043 Constant Folding has been implemented now.
7045 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7046 the error instead on types that are not supported in one's
7049 * constant.cs (Constant and all children): New set of functions to
7050 perform implict and explicit conversions.
7052 * ecore.cs (EnumConstant): Implement the new functions to perform
7053 conversion by proxying to the child expression.
7055 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7056 own separate setting that can not be turned off from the command
7057 line using --unchecked or --checked and is only controlled using
7058 the checked/unchecked statements and expressions. This setting is
7059 used by the constant folder to flag errors.
7061 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7062 ConstantCheckState as well.
7064 During Resolve, they also have to flag the state, because the
7065 constant folder runs completely in the Resolve phase.
7067 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7070 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7072 * cfold.cs: New file, this file contains the constant folder.
7074 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7075 argument to track whether we are using the resulting address to
7076 load or store a value and provide better error messages.
7078 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7079 new AddressOf arguments.
7081 * statement.cs (Foreach.EmitCollectionForeach): Update
7083 * expression.cs (Argument.Emit): Call AddressOf with proper
7084 arguments to track usage.
7086 (New.DoEmit): Call AddressOf with new arguments.
7088 (Unary.Emit): Adjust AddressOf call.
7090 2002-03-01 Ravi Pratap <ravi@ximian.com>
7092 * cs-parser.jay (member_access): Change the case for pre-defined types
7093 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7096 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7099 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7100 essentially like methods and apply attributes like MethodImplOptions to them too.
7102 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7105 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7106 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7109 * Update code everywhere accordingly.
7111 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7113 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7115 2002-02-28 Ravi Pratap <ravi@ximian.com>
7117 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7118 try performing lookups against those instead of jumping straight into using
7119 the 'using' clauses.
7121 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7123 (LookupType): Perform lookups in implicit parents too.
7125 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7126 sequence as RootContext.LookupType.
7128 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7129 the various cases of namespace lookups into this method.
7131 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7133 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7134 in positional arguments)
7136 * class.cs (Operator): Update the AllowedModifiers to contain
7139 * cs-parser.jay: Update operator declaration to allow for the
7140 operator body to be empty.
7142 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7145 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7147 * class.cs (Method.Emit): Label parameters.
7149 * driver.cs: Return 1 or 0 as the program exit code.
7151 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7153 * expression.cs: Special case the `null' object when trying to
7154 auto-compute the type, as anything can be explicitly converted to
7157 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7158 spotting this Paolo.
7160 (Expression.ImplicitNumericConversion): Perform comparissions of
7161 the type using the underlying type in the case of an enumeration
7162 rather than using the enumeration type for the compare.
7164 Cope with the underlying == type case, which is not possible to
7167 (Expression.ConvertNumericExplicit): Perform comparissions of
7168 the type using the underlying type in the case of an enumeration
7169 rather than using the enumeration type for the compare.
7171 * driver.cs: If the user does not supply an extension, assume .exe
7173 * cs-parser.jay (if_statement): Rewrote so that we can track the
7174 location for the if statement.
7176 * expression.cs (Binary.ConstantFold): Only concat strings when
7177 the operation is "+", not everything ;-)
7179 * statement.cs (Statement.EmitBoolExpression): Take a location
7181 (If, While, Do): Track location.
7183 * expression.cs (Binary.ResolveOperator): In the object + string
7184 case, I was missing a call to ConvertImplicit
7186 2002-02-25 Ravi Pratap <ravi@ximian.com>
7188 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7189 Location arguments. Ensure we use RootContext.LookupType to do our work
7190 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7192 * interface.cs (PopulateMethod): Handle the type of the parameter being
7195 * expression.cs (Invocation.BetterFunction): Handle the case when we
7196 have a params method with no fixed arguments and a call is made with no
7199 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7201 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7202 the verbatim-string-literal
7204 * support.cs (InternalParameters.ParameterModifier): handle null
7206 (InternalParameters.ParameterType): ditto.
7208 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7209 duplicating the name of the variable parameter.
7210 (GetParameterByName): Fix bug where we were not looking up array
7211 paramters if they were the only present (thanks Paolo!).
7212 (GetParameterInfo): We only have an empty set of types if both
7213 fixed and array are set to null.
7214 (GetParameterInfo-idx): Handle FixedParameter == null
7216 * cs-parser.jay: Handle the case where there is no catch
7217 statements (missing null test).
7219 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7221 * driver.cs (MainDriver): Be conservative on our command line
7224 Catch DirectoryNotFoundException when calling GetFiles.
7226 (SplitPathAndPattern): Used to split the input specification into
7227 a path and a pattern that we can feed to Directory.GetFiles.
7229 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7231 * statement.cs (Fixed): Implement the last case of the Fixed
7232 statement (string handling).
7234 * expression.cs (StringPtr): New class used to return a char * to
7235 a string; Used by the Fixed statement.
7237 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7239 * expression.cs (Binary.ResolveOperator): Remove redundant
7240 MemberLookup pn parent type.
7241 Optimize union call, we do not need a union if the types are the same.
7242 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7245 Specialize the use of MemberLookup everywhere, instead of using
7246 the default settings.
7248 (StackAlloc): Implement stackalloc keyword.
7250 * cs-parser.jay: Add rule to parse stackalloc.
7252 * driver.cs: Handle /h, /help, /?
7254 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7255 before we supported unsafe code.
7257 * makefile: add --unsafe to the self compilation of mcs.
7259 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7261 * expression.cs (PointerArithmetic): New class that is used to
7262 perform pointer arithmetic.
7263 (Binary.Resolve): Handle pointer arithmetic
7264 Handle pointer comparission.
7265 (ArrayPtr): Utility expression class that is used to take the
7266 address of an array.
7268 (ElementAccess): Implement array access for pointers
7270 * statement.cs (Fixed): Implement fixed statement for arrays, we
7271 are missing one more case before we are done.
7273 * expression.cs (Indirection): Implement EmitAssign and set the
7274 ExprClass to Variable. This allows pointer dereferences to be
7275 treated as variables, and to have values assigned to them.
7277 * ecore.cs (Expression.StoreFromPtr): New utility function to
7278 store values dereferencing.
7280 2002-02-20 Ravi Pratap <ravi@ximian.com>
7282 * expression.cs (Binary.ResolveOperator): Ensure that we are
7283 not trying to operate on a void type - this fixes the reported
7286 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7287 the parent implementation is sealed.
7289 * ../errors/cs0239.cs : Add.
7291 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7293 * typemanager.cs (unverifiable_code_type): Corresponds to
7294 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7295 which have unsafe code in them.
7297 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7300 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7302 * cs-tokenizer.cs: Add support for @"litreal strings"
7304 Make tokenizer accept pre-processor directives
7305 on any column (remove the old C-like limitation).
7307 * rootcontext.cs (EmitCode): Emit any global attributes.
7308 (AddGlobalAttributes): Used to keep track of assembly attributes.
7310 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7312 * cs-parser.jay: Add support for global attributes.
7314 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7316 * expression.cs (Indirection): New helper class. Unary will
7317 create Indirection classes to be able to implement the
7318 IMemoryLocation interface on it.
7320 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7322 * cs-parser.jay (fixed_statement): reference the right statement.
7324 * statement.cs (Fixed.Emit): Finish implementing the fixed
7325 statement for the &x case.
7327 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7329 * class.cs (Property.Define, Method.Define): Remove newslot when
7332 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7333 wrong. NewSlot should only be used if the `new' keyword is present.
7335 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7336 locating our system dir. Sorry about this.
7338 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7340 * driver.cs (GetSystemDir): Compute correctly the location of our
7341 system assemblies. I was using the compiler directory instead of
7342 the library directory.
7344 2002-02-13 Ravi Pratap <ravi@ximian.com>
7346 * expression.cs (BetterFunction): Put back in what Miguel commented out
7347 since it is the correct fix. The problem is elsewhere ;-)
7349 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7350 parameters of the parms method are themselves compatible or not !
7352 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7353 to check that a class implements an interface before saying that an implicit
7354 conversion was allowed. Use ImplementsInterface to do the checking.
7356 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7358 * class.cs (Method.Define): Track whether we are an explicit
7359 implementation or not. And only call DefineMethodOverride if we
7360 are an explicit implementation.
7362 (Property.DefineMethod): Ditto.
7364 2002-02-11 Ravi Pratap <ravi@ximian.com>
7366 * expression.cs (BetterFunction): Catch hideous bug which was
7367 preventing us from detecting ambiguous calls due to implicit casts i.e
7370 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7372 * support.cs (Pair): Remove un-needed method. I figured why I was
7373 getting the error in cs-parser.jay, the variable in a foreach loop
7374 is readonly, and the compiler does not really treat this as a variable.
7376 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7377 instead of EQUALS in grammar.
7379 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7381 * expression.cs (Unary.DoResolve): Check whether the argument is
7384 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7386 * support.cs: Api for Pair to set a value. Despite the fact that
7387 the variables are public the MS C# compiler refuses to compile
7388 code that accesses the field if the variable is part of a foreach
7391 * statement.cs (Fixed): Begin implementation of the fixed
7394 (Block.AddVariable): Return the VariableInfo on success and null
7395 on failure instead of true/false.
7397 * cs-parser.jay (foreach): Catch errors on variables already
7398 defined (we were ignoring this value before) and properly unwind
7401 (fixed_statement): grammar for the fixed statement.
7403 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7405 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7406 pointer types to be incretemented.
7408 (SizeOf): Implement.
7410 * cs-parser.jay (pointer_member_access): Implement
7411 expr->IDENTIFIER production.
7413 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7414 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7417 (Unary): Implement indirection.
7419 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7420 use in non-unsafe context).
7422 (SimpleName.DoResolve): Check for pointers in field access on safe
7425 (Expression.LoadFromPtr): Factor the load-indirect code in this
7426 function. This was duplicated in UnboxCast and ParameterReference
7428 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7430 * expression.cs (ComposedCast): report an error if a pointer cast
7431 is used in a safe region.
7433 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7434 pointer type casts in unsafe context.
7436 * codegen.cs (EmitContext): Set up IsUnsafe.
7438 * cs-parser.jay (non_expression_type): Add productions for pointer
7441 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7442 code. We should not use force into static mode if the method is
7443 not virtual. Fixes bug in MIS
7445 * statement.cs (Do.Emit, While.Emit, For.Emit,
7446 Statement.EmitBoolExpression): Add support to Do and While to
7447 propagate infinite loop as `I do return' semantics.
7449 Improve the For case to also test for boolean constants.
7451 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7452 to the list of attributes we can add.
7454 Remove `EmitContext' argument.
7456 * class.cs (Method.Define): Apply parameter attributes.
7457 (Constructor.Define): Apply parameter attributes.
7458 (MethodCore.LabelParameters): Move here the core of labeling
7461 * support.cs (ReflectionParameters.ParameterModifier,
7462 InternalParameters.ParameterModifier): Use IsByRef on the type and
7463 only return the OUT bit for these parameters instead of in/out/ref
7466 This is because I miss-understood things. The ParameterInfo.IsIn
7467 and IsOut represent whether the parameter has the [In] and [Out]
7470 2002-01-22 Miguel de Icaza <miguel@ximian.com>
7472 * ecore.cs (FieldExpr.Emit): Release temporaries.
7474 * assign.cs (LocalTemporary.Release): new function.
7476 * codegen.cs (EmitContext.GetTemporaryStorage,
7477 EmitContext.FreeTemporaryStorage): Rework the way we deal with
7478 temporary storage. Now we can "put back" localbuilders when we
7481 2002-01-21 Miguel de Icaza <miguel@ximian.com>
7483 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7484 need to make a copy of the variable to generate verifiable code.
7486 2002-01-19 Miguel de Icaza <miguel@ximian.com>
7488 * driver.cs: Compute dynamically the system directory.
7490 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7491 Slower, but more generally useful. Used by the abstract
7492 registering implementation.
7494 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7495 the rules for the special rule on Type/instances. First check if
7496 we have the same name, and if so, try that special static path
7497 rather than the instance path.
7499 2002-01-18 Miguel de Icaza <miguel@ximian.com>
7501 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7504 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7505 Enum, ValueType, Delegate or Array for non-corlib compiles.
7507 * cs-tokenizer.cs: Catch long identifiers (645)
7509 * typemanager.cs (IndexerPropetyName): Ravi never tested this
7512 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7513 fix, we were returning too early, so we were not registering
7514 pending methods from abstract classes.
7516 Do not register pending methods if the class is abstract.
7518 * expression.cs (Conditional.DoResolve): Report circular implicit
7519 conversions when we neecd to compute it for conditional
7522 (Is.DoResolve): If the expression is always of the provided type,
7523 flag warning 183. If the expression can not ever be of the
7524 provided type flag warning 184.
7526 * class.cs: Catch 169 as well.
7528 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7531 2002-01-18 Nick Drochak <ndrochak@gol.com>
7533 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
7535 2002-01-17 Miguel de Icaza <miguel@ximian.com>
7537 * interface.cs: (PopulateMethod): Check for pointers being defined
7538 only if the unsafe context is active.
7539 (PopulateProperty): ditto.
7540 (PopulateIndexer): ditto.
7542 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7543 specified. If pointers are present, make sure that they are
7544 present in an unsafe context.
7545 (Constructor, Constructor.Define): ditto.
7546 (Field, Field.Define): ditto.
7547 (Property, Property.Define): ditto.
7548 (Event, Event.Define): ditto.
7550 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7551 hashtable if there are classes or structs defined.
7553 * expression.cs (LocalVariableReference.DoResolve): Simplify this
7554 code, as the constant resolution moved.
7556 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7557 the metadata, so we can flag error 133.
7559 * decl.cs (MemberCore.UnsafeOK): New function to test that a
7560 pointer is being declared in an unsafe context.
7562 2002-01-16 Miguel de Icaza <miguel@ximian.com>
7564 * modifiers.cs (Modifiers.Check): Require a Location argument.
7565 Report error 227 for Unsafe use.
7567 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7569 * statement.cs (For.Emit): If the test is null, then report that
7570 we do `return', as we wont reach anything afterwards.
7572 (Switch.SwitchGoverningType): Track the expression that matched
7575 * driver.cs: Allow negative numbers as an error code to flag.
7577 * cs-parser.jay: Handle 1551.
7579 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7581 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7583 * cs-parser.jay: Report 1518 (type declaration can only contain
7584 class, struct, interface, enum or delegate)
7586 (switch_label): Report 1523 (keywords `case' or `default' must
7589 (opt_switch_sections): Report 1522 (empty switch)
7591 * driver.cs: Report 1515 (response file specified multiple times)
7592 Report 1516 (Source file specified multiple times).
7594 * expression.cs (Argument.Resolve): Signal 1510
7596 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7597 access not allowed in static code)
7599 2002-01-11 Ravi Pratap <ravi@ximian.com>
7601 * typemanager.cs (IsPointerType): Utility method which we are going
7604 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7605 the object type, so we take care of that.
7607 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7609 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7610 added to non-params parameters :-)
7612 * typemanager.cs (CSharpName): Include 'void' type too.
7614 (void_ptr_type): Include in the set of core types.
7616 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
7619 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
7622 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
7623 completely forgotten about it.
7625 2002-01-10 Ravi Pratap <ravi@ximian.com>
7627 * cs-parser.jay (pointer_type): Add. This begins our implementation
7628 of parsing rules for unsafe code.
7630 (unsafe_statement): Implement.
7632 (embedded_statement): Modify to include the above.
7634 * statement.cs (Unsafe): Implement new class for unsafe blocks.
7636 * codegen.cs (EmitContext.InUnsafe): Add. This determines
7637 if the current context is an unsafe one.
7639 * cs-parser.jay (local_variable_pointer_type): Since local variable types
7640 are handled differently, we need separate rules for them.
7642 (local_variable_declaration): Update to use local_variable_pointer_type
7643 to allow variable declarations of unmanaged pointer types.
7645 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7648 * ../errors/cs0214.cs : Add.
7650 2002-01-16 Nick Drochak <ndrochak@gol.com>
7652 * makefile: remove 'response' file when cleaning.
7654 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7656 * cs-parser.jay: Report 1524.
7658 2002-01-14 Miguel de Icaza <miguel@ximian.com>
7660 * typemanager.cs (RegisterMethod): drop checking if we have
7661 registered this from here
7663 2002-01-12 Miguel de Icaza <miguel@ximian.com>
7665 * class.cs (Method.EmitDestructor): Implement calling our base
7668 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7671 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7672 this routine and will wrap the call in a try/catch block. Deal
7675 2002-01-11 Miguel de Icaza <miguel@ximian.com>
7677 * ecore.cs (Expression.MemberLookup): instead of taking a
7678 parameter `same_type' that was used to tell whether we could
7679 access private members we compute our containing type from the
7682 (FieldExpr): Added partial support for volatile fields. This does
7683 not work for volatile fields exposed from assemblies, as I can not
7684 figure out how to extract the modreq from it.
7686 Updated all the source files to use this.
7688 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7689 because it is referenced by MemberLookup very often.
7691 2002-01-09 Ravi Pratap <ravi@ximian.com>
7693 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
7694 TypeBuilder.GetCustomAttributes to retrieve what we need.
7696 Get rid of redundant default_member_attr_type as this is the same as
7697 default_member_type which already exists.
7699 * interface.cs, attribute.cs : Update accordingly.
7701 2002-01-08 Miguel de Icaza <miguel@ximian.com>
7703 * typemanager.cs: Enable IndexerPropertyName again. It does not
7704 work for TYpeBuilders though. Ravi, can you please fix this?
7706 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
7708 * expression.cs (Argument.Emit): Handle the case of ref objects
7709 being passed to ref functions;
7711 (ParameterReference.EmitLoad): Loads the content of the pointer
7712 without dereferencing.
7714 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7716 * cs-tokenizer.cs: Implemented the pre-processing expressions.
7718 2002-01-08 Ravi Pratap <ravi@ximian.com>
7720 * class.cs (Indexer.DefineMethod): Incorporate the interface
7721 type in the name of the method if we are doing explicit interface
7724 * expression.cs (ConversionExists): Remove as it is completely obsolete.
7726 (BetterConversion): Fix extremely trivial bug where we were referring to
7727 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
7730 * ../errors/bug16.cs : Add although we have fixed it.
7732 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7734 * expression.cs (BaseIndexer): Begin implementation.
7736 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
7738 * cs-parser.jay (indexer_declarator): Use qualified_identifier
7739 production directly to remove a shift/reduce, and implement
7740 explicit interface implementation.
7742 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
7743 after a floating point suffix.
7745 * expression.cs (DoNumericPromotions): Improved the conversion for
7746 uint/uint. If we have a constant, we avoid doing a typecast to a
7749 * class.cs (Indexer): Implement explicit interface implementation
7752 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
7754 * class.cs: make the default instance constructor public and hidebysig.
7756 2001-01-03 Ravi Pratap <ravi@ximian.com>
7758 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
7759 so we can call it from elsewhere.
7761 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
7762 we emit it internally if the class has a defined indexer; otherwise the user
7763 emits it by decorating the class definition with the DefaultMemberAttribute.
7765 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
7766 attribute is not used on a type which defines an indexer.
7768 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
7769 character when we skip whitespace.
7771 * ../errors/cs0646.cs : Add.
7773 2002-01-03 Miguel de Icaza <miguel@ximian.com>
7775 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7778 * makefile: Add practical target `mcs3.exe' which builds the third
7779 generation compiler.
7781 * expression.cs (New): Fix structures constructor calling.
7783 * class.cs (Property, Method, Indexer): Emit Final flag on the
7784 method if we are an interface implementation and we are not
7787 * ecore.cs (PropertyExpr): New public field `IsBase', tells
7788 whether this property is referencing a `base' method.
7790 * expression.cs (Invocation.EmitCall): take an extra argument:
7791 is_base, this is used to determine whether the `call' or
7792 `callvirt' opcode should be used.
7795 * delegate.cs: update EmitCall.
7797 * class.cs (Method.Define): Set NewSlot for the cases where we are
7798 not implementing an interface method.
7800 (Property.Define): ditto.
7802 2002-01-02 Miguel de Icaza <miguel@ximian.com>
7804 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7805 'r'. Allows mcs to parse itself fully.
7807 2002-01-02 Ravi Pratap <ravi@ximian.com>
7809 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
7810 of the number of initializers that require the InitializeArray method.
7812 (CheckIndices): Store the Expression in all cases - not the plain value. Also
7813 update the above field where necessary.
7815 (MakeByteBlob): Update accordingly.
7817 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
7820 (EmitDynamicInitializers): Update in accordance with the new optimization.
7822 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
7823 same OpCode applies.
7825 * cs-parser.jay : Fix some glaring errors I introduced.
7827 2002-01-01 Ravi Pratap <ravi@ximian.com>
7829 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
7830 so that we can check for name clashes there too.
7832 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
7833 for interface indexers.
7835 * interfaces.cs (Define): Emit the default member attribute.
7837 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
7838 variable was being referred to while setting the value ;-)
7840 2002-01-01 Miguel de Icaza <miguel@ximian.com>
7842 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
7843 byte-by-byte information when we know the data is zero.
7845 Make the block always a multiple of 4, because
7846 DefineInitializedData has a bug.
7848 * assign.cs: Fix, we should assign from the temporary, not from
7851 * expression.cs (MakeByteBlob): Fix my incorrect code.
7853 2001-12-31 Miguel de Icaza <miguel@ximian.com>
7855 * typemanager.cs (EnumToUnderlying): This function is used to get
7856 the underlying type from an enumeration, because it does not
7859 * constant.cs: Use the I4_S form for values between -128 and 127.
7861 * statement.cs (Block.LookupLabel): Looks up a label.
7862 (Block): Drop support for labeled blocks.
7864 (LabeledStatement): New kind of statement that represents a label
7867 (Goto): Finally implement this bad boy.
7869 * cs-parser.jay: Update to reflect new mechanism to implement
7872 2001-12-30 Miguel de Icaza <miguel@ximian.com>
7874 * codegen.cs (EmitContext.This): a codegen property that keeps the
7875 a single instance of this instead of creating many different this
7878 * delegate.cs (Delegate.DoResolve): Update to use the property;
7880 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
7882 * expression.cs (BaseAccess.DoResolve): Ditto.
7884 2001-12-29 Ravi Pratap <ravi@ximian.com>
7886 * typemanager.cs (methodimpl_attr_type): Add to hold the type
7887 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
7889 (InitCoreTypes): Update accordingly.
7891 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
7892 so we can quickly store the state.
7894 (ApplyAttributes): Set the correct implementation flags
7895 for InternalCall methods.
7897 2001-12-29 Miguel de Icaza <miguel@ximian.com>
7899 * expression.cs (EmitCall): if a method is not virtual, then do
7900 not use callvirt on it.
7902 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
7903 user defined stuff) requires the use of stobj, which takes an
7904 address on the stack instead of an array and an index. So emit
7905 the Ldelema operation for it.
7907 (EmitStoreOpcode): Use stobj for valuetypes.
7909 (UnaryMutator.EmitCode): Use the right 1 value depending on
7910 whether we are dealing with int64/uint64, float or doubles.
7912 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
7913 constructors that I implemented last night.
7915 (Constructor.IsDefault): Fix to work properly for static
7918 * cs-parser.jay (CheckDef): report method signature errors.
7919 Update error number 103 to be 132.
7921 * decl.cs: New AdditionResult enumeration value: MethodExists.
7922 Although we do this check for methods later on in the semantic
7923 analysis, catching repeated default constructors is so easy that
7924 we catch these here.
7926 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
7929 (ParameterReference.EmitAssign, Emit): handle
7932 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
7933 (ArrayAccess.EmitStoreOpcode): ditto.
7935 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
7937 * expression.cs (MakeByteBlob): Complete all the missing types
7938 (uint, short, ushort, byte, sbyte)
7940 * class.cs: Only init instance field initializers on instance
7943 Rename `constructors' to instance_constructors.
7945 (TypeContainer.AddConstructor): Only add constructors to the list
7946 if it is not static.
7948 Make sure that we handle default_static_constructor independently
7949 everywhere where we handle instance_constructors
7951 2001-12-28 Miguel de Icaza <miguel@ximian.com>
7953 * class.cs: Do not lookup or create a base initializer for a
7956 (ConstructorInitializer.Resolve): use the proper type to lookup
7959 * cs-parser.jay: Report error 1585 (modifiers between type and name).
7961 * enum.cs, interface.cs: Remove CloseType, this is taken care by
7964 * decl.cs: CloseType is now an virtual method, the default
7965 implementation just closes this type.
7967 2001-12-28 Ravi Pratap <ravi@ximian.com>
7969 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
7970 to PreserveSig by default. Also emit HideBySig on such methods.
7972 Basically, set the defaults to standard values.
7974 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7975 argument, if candidate is better, it can't be worse than the best !
7977 (Invocation): Re-write bits to differentiate between methods being
7978 applicable in their expanded form and their normal form - for params
7981 Get rid of use_standard everywhere as only standard conversions are allowed
7982 in overload resolution.
7984 More spec conformance.
7986 2001-12-27 Miguel de Icaza <miguel@ximian.com>
7988 * driver.cs: Add --timestamp, to see where the compiler spends
7991 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7992 `this' in static code.
7994 (SimpleName.DoResolve): Implement in terms of a helper function
7995 that allows static-references to be passed upstream to
7998 (Expression.ResolveWithSimpleName): Resolve specially simple
7999 names when called by MemberAccess to implement the special
8002 (Expression.ImplicitReferenceConversion): Handle conversions from
8003 Null to reference types before others, as Null's type is
8006 * expression.cs (Invocation.EmitCall): Handle the special case of
8007 calling methods declared on a reference type from a ValueType
8008 (Base classes System.Object and System.Enum)
8010 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8011 the left hand side is a TypeExpr, not on every enumeration.
8013 (Binary.Resolve): If types are reference types, then do a cast to
8014 object on operators != and == of both arguments.
8016 * typemanager.cs (FindMembers): Extract instance and static
8017 members if requested.
8019 * interface.cs (PopulateProperty): Use void_type instead of null
8020 as the return type for the setter method.
8022 (PopulateIndexer): ditto.
8024 2001-12-27 Ravi Pratap <ravi@ximian.com>
8026 * support.cs (ReflectionParameters): Fix minor bug where we
8027 were examining the wrong parameter for the ParamArray attribute.
8029 Cope with requests for the type of the parameter at position
8030 greater than the params parameter's. We now return the element
8031 type of the params array as that makes more sense.
8033 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8034 accordingly as we no longer have to extract the element type
8037 (Invocation.OverloadResolve): Update.
8039 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8041 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8042 against IEnumerator, test whether the return value is a descendant
8043 of the IEnumerator interface.
8045 * class.cs (Indexer.Define): Use an auxiliary method to implement
8046 the other bits of the method definition. Begin support for
8047 explicit interface implementation.
8049 (Property.DefineMethod): Use TypeManager.void_type instead of null
8050 for an empty return value.
8052 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8054 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8055 dealing with a FieldExpr which is composed of a FieldBuilder, in
8056 the code path we did extract the constant, but we should have
8057 obtained the underlying value to be able to cast it (otherwise we
8058 end up in an infinite loop, this is what Ravi was running into).
8060 (ArrayCreation.UpdateIndices): Arrays might be empty.
8062 (MemberAccess.ResolveMemberAccess): Add support for section
8063 14.5.4.1 that deals with the special case of E.I when E is a type
8064 and something else, that I can be a reference to a static member.
8066 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8067 handle a particular array type to create byte blobs, it is just
8068 something we dont generate byteblobs for.
8070 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8073 * location.cs (Push): remove the key from the hashtable that we
8074 are about to add. This happens for empty files.
8076 * driver.cs: Dispose files after we have parsed them.
8078 (tokenize): new function that only runs the tokenizer on its
8079 input, for speed testing.
8081 2001-12-26 Ravi Pratap <ravi@ximian.com>
8083 * class.cs (Event.Define): Define the private field only if there
8084 are no accessors defined.
8086 * expression.cs (ResolveMemberAccess): If there is no associated
8087 field with the event, that means we have an event defined with its
8088 own accessors and we should flag error cs0070 since transforming
8089 ourselves into a field is not valid in that case.
8091 * ecore.cs (SimpleName.DoResolve): Same as above.
8093 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8094 and charset to sane values.
8096 2001-12-25 Ravi Pratap <ravi@ximian.com>
8098 * assign.cs (DoResolve): Perform check on events only if they
8099 are being accessed outside the declaring type.
8101 * cs-parser.jay (event_declarations): Update rules to correctly
8102 set the type of the implicit parameter etc.
8104 (add_accessor, remove_accessor): Set current local parameters.
8106 * expression.cs (Binary): For delegate addition and subtraction,
8107 cast the return value from the method into the appropriate delegate
8110 2001-12-24 Ravi Pratap <ravi@ximian.com>
8112 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8113 of these as the workaround is unnecessary.
8115 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8116 delegate data - none of that is needed at all.
8118 Re-write bits to extract the instance expression and the delegate method
8121 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8124 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8125 of attaching attributes instead of duplicating code everywhere.
8127 * everywhere : Update code to do attribute emission using the above method.
8129 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8131 * expression.cs (IsParamsMethodApplicable): if there are not
8132 parameters, return immediately.
8134 * ecore.cs: The 0 literal can be implicity converted to an enum
8137 (SimpleName.DoResolve): First lookup the type, then lookup the
8140 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8141 want to get its address. If the InstanceExpression is not
8142 addressable, store the result in a temporary variable, then get
8145 * codegen.cs: Only display 219 errors on warning level or above.
8147 * expression.cs (ArrayAccess): Make it implement the
8148 IMemoryLocation interface.
8150 (Binary.DoResolve): handle the operator == (object a, object b)
8151 and operator != (object a, object b) without incurring into a
8152 BoxedCast (because 5 != o should never be performed).
8154 Handle binary enumerator operators.
8156 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8157 value type, otherwise use Ldelem_ref.
8159 Use precomputed names;
8161 (AddressOf): Implement address of
8163 * cs-parser.jay (labeled_statement): Fix recursive block
8164 addition by reworking the production.
8166 * expression.cs (New.DoEmit): New has a special case:
8168 If we are dealing with a ValueType, we have a few
8169 situations to deal with:
8171 * The target of New is a ValueType variable, that is
8172 easy, we just pass this as the variable reference
8174 * The target of New is being passed as an argument,
8175 to a boxing operation or a function that takes a
8178 In this case, we need to create a temporary variable
8179 that is the argument of New.
8182 2001-12-23 Ravi Pratap <ravi@ximian.com>
8184 * rootcontext.cs (LookupType): Check that current_type is not null before
8185 going about looking at nested types.
8187 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8188 not implement the IAssignMethod interface any more.
8190 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8191 where we tranform them into FieldExprs if they are being resolved from within
8194 * ecore.cs (SimpleName.DoResolve): Do the same here.
8196 * assign.cs (DoResolve, Emit): Clean up code considerably.
8198 * ../errors/bug10.cs : Add.
8200 * ../errors/cs0070.cs : Add.
8202 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8204 * assign.cs : Get rid of EventIsLocal everywhere.
8206 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8208 * ecore.cs (ConvertIntLiteral): finished the implementation.
8210 * statement.cs (SwitchLabel): Convert the value we are using as a
8211 key before looking up the table.
8213 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8215 * codegen.cs (EmitTopBlock): Require a Location argument now.
8217 * cs-parser.jay (constructor_declarator): We need to setup
8218 current_local_parameters before we parse the
8219 opt_constructor_initializer, to allow the variables to be bound
8220 to the constructor arguments.
8222 * rootcontext.cs (LookupType): First lookup nested classes in our
8223 class and our parents before we go looking outside our class.
8225 * expression.cs (ConstantFold): Extract/debox the values at the
8228 * rootcontext.cs (EmitCode): Resolve the constants first before we
8229 resolve the types. This is not really needed, but it helps debugging.
8231 * statement.cs: report location.
8233 * cs-parser.jay: pass location to throw statement.
8235 * driver.cs: Small bug fix.
8237 * report.cs: Updated format to be 4-zero filled digits.
8239 2001-12-22 Ravi Pratap <ravi@ximian.com>
8241 * expression.cs (CheckIndices): Fix minor bug where the wrong
8242 variable was being referred to ;-)
8244 (DoEmit): Do not call EmitStaticInitializers when the
8245 underlying type is System.Object.
8247 2001-12-21 Ravi Pratap <ravi@ximian.com>
8249 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8250 and do the usual workaround for SRE.
8252 * class.cs (MyEventBuilder.EventType): New member to get at the type
8253 of the event, quickly.
8255 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8257 * assign.cs (Assign.DoResolve): Handle the case when the target
8258 is an EventExpr and perform the necessary checks.
8260 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8263 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8265 (EventExpr): Set the type in the constructor itself since we
8266 are meant to be born fully resolved.
8268 (EventExpr.Define): Revert code I wrote earlier.
8270 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8271 instance expression is null. The instance expression is a This in that case
8272 or a null, depending on whether it is a static method or not.
8274 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8275 refers to more than one method.
8277 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8278 and accordingly flag errors.
8280 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8282 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8284 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8286 * location.cs (ToString): Provide useful rutine.
8288 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8290 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8291 objects, return the actual integral boxed.
8293 * statement.cs (SwitchLabel): define an ILLabel for each
8296 (Switch.CheckSwitch): If the value is a Literal, extract
8297 the underlying literal.
8299 Also in the unused hashtable we had, add the SwitchLabel so we can
8300 quickly look this value up.
8302 * constant.cs: Implement a bunch of new constants. Rewrite
8303 Literal based on this. Made changes everywhere to adapt to this.
8305 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8306 dereferencing array only once, and also copes with enumrations.
8308 bytes are two bytes wide, not one.
8310 (Cast): Perform constant conversions.
8312 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8313 wrappers to the literals here.
8315 * expression.cs (DoNumericPromotions): long literals can converted
8316 to ulong implicity (this is taken care of elsewhere, but I was
8319 * ecore.cs (Expression.Literalize): Make the return type Literal,
8320 to improve type checking.
8322 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8324 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8326 * literal.cs: Revert code from ravi that checked the bounds. The
8327 bounds are sane by the definition of the type itself.
8329 * typemanager.cs: Fix implementation of ImplementsInterface. We
8330 need to actually look up in our parent hierarchy for interfaces
8333 * const.cs: Use the underlying type for enumerations
8335 * delegate.cs: Compute the basename for the delegate creation,
8336 that should fix the delegate test case, and restore the correct
8337 Type Lookup semantics in rootcontext
8339 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8340 referencing a nested type with the Reflection API is using the "+"
8343 * cs-parser.jay: Do not require EOF token at the end.
8345 2001-12-20 Ravi Pratap <ravi@ximian.com>
8347 * rootcontext.cs (LookupType): Concatenate type names with
8348 a '.' instead of a '+' The test suite passes again.
8350 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8351 field of the enumeration.
8353 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8354 the case when the member is an EventExpr.
8356 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8357 static has an associated instance expression.
8359 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8361 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8363 * class.cs (Event.Define): Register event and perform appropriate checks
8366 We define the Add and Remove methods even if the use provides none because
8367 in that case, we provide default implementations ourselves.
8369 Define a private field of the type of the event. This is done by the CSC compiler
8370 and we should be doing it too ;-)
8372 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8373 More methods we use in code we generate.
8375 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8378 (InitCoreTypes): Update accordingly for the above.
8380 * class.cs (Event.Emit): Generate code for default accessors that we provide
8382 (EmitDefaultMethod): Do the job in the above.
8384 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8387 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8389 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8390 builders even if we were missing one.
8392 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8393 pass the Basename as our class name instead of the Name. The
8394 basename will be correctly composed for us.
8396 * parameter.cs (Paramters): Now takes a Location argument.
8398 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8399 make all the code call directly LookupType in RootContext and take
8400 this chance to pass the Location information everywhere.
8402 * Everywhere: pass Location information.
8404 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8406 * class.cs (Constructor.Define): Updated way of detecting the
8407 length of the parameters.
8409 (TypeContainer.DefineType): Use basename as the type name for
8412 (TypeContainer.Define): Do not recursively define types here, as
8413 definition is taken care in order by the RootContext.
8415 * tree.cs: Keep track of namespaces in a per-file basis.
8417 * parameter.cs (Parameter.ComputeSignature): Update to use
8420 (Parameters.GetSignature): ditto.
8422 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8423 instead of a TypeContainer.
8425 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8426 resolve names. Because we need to be resolve in our context, not
8429 * driver.cs: Implement response files.
8431 * class.cs (TypeContainer.DefineType): If we are defined, do not
8434 (Event.Emit): Emit the code for add/remove handlers.
8435 (Event.Define): Save the MethodBuilders for add/remove.
8437 * typemanager.cs: Use pair here too.
8439 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8440 DictionaryEntry requires the first argument to be non-null.
8442 (enum_declaration): Compute full name for registering the
8445 (delegate_declaration): Instead of using
8446 formal_parameter_list, use opt_formal_parameter_list as the list
8449 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8450 (EventParsing): New property that controls whether `add' and
8451 `remove' are returned as tokens or identifiers (for events);
8453 2001-12-19 Ravi Pratap <ravi@ximian.com>
8455 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8456 use MyEventBuilder only and let it wrap the real builder for us.
8458 (MyEventBuilder): Revamp constructor etc.
8460 Implement all operations that we perform on EventBuilder in precisely the same
8463 (FindMembers): Update to use the EventBuilder member.
8465 (Event.Emit): Update accordingly.
8467 2001-12-18 Ravi Pratap <ravi@ximian.com>
8469 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8470 by calling the appropriate methods.
8472 (GetCustomAttributes): Make stubs as they cannot possibly do anything
8475 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8477 2001-12-17 Ravi Pratap <ravi@ximian.com>
8479 * delegate.cs (Delegate.Populate): Check that the return type
8480 and various parameters types are indeed accessible.
8482 * class.cs (Constructor.Define): Same here.
8484 (Field.Define): Ditto.
8486 (Event.Define): Ditto.
8488 (Operator.Define): Check that the underlying Method defined itself
8489 correctly - so it's MethodBuilder should not be null.
8491 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8492 expression happens to be null.
8494 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8495 members but as of now we don't seem to be able to do anything really useful with it.
8497 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8498 not the EventBuilder.
8500 2001-12-18 Miguel de Icaza <miguel@ximian.com>
8502 * cs-tokenizer.cs: Add support for defines.
8503 Add support for #if, #elif, #else, #endif
8505 (eval_var): evaluates a variable.
8506 (eval): stubbed for evaluating functions.
8508 * cs-parser.jay: Pass the defines information
8510 * driver.cs: Add --define command line option.
8512 * decl.cs: Move MemberCore here.
8514 Make it the base class for DeclSpace. This allows us to catch and
8515 report 108 and 109 for everything now.
8517 * class.cs (TypeContainer.Define): Extract all the members
8518 before populating and emit the warning 108 (new keyword required
8519 to override) instead of having each member implement this.
8521 (MemberCore.Define): New abstract method, we will be using this in
8522 the warning reporting engine in Populate.
8524 (Operator.Define): Adjust to new MemberCore protocol.
8526 * const.cs (Const): This does not derive from Expression, it is a
8527 temporary object we use to create fields, it is a MemberCore.
8529 * class.cs (Method.Define): Allow the entry point to be in a
8532 * driver.cs: Rewrite the argument handler to clean it up a bit.
8534 * rootcontext.cs: Made it just an auxiliary namespace feature by
8535 making everything static.
8537 * driver.cs: Adapt code to use RootContext type name instead of
8540 * delegate.cs: Remove RootContext argument.
8542 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8545 * class.cs (Event.Define): The lookup can fail.
8547 * cs-tokenizer.cs: Begin implementation of pre-procesor.
8549 * expression.cs: Resolve the this instance before invoking the code.
8551 2001-12-17 Miguel de Icaza <miguel@ximian.com>
8553 * cs-parser.jay: Add a production in element_access that allows
8554 the thing to become a "type" reference. This way we can parse
8555 things like "(string [])" as a type.
8557 Note that this still does not handle the more complex rules of
8561 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
8563 * ecore.cs: (CopyNewMethods): new utility function used to
8564 assemble the list of methods from running FindMembers.
8566 (MemberLookup): Rework FindMembers so that
8568 2001-12-16 Miguel de Icaza <miguel@ximian.com>
8570 * class.cs (TypeContainer): Remove Delegates who fail to be
8573 * delegate.cs (Populate): Verify that we dont get null return
8574 values. TODO: Check for AsAccessible.
8576 * cs-parser.jay: Use basename to emit error 574 (destructor should
8577 have the same name as container class), not the full name.
8579 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8580 possible representation.
8582 Also implements integer type suffixes U and L.
8584 2001-12-15 Miguel de Icaza <miguel@ximian.com>
8586 * expression.cs (ArrayCreation.DoResolve): We need to do the
8587 argument resolution *always*.
8589 * decl.cs: Make this hold the namespace. Hold the root context as
8591 (LookupType): Move here.
8593 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8595 * location.cs (Row, Name): Fixed the code, it was always returning
8596 references to the first file.
8598 * interface.cs: Register properties defined through interfaces.
8600 * driver.cs: Add support for globbing on the command line
8602 * class.cs (Field): Make it derive from MemberCore as well.
8605 2001-12-15 Ravi Pratap <ravi@ximian.com>
8607 * class.cs (Event::Define): Check that the type of the event is a delegate
8608 type else flag error #66.
8610 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8613 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8614 values of EntryPoint, CharSet etc etc.
8616 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8618 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8619 be null and we should ignore this. I am not sure if this is really clean. Apparently,
8620 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8621 which needs this to do its work.
8623 * ../errors/cs0066.cs : Add.
8625 2001-12-14 Miguel de Icaza <miguel@ximian.com>
8627 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8630 * class.cs: (MethodSignature.MethodSignature): Removed hack that
8631 clears out the parameters field.
8632 (MemberSignatureCompare): Cleanup
8634 (MemberCore): New base class used to share code between MethodCore
8637 (RegisterRequiredImplementations) BindingFlags.Public requires
8638 either BindingFlags.Instace or Static. Use instance here.
8640 (Property): Refactored code to cope better with the full spec.
8642 * parameter.cs (GetParameterInfo): Return an empty array instead
8645 * class.cs (Property): Abstract or extern properties have no bodies.
8647 * parameter.cs (GetParameterInfo): return a zero-sized array.
8649 * class.cs (TypeContainer.MethodModifiersValid): Move all the
8650 method modifier validation to the typecontainer so we can reuse
8653 (MethodCore.ParameterTypes): return an empty sized array of types.
8655 (Property.Define): Test property modifier validity.
8657 Add tests for sealed/override too.
8659 (Method.Emit): abstract or extern methods have no bodies.
8661 2001-12-14 Ravi Pratap <ravi@ximian.com>
8663 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8666 (Method::Define, ::Emit): Modify accordingly.
8668 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8670 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8672 * makefile: Pass in /unsafe.
8674 2001-12-13 Miguel de Icaza <miguel@ximian.com>
8676 * class.cs (MakeKey): Kill routine.
8678 * class.cs (TypeContainer.Define): Correctly define explicit
8679 method implementations (they require the full interface name plus
8682 * typemanager.cs: Deply the PtrHashtable here and stop using the
8683 lame keys. Things work so much better.
8685 This of course broke everyone who depended on `RegisterMethod' to
8686 do the `test for existance' test. This has to be done elsewhere.
8688 * support.cs (PtrHashtable): A hashtable that avoid comparing with
8689 the object stupid Equals method (because, that like fails all over
8690 the place). We still do not use it.
8692 * class.cs (TypeContainer.SetRequiredInterface,
8693 TypeContainer.RequireMethods): Killed these two routines and moved
8694 all the functionality to RegisterRequiredImplementations.
8696 (TypeContainer.RegisterRequiredImplementations): This routine now
8697 registers all the implementations required in an array for the
8698 interfaces and abstract methods. We use an array of structures
8699 which can be computed ahead of time to reduce memory usage and we
8700 also assume that lookups are cheap as most classes will not
8701 implement too many interfaces.
8703 We also avoid creating too many MethodSignatures.
8705 (TypeContainer.IsInterfaceMethod): Update and optionally does not
8706 clear the "pending" bit if we find that there are problems with
8709 (TypeContainer.VerifyPendingMethods): Update to report errors of
8710 methods that look like implementations but are not.
8712 (TypeContainer.Define): Add support for explicit interface method
8715 2001-12-12 Miguel de Icaza <miguel@ximian.com>
8717 * typemanager.cs: Keep track of the parameters here instead of
8718 being a feature of the TypeContainer.
8720 * class.cs: Drop the registration of parameters here, as
8721 InterfaceMethods are also interface declarations.
8723 * delegate.cs: Register methods with the TypeManager not only with
8724 the TypeContainer. This code was buggy.
8726 * interface.cs: Full registation here.
8728 2001-12-11 Miguel de Icaza <miguel@ximian.com>
8730 * expression.cs: Remove reducer for binary expressions, it can not
8733 * const.cs: Put here the code that used to go into constant.cs
8735 * constant.cs: Put here the code for constants, this is a new base
8738 * literal.cs: Make Literal derive from Constant.
8740 2001-12-09 Miguel de Icaza <miguel@ximian.com>
8742 * statement.cs (Return.Emit): Report error 157 if the user
8743 attempts to return from a finally block.
8745 (Return.Emit): Instead of emitting a return, jump to the end of
8748 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
8749 LocalBuilder to store the result of the function. ReturnLabel is
8750 the target where we jump.
8753 2001-12-09 Radek Doulik <rodo@ximian.com>
8755 * cs-parser.jay: remember alias in current namespace
8757 * ecore.cs (SimpleName::DoResolve): use aliases for types or
8760 * class.cs (LookupAlias): lookup alias in my_namespace
8762 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
8764 (LookupAlias): lookup alias in this and if needed in parent
8767 2001-12-08 Miguel de Icaza <miguel@ximian.com>
8771 * rootcontext.cs: (ModuleBuilder) Made static, first step into
8772 making things static. I need this to avoid passing the
8773 TypeContainer when calling ParameterType.
8775 * support.cs (InternalParameters.ParameterType): Remove ugly hack
8776 that did string manipulation to compute the type and then call
8777 GetType. Use Parameter.ParameterType instead.
8779 * cs-tokenizer.cs: Consume the suffix for floating values.
8781 * expression.cs (ParameterReference): figure out whether this is a
8782 reference parameter or not. Kill an extra variable by computing
8783 the arg_idx during emission.
8785 * parameter.cs (Parameters.GetParameterInfo): New overloaded
8786 function that returns whether a parameter is an out/ref value or not.
8788 (Parameter.ParameterType): The type of the parameter (base,
8789 without ref/out applied).
8791 (Parameter.Resolve): Perform resolution here.
8792 (Parameter.ExternalType): The full type (with ref/out applied).
8794 * statement.cs (Using.Emit, Using.EmitExpression): Implement
8795 support for expressions on the using statement.
8797 2001-12-07 Miguel de Icaza <miguel@ximian.com>
8799 * statement.cs (Using.EmitLocalVariableDecls): Split the
8800 localvariable handling of the using statement.
8802 (Block.EmitMeta): Keep track of variable count across blocks. We
8803 were reusing slots on separate branches of blocks.
8805 (Try.Emit): Emit the general code block, we were not emitting it.
8807 Check the type of the declaration to be an IDisposable or
8808 something that can be implicity converted to it.
8810 Emit conversions if required.
8812 * ecore.cs (EmptyExpression): New utility class.
8813 (Expression.ImplicitConversionExists): New utility function.
8815 2001-12-06 Miguel de Icaza <miguel@ximian.com>
8817 * statement.cs (Using): Implement.
8819 * expression.cs (LocalVariableReference): Support read only variables.
8821 * statement.cs: Remove the explicit emit for the Leave opcode.
8822 (VariableInfo): Add a readonly field.
8824 2001-12-05 Miguel de Icaza <miguel@ximian.com>
8826 * ecore.cs (ConvCast): new class used to encapsulate the various
8827 explicit integer conversions that works in both checked and
8830 (Expression.ConvertNumericExplicit): Use new ConvCast class to
8831 properly generate the overflow opcodes.
8833 2001-12-04 Miguel de Icaza <miguel@ximian.com>
8835 * statement.cs: The correct type for the EmptyExpression is the
8836 element_type, not the variable type. Ravi pointed this out.
8838 2001-12-04 Ravi Pratap <ravi@ximian.com>
8840 * class.cs (Method::Define): Handle PInvoke methods specially
8841 by using DefinePInvokeMethod instead of the usual one.
8843 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
8844 above to do the task of extracting information and defining the method.
8846 2001-12-04 Ravi Pratap <ravi@ximian.com>
8848 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
8849 of the condition for string type.
8851 (Emit): Move that here.
8853 (ArrayCreation::CheckIndices): Keep string literals in their expression
8856 (EmitDynamicInitializers): Handle strings appropriately.
8858 2001-12-04 Miguel de Icaza <miguel@ximian.com>
8860 * codegen.cs (EmitContext): Replace multiple variables with a
8861 single pointer to the current Switch statement.
8863 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
8866 2001-12-03 Miguel de Icaza <miguel@ximian.com>
8870 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
8873 (Foreach.Emit): Foreach on arrays was not setting
8874 up the loop variables (for break/continue).
8876 (GotoCase): Semi-implented.
8878 2001-12-03 Ravi Pratap <ravi@ximian.com>
8880 * attribute.cs (CheckAttribute): Handle system attributes by using
8881 Attribute.GetAttributes to examine information we need.
8883 (GetValidPlaces): Same here.
8885 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
8887 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
8889 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
8891 (Method::Define): Set appropriate flags if we have a DllImport attribute.
8893 (Method::Emit): Handle the case when we are a PInvoke method.
8895 2001-12-03 Miguel de Icaza <miguel@ximian.com>
8897 * expression.cs: Use ResolveWithSimpleName on compound names.
8899 2001-12-02 Ravi Pratap <ravi@ximian.com>
8901 * constant.cs (EmitConstant): Make sure we resolve the associated expression
8902 before trying to reduce it.
8904 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
8906 * constant.cs (LookupConstantValue): Implement.
8908 (EmitConstant): Use the above in emitting the constant.
8910 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
8911 that are user-defined by doing a LookupConstantValue on them.
8913 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
8916 2001-11-29 Miguel de Icaza <miguel@ximian.com>
8918 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
8920 (BaseAccess.DoResolve): Implement.
8922 (MemberAccess.DoResolve): Split this routine into a
8923 ResolveMemberAccess routine that can be used independently
8925 2001-11-28 Miguel de Icaza <miguel@ximian.com>
8927 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
8928 As that share bits of the implementation. Is returns a boolean,
8929 while As returns the Type that is being probed.
8931 2001-12-01 Ravi Pratap <ravi@ximian.com>
8933 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
8934 instead of a Literal - much easier.
8936 (EnumInTransit): Remove - utterly useless :-)
8938 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
8940 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
8942 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
8943 chain when we have no associated expression.
8945 2001-11-30 Ravi Pratap <ravi@ximian.com>
8947 * constant.cs (Define): Use Location while reporting the errror.
8949 Also emit a warning when 'new' is used and there is no inherited
8952 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
8955 (LookupEnumValue): Implement to lookup an enum member's value and define it
8958 (Populate): Re-write accordingly to use the above routine.
8960 2001-11-27 Miguel de Icaza <miguel@ximian.com>
8962 * expression.cs (This): Fix prototype for DoResolveLValue to
8963 override the base class DoResolveLValue.
8965 * cs-parser.cs: Report errors cs574 and cs575 (destructor
8968 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
8969 (we need to load the address of the field here). This fixes
8972 (FieldExpr.DoResolveLValue): Call the DoResolve
8973 function to initialize the Instance expression.
8975 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8976 correctly the GetEnumerator operation on a value type.
8978 * cs-parser.jay: Add more simple parsing error catches.
8980 * statement.cs (Switch): Add support for string switches.
8981 Handle null specially.
8983 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
8985 2001-11-28 Ravi Pratap <ravi@ximian.com>
8987 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8989 (declare_local_constant): New helper function.
8991 * statement.cs (AddConstant): Keep a separate record of constants
8993 (IsConstant): Implement to determine if a variable is a constant.
8995 (GetConstantExpression): Implement.
8997 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8999 * statement.cs (IsVariableDefined): Re-write.
9001 2001-11-27 Ravi Pratap <ravi@ximian.com>
9003 * class.cs (TypeContainer::FindMembers): Look for constants
9004 in the case when we are looking for MemberTypes.Field
9006 * expression.cs (MemberAccess::DoResolve): Check that in the
9007 case we are a FieldExpr and a Literal, we are not being accessed
9008 by an instance reference.
9010 * cs-parser.jay (local_constant_declaration): Implement.
9012 (declaration_statement): Implement for constant declarations.
9014 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9016 * statement.cs (Switch): Catch double defaults.
9018 (Switch): More work on the switch() statement
9019 implementation. It works for integral values now, need to finish
9023 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9025 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9026 integer literals into other integer literals. To be used by
9029 2001-11-24 Ravi Pratap <ravi@ximian.com>
9031 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9034 (EmitDynamicInitializers): Cope with the above since we extract data
9035 directly from ArrayData now.
9037 (ExpectInitializers): Keep track of whether initializers are mandatory
9040 (Bounds): Make it a hashtable to prevent the same dimension being
9041 recorded for every element in that dimension.
9043 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9046 Also fix bug which was causing the indices to be emitted in the reverse
9049 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9051 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9052 unfinished. They do not work, because the underlying code is
9055 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9057 * cs-parser.jay: Remove bogus fixme.
9059 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9060 on Switch statement.
9062 2001-11-23 Ravi Pratap <ravi@ximian.com>
9064 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9067 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9068 parameter. Apparently, any expression is allowed.
9070 (ValidateInitializers): Update accordingly.
9072 (CheckIndices): Fix some tricky bugs thanks to recursion.
9074 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9075 I was being completely brain-dead.
9077 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9078 and re-write acordingly.
9080 (DelegateInvocation): Re-write accordingly.
9082 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9084 (MakeByteBlob): Handle types more correctly.
9086 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9087 initialization from expressions but it is incomplete because I am a complete
9090 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9092 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9093 on If. Basically, we have to return `true' (ie, we do return to
9094 our caller) only if both branches of the if return.
9096 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9097 short-circuit operators, handle them as short circuit operators.
9099 (Cast.DoResolve): Resolve type.
9100 (Cast.Cast): Take an expression as the target type.
9102 * cs-parser.jay (cast_expression): Remove old hack that only
9103 allowed a limited set of types to be handled. Now we take a
9104 unary_expression and we resolve to a type during semantic
9107 Use the grammar productions from Rhys to handle casts (this is
9108 not complete like Rhys syntax yet, we fail to handle that corner
9109 case that C# has regarding (-x), but we will get there.
9111 2001-11-22 Ravi Pratap <ravi@ximian.com>
9113 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9114 field which is an array type.
9116 * cs-parser.jay (declare_local_variables): Support array initialization too.
9118 * typemanager.cs (MakeKey): Implement.
9120 (everywhere): Use the above appropriately.
9122 * cs-parser.jay (for_statement): Update for array initialization while
9123 declaring variables.
9125 * ecore.cs : The error message was correct, it's the variable's names that
9126 were misleading ;-) Make the code more readable.
9128 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9129 the correct type etc.
9131 (ConvertExplicit): Handle Enum types by examining the underlying type.
9133 2001-11-21 Ravi Pratap <ravi@ximian.com>
9135 * parameter.cs (GetCallingConvention): Always return
9136 CallingConventions.Standard for now.
9138 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9140 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9141 and `r' after calling DoNumericPromotions.
9143 * ecore.cs: Fix error message (the types were in the wrong order).
9145 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9146 BindingFlags.Instance as well
9148 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9149 implicit int literal conversion in an empty cast so that we
9150 propagate the right type upstream.
9152 (UnboxCast): new class used to unbox value types.
9153 (Expression.ConvertExplicit): Add explicit type conversions done
9156 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9157 the target type before applying the implicit LongLiterals to ULong
9160 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9162 * cs-parser.jay (for_statement): Reworked the way For works: now
9163 we declare manually any variables that are introduced in
9164 for_initializer to solve the problem of having out-of-band code
9165 emition (that is what got for broken).
9167 (declaration_statement): Perform the actual variable declaration
9168 that used to be done in local_variable_declaration here.
9170 (local_variable_declaration): Do not declare anything, just pass
9171 the information on a DictionaryEntry
9173 2001-11-20 Ravi Pratap <ravi@ximian.com>
9175 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9176 re-write of the logic to now make it recursive.
9178 (UpdateIndices): Re-write accordingly.
9180 Store element data in a separate ArrayData list in the above methods.
9182 (MakeByteBlob): Implement to dump the array data into a byte array.
9184 2001-11-19 Ravi Pratap <ravi@ximian.com>
9186 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9189 * constant.cs (Define): Implement.
9191 (EmitConstant): Re-write fully.
9193 Pass in location info.
9195 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9198 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9199 DictionaryEntry since we need location info too.
9201 (constant_declaration): Update accordingly.
9203 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9204 code into another method : UpdateIndices.
9206 2001-11-18 Ravi Pratap <ravi@ximian.com>
9208 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9209 some type checking etc.
9211 2001-11-17 Ravi Pratap <ravi@ximian.com>
9213 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9214 bits to provide dimension info if the user skips doing that.
9216 Update second constructor to store the rank correctly.
9218 2001-11-16 Ravi Pratap <ravi@ximian.com>
9220 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9221 and try to implement.
9223 * ../errors/cs0150.cs : Add.
9225 * ../errors/cs0178.cs : Add.
9227 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9229 * statement.cs: Implement foreach on multi-dimensional arrays.
9231 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9232 name of the params argument.
9234 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9235 initializing the array.
9237 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9238 we can use this elsewhere.
9240 * statement.cs: Finish implementation of foreach for single
9243 * cs-parser.jay: Use an out-of-band stack to pass information
9244 around, I wonder why I need this.
9246 foreach_block: Make the new foreach_block the current_block.
9248 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9249 function used to return a static Parameters structure. Used for
9250 empty parameters, as those are created very frequently.
9252 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9254 2001-11-15 Ravi Pratap <ravi@ximian.com>
9256 * interface.cs : Default modifier is private, not public. The
9257 make verify test passes again.
9259 2001-11-15 Ravi Pratap <ravi@ximian.com>
9261 * support.cs (ReflectionParameters): Fix logic to determine
9262 whether the last parameter is a params one. Test 9 passes again.
9264 * delegate.cs (Populate): Register the builders we define with
9265 RegisterParameterForBuilder. Test 19 passes again.
9267 * cs-parser.jay (property_declaration): Reference $6 instead
9268 of $$ to get at the location.
9270 (indexer_declaration): Similar stuff.
9274 * class.cs (Property): Register parameters for the Get and Set methods
9275 if they exist. Test 23 passes again.
9277 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9278 call to EmitArguments as we are sure there aren't any params arguments.
9279 Test 32 passes again.
9281 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9282 IndexOutOfRangeException.
9284 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9285 Test 33 now passes again.
9287 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9289 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9290 broke a bunch of things. Will have to come up with a better way
9291 of tracking locations.
9293 * statement.cs: Implemented foreach for single dimension arrays.
9295 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9297 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9298 an error. This removes the lookup from the critical path.
9300 * cs-parser.jay: Removed use of temporary_loc, which is completely
9303 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9305 * support.cs (ReflectionParameters.ParameterModifier): Report
9306 whether the argument is a PARAMS argument or not.
9308 * class.cs: Set the attribute `ParamArrayAttribute' on the
9311 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9312 and cons_param_array_attribute (ConstructorInfo for
9313 ParamArrayAttribute).,
9315 * codegen.cs: Emit the return using the `Return' statement, that
9316 way we can report the error correctly for missing return values.
9318 * class.cs (Method.Emit): Clean up.
9320 * expression.cs (Argument.Resolve): Take another argument: the
9321 location where this argument is used. Notice that this is not
9322 part of the "Argument" class as to reduce the size of the
9323 structure (we know the approximate location anyways).
9325 Test if the argument is a variable-reference, if not, then
9326 complain with a 206.
9328 (Argument.Emit): Emit addresses of variables.
9330 (Argument.FullDesc): Simplify.
9332 (Invocation.DoResolve): Update for Argument.Resolve.
9334 (ElementAccess.DoResolve): ditto.
9336 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9337 method should be virtual, as this method is always virtual.
9339 (NewDelegate.DoResolve): Update for Argument.Resolve.
9341 * class.cs (ConstructorInitializer.DoResolve): ditto.
9343 * attribute.cs (Attribute.Resolve): ditto.
9345 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9347 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9349 * expression.cs (ParameterReference): Drop IStackStorage and implement
9350 IAssignMethod instead.
9352 (LocalVariableReference): ditto.
9354 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9355 IAssignMethod instead.
9357 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9359 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9360 enumerations that are used in heavily used structures derive from
9361 byte in a laughable and pathetic attempt to reduce memory usage.
9362 This is the kind of pre-optimzations that you should not do at
9363 home without adult supervision.
9365 * expression.cs (UnaryMutator): New class, used to handle ++ and
9366 -- separatedly from the other unary operators. Cleans up the
9367 code, and kills the ExpressionStatement dependency in Unary.
9369 (Unary): Removed `method' and `Arguments' from this class, making
9370 it smaller, and moving it all to SimpleCall, so I can reuse this
9371 code in other locations and avoid creating a lot of transient data
9372 strucutres when not required.
9374 * cs-parser.jay: Adjust for new changes.
9376 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9378 * enum.cs (Enum.Populate): If there is a failure during
9381 * cs-parser.jay (opt_enum_base): we used to catch type errors
9382 here, but this is really incorrect. The type error should be
9383 catched during semantic analysis.
9385 2001-12-11 Ravi Pratap <ravi@ximian.com>
9387 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9388 current_local_parameters as expected since I, in my stupidity, had forgotten
9391 * attribute.cs (GetValidPlaces): Fix stupid bug.
9393 * class.cs (Method::Emit): Perform check on applicability of attributes.
9395 (Constructor::Emit): Ditto.
9397 (Field::Emit): Ditto.
9399 (Field.Location): Store location information.
9401 (Property, Event, Indexer, Operator): Ditto.
9403 * cs-parser.jay (field_declaration): Pass in location for each field.
9405 * ../errors/cs0592.cs : Add.
9407 2001-11-12 Ravi Pratap <ravi@ximian.com>
9409 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9411 (InitCoreTypes): Update accordingly.
9413 (RegisterAttrType, LookupAttr): Implement.
9415 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9416 info about the same.
9418 (Resolve): Update to populate the above as necessary.
9422 (GetValidPlaces): Helper to the above.
9424 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9426 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9428 2001-11-12 Ravi Pratap <ravi@ximian.com>
9430 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9432 * ../errors/cs0617.cs : Add.
9434 2001-11-11 Ravi Pratap <ravi@ximian.com>
9436 * enum.cs (Emit): Rename to Populate to be more consistent with what
9437 we expect it to do and when exactly it is called.
9439 * class.cs, rootcontext.cs : Update accordingly.
9441 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9442 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9444 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9446 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9447 of a fieldinfo using the above, when dealing with a FieldBuilder.
9449 2001-11-10 Ravi Pratap <ravi@ximian.com>
9451 * ../errors/cs0031.cs : Add.
9453 * ../errors/cs1008.cs : Add.
9455 * ../errrors/cs0543.cs : Add.
9457 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9460 (FindMembers): Implement.
9462 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9463 enums and delegates too.
9465 (enum_types): Rename to builder_to_enum.
9467 (delegate_types): Rename to builder_to_delegate.
9469 * delegate.cs (FindMembers): Implement.
9471 2001-11-09 Ravi Pratap <ravi@ximian.com>
9473 * typemanager.cs (IsEnumType): Implement.
9475 * enum.cs (Emit): Re-write parts to account for the underlying type
9476 better and perform checking etc.
9478 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9479 of the underlying type.
9481 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9484 * enum.cs (error31): Helper to report error #31.
9486 * cs-parser.jay (enum_declaration): Store location of each member too.
9488 * enum.cs (member_to_location): New hashtable.
9490 (AddEnumMember): Update location hashtable.
9492 (Emit): Use the location of each member while reporting errors.
9494 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9496 * cs-parser.jay: A for_initializer if is a
9497 local_variable_declaration really ammount to have an implicit
9498 block with the variable declaration and no initializer for for.
9500 * statement.cs (For.Emit): Cope with null initializers.
9502 This fixes the infinite loop on for initializers.
9504 2001-11-08 Miguel de Icaza <miguel@ximian.com>
9506 * enum.cs: More cleanup.
9508 * ecore.cs: Remove dead code.
9510 * class.cs (Property.Emit): More simplification.
9511 (Event.Emit): ditto.
9513 Reworked to have less levels of indentation.
9515 2001-11-08 Ravi Pratap <ravi@ximian.com>
9517 * class.cs (Property): Emit attributes.
9527 * enum.cs (Emit): Ditto.
9529 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9532 * class.cs (Field, Event, etc.): Move attribute generation into the
9533 Emit method everywhere.
9535 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9536 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9537 as we had no way of defining nested enums !
9539 * rootcontext.cs : Adjust code accordingly.
9541 * typemanager.cs (AddEnumType): To keep track of enum types separately.
9543 2001-11-07 Ravi Pratap <ravi@ximian.com>
9545 * expression.cs (EvalConstantExpression): Move into ecore.cs
9547 * enum.cs (Enum): Rename some members and make them public and readonly
9548 according to our convention.
9550 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9553 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9555 (Enum::Emit): Write a simple version for now which doesn't try to compute
9556 expressions. I shall modify this to be more robust in just a while.
9558 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9560 (TypeContainer::CloseType): Create the Enum types too.
9562 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9564 * expression.cs (EvalConstantExpression): Get rid of completely.
9566 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9567 user-defined values and other cases.
9569 (IsValidEnumLiteral): Helper function.
9571 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
9572 out there in the case we had a literal FieldExpr.
9574 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9576 (Literalize): Revamp a bit to take two arguments.
9578 (EnumLiteral): New class which derives from Literal to wrap enum literals.
9580 2001-11-06 Ravi Pratap <ravi@ximian.com>
9582 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9584 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9586 (Resolve): Use the above to ensure we have proper initializers.
9588 2001-11-05 Ravi Pratap <ravi@ximian.com>
9590 * expression.cs (Expression::EvalConstantExpression): New method to
9591 evaluate constant expressions.
9593 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9595 2001-11-07 Miguel de Icaza <miguel@ximian.com>
9597 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9600 (Binary.ResolveOperator): Handle operator != (object a, object b)
9601 and operator == (object a, object b);
9603 (Binary.DoNumericPromotions): Indicate whether the numeric
9604 promotion was possible.
9606 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9609 Made the ArrayAccess implement interface IAssignMethod instead of
9610 IStackStore as the order in which arguments are passed reflects
9613 * assign.cs: Instead of using expr.ExprClass to select the way of
9614 assinging, probe for the IStackStore/IAssignMethod interfaces.
9616 * typemanager.cs: Load InitializeArray definition.
9618 * rootcontext.cs (RootContext.MakeStaticData): Used to define
9619 static data that can be used to initialize arrays.
9621 2001-11-05 Miguel de Icaza <miguel@ximian.com>
9623 * expression.cs: Handle operator== and operator!= for booleans.
9625 (Conditioal.Reduce): Implement reducer for the ?: operator.
9627 (Conditional.Resolve): Implement dead code elimination.
9629 (Binary.Resolve): Catch string literals and return a new
9630 concatenated string.
9632 (Unary.Reduce): Implement reduction of unary expressions.
9634 * ecore.cs: Split out the expression core handling here.
9636 (Expression.Reduce): New method used to perform constant folding
9637 and CSE. This is needed to support constant-expressions.
9639 * statement.cs (Statement.EmitBoolExpression): Pass true and false
9640 targets, and optimize for !x.
9642 2001-11-04 Ravi Pratap <ravi@ximian.com>
9644 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9645 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9646 set custom atttributes.
9648 * literal.cs (Literal::GetValue): New abstract method to return the actual
9649 value of the literal, cast as an object.
9651 (*Literal): Implement GetValue method.
9653 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9654 expressions to the arraylist but objects of type Argument.
9656 * class.cs (TypeContainer::Emit): Emit our attributes too.
9658 (Method::Emit, Constructor::Emit): Ditto.
9660 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9661 to be ignoring earlier.
9663 2001-11-03 Ravi Pratap <ravi@ximian.com>
9665 * attribute.cs (AttributeSection::Define): Implement to do the business
9666 of constructing a CustomAttributeBuilder.
9668 (Attribute): New trivial class. Increases readability of code.
9670 * cs-parser.jay : Update accordingly.
9672 (positional_argument_list, named_argument_list, named_argument): New rules
9674 (attribute_arguments): Use the above so that we are more correct.
9676 2001-11-02 Ravi Pratap <ravi@ximian.com>
9678 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9679 to perform all checks for a method with a params parameter.
9681 (Invocation::OverloadResolve): Update to use the above method and therefore
9682 cope correctly with params method invocations.
9684 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
9687 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9688 constructors in our parent too because we can't afford to miss out on
9691 * attribute.cs (AttributeSection): New name for the class Attribute
9693 Other trivial changes to improve readability.
9695 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
9696 use the new class names.
9698 2001-11-01 Ravi Pratap <ravi@ximian.com>
9700 * class.cs (Method::Define): Complete definition for params types too
9702 (Indexer::Define): Ditto.
9704 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
9705 Cope everywhere with a request for info about the array parameter.
9707 2001-11-01 Ravi Pratap <ravi@ximian.com>
9709 * tree.cs (RecordNamespace): Fix up to check for the correct key.
9711 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
9712 local_variable_type to extract the string corresponding to the type.
9714 (local_variable_type): Fixup the action to use the new helper method.
9716 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
9719 * expression.cs : Clean out code which uses the above.
9721 2001-10-31 Ravi Pratap <ravi@ximian.com>
9723 * typemanager.cs (RegisterMethod): Check if we already have an existing key
9724 and bale out if necessary by returning a false.
9726 (RegisterProperty): Ditto.
9728 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
9729 and print out appropriate error messages.
9731 * interface.cs (everywhere): Ditto.
9733 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
9734 location to constructor.
9736 * class.cs (Property, Event, Indexer): Update accordingly.
9738 * ../errors/cs111.cs : Added.
9740 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
9741 of a method, as laid down by the spec.
9743 (Invocation::OverloadResolve): Use the above method.
9745 2001-10-31 Ravi Pratap <ravi@ximian.com>
9747 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
9748 now take a TypeContainer and a Parameters object.
9750 (ParameterData): Modify return type of ParameterModifier method to be
9751 Parameter.Modifier and not a string.
9753 (ReflectionParameters, InternalParameters): Update accordingly.
9755 * expression.cs (Argument::GetParameterModifier): Same here.
9757 * support.cs (InternalParameters::ParameterType): Find a better way of determining
9758 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
9759 symbol in it at all so maybe this is only for now.
9761 2001-10-30 Ravi Pratap <ravi@ximian.com>
9763 * support.cs (InternalParameters): Constructor now takes an extra argument
9764 which is the actual Parameters class.
9766 (ParameterDesc): Update to provide info on ref/out modifiers.
9768 * class.cs (everywhere): Update call to InternalParameters to pass in
9769 the second argument too.
9771 * support.cs (ParameterData): Add ParameterModifier, which is a method
9772 to return the modifier info [ref/out etc]
9774 (InternalParameters, ReflectionParameters): Implement the above.
9776 * expression.cs (Argument::ParameterModifier): Similar function to return
9777 info about the argument's modifiers.
9779 (Invocation::OverloadResolve): Update to take into account matching modifiers
9782 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9783 a new SetFormalParameters object which we pass to InternalParameters.
9785 2001-10-30 Ravi Pratap <ravi@ximian.com>
9787 * expression.cs (NewArray): Merge into the ArrayCreation class.
9789 2001-10-29 Ravi Pratap <ravi@ximian.com>
9791 * expression.cs (NewArray): Merge classes NewBuiltinArray and
9792 NewUserdefinedArray into one as there wasn't much of a use in having
9795 * expression.cs (Argument): Change field's name to ArgType from Type.
9797 (Type): New readonly property which returns the proper type, taking into
9798 account ref/out modifiers.
9800 (everywhere): Adjust code accordingly for the above.
9802 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9803 whether we are emitting for a ref or out parameter.
9805 * expression.cs (Argument::Emit): Use the above field to set the state.
9807 (LocalVariableReference::Emit): Update to honour the flag and emit the
9810 * parameter.cs (Attributes): Set the correct flags for ref parameters.
9812 * expression.cs (Argument::FullDesc): New function to provide a full desc.
9814 * support.cs (ParameterData): Add method ParameterDesc to the interface.
9816 (ReflectionParameters, InternalParameters): Implement the above method.
9818 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
9821 (Invocation::FullMethodDesc): Ditto.
9823 2001-10-29 Miguel de Icaza <miguel@ximian.com>
9825 * cs-parser.jay: Add extra production for the second form of array
9828 * expression.cs (ArrayCreation): Update to reflect the above
9831 * Small changes to prepare for Array initialization.
9833 2001-10-28 Miguel de Icaza <miguel@ximian.com>
9835 * typemanager.cs (ImplementsInterface): interface might be null;
9836 Deal with this problem;
9838 Also, we do store negative hits on the cache (null values), so use
9839 this instead of calling t.GetInterfaces on the type everytime.
9841 2001-10-28 Ravi Pratap <ravi@ximian.com>
9843 * typemanager.cs (IsBuiltinType): New method to help determine the same.
9845 * expression.cs (New::DoResolve): Get rid of array creation code and instead
9846 split functionality out into different classes.
9848 (New::FormArrayType): Move into NewBuiltinArray.
9850 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
9853 (NewBuiltinArray): New class to handle creation of built-in arrays.
9855 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
9856 account creation of one-dimensional arrays.
9858 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
9860 (NewUserdefinedArray::DoResolve): Implement.
9862 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
9864 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
9865 we maintain inside the TypeManager. This is necessary to perform lookups on the
9868 (LookupType): Update to perform GetType on the module builders too.
9870 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
9872 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
9874 2001-10-23 Ravi Pratap <ravi@ximian.com>
9876 * expression.cs (New::DoResolve): Implement guts of array creation.
9878 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
9880 2001-10-27 Miguel de Icaza <miguel@ximian.com>
9882 * expression.cs: Fix bug I introduced lsat night that broke
9885 (Expression.Resolve): Report a 246 error (can not resolve name)
9886 if we find a SimpleName in the stream.
9888 (Expression.ResolveLValue): Ditto.
9890 (Expression.ResolveWithSimpleName): This function is a variant of
9891 ResolveName, this one allows SimpleNames to be returned without a
9892 warning. The only consumer of SimpleNames is MemberAccess
9894 2001-10-26 Miguel de Icaza <miguel@ximian.com>
9896 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
9897 might arrive here. I have my doubts that this is correct.
9899 * statement.cs (Lock): Implement lock statement.
9901 * cs-parser.jay: Small fixes to support `lock' and `using'
9903 * cs-tokenizer.cs: Remove extra space
9905 * driver.cs: New flag --checked, allows to turn on integer math
9908 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
9909 Threading.Monitor.Exit
9911 2001-10-23 Miguel de Icaza <miguel@ximian.com>
9913 * expression.cs (IndexerAccess::DoResolveLValue): Set the
9914 Expression Class to be IndexerAccess.
9916 Notice that Indexer::DoResolve sets the eclass to Value.
9918 2001-10-22 Miguel de Icaza <miguel@ximian.com>
9920 * class.cs (TypeContainer::Emit): Emit code for indexers.
9922 * assign.cs (IAssignMethod): New interface implemented by Indexers
9923 and Properties for handling assignment.
9925 (Assign::Emit): Simplify and reuse code.
9927 * expression.cs (IndexerAccess, PropertyExpr): Implement
9928 IAssignMethod, clean up old code.
9930 2001-10-22 Ravi Pratap <ravi@ximian.com>
9932 * typemanager.cs (ImplementsInterface): New method to determine if a type
9933 implements a given interface. Provides a nice cache too.
9935 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
9938 (ConvertReferenceExplicit): Ditto.
9940 * delegate.cs (Delegate::Populate): Update to define the parameters on the
9941 various methods, with correct names etc.
9943 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
9944 Operator.UnaryNegation.
9946 * cs-parser.jay (operator_declarator): Be a little clever in the case where
9947 we have a unary plus or minus operator.
9949 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
9952 * everywhere : update accordingly.
9954 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
9957 * class.cs (Method::Define): For the case where we are implementing a method
9958 inherited from an interface, we need to set the MethodAttributes.Final flag too.
9959 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
9961 2001-10-21 Ravi Pratap <ravi@ximian.com>
9963 * interface.cs (FindMembers): Implement to work around S.R.E
9966 * typemanager.cs (IsInterfaceType): Implement.
9968 (FindMembers): Update to handle interface types too.
9970 * expression.cs (ImplicitReferenceConversion): Re-write bits which
9971 use IsAssignableFrom as that is not correct - it doesn't work.
9973 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9974 and accordingly override EmitStatement.
9976 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9977 using the correct logic :-)
9979 2001-10-19 Ravi Pratap <ravi@ximian.com>
9981 * ../errors/cs-11.cs : Add to demonstrate error -11
9983 2001-10-17 Miguel de Icaza <miguel@ximian.com>
9985 * assign.cs (Assign::Resolve): Resolve right hand side first, and
9986 then pass this as a hint to ResolveLValue.
9988 * expression.cs (FieldExpr): Add Location information
9990 (FieldExpr::LValueResolve): Report assignment to readonly
9993 (Expression::ExprClassFromMemberInfo): Pass location information.
9995 (Expression::ResolveLValue): Add new method that resolves an
9998 (Expression::DoResolveLValue): Default invocation calls
10001 (Indexers): New class used to keep track of indexers in a given
10004 (IStackStore): Renamed from LValue, as it did not really describe
10005 what this did. Also ResolveLValue is gone from this interface and
10006 now is part of Expression.
10008 (ElementAccess): Depending on the element access type
10010 * typemanager.cs: Add `indexer_name_type' as a Core type
10011 (System.Runtime.CompilerServices.IndexerNameAttribute)
10013 * statement.cs (Goto): Take a location.
10015 2001-10-18 Ravi Pratap <ravi@ximian.com>
10017 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10018 if two delegates are compatible.
10020 (NewDelegate::DoResolve): Update to take care of the case when
10021 we instantiate a delegate from another delegate.
10023 * typemanager.cs (FindMembers): Don't even try to look up members
10024 of Delegate types for now.
10026 2001-10-18 Ravi Pratap <ravi@ximian.com>
10028 * delegate.cs (NewDelegate): New class to take care of delegate
10031 * expression.cs (New): Split the delegate related code out into
10032 the NewDelegate class.
10034 * delegate.cs (DelegateInvocation): New class to handle delegate
10037 * expression.cs (Invocation): Split out delegate related code into
10038 the DelegateInvocation class.
10040 2001-10-17 Ravi Pratap <ravi@ximian.com>
10042 * expression.cs (New::DoResolve): Implement delegate creation fully
10043 and according to the spec.
10045 (New::DoEmit): Update to handle delegates differently.
10047 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10048 because of which we were printing out arguments in reverse order !
10050 * delegate.cs (VerifyMethod): Implement to check if the given method
10051 matches the delegate.
10053 (FullDelegateDesc): Implement.
10055 (VerifyApplicability): Implement.
10057 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10058 delegate invocations too.
10060 (Invocation::Emit): Ditto.
10062 * ../errors/cs1593.cs : Added.
10064 * ../errors/cs1594.cs : Added.
10066 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10068 2001-10-16 Ravi Pratap <ravi@ximian.com>
10070 * typemanager.cs (intptr_type): Core type for System.IntPtr
10072 (InitCoreTypes): Update for the same.
10074 (iasyncresult_type, asynccallback_type): Ditto.
10076 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10079 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10082 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10083 the builders for the 4 members of a delegate type :-)
10085 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10088 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10090 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10092 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10094 * statement.cs (Break::Emit): Implement.
10095 (Continue::Emit): Implement.
10097 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10098 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10099 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10100 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10103 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10104 properties that track the label for the current loop (begin of the
10105 loop and end of the loop).
10107 2001-10-15 Ravi Pratap <ravi@ximian.com>
10109 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10110 use of emitting anything at all.
10112 * class.cs, rootcontext.cs : Get rid of calls to the same.
10114 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10116 (Populate): Define the constructor correctly and set the implementation
10119 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10122 (AddDelegateType): Implement.
10124 (IsDelegateType): Implement helper method.
10126 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10128 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10129 and accordingly handle it.
10131 * delegate.cs (Populate): Take TypeContainer argument.
10132 Implement bits to define the Invoke method. However, I still haven't figured out
10133 how to take care of the native int bit :-(
10135 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10136 Qualify the name of the delegate, not its return type !
10138 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10141 (StandardConversionExists): Checking for array types turns out to be recursive.
10143 (ConvertReferenceExplicit): Implement array conversion.
10145 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10147 2001-10-12 Ravi Pratap <ravi@ximian.com>
10149 * cs-parser.jay (delegate_declaration): Store the fully qualified
10150 name as it is a type declaration.
10152 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10155 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10156 as TypeContainer::DefineType.
10158 (Populate): Method in which all the definition of the various methods (Invoke)
10161 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10164 (CloseDelegate): Finally creates the delegate.
10166 * class.cs (TypeContainer::DefineType): Update to define delegates.
10167 (Populate, Emit and CloseType): Do the same thing here too.
10169 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10170 delegates in all these operations.
10172 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10174 * expression.cs: LocalTemporary: a new expression used to
10175 reference a temporary that has been created.
10177 * assign.cs: Handle PropertyAccess back here, so that we can
10178 provide the proper semantic access to properties.
10180 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10181 a few more explicit conversions.
10183 * modifiers.cs: `NEW' modifier maps to HideBySig.
10185 * expression.cs (PropertyExpr): Make this into an
10186 ExpressionStatement, and support the EmitStatement code path.
10188 Perform get/set error checking, clean up the interface.
10190 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10191 them into toplevel access objects.
10193 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10195 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10198 * typemanager.cs: Keep track here of our PropertyBuilders again to
10199 work around lameness in SRE.
10201 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10203 * expression.cs (LValue::LValueResolve): New method in the
10204 interface, used to perform a second resolution pass for LValues.
10206 (This::DoResolve): Catch the use of this in static methods.
10208 (This::LValueResolve): Implement.
10210 (This::Store): Remove warning, assigning to `this' in structures
10213 (Invocation::Emit): Deal with invocation of
10214 methods on value types. We need to pass the address to structure
10215 methods rather than the object itself. (The equivalent code to
10216 emit "this" for structures leaves the entire structure on the
10217 stack instead of a pointer to it).
10219 (ParameterReference::DoResolve): Compute the real index for the
10220 argument based on whether the method takes or not a `this' pointer
10221 (ie, the method is static).
10223 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10224 value types returned from functions when we need to invoke a
10225 method on the sturcture.
10228 2001-10-11 Ravi Pratap <ravi@ximian.com>
10230 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10231 defining the type in the Modulebuilder or Typebuilder. This is to take
10232 care of nested types which need to be defined on the TypeBuilder using
10233 DefineNestedMethod.
10235 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10236 methods in RootContext, only ported to be part of TypeContainer.
10238 (TypeContainer::GetInterfaceOrClass): Ditto.
10240 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10242 * interface.cs (Interface::DefineInterface): New method. Does exactly
10243 what RootContext.CreateInterface did earlier, only it takes care of nested types
10246 (Interface::GetInterfaces): Move from RootContext here and port.
10248 (Interface::GetInterfaceByName): Same here.
10250 * rootcontext.cs (ResolveTree): Re-write.
10252 (PopulateTypes): Re-write.
10254 * class.cs (TypeContainer::Populate): Populate nested types too.
10255 (TypeContainer::Emit): Emit nested members too.
10257 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10258 instead just use the name argument passed in as it is already fully
10261 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10262 to TypeContainer mapping to see if a type is user-defined.
10264 * class.cs (TypeContainer::CloseType): Implement.
10266 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10267 the default constructor.
10269 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10272 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10274 * interface.cs (CloseType): Create the type here.
10276 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10279 Remove all the methods which are now in TypeContainer.
10281 2001-10-10 Ravi Pratap <ravi@ximian.com>
10283 * delegate.cs (Define): Re-write bits to define the delegate
10286 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10288 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10290 * expression.cs (ImplicitReferenceConversion): handle null as well
10291 as a source to convert to any reference type.
10293 * statement.cs (Return): Perform any implicit conversions to
10294 expected return type.
10296 Validate use of return statement.
10298 * codegen.cs (EmitContext): Pass the expected return type here.
10300 * class.cs (Method, Constructor, Property): Pass expected return
10301 type to EmitContext.
10303 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10305 * expression.cs: Make DoResolve take an EmitContext instead of a
10308 Replaced `l' and `location' for `loc', for consistency.
10310 (Error, Warning): Remove unneeded Tc argument.
10312 * assign.cs, literal.cs, constant.cs: Update to new calling
10315 * codegen.cs: EmitContext now contains a flag indicating whether
10316 code is being generated in a static method or not.
10318 * cs-parser.jay: DecomposeQI, new function that replaces the old
10319 QualifiedIdentifier. Now we always decompose the assembled
10320 strings from qualified_identifier productions into a group of
10323 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10325 * rootcontext.cs: Deal with field-less struct types correctly now
10326 by passing the size option to Define Type.
10328 * class.cs: Removed hack that created one static field.
10330 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10332 * statement.cs: Moved most of the code generation here.
10334 2001-10-09 Ravi Pratap <ravi@ximian.com>
10336 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10339 (ElementAccess): Remove useless bits for now - keep checks as the spec
10342 2001-10-08 Ravi Pratap <ravi@ximian.com>
10344 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10345 and start performing checks according to the spec.
10347 2001-10-07 Ravi Pratap <ravi@ximian.com>
10349 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10350 rank_specifiers instead.
10352 (rank_specifiers): Change the order in which the rank specifiers are stored
10354 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10356 * expression.cs (ElementAccess): Implement the LValue interface too.
10358 2001-10-06 Ravi Pratap <ravi@ximian.com>
10360 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10361 except that user defined conversions are not included.
10363 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10364 perform the conversion of the return type, if necessary.
10366 (New::DoResolve): Check whether we are creating an array or an object
10367 and accordingly do the needful.
10369 (New::Emit): Same here.
10371 (New::DoResolve): Implement guts of array creation.
10373 (New::FormLookupType): Helper function.
10375 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10377 * codegen.cs: Removed most of the code generation here, and move the
10378 corresponding code generation bits to the statement classes.
10380 Added support for try/catch/finalize and throw.
10382 * cs-parser.jay: Added support for try/catch/finalize.
10384 * class.cs: Catch static methods having the flags override,
10385 virtual or abstract.
10387 * expression.cs (UserCast): This user cast was not really doing
10388 what it was supposed to do. Which is to be born in fully resolved
10389 state. Parts of the resolution were being performed at Emit time!
10393 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10395 * expression.cs: Implicity convert the result from UserCast.
10397 2001-10-05 Ravi Pratap <ravi@ximian.com>
10399 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10400 prevented it from working correctly.
10402 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10403 merely ConvertImplicit.
10405 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10407 * typemanager.cs: Make the LookupTypeContainer function static,
10408 and not per-instance.
10410 * class.cs: Make static FindMembers (the one that takes a Type
10413 * codegen.cs: Add EmitForeach here.
10415 * cs-parser.jay: Make foreach a toplevel object instead of the
10416 inline expansion, as we need to perform semantic analysis on it.
10418 2001-10-05 Ravi Pratap <ravi@ximian.com>
10420 * expression.cs (Expression::ImplicitUserConversion): Rename to
10421 UserDefinedConversion.
10423 (Expression::UserDefinedConversion): Take an extra argument specifying
10424 whether we look for explicit user conversions too.
10426 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10428 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10430 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10431 with the appropriate arguments.
10433 * cs-parser.jay (cast_expression): Record location too.
10435 * expression.cs (Cast): Record location info.
10437 (Expression::ConvertExplicit): Take location argument.
10439 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10440 to determine if we are doing explicit conversions.
10442 (UserCast::Emit): Update accordingly.
10444 (Expression::ConvertExplicit): Report an error if everything fails.
10446 * ../errors/cs0030.cs : Add.
10448 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10450 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10451 virtual and newslot bits.
10453 * class.cs (TypeContainer::RegisterRequiredImplementations):
10454 Record methods we need.
10456 (TypeContainer::MakeKey): Helper function to make keys for
10457 MethodBases, since the Methodbase key is useless.
10459 (TypeContainer::Populate): Call RegisterRequiredImplementations
10460 before defining the methods.
10462 Create a mapping for method_builders_to_methods ahead of time
10463 instead of inside a tight loop.
10465 (::RequireMethods): Accept an object as the data to set into the
10466 hashtable so we can report interface vs abstract method mismatch.
10468 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10470 * report.cs: Make all of it static.
10472 * rootcontext.cs: Drop object_type and value_type computations, as
10473 we have those in the TypeManager anyways.
10475 Drop report instance variable too, now it is a global.
10477 * driver.cs: Use try/catch on command line handling.
10479 Add --probe option to debug the error reporting system with a test
10482 * report.cs: Add support for exiting program when a probe
10483 condition is reached.
10485 2001-10-03 Ravi Pratap <ravi@ximian.com>
10487 * expression.cs (Binary::DoNumericPromotions): Fix the case when
10488 we do a forcible conversion regardless of type, to check if
10489 ForceConversion returns a null.
10491 (Binary::error19): Use location to report error.
10493 (Unary::error23): Use location here too.
10495 * ../errors/cs0019.cs : Check in.
10497 * ../errors/cs0023.cs : Check in.
10499 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10500 case of a non-null MethodInfo object with a length of 0 !
10502 (Binary::ResolveOperator): Flag error if overload resolution fails to find
10503 an applicable member - according to the spec :-)
10504 Also fix logic to find members in base types.
10506 (Unary::ResolveOperator): Same here.
10508 (Unary::report23): Change name to error23 and make first argument a TypeContainer
10509 as I was getting thoroughly confused between this and error19 :-)
10511 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10512 (::FindMostEncompassedType): Implement.
10513 (::FindMostEncompassingType): Implement.
10514 (::StandardConversionExists): Implement.
10516 (UserImplicitCast): Re-vamp. We now need info about most specific
10517 source and target types so that we can do the necessary conversions.
10519 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10520 mathematical union with no duplicates.
10522 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10524 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10525 in order from base classes to child classes, so that we can in
10526 child classes look up in our parent for method names and
10527 attributes (required for handling abstract, virtual, new, override
10528 constructs: we need to instrospect our base class, and if we dont
10529 populate the classes in order, the introspection might be
10530 incorrect. For example, a method could query its parent before
10531 the parent has any methods and would determine that the parent has
10532 no abstract methods (while it could have had them)).
10534 (RootContext::CreateType): Record the order in which we define the
10537 2001-10-02 Miguel de Icaza <miguel@ximian.com>
10539 * class.cs (TypeContainer::Populate): Also method definitions can
10540 fail now, keep track of this.
10542 (TypeContainer::FindMembers): Implement support for
10543 DeclaredOnly/noDeclaredOnly flag.
10545 (Constructor::Emit) Return the ConstructorBuilder.
10547 (Method::Emit) Return the MethodBuilder.
10548 Check for abstract or virtual methods to be public.
10550 * rootcontext.cs (RootContext::CreateType): Register all the
10551 abstract methods required for the class to be complete and the
10552 interface methods that must be implemented.
10554 * cs-parser.jay: Report error 501 (method requires body if it is
10555 not marked abstract or extern).
10557 * expression.cs (TypeOf::Emit): Implement.
10559 * typemanager.cs: runtime_handle_type, new global type.
10561 * class.cs (Property::Emit): Generate code for properties.
10563 2001-10-02 Ravi Pratap <ravi@ximian.com>
10565 * expression.cs (Unary::ResolveOperator): Find operators on base type
10566 too - we now conform exactly to the spec.
10568 (Binary::ResolveOperator): Same here.
10570 * class.cs (Operator::Define): Fix minor quirk in the tests.
10572 * ../errors/cs0215.cs : Added.
10574 * ../errors/cs0556.cs : Added.
10576 * ../errors/cs0555.cs : Added.
10578 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10580 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10581 single integer which is really efficient
10583 2001-10-01 Ravi Pratap <ravi@ximian.com>
10585 * expression.cs (Expression::ImplicitUserConversion): Use location
10586 even in the case when we are examining True operators.
10588 * class.cs (Operator::Define): Perform extensive checks to conform
10589 with the rules for operator overloading in the spec.
10591 * expression.cs (Expression::ImplicitReferenceConversion): Implement
10592 some of the other conversions mentioned in the spec.
10594 * typemanager.cs (array_type): New static member for the System.Array built-in
10597 (cloneable_interface): For System.ICloneable interface.
10599 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10600 we start resolving the tree and populating types.
10602 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10604 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10606 * expression.cs (Expression::ExprClassFromMemberInfo,
10607 Expression::Literalize): Create literal expressions from
10608 FieldInfos which are literals.
10610 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10611 type casts, because they were wrong. The test suite in tests
10614 (ImplicitNumericConversion): ushort to ulong requires a widening
10617 Int32 constant to long requires widening cast as well.
10619 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10620 for integers because the type on the stack is not i4.
10622 2001-09-30 Miguel de Icaza <miguel@ximian.com>
10624 * expression.cs (report118): require location argument.
10626 * parameter.cs: Do not dereference potential null value.
10628 * class.cs: Catch methods that lack the `new' keyword when
10629 overriding a name. Report warnings when `new' is used without
10630 anything being there to override.
10632 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10634 * class.cs: Only add constructor to hashtable if it is non-null
10635 (as now constructors can fail on define).
10637 (TypeManager, Class, Struct): Take location arguments.
10639 Catch field instance initialization in structs as errors.
10641 accepting_filter: a new filter for FindMembers that is static so
10642 that we dont create an instance per invocation.
10644 (Constructor::Define): Catch errors where a struct constructor is
10647 * cs-parser.jay: Pass location information for various new
10650 * delegate.cs (Delegate): take a location argument.
10652 * driver.cs: Do not call EmitCode if there were problesm in the
10653 Definition of the types, as many Builders wont be there.
10655 * decl.cs (Decl::Decl): Require a location argument.
10657 * cs-tokenizer.cs: Handle properly hex constants that can not fit
10658 into integers, and find the most appropiate integer for it.
10660 * literal.cs: Implement ULongLiteral.
10662 * rootcontext.cs: Provide better information about the location of
10663 failure when CreateType fails.
10665 2001-09-29 Miguel de Icaza <miguel@ximian.com>
10667 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10670 * expression.cs (Binary::CheckShiftArguments): Add missing type
10672 (Binary::ResolveOperator): Add type to the logical and and logical
10673 or, Bitwise And/Or and Exclusive Or code paths, it was missing
10676 (Binary::DoNumericPromotions): In the case where either argument
10677 is ulong (and most signed types combined with ulong cause an
10678 error) perform implicit integer constant conversions as well.
10680 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10682 * expression.cs (UserImplicitCast): Method should always be
10684 (Invocation::BetterConversion): Simplified test for IntLiteral.
10686 (Expression::ImplicitNumericConversion): Split this routine out.
10687 Put the code that performs implicit constant integer conversions
10690 (Expression::Resolve): Become a wrapper around DoResolve so we can
10691 check eclass and type being set after resolve.
10693 (Invocation::Badness): Remove this dead function
10695 (Binary::ResolveOperator): Do not compute the expensive argumnets
10696 unless we have a union for it.
10698 (Probe::Emit): Is needs to do an isinst and then
10699 compare against null.
10701 (::CanConvert): Added Location argument. If the Location argument
10702 is null (Location.Null), then we do not report errors. This is
10703 used by the `probe' mechanism of the Explicit conversion. We do
10704 not want to generate an error for something that the user
10705 explicitly requested to be casted. But the pipeline for an
10706 explicit cast first tests for potential implicit casts.
10708 So for now, if the Location is null, it means `Probe only' to
10709 avoid adding another argument. Might have to revise this
10712 (ClassCast): New class used to type cast objects into arbitrary
10713 classes (used in Explicit Reference Conversions).
10715 Implement `as' as well.
10717 Reverted all the patches from Ravi below: they were broken:
10719 * The use of `level' as a mechanism to stop recursive
10720 invocations is wrong. That was there just to catch the
10721 bug with a strack trace but not as a way of addressing
10724 To fix the problem we have to *understand* what is going
10725 on and the interactions and come up with a plan, not
10726 just get things going.
10728 * The use of the type conversion cache that I proposed
10729 last night had an open topic: How does this work across
10730 protection domains. A user defined conversion might not
10731 be public in the location where we are applying the
10732 conversion, a different conversion might be selected
10733 (ie, private A->B (better) but public B->A (worse),
10734 inside A, A->B applies, but outside it, B->A will
10737 * On top of that (ie, even if the above is solved),
10738 conversions in a cache need to be abstract. Ie, `To
10739 convert from an Int to a Short use an OpcodeCast', not
10740 `To convert from an Int to a Short use the OpcodeCast on
10741 the variable 5' (which is what this patch was doing).
10743 2001-09-28 Ravi Pratap <ravi@ximian.com>
10745 * expression.cs (Invocation::ConversionExists): Re-write to use
10746 the conversion cache
10748 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
10749 cache all conversions done, not just user-defined ones.
10751 (Invocation::BetterConversion): The real culprit. Use ConversionExists
10752 to determine if a conversion exists instead of acutually trying to
10753 perform the conversion. It's faster too.
10755 (Expression::ConvertExplicit): Modify to use ConversionExists to check
10756 and only then attempt the implicit conversion.
10758 2001-09-28 Ravi Pratap <ravi@ximian.com>
10760 * expression.cs (ConvertImplicit): Use a cache for conversions
10761 already found. Check level of recursion and bail out if necessary.
10763 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10765 * typemanager.cs (string_concat_string_string, string_concat_object_object):
10766 Export standard methods that we expect for string operations.
10768 * statement.cs (Block::UsageWarning): Track usage of variables and
10769 report the errors for not used variables.
10771 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
10774 2001-09-27 Miguel de Icaza <miguel@ximian.com>
10776 * codegen.cs: remove unnneded code
10778 * expression.cs: Removed BuiltinTypeAccess class
10780 Fix the order in which implicit conversions are
10783 The previous fixed dropped support for boxed conversions (adding a
10784 test to the test suite now)
10786 (UserImplicitCast::CanConvert): Remove test for source being null,
10787 that code is broken. We should not feed a null to begin with, if
10788 we do, then we should track the bug where the problem originates
10789 and not try to cover it up here.
10791 Return a resolved expression of type UserImplicitCast on success
10792 rather than true/false. Ravi: this is what I was talking about,
10793 the pattern is to use a static method as a "constructor" for
10796 Also, do not create arguments until the very last minute,
10797 otherwise we always create the arguments even for lookups that
10798 will never be performed.
10800 (UserImplicitCast::Resolve): Eliminate, objects of type
10801 UserImplicitCast are born in a fully resolved state.
10803 * typemanager.cs (InitCoreTypes): Init also value_type
10804 (System.ValueType).
10806 * expression.cs (Cast::Resolve): First resolve the child expression.
10808 (LValue): Add new method AddressOf to be used by
10811 Change the argument of Store to take an EmitContext instead of an
10812 ILGenerator, because things like FieldExpr need to be able to call
10813 their children expression to generate the instance code.
10815 (Expression::Error, Expression::Warning): Sugar functions for
10818 (Expression::MemberLookup): Accept a TypeContainer instead of a
10819 Report as the first argument.
10821 (Expression::ResolvePrimary): Killed. I still want to improve
10822 this as currently the code is just not right.
10824 (Expression::ResolveMemberAccess): Simplify, but it is still
10827 (Unary::Resolve): Catch errors in AddressOf operators.
10829 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
10830 index to a byte for the short-version, or the compiler will choose
10831 the wrong Emit call, which generates the wrong data.
10833 (ParameterReference::Emit, ::Store): same.
10835 (FieldExpr::AddressOf): Implement.
10837 * typemanager.cs: TypeManager: made public variable instead of
10840 * driver.cs: document --fatal.
10842 * report.cs (ErrorMessage, WarningMessage): new names for the old
10843 Error and Warning classes.
10845 * cs-parser.jay (member_access): Turn built-in access to types
10846 into a normal simplename
10848 2001-09-27 Ravi Pratap <ravi@ximian.com>
10850 * expression.cs (Invocation::BetterConversion): Fix to cope
10851 with q being null, since this was introducing a bug.
10853 * expression.cs (ConvertImplicit): Do built-in conversions first.
10855 2001-09-27 Ravi Pratap <ravi@ximian.com>
10857 * expression.cs (UserImplicitCast::Resolve): Fix bug.
10859 2001-09-27 Ravi Pratap <ravi@ximian.com>
10861 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
10862 I had introduced long ago (what's new ?).
10864 * expression.cs (UserImplicitCast::CanConvert): Static method to do
10865 the work of all the checking.
10866 (ConvertImplicit): Call CanConvert and only then create object if necessary.
10867 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
10869 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
10870 that is the right way.
10872 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
10873 overloading resolution. Use everywhere instead of cutting and pasting code.
10875 (Binary::ResolveOperator): Use MakeUnionSet.
10877 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
10878 we have to convert to bool types. Not complete yet.
10880 2001-09-27 Miguel de Icaza <miguel@ximian.com>
10882 * typemanager.cs (TypeManager::CSharpName): support ushort.
10884 * expression.cs (Expression::TryImplicitIntConversion): Attempts
10885 to provide an expression that performsn an implicit constant int
10886 conversion (section 6.1.6).
10887 (Expression::ConvertImplicitRequired): Reworked to include
10888 implicit constant expression conversions.
10890 (Expression::ConvertNumericExplicit): Finished.
10892 (Invocation::Emit): If InstanceExpression is null, then it means
10893 that we perform a call on this.
10895 2001-09-26 Miguel de Icaza <miguel@ximian.com>
10897 * expression.cs (Unary::Emit): Remove some dead code.
10898 (Probe): Implement Resolve and Emit for `is'.
10899 (Expression::ConvertImplicitRequired): Attempt to do constant
10900 expression conversions here. Maybe should be moved to
10901 ConvertImplicit, but I am not sure.
10902 (Expression::ImplicitLongConstantConversionPossible,
10903 Expression::ImplicitIntConstantConversionPossible): New functions
10904 that tell whether is it possible to apply an implicit constant
10905 expression conversion.
10907 (ConvertNumericExplicit): Started work on explicit numeric
10910 * cs-parser.jay: Update operator constants.
10912 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
10913 (Parameters::GetSignature): Hook up VerifyArgs here.
10914 (Parameters::VerifyArgs): Verifies that no two arguments have the
10917 * class.cs (Operator): Update the operator names to reflect the
10918 ones that the spec expects (as we are just stringizing the
10921 * expression.cs (Unary::ResolveOperator): Fix bug: Use
10922 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
10923 previous usage did only work for our methods.
10924 (Expression::ConvertImplicit): Handle decimal implicit numeric
10925 conversions as well.
10926 (Expression::InternalTypeConstructor): Used to invoke constructors
10927 on internal types for default promotions.
10929 (Unary::Emit): Implement special handling for the pre/post
10930 increment/decrement for overloaded operators, as they need to have
10931 the same semantics as the other operators.
10933 (Binary::ResolveOperator): ditto.
10934 (Invocation::ConversionExists): ditto.
10935 (UserImplicitCast::Resolve): ditto.
10937 2001-09-26 Ravi Pratap <ravi@ximian.com>
10939 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
10940 operator, return after emitting body. Regression tests pass again !
10942 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
10943 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
10944 (Invocation::OverloadResolve): Ditto.
10945 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
10947 * everywhere : update calls to the above methods accordingly.
10949 2001-09-26 Miguel de Icaza <miguel@ximian.com>
10951 * assign.cs (Assign): Make it inherit from ExpressionStatement.
10953 * expression.cs (ExpressionStatement): New base class used for
10954 expressions that can appear in statements, so that we can provide
10955 an alternate path to generate expression that do not leave a value
10958 (Expression::Emit, and all the derivatives): We no longer return
10959 whether a value is left on the stack or not. Every expression
10960 after being emitted leaves a single value on the stack.
10962 * codegen.cs (EmitContext::EmitStatementExpression): Use the
10963 facilties of ExpressionStatement if possible.
10965 * cs-parser.jay: Update statement_expression.
10967 2001-09-25 Miguel de Icaza <miguel@ximian.com>
10969 * driver.cs: Change the wording of message
10971 2001-09-25 Ravi Pratap <ravi@ximian.com>
10973 * expression.cs (Binary::ResolveOperator): Had forgottten to set
10974 the type of the expression to the return type of the method if
10975 we have an overloaded operator match ! The regression tests pass again !
10976 (Unary::ResolveOperator): Ditto.
10978 * expression.cs (Invocation::ConversionExists): Correct the member lookup
10979 to find "op_Implicit", not "implicit" ;-)
10980 (UserImplicitCast): New class to take care of user-defined implicit conversions.
10981 (ConvertImplicit, ForceConversion): Take TypeContainer argument
10983 * everywhere : Correct calls to the above accordingly.
10985 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10986 (ConvertImplicit): Do user-defined conversion if it exists.
10988 2001-09-24 Miguel de Icaza <miguel@ximian.com>
10990 * assign.cs: track location.
10991 (Resolve): Use implicit conversions on assignment.
10993 * literal.cs: Oops. Not good, Emit of short access values should
10994 pass (Bytes) or the wrong argument will be selected.
10996 * expression.cs (Unary::Emit): Emit code for -expr.
10998 (Unary::ResolveOperator): Handle `Substract' for non-constants
10999 (substract from zero from the non-constants).
11000 Deal with Doubles as well.
11002 (Expression::ConvertImplicitRequired): New routine that reports an
11003 error if no implicit conversion exists.
11005 (Invocation::OverloadResolve): Store the converted implicit
11006 expressions if we make them
11008 2001-09-24 Ravi Pratap <ravi@ximian.com>
11010 * class.cs (ConstructorInitializer): Take a Location argument.
11011 (ConstructorBaseInitializer): Same here.
11012 (ConstructorThisInitializer): Same here.
11014 * cs-parser.jay : Update all calls accordingly.
11016 * expression.cs (Unary, Binary, New): Take location argument.
11017 Update accordingly everywhere.
11019 * cs-parser.jay : Update all calls to the above to take a location
11022 * class.cs : Ditto.
11024 2001-09-24 Ravi Pratap <ravi@ximian.com>
11026 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11027 (Invocation::BetterConversion): Same here
11028 (Invocation::ConversionExists): Ditto.
11030 (Invocation::ConversionExists): Implement.
11032 2001-09-22 Ravi Pratap <ravi@ximian.com>
11034 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11035 Also take an additional TypeContainer argument.
11037 * All over : Pass in TypeContainer as argument to OverloadResolve.
11039 * typemanager.cs (CSharpName): Update to check for the string type and return
11042 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11045 2001-09-21 Ravi Pratap <ravi@ximian.com>
11047 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11048 (Invocation::BetterFunction): Implement.
11049 (Invocation::BetterConversion): Implement.
11050 (Invocation::ConversionExists): Skeleton, no implementation yet.
11052 Okay, things work fine !
11054 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11056 * typemanager.cs: declare and load enum_type, delegate_type and
11059 * expression.cs (Expression::Emit): Now emit returns a value that
11060 tells whether a value is left on the stack or not. This strategy
11061 might be reveted tomorrow with a mechanism that would address
11062 multiple assignments.
11063 (Expression::report118): Utility routine to report mismatches on
11066 (Unary::Report23): Report impossible type/operator combination
11069 (Unary::IsIncrementableNumber): Whether the type can be
11070 incremented or decremented with add.
11071 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11073 (Unary::ResolveOperator): Implement ++, !, ~,
11075 (Invocation::Emit): Deal with new Emit convetion.
11077 * All Expression derivatives: Updated their Emit method to return
11078 whether they leave values on the stack or not.
11080 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11081 stack for expressions that are statements.
11083 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11085 * expression.cs (LValue): New interface. Must be implemented by
11087 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11090 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11091 interface for generating code, simplifies the code.
11093 2001-09-20 Ravi Pratap <ravi@ximian.com>
11095 * expression.cs (everywhere): Comment out return statements in ::Resolve
11096 methods to avoid the warnings.
11098 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11100 * driver.cs (parse): Report error 2001 if we can not open the
11103 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11106 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11109 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11110 otherwise nested blocks end up with the same index.
11112 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11114 * expression.cs: Instead of having FIXMEs in the Resolve
11115 functions, throw exceptions so it is obvious that we are facing a
11118 * cs-parser.jay (invocation_expression): Pass Location information.
11120 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11121 Use a basename for those routines because .NET does not like paths
11124 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11127 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11129 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11130 are loading the correct data types (throws an exception if not).
11131 (TypeManager::InitCoreTypes): Use CoreLookupType
11133 * expression.cs (Unary::ResolveOperator): return the child
11134 expression for expressions which are just +expr.
11135 (Unary::ResolveOperator): Return negative literals for -LITERAL
11136 expressions (otherwise they are Unary {Literal}).
11137 (Invocation::Badness): Take into account `Implicit constant
11138 expression conversions'.
11140 * literal.cs (LongLiteral): Implement long literal class.
11141 (IntLiteral): export the `Value' of the intliteral.
11143 2001-09-19 Ravi Pratap <ravi@ximian.com>
11145 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11147 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11148 instead of 'Operator'
11150 * expression.cs (Binary::ResolveOperator): Update accordingly.
11151 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11154 * cs-parser.jay (unary_expression): Update to use the new names.
11156 * gen-treedump.cs (GetUnary): Same here.
11158 * expression.cs (Unary::Resolve): Implement.
11159 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11160 operators are found instead of making noise ;-)
11161 (Unary::ResolveOperator): New method to do precisely the same thing which
11162 Binary::ResolveOperator does for Binary expressions.
11163 (Unary.method, .Arguments): Add.
11164 (Unary::OperName): Implement.
11165 (Unary::ForceConversion): Copy and Paste !
11167 * class.cs (Operator::Define): Fix a small bug for the case when we have
11170 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11171 for the inbuilt operators. Only overloading works for now ;-)
11173 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11175 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11176 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11178 * expression.cs (This::Emit): Implement.
11179 (This::Resolve): Implement.
11180 (TypeOf:Resolve): Implement.
11181 (Expression::ResolveSimpleName): Add an implicit this to instance
11183 (MemberAccess::Resolve): Deal with Parameters and Fields.
11184 Bind instance variable to Field expressions.
11185 (FieldExpr::Instance): New field used to track the expression that
11186 represents the object instance.
11187 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11189 (FieldExpr::Emit): Implement.
11191 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11192 the last instruction contains a return opcode to avoid generating
11193 the last `ret' instruction (this generates correct code, and it is
11194 nice to pass the peverify output).
11196 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11197 initializer for static and instance variables.
11198 (Constructor::Emit): Allow initializer to be null in the case of
11199 static constructors. Only emit initializer for instance
11202 (TypeContainer::FindMembers): Return a null array if there are no
11205 Also fix the code for the MemberTypes.Method branch, as it was not
11206 scanning that for operators (or tried to access null variables before).
11208 * assign.cs (Assign::Emit): Handle instance and static fields.
11212 * driver.cs: Stop compilation if there are parse errors.
11214 * cs-parser.jay (constructor_declaration): Provide default base
11215 initializer for non-static constructors.
11216 (constructor_declarator): Do not provide a default base
11217 initializers if none was specified.
11218 Catch the fact that constructors should not have parameters.
11220 * class.cs: Do not emit parent class initializers for static
11221 constructors, that should be flagged as an error.
11223 2001-09-18 Ravi Pratap <ravi@ximian.com>
11225 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11226 Move back code into TypeContainer::Populate.
11228 2001-09-18 Ravi Pratap <ravi@ximian.com>
11230 * class.cs (TypeContainer::AddConstructor): Fix the check to
11231 compare against Name, not Basename.
11232 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11234 * cs-parser.jay : Update accordingly.
11236 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11237 for methods, don't forget to look into the operators too.
11238 (RegisterMethodBuilder): Helper method to take care of this for
11239 methods, constructors and operators.
11240 (Operator::Define): Completely revamp.
11241 (Operator.OperatorMethod, MethodName): New fields.
11242 (TypeContainer::Populate): Move the registering of builders into
11243 RegisterMethodBuilder.
11244 (Operator::Emit): Re-write.
11246 * expression.cs (Binary::Emit): Comment out code path to emit method
11247 invocation stuff for the case when we have a user defined operator. I am
11248 just not able to get it right !
11250 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11252 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11255 (Expression::MemberLookup): Provide a version that allows to
11256 specify the MemberTypes and BindingFlags.
11258 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11259 so it was not fetching variable information from outer blocks.
11261 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11262 Beforefieldinit as it was buggy.
11264 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11265 that Ravi put here.
11267 * class.cs (Constructor::Emit): Only emit if block is not null.
11268 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11269 deal with this by semantically definining it as if the user had
11272 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11273 constructors as we now "emit" them at a higher level.
11275 (TypeContainer::DefineDefaultConstructor): Used to define the
11276 default constructors if none was provided.
11278 (ConstructorInitializer): Add methods Resolve and Emit.
11280 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11282 2001-09-17 Ravi Pratap <ravi@ximian.com>
11284 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11285 the default constructor builder with our hashtable for methodbuilders
11288 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11289 and argument_count is 0 in which case we have a match.
11290 (Binary::ResolveOperator): More null checking and miscellaneous coding
11293 2001-09-17 Ravi Pratap <ravi@ximian.com>
11295 * rootcontext.cs (IsNameSpace): Compare against null.
11297 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11299 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11300 and Unary::Operator.
11302 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11305 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11306 we have overloaded operators.
11307 (Binary::ResolveOperator): Implement the part which does the operator overload
11310 * class.cs (Operator::Emit): Implement.
11311 (TypeContainer::Emit): Emit the operators we have too.
11313 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11314 the case when we have a user-defined operator.
11316 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11318 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11320 2001-09-16 Ravi Pratap <ravi@ximian.com>
11322 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11323 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11324 (Constructor::Emit): Implement.
11325 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11326 if we have no work to do.
11327 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11330 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11331 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11333 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11336 2001-09-15 Ravi Pratap <ravi@ximian.com>
11338 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11340 (Tree::RecordNamespace): Method to do what the name says ;-)
11341 (Tree::Namespaces): Property to get at the namespaces hashtable.
11343 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11346 * rootcontext.cs (IsNamespace): Fixed it :-)
11348 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11350 * class.cs (TypeContainer::FindMembers): Add support for
11352 (MethodCore): New class that encapsulates both the shared aspects
11353 of a Constructor and a Method.
11354 (Method, Constructor): Factored pieces into MethodCore.
11356 * driver.cs: Added --fatal which makes errors throw exceptions.
11357 Load System assembly as well as part of the standard library.
11359 * report.cs: Allow throwing exceptions on errors for debugging.
11361 * modifiers.cs: Do not use `parent', instead use the real type
11362 container to evaluate permission settings.
11364 * class.cs: Put Ravi's patch back in. He is right, and we will
11365 have to cope with the
11367 2001-09-14 Ravi Pratap <ravi@ximian.com>
11369 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11370 FamORAssem, not FamANDAssem.
11372 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11374 * driver.cs: Added --parse option that only parses its input files
11377 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11378 incorrect. IsTopLevel is not used to tell whether an object is
11379 root_types or not (that can be achieved by testing this ==
11380 root_types). But to see if this is a top-level *class* (not
11381 necessarly our "toplevel" container).
11383 2001-09-14 Ravi Pratap <ravi@ximian.com>
11385 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11386 parent instead of a direct call to GetType.
11388 2001-09-14 Ravi Pratap <ravi@ximian.com>
11390 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11391 Modifiers.TypeAttr. This should just be a call to that method.
11393 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11394 object so that we can determine if we are top-level or not.
11396 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11399 * enum.cs (Enum::Define): Ditto.
11401 * modifiers.cs (FieldAttr): Re-write.
11403 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11404 (TypeContainer::HaveStaticConstructor): New property to provide access
11405 to precisely that info.
11407 * modifiers.cs (MethodAttr): Re-write.
11408 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11410 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11411 of top-level types as claimed.
11413 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11415 * expression.cs (MemberLookup): Fruitless attempt to lookup
11416 constructors. Maybe I need to emit default constructors? That
11417 might be it (currently .NET emits this for me automatically).
11418 (Invocation::OverloadResolve): Cope with Arguments == null.
11419 (Invocation::EmitArguments): new function, shared by the new
11420 constructor and us.
11421 (Invocation::Emit): Handle static and instance methods. Emit
11422 proper call instruction for virtual or non-virtual invocations.
11423 (New::Emit): Implement.
11424 (New::Resolve): Implement.
11425 (MemberAccess:Resolve): Implement.
11426 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11427 to track instances.
11428 (FieldExpr::Resolve): Set type.
11430 * support.cs: Handle empty arguments.
11432 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11433 SimpleLookup): Auxiliary routines to help parse a qualifier
11436 Update qualifier_identifier rule.
11438 * codegen.cs: Removed debugging messages.
11440 * class.cs: Make this a global thing, this acts just as a "key" to
11441 objects that we might have around.
11443 (Populate): Only initialize method_builders_to_methods once.
11445 * expression.cs (PropertyExpr): Initialize type from the
11448 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11449 Resolve pattern. Attempt to implicitly convert value to boolean.
11452 * expression.cs: Set the type for the int32/int32 argument case.
11453 (Binary::ResolveOperator): Set the return type to boolean for
11454 comparission operators
11456 * typemanager.cs: Remove debugging print code.
11458 (Invocation::Resolve): resolve type.
11460 * class.cs: Allocate a MemberInfo of the correct size, as the code
11461 elsewhere depends on the test to reflect the correct contents.
11463 (Method::) Keep track of parameters, due to System.Reflection holes
11465 (TypeContainer::Populate): Keep track of MethodBuilders to Method
11468 (TypeContainer::FindMembers): Use ArrayList and then copy an array
11469 of the exact size and return that.
11471 (Class::LookupMethodByBuilder): New function that maps
11472 MethodBuilders to its methods. Required to locate the information
11473 on methods because System.Reflection bit us again.
11475 * support.cs: New file, contains an interface ParameterData and
11476 two implementations: ReflectionParameters and InternalParameters
11477 used to access Parameter information. We will need to grow this
11480 * expression.cs (Invocation::GetParameterData): implement a cache
11481 and a wrapper around the ParameterData creation for methods.
11482 (Invocation::OverloadResolve): Use new code.
11484 2001-09-13 Ravi Pratap <ravi@ximian.com>
11486 * class.cs (TypeContainer::EmitField): Remove and move into
11487 (Field::Define): here and modify accordingly.
11488 (Field.FieldBuilder): New member.
11489 (TypeContainer::Populate): Update accordingly.
11490 (TypeContainer::FindMembers): Implement.
11492 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11494 * statement.cs: (VariableInfo::VariableType): New field to be
11495 initialized with the full type once it is resolved.
11497 2001-09-12 Miguel de Icaza <miguel@ximian.com>
11499 * parameter.cs (GetParameterInfo): Use a type cache to compute
11500 things only once, and to reuse this information
11502 * expression.cs (LocalVariableReference::Emit): Implement.
11503 (OpcodeCast::Emit): fix.
11505 (ParameterReference::Resolve): Implement.
11506 (ParameterReference::Emit): Implement.
11508 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11509 that are expressions need to stay as Expressions.
11511 * typemanager.cs (CSharpName): Returns the C# name of a type if
11514 * expression.cs (Expression::ConvertImplicit): New function that
11515 implements implicit type conversions.
11517 (Expression::ImplicitReferenceConversion): Implements implicit
11518 reference conversions.
11520 (EmptyCast): New type for transparent casts.
11522 (OpcodeCast): New type for casts of types that are performed with
11523 a sequence of bytecodes.
11525 (BoxedCast): New type used for casting value types into reference
11526 types. Emits a box opcode.
11528 (Binary::DoNumericPromotions): Implements numeric promotions of
11529 and computation of the Binary::Type.
11531 (Binary::EmitBranchable): Optimization.
11533 (Binary::Emit): Implement code emission for expressions.
11535 * typemanager.cs (TypeManager): Added two new core types: sbyte
11538 2001-09-12 Ravi Pratap <ravi@ximian.com>
11540 * class.cs (TypeContainer::FindMembers): Method which does exactly
11541 what Type.FindMembers does, only we don't have to use reflection. No
11542 implementation yet.
11544 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11545 typecontainer objects as we need to get at them.
11546 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11548 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11549 typecontainer object.
11551 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11552 of just a Report object.
11554 2001-09-11 Ravi Pratap <ravi@ximian.com>
11556 * class.cs (Event::Define): Go back to using the prefixes "add_" and
11558 (TypeContainer::Populate): Now define the delegates of the type too.
11559 (TypeContainer.Delegates): Property to access the list of delegates defined
11562 * delegates.cs (Delegate::Define): Implement partially.
11564 * modifiers.cs (TypeAttr): Handle more flags.
11566 2001-09-11 Ravi Pratap <ravi@ximian.com>
11568 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11570 (Operator::Define): Re-write logic to get types by using the LookupType method
11571 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11572 (Indexer::Define): Ditto.
11573 (Event::Define): Ditto.
11574 (Property::Define): Ditto.
11576 2001-09-10 Ravi Pratap <ravi@ximian.com>
11578 * class.cs (TypeContainer::Populate): Now define operators too.
11579 (TypeContainer.Operators): New property to access the list of operators
11581 (Operator.OperatorMethodBuilder): New member to hold the method builder
11582 for the operator we are defining.
11583 (Operator::Define): Implement.
11585 2001-09-10 Ravi Pratap <ravi@ximian.com>
11587 * class.cs (Event::Define): Make the prefixes of the accessor methods
11588 addOn_ and removeOn_
11590 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11591 of the location being passed in too. Ideally, this should go later since all
11592 error reporting should be done through the Report object.
11594 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11595 (Populate): Iterate thru the indexers we have and define them too.
11596 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11597 for the get and set accessors.
11598 (Indexer::Define): Implement.
11600 2001-09-09 Miguel de Icaza <miguel@ximian.com>
11602 * expression.cs (Binary::Resolve): Beginning of it. I scratched
11603 my previous implementation, did not work.
11605 * typemanager.cs: Add a couple of missing types (the longs).
11607 * literal.cs: Use TypeManager.bool_type instead of getting it.
11609 * expression.cs (EventExpr): New kind of expressions.
11610 (Expressio::ExprClassFromMemberInfo): finish
11612 2001-09-08 Miguel de Icaza <miguel@ximian.com>
11614 * assign.cs: Emit stores to static fields differently.
11616 2001-09-08 Ravi Pratap <ravi@ximian.com>
11618 * Merge in changes and adjust code to tackle conflicts. Backed out my
11619 code in Assign::Resolve ;-)
11621 2001-09-08 Ravi Pratap <ravi@ximian.com>
11623 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11624 instead Report.Error and also pass in the location.
11625 (CSharpParser::Lexer): New readonly property to return the reference
11626 to the Tokenizer object.
11627 (declare_local_variables): Use Report.Error with location instead of plain
11631 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11632 (Operator.CheckBinaryOperator): Ditto.
11634 * cs-parser.jay (operator_declarator): Update accordingly.
11636 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11637 (CheckBinaryOperator): Same here.
11639 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11640 on the name without any prefixes of namespace names etc. This is because we
11641 already might have something already fully qualified like
11642 'System.Console.WriteLine'
11644 * assign.cs (Resolve): Begin implementation. Stuck ;-)
11646 2001-09-07 Ravi Pratap <ravi@ximian.com>
11648 * cs-tokenizer.cs (location): Return a string which also contains
11651 * expression.cs (ElementAccess): New class for expressions of the
11652 type 'element access.'
11653 (BaseAccess): New class for expressions of the type 'base access.'
11654 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11657 * cs-parser.jay (element_access): Implement action.
11658 (base_access): Implement actions.
11659 (checked_expression, unchecked_expression): Implement.
11661 * cs-parser.jay (local_variable_type): Correct and implement.
11662 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11664 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11666 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11667 name and the specifiers.
11669 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11671 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
11672 making them all public ;-)
11674 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11677 2001-09-07 Miguel de Icaza <miguel@ximian.com>
11679 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11681 (FieldExpr, PropertyExprs): New resolved expressions.
11682 (SimpleName::MemberStaticCheck): Perform static checks for access
11683 to non-static fields on static methods. Maybe this should be
11684 generalized for MemberAccesses.
11685 (SimpleName::ResolveSimpleName): More work on simple name
11688 * cs-parser.jay (primary_expression/qualified_identifier): track
11689 the parameter index.
11691 * codegen.cs (CodeGen::Save): Catch save exception, report error.
11692 (EmitContext::EmitBoolExpression): Chain to expression generation
11693 instead of temporary hack.
11694 (::EmitStatementExpression): Put generic expression code generation.
11696 * assign.cs (Assign::Emit): Implement variable assignments to
11697 local variables, parameters and fields.
11699 2001-09-06 Miguel de Icaza <miguel@ximian.com>
11701 * statement.cs (Block::GetVariableInfo): New method, returns the
11702 VariableInfo for a variable name in a block.
11703 (Block::GetVariableType): Implement in terms of GetVariableInfo
11705 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
11706 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
11708 2001-09-06 Ravi Pratap <ravi@ximian.com>
11710 * cs-parser.jay (operator_declaration): Continue on my quest : update
11711 to take attributes argument.
11712 (event_declaration): Ditto.
11713 (enum_declaration): Ditto.
11714 (indexer_declaration): Ditto.
11716 * class.cs (Operator::Operator): Update constructor accordingly.
11717 (Event::Event): Ditto.
11719 * delegate.cs (Delegate::Delegate): Same here.
11721 * enum.cs (Enum::Enum): Same here.
11723 2001-09-05 Ravi Pratap <ravi@ximian.com>
11725 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
11727 * ../tests/cs0658.cs : New file to demonstrate error 0658.
11729 * attribute.cs (Attributes): New class to encapsulate all attributes which were
11730 being passed around as an arraylist.
11731 (Attributes::AddAttribute): Method to add attribute sections.
11733 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
11734 (struct_declaration): Update accordingly.
11735 (constant_declaration): Update.
11736 (field_declaration): Update.
11737 (method_header): Update.
11738 (fixed_parameter): Update.
11739 (parameter_array): Ditto.
11740 (property_declaration): Ditto.
11741 (destructor_declaration): Ditto.
11743 * class.cs (Struct::Struct): Update constructors accordingly.
11744 (Class::Class): Ditto.
11745 (Field::Field): Ditto.
11746 (Method::Method): Ditto.
11747 (Property::Property): Ditto.
11748 (TypeContainer::OptAttribute): update property's return type.
11750 * interface.cs (Interface.opt_attributes): New member.
11751 (Interface::Interface): Update to take the extra Attributes argument.
11753 * parameter.cs (Parameter::Parameter): Ditto.
11755 * constant.cs (Constant::Constant): Ditto.
11757 * interface.cs (InterfaceMemberBase): New OptAttributes field.
11758 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
11759 the attributes as a parameter.
11760 (InterfaceProperty): Update constructor call.
11761 (InterfaceEvent): Ditto.
11762 (InterfaceMethod): Ditto.
11763 (InterfaceIndexer): Ditto.
11765 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
11766 pass the attributes too.
11767 (interface_event_declaration): Ditto.
11768 (interface_property_declaration): Ditto.
11769 (interface_method_declaration): Ditto.
11770 (interface_declaration): Ditto.
11772 2001-09-05 Miguel de Icaza <miguel@ximian.com>
11774 * class.cs (Method::Define): Track the "static Main" definition to
11775 create an entry point.
11777 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11778 EntryPoint if we find it.
11780 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11781 (EmitContext::ig): Make this variable public.
11783 * driver.cs: Make the default output file be the first file name
11784 with the .exe extension.
11786 Detect empty compilations
11788 Handle various kinds of output targets. Handle --target and
11789 rename -t to --dumper.
11791 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11792 methods inherited from Expression return now an Expression. This
11793 will is used during the tree rewriting as we resolve them during
11796 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11797 the spec. Missing entirely is the information about
11798 accessability of elements of it.
11800 (Expression::ExprClassFromMemberInfo): New constructor for
11801 Expressions that creates a fully initialized Expression based on
11802 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11805 (Invocation::Resolve): Begin implementing resolution of invocations.
11807 * literal.cs (StringLiteral): Implement Emit.
11809 2001-09-05 Ravi Pratap <ravi@ximian.com>
11811 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
11814 2001-09-04 Ravi Pratap <ravi@ximian.com>
11816 * cs-parser.jay (attribute_arguments): Implement actions.
11817 (attribute): Fix bug in production. Implement action.
11818 (attribute_list): Implement.
11819 (attribute_target): Implement.
11820 (attribute_target_specifier, opt_target_specifier): Implement
11821 (CheckAttributeTarget): New method to check if the attribute target
11823 (attribute_section): Implement.
11824 (opt_attributes): Implement.
11826 * attribute.cs : New file to handle attributes.
11827 (Attribute): Class to hold attribute info.
11829 * cs-parser.jay (opt_attribute_target_specifier): Remove production
11830 (attribute_section): Modify production to use 2 different rules to
11831 achieve the same thing. 1 s/r conflict down !
11832 Clean out commented, useless, non-reducing dimension_separator rules.
11834 * class.cs (TypeContainer.attributes): New member to hold list
11835 of attributes for a type.
11836 (Struct::Struct): Modify to take one more argument, the attribute list.
11837 (Class::Class): Ditto.
11838 (Field::Field): Ditto.
11839 (Method::Method): Ditto.
11840 (Property::Property): Ditto.
11842 * cs-parser.jay (struct_declaration): Update constructor call to
11843 pass in the attributes too.
11844 (class_declaration): Ditto.
11845 (constant_declaration): Ditto.
11846 (field_declaration): Ditto.
11847 (method_header): Ditto.
11848 (fixed_parameter): Ditto.
11849 (parameter_array): Ditto.
11850 (property_declaration): Ditto.
11852 * constant.cs (Constant::Constant): Update constructor similarly.
11853 Use System.Collections.
11855 * parameter.cs (Parameter::Parameter): Update as above.
11857 2001-09-02 Ravi Pratap <ravi@ximian.com>
11859 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
11860 (TypeContainer.delegates): New member to hold list of delegates.
11862 * cs-parser.jay (delegate_declaration): Implement the action correctly
11863 this time as I seem to be on crack ;-)
11865 2001-09-02 Miguel de Icaza <miguel@ximian.com>
11867 * rootcontext.cs (RootContext::IsNamespace): new function, used to
11868 tell whether an identifier represents a namespace.
11870 * expression.cs (NamespaceExpr): A namespace expression, used only
11871 temporarly during expression resolution.
11872 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
11873 utility functions to resolve names on expressions.
11875 2001-09-01 Miguel de Icaza <miguel@ximian.com>
11877 * codegen.cs: Add hook for StatementExpressions.
11879 * class.cs: Fix inverted test for static flag in methods.
11881 2001-09-02 Ravi Pratap <ravi@ximian.com>
11883 * class.cs (Operator::CheckUnaryOperator): Correct error number used
11884 to make it coincide with MS' number.
11885 (Operator::CheckBinaryOperator): Ditto.
11887 * ../errors/errors.txt : Remove error numbers added earlier.
11889 * ../errors/cs1019.cs : Test case for error # 1019
11891 * ../errros/cs1020.cs : Test case for error # 1020
11893 * cs-parser.jay : Clean out commented cruft.
11894 (dimension_separators, dimension_separator): Comment out. Ostensibly not
11895 used anywhere - non-reducing rule.
11896 (namespace_declarations): Non-reducing rule - comment out.
11898 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
11899 with TypeContainer::AddEnum.
11901 * delegate.cs : New file for delegate handling classes.
11902 (Delegate): Class for declaring delegates.
11904 * makefile : Update.
11906 * cs-parser.jay (delegate_declaration): Implement.
11908 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
11910 * class.cs (Event::Define): Implement.
11911 (Event.EventBuilder): New member.
11913 * class.cs (TypeContainer::Populate): Update to define all enums and events
11915 (Events): New property for the events arraylist we hold. Shouldn't we move to using
11916 readonly fields for all these cases ?
11918 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
11920 * class.cs (Property): Revamp to use the convention of making fields readonly.
11921 Accordingly modify code elsewhere.
11923 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
11924 the Define method of the Property class.
11926 * class.cs : Clean up applied patch and update references to variables etc. Fix
11928 (TypeContainer::Populate): Update to define all the properties we have. Also
11929 define all enumerations.
11931 * enum.cs (Define): Implement.
11933 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
11935 * cs-parser.jay (overloadable_operator): The semantic value is an
11936 enum of the Operator class.
11937 (operator_declarator): Implement actions.
11938 (operator_declaration): Implement.
11940 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
11941 validity of definitions.
11942 (Operator::CheckBinaryOperator): Static method to check for binary operators
11943 (TypeContainer::AddOperator): New method to add an operator to a type.
11945 * cs-parser.jay (indexer_declaration): Added line to actually call the
11946 AddIndexer method so it gets added ;-)
11948 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
11949 already taken care of by the MS compiler ?
11951 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
11953 * class.cs (Operator): New class for operator declarations.
11954 (Operator::OpType): Enum for the various operators.
11956 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
11958 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
11959 ostensibly handle this in semantic analysis.
11961 * cs-parser.jay (general_catch_clause): Comment out
11962 (specific_catch_clauses, specific_catch_clause): Ditto.
11963 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
11964 (catch_args, opt_catch_args): New productions.
11965 (catch_clause): Rewrite to use the new productions above
11966 (catch_clauses): Modify accordingly.
11967 (opt_catch_clauses): New production to use in try_statement
11968 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
11969 and re-write the code in the actions to extract the specific and
11970 general catch clauses by being a little smart ;-)
11972 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
11973 Hooray, try and catch statements parse fine !
11975 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11977 * statement.cs (Block::GetVariableType): Fix logic to extract the type
11978 string from the hashtable of variables.
11980 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11981 I end up making that mistake ;-)
11982 (catch_clauses): Fixed gross error which made Key and Value of the
11983 DictionaryEntry the same : $1 !!
11985 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11987 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11989 * cs-parser.jay (event_declaration): Correct to remove the semicolon
11990 when the add and remove accessors are specified.
11992 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11994 * cs-parser.jay (IndexerDeclaration): New helper class to hold
11995 information about indexer_declarator.
11996 (indexer_declarator): Implement actions.
11997 (parsing_indexer): New local boolean used to keep track of whether
11998 we are parsing indexers or properties. This is necessary because
11999 implicit_parameters come into picture even for the get accessor in the
12000 case of an indexer.
12001 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12003 * class.cs (Indexer): New class for indexer declarations.
12004 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12005 (TypeContainer::indexers): New member to hold list of indexers for the
12008 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12010 * cs-parser.jay (add_accessor_declaration): Implement action.
12011 (remove_accessor_declaration): Implement action.
12012 (event_accessors_declaration): Implement
12013 (variable_declarators): swap statements for first rule - trivial.
12015 * class.cs (Event): New class to hold information about event
12017 (TypeContainer::AddEvent): New method to add an event to a type
12018 (TypeContainer::events): New member to hold list of events.
12020 * cs-parser.jay (event_declaration): Implement actions.
12022 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12024 * cs-parser.jay (dim_separators): Implement. Make it a string
12025 concatenating all the commas together, just as they appear.
12026 (opt_dim_separators): Modify accordingly
12027 (rank_specifiers): Update accordingly. Basically do the same
12028 thing - instead, collect the brackets here.
12029 (opt_rank_sepcifiers): Modify accordingly.
12030 (array_type): Modify to actually return the complete type string
12031 instead of ignoring the rank_specifiers.
12032 (expression_list): Implement to collect the expressions
12033 (variable_initializer): Implement. We make it a list of expressions
12034 essentially so that we can handle the array_initializer case neatly too.
12035 (variable_initializer_list): Implement.
12036 (array_initializer): Make it a list of variable_initializers
12037 (opt_array_initializer): Modify accordingly.
12039 * expression.cs (New::NType): Add enumeration to help us
12040 keep track of whether we have an object/delegate creation
12041 or an array creation.
12042 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12043 members to hold data about array creation.
12044 (New:New): Modify to update NewType
12045 (New:New): New Overloaded contructor for the array creation
12048 * cs-parser.jay (array_creation_expression): Implement to call
12049 the overloaded New constructor.
12051 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12053 * class.cs (TypeContainer::Constructors): Return member
12054 constructors instead of returning null.
12056 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12058 * typemanager.cs (InitCoreTypes): Initialize the various core
12059 types after we have populated the type manager with the user
12060 defined types (this distinction will be important later while
12061 compiling corlib.dll)
12063 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12064 on Expression Classification. Now all expressions have a method
12065 `Resolve' and a method `Emit'.
12067 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12068 generation from working. Also add some temporary debugging
12071 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12073 * codegen.cs: Lots of code generation pieces. This is only the
12074 beginning, will continue tomorrow with more touches of polish. We
12075 handle the fundamentals of if, while, do, for, return. Others are
12076 trickier and I need to start working on invocations soon.
12078 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12081 * codegen.cs (EmitContext): New struct, used during code
12082 emission to keep a context. Most of the code generation will be
12085 * cs-parser.jay: Add embedded blocks to the list of statements of
12086 this block. So code generation proceeds in a top down fashion.
12088 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12090 * statement.cs: Add support for multiple child blocks.
12092 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12094 * codegen.cs (EmitCode): New function, will emit the code for a
12095 Block of code given a TypeContainer and its ILGenerator.
12097 * statement.cs (Block): Standard public readonly optimization.
12098 (Block::Block constructors): Link children.
12099 (Block::Child): Child Linker.
12100 (Block::EmitVariables): Emits IL variable declarations.
12102 * class.cs: Drop support for MethodGroups here, delay until
12104 (Method::): Applied the same simplification that I did before, and
12105 move from Properties to public readonly fields.
12106 (Method::ParameterTypes): Returns the parameter types for the
12107 function, and implements a cache that will be useful later when I
12108 do error checking and the semantic analysis on the methods is
12110 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12111 and made a method, optional argument tells whether this is a class
12112 or a structure to apply the `has-this' bit.
12113 (Method::GetCallingConvention): Implement, returns the calling
12115 (Method::Define): Defines the type, a second pass is performed
12116 later to populate the methods.
12118 (Constructor::ParameterTypes): implement a cache similar to the
12119 one on Method::ParameterTypes, useful later when we do semantic
12122 (TypeContainer::EmitMethod): New method. Emits methods.
12124 * expression.cs: Removed MethodGroup class from here.
12126 * parameter.cs (Parameters::GetCallingConvention): new method.
12128 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12130 * class.cs (TypeContainer::Populate): Drop RootContext from the
12133 (Constructor::CallingConvention): Returns the calling convention.
12134 (Constructor::ParameterTypes): Returns the constructor parameter
12137 (TypeContainer::AddConstructor): Keep track of default constructor
12138 and the default static constructor.
12140 (Constructor::) Another class that starts using `public readonly'
12141 instead of properties.
12143 (Constructor::IsDefault): Whether this is a default constructor.
12145 (Field::) use readonly public fields instead of properties also.
12147 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12148 track of static constructors; If none is used, turn on
12149 BeforeFieldInit in the TypeAttributes.
12151 * cs-parser.jay (opt_argument_list): now the return can be null
12152 for the cases where there are no arguments.
12154 (constructor_declarator): If there is no implicit `base' or
12155 `this', then invoke the default parent constructor.
12157 * modifiers.cs (MethodAttr): New static function maps a set of
12158 modifiers flags into a MethodAttributes enum
12159 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12160 MethodAttr, TypeAttr to represent the various mappings where the
12161 modifiers are used.
12162 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12164 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12166 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12169 * interface.cs (PopulateIndexer): Implemented the code generator
12170 for interface indexers.
12172 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12174 * interface.cs (InterfaceMemberBase): Now we track the new status
12177 (PopulateProperty): Implement property population. Woohoo! Got
12178 Methods and Properties going today.
12180 Removed all the properties for interfaces, and replaced them with
12181 `public readonly' fields.
12183 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12185 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12186 initialize their hashtables/arraylists only when they are needed
12187 instead of doing this always.
12189 * parameter.cs: Handle refs and out parameters.
12191 * cs-parser.jay: Use an ArrayList to construct the arguments
12192 instead of the ParameterCollection, and then cast that to a
12195 * parameter.cs: Drop the use of ParameterCollection and use
12196 instead arrays of Parameters.
12198 (GetParameterInfo): Use the Type, not the Name when resolving
12201 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12203 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12204 and instead use public readonly fields.
12206 * class.cs: Put back walking code for type containers.
12208 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12210 * class.cs (MakeConstant): Code to define constants.
12212 * rootcontext.cs (LookupType): New function. Used to locate types
12215 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12217 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12218 this System.Reflection code is. Kudos to Microsoft
12220 * typemanager.cs: Implement a type cache and avoid loading all
12221 types at boot time. Wrap in LookupType the internals. This made
12222 the compiler so much faster. Wow. I rule!
12224 * driver.cs: Make sure we always load mscorlib first (for
12225 debugging purposes, nothing really important).
12227 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12228 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12230 * rootcontext.cs: Lookup types on their namespace; Lookup types
12231 on namespaces that have been imported using the `using' keyword.
12233 * class.cs (TypeContainer::TypeAttr): Virtualize.
12234 (Class::TypeAttr): Return attributes suitable for this bad boy.
12235 (Struct::TypeAttr): ditto.
12236 Handle nested classes.
12237 (TypeContainer::) Remove all the type visiting code, it is now
12238 replaced with the rootcontext.cs code
12240 * rootcontext.cs (GetClassBases): Added support for structs.
12242 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12244 * interface.cs, statement.cs, class.cs, parameter.cs,
12245 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12246 Drop use of TypeRefs, and use strings instead.
12248 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12252 * class.cs (Struct::Struct): set the SEALED flags after
12253 checking the modifiers.
12254 (TypeContainer::TypeAttr): new property, returns the
12255 TypeAttributes for a class.
12257 * cs-parser.jay (type_list): Oops, list production was creating a
12258 new list of base types.
12260 * rootcontext.cs (StdLib): New property.
12261 (GetInterfaceTypeByName): returns an interface by type name, and
12262 encapsulates error handling here.
12263 (GetInterfaces): simplified.
12264 (ResolveTree): Encapsulated all the tree resolution here.
12265 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12268 * driver.cs: Add support for --nostdlib, to avoid loading the
12269 default assemblies.
12270 (Main): Do not put tree resolution here.
12272 * rootcontext.cs: Beginning of the class resolution.
12274 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12276 * rootcontext.cs: Provide better error reporting.
12278 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12280 * rootcontext.cs (CreateInterface): Handle the case where there
12281 are no parent interfaces.
12283 (CloseTypes): Routine to flush types at the end.
12284 (CreateInterface): Track types.
12285 (GetInterfaces): Returns an array of Types from the list of
12286 defined interfaces.
12288 * typemanager.c (AddUserType): Mechanism to track user types (puts
12289 the type on the global type hash, and allows us to close it at the
12292 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12294 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12295 RecordInterface instead.
12297 * cs-parser.jay: Updated to reflect changes above.
12299 * decl.cs (Definition): Keep track of the TypeBuilder type that
12300 represents this type here. Not sure we will use it in the long
12301 run, but wont hurt for now.
12303 * driver.cs: Smaller changes to accomodate the new code.
12305 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12308 * rootcontext.cs (CreateInterface): New method, used to create
12309 the System.TypeBuilder type for interfaces.
12310 (ResolveInterfaces): new entry point to resolve the interface
12312 (CodeGen): Property, used to keep track of the code generator.
12314 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12316 * cs-parser.jay: Add a second production for delegate_declaration
12319 (enum_body): Put an opt_comma here instead of putting it on
12320 enum_body or enum_member_declarations so we can handle trailing
12321 commas on enumeration members. Gets rid of a shift/reduce.
12323 (type_list): Need a COMMA in the middle.
12325 (indexer_declaration): Tell tokenizer to recognize get/set
12327 * Remove old targets.
12329 * Re-add the parser target.
12331 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12333 * cs-parser.jay: Add precendence rules for a number of operators
12334 ot reduce the number of shift/reduce conflicts in the grammar.
12336 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12338 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12341 Get rid of old crufty code.
12343 * rootcontext.cs: Use this to keep track of the parsed
12344 representation and the defined types available to the program.
12346 * gen-treedump.cs: adjust for new convention.
12348 * type.cs: Split out the type manager, and the assembly builder
12351 * typemanager.cs: the type manager will live here now.
12353 * cil-codegen.cs: And the code generator here.
12355 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12357 * makefile: Fixed up for easy making.
12359 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12361 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12364 (unary_expression): Expand pre_increment_expression and
12365 post_decrement_expression to reduce a shift/reduce.
12367 2001-07-11 Simon Cozens
12369 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12371 Improve allow_keyword_as_indent name.
12373 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12375 * Adjustments for Beta2.
12377 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12379 * decl.cs: Added `Define' abstract method.
12380 (InTransit): new property, used to catch recursive definitions.
12382 * interface.cs: Implement `Define'.
12384 * modifiers.cs: Map Modifiers.constants to
12385 System.Reflection.TypeAttribute flags.
12387 * class.cs: Keep track of types and user-defined types.
12388 (BuilderInit): New method for creating an assembly
12389 (ResolveType): New function to launch the resolution process, only
12390 used by interfaces for now.
12392 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12393 that are inserted into the name space.
12395 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12397 * ARGH. I have screwed up my tree so many times due to the use of
12398 rsync rather than using CVS. Going to fix this at once.
12400 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12403 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12405 * Experiment successful: Use System.Type rather that our own
12408 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12410 * cs-parser.jay: Removed nsAliases from here.
12412 Use new namespaces, handle `using XXX;'
12414 * namespace.cs: Reimplemented namespace handling, use a recursive
12415 definition of the class. Now we can keep track of using clauses
12416 and catch invalid using clauses.
12418 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12420 * gen-treedump.cs: Adapted for all the renaming.
12422 * expression.cs (Expression): this class now has a Type property
12423 which returns an expression Type.
12425 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12426 `Type', as this has a different meaning now in the base
12428 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12430 * interface.cs, class.cs: Removed from all the sources the
12431 references to signature computation, as we can not do method
12432 signature computation during the parsing time, as we are not
12433 trying to solve at that point distinguishing:
12437 void a (NS.Blah x) {}
12440 Which depending on the context might be valid or not, as we do not
12441 know if Blah is the same thing as NS.Blah at that point.
12443 * Redid everything so the code uses TypeRefs now instead of
12444 Types. TypeRefs are just temporary type placeholders, that need
12445 to be resolved. They initially have a pointer to a string and the
12446 current scope in which they are used. This is used later by the
12447 compiler to resolve the reference to an actual Type.
12449 * DeclSpace is no longer a CIR.Type, and neither are
12450 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12451 are all DeclSpaces, but no Types.
12453 * type.cs (TypeRefManager): This implements the TypeRef manager,
12454 which keeps track of all the types that need to be resolved after
12455 the parsing has finished.
12457 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12459 * ARGH. We are going to have to store `foreach' as a class rather
12460 than resolving it, as we need to verify error 1579 after name
12461 resolution. *OR* we could keep a flag that says `This request to
12462 IEnumerator comes from a foreach statement' which we can then use
12463 to generate the error.
12465 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12467 * class.cs (TypeContainer.AddMethod): we now add methods to the
12468 MethodGroup instead of the method hashtable.
12470 * expression.cs: Add MethodGroup abstraction, which gets us one
12471 step closer to the specification in the way we handle method
12474 * cs-parser.jay (primary_expression): qualified_identifier now
12475 tried to match up an identifier to a local variable reference or
12476 to a parameter reference.
12478 current_local_parameters is now a parser global variable that
12479 points to the current parameters for the block, used during name
12482 (property_declaration): Now creates an implicit `value' argument to
12485 2001-05-09 Miguel de Icaza <miguel@ximian.com>
12487 * parameter.cs: Do not use `param' arguments as part of the
12488 signature, per the spec.
12490 2001-05-08 Miguel de Icaza <miguel@ximian.com>
12492 * decl.cs: Base class for classes, structs and interfaces. This
12493 is the "Declaration Space"
12495 * cs-parser.jay: Use CheckDef for checking declaration errors
12496 instead of having one on each function.
12498 * class.cs: Factor out some code for handling error handling in
12499 accordance to the "Declarations" section in the "Basic Concepts"
12500 chapter in the ECMA C# spec.
12502 * interface.cs: Make all interface member classes derive from
12503 InterfaceMemberBase.
12505 2001-05-07 Miguel de Icaza <miguel@ximian.com>
12507 * Many things: all interfaces are parsed and generated in
12508 gen-treedump. Support for member variables, constructors,
12509 destructors, properties, constants is there.
12511 Beginning of the IL backend, but very little done, just there for
12514 2001-04-29 Miguel de Icaza <miguel@ximian.com>
12516 * cs-parser.jay: Fix labeled statement.
12518 * cs-tokenizer.cs (escape): Escape " and ' always.
12519 ref_line, ref_name: keep track of the line/filename as instructed
12520 by #line by the compiler.
12523 2001-04-27 Miguel de Icaza <miguel@ximian.com>
12525 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12526 to match the values in System.CodeDOM.
12528 Divid renamed to Divide.
12530 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12532 (Statements.set): remove.
12534 * System.CodeDOM/CodeCatchClause.cs: always have a valid
12537 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12538 falseStatements always have valid values.
12540 * cs-parser.jay: Use System.CodeDOM now.