1 2003-08-28 Martin Baulig <martin@ximian.com>
3 * sample-stack.il: Compile this with ilasm: "ilasm /dll
6 * sample-hello.cs: Compile this with gmcs: "gmcs
7 /r:sample-stack.dll sample-hello.cs".
9 2003-08-28 Martin Baulig <martin@ximian.com>
11 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
12 the parameters to the generic type.
14 2003-08-28 Martin Baulig <martin@ximian.com>
16 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
18 2003-08-28 Martin Baulig <martin@ximian.com>
20 * cs-parser.jay (opt_type_argument_list): Use
21 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
22 (primary_expression): Replace `qualified_identifier' with `type_name'.
23 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
25 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
26 parser to check whether it is syntactically a type parameter list;
27 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
30 2003-08-26 Martin Baulig <martin@ximian.com>
32 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
33 resolving aliases; fixes #47927.
35 2003-08-26 Martin Baulig <martin@ximian.com>
37 * statement.cs (Using.DoResolve): This is internally emitting a
38 try/finally clause, so we need to set ec.NeedExplicitReturn if we
39 do not always return. Fixes #47681.
41 2003-08-26 Martin Baulig <martin@ximian.com>
43 * decl.cs (MemberCore): Moved WarningNotHiding(),
44 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
46 (AdditionResult): Make this nested in DeclSpace.
47 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
48 argument; call NamespaceEntry.Define() unless we're nested in a
51 * namespace.cs (Namespace.DefineName): New public function. This
52 is called from DeclSpace's .ctor to add
53 (Namespace.Lookup): Include DeclSpaces in the lookup.
55 * class.cs (Operator): Derive from MemberBase, not MemberCore.
57 * const.cs (Const): Derive from MemberBase, not MemberCore.
59 2003-08-25 Martin Baulig <martin@ximian.com>
61 * convert.cs (Convert.ExplicitReferenceConversion): When
62 converting from an interface type to a class, unbox if the target
63 type is a struct type. Fixes #47822.
65 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
67 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
70 2003-08-22 Martin Baulig <martin@ximian.com>
72 * class.cs (TypeManager.DefineType): When defining a nested type,
73 call DefineType() on our parent; fixes #47801.
75 2003-08-22 Martin Baulig <martin@ximian.com>
77 * class.cs (MethodData.Define): While checking if a method is an
78 interface implementation, improve the test a bit more to fix #47654.
80 2003-08-22 Martin Baulig <martin@ximian.com>
82 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
83 correctly; fixes #47722.
85 2003-08-22 Martin Baulig <martin@ximian.com>
87 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
88 LocalVariableReference, ensure it's not read-only. Fixes #47536.
90 * statement.cs (Fixed.DoResolve): Make all variables read-only.
92 2003-08-22 Martin Baulig <martin@ximian.com>
94 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
95 can only be assigned in static constructors. Fixes #47161.
97 2003-08-22 Martin Baulig <martin@ximian.com>
99 Rewrote and improved the flow analysis code.
101 * flowbranching.cs (FlowBranching): Make this class abstract.
102 (FlowBranching.CreateBranching): New static function to create a
104 (FlowBranchingBlock, FlowBranchingException): New classes.
105 (FlowBranching.UsageVector.Type): New public readonly field.
106 (FlowBranching.UsageVector.Breaks): Removed the setter.
107 (FlowBranching.UsageVector.Returns): Removed the setter.
108 (FlowBranching.UsageVector): Added Break(), Return(),
109 NeverReachable() and Throw() methods to modify the reachability.
110 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
111 done by FlowBranching.Merge().
112 (FlowBranching.UsageVector.MergeChild): New method; merges the
113 merge result into the current vector.
114 (FlowBranching.Merge): New abstract method to merge a branching.
116 2003-08-12 Martin Baulig <martin@ximian.com>
118 * expression.cs (Indirection.CacheTemporaries): Create the
119 LocalTemporary with the pointer type, not its element type.
121 2003-08-10 Miguel de Icaza <miguel@ximian.com>
123 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
124 token was a keyword or not.
126 Add `error' options where an IDENTIFIER was expected; Provide
127 CheckToken and CheckIdentifierToken convenience error reporting
130 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
132 * decl.cs: Rename `NamespaceEntry Namespace' public field into
133 NameSpaceEntry NameSpaceEntry.
135 (LookupInterfaceOrClass): Avoid creating a full qualified name
136 from namespace and name: avoid doing lookups when we know the
137 namespace is non-existant. Use new Tree.LookupByNamespace which
138 looks up DeclSpaces based on their namespace, name pair.
140 * driver.cs: Provide a new `parser verbose' to display the
141 exception thrown during parsing. This is turned off by default
142 now, so the output of a failure from mcs is more graceful.
144 * namespace.cs: Track all the namespaces defined in a hashtable
147 (IsNamespace): New method
149 2003-08-09 Miguel de Icaza <miguel@ximian.com>
151 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
152 we know that we need to concatenate (full typename can never be
157 * statement.cs: Use a bitfield; Do not initialize to null things
158 which are done by the constructor by default.
160 * cs-parser.jay: bug fix, parameter was 4, not 3.
162 * expression.cs: Just use the property;
164 * statement.cs: No need for GetVariableInfo method.
166 2003-08-08 Martin Baulig <martin@ximian.com>
168 * flowanalysis.cs (FlowReturns): This is now nested in the
169 `FlowBranching' class.
170 (MyBitVector): Moved this here from statement.cs.
171 (FlowBranching.SiblingType): New enum type.
172 (FlowBranching.CreateSibling): Added `SiblingType' argument.
174 2003-08-07 Martin Baulig <martin@ximian.com>
176 * flowanalysis.cs (FlowBranchingType): This is now nested in the
177 `FlowBranching' class and called `BranchingType'.
179 2003-08-07 Martin Baulig <martin@ximian.com>
181 * flowanalysis.cs: Moved all the control flow analysis code into
184 2003-08-07 Martin Baulig <martin@ximian.com>
186 * assign.cs (Assign.DoResolve): `target' must either be an
187 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
190 2003-08-07 Miguel de Icaza <miguel@ximian.com>
192 * expression.cs (BinaryMethod): This kind of expression is created by the
193 Binary class if it determines that the operator has to be handled
196 (BinaryDelegate): This kind of expression is created if we are
197 dealing with a + or - operator on delegates.
199 (Binary): remove method, argumetns, and DelegateOperator: when
200 dealing with methods,
202 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
204 * statement.cs (Block): use bitfields for the three extra booleans
205 we had in use. Remove unused topblock parameter.
207 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
209 * assign.cs: Drop extra unneeded tests.
211 2003-08-06 Miguel de Icaza <miguel@ximian.com>
213 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
215 * statement.cs (Foreach): Use VariableStorage instead of
218 * codegen.cs (VariableStorage): New class used by clients that
219 require a variable stored: locals or fields for variables that
220 need to live across yield.
222 Maybe provide a convenience api for EmitThis+EmitLoad?
224 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
227 2003-08-05 Miguel de Icaza <miguel@ximian.com>
229 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
230 RemapParameterLValue): New methods that are used to turn a
231 precomputed FieldInfo into an expression like this:
235 The idea is to use this instead of making LocalVariableReference
236 have more than one meaning.
238 * cs-parser.jay: Add error production to BASE.
240 * ecore.cs: Deal with TypeManager.GetField returning null, which
241 is now a valid return value.
243 (FieldExprNoAddress): New expression for Fields whose address can
246 * expression.cs (LocalVariableReference): During the resolve
247 phases, create new expressions if we are in a remapping context.
248 Remove code that dealt with remapping here.
250 (ParameterReference): same.
252 (ProxyInstance): New expression, like the `This' expression, but
253 it is born fully resolved. We know what we are doing, so remove
254 the errors that are targeted to user-provided uses of `this'.
256 * statement.cs (Foreach): our variable is now stored as an
257 Expression; During resolution, follow the protocol, dont just
258 assume it will return this.
260 2003-08-06 Martin Baulig <martin@ximian.com>
262 * support.cs (SeekableStreamReader.cs): New public class.
264 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
265 SeekableStreamReader instead of the normal StreamReader.
267 2003-08-04 Martin Baulig <martin@ximian.com>
269 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
270 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
271 deambiguate casts and delegate invocations.
272 (parenthesized_expression): Use the new tokens to ensure this is
273 not a cast of method invocation.
275 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
276 when reading a `)' and Deambiguate_CloseParens () was previously
279 * expression.cs (ParenthesizedExpression): New class. This is
280 just used for the CS0075 test.
281 (Binary.DoResolve): Check for CS0075.
283 2003-07-29 Ravi Pratap <ravi@ximian.com>
285 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
286 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
287 reference comparison.
289 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
290 examine the ReturnType for equality - this is necessary in the
291 cases of implicit and explicit operators whose signature also
292 includes the return type.
294 2003-07-26 Miguel de Icaza <miguel@ximian.com>
296 * namespace.cs: Cache the result of the namespace computation,
297 instead of computing it every time.
299 2003-07-24 Miguel de Icaza <miguel@ximian.com>
301 * decl.cs: Use a global arraylist that we reuse over invocations
302 to avoid excesive memory consumption. Reduces memory usage on an
303 mcs compile by one meg (45 average).
305 * typemanager.cs (LookupTypeReflection): In .NET pointers are
306 private, work around that.
308 2003-07-23 Miguel de Icaza <miguel@ximian.com>
310 * literal.cs (IntLiteral): Define Zero and One static literals.
312 * cs-parser.jay (integer_literal): use static literals to reduce
313 memory usage for the most used literals (0, 1 and -1). 211kb
314 reduced in memory usage.
316 Replace all calls to `new ArrayList' with `new
317 ArrayList(4)' which is a good average number for most allocations,
318 and also requires only 16 bytes of memory for its buffer by
321 This reduced MCS memory usage in seven megabytes for the RSS after
324 2003-07-28 Ravi Pratap <ravi@ximian.com>
326 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
327 handle params methods the correct way by forming only one
328 applicable set with params and normal methods in them. Earlier we
329 were looking at params methods only if we found no normal methods
330 which was not the correct thing to do.
332 (Invocation.BetterFunction): Take separate arguments indicating
333 when candidate and the best method are params methods in their
336 This fixes bugs #43367 and #46199.
338 * attribute.cs: Documentation updates.
340 (CheckAttribute): Rename to CheckAttributeTarget.
341 (GetValidPlaces): Rename to GetValidTargets.
343 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
344 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
348 2003-07-28 Miguel de Icaza <miguel@ximian.com>
350 * codegen.cs: Compute IsGeneric correctly.
352 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
355 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
356 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
357 regressions, and I was chasing more bugs than I required.
359 * interface.cs: Use expressions for base type names (like classes
360 and structs have been doing for a while now), and resolve that.
361 This patch should probably go into head as well.
363 This makes it one less user of FindType.
365 2003-07-24 Miguel de Icaza <miguel@ximian.com>
367 This compiler can not self host currently. Need to fix that.
369 * Makefile: compile to `gmcs.exe'
371 * driver.cs: Turn on v2 by default on gmcs.
373 * generic.cs (ConstructedType): Does no longer take a container
374 type argument; That will be taken care of later.
376 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
377 Use SimpleName to resolve for now, so we can continue the work on
378 the parser, until we get Type.GetType that understands generics.
380 (ConstructedType.ToString): Implement
382 (TypeArguments.Resolve): Resolve the child expressions as types.
384 * cs-parser.jay: Rename interface_constraints to
385 type_parameter_constraints
387 (namespace_or_type_name): Only use constructed types for the basic
388 construction, we will deal with identifier<...> later.
390 (type/type_name): No longer call DecomposeQI, as
391 namespace_or_type_name is always decoded now.
393 2003-07-22 Ravi Pratap <ravi@ximian.com>
395 * expression.cs (Invocation.OverloadResolve): Follow the spec more
396 closely: we eliminate methods in base types when we have an
397 applicable method in a top-level type.
399 Please see section 14.5.5.1 for an exact description of what goes
402 This fixes bug #45127 and a host of other related to corlib compilation.
404 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
405 array is the method corresponding to the top-level type (this is
406 because of the changes made to icall.c) so we change this
409 (MethodGroupExpr.Name): This too.
411 * typemanager.cs (GetElementType): New method which does the right
412 thing when compiling corlib.
414 * everywhere: Make use of the above in the relevant places.
416 2003-07-22 Martin Baulig <martin@ximian.com>
418 * cs-parser.jay (invocation_expression): Moved
419 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
420 `cast_expression', but create a InvocationOrCast which later
421 resolves to either an Invocation or a Cast.
423 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
424 method; call this before EmitStatement() to make sure that this
425 expression can be used as a statement.
427 * expression.cs (InvocationOrCast): New class; resolves to either
428 an Invocation or a Cast.
430 * statement.cs (StatementExpression): Call ResolveStatement() on
431 the ExpressionStatement before emitting it.
433 2003-07-21 Martin Baulig <martin@ximian.com>
435 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
436 `ref' and `out' attributes match; fixes #46220.
437 (MemberAccess.ResolveMemberAccess): You can't reference a type
438 through an expression; fixes #33180.
439 (Indexers.GetIndexersForType): Don't return the indexers from
440 interfaces the class implements; fixes #46502.
442 2003-07-21 Martin Baulig <martin@ximian.com>
444 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
445 CS0661 checks; fixes bug #30442.
447 2003-07-21 Martin Baulig <martin@ximian.com>
449 * decl.cs (AdditionResult): Added `Error'.
451 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
453 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
454 cs0031.cs actually work.
456 2003-07-20 Miguel de Icaza <miguel@ximian.com>
458 * cs-parser.jay (namespace_name): do not use
459 namespace_or_type_name, use qualified_identifier, because
460 namespace_or_type_name will soon return a composed expression
463 (namespace_or_type_name): Instead of returning a string, now this
464 production returns an expression.
466 * codegen.cs (EmitContext): Setup IsGeneric property based on
467 whether our DeclSpace is generic, our the method is generic.
469 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
470 the method is generic.
472 * cs-parser.jay (type_arguments, opt_type_argument_list,
473 type_parameters, type_parameter_list, opt_type_parameter_list,
474 type_parameter,, opt_type_parameter_constraints_clauses,
475 type_parameter_constraints_clauses,
476 type_parameter_constraint_clause, type_parameter_constraint,
477 interface_constraints): Add new production
479 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
480 DeclSpace is generic or not.
482 (DeclSpace.SetParameterInfo): New routine, used to set the
483 parameter info for a type.
485 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
486 returns a GenericTypeExpr
488 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
489 generic, lookup the generic argument.
491 * attribute.cs: Do not allow TypeParameterExpressions in
494 * class.cs: Do not allow the Main method to be defined in a
497 * expression.cs (SizeOf): Do not allow generic types to be used as
500 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
501 it: whether a type is generic or not. Only works for types we are
502 currently building for now.
504 2003-07-20 Martin Baulig <martin@ximian.com>
506 * namespace.cs: Fixed that bug which caused a crash when compiling
509 2003-07-20 Miguel de Icaza <miguel@ximian.com>
511 * typemanager.cs (LookupTypeReflection): Never expose types which
512 are NotPublic, NestedPrivate, NestedAssembly, or
513 NestedFamANDAssem. We used to return these, and later do a check
514 that would report a meaningful error, but the problem is that we
515 would not get the real match, if there was a name override.
517 2003-07-18 Miguel de Icaza <miguel@ximian.com>
519 * namespace.cs (Namespace, Name): Do not compute the namespace
520 name dynamically, compute it in the constructor. This reduced
521 memory usage by 1697 KB.
523 * driver.cs: Use --pause to pause at the end.
525 2003-07-17 Peter Williams <peter@newton.cx>
527 * Makefile: Change the name of the test target so that it doesn't
528 conflict with the recursive test target.
530 2003-07-17 Miguel de Icaza <miguel@ximian.com>
532 * expression.cs (LocalVariableReference.Emit, EmitAssign,
533 AddressOf): Do not use EmitThis, that was wrong, use the actual
536 2003-07-15 Miguel de Icaza <miguel@ximian.com>
538 * class.cs (MethodData.Define): While checking if a method is an
539 interface implementation, improve the test: If we are not public
540 (use new test here: use the computed MethodAttributes directly,
541 instead of the parsed modifier flags) check if the `implementing'
542 method comes from an interface or not.
544 * pending.cs (VerifyPendingMethods): Slightly better error
547 * makefile: add test target that does the mcs bootstrap.
549 2003-07-16 Ravi Pratap <ravi@ximian.com>
551 * interface.cs (Define): Do nothing here since there are no
552 members to populate etc. Move the attribute emission out of here
553 since this was just totally the wrong place to put it. Attribute
554 application happens during the 'Emit' phase, not in the 'Define'
557 (Emit): Add this method and move the attribute emission here
559 * rootcontext.cs (EmitCode): Call the Emit method on interface
562 2003-07-14 Ravi Pratap M <ravi@ximian.com>
564 * expression.cs (OverloadResolve): Report error only if Location
565 is not 'Null' which means that there was a probe going on.
567 2003-07-14 Martin Baulig <martin@ximian.com>
569 * expression.cs (ConditionalLogicalOperator): New public class to
570 implement user defined conditional logical operators.
571 This is section 14.11.2 in the spec and bug #40505.
573 2003-07-14 Martin Baulig <martin@ximian.com>
575 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
577 2003-07-14 Martin Baulig <martin@ximian.com>
579 * codegen.cs (EmitContext.InFixedInitializer): New public field.
581 * ecore.cs (IVariable.VerifyFixed): New interface method.
583 * expression.cs (Unary.ResolveOperator): When resolving the `&'
584 operator, check whether the variable is actually fixed. Fixes bug
585 #36055. Set a variable definitely assigned when taking its
586 address as required by the spec.
588 * statement.cs (LocalInfo.IsFixed): New field.
589 (LocalInfo.MakePinned): Set `IsFixed' to true.
591 2003-07-14 Ravi Pratap M <ravi@ximian.com>
593 * attribute.cs (Attribute.Resolve): While doing a Member lookup
594 for .ctors, ensure that we only ask for members declared in the
595 attribute type (BindingFlags.DeclaredOnly).
599 * expression.cs (Error_WrongNumArguments): Report error 1501
600 correctly the way CSC does.
602 2003-07-13 Martin Baulig <martin@ximian.com>
604 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
605 lookup on the fully qualified name, to make things like "X.X" work
606 where "X.X" is a fully qualified type name, but we also have a
607 namespace "X" in the using list. Fixes #41975.
609 2003-07-13 Martin Baulig <martin@ximian.com>
611 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
612 function. If we're a CompoundAssign, we need to create an embedded
613 CompoundAssign, not an embedded Assign.
614 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
617 2003-07-13 Martin Baulig <martin@ximian.com>
619 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
620 work to fix bug #46088.
622 2003-07-13 Ravi Pratap <ravi@ximian.com>
624 * class.cs (Operator.Emit): Do not emit attributes here - it is
625 taken care of by the Method class that we delegate too. This takes
628 2003-07-10 Martin Baulig <martin@ximian.com>
630 * expression.cs (TypeOfVoid): New class.
631 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
633 2003-07-10 Martin Baulig <martin@ximian.com>
635 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
638 2003-07-10 Martin Baulig <martin@ximian.com>
640 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
641 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
643 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
645 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
647 2003-07-10 Martin Baulig <martin@ximian.com>
649 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
650 of decimal. Fixes #42850.
652 NOTE: I also fixed the created byte blob, but this doesn't work on
653 the MS runtime and csc never produces any byte blobs for decimal
656 2003-07-10 Martin Baulig <martin@ximian.com>
658 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
659 structs; fixes #32068.
660 (Block.AddChildVariableNames): Fixed #44302.
662 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
664 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
666 2003-07-07 Miguel de Icaza <miguel@ximian.com>
668 * attribute.cs: And this test is onger needed.
670 2003-07-08 Martin Baulig <martin@ximian.com>
672 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
673 inaccessible types. Fixes #36313.
675 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
677 * namespace.cs (NamespaceEntry): Create implicit entries for all
678 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
679 implicit entries for N1.N2 and N1.
681 2003-07-08 Martin Baulig <martin@ximian.com>
683 Rewrote the handling of namespaces to fix a lot of the issues
684 wrt. `using' aliases etc.
686 * namespace.cs (Namespace): Splitted this class into a
687 per-assembly `Namespace' and a per-file `NamespaceEntry'.
689 * typemanager.cs (TypeManager.IsNamespace): Removed.
690 (TypeManager.ComputeNamespaces): Only compute namespaces from
691 loaded assemblies here, not the namespaces from the assembly we're
694 2003-07-08 Martin Baulig <martin@ximian.com>
696 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
698 2003-07-07 Miguel de Icaza <miguel@ximian.com>
700 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
703 I thought about the memory savings here, but LookupTypeReflection
704 is used under already very constrained scenarios. Compiling
705 corlib or mcs only exposes one hit, so it would not really reduce
706 any memory consumption.
708 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
710 * typemanager.cs: fixes bug #45889 by only adding public types from
711 other assemblies to the list of known types.
713 2003-07-07 Miguel de Icaza <miguel@ximian.com>
715 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
716 on the type we resolved.
718 2003-07-05 Martin Baulig <martin@ximian.com>
720 * pending.cs (PendingImplementation.ParentImplements): Don't
721 create the proxy if the parent is abstract.
723 * class.cs (TypeContainer.DefineIndexers): Process explicit
724 interface implementations first. Fixes #37714.
726 2003-07-04 Miguel de Icaza <miguel@ximian.com>
728 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
729 defined recursively; but since we modify the input parameters
730 (left is set to `this' temporarily), we reset this value if the
731 left_is_explicit is false, which gives the original semantics to
734 * literal.cs (NullPointer): new class used to represent a null
735 literal in a pointer context.
737 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
738 type is a pointer, use a NullPointer object instead of a
739 NullLiteral. Closes 43687
741 (ExplicitConversion): Convert pointer values using
742 the conv opcode to the proper type.
744 * ecore.cs (New): change ValueTypeVariable property into a method,
745 that returns whether the valuetype is suitable for being used.
747 * expression.cs (Binary.DoNumericPromotions): Only return if we
748 the int constant was a valid uint, and we can return both left and
749 right as uints. If not, we continue processing, to trigger the
750 type conversion. This fixes 39018.
752 * statement.cs (Block.EmitMeta): During constant resolution, set
753 the CurrentBlock property on the emitcontext, so that we resolve
756 2003-07-02 Martin Baulig <martin@ximian.com>
758 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
759 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
761 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
762 than emitting it here.
764 * statement.cs: Fixed some more flow analysis bugs.
766 2003-07-02 Martin Baulig <martin@ximian.com>
768 * class.cs (MethodData.Define): When implementing interface
769 methods, set Final unless we're Virtual.
771 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
772 check work for interface methods.
774 2003-07-01 Martin Baulig <martin@ximian.com>
776 * ecore.cs (EmitContext.This): Replaced this property with a
777 GetThis() method which takes a Location argument. This ensures
778 that we get the correct error location for a CS0188.
780 2003-07-01 Miguel de Icaza <miguel@ximian.com>
782 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
783 ImplicitStandardConversion.
785 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
787 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
789 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
792 2003-06-30 Miguel de Icaza <miguel@ximian.com>
794 * class.cs (Constructor.Define): Turn off initlocals for unsafe
797 (MethodData.Define): Turn off initlocals for unsafe methods.
799 2003-06-29 Miguel de Icaza <miguel@ximian.com>
801 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
802 complete; Fixes #37521.
804 * delegate.cs: Use Modifiers.TypeAttr to compute the
805 TypeAttributes, instead of rolling our own. This makes the flags
806 correct for the delegates.
808 2003-06-28 Miguel de Icaza <miguel@ximian.com>
810 * class.cs (Constructor.Define): Set the private flag for static
811 constructors as well.
813 * cs-parser.jay (statement_expression): Set the return value to
814 null, to avoid a crash when we catch an error.
816 2003-06-24 Miguel de Icaza <miguel@ximian.com>
818 * cs-parser.jay: Applied patch from Jackson that adds support for
819 extern and unsafe modifiers to destructor declarations.
821 * expression.cs: Report error 21 if the user is trying to index a
824 * driver.cs: Add an error message, suggested by the bug report.
826 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
827 if we do not have a ": this ()" constructor initializer. Fixes 45149
829 2003-06-14 Miguel de Icaza <miguel@ximian.com>
831 * namespace.cs: Add some information to reduce FAQs.
833 2003-06-13 Miguel de Icaza <miguel@ximian.com>
835 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
836 underlying enumeration types. Fixes #43915.
838 * expression.cs: Treat ushort/short as legal values to be used in
841 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
843 * delegate.cs: transfer custom attributes for paramenters from
844 the delegate declaration to Invoke and BeginInvoke.
846 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
848 * attribute.cs: handle custom marshalers and emit marshal info
851 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
853 * makefile.gnu: Added anonymous.cs to the compiler sources.
855 2003-05-28 Miguel de Icaza <miguel@ximian.com>
857 * iterators.cs: Change the name of the proxy class to include two
860 * cs-parser.jay: Update grammar to include anonymous methods.
862 * anonymous.cs: new file.
864 2003-05-27 Miguel de Icaza <miguel@ximian.com>
866 * class.cs (Field.Define): Add missing test for pointers and
869 2003-05-27 Ravi Pratap <ravi@ximian.com>
871 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
872 we use the stobj opcode.
874 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
875 since it wasn't the correct fix.
877 It still is puzzling that we are required to use stobj for IntPtr
878 which seems to be a ValueType.
880 2003-05-26 Miguel de Icaza <miguel@ximian.com>
882 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
883 during regular simple name resolution. Now, the trick is that
884 instead of returning for processing the simplename, we do a
885 TypeManager.LookupType (ie, a rooted lookup as opposed to a
886 contextual lookup type). If a match is found, return that, if
887 not, return for further composition.
889 This fixes long-standing 30485.
891 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
892 using the address to initialize an object, do an Stobj instead of
893 using the regular Stelem.
895 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
896 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
897 Because if we are a BaseIndexerAccess that value will be true.
900 * statement.cs (GotoCase.Resolve): Return after reporting an
901 error, do not attempt to continue.
903 * expression.cs (PointerArithmetic.Emit): If our operand is a
904 long, convert our constants to match the operand before
905 multiplying. Convert to I type before adding. Fixes 43670.
907 2003-05-14 Ravi Pratap <ravi@ximian.com>
909 * enum.cs (ImplicitConversionExists) : Rename to
910 ImplicitEnumConversionExists to remove ambiguity.
912 * ecore.cs (NullCast): New type of cast expression class which
913 basically is very similar to EmptyCast with the difference being
914 it still is a constant since it is used only to cast a null to
918 * convert.cs (ImplicitReferenceConversion): When casting a null
919 literal, we return a NullCast.
921 * literal.cs (NullLiteralTyped): Remove - I don't see why this
922 should be around anymore.
924 The renaming (reported was slightly wrong). Corrections:
926 ConvertImplicitStandard -> ImplicitConversionStandard
927 ConvertExplicitStandard -> ExplicitConversionStandard
929 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
930 before passing them in !
932 * convert.cs (ImplicitConversionStandard): When comparing for
933 equal expr and target types, ensure that expr is not a
936 In general, we must not be checking (expr_type ==
937 target_type) in the top level conversion methods
938 (ImplicitConversion, ExplicitConversion etc). This checking is
939 done in the methods that they delegate to.
941 2003-05-20 Miguel de Icaza <miguel@ximian.com>
943 * convert.cs: Move Error_CannotConvertType,
944 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
945 ImplicitNumericConversion, ImplicitConversionExists,
946 ImplicitUserConversionExists, StandardConversionExists,
947 FindMostEncompassedType, FindMostSpecificSource,
948 FindMostSpecificTarget, ImplicitUserConversion,
949 ExplicitUserConversion, GetConversionOperators,
950 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
951 TryImplicitIntConversion, Error_CannotConvertImplicit,
952 ConvertImplicitRequired, ConvertNumericExplicit,
953 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
954 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
957 Perform the following renames:
959 StandardConversionExists -> ImplicitStandardConversionExists
960 ConvertImplicit -> ImplicitConversion
961 ConvertImplicitStandard -> ImplicitStandardConversion
962 TryImplicitIntConversion -> ImplicitIntConversion
963 ConvertImplicitRequired -> ImplicitConversionRequired
964 ConvertNumericExplicit -> ExplicitNumericConversion
965 ConvertReferenceExplicit -> ExplicitReferenceConversion
966 ConvertExplicit -> ExplicitConversion
967 ConvertExplicitStandard -> ExplicitStandardConversion
969 2003-05-19 Martin Baulig <martin@ximian.com>
971 * statement.cs (TypeInfo.StructInfo): Made this type protected.
972 (TypeInfo): Added support for structs having structs as fields.
974 * ecore.cs (FieldExpr): Implement IVariable.
975 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
976 VariableInfo for the field.
978 2003-05-18 Martin Baulig <martin@ximian.com>
980 * expression.cs (This.DoResolve): Report a CS0027 if we're
981 emitting a field initializer.
983 2003-05-18 Martin Baulig <martin@ximian.com>
985 * expression.cs (This.ResolveBase): New public function.
986 (This.DoResolve): Check for CS0188.
988 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
991 * ecore.cs (MethodGroupExpr.DoResolve): Set the
992 `instance_expression' to null if we don't have any non-static
995 2003-05-18 Martin Baulig <martin@ximian.com>
997 Reworked the way how local variables and parameters are handled by
998 the flow analysis code.
1000 * statement.cs (TypeInfo, VariableMap): New public classes.
1001 (VariableInfo): New public class. This is now responsible for
1002 checking whether a variable has been assigned. It is used for
1003 parameters and local variables.
1004 (Block.EmitMeta): Take the InternalParameters as argument; compute
1005 the layout of the flow vectors here.
1006 (Block.LocalMap, Block.ParameterMap): New public properties.
1007 (FlowBranching): The .ctor doesn't get the InternalParameters
1008 anymore since Block.EmitMeta() now computes the layout of the flow
1010 (MyStructInfo): This class is now known as `StructInfo' and nested
1011 in `TypeInfo'; we don't access this directly anymore.
1013 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1014 property and removed IsAssigned(), IsFieldAssigned(),
1015 SetAssigned() and SetFieldAssigned(); we now call them on the
1016 VariableInfo so we don't need to duplicate this code everywhere.
1018 * expression.cs (ParameterReference): Added `Block block' argument
1020 (LocalVariableReference, ParameterReference, This): The new
1021 VariableInfo class is now responsible for all the definite
1024 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1025 IsParameterAssigned, SetParameterAssigned): Removed.
1027 2003-05-18 Martin Baulig <martin@ximian.com>
1029 * typemanager.cs (InitCoreTypes): Try calling
1030 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1031 the 3-args-version. Corlib now also needs our `void_type'.
1032 (GetMethod): Added overloaded version which takes an optional
1033 `bool report_errors' to allow lookups of optional methods.
1035 2003-05-12 Martin Baulig <martin@ximian.com>
1037 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1038 only used for locals and not for parameters.
1040 2003-05-12 Miguel de Icaza <miguel@ximian.com>
1042 * support.cs (InternalParameters.ParameterType): Return the
1043 ExternalType of the parameter.
1045 * parameter.cs (Parameter.ExternalType): drop the two arguments,
1048 2003-05-11 Miguel de Icaza <miguel@ximian.com>
1050 * class.cs (MethodData.Define): Do not set the `newslot' on
1051 interface members, if they are also flagged as "override".
1053 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1054 better code for ++i and i++. This only works for static fields
1055 and local variables.
1057 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1058 want to pull the DeclSpace out of the builder_to_declspace instead
1059 of the TypeBuilder (like in TypeContainer.FindMembers).
1061 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1062 instead of LookupTypeContainer. Fixes the crash on .NET for
1063 looking up interface members.
1065 * const.cs: Create our own emit context during the Definition
1066 stage, so that constants are evaluated in the proper context, when
1067 a recursive definition happens.
1069 2003-05-11 Martin Baulig <martin@ximian.com>
1071 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
1072 new block for a switch section.
1073 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1074 the adding/lookup in the switch block. Fixes #39828.
1076 2003-05-09 Miguel de Icaza <miguel@ximian.com>
1078 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1079 functionality: I needed to convert the data after I had performed
1080 the add/sub operation into the operands type size.
1082 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1083 pass the type for the box operation, otherwise the resulting
1084 object would have been of type object.
1086 (BoxedCast): Add constructor to specify the type to box as.
1088 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1090 * iterators.cs: I was reusing the `count' variable inadvertently,
1091 take steps to not allow this to happen.
1093 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1095 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1096 by creating an array at the point where the params starts and
1097 putting all those arguments there, then adjusting the size of the
1100 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1102 * expression.cs (New.AddressOf): Implement interface
1103 IMemoryLocation. This is used when the `new' operator is used in
1104 the context of an invocation to a method on a value type.
1106 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1109 * namespace.cs: Also check the using aliases here.
1111 * driver.cs: Move the test for using validity after the types have
1112 been entered, so we do a single pass that also includes the using
1115 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1116 in the regular case. CreateSiblingForFinally is doing extra
1119 * attribute.cs (GetAttributeArgumentExpression): Store the result
1120 on an out value, and use the return value to indicate failure
1121 instead of using null (which is a valid return for Constant.GetValue).
1123 * statement.cs: Perform the analysis flow for the increment
1124 portion after the statement, because this will be the real flow of
1125 execution. Fixes #42385
1127 * codegen.cs (EmitContext.EmitArgument,
1128 EmitContext.EmitStoreArgument): New helper functions when the
1129 RemapToProxy flag is set.
1131 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1134 Add support for remapping parameters.
1136 * iterators.cs: Propagate parameter values; Store parameter
1137 values in the proxy classes.
1139 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1141 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1142 need a proxy reference; I do not know what I was thinking
1144 * cs-parser.jay (constructor_initializer): catch another error,
1145 and display nice message.
1147 (field_declaration): catch void field declaration
1148 to flag a better error.
1150 * class.cs (MemberBase.CheckBase): Report an error instead of a
1151 warning if a new protected member is declared in a struct.
1152 (Field.Define): catch the error of readonly/volatile.
1154 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1156 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1157 volatile variable is taken
1159 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1161 * statement.cs (Fixed.Resolve): Report an error if we are not in
1164 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1166 * typemanager.cs: reuse the code that handles type clashes for
1167 delegates and enumerations.
1169 * class.cs (Report28): Always report.
1171 * expression.cs (EncodeAsAttribute): Allow nulls here.
1173 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1175 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1176 the functionality for testing whether an expression is valid for
1177 an attribute here. Also handle the case of arrays of elements
1180 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1181 encoding a linear array into an array of objects that are suitable
1182 to be passed to an CustomAttributeBuilder.
1184 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1186 * ecore.cs: (FieldExpr): Handle field remapping here.
1188 * iteratators.cs: Pass the instance variable (if the method is an
1189 instance method) to the constructors, so we can access the field
1190 variables on the class.
1192 TODO: Test this with structs. I think the THIS variable on
1193 structs might have to be a pointer, and not a refenrece
1195 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1197 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1198 local variables to fields in a proxy class.
1200 * iterators.cs (PopulateProxy): Rename our internal fields to
1202 Create a <THIS> field if we are an instance method, so we can
1203 reference our parent container variables.
1204 (MapVariable): Called back from the EmitContext code to enter a
1205 new variable to field mapping into the proxy class (we just create
1209 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1210 for using the remapped locals to fields.
1212 I placed the code here, because that gives the same semantics to
1213 local variables, and only changes the Emit code.
1215 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1216 statements inside iterators.
1217 (VariableInfo): Add a FieldBuilder for the cases when we are
1218 remapping local variables to fields in a proxy class
1220 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1221 current_block != null.
1223 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1224 not cope with strings, as it has been moved to the
1225 TableSwitchEmit. Fixed bug in switch generation.
1227 * expression.cs (New.DoResolve): Provide more context for the user
1228 when reporting an error.
1230 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1233 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1234 check the permissions for it. Note than in a type-resolution
1235 context the check was already present in DeclSpace.ResolveType,
1236 but was missing from the MemberAccess.
1238 (ArrayCreation.CheckIndices): warn if the user has
1239 more nested levels of expressions, but there are no more
1240 dimensions specified. Avoids crash on bug 41906.
1242 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1244 * statement.cs (Block): replace Implicit bool, for a generic
1246 New flag: `Unchecked'. This is used during the EmitMeta phase
1247 (which is out-of-line with the regular Resolve/Emit process for a
1248 statement, as this is done ahead of time, but still gets a chance
1249 to call constant resolve).
1251 (Block.Flags): new enum for adding a new flag.
1253 (Block.EmitMeta): track the state of unchecked.
1255 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1256 to enable constant resolution to work there as well.
1258 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1260 * typemanager.cs (ienumerable_type): Also look up
1261 System.Collections.IEnumerable.
1263 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1265 TODO: Test more than one conditional per method.
1267 * class.cs (Indexer.Define): Report the location where the user is
1268 referencing the unsupported feature.
1270 (MethodData): Overload the use of `conditionals' to
1271 minimize the creation of needless ArrayLists. This saves roughly
1272 212kb on my machine.
1274 (Method): Implement the new IIteratorContainer interface.
1275 (Method.SetYields): Implement the method by setting the ModFlags
1276 to contain METHOD_YIELDS.
1278 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1279 which just got set to null.
1281 * iterators.cs: New file.
1283 (Yield, YieldBreak): New statements.
1285 * statement.cs (Return.Resolve): Flag an error if we are used in
1288 * codegen.cs (InIterator): New flag set if the code is being
1289 compiled in an iterator method.
1291 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1292 internal modifier, and we just use it to avoid adding extra
1293 fields, as this is seldom used.
1295 * cs-parser.jay: Add yield_statement (yield and yield break).
1297 * driver.cs: New flag -v2 to turn on version 2 features.
1299 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1300 hashtable when v2 is enabled.
1302 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1304 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1305 there is already a namespace defined with this name.
1307 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1308 people upgraded their corlibs.
1310 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1311 always use fully qualified types, no need to use the compiler
1314 (TypeManager.IsNamespace): Use binarysearch.
1316 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1317 AddDelegate): I did not quite use the new IsValid API properly: I
1318 have to pass the short-name and the fullname. I was passing only
1319 the basename instead of the fullname sometimes.
1321 (TypeContainer.DefineType): call NamespaceClash.
1323 * interface.cs (Interface.DefineType): use NamespaceClash before
1326 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1329 * enum.cs: (Enum.DefineType): use NamespaceClash before
1332 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1333 speed increase. First, use the negative_hits cache when we get a
1334 negative. Second, add the type with its full original name
1335 instead of the new . and + encoded name (reflection uses + to
1336 separate type from a nested type). Use LookupTypeReflection
1337 directly which bypasses the type->name hashtable (that we already
1338 know does not contain the type.
1340 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1341 location/container type.
1343 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1345 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1347 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1349 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1350 method is being referenced in the method group from a static
1351 context, and report error 120 if so.
1353 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1356 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1357 is created, we create the A namespace).
1359 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1362 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1364 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1365 invocation to ModuleBuilder.GetType with the same values will
1366 return a new type instance, so we need to cache its return
1369 * expression.cs (Binary.ResolveOperator): Only allow the compare
1370 operators on enums if they are of the same type.
1372 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1373 types of ValueType on their own case. Before we were giving them
1374 the same treatment as objects.
1376 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1377 fullname. Short name is used to compare against container name.
1378 Fullname is used to check against defined namespace names.
1380 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1381 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1383 (Method.CheckBase): Call parent.
1384 (MemberBase.CheckBase): Check for protected members on sealed
1386 (PropertyBase.CheckBase): Call parent.
1387 (Field.Define): Call parent.
1389 * report.cs: Negative error codes are now mapped to 8000 - code,
1390 so that the display is render more nicely.
1392 * typemanager.cs: Do not use try/catch, instead report a regular
1395 (GetPointerType, GetReferenceType): These methods provide
1396 mechanisms to obtain the T* and T& from a T. We had the code
1397 previously scattered around the code base, and it also used
1398 TypeManager.LookupType that would go through plenty of caches.
1399 This one goes directly to the type source.
1401 In some places we did the Type.GetType followed by
1402 ModuleBuilder.GetType, but not in others, so this unifies the
1405 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1406 statements now that we have namespace information.
1408 * typemanager.cs (IsNamespace): New method, returns whether the
1409 string presented is a namespace or not.
1411 (ComputeNamespaces): New public entry point, computes the list of
1412 available namespaces, using the GetNamespaces API call in Mono, or
1413 the slower version in MS.NET.
1415 Now before we start the semantic analysis phase, we have a
1416 complete list of namespaces including everything that the user has
1419 Deleted old code to cache namespaces in .nsc files.
1421 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1423 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1424 class/struct location definition Location for the implicit
1425 constructor location.
1427 (Operator.Define): Use the location of the operator for the
1428 implicit Method definition.
1430 (Constructor.Emit): use the constructor location for the implicit
1431 base initializer constructor.
1433 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1434 and the Expression class now contains two new methods:
1436 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1437 isolate type lookup from the rest of the resolution process.
1439 Since we use Expressions to hold type definitions due to the way
1440 we parse the input we have historically overloaded Resolve to
1441 perform the Type lookups if a special flag is passed. Now this is
1442 eliminated and two methods take their place.
1444 The differences in the two methods between xStep and xTerminal is
1445 that xStep is involved in our current lookup system that uses
1446 SimpleNames to compose a name, while xTerminal is used just to
1447 catch the case where the simplename lookup failed.
1449 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1451 * expression.cs (ResolveMemberAccess): Remove redundant code.
1452 TypeExpr expressions are always born fully resolved.
1454 * interface.cs (PopulateMethod): Do not lookup the types twice.
1455 We were doing it once during SemanticAnalysis and once during
1458 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1459 in local variable type definitions, were being returned as a
1460 SimpleName (we decomposed everything into a string), that is
1461 because primary_expression was being used instead of a type in the
1462 grammar (reduce/reduce conflicts).
1464 The part that was wrong is that we converted the expression into a
1465 string (an oversimplification in one hand, compounded with primary
1466 expressions doing string concatenation).
1472 Would return "A.B.C[]" as a SimpleName. This stopped things like
1473 using clauses from working on this particular context. And a type
1474 was being matched directly against "A.B.C[]".
1476 We now use the correct approach, and allow for ComposedCast to be
1477 part of the unary expression. So the "A.B.C []" become a composed
1478 cast of "A.B.C" (as a nested group of MemberAccess with a
1479 SimpleName at the end) plus the rank composition "[]".
1483 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1485 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1486 for the access level checking.
1488 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1489 `TypeContainer container', because I kept getting confused when I
1490 was debugging this code.
1492 * expression.cs (Indexers): Instead of tracking getters/setters,
1493 we now track them in parallel. We create one arraylist less, but
1494 most importantly it is possible now for the LValue code to find a
1495 matching get for a set.
1497 (IndexerAccess.DoResolveLValue): Update the code.
1498 GetIndexersForType has been modified already to extract all the
1499 indexers from a type. The code assumed it did not.
1501 Also make the code set the correct return type for the indexer.
1502 This was fixed a long time ago for properties, but was missing for
1503 indexers. It used to be void_type.
1505 (Binary.Emit): Test first for doubles instead of
1506 floats, as they are more common.
1508 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1509 when dealing with floats and the <=, >= operators. This fixes bug
1512 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1513 to load the array value by emitting a load on the foreach variable
1514 type. This was incorrect.
1516 We now emit the code to load an element using the the array
1517 variable type, and then we emit the conversion operator.
1521 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1523 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1525 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1527 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1528 test for protection before we test for signatures.
1530 (MethodSignature.ToString): implement.
1532 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1533 to the case where we reduced into a LongConstant.
1535 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1536 depend on whether the information is acurrate, because the
1537 Microsoft runtime will always claim that the array type is public,
1538 regardless of the real state.
1540 If the type is a pointer, another problem happens: the type is
1541 reported as non-public in Microsoft.
1543 In both cases we have to call CheckAccessLevel recursively with
1544 the underlying type as the argument to be tested.
1546 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1548 * assign.cs (Assign.Emit): If we are dealing with a compound
1549 assignment expression, we should use the code path that stores the
1550 intermediate result in a temporary value. This fixes #40903.
1552 *expression.cs (Indirection.ToString): Provide ToString method for
1555 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
1557 * class.cs: Null out fields holding references to Block objects so
1558 they can be garbage collected.
1560 * expression.cs (OverloadResolve): Remove unused local.
1562 2003-04-07 Martin Baulig <martin@ximian.com>
1564 * codegen.cs (EmitContext.CurrentFile): New public field.
1565 (EmitContext.Mark): Use the CurrentFile to check whether the
1566 location is in the correct file.
1567 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1569 2003-04-07 Martin Baulig <martin@ximian.com>
1571 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1573 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1574 location. [FIXME: The location argument which gets passed to this
1575 method is sometimes wrong!]
1577 2003-04-07 Nick Drochak <ndrochak@gol.com>
1579 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1581 2003-04-07 Miguel de Icaza <miguel@ximian.com>
1583 * expression.cs (Indirection.EmitAssign): We were using the
1584 temporary, but returning immediately instead of continuing the
1587 2003-04-06 Martin Baulig <martin@ximian.com>
1589 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1590 if it's a nested child, but also deriving from the outer class.
1593 * typemanager.cs (IsNestedChildOf): Make this work if it's a
1594 nested child, but also deriving from the outer class. See
1596 (FilterWithClosure): We may access private members of the outer
1597 class if we're a nested child and deriving from the outer class.
1598 (RealMemberLookup): Only set `closure_private_ok' if the
1599 `original_bf' contained BindingFlags.NonPublic.
1601 2003-04-05 Martin Baulig <martin@ximian.com>
1603 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
1604 probe if its a type parameter, and if so, flag an error.
1606 * decl.cs: Move here the SetParameterInfo code from class.cs.
1607 Handle IsGeneric here.
1609 Handle a variety of errors in the parameter info definition.
1611 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
1612 type parameters here.
1614 * cs-parser.jay (class_declaration): report errors for parameters
1617 2003-01-21 Miguel de Icaza <miguel@ximian.com>
1619 * generic.cs: New file, contains support code for generics.
1621 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
1622 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
1624 Update parser for the above removals.
1626 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
1627 now taken care of in the parser.
1629 2003-04-02 Miguel de Icaza <miguel@ximian.com>
1631 * class.cs (Event.Define): Do not allow abstract events to have
1634 2003-04-01 Miguel de Icaza <miguel@ximian.com>
1636 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1637 block in event declarations.
1639 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1640 value type, get its address.
1642 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1643 leaving a class on the stack instead of a boolean value (int
1644 0/1). Change the code so we compare against null, and then the
1645 result against zero.
1647 * class.cs (TypeContainer.GetClassBases): We were checking for the
1648 parent class being sealed too late.
1650 * expression.cs (Binary.Emit): For <= and >= when dealing with
1651 floating point values, use cgt.un and clt.un instead of cgt and
1654 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
1656 * statement.cs: Apply the same optimization as MS: skip the
1657 GetEnumerator returning an IEnumerator, and use the one returning a
1658 CharEnumerator instead. This allows us to avoid the try-finally block
1661 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
1663 * cs-parser.jay: Attributes cannot be applied to
1664 namespaces. Fixes #40473
1666 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1669 (Add*): check if the name is valid using the full name for constants,
1670 fields, properties and events.
1672 2003-03-28 Miguel de Icaza <miguel@ximian.com>
1674 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1675 char constants to be part of the enumeration.
1677 * expression.cs (Conditional.DoResolve): Add support for operator
1678 true. Implements the missing functionality from 14.12
1680 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1681 operator true/false as required by the spec.
1683 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1684 implicit conversion to boolean.
1686 * statement.cs (Statement.ResolveBoolean): A boolean expression is
1687 also one where the type implements `operator true'.
1689 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1690 get an expression that will invoke operator true based on an
1693 (GetConversionOperators): Removed the hack that called op_True
1696 (Expression.ResolveBoolean): Move this from Statement.
1698 2003-03-17 Miguel de Icaza <miguel@ximian.com>
1700 * ecore.cs (FieldExpr): do not allow initialization of initonly
1701 fields on derived classes
1703 2003-03-13 Martin Baulig <martin@ximian.com>
1705 * statement.cs (Block.Emit): Call ig.BeginScope() and
1706 ig.EndScope() when compiling with debugging info; call
1707 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1709 2003-03-08 Miguel de Icaza <miguel@ximian.com>
1711 * expression.cs (Indexers): Do not construct immediately, allow
1712 for new members to be appended as we go. Fixes 38143
1714 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1716 * expression.cs: save/restore context when resolving an unchecked
1719 2003-03-05 Miguel de Icaza <miguel@ximian.com>
1721 * cfold.cs: Catch division by zero in modulus operator during
1724 2003-03-03 Miguel de Icaza <miguel@ximian.com>
1726 * interface.cs (Interface.DefineMembers): Avoid defining members
1729 2003-02-27 Miguel de Icaza <miguel@ximian.com>
1731 * driver.cs: handle the +/- options for -noconfig
1733 * statement.cs (Unckeched.Resolve): Also track the state of
1734 unchecked in the Resolve phase.
1736 2003-02-27 Martin Baulig <martin@ximian.com>
1738 * ecore.cs (Expression.MemberLookup): Don't create a
1739 MethodGroupExpr for something which is not a method. Fixes #38291.
1741 2003-02-25 Miguel de Icaza <miguel@ximian.com>
1743 * class.cs (MemberBase.CheckParameters): Also check that the type
1744 is unmanaged if it is a pointer.
1746 * expression.cs (SizeOf.Resolve): Add location information.
1748 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1749 a managed type is declared.
1751 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1752 parameter modifiers as well. Fixes bug 38606
1754 * class.cs: Very sad. Am backing out the speed up changes
1755 introduced by the ArrayList -> Array in the TypeContainer, as they
1756 were not actually that much faster, and introduced a bug (no error
1757 reports on duplicated methods).
1759 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1760 source first, this will guarantee that we have a valid expression
1761 before calling in lower levels functions that will require a
1762 resolved object. Then use this original_source in the
1763 target.ResolveLValue instead of the original source that was
1766 Another change. Use target.Resolve instead of LValueResolve.
1767 Although we are resolving for LValues, we will let the Assign code
1768 take care of that (it will be called again from Resolve). This
1769 basically allows code like this:
1771 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1772 class Y { void A (X x) { x [0] += o; }
1774 The problem was that the indexer was trying to resolve for
1775 set_Item (idx, object o) and never finding one. The real set_Item
1776 was set_Item (idx, X). By delaying the process we get the right
1781 2003-02-23 Martin Baulig <martin@ximian.com>
1783 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1784 while calling DoEmit ().
1786 * codegen.cs (EmitContext.Mark): Don't mark locations in other
1787 source files; if you use the #line directive inside a method, the
1788 compiler stops emitting line numbers for the debugger until it
1789 reaches the end of the method or another #line directive which
1790 restores the original file.
1792 2003-02-23 Martin Baulig <martin@ximian.com>
1794 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1796 2003-02-23 Martin Baulig <martin@ximian.com>
1798 * statement.cs (Block.AddChildVariableNames): We need to call this
1799 recursively, not just for our immediate children.
1801 2003-02-23 Martin Baulig <martin@ximian.com>
1803 * class.cs (Event.Define): Always make the field private, like csc does.
1805 * typemanager.cs (TypeManager.RealMemberLookup): Make events
1806 actually work, fixes bug #37521.
1808 2003-02-23 Miguel de Icaza <miguel@ximian.com>
1810 * delegate.cs: When creating the various temporary "Parameters"
1811 classes, make sure that we call the ComputeAndDefineParameterTypes
1812 on those new parameters (just like we do with the formal ones), to
1813 allow them to be resolved in the context of the DeclSpace.
1815 This fixes the bug that Dick observed in Bugzilla #38530.
1817 2003-02-22 Miguel de Icaza <miguel@ximian.com>
1819 * expression.cs (ResolveMemberAccess): When resolving a constant,
1820 do not attempt to pull a constant if the value was not able to
1821 generate a valid constant.
1823 * const.cs (LookupConstantValue): Do not report more errors than required.
1825 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1827 * expression.cs: fixes bug #38328.
1829 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1831 * class.cs: Changed all the various members that can be part of a
1832 class from being an ArrayList to be an Array of the right type.
1833 During the DefineType type_list, interface_list, delegate_list and
1834 enum_list are turned into types, interfaces, delegates and enums
1837 And during the member population, indexer_list, event_list,
1838 constant_list, field_list, instance_constructor_list, method_list,
1839 operator_list and property_list are turned into their real arrays.
1841 Although we could probably perform this operation earlier, for
1842 good error reporting we need to keep the lists and remove the
1843 lists for longer than required.
1845 This optimization was triggered by Paolo profiling the compiler
1846 speed on the output of `gen-sample-program.pl' perl script.
1848 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
1849 not crash in methods like MemberLookupFailed that use this field.
1851 This problem arises when the compiler fails to resolve a type
1852 during interface type definition for example.
1854 2003-02-18 Miguel de Icaza <miguel@ximian.com>
1856 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
1857 inherit from System.Object, so we have to stop at null, not only
1858 when reaching System.Object.
1860 2003-02-17 Miguel de Icaza <miguel@ximian.com>
1862 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
1863 DeclaredOnly because the parent indexer might have had a different
1864 name, but did not loop until the top of the hierarchy was reached.
1866 The problem this one fixes is 35492: when a class implemented an
1867 indexer from an interface, we were getting the interface method
1868 (which was abstract) and we were flagging an error (can not invoke
1871 This also keeps bug 33089 functioning, and test-148 functioning.
1873 * typemanager.cs (IsSpecialMethod): The correct way of figuring
1874 out if a method is special is to see if it is declared in a
1875 property or event, or whether it is one of the predefined operator
1876 names. This should fix correctly #36804.
1878 2003-02-15 Miguel de Icaza <miguel@ximian.com>
1880 The goal here is to remove the dependency on EmptyCast.Peel ().
1881 Killing it completely.
1883 The problem is that currently in a number of places where
1884 constants are expected, we have to "probe" for an EmptyCast, and
1885 Peel, which is not the correct thing to do, as this will be
1886 repetitive and will likely lead to errors.
1888 The idea is to remove any EmptyCasts that are used in casts that
1889 can be reduced to constants, so we only have to cope with
1892 This bug hunt was triggered by Bug 37363 and the desire to remove
1893 the duplicate pattern where we were "peeling" emptycasts to check
1894 whether they were constants. Now constants will always be
1897 * ecore.cs: Use an enumconstant here instead of wrapping with
1900 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1901 throwing me off. By handling this we can get rid of a few hacks.
1903 * statement.cs (Switch): Removed Peel() code.
1905 2003-02-14 Miguel de Icaza <miguel@ximian.com>
1907 * class.cs: Location information for error 508
1909 * expression.cs (New.DoResolve): Add a guard against double
1910 resolution of an expression.
1912 The New DoResolve might be called twice when initializing field
1913 expressions (see EmitFieldInitializers, the call to
1914 GetInitializerExpression will perform a resolve on the expression,
1915 and later the assign will trigger another resolution
1917 This leads to bugs (#37014)
1919 * delegate.cs: The signature for EndInvoke should contain any ref
1920 or out parameters as well. We were not doing this in the past.
1922 * class.cs (Field.Define): Do not overwrite the type definition
1923 inside the `volatile' group. Turns out that volatile enumerations
1924 were changing the type here to perform a validity test, which
1927 2003-02-12 Miguel de Icaza <miguel@ximian.com>
1929 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
1930 and structs, we do not want to load the instance variable
1932 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
1933 enum_type has to be handled like an object reference (implicit
1934 conversions exists from this to object), but the regular IsClass
1935 and IsValueType tests will never return true for this one.
1937 Also we use TypeManager.IsValueType instead of type.IsValueType,
1938 just for consistency with the rest of the code (this is only
1939 needed if we ever use the construct exposed by test-180.cs inside
1940 corlib, which we dont today).
1942 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
1944 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
1947 2003-02-09 Martin Baulig <martin@ximian.com>
1949 * namespace.cs (Namespace..ctor): Added SourceFile argument.
1950 (Namespace.DefineNamespaces): New static public method; this is
1951 called when we're compiling with debugging to add all namespaces
1954 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
1955 pass it to the Namespace's .ctor.
1957 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
1958 and MethodBase arguments; pass the namespace ID to the symwriter;
1959 pass the MethodBase instead of the token to the symwriter.
1960 (SymbolWriter.DefineNamespace): New method to add a namespace to
1963 2003-02-09 Martin Baulig <martin@ximian.com>
1965 * symbolwriter.cs: New file. This is a wrapper around
1966 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
1967 methods here in near future.
1969 2003-02-09 Martin Baulig <martin@ximian.com>
1971 * codegen.cs (EmitContext.Mark): Just pass the arguments to
1972 ILGenerator.MarkSequencePoint() which are actually used by the
1975 2003-02-09 Martin Baulig <martin@ximian.com>
1977 * location.cs (SourceFile): New public sealed class. This
1978 contains the name and an index which is used in the location's token.
1979 (Location): Reserve an appropriate number of bits in the token for
1980 the source file instead of walking over that list, this gives us a
1981 really huge performance improvement when compiling with debugging.
1983 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
1984 `SourceFile' argument instead of a string.
1985 (Driver.ProcessFile): Add all the files via Location.AddFile(),
1986 but don't parse/tokenize here, we need to generate the list of all
1987 source files before we do that.
1988 (Driver.ProcessFiles): New static function. Parses/tokenizes all
1991 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
1992 instead of a string.
1994 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
1997 2003-02-09 Martin Baulig <martin@ximian.com>
1999 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2000 filename on `#line default'.
2002 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2004 * statement.cs: don't clear the pinned var when the fixed statement
2005 returns from the method (fixes bug#37752).
2007 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2009 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
2012 2003-02-07 Martin Baulig <martin@ximian.com>
2014 * driver.cs: Removed the `--debug-args' command line argument.
2016 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2017 automatically by the AsssemblyBuilder.
2018 (CodeGen.InitializeSymbolWriter): We don't need to call any
2019 initialization function on the symbol writer anymore. This method
2020 doesn't take any arguments.
2022 2003-02-03 Miguel de Icaza <miguel@ximian.com>
2024 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2025 from referenced assemblies as well.
2027 2003-02-02 Martin Baulig <martin@ximian.com>
2029 * class.cs (MethodData.Emit): Generate debugging info for external methods.
2031 2003-02-02 Martin Baulig <martin@ximian.com>
2033 * class.cs (Constructor.Emit): Open the symbol writer before
2034 emitting the constructor initializer.
2035 (ConstructorInitializer.Emit): Call ec.Mark() to allow
2036 single-stepping through constructor initializers.
2038 2003-01-30 Miguel de Icaza <miguel@ximian.com>
2040 * class.cs: Handle error 549: do not allow virtual methods in
2043 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2045 * decl.cs: Check access levels when resolving types
2047 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2049 * statement.cs: Add parameters and locals set in catch blocks that might
2050 return to set vector
2052 2003-01-29 Miguel de Icaza <miguel@ximian.com>
2054 * class.cs (Operator): Set the SpecialName flags for operators.
2056 * expression.cs (Invocation.DoResolve): Only block calls to
2057 accessors and operators on SpecialName methods.
2059 (Cast.TryReduce): Handle conversions from char constants.
2062 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2064 * statement.cs: small memory and time optimization in FlowBranching.
2066 2003-01-28 Pedro Mart <yoros@wanadoo.es>
2068 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2069 problem that the last fix but in the other sid (Set).
2071 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2072 access when there is no indexer in the hierarchy.
2074 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2076 * class.cs: Combine some if statements.
2078 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2080 * driver.cs: fixed bug #37187.
2082 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
2084 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2085 any indexer, it's needed to build a list with all the indexers in the
2086 hierarchy (AllGetters), else we have problems. Fixes #35653.
2088 2003-01-23 Miguel de Icaza <miguel@ximian.com>
2090 * class.cs (MethodData.Define): It is wrong for an interface
2091 implementation to be static in both cases: explicit and implicit.
2092 We were only handling this in one case.
2094 Improve the if situation there to not have negations.
2096 * class.cs (Field.Define): Turns out that we do not need to check
2097 the unsafe bit on field definition, only on usage. Remove the test.
2099 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2101 * driver.cs: use assembly.Location instead of Codebase (the latest
2102 patch made mcs fail when using MS assemblies).
2104 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
2106 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2107 get the path to *corlib.dll.
2109 2003-01-21 Nick Drochak <ndrochak@gol.com>
2113 * typemanager.cs: Remove compiler warnings
2115 2003-01-20 Duncan Mak <duncan@ximian.com>
2117 * AssemblyInfo.cs: Bump the version number to 0.19.
2119 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2121 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2123 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2125 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2127 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2129 * cs-parser.jay: Small fix: we were not comparing the constructor
2130 name correctly. Thanks to Zoltan for the initial pointer.
2132 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2134 * cs-tokenizer.cs: Set file name when specified with #line
2136 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2138 * cs-parser.jay: Only perform the constructor checks here if we
2139 are named like the class; This will help provider a better
2140 error. The constructor path is taken when a type definition is
2141 not found, but most likely the user forgot to add the type, so
2142 report that rather than the constructor error.
2144 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2146 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2149 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2151 * cs-parser.jay: Add cleanup call.
2153 2003-01-13 Duncan Mak <duncan@ximian.com>
2155 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2156 consistent with other methods.
2158 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2160 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2162 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2164 * attribute.cs: only set GuidAttr to true when we have a
2167 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2171 * typemanager.cs: fixes to allow mcs compile corlib with the new
2172 Type.IsSubclassOf fix.
2174 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2176 * expression.cs (LocalVariableReference.DoResolve): Classify a
2177 constant as a value, not as a variable. Also, set the type for
2180 * cs-parser.jay (fixed_statement): take a type instead of a
2181 pointer_type, so we can produce a better error message later.
2183 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2186 (For.DoEmit): Make inifinite loops have a
2187 non-conditional branch back.
2189 (Fixed.DoEmit): First populate the pinned variables, then emit the
2190 statement, then clear the variables. Before I was emitting the
2191 code once for each fixed piece.
2194 2003-01-08 Martin Baulig <martin@ximian.com>
2196 * statement.cs (FlowBranching.MergeChild): A break in a
2197 SWITCH_SECTION does not leave a loop. Fixes #36155.
2199 2003-01-08 Martin Baulig <martin@ximian.com>
2201 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2202 lives in the same number space than `param_map'. Fixes #36154.
2204 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2206 * cs-parser.jay (constructor_declaration): Set the
2207 Constructor.ModFlags before probing for it. This makes the
2208 compiler report 514, 515 and 132 (the code was there, but got
2211 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2212 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2213 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2215 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2217 * enum.cs: create the enum static fields using the enum type.
2219 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2221 * class.cs: don't try to create the ParamBuilder for the return
2222 type if it's not needed (and handle it breaking for the ms runtime
2225 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2227 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2229 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2231 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2232 the command. This showed up while compiling the JANET source
2233 code, which used \r as its only newline separator.
2235 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2237 * class.cs (Method.Define): If we are an operator (because it
2238 reuses our code), then set the SpecialName and HideBySig. #36128
2240 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2242 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2243 exception, report error 120 `object reference required'.
2245 * driver.cs: Add --pause option, used during to measure the size
2246 of the process as it goes with --timestamp.
2248 * expression.cs (Invocation.DoResolve): Do not allow methods with
2249 SpecialName to be invoked.
2251 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2253 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2254 number before adding it.
2256 2002-12-21 Ravi Pratap <ravi@ximian.com>
2258 * ecore.cs (StandardImplicitConversion): When in an unsafe
2259 context, we allow conversion between void * to any other pointer
2260 type. This fixes bug #35973.
2262 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2264 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2265 is not thrown when extensionless outputs are used
2267 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2269 * rootcontext.cs: fixed compilation of corlib.
2271 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2273 * attribute.cs (Attributes.Contains): Add new method.
2275 * class.cs (MethodCore.LabelParameters): if the parameter is an
2276 `out' parameter, check that no attribute `[In]' has been passed.
2278 * enum.cs: Handle the `value__' name in an enumeration.
2280 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2282 * decl.cs: Added special case to allow overrides on "protected
2285 2002-12-18 Ravi Pratap <ravi@ximian.com>
2287 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2288 since it makes much more sense.
2290 (Attributes.ctor): Don't require a Location parameter.
2292 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2294 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2295 since we already have that information per attribute.
2297 * everywhere : make appropriate changes.
2299 * class.cs (LabelParameters): Write the code which actually
2300 applies attributes to the return type. We can't do this on the MS
2301 .NET runtime so we flag a warning in the case an exception is
2304 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2306 * const.cs: Handle implicit null conversions here too.
2308 2002-12-17 Ravi Pratap <ravi@ximian.com>
2310 * class.cs (MethodCore.LabelParameters): Remove the extra
2311 Type [] parameter since it is completely unnecessary. Instead
2312 pass in the method's attributes so that we can extract
2313 the "return" attribute.
2315 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2317 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2318 of ignoring it and letting the compile continue.
2320 * typemanager.cs (ChangeType): use an extra argument to return an
2321 error condition instead of throwing an exception.
2323 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2325 * expression.cs (Unary.TryReduce): mimic the code for the regular
2326 code path. Perform an implicit cast in the cases where we can
2327 implicitly convert to one of the integral types, and then reduce
2328 based on that constant. This fixes bug #35483.
2330 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2332 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2334 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2336 * namespace.cs: fixed bug #35489.
2338 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2340 * class.cs: Remove some dead code.
2342 * cs-parser.jay: Estimate the number of methods needed
2343 (RootContext.MethodCount);
2345 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2346 numbers instead of StringBuilders.
2348 * support.cs (PtrHashtable): Add constructor with initial size;
2349 We can now reduce reallocations of the method table.
2351 2002-12-10 Ravi Pratap <ravi@ximian.com>
2353 * attribute.cs (ApplyAttributes): Keep track of the emitted
2354 attributes on a per-target basis. This fixes bug #35413.
2356 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2358 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2359 default to the Windows 1252 encoding.
2361 (UnixParseOption): Support version, thanks to Alp for the missing
2364 * AssemblyInfo.cs: Add nice assembly information.
2366 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2369 * cs-parser.jay: Allow a trailing comma before the close bracked
2370 in the attribute_section production.
2372 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2373 address of the instance was being taken, I will take this out,
2374 because we take the address of the object immediately here.
2376 2002-12-09 Ravi Pratap <ravi@ximian.com>
2378 * typemanager.cs (AreMultipleAllowed): Take care of the most
2379 obvious case where attribute type is not in the current assembly -
2382 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2384 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2385 definitions, instead of doing that afterwards.
2387 Also we use a nice little hack, depending on the constructor, we
2388 know if we are a "composed" name or a simple name. Hence, we
2389 avoid the IndexOf test, and we avoid
2391 * codegen.cs: Add code to assist in a bug reporter to track down
2392 the source of a compiler crash.
2394 2002-12-07 Ravi Pratap <ravi@ximian.com>
2396 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2397 types have been emitted for a given element and flag an error
2398 if something which does not have AllowMultiple set is used more
2401 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2402 attribute types and their corresponding AllowMultiple properties
2404 (AreMultipleAllowed): Check the property for a given type.
2406 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2407 property in the case we have a TypeContainer.
2409 (Attributes.AddAttribute): Detect duplicates and just skip on
2410 adding them. This trivial fix catches a pretty gross error in our
2411 attribute emission - global attributes were being emitted twice!
2413 Bugzilla bug #33187 is now fixed.
2415 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2417 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2420 * expression.cs (Binary.ResolveOperator): I can only use the
2421 Concat (string, string, string) and Concat (string, string,
2422 string, string) if the child is actually a concatenation of
2425 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2427 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2428 context where we need a 2-character lookahead.
2430 * pending.cs (PendingImplementation): Rework so we can keep track
2431 of interface types all the time, and flag those which were
2432 implemented by parents as optional.
2434 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2436 * expression.cs (Binary.ResolveOperator): Use
2437 String.Concat(string,string,string) or
2438 String.Concat(string,string,string,string) when possible.
2440 * typemanager: More helper methods.
2443 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2445 * pending.cs: remove the bogus return from GetMissingInterfaces()
2446 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2448 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2450 * namespace.cs: avoid duplicated 'using xxx' being added to
2451 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2452 when we get more than one 'using' statement for the same namespace.
2453 Report a CS0105 warning for it.
2455 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2457 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2458 of calling getChar/putback, uses internal knowledge of it.
2460 (xtoken): Reorder tokenizer so most common patterns are checked
2461 first. This reduces the compilation time in another 5% (from 8.11s
2462 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2464 The parsing time is 22% of the compilation in mcs, and from that
2465 64% is spent on the tokenization process.
2467 I tried using a binary search for keywords, but this is slower
2468 than the hashtable. Another option would be to do a couple of
2471 * Not use a StringBuilder, instead use an array of chars,
2472 with a set value. Notice that this way we could catch
2473 the 645 error without having to do it *afterwards*.
2475 * We could write a hand-parser to avoid the hashtable
2476 compares altogether.
2478 The identifier consumption process takes 37% of the tokenization
2479 time. Another 15% is spent on is_number. 56% of the time spent
2480 on is_number is spent on Int64.Parse:
2482 * We could probably choose based on the string length to
2483 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2486 Another 3% is spend on wrapping `xtoken' in the `token' function.
2488 Handle 0xa0 as whitespace (#34752)
2490 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2492 * typemanager.cs (IsCLRType): New routine to tell whether a type
2493 is one of the builtin types.
2495 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2496 typecode in more places instead of doing pointer comparissions.
2497 We could leverage some knowledge about the way the typecodes are
2500 New code to cache namespaces in assemblies, it is currently not
2501 invoked, to be used soon.
2503 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2505 * expression.cs (Binary.ResolveOperator): specially handle
2506 strings, and do not perform user-defined operator overloading for
2509 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2511 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2512 internalcall as it is a pretty simple operation; Avoid whenever
2513 possible to call Char.IsLetter.
2515 (consume_identifier): Cut by half the number of
2516 hashtable calls by merging the is_keyword and GetKeyword behavior.
2518 Do not short-circuit, because if we do, we
2519 report errors (ie, #if false && true would produce an invalid
2523 2002-11-24 Martin Baulig <martin@ximian.com>
2525 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2526 check constant ranges and report a CS0221. Fixes #33186.
2528 2002-11-24 Martin Baulig <martin@ximian.com>
2530 * cs-parser.jay: Make this work for uninitialized variable
2531 declarations in the `for' initializer. Fixes #32416.
2533 2002-11-24 Martin Baulig <martin@ximian.com>
2535 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2536 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2538 2002-11-24 Martin Baulig <martin@ximian.com>
2540 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2541 argument; if true, we also check for user-defined conversions.
2542 This is only needed if both arguments are of a user-defined type.
2543 Fixes #30443, added test-175.cs.
2544 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2546 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2548 2002-11-24 Martin Baulig <martin@ximian.com>
2550 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2551 function to get the store opcode.
2552 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2553 only emit the Ldelema if the store opcode is Stobj. You must run
2554 both test-34 and test-167 to test this. Fixes #34529.
2556 2002-11-23 Martin Baulig <martin@ximian.com>
2558 * ecore.cs (Expression.MemberLookup): Added additional
2559 `qualifier_type' argument which is used when we're being called
2560 from MemberAccess.DoResolve() and null if we're called from a
2562 (Expression.MemberLookupFailed): New method to report errors; this
2563 does the CS1540 check and reports the correct error message.
2565 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2566 argument for the CS1540 check and redone the way how we're dealing
2567 with private members. See the comment in the source code for details.
2568 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2569 `closure_start_type' to `closure_qualifier_type' and check whether
2570 it's not null. It was not this filter being broken, it was just
2571 being called with the wrong arguments.
2573 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2574 and pass it the correct `qualifier_type'; this also does the error
2577 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2579 * expression.cs (Invocation.EmitParams): If the we are dealing
2580 with a non-built-in value type, load its address as well.
2582 (ArrayCreation): Use a a pretty constant instead
2583 of the hardcoded value 2. Use 6 instead of 2 for the number of
2584 static initializers.
2586 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2587 because they are not really value types, just glorified integers.
2589 * driver.cs: Do not append .exe, the CSC compiler does not do it.
2591 * ecore.cs: Remove redundant code for enumerations, make them use
2592 the same code path as everything else, fixes the casting issue
2593 with enumerations in Windows.Forms.
2595 * attribute.cs: Do only cast to string if it is a string, the
2596 validation happens later.
2598 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2599 people upgrade their corlibs.
2601 * ecore.cs: Oops, enumerations were not following the entire code path
2603 2002-11-21 Miguel de Icaza <miguel@ximian.com>
2605 * typemanager.cs (FilterWithClosure): Commented out the test for
2606 1540 in typemanager.cs, as it has problems when accessing
2607 protected methods from a parent class (see test-174.cs).
2609 * attribute.cs (Attribute.ValidateGuid): new method.
2610 (Attribute.Resolve): Use above.
2612 2002-11-19 Miguel de Icaza <miguel@ximian.com>
2614 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2616 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2617 handling for enumerations, as we only needed the TypeContainer
2618 functionality to begin with (this is required for the fix below to
2619 work for enums that reference constants in a container class for
2622 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2624 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2625 a valid TypeBuilder to perform lookups on.o
2627 * class.cs (InheritableMemberSignatureCompare): Use true in the
2628 call to GetGetMethod and GetSetMethod, because we are comparing
2629 the signature, and we need to get the methods *even* if they are
2632 (PropertyBase.CheckBase): ditto.
2634 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2635 GotoCase.Resolve): Use Peel on EmpytCasts.
2637 * ecore.cs (EmptyCast): drop child, add Peel method.
2639 2002-11-17 Martin Baulig <martin@ximian.com>
2641 * ecore.cs (EmptyCast.Child): New public property.
2643 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2644 label resolved to an EmptyCast. Fixes #34162.
2645 (GotoCase.Resolve): Likewise.
2646 (Block.EmitMeta): Likewise.
2648 2002-11-17 Martin Baulig <martin@ximian.com>
2650 * expression.cs (Invocation.BetterConversion): Prefer int over
2651 uint; short over ushort; long over ulong for integer literals.
2652 Use ImplicitConversionExists instead of StandardConversionExists
2653 since we also need to check for user-defined implicit conversions.
2654 Fixes #34165. Added test-173.cs.
2656 2002-11-16 Martin Baulig <martin@ximian.com>
2658 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2659 with the `true' and `false' literals. Fixes #33151.
2661 2002-11-16 Martin Baulig <martin@ximian.com>
2663 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2664 October 22nd; don't do the cs1540 check for static members.
2666 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2667 now using our own filter here and doing the cs1540 check again.
2669 2002-11-16 Martin Baulig <martin@ximian.com>
2671 * support.cs (InternalParameters): Don't crash if we don't have
2672 any fixed parameters. Fixes #33532.
2674 2002-11-16 Martin Baulig <martin@ximian.com>
2676 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2677 when looking up static methods to make this work on Windows.
2680 2002-11-16 Martin Baulig <martin@ximian.com>
2682 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2683 a setter rather than using PropertyInfo.CanWrite.
2685 2002-11-15 Nick Drochak <ndrochak@gol.com>
2687 * class.cs: Allow acces to block member by subclasses. Fixes build
2690 2002-11-14 Martin Baulig <martin@ximian.com>
2692 * class.cs (Constructor.Emit): Added the extern/block check.
2695 2002-11-14 Martin Baulig <martin@ximian.com>
2697 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2698 iteration while looking for indexers, this is needed because the
2699 indexer may have a different name in our base classes. Fixed the
2700 error reporting (no indexers at all, not get accessor, no
2701 overloaded match). Fixes bug #33089.
2702 (IndexerAccess.DoResolveLValue): Likewise.
2704 2002-11-14 Martin Baulig <martin@ximian.com>
2706 * class.cs (PropertyBase.CheckBase): Make this work for multiple
2707 indexers. Fixes the first part of bug #33089.
2708 (MethodSignature.InheritableMemberSignatureCompare): Added support
2711 2002-11-13 Ravi Pratap <ravi@ximian.com>
2713 * attribute.cs (Attribute.Resolve): Catch the
2714 NullReferenceException and report it since it isn't supposed to
2717 2002-11-12 Miguel de Icaza <miguel@ximian.com>
2719 * expression.cs (Binary.EmitBranchable): Also handle the cases for
2720 LogicalOr and LogicalAnd that can benefit from recursively
2721 handling EmitBranchable. The code now should be nice for Paolo.
2723 2002-11-08 Miguel de Icaza <miguel@ximian.com>
2725 * typemanager.cs (LookupType): Added a negative-hit hashtable for
2726 the Type lookups, as we perform quite a number of lookups on
2727 non-Types. This can be removed once we can deterministically tell
2728 whether we have a type or a namespace in advance.
2730 But this might require special hacks from our corlib.
2734 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2735 and double which avoids a conversion from an integer to a double.
2737 * expression.cs: tiny optimization, avoid calling IsConstant,
2738 because it effectively performs the lookup twice.
2740 2002-11-06 Miguel de Icaza <miguel@ximian.com>
2742 But a bogus return here to keep the semantics of the old code
2743 until the Mono runtime is fixed.
2745 * pending.cs (GetMissingInterfaces): New method used to remove all
2746 the interfaces that are already implemented by our parent
2747 classes from the list of pending methods.
2749 * interface.cs: Add checks for calls after ResolveTypeExpr.
2751 2002-11-05 Miguel de Icaza <miguel@ximian.com>
2753 * class.cs (Class.Emit): Report warning 67: event not used if the
2754 warning level is beyond 3.
2756 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2757 being a NullLiteral.
2759 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2762 * class.cs (TypeContainer.GetClassBases): Cover a missing code
2763 path that might fail if a type can not be resolved.
2765 * expression.cs (Binary.Emit): Emit unsigned versions of the
2768 * driver.cs: use error 5.
2770 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2772 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2774 2002-11-01 Miguel de Icaza <miguel@ximian.com>
2776 * cs-parser.jay (switch_section): A beautiful patch from Martin
2777 Baulig that fixed 33094.
2779 2002-10-31 Miguel de Icaza <miguel@ximian.com>
2781 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2782 Check whether the base is abstract and report an error if so.
2784 * expression.cs (IndexerAccess.DoResolveLValue,
2785 IndexerAccess.DoResolve): ditto.
2787 (Invocation.DoResolve): ditto.
2789 (Invocation.FullMethodDesc): Improve the report string.
2791 * statement.cs (Block): Eliminate IsVariableDefined as it is
2792 basically just a wrapper for GetVariableInfo.
2794 * ecore.cs (SimpleName): Use new
2796 * support.cs (ReflectionParamter.ParameterType): We unwrap the
2797 type, as we return the actual parameter ref/unref state on a
2800 2002-10-30 Miguel de Icaza <miguel@ximian.com>
2802 * support.cs: Return proper flags REF/OUT fixing the previous
2805 * expression.cs: Reverted last patch, that was wrong. Is_ref is
2806 not used to mean `ref' but `ref or out' in ParameterReference
2808 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
2809 full type signature instead of calling TypeManger.CSharpName
2812 * support.cs (InternalParameters.ParameterDesc): Do not compare
2813 directly to the modflags, because REF/OUT will actually be bitsets
2816 * delegate.cs (VerifyMethod): Check also the modifiers.
2818 * cs-tokenizer.cs: Fix bug where floating point values with an
2819 exponent where a sign was missing was ignored.
2821 * driver.cs: Allow multiple assemblies to be specified in a single
2824 2002-10-28 Miguel de Icaza <miguel@ximian.com>
2826 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
2827 because identifiers after a parenthesis would end up in this kind
2828 of production, and we needed to desamiguate it for having casts
2831 (UserDefinedType *) xxx
2833 2002-10-24 Miguel de Icaza <miguel@ximian.com>
2835 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
2836 we should set on the Bindingflags.NonPublic, but not turn on
2837 private_ok. private_ok controls whether a Private member is
2838 returned (this is chekced on the filter routine), while the
2839 BindingFlags.NonPublic just controls whether private/protected
2840 will be allowed. This fixes the problem part of the problem of
2841 private properties being allowed to be used in derived classes.
2843 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
2844 so we can call the children DoResolveLValue method (this will
2845 properly signal errors on lvalue assignments to base properties)
2847 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
2848 getter are null, and we have a property info, we know that this
2849 happened because the lookup failed, so we report an error 122 for
2850 protection level violation.
2852 We also silently return if setter and getter are null in the
2853 resolve functions, this condition only happens if we have flagged
2854 the error before. This is the other half of the problem.
2856 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
2857 not have accessibility information, that is why we were returning
2858 true in the filter function in typemanager.cs.
2860 To properly report 122 (property is inaccessible because of its
2861 protection level) correctly, we report this error in ResolveAccess
2862 by failing if both the setter and the getter are lacking (ie, the
2865 DoResolve and DoLResolve have been modified to check for both
2866 setter/getter being null and returning silently, the reason being
2867 that I did not want to put the knowledge about this error in upper
2870 int old = Report.Errors;
2871 x = new PropertyExpr (...);
2872 if (old != Report.Errors)
2877 So the property expr is returned, but it is invalid, so the error
2878 will be flagged during the resolve process.
2880 * class.cs: Remove InheritablePropertySignatureCompare from the
2881 class, as we no longer depend on the property signature to compute
2882 whether it is possible to implement a method or not.
2884 The reason is that calling PropertyInfo.GetGetMethod will return
2885 null (in .NET, in Mono it works, and we should change this), in
2886 cases where the Get Method does not exist in that particular
2891 class X { public virtual int A { get { return 1; } } }
2893 class Z : Y { public override int A { get { return 2; } } }
2895 Would fail in Z because the parent (Y) would not have the property
2896 defined. So we avoid this completely now (because the alternative
2897 fix was ugly and slow), and we now depend exclusively on the
2900 (PropertyBase.CheckBase): Use a method-base mechanism to find our
2901 reference method, instead of using the property.
2903 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2904 routines are gone now.
2906 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2907 names, they were incorrectly named.
2909 * cs-tokenizer.cs: Return are more gentle token on failure.
2911 * pending.cs (PendingImplementation.InterfaceMethod): This routine
2912 had an out-of-sync index variable, which caused it to remove from
2913 the list of pending methods the wrong method sometimes.
2915 2002-10-22 Miguel de Icaza <miguel@ximian.com>
2917 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2918 CanWrite, because those refer to this particular instance of the
2919 property, and do not take into account the fact that we can
2920 override single members of a property.
2922 Constructor requires an EmitContext. The resolution process does
2923 not happen here, but we need to compute the accessors before,
2924 because the resolution does not always happen for properties.
2926 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
2927 subclass, before we did not update this flag, but we did update
2930 (GetAccessors): Drop this routine, as it did not work in the
2931 presence of partially overwritten set/get methods.
2933 Notice that this broke the cs1540 detection, but that will require
2936 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2940 * driver.cs: issue a warning instead of an error if we don't support
2941 debugging for the platform. Also ignore a couple of errors that may
2942 arise when trying to write the symbols. Undo my previous patch.
2944 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2946 * driver.cs: ignore /debug switch except for Unix platforms.
2948 2002-10-23 Nick Drochak <ndrochak@gol.com>
2950 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
2952 2002-10-21 Miguel de Icaza <miguel@ximian.com>
2954 * driver.cs: Do not make mcs-debug conditional, so we do not break
2957 * statement.cs (UsageVector.MergeChildren): I would like Martin to
2958 review this patch. But basically after all the children variables
2959 have been merged, the value of "Breaks" was not being set to
2960 new_breaks for Switch blocks. I think that it should be set after
2961 it has executed. Currently I set this to the value of new_breaks,
2962 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
2963 conservative, but I do not understand this code very well.
2965 I did not break anything in the build, so that is good ;-)
2967 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
2969 2002-10-20 Mark Crichton <crichton@gimp.org>
2971 * cfold.cs: Fixed compile blocker. Really fixed it this time.
2973 2002-10-20 Nick Drochak <ndrochak@gol.com>
2975 * cfold.cs: Fixed compile blocker.
2977 2002-10-20 Miguel de Icaza <miguel@ximian.com>
2979 * driver.cs: I was chekcing the key, not the file.
2981 2002-10-19 Ravi Pratap <ravi@ximian.com>
2983 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
2984 message that we were generating - we just need to silently return
2987 2002-10-19 Miguel de Icaza <miguel@ximian.com>
2989 * class.cs (Event.Define): Change my previous commit, as this
2990 breaks the debugger. This is a temporary hack, as it seems like
2991 the compiler is generating events incorrectly to begin with.
2993 * expression.cs (Binary.ResolveOperator): Added support for
2994 "U operator - (E x, E y)"
2996 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
2999 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3000 init-only variables, but this path did not take into account that
3001 there might be also instance readonly variables. Correct this
3004 This fixes bug 32253
3006 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3009 * driver.cs: Change the extension for modules to `netmodule'
3011 * cs-parser.jay: Improved slightly the location tracking for
3012 the debugger symbols.
3014 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3015 modifiers that were specified instead of the hardcoded value
3016 (FamAndAssem). This was basically ignoring the static modifier,
3017 and others. Fixes 32429.
3019 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3020 fixed a bug in the process (32476)
3022 * expression.cs (ArrayAccess.EmitAssign): Patch from
3023 hwang_rob@yahoo.ca that fixes bug 31834.3
3025 2002-10-18 Miguel de Icaza <miguel@ximian.com>
3027 * driver.cs: Make the module extension .netmodule.
3029 2002-10-16 Miguel de Icaza <miguel@ximian.com>
3031 * driver.cs: Report an error if the resource file is not found
3032 instead of crashing.
3034 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3035 false, like Emit does.
3037 2002-10-16 Nick Drochak <ndrochak@gol.com>
3039 * typemanager.cs: Remove unused private member. Also reported mcs
3040 bug to report this as a warning like csc.
3042 2002-10-15 Martin Baulig <martin@gnome.org>
3044 * statement.cs (Statement.Emit): Made this a virtual method; emits
3045 the line number info and calls DoEmit().
3046 (Statement.DoEmit): New protected abstract method, formerly knows
3047 as Statement.Emit().
3049 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3051 2002-10-11 Miguel de Icaza <miguel@ximian.com>
3053 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3054 have fixed a remaining problem: not every AddXXXX was adding a
3055 fully qualified name.
3057 Now everyone registers a fully qualified name in the DeclSpace as
3058 being defined instead of the partial name.
3060 Downsides: we are slower than we need to be due to the excess
3061 copies and the names being registered this way.
3063 The reason for this is that we currently depend (on the corlib
3064 bootstrap for instance) that types are fully qualified, because
3065 we dump all the types in the namespace, and we should really have
3066 types inserted into the proper namespace, so we can only store the
3067 basenames in the defined_names array.
3069 2002-10-10 Martin Baulig <martin@gnome.org>
3071 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3072 from bug #31834, see the bug report for a testcase which is
3075 2002-10-10 Martin Baulig <martin@gnome.org>
3077 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3078 flow analysis code for this.
3080 * statement.cs (Do, While, For): Tell the flow analysis code about
3082 (FlowBranching.UsageVector): Added support for infinite loops.
3083 (Block.Resolve): Moved the dead code elimination here and use flow
3086 2002-10-09 Miguel de Icaza <miguel@ximian.com>
3088 * class.cs (Field.Define): Catch cycles on struct type
3091 * typemanager.cs (IsUnmanagedtype): Do not recursively check
3092 fields if the fields are static. We only need to check instance
3095 * expression.cs (As.DoResolve): Test for reference type.
3097 * statement.cs (Using.ResolveExpression): Use
3098 ConvertImplicitRequired, not ConvertImplicit which reports an
3100 (Using.ResolveLocalVariableDecls): ditto.
3102 * expression.cs (Binary.ResolveOperator): Report errors in a few
3103 places where we had to.
3105 * typemanager.cs (IsUnmanagedtype): Finish implementation.
3107 2002-10-08 Miguel de Icaza <miguel@ximian.com>
3109 * expression.cs: Use StoreFromPtr instead of extracting the type
3110 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3112 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3113 an enumeration value to a System.Enum, but System.Enum is not a
3114 value type, but an class type, so we need to box.
3116 (Expression.ConvertExplicit): One codepath could return
3117 errors but not flag them. Fix this. Fixes #31853
3119 * parameter.cs (Resolve): Do not allow void as a parameter type.
3121 2002-10-06 Martin Baulig <martin@gnome.org>
3123 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3124 if it's a class type and not a struct. Fixes #31815.
3126 2002-10-06 Martin Baulig <martin@gnome.org>
3128 * statement.cs: Reworked the flow analysis code a bit to make it
3129 usable for dead code elimination.
3131 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3133 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3135 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3137 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3138 to fix the test 165, will investigate deeper.
3140 2002-10-04 Martin Baulig <martin@gnome.org>
3142 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3143 finally blocks actually work.
3144 (Try.Resolve): We don't need to create a sibling for `finally' if
3145 there is no finally block.
3147 2002-10-04 Martin Baulig <martin@gnome.org>
3149 * class.cs (Constructor.Define): The default accessibility for a
3150 non-default constructor is private, not public.
3152 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3154 * class.cs (Constructor): Make AllowedModifiers public, add
3157 * cs-parser.jay: Perform the modifiers test here, as the
3158 constructor for the Constructor class usually receives a zero
3159 because of the way we create it (first we create, later we
3160 customize, and we were never checking the modifiers).
3162 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3163 is a version of LookupTypeReflection that includes the type-name
3164 cache. This can be used as a fast path for functions that know
3165 the fully qualified name and are only calling into *.GetType() to
3166 obtain a composed type.
3168 This is also used by TypeManager.LookupType during its type
3171 (LookupType): We now also track the real type name, as sometimes
3172 we can get a quey for the real type name from things like
3173 ComposedCast. This fixes bug 31422.
3175 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3176 complete type fullname, it does not have to go through the type
3177 resolution system to obtain the composed version of the type (for
3178 obtaining arrays or pointers).
3180 (Conditional.Emit): Use the EmitBoolExpression to
3181 generate nicer code, as requested by Paolo.
3183 (ArrayCreation.CheckIndices): Use the patch from
3184 hwang_rob@yahoo.ca to validate the array initializers.
3186 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3188 * class.cs (ConstructorInitializer.Emit): simplify code by using
3189 Invocation.EmitCall, and at the same time, fix the bugs in calling
3190 parent constructors that took variable arguments.
3192 * ecore.cs (Expression.ConvertNumericExplicit,
3193 Expression.ImplicitNumericConversion): Remove the code that
3194 manually wrapped decimal (InternalTypeConstructor call is now gone
3197 * expression.cs (Cast.TryReduce): Also handle decimal types when
3198 trying to perform a constant fold on the type.
3200 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3202 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3203 that only turned off an error report, and did nothing else.
3205 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3207 * driver.cs: Handle and ignore /fullpaths
3209 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3211 * expression.cs (Binary.ResolveOperator): Catch the case where
3212 DoNumericPromotions returns true,
3214 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3216 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3218 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3221 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3223 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3224 conversion exists, but it is also required that the conversion be
3225 performed. This manifested in "(Type64Enum) 2".
3227 * class.cs (TypeManager.AddMethod): The fix is not to change
3228 AddEnum, because that one was using a fully qualified name (every
3229 DeclSpace derivative does), but to change the AddMethod routine
3230 that was using an un-namespaced name. This now correctly reports
3231 the duplicated name.
3233 Revert patch until I can properly fix it. The issue
3234 is that we have a shared Type space across all namespaces
3235 currently, which is wrong.
3237 Options include making the Namespace a DeclSpace, and merge
3238 current_namespace/current_container in the parser.
3240 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3242 * cs-parser.jay: Improve error reporting when we get a different
3243 kind of expression in local_variable_type and
3244 local_variable_pointer_type.
3246 Propagate this to avoid missleading errors being reported.
3248 * ecore.cs (ImplicitReferenceConversion): treat
3249 TypeManager.value_type as a target just like object_type. As
3254 Is valid, and needs to result in the int 1 being boxed before it
3255 is assigned to the value type v.
3257 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3258 to validate the enumeration name.
3260 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3261 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3262 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3264 * ecore.cs (TryImplicitIntConversion): When doing an
3265 implicit-enumeration-conversion, check if the type is 64-bits and
3266 perform a conversion before passing to EnumConstant.
3268 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3270 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3271 report ambiguous type references. Unlike the MS version, we
3272 report what the ambiguity is. Innovation at work ;-)
3274 (DeclSpace.FindType): Require a location argument to
3275 display when we display an ambiguous error.
3277 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3279 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3281 * expression.cs (EmitDynamicInitializers): Apply patch from
3282 hwang_rob@yahoo.ca that fixes the order in which we emit our
3285 2002-09-21 Martin Baulig <martin@gnome.org>
3287 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3288 delegate takes no arguments.
3290 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3292 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3295 * expression.cs: Extract the underlying type.
3297 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3299 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3301 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3303 * class.cs (TypeContainer.DefineType): We can not use the nice
3304 PackingSize with the size set to 1 DefineType method, because it
3305 will not allow us to define the interfaces that the struct
3308 This completes the fixing of bug 27287
3310 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3311 means also structs. This fixes part of the problem.
3312 (Expresion.ImplicitReferenceConversionExists): ditto.
3314 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3315 error if there were no errors reported during the type lookup
3316 process, to avoid duplicates or redundant errors. Without this
3317 you would get an ambiguous errors plus a type not found. We have
3318 beaten the user enough with the first error.
3320 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3323 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3324 during the resolution process, stop the lookup, this avoids
3325 repeated error reports (same error twice).
3327 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3329 * typemanager.cs (LookupType): Redo the type lookup code to match
3330 the needs of System.Reflection.
3332 The issue is that System.Reflection requires references to nested
3333 types to begin with a "+" sign instead of a dot. So toplevel
3334 types look like: "NameSpace.TopLevelClass", and nested ones look
3335 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3338 2002-09-19 Martin Baulig <martin@gnome.org>
3340 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3341 says that a method always returns or always throws an exception,
3342 don't report the CS0161.
3344 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3345 set `Returns = new_returns'.
3347 2002-09-19 Martin Baulig <martin@gnome.org>
3349 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3350 to an enum constant, check for a CS0176.
3352 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3354 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3355 for operators that must be in pairs and report errors.
3357 * ecore.cs (SimpleName.DoResolveType): During the initial type
3358 resolution process, when we define types recursively, we must
3359 check first for types in our current scope before we perform
3360 lookups in the enclosing scopes.
3362 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3364 (Invocation.VerifyArgumentsCompat): Call
3365 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3366 I thought we were supposed to always call this, but there are a
3367 few places in the code where we dont do it.
3369 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3371 * driver.cs: Add support in -linkres and -resource to specify the
3372 name of the identifier.
3374 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3376 * ecore.cs (StandardConversionExists): Sync with the conversion
3377 code: allow anything-* to void* conversions.
3379 (FindMostSpecificSource): Use an Expression argument
3380 instead of a Type, because we might be handed over a Literal which
3381 gets a few more implicit conversions that plain types do not. So
3382 this information was being lost.
3384 Also, we drop the temporary type-holder expression when not
3387 2002-09-17 Martin Baulig <martin@gnome.org>
3389 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3390 this is an explicit interface implementation.
3392 2002-09-17 Martin Baulig <martin@gnome.org>
3394 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3395 different `IndexerName' attributes.
3397 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3398 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3399 virtual CommonResolve().
3401 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3403 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3404 and convert that to the UnderlyingType.
3406 * statement.cs (Foreach.Resolve): Indexers are just like variables
3407 or PropertyAccesses.
3409 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3410 inside quoted strings, we were not doing this before.
3412 2002-09-16 Martin Baulig <martin@gnome.org>
3414 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3415 resolve it. This is needed for the definite assignment check of the
3416 instance expression, fixes bug #29846.
3417 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3419 2002-09-16 Nick Drochak <ndrochak@gol.com>
3421 * parameter.cs: Fix compile error. Cannot reference static member
3422 from an instance object. Is this an mcs bug?
3424 2002-09-14 Martin Baulig <martin@gnome.org>
3426 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3427 multiple times. Fixes bug #30295, added test-166.cs.
3429 2002-09-14 Martin Baulig <martin@gnome.org>
3431 * statement.cs (Block.Emit): Don't emit unreachable code.
3432 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3434 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3436 2002-09-14 Martin Baulig <martin@gnome.org>
3438 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3441 2002-09-14 Martin Baulig <martin@gnome.org>
3443 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3444 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3445 be false on the ms runtime.
3447 2002-09-13 Martin Baulig <martin@gnome.org>
3449 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3450 the CS0038 error message.
3452 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3454 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3455 constant inside, return it.
3457 2002-09-12 Martin Baulig <martin@gnome.org>
3459 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3460 implicit conversion can be done between enum types.
3462 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3463 check whether an implicit conversion to the current enum's UnderlyingType
3464 exists and report an error if not.
3466 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3467 without debugging support.
3469 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3470 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3472 2002-09-12 Martin Baulig <martin@gnome.org>
3474 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3476 * ecore.cs (IMemberExpr.DeclaringType): New property.
3477 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3478 nonstatic member of an outer type (CS0038).
3480 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3482 * driver.cs: Activate the using-error detector at warning level
3483 4 (at least for MS-compatible APIs).
3485 * namespace.cs (VerifyUsing): Small buglett fix.
3487 * pending.cs (PendingImplementation): pass the container pointer.
3489 * interface.cs (GetMethods): Allow for recursive definition. Long
3490 term, I would like to move every type to support recursive
3491 definitions, not the current ordering mechanism that we have right
3494 The situation is this: Attributes are handled before interfaces,
3495 so we can apply attributes to interfaces. But some attributes
3496 implement interfaces, we will now handle the simple cases
3497 (recursive definitions will just get an error).
3499 * parameter.cs: Only invalidate types at the end if we fail to
3502 2002-09-09 Martin Baulig <martin@gnome.org>
3504 * ecore.cs (PropertyExpr.Emit): Also check for
3505 TypeManager.system_int_array_get_length so this'll also work when
3506 compiling corlib. Fixes #30003.
3508 2002-09-09 Martin Baulig <martin@gnome.org>
3510 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3511 and throw an exception if we can't get the type's size. Fixed #30040,
3514 2002-09-09 Martin Baulig <martin@gnome.org>
3516 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3518 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3519 context. Fixes bug #30027.
3521 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3522 virtual functions. Fixes bug #30043, added test-164.cs.
3524 2002-09-08 Ravi Pratap <ravi@ximian.com>
3526 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3528 2002-09-08 Nick Drochak <ndrochak@gol.com>
3530 * driver.cs: Use an object to get the windows codepage since it's not a
3533 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3535 * statement.cs (For.Emit): for infinite loops (test == null)
3536 return whether there is a break inside, not always "true".
3538 * namespace.cs (UsingEntry): New struct to hold the name of the
3539 using definition, the location where it is defined, and whether it
3540 has been used in a successful type lookup.
3542 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3547 2002-09-06 Ravi Pratap <ravi@ximian.com>
3549 * attribute.cs : Fix incorrect code which relied on catching
3550 a NullReferenceException to detect a null being passed in
3551 where an object was expected.
3553 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3555 * statement.cs (Try): flag the catch variable as assigned
3557 * expression.cs (Cast): Simplified by using ResolveType instead of
3560 * statement.cs (Catch): Fix bug by using ResolveType.
3562 2002-09-06 Ravi Pratap <ravi@ximian.com>
3564 * expression.cs (BetterConversion): Special case for when we have
3565 a NullLiteral as the argument and we have to choose between string
3566 and object types - we choose string the way csc does.
3568 * attribute.cs (Attribute.Resolve): Catch the
3569 NullReferenceException and report error #182 since the Mono
3570 runtime no more has the bug and having this exception raised means
3571 we tried to select a constructor which takes an object and is
3574 2002-09-05 Ravi Pratap <ravi@ximian.com>
3576 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3577 message (1502, 1503) when we can't locate a method after overload
3578 resolution. This is much more informative and closes the bug
3581 * interface.cs (PopulateMethod): Return if there are no argument
3582 types. Fixes a NullReferenceException bug.
3584 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3585 expressions too. Previously we were checking only in one place for
3586 positional arguments leaving out named arguments.
3588 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3589 type to the enum type is not allowed. Remove code corresponding to
3592 (ConvertNumericExplicit): Allow explicit conversions from
3593 the underlying type to enum type. This precisely follows the spec
3594 and closes a bug filed by Gonzalo.
3596 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3599 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3601 2002-09-03 Miguel de Icaza <miguel@ximian.com>
3603 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3604 it was important that we stored the right value after the
3605 reduction in `converted'.
3607 2002-09-04 Martin Baulig <martin@gnome.org>
3609 * location.cs (Location.SymbolDocument): Use full pathnames for the
3612 2002-08-30 Miguel de Icaza <miguel@ximian.com>
3614 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3615 of the expression resolve mechanism, because that will catch the
3616 SimpleName error failures.
3618 (Conditional): If we can not resolve the
3619 expression, return, do not crash.
3621 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3624 (location): display token name instead of its number.
3626 2002-08-28 Martin Baulig <martin@gnome.org>
3628 * expression.cs (Binary.ResolveOperator): Don't silently return
3629 but return an error if an operator cannot be applied between two
3632 2002-08-28 Martin Baulig <martin@gnome.org>
3634 * class.cs (Constructor.Define): Set the permission attributes
3635 correctly instead of making all constructors public.
3637 2002-08-28 Martin Baulig <martin@gnome.org>
3639 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3640 for private members before reporting a CS0103; if we find anything,
3643 2002-08-28 Martin Baulig <martin@gnome.org>
3645 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3646 to check whether `closure_start_type == closure_invocation_type',
3647 we also need to check whether `m.DeclaringType == closure_invocation_type'
3648 before bypassing the permission checks. We might be accessing
3649 protected/private members from the base class.
3650 (TypeManager.RealMemberLookup): Only set private_ok if private
3651 members were requested via BindingFlags.NonPublic.
3653 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3655 * expression.cs (MemberAccess.ResolveMemberAccess): Set
3656 MethodGroupExpr.IsExplicitImpl if appropriate.
3657 (Invocation.DoResolve): Don't report the CS0120 for explicit
3658 interface implementations.
3660 2002-08-27 Martin Baulig <martin@gnome.org>
3662 * expression.cs (Invocation.DoResolve): If this is a static
3663 method and we don't have an InstanceExpression, we must report
3666 2002-08-25 Martin Baulig <martin@gnome.org>
3668 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3669 `==' between a valuetype and an object.
3671 2002-08-25 Miguel de Icaza <miguel@ximian.com>
3673 * ecore.cs (TypeExpr): Provide a ToString method.
3675 2002-08-24 Martin Baulig <martin@gnome.org>
3677 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3678 now called proggie.dbg and it's a binary file.
3680 2002-08-23 Martin Baulig <martin@gnome.org>
3682 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3684 2002-08-23 Martin Baulig <martin@gnome.org>
3686 * struct.cs (MyStructInfo.ctor): Make this work with empty
3687 structs; it's not allowed to use foreach() on null.
3689 2002-08-23 Martin Baulig <martin@gnome.org>
3691 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3692 writer the full pathname of the generated assembly.
3694 2002-08-23 Martin Baulig <martin@gnome.org>
3696 * statements.cs (FlowBranching.UsageVector.MergeChildren):
3697 A `finally' block never returns or breaks; improved handling of
3700 2002-08-23 Martin Baulig <martin@gnome.org>
3702 * statement.cs (Throw.Resolve): Allow `throw null'.
3704 2002-08-23 Martin Baulig <martin@gnome.org>
3706 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3707 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3708 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
3709 MemberLookup would return a wrong event if this is an explicit
3710 interface implementation and the class has an event with the same
3713 2002-08-23 Martin Baulig <martin@gnome.org>
3715 * statement.cs (Block.AddChildVariableNames): New public method.
3716 (Block.AddChildVariableName): Likewise.
3717 (Block.IsVariableNameUsedInChildBlock): Likewise.
3718 (Block.AddVariable): Check whether a variable name has already
3719 been used in a child block.
3721 * cs-parser.jay (declare_local_variables): Mark all variable names
3722 from the current block as being used in a child block in the
3725 2002-08-23 Martin Baulig <martin@gnome.org>
3727 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3728 find the symbol writer.
3730 * driver.cs: csc also allows the arguments to /define being
3731 separated by commas, not only by semicolons.
3733 2002-08-23 Martin Baulig <martin@gnome.org>
3735 * interface.cs (Interface.GetMembers): Added static check for events.
3737 2002-08-15 Martin Baulig <martin@gnome.org>
3739 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3740 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3742 * ecore.cs (Expression.MemberLookup): Added documentation and explained
3743 why the MethodData.EmitDestructor() change was necessary.
3745 2002-08-20 Martin Baulig <martin@gnome.org>
3747 * class.cs (TypeContainer.FindMembers): Added static check for events.
3749 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3751 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3752 use Type.GetEvents(), not Type.FindMembers().
3754 2002-08-20 Martin Baulig <martin@gnome.org>
3756 * decl.cs (MemberCache): Added a special method cache which will
3757 be used for method-only searched. This ensures that a method
3758 search will return a MethodInfo with the correct ReflectedType for
3761 2002-08-20 Martin Baulig <martin@gnome.org>
3763 * decl.cs (DeclSpace.FindMembers): Made this public.
3765 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3767 * delegate.cs: fixed build on windows.
3768 [FIXME: Filed as bug #29150: MCS must report these errors.]
3770 2002-08-19 Ravi Pratap <ravi@ximian.com>
3772 * ecore.cs (StandardConversionExists): Return a false
3773 if we are trying to convert the void type to anything else
3774 since that is not allowed.
3776 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3777 we flag error 70 in the event an event is trying to be accessed
3778 directly from outside the declaring type.
3780 2002-08-20 Martin Baulig <martin@gnome.org>
3782 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3783 MemberCache from typemanager.cs to decl.cs.
3785 2002-08-19 Martin Baulig <martin@gnome.org>
3787 * class.cs (TypeContainer): Implement IMemberContainer.
3788 (TypeContainer.DefineMembers): Create the MemberCache.
3789 (TypeContainer.FindMembers): Do better BindingFlags checking; only
3790 return public members if BindingFlags.Public was given, check
3791 whether members are static.
3793 2002-08-16 Martin Baulig <martin@gnome.org>
3795 * decl.cs (DeclSpace.Define): Splitted this in Define and
3796 DefineMembers. DefineMembers is called first and initializes the
3799 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
3800 DefineMembers() on all our DeclSpaces.
3802 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3803 but call DefineMembers() on all nested interfaces. We call their
3804 Define() in our new Define() function.
3806 * interface.cs (Interface): Implement IMemberContainer.
3807 (Interface.Define): Moved all code except the attribute stuf to
3809 (Interface.DefineMembers): Initialize the member cache.
3811 * typemanager.cs (IMemberFinder): Removed this interface, we don't
3812 need this anymore since we can use MemberCache.FindMembers directly.
3814 2002-08-19 Martin Baulig <martin@gnome.org>
3816 * typemanager.cs (MemberCache): When creating the cache for an
3817 interface type, add all inherited members.
3818 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
3819 to `out bool used_cache' and documented it.
3820 (TypeManager.MemberLookup): If we already used the cache in the first
3821 iteration, we don't need to do the interfaces check.
3823 2002-08-19 Martin Baulig <martin@gnome.org>
3825 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
3826 here from IMemberFinder and don't implement this interface anymore.
3827 (DeclSpace.MemberCache): Moved here from IMemberFinder.
3829 * typemanager.cs (IMemberFinder): This interface is now only used by
3830 classes which actually support the member cache.
3831 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
3832 since we only put DeclSpaces into this Hashtable.
3833 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
3834 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
3836 2002-08-16 Martin Baulig <martin@gnome.org>
3838 * typemanager.cs (ICachingMemberFinder): Removed.
3839 (IMemberFinder.MemberCache): New property.
3840 (TypeManager.FindMembers): Merged this with RealFindMembers().
3841 This function will never be called from TypeManager.MemberLookup()
3842 so we can't use the cache here, just the IMemberFinder.
3843 (TypeManager.MemberLookup_FindMembers): Check whether the
3844 IMemberFinder has a MemberCache and call the cache's FindMembers
3846 (MemberCache): Rewrote larger parts of this yet another time and
3847 cleaned it up a bit.
3849 2002-08-15 Miguel de Icaza <miguel@ximian.com>
3851 * driver.cs (LoadArgs): Support quoting.
3853 (Usage): Show the CSC-like command line arguments.
3855 Improved a few error messages.
3857 2002-08-15 Martin Baulig <martin@gnome.org>
3859 * typemanager.cs (IMemberContainer.Type): New property.
3860 (IMemberContainer.IsInterface): New property.
3862 The following changes are conditional to BROKEN_RUNTIME, which is
3863 defined at the top of the file.
3865 * typemanager.cs (MemberCache.MemberCache): Don't add the base
3866 class'es members, but add all members from TypeHandle.ObjectType
3867 if we're an interface.
3868 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
3869 is the current type.
3870 (MemberCache.CacheEntry.Container): Removed this field.
3871 (TypeHandle.GetMembers): Include inherited members.
3873 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3875 * typemanager.cs: fixed compilation and added a comment on a field that
3878 2002-08-15 Martin Baulig <martin@gnome.org>
3880 * class.cs (ConstructorInitializer.Resolve): In the
3881 Expression.MemberLookup call, use the queried_type as
3884 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
3885 declared' attribute, it's always true.
3886 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3887 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3888 temporary wrapper for FindMembers which tells MemberLookup whether
3889 members from the base classes are included in the return value.
3890 This will go away soon.
3891 (TypeManager.MemberLookup): Use this temporary hack here; once the
3892 new MemberCache is completed, we don't need to do the DeclaredOnly
3893 looping here anymore since the MemberCache will take care of this.
3894 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3895 (MemberCache): When creating the MemberCache for a class, get
3896 members from the current class and all its base classes.
3897 (MemberCache.CacheEntry.Container): New field. This is a
3898 temporary hack until the Mono runtime is fixed to distinguish
3899 between ReflectedType and DeclaringType. It allows us to use MCS
3900 with both the MS runtime and the unfixed Mono runtime without
3901 problems and without accecting performance.
3902 (MemberCache.SearchMembers): The DeclaredOnly looping from
3903 TypeManager.MemberLookup is now done here.
3905 2002-08-14 Martin Baulig <martin@gnome.org>
3907 * statement.cs (MyStructInfo.MyStructInfo): Don't call
3908 Type.GetFields on dynamic types but get the fields from the
3909 corresponding TypeContainer.
3910 (MyStructInfo.GetStructInfo): Added check for enum types.
3912 * typemanager.cs (MemberList.IsSynchronized): Implemented.
3913 (MemberList.SyncRoot): Implemented.
3914 (TypeManager.FilterWithClosure): No need to check permissions if
3915 closure_start_type == closure_invocation_type, don't crash if
3916 closure_invocation_type is null.
3918 2002-08-13 Martin Baulig <martin@gnome.org>
3920 Rewrote TypeContainer.FindMembers to use a member cache. This
3921 gives us a speed increase of about 35% for the self-hosting MCS
3922 build and of about 15-20% for the class libs (both on GNU/Linux).
3924 * report.cs (Timer): New class to get enhanced profiling. This
3925 whole class is "TIMER" conditional since it remarkably slows down
3928 * class.cs (MemberList): New class. This is an IList wrapper
3929 which we're now using instead of passing MemberInfo[]'s around to
3930 avoid copying this array unnecessarily.
3931 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
3932 (ICachingMemberFinder, IMemberContainer): New interface.
3933 (TypeManager.FilterWithClosure): If `criteria' is null, the name
3934 has already been checked, otherwise use it for the name comparision.
3935 (TypeManager.FindMembers): Renamed to RealMemberFinder and
3936 provided wrapper which tries to use ICachingMemberFinder.FindMembers
3937 if possible. Returns a MemberList, not a MemberInfo [].
3938 (TypeHandle): New class, implements IMemberContainer. We create
3939 one instance of this class per type, it contains a MemberCache
3940 which is used to do the member lookups.
3941 (MemberCache): New class. Each instance of this class contains
3942 all members of a type and a name-based hash table.
3943 (MemberCache.FindMembers): This is our new member lookup
3944 function. First, it looks up all members of the requested name in
3945 the hash table. Then, it walks this list and sorts out all
3946 applicable members and returns them.
3948 2002-08-13 Martin Baulig <martin@gnome.org>
3950 In addition to a nice code cleanup, this gives us a performance
3951 increase of about 1.4% on GNU/Linux - not much, but it's already
3952 half a second for the self-hosting MCS compilation.
3954 * typemanager.cs (IMemberFinder): New interface. It is used by
3955 TypeManager.FindMembers to call FindMembers on a TypeContainer,
3956 Enum, Delegate or Interface.
3957 (TypeManager.finder_to_member_finder): New PtrHashtable.
3958 (TypeManager.finder_to_container): Removed.
3959 (TypeManager.finder_to_delegate): Removed.
3960 (TypeManager.finder_to_interface): Removed.
3961 (TypeManager.finder_to_enum): Removed.
3963 * interface.cs (Interface): Implement IMemberFinder.
3965 * delegate.cs (Delegate): Implement IMemberFinder.
3967 * enum.cs (Enum): Implement IMemberFinder.
3969 * class.cs (TypeContainer): Implement IMemberFinder.
3971 2002-08-12 Martin Baulig <martin@gnome.org>
3973 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
3975 2002-08-12 Martin Baulig <martin@gnome.org>
3977 * ecore.cs (ITypeExpression): New interface for expressions which
3979 (TypeExpression): Renamed to TypeLookupExpression.
3980 (Expression.DoResolve): If we're doing a types-only lookup, the
3981 expression must implement the ITypeExpression interface and we
3982 call DoResolveType() on it.
3983 (SimpleName): Implement the new ITypeExpression interface.
3984 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
3985 hack, the situation that we're only looking up types can't happen
3986 anymore when this method is called. Moved the type lookup code to
3987 DoResolveType() and call it.
3988 (SimpleName.DoResolveType): This ITypeExpression interface method
3989 is now doing the types-only lookup.
3990 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
3991 (ResolveFlags): Added MaskExprClass.
3993 * expression.cs (MemberAccess): Implement the ITypeExpression
3995 (MemberAccess.DoResolve): Added support for a types-only lookup
3996 when we're called via ITypeExpression.DoResolveType().
3997 (ComposedCast): Implement the ITypeExpression interface.
3999 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
4000 Expression.Resolve() with ResolveFlags.Type instead.
4002 2002-08-12 Martin Baulig <martin@gnome.org>
4004 * interface.cs (Interface.Define): Apply attributes.
4006 * attribute.cs (Attribute.ApplyAttributes): Added support for
4007 interface attributes.
4009 2002-08-11 Martin Baulig <martin@gnome.org>
4011 * statement.cs (Block.Emit): Only check the "this" variable if we
4012 do not always throw an exception.
4014 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4015 whether the property has a set accessor.
4017 2002-08-11 Martin Baulig <martin@gnome.org>
4019 Added control flow analysis support for structs.
4021 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4022 with control flow analysis turned off.
4023 (IVariable): New interface.
4024 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4025 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4026 (FieldExpr.DoResolve): Resolve the instance expression with flow
4027 analysis turned off and do the definite assignment check after the
4028 resolving when we know what the expression will resolve to.
4030 * expression.cs (LocalVariableReference, ParameterReference):
4031 Implement the new IVariable interface, only call the flow analysis
4032 code if ec.DoFlowAnalysis is true.
4033 (This): Added constructor which takes a Block argument. Implement
4034 the new IVariable interface.
4035 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4036 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4037 This does the definite assignment checks for struct members.
4039 * class.cs (Constructor.Emit): If this is a non-static `struct'
4040 constructor which doesn't have any initializer, call
4041 Block.AddThisVariable() to tell the flow analysis code that all
4042 struct elements must be initialized before control returns from
4045 * statement.cs (MyStructInfo): New public class.
4046 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4047 argument to this indexer. If non-zero, check an individual struct
4048 member, not the whole struct.
4049 (FlowBranching.CheckOutParameters): Check struct members.
4050 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4051 overloaded versions of these methods which take an additional
4052 `int field_idx' argument to check struct members.
4053 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4054 overloaded versions of these methods which take an additional
4055 `string field_name' argument to check struct member.s
4056 (VariableInfo): Implement the IVariable interface.
4057 (VariableInfo.StructInfo): New public property. Returns the
4058 MyStructInfo instance of the variable if it's a struct or null.
4059 (Block.AddThisVariable): New public method. This is called from
4060 Constructor.Emit() for non-static `struct' constructor which do
4061 not have any initializer. It creates a special variable for the
4062 "this" instance variable which will be checked by the flow
4063 analysis code to ensure that all of the struct's fields are
4064 initialized before control returns from the constructor.
4065 (UsageVector): Added support for struct members. If a
4066 variable/parameter is a struct with N members, we reserve a slot
4067 in the usage vector for each member. A struct is considered fully
4068 initialized if either the struct itself (slot 0) or all its
4069 members are initialized.
4071 2002-08-08 Martin Baulig <martin@gnome.org>
4073 * driver.cs (Driver.MainDriver): Only report an error CS5001
4074 if there were no compilation errors.
4076 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4077 `UnsafeContext' property to determine whether the parent is in
4078 unsafe context rather than checking the parent's ModFlags:
4079 classes nested in an unsafe class are unsafe as well.
4081 2002-08-08 Martin Baulig <martin@gnome.org>
4083 * statement.cs (UsageVector.MergeChildren): Distinguish between
4084 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4085 we return. Added test17() and test18() to test-154.cs.
4087 2002-08-08 Martin Baulig <martin@gnome.org>
4089 * typemanager.cs (TypeManager.FilterWithClosure): If we have
4090 Family access, make sure the invoking type isn't a subclass of the
4091 queried type (that'd be a CS1540).
4093 * ecore.cs (Expression.MemberLookup): Added overloaded version of
4094 this method which takes an additional `Type invocation_type'.
4096 * expression.cs (BaseAccess.DoResolve): Use the base type as
4097 invocation and query type.
4098 (MemberAccess.DoResolve): If the lookup failed and we're about to
4099 report a CS0122, try a lookup with the ec.ContainerType - if this
4100 succeeds, we must report a CS1540.
4102 2002-08-08 Martin Baulig <martin@gnome.org>
4104 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4105 (MethodGroupExpr): Implement the IMemberExpr interface.
4107 * expression (MemberAccess.ResolveMemberAccess): No need to have
4108 any special code for MethodGroupExprs anymore, they're now
4111 2002-08-08 Martin Baulig <martin@gnome.org>
4113 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4114 Family, FamANDAssem and FamORAssem permissions.
4115 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4117 2002-08-08 Martin Baulig <martin@gnome.org>
4119 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4120 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4123 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4125 * driver.cs: implemented /resource option to embed managed resources.
4127 2002-08-07 Martin Baulig <martin@gnome.org>
4129 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4130 (FieldBase.HasFieldInitializer): New public property.
4131 (FieldBase.GetInitializerExpression): New public method. Resolves and
4132 returns the field initializer and makes sure it is only resolved once.
4133 (TypeContainer.EmitFieldInitializers): Call
4134 FieldBase.GetInitializerExpression to get the initializer, this ensures
4135 that it isn't resolved multiple times.
4137 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4138 the resolving process (SimpleName/MemberLookup) that we're currently
4139 emitting a field initializer (which must not access any instance members,
4140 this is an error CS0236).
4142 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4143 argument, if the `IsFieldInitializer' flag is set, we must report and
4144 error CS0236 and not an error CS0120.
4146 2002-08-07 Martin Baulig <martin@gnome.org>
4148 * ecore.cs (IMemberExpr): New public interface.
4149 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4150 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4151 if the expression is an IMemberExpr.
4153 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4154 to be null, implicitly default to `this' if we're non-static in
4155 this case. Simplified the code a lot by using the new IMemberExpr
4156 interface. Also fixed bug #28176 here.
4158 2002-08-06 Martin Baulig <martin@gnome.org>
4160 * cs-parser.jay (SimpleLookup): Removed. We need to create
4161 ParameterReferences during semantic analysis so that we can do a
4162 type-only search when resolving Cast, TypeOf and SizeOf.
4163 (block): Pass the `current_local_parameters' to the Block's
4166 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4167 argument to the constructor.
4168 (ConstructorInitializer.Resolve): Create a temporary implicit
4169 block with the parameters.
4171 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4172 references here if we aren't doing a type-only search.
4174 * statement.cs (Block): Added constructor which takes a
4175 `Parameters parameters' argument.
4176 (Block.Parameters): New public property.
4178 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4179 to `Parameters' and made it public readonly.
4181 2002-08-06 Martin Baulig <martin@gnome.org>
4183 * ecore.cs (Expression.Warning): Made this public as well.
4185 * report.cs (Report.Debug): Print the contents of collections.
4187 2002-08-06 Martin Baulig <martin@gnome.org>
4189 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4190 used to tell Resolve() which kinds of expressions it may return.
4191 (Expression.Resolve): Added overloaded version of this method which
4192 takes a `ResolveFlags flags' argument. This can be used to tell
4193 Resolve() which kinds of expressions it may return. Reports a
4195 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4196 ResolveFlags.SimpleName.
4197 (Expression.Error118): Added overloaded version of this method which
4198 takes a `ResolveFlags flags' argument. It uses the flags to determine
4199 which kinds of expressions are allowed.
4201 * expression.cs (Argument.ResolveMethodGroup): New public method.
4202 Resolves an argument, but allows a MethodGroup to be returned.
4203 This is used when invoking a delegate.
4205 * TODO: Updated a bit.
4207 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4209 Fixed compilation with csc.
4211 * ecore.cs: Expression.Error made public. Is this correct? Should
4212 Warning be made public too?
4214 * expression.cs: use ea.Location instead of ea.loc.
4215 [FIXME: Filed as bug #28607: MCS must report these errors.]
4217 2002-08-06 Martin Baulig <martin@gnome.org>
4219 * ecore.cs (Expression.loc): Moved the location here instead of
4220 duplicating it in all derived classes.
4221 (Expression.Location): New public property.
4222 (Expression.Error, Expression.Warning): Made them non-static and
4223 removed the location argument.
4224 (Expression.Warning): Added overloaded version which takes an
4225 `int level' argument.
4226 (Expression.Error118): Make this non-static and removed the
4227 expression and location arguments.
4228 (TypeExpr): Added location argument to the constructor.
4230 * expression.cs (StaticCallExpr): Added location argument to
4232 (Indirection, PointerArithmetic): Likewise.
4233 (CheckedExpr, UnCheckedExpr): Likewise.
4234 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4235 (StringPtr): Likewise.
4238 2002-08-05 Martin Baulig <martin@gnome.org>
4240 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4242 * assign.cs (Assign.DoResolve): Check whether the source
4243 expression is a value or variable.
4245 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4246 while resolving the corresponding blocks.
4248 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4249 an error, don't silently return null.
4251 * statement.cs (Block.AddVariable): Do the error reporting here
4252 and distinguish between CS0128 and CS0136.
4253 (Block.DoResolve): Report all unused labels (warning CS0164).
4254 (LabeledStatement): Pass the location to the constructor.
4255 (LabeledStatement.HasBeenReferenced): New property.
4256 (LabeledStatement.Resolve): Set it to true here.
4258 * statement.cs (Return.Emit): Return success even after reporting
4259 a type mismatch error (CS0126 or CS0127), this is what csc does and
4260 it avoids confusing the users with any consecutive errors.
4262 2002-08-05 Martin Baulig <martin@gnome.org>
4264 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4266 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4268 * expression.cs (MemberAccess.DoResolve): Silently return if an
4269 error has already been reported.
4271 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4272 error has already been reported.
4274 2002-08-05 Martin Baulig <martin@gnome.org>
4276 * statement.cs (UsageVector): Only initialize the `parameters'
4277 vector if we actually have any "out" parameters.
4279 2002-08-05 Martin Baulig <martin@gnome.org>
4281 * expression.cs (Binary.ResolveOperator): When combining delegates,
4282 they must have the same type.
4284 2002-08-05 Martin Baulig <martin@gnome.org>
4286 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4287 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4288 work with the ms runtime and we also don't need it: if we're a
4289 PropertyBuilder and not in the `indexer_arguments' hash, then we
4290 are a property and not an indexer.
4292 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4293 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4294 since the latter one doesn't work with the ms runtime.
4296 2002-08-03 Martin Baulig <martin@gnome.org>
4298 Fixed bugs #27998 and #22735.
4300 * class.cs (Method.IsOperator): New public field.
4301 (Method.CheckBase): Report CS0111 if there's already a method
4302 with the same parameters in the current class. Report CS0508 when
4303 attempting to change the return type of an inherited method.
4304 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4305 and it's not marked abstract or extern.
4306 (PropertyBase): New abstract base class for Property and Indexer.
4307 (PropertyBase.CheckBase): Moved here from Property and made it work
4309 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4310 the same so we can reuse it there.
4311 (Property, Indexer): Derive from PropertyBase.
4312 (MethodSignature.inheritable_property_signature_filter): New delegate
4313 to find properties and indexers.
4315 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4316 argument and improved error reporting.
4318 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4319 EmptyReadOnlyParameters and made it a property.
4321 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4322 version of this method which takes a `PropertyInfo indexer'.
4323 (TypeManager.RegisterIndexer): New method.
4325 * class.cs: Added myself as author of this file :-)
4327 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4329 * class.cs: fixed compilation on windoze.
4331 2002-08-03 Martin Baulig <martin@gnome.org>
4333 * interface.cs (Interface.GetInterfaceBases): Check whether all
4334 base interfaces are at least as accessible than the current one.
4336 * class.cs (TypeContainer.GetClassBases): Check whether base types
4337 are at least as accessible than the current type.
4338 (TypeContainer.AsAccessible): Implemented and made non-static.
4339 (MemberBase.CheckParameters): Report errors if the accessibility
4342 * delegate.cs (Delegate.Delegate): The default visibility is
4343 internal for top-level types and private for nested types.
4344 (Delegate.Define): Report errors if the accessibility checks fail.
4346 * enum.cs (Enum.Enum): The default visibility is internal for
4347 top-level types and private for nested types.
4348 (Enum.DefineType): Compute the correct visibility.
4350 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4351 function which takes a `bool is_toplevel' instead of a TypeContainer.
4353 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4356 2002-08-02 Martin Baulig <martin@gnome.org>
4358 * expression.cs (LocalVariableReferenc): Added constructor which
4359 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4360 (LocalVariableReference.IsReadOnly): New property.
4361 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4362 variable is readonly, use our own readonly flag to do this; you can
4363 use the new constructor to get a writable reference to a read-only
4366 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4367 reference to the local variable.
4369 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4371 * rootcontext.cs (ResolveCore): Also include System.Exception
4373 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4374 we reach an EmptyStatement.
4376 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4379 * expression.cs (Binary.ResolveOperator): Check error result in
4382 use brtrue/brfalse directly and avoid compares to null.
4384 2002-08-02 Martin Baulig <martin@gnome.org>
4386 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4387 Fixes bug #28407, added test-155.cs.
4389 2002-08-01 Martin Baulig <martin@gnome.org>
4391 * class.cs (Event.EmitDefaultMethod): Make this work with static
4392 events. Fixes #28311, added verify-3.cs.
4394 2002-08-01 Martin Baulig <martin@gnome.org>
4396 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4397 `is_disposable' fields.
4398 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4399 `hm.is_disposable' if we're using the collection pattern.
4400 (Foreach.EmitCollectionForeach): Use the correct type for the
4401 enumerator's local variable, only emit the try/finally block if
4402 necessary (fixes #27713).
4404 2002-08-01 Martin Baulig <martin@gnome.org>
4406 * ecore.cs (Expression.report118): Renamed to Error118 and made
4409 * statement.cs (Throw.Resolve): Check whether the expression is of
4410 the correct type (CS0118) and whether the type derives from
4411 System.Exception (CS0155).
4412 (Catch.Resolve): New method. Do the type lookup here and check
4413 whether it derives from System.Exception (CS0155).
4414 (Catch.CatchType, Catch.IsGeneral): New public properties.
4416 * typemanager.cs (TypeManager.exception_type): Added.
4418 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4420 * driver.cs: Updated About function.
4422 2002-07-31 Martin Baulig <martin@gnome.org>
4424 Implemented Control Flow Analysis.
4426 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4427 (EmitContext.CurrentBranching): Added.
4428 (EmitContext.StartFlowBranching): Added.
4429 (EmitContext.EndFlowBranching): Added.
4430 (EmitContext.KillFlowBranching): Added.
4431 (EmitContext.IsVariableAssigned): Added.
4432 (EmitContext.SetVariableAssigned): Added.
4433 (EmitContext.IsParameterAssigned): Added.
4434 (EmitContext.SetParameterAssigned): Added.
4435 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4436 Added control flow analysis stuff here.
4438 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4439 resolve the expression as lvalue.
4440 (LocalVariableReference.DoResolve): Check whether the variable has
4441 already been assigned.
4442 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4443 the parameter as assigned here.
4444 (ParameterReference.DoResolve): Check whether the parameter has already
4446 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4447 expression as lvalue.
4449 * statement.cs (FlowBranching): New class for the flow analysis code.
4450 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4451 (LabeledStatement.IsDefined): New public property.
4452 (LabeledStatement.AddUsageVector): New public method to tell flow
4453 analyis that the label may be reached via a forward jump.
4454 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4456 (VariableInfo.Number): New public field. This is used by flow analysis
4457 to number all locals of a block.
4458 (Block.CountVariables): New public property. This is the number of
4459 local variables in this block (including the locals from all parent
4461 (Block.EmitMeta): Number all the variables.
4463 * statement.cs: Added flow analysis support to all classes.
4465 2002-07-31 Martin Baulig <martin@gnome.org>
4467 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4468 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4469 then use this argument.
4471 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4473 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4474 use this to specify /define options.
4476 2002-07-29 Martin Baulig <martin@gnome.org>
4478 * statement.cs (Fixed): Moved all code that does variable lookups
4479 and resolvings from Emit to Resolve.
4481 * statement.cs (For): Moved all code that does variable lookups
4482 and resolvings from Emit to Resolve.
4484 * statement.cs (Using): Moved all code that does variable lookups
4485 and resolvings from Emit to Resolve.
4487 2002-07-29 Martin Baulig <martin@gnome.org>
4489 * attribute.cs (Attribute.Resolve): Explicitly catch a
4490 System.NullReferenceException when creating the
4491 CustromAttributeBuilder and report a different warning message.
4493 2002-07-29 Martin Baulig <martin@gnome.org>
4495 * support.cs (ParameterData.ParameterName): Added method to
4496 get the name of a parameter.
4498 * typemanager.cs (TypeManager.IsValueType): New public method.
4500 2002-07-29 Martin Baulig <martin@gnome.org>
4502 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4503 is a flag which specifies that it's either ref or out.
4504 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4505 the out parameter to `out Parameter.Modifier mod', also set the
4506 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4508 * support.cs (InternalParameters.ParameterModifier): Distinguish
4509 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4510 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4512 * expression.cs (Argument.GetParameterModifier): Distinguish
4513 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4514 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4516 2002-07-29 Martin Baulig <martin@gnome.org>
4518 * expression.cs (ParameterReference.ParameterReference): Added
4519 `Location loc' argument to the constructor.
4521 * cs-parser.jay: Pass location to ParameterReference.
4523 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4525 * statement.cs (Try): Initialize the location.
4527 * cs-parser.jay: pass location to Try.
4529 * expression.cs (Unary.Reduce): Change the prototype to return
4530 whether a constant fold could be performed or not. The result is
4531 returned in an out parameters. In the case of Indirection and
4532 AddressOf, we want to perform the full tests.
4534 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4536 * statement.cs (Statement.Emit): Flag dead code.
4538 2002-07-27 Andrew Birkett <andy@nobugs.org>
4540 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4542 2002-07-27 Martin Baulig <martin@gnome.org>
4544 * class.cs (MethodData.Define): Put back call to
4545 TypeManager.AddMethod(), accidentally commented this out.
4547 * report.cs (Debug): New public method to print debugging information,
4548 this is `[Conditional ("DEBUG")]'.
4550 2002-07-26 Martin Baulig <martin@gnome.org>
4552 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4553 (switch_statement): Push the current_block to the switch_stack and
4554 pop it again when we're done with the switch.
4555 (switch_section): The new block is a child of the current_block.
4556 Fixes bug #24007, added test-152.cs.
4558 2002-07-27 Martin Baulig <martin@gnome.org>
4560 * expression.cs (Invocation.EmitArguments): When calling a varargs
4561 function with only its fixed arguments, we need to pass an empty
4564 2002-07-27 Martin Baulig <martin@gnome.org>
4566 Mono 0.13 has been released.
4568 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4570 * driver.cs: Rename --resource to --linkres, because that is what
4571 we do currently, we dont support --resource yet.
4573 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4575 2002-07-25 Martin Baulig <martin@gnome.org>
4577 * class.cs (MethodData): New public class. This is a `method builder'
4578 class for a method or one accessor of a Property/Indexer/Event.
4579 (MethodData.GetMethodFlags): Moved here from MemberBase.
4580 (MethodData.ApplyAttributes): Likewise.
4581 (MethodData.ApplyObsoleteAttribute): Likewise.
4582 (MethodData.ApplyConditionalAttribute): Likewise.
4583 (MethodData.ApplyDllImportAttribute): Likewise.
4584 (MethodData.CheckAbstractAndExternal): Likewise.
4585 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4586 (MethodData.Emit): Formerly known as Method.Emit().
4587 (MemberBase): Moved everything which was specific to a single
4588 accessor/method to MethodData.
4589 (Method): Create a new MethodData and call Define() and Emit() on it.
4590 (Property, Indexer, Event): Create a new MethodData objects for each
4591 accessor and call Define() and Emit() on them.
4593 2002-07-25 Martin Baulig <martin@gnome.org>
4595 Made MethodCore derive from MemberBase to reuse the code from there.
4596 MemberBase now also checks for attributes.
4598 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4599 (MemberBase.GetMethodFlags): Moved here from class Method and marked
4601 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4602 `CallingConventions cc' and `Attributes opt_attrs' arguments.
4603 (MemberBase.ApplyAttributes): New virtual method; applies the
4604 attributes to a method or accessor.
4605 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4606 (MemberBase.ApplyConditionalAttribute): Likewise.
4607 (MemberBase.ApplyDllImportAttribute): Likewise.
4608 (MemberBase.CheckAbstractAndExternal): Likewise.
4609 (MethodCore.ParameterTypes): This is now a property instead of a
4610 method, it's initialized from DoDefineParameters().
4611 (MethodCore.ParameterInfo): Removed the set accessor.
4612 (MethodCore.DoDefineParameters): New protected virtual method to
4613 initialize ParameterTypes and ParameterInfo.
4614 (Method.GetReturnType): We can now simply return the MemberType.
4615 (Method.GetMethodFlags): Override the MemberBase version and add
4616 the conditional flags.
4617 (Method.CheckBase): Moved some code from Define() here, call
4618 DoDefineParameters() here.
4619 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4620 here to avoid some larger code duplication.
4621 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4622 ensure that abstract and external accessors don't declare a body.
4624 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4625 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4626 lookup in the attribute's parent classes, so we need to abort as soon
4627 as we found the first match.
4628 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4629 the attribute has no arguments.
4631 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4634 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4636 * cs-parser.jay: reverted previous patch.
4638 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4640 * cs-parser.jay: fixed bug #22119.
4642 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4644 * attribute.cs: fixed compilation. The error was:
4645 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
4646 be assigned to before control leaves the current method."
4647 [FIXME: Filed as bug #28186: MCS must report this error.]
4649 2002-07-25 Martin Baulig <martin@gnome.org>
4651 * attribute.cs (Attribute.Conditional_GetConditionName): New static
4652 method to pull the condition name ouf of a Conditional attribute.
4653 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4654 the obsolete message and error flag out of an Obsolete attribute.
4656 * class.cs (Method.GetMethodFlags): New public method to get the
4657 TypeManager.MethodFlags for this method.
4658 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4660 (Method.Define): Get and apply the Obsolete and Conditional attributes;
4661 if we're overriding a virtual function, set the new private variable
4662 `parent_method'; call the new TypeManager.AddMethod().
4664 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
4665 the MethodBuilder and the Method in a PtrHashtable.
4666 (TypeManager.builder_to_method): Added for this purpose.
4667 (TypeManager.MethodFlags): Added IsObsoleteError.
4668 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
4669 Obsolete and Conditional arguments in MethodBuilders. If we discover
4670 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4671 the message from the attribute.
4673 2002-07-24 Martin Baulig <martin@gnome.org>
4675 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4676 preprocessor directives, ensure that the argument to #define/#undef is
4677 exactly one identifier and that it's actually an identifier.
4679 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4682 2002-07-24 Martin Baulig <martin@gnome.org>
4684 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4685 initialize it to TypeManager.object_type in the constructor.
4686 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4687 of the `hm.get_current' method if we're using the collection pattern.
4688 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4689 for the explicit conversion to make it work when we're using the collection
4690 pattern and the `Current' property has a different return type than `object'.
4693 2002-07-24 Martin Baulig <martin@gnome.org>
4695 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4696 does not match, but don't report any errors. This method is called in
4697 order for all methods in a MethodGroupExpr until a matching method is
4698 found, so we don't want to bail out if the first method doesn't match.
4699 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4700 matches, report the 123. Fixes #28070.
4702 2002-07-24 Martin Baulig <martin@gnome.org>
4704 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4705 TypeManager.TypeToCoreType() to the top of the method so the
4706 following equality checks will work. Fixes #28107.
4708 2002-07-24 Martin Baulig <martin@gnome.org>
4710 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4711 operand is of type uint, and the other operand is of type sbyte,
4712 short or int, the operands are converted to type long." -
4713 Actually do what this comment already told us. Fixes bug #28106,
4716 2002-07-24 Martin Baulig <martin@gnome.org>
4718 * class.cs (MethodBase): New abstract class. This is now a base
4719 class for Property, Indexer and Event to avoid some code duplication
4720 in their Define() and DefineMethods() methods.
4721 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4722 generic methods for Define() and DefineMethods().
4723 (FieldBase): Derive from MemberBase, not MemberCore.
4724 (Property): Derive from MemberBase, not MemberCore.
4725 (Property.DefineMethod): Moved all the code from this method to the
4726 new MethodBase.DefineAccessor(), just call it with appropriate
4728 (Property.Define): Call the new Property.DoDefine(), this does some
4729 sanity checks and we don't need to duplicate the code everywhere.
4730 (Event): Derive from MemberBase, not MemberCore.
4731 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4732 accessors, this will also make them work with interface events.
4733 (Indexer): Derive from MemberBase, not MemberCore.
4734 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4735 (Indexer.Define): Use the new MethodBase functions.
4737 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4738 argument to the constructor.
4739 (Interface.FindMembers): Added support for interface events.
4740 (Interface.PopluateEvent): Implemented.
4742 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
4744 2002-07-22 Miguel de Icaza <miguel@ximian.com>
4746 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4747 but this is required to check for a method name being the same as
4748 the containing class.
4752 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4754 * interface.cs: initialize variable.
4756 2002-07-23 Martin Baulig <martin@gnome.org>
4758 Implemented the IndexerName attribute in interfaces.
4760 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4761 name if this is an explicit interface implementation.
4762 (Indexer.InterfaceIndexerName): New public variable. If we're
4763 implementing an interface indexer, this is the IndexerName in that
4764 interface. Otherwise, it's the IndexerName.
4765 (Indexer.DefineMethod): If we're implementing interface indexer,
4766 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
4767 and Pending.ImplementIndexer methods.
4768 (Indexer.Define): Also define the PropertyBuilder if we're
4769 implementing an interface indexer and this is neither an explicit
4770 interface implementation nor do the IndexerName match the one in
4773 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4774 If a method is defined here, then we always need to create a proxy
4775 for it. This is used when implementing interface indexers.
4776 (Pending.IsInterfaceIndexer): New public method.
4777 (Pending.ImplementIndexer): New public method.
4778 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4779 This is used when implementing interface indexers to define a proxy
4781 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4782 define a proxy if necessary.
4784 * interface.cs (Interface.IndexerName): New public variable.
4785 (Interface.PopulateIndexer): Set the IndexerName.
4786 (Interface.DefineIndexers): New private method. Populate all the
4787 indexers and make sure their IndexerNames match.
4789 * typemanager.cs (IndexerPropertyName): Added support for interface
4792 2002-07-22 Martin Baulig <martin@gnome.org>
4794 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4795 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4796 ret if HasReturnLabel.
4797 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4800 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4801 and set the ec.LoopBeginTryCatchLevel.
4802 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4803 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
4804 the current ec.TryCatchLevel, the branch goes out of an exception
4805 block. In this case, we need to use Leave and not Br.
4807 2002-07-22 Martin Baulig <martin@gnome.org>
4809 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
4810 block unless the block does not always return or it is contained in
4811 another try { ... } catch { ... } block. Fixes bug #26506.
4812 Added verify-1.cs to the test suite.
4814 2002-07-22 Martin Baulig <martin@gnome.org>
4816 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
4817 then we do not always return. Fixes bug #24985.
4819 2002-07-22 Martin Baulig <martin@gnome.org>
4821 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
4822 lookup on a per-class level; ie. walk up the class hierarchy until we
4823 found at least one applicable method, then choose the best among them.
4824 Fixes bug #24463 and test-29.cs.
4826 2002-07-22 Martin Baulig <martin@gnome.org>
4828 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
4829 return types of the methods. The return type is not part of the
4830 signature and we must not check it to make the `new' modifier work.
4831 Fixes bug #27999, also added test-147.cs.
4832 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
4834 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
4835 on the method's return type.
4837 2002-07-21 Martin Baulig <martin@gnome.org>
4839 * assign.cs: Make this work if the rightmost source is a constant and
4840 we need to do an implicit type conversion. Also adding a few more tests
4841 to test-38.cs which should have caught this.
4843 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
4844 target in the makefile for this. The makefile.gnu is primarily intended
4845 for end-users who don't want to debug the compiler.
4847 2002-07-21 Martin Baulig <martin@gnome.org>
4849 * assign.cs: Improved the Assign class so it can now handle embedded
4850 assignments (X = Y = Z = something). As a side-effect this'll now also
4851 consume less local variables. test-38.cs now passes with MCS, added
4852 a few new test cases to that test.
4854 2002-07-20 Martin Baulig <martin@gnome.org>
4856 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
4857 instructions. Fixes bug #27977, also added test-146.cs.
4859 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4861 * cs-tokenizer.cs: fixed getHex ().
4863 2002-07-19 Martin Baulig <martin@gnome.org>
4865 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
4866 not Type.GetType() to lookup the array type. This is needed when
4867 we're constructing an array of a user-defined type.
4868 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
4869 single-dimensional arrays, but also for single-dimensial arrays of
4872 2002-07-19 Martin Baulig <martin@gnome.org>
4874 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
4875 this function is called, it's not allowed to share LocalBuilders
4878 2002-07-19 Martin Baulig <martin@gnome.org>
4880 * expression.cs (Argument.Resolve): Report an error 118 when trying
4881 to pass a type as argument.
4883 2002-07-18 Martin Baulig <martin@gnome.org>
4885 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
4886 Conv_R_Un for the signed `long' type.
4888 2002-07-15 Miguel de Icaza <miguel@ximian.com>
4890 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4891 `expr' for the temporary result, as that will fail if we do
4892 multiple resolves on the same expression.
4894 2002-07-05 Miguel de Icaza <miguel@ximian.com>
4896 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4897 ec.TypeContainer for looking up aliases.
4899 * class.cs (TypeContainer): Remove LookupAlias from here.
4901 * decl.cs (DeclSpace); Move here.
4903 2002-07-01 Miguel de Icaza <miguel@ximian.com>
4905 * class.cs (FindMembers): Only call filter if the constructor
4906 bulider is not null.
4908 Also handle delegates in `NestedTypes' now. Now we will perform
4909 type lookups using the standard resolution process. This also
4912 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4913 This uses Expressions (the limited kind that can be parsed by the
4914 tree) instead of strings.
4916 * expression.cs (ComposedCast.ToString): Implement, used to flag
4917 errors since now we have to render expressions.
4919 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
4922 * ecore.cs (SimpleName.ToString): ditto.
4924 * cs-parser.jay: Instead of using strings to assemble types, use
4925 Expressions to assemble the type (using SimpleName, ComposedCast,
4926 MemberAccess). This should fix the type lookups in declarations,
4927 because we were using a different code path for this.
4929 * statement.cs (Block.Resolve): Continue processing statements
4930 even when there is an error.
4932 2002-07-17 Miguel de Icaza <miguel@ximian.com>
4934 * class.cs (Event.Define): Also remove the `remove' method from
4935 the list of pending items.
4937 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
4938 generate more compact code.
4940 2002-07-17 Martin Baulig <martin@gnome.org>
4942 * const.cs (Const.LookupConstantValue): Add support for constant
4943 `unchecked' and `checked' expressions.
4944 Also adding test case test-140.cs for this.
4946 2002-07-17 Martin Baulig <martin@gnome.org>
4948 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
4949 check whether mi.ReturnType implements the IEnumerator interface; the
4950 `==' and the IsAssignableFrom() will fail in this situation.
4952 2002-07-16 Ravi Pratap <ravi@ximian.com>
4954 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
4957 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4959 * expression.cs: fixed bug #27811.
4961 2002-07-14 Miguel de Icaza <miguel@ximian.com>
4963 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
4964 Molaro: when we are a ref, the value already contains a pointer
4965 value, do not take the address of it.
4967 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4968 * removed mb-parser.jay and mb-tokenizer.cs
4970 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4972 * expression.cs: check against the building corlib void type.
4974 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
4976 * ecore.cs: fix for valuetype static readonly fields: when
4977 initializing them, we need their address, not the address of a copy.
4979 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
4981 * typemanager.cs: register also enum_type in corlib.
4983 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4985 * class.cs: allow calling this (but not base) initializers in structs.
4987 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
4989 * ecore.cs: make sure we compare against the building base types
4992 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
4994 * typemanager.cs: fix TypeToCoreType() to handle void and object
4995 (corlib gets no more typerefs after this change).
4997 2002-07-12 Miguel de Icaza <miguel@ximian.com>
4999 * expression.cs (ArrayCreation.EmitArrayArguments): use
5000 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5002 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5003 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
5004 array indexes, the runtime actually forbids them.
5006 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5007 for array arguments here.
5009 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5010 instead of the default for ValueTypes.
5012 (New.DoEmit): Use IsValueType instead of
5013 IsSubclassOf (value_type)
5014 (New.DoResolve): ditto.
5015 (Invocation.EmitCall): ditto.
5017 * assign.cs (Assign): ditto.
5019 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5020 Statements *are* currently doing part of their resolution during
5023 Expressions do always resolve during resolve, but statements are
5024 only required to propagate resolution to their children.
5026 2002-07-11 Miguel de Icaza <miguel@ximian.com>
5028 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5030 (LoadAssembly): Do not add the dll if it is already specified
5032 (MainDriver): Add the System directory to the link path at the end,
5033 after all the other -L arguments.
5035 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5036 wrong opcode for loading bytes and bools (ldelem.i1 instead of
5037 ldelem.u1) and using the opposite for sbytes.
5039 This fixes Digger, and we can finally run it.
5041 * driver.cs (UnixParseOption): Move the option parsing here.
5042 (CSCParseOption): Implement CSC-like parsing of options.
5044 We now support both modes of operation, the old Unix way, and the
5045 new CSC-like way. This should help those who wanted to make cross
5048 The only thing broken is that /r:, /reference: and /lib: are not
5049 implemented, because I want to make those have the same semantics
5050 as the CSC compiler has, and kill once and for all the confussion
5051 around this. Will be doing this tomorrow.
5053 * statement.cs (Unsafe.Resolve): The state is checked during
5054 resolve, not emit, so we have to set the flags for IsUnsfe here.
5056 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5058 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5059 not catch the Error_ObjectRefRequired in SimpleName (as it is
5060 possible to have a class/instance variable name that later gets
5061 deambiguated), we have to check this here.
5063 2002-07-10 Ravi Pratap <ravi@ximian.com>
5065 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5066 make static and put into Expression.
5068 (Event.Define): Register the private field of the event with the
5069 TypeManager so that GetFieldFromEvent can get at it.
5071 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5072 keep track of the private field associated with an event which
5075 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5078 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5080 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5082 * expression.cs (Binary.EmitBranchable): this routine emits the
5083 Binary expression in a branchable context. This basically means:
5084 we need to branch somewhere, not just get the value on the stack.
5086 This works together with Statement.EmitBoolExpression.
5088 * statement.cs (Statement.EmitBoolExpression): Use
5091 2002-07-09 Miguel de Icaza <miguel@ximian.com>
5093 * statement.cs (For): Reduce the number of jumps in loops.
5095 (For): Implement loop inversion for the For statement.
5097 (Break): We can be breaking out of a Try/Catch controlled section
5098 (foreach might have an implicit try/catch clause), so we need to
5099 use Leave instead of Br.
5101 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5102 now). If the instace expression supports IMemoryLocation, we use
5103 the AddressOf method from the IMemoryLocation to extract the
5104 address instead of emitting the instance.
5106 This showed up with `This', as we were emitting the instance
5107 always (Emit) instead of the Address of This. Particularly
5108 interesting when This is a value type, as we dont want the Emit
5109 effect (which was to load the object).
5111 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5113 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5115 * statement.cs (Checked): Set the CheckedState during the resolve
5116 process too, as the ConvCast operations track the checked state on
5117 the resolve process, and not emit.
5119 * cs-parser.jay (namespace_member_declaration): Flag that we have
5120 found a declaration when we do. This is used to flag error 1529
5122 * driver.cs: Report ok when we display the help only.
5124 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5126 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5128 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5130 * cs-tokenizer.cs (define): We also have to track locally the
5131 defines. AllDefines is just used for the Conditional Attribute,
5132 but we also need the local defines for the current source code.
5134 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5136 * statement.cs (While, For, Do): These loops can exit through a
5137 Break statement, use this information to tell whether the
5138 statement is the last piece of code.
5140 (Break): Flag that we break.
5142 * codegen.cs (EmitContexts): New `Breaks' state variable.
5144 2002-07-03 Martin Baulig <martin@gnome.org>
5146 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5147 modifiers in method declarations in structs. Otherwise, you won't
5148 be able to override things like Object.Equals().
5150 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5152 * class.cs (Method, Property, Indexer): Do not allow the public
5153 modifier to be used in explicit interface implementations.
5155 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5156 override modifiers in method declarations in structs
5158 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5160 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5161 integer or real overflow, report an error
5163 2002-07-02 Martin Baulig <martin@gnome.org>
5165 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5166 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5167 to tell the runtime about our newly created System.Object and
5168 System.ValueType types.
5170 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5172 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5173 struct instead of Ldarg/Starg.
5175 2002-07-02 Martin Baulig <martin@gnome.org>
5177 * expression.cs (Indirection.Indirection): Call
5178 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5180 2002-07-02 Martin Baulig <martin@gnome.org>
5182 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5183 ValueType, call TypeManager.TypeToCoreType() on it.
5184 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5185 the OpCodes.Newarr argument.
5187 2002-07-02 Martin Baulig <martin@gnome.org>
5189 * expression.cs (Invocation.EmitCall): When compiling corlib,
5190 replace all calls to the system's System.Array type to calls to
5191 the newly created one.
5193 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5194 System.Array methods.
5195 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5196 from the system's System.Array type which must be replaced.
5198 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5200 * typemanager.cs: load unverifiable_code_ctor so we can build
5201 corlib using the correct type. Avoid using GetTypeCode() with
5203 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5204 TypeManager.object_type to allow building corlib.
5206 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5208 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5210 2002-07-01 Martin Baulig <martin@gnome.org>
5212 * class.cs: Make the last change actually work, we need to check
5213 whether `ifaces != null' to avoid a crash.
5215 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5217 * class.cs: when we build structs without fields that implement
5218 interfaces, we need to add the interfaces separately, since there is
5219 no API to both set the size and add the interfaces at type creation
5222 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5224 * expression.cs: the dimension arguments to the array constructors
5225 need to be converted if they are a long.
5227 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5229 * class.cs: don't emit ldarg.0 if there is no parent constructor
5230 (fixes showstopper for corlib).
5232 2002-06-29 Martin Baulig <martin@gnome.org>
5234 MCS now compiles corlib on GNU/Linux :-)
5236 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5237 ie. check for MethodImplOptions.InternalCall.
5239 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5240 and TypeManager.attribute_type are null, so we must explicitly check
5241 whether parent is not null to find out whether it's an attribute type.
5242 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5243 and SetBuilder, not only if the property is neither abstract nor external.
5244 This is necessary to set the MethodImplOptions on the accessor methods.
5245 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5246 SetBuilder, see Property.Emit().
5248 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5249 populate "System.Object", "System.ValueType" and "System.Attribute" since
5250 they've already been populated from BootCorlib_PopulateCoreTypes().
5252 2002-06-29 Martin Baulig <martin@gnome.org>
5254 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5255 is the NullLiteral, we also need to make sure that target_type is not
5258 2002-06-29 Martin Baulig <martin@gnome.org>
5260 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5261 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5262 before calling BootstrapCorlib_ResolveDelegate ().
5264 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5266 * statement.cs: fixed build-breaker. All tests passed ok.
5268 2002-06-27 Martin Baulig <martin@gnome.org>
5270 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5271 for System.Decimal when compiling corlib.
5273 2002-06-27 Martin Baulig <martin@gnome.org>
5275 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5276 switch blocks which contain nothing but a default clause.
5278 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5280 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5282 2002-06-27 Martin Baulig <martin@gnome.org>
5284 * ecore.cs (PropertyExpr.PropertyExpr): Call
5285 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5287 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5288 is already a TypeBuilder.
5290 2002-06-27 Martin Baulig <martin@gnome.org>
5292 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5293 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5294 the "from an array-type to System.Array" case. This makes it work
5295 when compiling corlib.
5297 2002-06-27 Martin Baulig <martin@gnome.org>
5299 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5300 non-static PropertyExpr, set its InstanceExpression. This makes
5301 the `ICollection.Count' property work in System/Array.cs.
5303 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5305 * driver.cs: Made error handling more consistent. Errors now
5306 tracked by Report class, so many methods which used to return int
5307 now return void. Main() now prints success/failure and
5308 errors/warnings message.
5310 Renamed '--probe' compiler argument to '--expect-error'. Removed
5311 the magic number return values (123 and 124). Now, if the
5312 expected error occurs, the compiler exits with success (exit value
5313 0). If the compilation completes without seeing that particular
5314 error, the compiler exits with failure (exit value 1). The
5315 makefile in mcs/errors has been changed to handle the new behaviour.
5317 * report.cs: Made 'expected error' number a property and renamed
5318 it from 'Probe' to 'ExpectedError'.
5320 * genericparser.cs: Removed error handling support, since it is
5321 now all done by Report class.
5323 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5324 class, so parse() no longer returns an int.
5326 * namespace.cs: Use Report.Error instead of GenericParser.error
5328 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5330 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5331 TypeContainer.AddOperator): At the front of the list put the
5332 explicit implementations, so they get resolved/defined first.
5334 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5336 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5337 interface type is implemented by this TypeContainer. Used during
5338 explicit interface implementation.
5340 (Property.Define, Indexer.Define, Method.Define): Validate that
5341 the given interface in the explicit implementation is one of the
5342 base classes for the containing type.
5344 Also if we are explicitly implementing an interface, but there is
5345 no match in the pending implementation table, report an error.
5347 (Property.Define): Only define the property if we are
5348 not explicitly implementing a property from an interface. Use the
5349 correct name also for those properties (the same CSC uses,
5350 although that is really not needed).
5352 (Property.Emit): Do not emit attributes for explicitly implemented
5353 properties, as there is no TypeBuilder.
5355 (Indexer.Emit): ditto.
5357 Hiding then means that we do not really *implement* a pending
5358 implementation, which makes code fail.
5360 2002-06-22 Martin Baulig <martin@gnome.org>
5362 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5363 the return value of Object.GetType(). [FIXME: we need to do this whenever
5364 we get a type back from the reflection library].
5366 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5368 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5370 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5372 * attribute.cs: Return null if we can not look up the type.
5374 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5375 the interface types found.
5377 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5378 interface types found.
5380 * typemanager.cs (GetInterfaces): Make this routine returns alll
5381 the interfaces and work around the lame differences between
5382 System.Type and System.Reflection.Emit.TypeBuilder in the results
5383 result for GetInterfaces.
5385 (ExpandInterfaces): Given an array of interface types, expand and
5386 eliminate repeated ocurrences of an interface. This expands in
5387 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5390 2002-06-21 Martin Baulig <martin@gnome.org>
5392 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5395 2002-06-21 Martin Baulig <martin@gnome.org>
5397 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5398 and called with one of the core types, return the corresponding typebuilder for
5401 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5404 2002-06-21 Martin Baulig <martin@gnome.org>
5406 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5407 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5408 (Expression.ConvertReferenceExplicit): Likewise.
5410 * expression.cs (ElementAccess.DoResolve): Likewise.
5411 (ElementAccess.DoResolveLValue): Likewise.
5413 2002-06-10 Martin Baulig <martin@gnome.org>
5415 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5416 add the "value" parameter to the parameter list.
5418 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5421 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5423 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5424 the argument to an int, uint, long or ulong, per the spec. Also
5425 catch negative constants in array creation.
5427 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5429 * class.cs: do not allow the same interface to appear twice in
5430 the definition list.
5432 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5434 * ecore.cs: don't use ldlen with System.Array.
5436 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5438 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5440 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5442 * modifiers.cs: produce correct field attributes for protected
5443 internal. Easy fix so miguel can work on ther harder stuff:-)
5445 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5447 * pending.cs: New file. Move the code from class.cs here.
5448 Support clearning the pending flag for all methods (when not doing
5449 explicit interface implementation).
5451 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5453 * rootcontext.cs: added a couple more types needed to bootstrap.
5455 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5457 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5458 constructor in the type, instead of any constructor in the type
5459 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5460 a bug in the Mono runtime when applying the params attribute).
5462 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5463 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5465 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5467 * expression.cs (Unary.ResolveOperator): Use TypeManager
5468 to resolve the type.
5470 2002-06-13 Ravi Pratap <ravi@ximian.com>
5472 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5475 * enum.cs (AddEnumMember): Add support to store the attributes associated
5476 with each member too.
5478 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5479 field builders too - this takes care of the enum member case.
5481 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5483 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5484 address-of operator on both value types and pointers.
5486 2002-06-10 Martin Baulig <martin@gnome.org>
5488 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5489 PropertyBuilder to the `property_builders' list.
5491 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5492 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5493 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5494 find any indexers which are inherited from an interface.
5496 2002-06-09 Martin Baulig <martin@gnome.org>
5498 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5499 the same type as the constant if necessary. There's also a test-130.cs
5502 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5504 * typemanager.cs (TypeManager.ChangeType): Previously known as
5505 Enum.ChangeEnumType().
5507 2002-06-09 Martin Baulig <martin@gnome.org>
5509 * expression.cs (Cast.TryReduce): Added support for consts.
5511 2002-06-08 Ravi Pratap <ravi@ximian.com>
5513 * class.cs (Accessor): Hold attributes information so we can pass
5516 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5517 Modify to pass in attributes attached to the methods.
5519 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5521 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5522 to handle the Accessor kind :-)
5524 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5526 2002-06-08 Martin Baulig <martin@gnome.org>
5528 * expression.cs (Unary.TryReduceNegative): Added support for
5531 2002-06-08 Martin Baulig <martin@gnome.org>
5533 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5534 name can't be found in the `defined_names' - the caller will do a
5535 MemberLookup in this case and thus find methods in System.Enum
5536 such as Enum.IsDefined().
5538 2002-06-08 Martin Baulig <martin@gnome.org>
5540 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5541 Convert.ChangeType() which works with TypeBuilder created types.
5542 (Enum.LookupEnumValue, Enum.Define): Use it here.
5544 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5545 `TypeBuilder.BaseType != null' check.
5546 (TypeContainer.FindMembers): Only lookup parent members if we
5547 actually have a parent.
5548 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5549 (ConstructorInitializer.Resolve): Likewise.
5551 * interface.cs (Interface.FindMembers): Added
5552 `TypeBuilder.BaseType != null' check.
5554 * rootcontext.cs (RootContext.ResolveCore): Added
5555 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5556 classes_second_stage.
5558 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5559 debug_type and trace_type when compiling with --nostdlib.
5561 2002-06-07 Martin Baulig <martin@gnome.org>
5563 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5564 (AddField): Set it to true when adding a non-static field.
5565 (DefineType): Use `have_nonstatic_fields' to find out whether we
5566 have non-static fields, not `Fields != null'.
5568 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5570 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5571 dereferencing a null on the static-field code path)
5573 2002-05-30 Martin Baulig <martin@gnome.org>
5575 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5576 to take command line arguments. Use reflection to call the new
5577 custom `Initialize' function on the symbol writer and pass it the
5578 command line arguments.
5580 * driver.cs (--debug-args): New command line argument to pass command
5581 line arguments to the symbol writer.
5583 2002-05-28 Miguel de Icaza <miguel@ximian.com>
5585 * assign.cs (DoResolve): Forgot to do the implicit conversion to
5586 the target type for indexers and properties. Thanks to Joe for
5589 2002-05-27 Miguel de Icaza <miguel@ximian.com>
5591 * typemanager.cs (MethodFlags): returns the method flags
5592 (Obsolete/ShouldIgnore) that control warning emission and whether
5593 the invocation should be made, or ignored.
5595 * expression.cs (Invocation.Emit): Remove previous hack, we should
5596 not do this on matching a base type, we should do this based on an attribute
5598 Only emit calls to System.Diagnostics.Debug and
5599 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5600 on the command line.
5602 * rootcontext.cs: Global settings for tracing and debugging.
5604 * cs-tokenizer.cs (define): New utility function to track
5605 defines. Set the global settings for TRACE and DEBUG if found.
5607 2002-05-25 Ravi Pratap <ravi@ximian.com>
5609 * interface.cs (Populate*): Pass in the TypeContainer as well as
5610 the DeclSpace as parameters so that we can create EmitContexts and
5611 then use that to apply attributes etc.
5613 (PopulateMethod, PopulateEvent, PopulateProperty)
5614 (PopulateIndexer): Apply attributes everywhere.
5616 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5619 (ApplyAttributes): Update accordingly.
5621 We now apply interface attributes for all members too.
5623 2002-05-26 Miguel de Icaza <miguel@ximian.com>
5625 * class.cs (Indexer.Define); Correctly check if we are explicit
5626 implementation (instead of checking the Name for a ".", we
5627 directly look up if the InterfaceType was specified).
5629 Delay the creation of the PropertyBuilder.
5631 Only create the PropertyBuilder if we are not an explicit
5632 interface implementation. This means that explicit interface
5633 implementation members do not participate in regular function
5634 lookups, and hence fixes another major ambiguity problem in
5635 overload resolution (that was the visible effect).
5637 (DefineMethod): Return whether we are doing an interface
5640 * typemanager.cs: Temporary hack until we get attributes in
5641 interfaces (Ravi is working on that) and we get IndexerName
5642 support in interfaces.
5644 * interface.cs: Register the indexers as properties.
5646 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5647 warning, I have verified that this is a bug in the .NET runtime
5648 (JavaScript suffers of the same problem).
5650 * typemanager.cs (MemberLookup): When looking up members for
5651 interfaces, the parent of an interface is the implicit
5652 System.Object (so we succeed in searches of Object methods in an
5653 interface method invocation. Example: IEnumerable x; x.ToString
5656 2002-05-25 Miguel de Icaza <miguel@ximian.com>
5658 * class.cs (Event): Events should also register if they do
5659 implement the methods that an interface requires.
5661 * typemanager.cs (MemberLookup); use the new GetInterfaces
5664 (GetInterfaces): The code used to lookup interfaces for a type is
5665 used in more than one place, factor it here.
5667 * driver.cs: Track the errors at the bottom of the file, we kept
5670 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5671 instance if the method we are calling is static!
5673 2002-05-24 Miguel de Icaza <miguel@ximian.com>
5675 * attribute.cs (ApplyAttributes): Make this function filter out
5676 the IndexerName attribute (as that attribute in reality is never
5677 applied) and return the string constant for the IndexerName
5680 * class.cs (TypeContainer.Emit): Validate that all the indexers
5681 have the same IndexerName attribute, and if so, set the
5682 DefaultName attribute on the class.
5684 * typemanager.cs: The return value might contain other stuff (not
5685 only methods). For instance, consider a method with an "Item"
5686 property and an Item method.
5688 * class.cs: If there is a problem with the parameter types,
5691 2002-05-24 Ravi Pratap <ravi@ximian.com>
5693 * ecore.cs (ImplicitConversionExists): Wrapper function which also
5694 looks at user defined conversion after making a call to
5695 StandardConversionExists - we need this for overload resolution.
5697 * expression.cs : Update accordingly the various method calls.
5699 This fixes 2 bugs filed against implicit user defined conversions
5701 2002-05-22 Miguel de Icaza <miguel@ximian.com>
5703 * statement.cs: Track the result of the assignment.
5705 2002-05-21 Miguel de Icaza <miguel@ximian.com>
5707 * expression.cs (MemberAccess): Improved error reporting for
5708 inaccessible members.
5710 2002-05-22 Martin Baulig <martin@gnome.org>
5712 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
5713 itself with debugging support.
5715 2002-05-22 Martin Baulig <martin@gnome.org>
5717 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5718 Removed, this isn't needed anymore.
5720 2002-05-20 Martin Baulig <martin@gnome.org>
5722 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5723 be underlying type for an enum.
5725 2002-05-20 Miguel de Icaza <miguel@ximian.com>
5727 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5728 that splits out the loading of just the core types.
5730 * rootcontext.cs (ResolveCore): Split the struct resolution in
5731 two, so we can load the enumeration underlying types before any
5734 * expression.cs (Is): Bandaid until we fix properly Switch (see
5735 bug #24985 for details).
5737 * typemanager.cs (ImplementsInterface): The hashtable will contain
5738 a null if there are no interfaces implemented.
5740 2002-05-18 Miguel de Icaza <miguel@ximian.com>
5742 * cs-parser.jay (indexer_declarator): It is fine to have array
5745 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5747 * typemanager.cs: (RegisterBuilder): New function used to register
5748 TypeBuilders that implement interfaces. Since
5749 TypeBuilder.GetInterfaces (as usual) does not work with lame
5751 (AddUserType): register interfaces.
5753 (ImplementsInterface): Use the builder_to_ifaces hash if we are
5754 dealing with TypeBuilder. Also, arrays are showing up as
5755 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5756 methods can not be invoked on them!
5758 * ecore.cs (ExplicitReferenceConversionExists): Made public.
5759 (ImplicitReferenceConversionExists): Split out from
5760 StandardConversionExists.
5762 * expression.cs (As): We were only implementing one of the three
5763 cases for the as operator. We now implement them all.
5764 (Is): Implement the various other cases for Is as well.
5766 * typemanager.cs (CACHE): New define used to control if we want or
5767 not the FindMembers cache. Seems to have a negative impact on
5768 performance currently
5770 (MemberLookup): Nested types have full acess to
5771 enclosing type members
5773 Remove code that coped with instance/static returns for events, we
5774 now catch this in RealFindMembers.
5776 (RealFindMembers): only perform static lookup if the instance
5777 lookup did not return a type or an event.
5779 2002-05-17 Miguel de Icaza <miguel@ximian.com>
5781 * assign.cs (CompoundAssign): We pass more semantic information
5782 now to Compound Assignments than we did before: now we have all
5783 the information at hand, and now we resolve the target *before* we
5784 do the expression expansion, which allows the "CacheValue" method
5785 to have the effect we intended (before, a [x] += 1 would generate
5786 two differen ArrayAccess expressions from the ElementAccess,
5787 during the resolution process).
5789 (CompoundAssign.DoResolve): Resolve target and original_source here.
5791 2002-05-16 Miguel de Icaza <miguel@ximian.com>
5793 * expression.cs (ArrayAccess): dropped debugging information.
5795 * typemanager.cs: Small bug fix: I was always returning i_members,
5796 instead of one of i_members or s_members (depending on which had
5799 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
5800 method is invoked before any code generation takes place, and it
5801 is a mechanism to inform that the expression will be invoked more
5802 than once, and that the method should use temporary values to
5803 avoid having side effects
5805 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
5807 * ecore.cs (Expression.CacheTemporaries): Provide empty default
5810 * expression.cs (Indirection, ArrayAccess): Add support for
5811 CacheTemporaries in these two bad boys.
5813 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
5815 (StoreFromPtr): Handle stobj as well.
5817 * expression.cs (UnaryMutator): Share more code.
5819 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
5820 down: I was not tracking the Filter function as well, which
5821 was affecting the results of the cache.
5823 2002-05-15 Miguel de Icaza <miguel@ximian.com>
5825 * attribute.cs: Remove the hack to handle the CharSet property on
5828 2002-05-14 Miguel de Icaza <miguel@ximian.com>
5830 * attribute.cs (DoResolve): More uglyness, we now only try to
5831 resolve the attribute partially, to extract the CharSet
5832 information (only if we are a StructLayout attribute). Otherwise
5834 (GetExtraTypeInfo): Add some code to conditionally kill in the
5835 future this. I am more and more convinced that the .NET
5836 framework has special code to handle the attribute setting on
5839 * expression.cs (IsParamsMethodApplicable): Revert my previous
5840 foreach change here, it was wrong.
5842 2002-05-13 Miguel de Icaza <miguel@ximian.com>
5844 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
5845 (pp_expr): do not abort on unknown input, just return.
5846 (eval): abort if there are pending chars.
5848 * attribute.cs (Attribute.Resolve): Positional parameters are
5849 optional. Deal with that case.
5851 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
5852 the Ansi/Unicode/Auto information for the type.
5854 (TypeContainer.DefineType): instantiate the EmitContext here, as
5855 we will be using it during the type definition (to resolve
5856 attributes) and during the emit phase.
5858 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
5859 to pull type information out of the attributes
5861 (Attribute.Resolve): track the constructor builder, and allow for
5862 multiple invocations (structs and classes will use this).
5864 * ecore.cs (MemberLookupFinal): new version with all the
5865 parameters customizable.
5867 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
5868 constructors. Return if the result value is null (as the error
5869 would have been flagged already by MemberLookupFinal)
5871 Do not allow instances of abstract classes or interfaces to be
5874 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
5875 We have to compare the assembly property here when dealing with
5876 FamANDAssem and Assembly access modifiers, because we might be
5877 creating an assembly from *modules* (that means that we are not
5878 getting TypeBuilders for types defined in other modules that are
5879 part of this assembly).
5881 (Method.Emit): If the method is marked abstract and has a body,
5884 (TypeContainer.DefineMembers): If both the defined member and the
5885 parent name match are methods, then do not emit any warnings: let
5886 the Method.Define routine take care of flagging warnings. But if
5887 there is a mismatch (method overrides something else, or method is
5888 overriwritten by something, then emit warning).
5890 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5891 set to null, this means `do not check for the return type on the
5894 (Method.Define): set the return type for the method signature to
5895 null, so that we get methods with the same name and parameters and
5896 different return types. This is used to flag warning 114 (you are
5897 hiding a method, and you probably want to use the new/override
5900 * typemanager.cs (MemberLookup): Implemented proper access
5901 control, closing a long standing set of bug reports. The problem
5902 was that the Framework only has two bits: Public and NonPublic,
5903 and NonPublic includes private and protected methods, but we need
5904 to enforce the FamANDAssem, FamOrAssem and Family.
5906 2002-05-11 Miguel de Icaza <miguel@ximian.com>
5908 * statement.cs (GotoCase): Return true: Ammounts to giving up
5909 knowledge on whether we return or not, and letting the other case
5910 be responsible for it.
5912 2002-05-10 Miguel de Icaza <miguel@ximian.com>
5914 * driver.cs: Do not load directories for each file processed, only
5915 do it if there is a pattern.
5917 * ecore.cs: Report readonly assigns here as well, as we might have
5918 been resolved only by MemberAccess.
5920 (SimpleName.SimpleNameResolve): Also be useful for LValue
5921 resolution. We need this to propagate assign to local readonly variables
5923 * typemanager.cs: Use a ptrhashtable for the criteria, because we
5924 do not want to reuse potential criteria memory.
5926 * class.cs (MyEventBuilder): Set reflected_type;
5928 * ecore.cs (Constantify): Added support for constifying bools.
5930 (RootContext.LookupType): Added a cache for values looked up in
5931 the declaration space.
5933 * typemanager.cs (FindMembers): Now is a front-end to
5934 RealFindMembers, and provides a two-level hashtable-based cache to
5937 15% performance improvement: from 22.5 to 19.2 seconds.
5939 * expression.cs (IsParamsMethodApplicable): use foreach.
5940 (Invocation.DoResolve): ditto.
5941 (New.DoResolve): ditto.
5942 (ArrayCreation.DoResolve): ditto.
5944 * ecore.cs (FindMostEncompassingType): use foreach.
5946 * delegate.cs (NewDelegate.DoResolve): Use foreach
5948 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
5949 (RemoveMethods): use foreach.
5951 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
5952 nested foreach statements instead of for, and also break out of
5953 the inner loop once a match is found.
5955 (Invocation.OverloadResolve): Use foreach, simplify the code.
5957 2002-05-08 Miguel de Icaza <miguel@ximian.com>
5959 * cfold.cs (BinaryFold): During an enumeration evaluation context,
5960 we actually unwrap the expression to allow for extra information
5963 * expression.cs: Use Shr_Un on unsigned operations.
5965 2002-05-08 Ravi Pratap <ravi@ximian.com>
5967 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
5968 applicable operators was not being considered correctly. This closes
5969 the bug Miguel reported.
5971 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
5973 * attribute.cs: check that the type derives from System.Attribute
5974 and report the correct error in that case (moved the duplicate code to
5975 its own method, too).
5977 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
5979 * attribute.cs: lookup attribute type name as the spec says: first the
5980 bare attribute name and then name + "Attribute" (nant compiles with
5981 mcs after this fix).
5983 2002-05-07 Miguel de Icaza <miguel@ximian.com>
5985 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
5986 Because of the way we parse things, we should try to see if a
5987 UIntConstant can fit in an integer.
5989 2002-05-07 Ravi Pratap <ravi@ximian.com>
5991 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
5992 when we are in an explicit context.
5994 (ConvertReferenceExplicit): When converting from Iface type S to Class
5995 T make sure the rules are implemented as an OR.
5997 * parameter.cs (ParameterType): Make it a property for now although the
5998 purpose really isn't anything immediate.
6000 * expression.cs (Is*Applicable): Do better checking on the parameter type
6001 of a ref/out parameter. The ones from the system assemblies are already
6002 marked with the correct type so we don't need to do any correction.
6004 * ecore.cs (StandardConversionExists): Conversion from Interface types to
6005 the object type is standard too so include that.
6007 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6009 * ecore.cs (StandardConversionExists): Augment with missing code:
6010 deal with IntConstant, LongConstants and Enumerations.
6012 * assign.cs: Report the error, instead of failing silently
6014 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6015 typecontainer that they are declared, because the
6016 typecontainer/namespace will have the list of using clauses that
6019 Assembly Attributes were escaping the normal registration
6022 (EmitCode): Apply attributes within an EmitContext that represents
6023 the container they were declared on.
6025 * cs-parser.jay: Track bases for structs. How did I get this wrong?
6027 2002-05-06 Ravi Pratap <ravi@ximian.com>
6029 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6030 Revamp completely - make much cleaner as we now operate only
6033 (FindMostSpecificSource, FindMostSpecificTarget): New methods
6034 to implement the logic detailed in the spec more correctly.
6036 (UserDefinedConversion): Update accordingly.
6038 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6040 * statement.cs: Return flow analysis information up.
6042 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6045 (token): Do not consume an extra character before calling
6048 2002-05-06 Piers Haken <piersh@friskit.com>
6050 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6052 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6054 * class.cs (Constructor.Emit): Set the IsStatic flag in the
6055 EmitContext during the instance constructor initializer
6056 resolution, to stop access to instance variables.
6058 This is mandated by the spec, last paragraph of the `constructor
6059 initializers' section.
6061 2002-05-05 Miguel de Icaza <miguel@ximian.com>
6063 * cs-parser.jay, class.cs (Accessor): new class used to represent
6064 an accessor (get or set). In the past we used `null' to represent
6065 a missing accessor. But this is ambiguous because there was no
6066 way to tell in abstract indexers/properties if one of them was
6069 Now there is a way of addressing that.
6071 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6072 instead of FindMembers.
6074 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6075 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6077 * attribute.cs: Treat indexers and properties as the same in terms
6078 of applying attributes
6080 * ecore.cs (FindMostEncompassedType): Use statically initialized
6081 EmptyExpressions()s like we do elsewhere to avoid creating useless
6082 objects (and we take this out of the tight loop).
6084 (GetConversionOperators): Move the code to extract the actual
6085 operators to a separate routine to clean things up.
6087 2002-05-04 Miguel de Icaza <miguel@ximian.com>
6089 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6090 events are always registered FieldBuilders.
6092 * class.cs (FieldBase): New class shared by Fields
6094 * delegate.cs: If we are a toplevel delegate, use our full name.
6095 If we are a nested delegate, then only use our tail name.
6097 2002-05-02 Ravi Pratap <ravi@ximian.com>
6099 * expression.cs (IsApplicable): Ensure that we add the "&" to
6100 ref/out types before comparing it with the type of the argument.
6102 (IsParamsMethodApplicable): Ditto.
6104 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
6107 * delegate.cs : Handle the case when we have more than one applicable
6108 method. Flag an error only when we finish checking all.
6110 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6112 * expression.cs: Add support for boolean static initializers.
6114 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6116 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6118 * parameter.cs (ComputeParameterTypes,
6119 ComputeAndDefineParameterTypes): Better error handling: now we
6120 clear the `types' cache if we fail during any of the type lookups.
6121 We also return the status code correctly to our caller
6123 * delegate.cs: If we fail to define a delegate, abort the extra
6126 * expression.cs (Binary.ResolveOperator): for
6127 operator==(object,object) and operator !=(object, object) we also
6128 have to verify that there is an implicit conversion from one to
6131 (ArrayAccess.DoResolve): Array Access can operate on
6134 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6136 * assign.cs (CompoundAssign): A new class used as a "flag" that
6137 the assignment actually is happening as part of a compound
6138 assignment operator.
6140 During compound assignment, a few new rules exist to enable things
6147 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6148 to the type of x) if y is implicitly convertible to the type of x,
6149 and the operator is a builtin operator and the return type of the
6150 operator is explicitly convertible to the type of x.
6152 * rootcontext.cs: Reset warning level to 2. 4 catches various
6153 "interesting" features in mcs, we must clean this up at some
6154 point, but currently am trying to kill other bugs ;-)
6156 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6157 in container classes as well.
6159 * expression.cs (Binary.ResolveOperator): Handle string case
6160 before anything else (as operator overloading does emit an error
6161 before doing anything else).
6163 This code could go away when we move to a table driven model, but
6164 i could not come up with a good plan last night.
6166 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6168 * typemanager.cs (CSharpName): reimplementation using regex.
6169 * class.cs: added null check for fields in Emit
6170 * rootcontext.cs: set warninglevel to 4
6172 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6174 * typemanager.cs (CSharpName): reimplemented with Lupus
6177 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6179 * statement.cs (If): correclty implement Resolve, because we were
6180 not catching sem errors in there. The same process is needed
6182 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6185 (Statement.Warning_DeadCodeFound): Factorize code.
6186 (While): Report dead code here too.
6188 (Statement): Added Resolve virtual method to allow
6189 for resolution split from the emit code.
6191 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6193 * statement.cs (EmitBoolExpression): No longer try to resolve the
6195 (MakeBoolean): New utility function that resolve, implicitly
6196 converts to boolean and tags the expression.
6199 (If, Do): Implement dead code elimination.
6200 (While): Implement loop inversion
6202 (Do, While, For, If): Resolve the expression prior to calling our
6205 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6208 - added method Report28 (warning: program has more than one entry point)
6209 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6210 - modified method Method.Define, the part at the end of the method
6212 * rootcontext.cs: added static public Location EntryPointLocation;
6214 * ../errors/cs0028.cs : Add test case for the above warning.
6217 - modified method CSharpName to allow arrays of primitive type to
6218 be printed nicely (e.g. instead of System.Int32[][] it now prints
6220 - added method CSharpSignature: returns the signature of a method
6221 in string format to be used in reporting errors, warnings, etc.
6223 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6226 2002-04-26 Ravi Pratap <ravi@ximian.com>
6228 * delegate.cs (Define): Fix extremely silly bug where I was
6229 setting the type of the 'object' parameter of the BeginInvoke
6230 method to System.IAsyncResult instead of System.Object ;-)
6232 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6234 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6237 (Constructor.Emit): return if we fail to initialize the
6238 constructor. Another door closed!
6240 * expression.cs (New.DoResolve): Improve error message (from -6 to
6241 1501). Use DeclaredOnly lookup to find the exact constructor.
6243 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6244 loop. This is useful.
6246 * cs-parser.jay: Adjust the default parameters so that destructors
6247 have the proper signature.
6249 2002-04-26 Martin Baulig <martin@gnome.org>
6251 * driver.cs (LoadAssembly): If `assembly' contains any characters
6252 which are only valid in path names and not in assembly names
6253 (currently slash, backslash and point), use Assembly.LoadFrom ()
6254 instead of Assembly.Load () on the `assembly' (before iteration
6255 over the link_paths).
6257 2002-04-26 Martin Baulig <martin@gnome.org>
6259 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6261 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6263 * class.cs (Property): use the new typemanager.MemberLookup
6265 (TypeContainer.MemberLookup): Implement using the
6266 TypeManager.MemberLookup now.
6268 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6269 and return MemberInfos, so that these can be used without an
6270 EmitContext (what we had before).
6272 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6274 * expression.cs: Fix the case where the argument to params if the
6275 type of the params. I omitted handling this before. Fixed
6277 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6279 * driver.cs: Call BootCorlib_PopulateCoreType
6281 * class.cs (Property.CheckBase): Check for properties only, not
6284 * interface.cs: Temporary hack: try/catch around the
6285 CustomAttributeBuilder, because I am getting an exception that I
6288 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6289 types whose definitions are required to be there (attributes are
6290 defined before standard types).
6292 Compute definitions as we boot the various types, as they are used
6293 immediately (value_type class will need object_type, but if we do
6294 not initialize object_type, we will pass a null, which will let
6295 the runtime pick the System.Object from the existing corlib, which
6296 is not what we want).
6298 2002-04-22 Patrik Torstensson <totte@labs2.com>
6300 * cs-tokenizer.cs: fixed a number of trim() issues.
6302 2002-04-22 Ravi Pratap <ravi@ximian.com>
6304 * expression.cs (Argument.Type): Ensure that we return the correct
6305 type when we have out or ref parameters [in which case we
6308 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6310 * class.cs (Property, Indexer): Allow extern modifier in there.
6312 * typemanager.cs (InitBaseTypes): Initializes object_type and
6313 value_type, since those will be used early on during the bootstrap
6314 process to compile corlib.
6316 (InitCoreTypes): Move code from here to InitBaseTypes.
6318 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6320 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6321 single-dimension arrays as using the ldlen opcode.
6323 Daniel Lewis discovered this optimization.
6325 * typemanager.cs: Add signature for System.Array::get_Length
6327 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6329 * statement.cs: report the error when the foreach does not apply to an
6330 array nor a collection.
6332 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6334 * expression.cs: Add implicit conversions to the operator ~.
6336 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6338 * typemanager.cs: Locate the decimal constructor.
6340 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6342 * attribute.cs: use the new property of TypeOf.
6343 * expression.cs: added 'get' property around typearg.
6345 These changes fix a build breaker reported by NickD. Is this the
6346 correct way to fix? If not, please, revert my changes and make it
6349 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6351 * attribute.cs: Add support for typeof in attribute invocations.
6352 I am not sure that this is right though.
6354 2002-04-14 Duncan Mak <duncan@ximian.com>
6356 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6357 Binary.Operator.Division case.
6359 2002-04-13 Ravi Pratap <ravi@ximian.com>
6361 * class.cs (DefineType): Ensure that we do a proper check on
6362 attribute types and also register it with the TypeManager.
6364 (TypeContainer.Targets): The default for attribute types is
6365 AttributeTargets.All.
6367 * attribute.cs (ApplyAttributes): Registering the attribute type
6368 is done elsewhere, not when we discover we have a Usage attribute.
6370 2002-04-12 Ravi Pratap <ravi@ximian.com>
6372 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6373 and get rid of is_delegate parameter.
6375 * everywhere : update.
6377 2002-04-12 Ravi Pratap <ravi@ximian.com>
6379 * cs-parser.jay (compilation_unit): Revamp completely to use
6380 some new ideas that I got from Rhys' grammar to solve the problems
6381 with assembly level attributes.
6383 (outer_declaration): New grammar production.
6385 (attribute_sections): Add.
6387 (opt_attributes): Base on attribute_sections
6389 (namespace_declaration): Allow opt_attributes to tackle the case
6390 when we have assembly level attributes - we are clever in this
6393 * attribute.cs (ApplyAttributes): Do not worry about assembly
6394 attributes in the non-global context.
6396 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6397 instead of SetGlobalAttributes.
6399 * class.cs, rootcontext.cs : Ensure we define and generate
6400 attribute types before anything else.
6402 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6403 and flag the new error -20 for the case when the attribute type
6404 does not have valid targets specified. csc does not catch this.
6406 * ../errors/errors.txt : update for error # -20
6408 2002-04-11 Ravi Pratap <ravi@ximian.com>
6410 * support.cs (InternalParameters.ParameterModifier): Do some null
6411 checking and return sane values.
6413 * class.cs (Method.Define): If we are a PInvoke method, ensure
6414 that we are static and extern. Report error # 601
6416 * ../errors/cs0601.cs : Add test case for the above error.
6418 2002-04-07 Ravi Pratap <ravi@ximian.com>
6420 * rootcontext.cs (attribute_types): We need to keep type of
6421 all attribute types separately and emit code for them first.
6423 (RegisterAttribute) : Implement.
6425 * class.cs (DefineType): Check if the current Type is a custom
6426 attribute type and register it accordingly.
6428 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6429 adding the first attribute twice and rename to
6431 (SetGlobalAttributes): this.
6433 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6436 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6437 if we are processing global arguments. Hmm, I am unsure of this.
6439 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6441 * expression.cs: added static array of strings to avoid calling
6442 Enum.ToString () for Operator in Binary. Significant recover of
6445 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6447 * class.cs (FindMembers): Allow the Builders of the various
6448 members to be null. If they are skip them. This only happens
6449 during the PInvoke declaration.
6451 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6453 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6454 failure, so we do not keep going afterwards.
6456 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6457 wanted to pass `false' as the `is_delegate' argument. If this is
6458 the case, why not use delegate_type == null to mean `is_delegate =
6459 false' and anything else as is_delegate = true.
6461 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6463 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6464 code for the section, not the beginning of the tests.
6466 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6468 * cfold.cs: Handle operator + (Enum x, Underlying x)
6470 * expression.cs (Binary): same. Warn about errors where we have
6471 Enum/Enum in operator + as well.
6473 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6476 - added support for switch(bool)
6477 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6478 - add TableSwitchEmit() to handle table-based switch statements
6480 2002-04-05 Ravi Pratap <ravi@ximian.com>
6482 * expression.cs (Invocation.OverloadResolve): Factor out code which
6483 does parameter compatibility checking with arguments so that we can
6484 re-use the code even from Delegate.VerifyApplicability
6486 (VerifyArgumentsCompat): Move above code here.
6488 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6489 and instead make a call to the above method.
6491 2002-03-31 Ravi Pratap <ravi@ximian.com>
6493 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6494 We use it to keep track of classes which are attribute types.
6496 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6498 * delegate.cs (Delegate.Define): Correctly define the types in the
6499 presence of fixed and array parameters.
6501 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6504 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6505 include NonPublic after the first iteration.
6507 * class.cs (Indexer.CheckBase): Only check if both parents are
6510 * cs-parser.jay (accessor_body): If empty, set to null.
6512 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6513 same code path here to resolve constants names that we did have in
6514 MemberAccess.DoResolve. There is too much code duplicated here.
6516 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6518 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6520 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6523 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6524 tokens, numbers and strings.
6526 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6529 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6530 asyncronous parameters and the regular parameters.
6532 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6533 specify the target directory.
6535 * expression.cs: (This.DoResolve): Simplify
6536 (As.Emit): Optimize, do not generate IsInst if the expression is
6537 always of the given type.
6539 (Is.DoResolve): Bug fix, we were reporting both always/never for
6542 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6543 creating too many unnecessary arrays.
6545 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6547 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6548 fields instead of rolling our own initializer. Takes care of all
6549 implicit conversions, and drops unnecessary static checks/argument.
6551 2002-03-31 Dick Porter <dick@ximian.com>
6553 * driver.cs: use the GetDirectories() return values properly, and
6554 use "/" as path separator.
6556 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6558 * expression.cs (Unary): Optimize - - expr into expr.
6559 (Binary): Optimize a + (-b) into a -b.
6561 * codegen.cs (CodeGen): Made all methods static.
6563 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6567 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6568 TypeBuilder property.
6570 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6573 * tree.cs: Removed the various RecordXXXX, and replaced with a
6574 single RecordDecl. Removed all the accessor methods, and just
6575 left a single access point Type
6577 * enum.cs: Rename DefineEnum to DefineType.
6579 * decl.cs: New abstract method `DefineType' used to unify the
6580 Defines for Enumerations, Interfaces, TypeContainers and
6583 (FindType): Moved LookupInterfaceOrClass here. Moved the
6584 LookupBaseClasses method that used to live in class.cs and
6585 interface.cs here, and renamed to FindType.
6587 * delegate.cs: Implement DefineType. Take advantage of the
6588 refactored pattern for locating the parent builder without taking
6589 the parent_builder argument (which we know does not work if we are
6590 nested, and triggering a toplevel definition).
6592 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6594 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6595 accessibility of a member has changed during override and report
6598 * class.cs (Method.Define, Property.Define): Only complain on
6599 overrides if the method is private, any other accessibility is
6600 fine (and since we just checked the permission is the same, we are
6603 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6604 and elif are processed always. The other pre-processing
6605 directives are only processed if we are "taking" the path
6607 2002-03-29 Martin Baulig <martin@gnome.org>
6609 * class.cs (Method.Emit): Only emit symbolic debugging info if the
6610 current location is not Null.
6612 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6613 a separate method so we can profile it.
6615 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6616 `span.Seconds' are just seconds, but no minutes or hours.
6617 (MainDriver): Profile the CodeGen.SaveSymbols calls.
6619 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6621 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6622 Remove the gratuitous set of Final:
6624 // If an interface implementation, then we can set Final.
6625 if (((flags & MethodAttributes.Abstract) == 0) &&
6626 implementing.DeclaringType.IsInterface)
6627 flags |= MethodAttributes.Final;
6629 I do not know what I was smoking when I used that.
6632 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6633 step into fixing the name resolution issues for delegates and
6634 unifying the toplevel name resolution.
6636 2002-03-28 Martin Baulig <martin@gnome.org>
6638 * class.cs (Method.Emit): If we have a symbol writer, call its
6639 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6640 tell it about the current method.
6642 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6643 writer that we're going to emit the first byte of IL code for a new
6644 statement (a new source line).
6645 (EmitContext.EmitTopBlock): If we have a symbol writer, call
6646 EmitContext.Mark() before emitting any code.
6648 * location.cs (SymbolDocument): Return null when we're Null.
6650 * statement.cs (Statement): Moved the `Location loc' variable here.
6651 (Statement.EmitBoolExpression): If we have a symbol writer, call
6652 ec.Mark() before emitting any code to tell it that we're at the
6653 beginning of a new statement.
6654 (StatementExpression): Added `Location' argument to the constructor.
6655 (Block): Added public readonly variable `StartLocation' and public
6656 variable `EndLocation'. The latter is to be set using SetEndLocation().
6657 (Block): Added constructor which takes a start and end location.
6658 (Block.SetEndLocation): New method. This sets the end location.
6659 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6660 local variables we create.
6661 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6662 each statement and do also mark the begin and end of the block.
6664 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6665 tell it the current lexer.Location, use Location.Null for the end of the
6667 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6668 current block, set its end location using SetEndLocation().
6669 (statement_expression): StatementExpression constructor now takes the
6670 lexer.Location as additional argument.
6671 (for_statement, declare_local_variables): Likewise.
6672 (declare_local_variables): When creating a new implicit block, use the
6673 new Block constructor and pass it the lexer.Location.
6675 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6677 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6678 members also on the parent interfaces recursively.
6680 2002-03-27 Miguel de Icaza <miguel@ximian.com>
6682 * report.cs: Use new formats, since Gonzalo finished the missing
6685 * expression.cs (Binary.ResolveOperator): added missing operator|
6686 operator& and operator^ for bool/bool.
6688 * cs-parser.jay: CheckDef now takes a Location argument that is
6689 used to report errors more precisly (instead of reporting the end
6690 of a definition, we try to track something which is a lot closer
6691 to the source of the problem).
6693 * cs-tokenizer.cs: Track global token use, so we can properly flag
6694 the use of #define/#undef after the first token has been seen.
6696 Also, rename the reportXXXX to Error_DescriptiveName
6698 * decl.cs (DeclSpace.IsTopLevel): Move property here from
6699 TypeContainer, so that Enum and Interface can use this too.
6701 * class.cs (TypeContainer.LookupInterfaceOrClass,
6702 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6703 `builder' argument. Typically this was used to pass the parent
6704 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6707 The problem is that a nested class could trigger the definition of
6708 a toplevel class, and the builder would be obviously wrong in that
6711 So we drop this argument, and we compute dynamically the
6712 TypeBuilder/ModuleBuilder (the correct information was available
6713 to us anyways from DeclSpace.Parent)
6715 * interface.cs (Interface.DefineInterface): Drop builder
6716 parameter cleanup like class.cs
6718 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
6721 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6724 (Try.Emit): Propagate the returns value from the statement.
6726 (Return.Emit): Even if we are leavning
6728 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6730 * modifiers.cs: Fix the computation of MethodAttributes flags.
6732 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6734 * driver.cs: allow compilation of files that start with '/'.
6735 Add a default case when checking the argument of --target.
6737 2002-03-25 Miguel de Icaza <miguel@ximian.com>
6739 * interface.cs: Implement the same search algorithm for types in
6742 * delegate.cs: Do not allow multiple definition.
6744 * Recovered ChangeLog that got accidentally amputated
6746 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6748 * rootcontext.cs: Load manually enum to allow core classes to
6749 contain enumerations.
6751 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6752 Update to new static methods in TypeManager.
6754 * typemanager.cs (GetMethod, GetConstructor): Use our
6755 implementation of FindMembers to find the members, since during
6756 corlib compilation, the types are TypeBuilders and GetMethod and
6757 GetConstructor do not work.
6759 Make all methods in TypeManager static.
6761 (InitCodeHelpers): Split the functionality from
6762 the InitCodeTypes function.
6764 * driver.cs: Call InitCodeHelpers after we have populated the
6767 * cs-parser.jay (delegate_declaration): we did not used to compute
6768 the delegate name correctly for void delegates.
6770 2002-03-24 Miguel de Icaza <miguel@ximian.com>
6772 * rootcontext.cs (RootContext): Init the interface_resolve_order
6773 and type_container_resolve_order always.
6775 (ResolveCore, BootstrapCorlib_ResolveClass,
6776 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6777 compiler when compiling with --nostdlib
6779 * class.cs (TypeContainer.DefineType): Check that our parent is
6780 not null. This test is most important when we are bootstraping
6783 * codegen.cs: Split out the symbol writing code.
6785 2002-03-25 Martin Baulig <martin@gnome.org>
6787 * driver.cs (-g): Made -g an alias for --debug.
6789 2002-03-24 Martin Baulig <martin@gnome.org>
6791 * codegen.cs (SymbolWriter): New public variable. Returns the
6792 current symbol writer.
6793 (CodeGen): Added `bool want_debugging_support' argument to the
6794 constructor. If true, tell the ModuleBuild that we want debugging
6795 support and ask it for the ISymbolWriter.
6796 (Save): If we have a symbol writer, call it's Close() method after
6797 saving the assembly.
6799 * driver.c (--debug): New command line argument to create a
6800 debugger information file.
6802 * location.cs (SymbolDocument): New public property. Returns an
6803 ISymbolDocumentWriter object for the current source file or null
6804 if we don't have a symbol writer.
6806 2002-03-21 Miguel de Icaza <miguel@ximian.com>
6808 * driver.cs (LoadAssembly): Correctly return when all the paths
6809 have been tried and not before.
6811 * statement.cs (Switch.Emit): return the actual coverage for this
6812 statement (returns/not-returns)
6814 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
6815 switch of the statement if we are the last switch section. That
6816 kills two problems: try/catch problems (we used to emit an empty
6817 nop at the end) and switch statements where all branches would
6820 2002-03-19 Miguel de Icaza <miguel@ximian.com>
6822 * driver.cs: Add default assemblies (the equivalent to the
6823 Microsoft CSC.RSP file)
6825 * cs-tokenizer.cs: When updating `cols and setting it to zero,
6826 also update tokens_seen and set it to false.
6828 * driver.cs: Implement --recurse for Mike.
6830 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
6831 correctly splitting out the paths.
6833 2002-03-18 Miguel de Icaza <miguel@ximian.com>
6835 * interface.cs (Interface.PopulateProperty): Instead of using
6836 `parent' as the declaration space for the set parameters, use
6839 * support.cs (InternalParameters): InternalParameters constructor
6840 takes a DeclSpace instead of a TypeContainer.
6842 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
6843 types are being initialized, load the address of it before calling
6846 (New): Provide a mechanism to disable the generation of local
6847 value type temporaries when the caller will be providing us with
6848 an address to store it.
6850 (ArrayCreation.EmitDynamicInitializers): Use it.
6852 2002-03-17 Miguel de Icaza <miguel@ximian.com>
6854 * expression.cs (Invocation.EmitArguments): Only probe for array
6855 property if there is more than one argument. Sorry about that.
6857 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
6860 * class.cs (Method.LabelParameters): Fix incorrect code path that
6861 prevented the `ParamArrayAttribute' from being applied to the
6864 2002-03-16 Miguel de Icaza <miguel@ximian.com>
6866 * support.cs (ReflectionParameters): Correctly compute whether the
6867 last argument is a params array. Fixes the problem with
6870 * typemanager.cs: Make the assemblies array always be non-null
6871 (empty, but non-null)
6873 * tree.cs (RecordDecl): New function that abstracts the recording
6874 of names. This reports error 101, and provides a pointer to the
6875 previous declaration. Fixes a crash in the compiler.
6877 * cs-parser.jay (constructor_declaration): Update to new grammar,
6878 and provide a constructor_body that can be empty.
6880 2002-03-15 Miguel de Icaza <miguel@ximian.com>
6882 * driver.cs: Add support for --resources.
6884 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6885 Make all types for the various array helper methods be integer.
6887 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6888 CheckState to ConvCast.
6890 (ConvCast): Now it takes a `checked' state argument, to avoid
6891 depending on the emit context for the conversion, and just using
6892 the resolve time setting.
6894 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6895 instead of Invocation.EmitArguments. We do not emit the original
6896 arguments, instead we emit those which have been converted to
6897 unsigned int expressions.
6899 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6901 * codegen.cs: ditto.
6903 * expression.cs (LocalVariableReference): Drop the use of the
6904 Store function that depended on the variable index.
6906 * statement.cs (VariableInfo): Drop the `Idx' property from this
6907 class, as this is not taking into account the indexes for
6908 temporaries tat we generate during the execution, getting the
6911 * class.cs: First emit class initializers, then call the parent
6914 * expression.cs (Binary): Fix opcode emision.
6915 (UnaryMutator.EmitCode): Support checked code generation
6917 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6918 matches for events for both the Static and Instance scans,
6919 pointing to the same element. Fix that.
6921 2002-03-14 Miguel de Icaza <miguel@ximian.com>
6923 * rootcontext.cs (ResolveTree): Always set the
6924 interface_resolve_order, because nested interfaces will be calling
6927 * class.cs (GetInterfaceOrClass): Track the same resolution
6928 process used by TypeManager.LookupType. This fixes the nested
6929 type lookups in class declarations (separate path from
6932 (TypeContainer.DefineType): Also define nested interfaces.
6933 (TypeContainer.RegisterOrder): New public function used to
6934 register the order in which child interfaces need to be closed.
6936 Nested interfaces need to be closed after their parents have been
6939 * interface.cs (InterfaceAttr): Put all the logic for computing
6940 the interface attribute here.
6942 (DefineInterface): Register our interface order with the
6943 RootContext or with the TypeContainer depending on the case.
6945 2002-03-12 Miguel de Icaza <miguel@ximian.com>
6947 * cs-parser.jay: rework foreach statement to work with the new
6948 changes to the policy on SimpleNames.
6950 * report.cs: support Stacktrace on warnings as well.
6952 * makefile: drop --unsafe and /unsafe from the compile.
6954 2002-03-13 Ravi Pratap <ravi@ximian.com>
6956 * ecore.cs (StandardConversionExists): Modify to take an Expression
6957 as the first parameter. Ensure we do null -> reference type conversion
6960 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
6961 temporary Expression objects.
6963 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
6965 * interface.cs: workaround bug in method overloading resolution
6966 (there is already a bugzilla bug for it).
6968 2002-03-12 Miguel de Icaza <miguel@ximian.com>
6970 We could also solve this problem by having a separate path for
6971 performing type lookups, instead of DoResolve, we could have a
6972 ResolveType entry point, and only participating pieces of the
6973 production (simplename, deref, array) would implement this.
6975 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
6976 signal SimpleName to only resolve type names and not attempt to
6977 resolve anything else.
6979 * expression.cs (Cast): Set the flag.
6981 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
6983 * class.cs: Only report 108 if there is no `new' modifier.
6985 * cs-parser.jay: rework foreach statement to work with the new
6986 changes to the policy on SimpleNames.
6988 * report.cs: support Stacktrace on warnings as well.
6990 * makefile: drop --unsafe and /unsafe from the compile.
6992 2002-03-11 Miguel de Icaza <miguel@ximian.com>
6994 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6995 lookups here, instead of doing that at parse time. This means
6996 that our grammar will not introduce `LocalVariableReferences' as
6997 expressions at this point. That solves the problem of code like
7005 This is only half the fix. The full fix requires parameters to
7006 also be handled in this way.
7008 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7009 makes the use more obvious of the DeclSpace. The
7010 ec.TypeContainer.TypeBuilder is now only used to pull the
7013 My theory is that I can get rid of the TypeBuilder completely from
7014 the EmitContext, and have typecasts where it is used (from
7015 DeclSpace to where it matters).
7017 The only pending problem is that the code that implements Aliases
7018 is on TypeContainer, and probably should go in DeclSpace.
7020 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7021 lookups here, instead of doing that at parse time. This means
7022 that our grammar will not introduce `LocalVariableReferences' as
7023 expressions at this point. That solves the problem of code like
7031 This is only half the fix. The full fix requires parameters to
7032 also be handled in this way.
7034 * class.cs (Property.DefineMethod): When implementing an interface
7035 method, set newslot, when implementing an abstract method, do not
7036 set the flag (before we tried never setting it, or always setting
7037 it, which is the difference).
7038 (Indexer.DefineMethod): same.
7039 (Method.DefineMethod): same.
7041 * ecore.cs: Only set the status used flag if we get back a Field.
7043 * attribute.cs: Temporary hack, so Paolo can keep working.
7045 2002-03-08 Ravi Pratap <ravi@ximian.com>
7047 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7048 the unmanaged type in the case we have a MarshalAs attribute.
7050 (Resolve): Handle the case when we are parsing the special MarshalAs
7051 attribute [we need to store the unmanaged type to use later]
7053 * typemanager.cs (marshal_as_attr_type): Built in type for the
7054 MarshalAs Attribute.
7056 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
7057 on parameters and accordingly set the marshalling info.
7059 2002-03-09 Miguel de Icaza <miguel@ximian.com>
7061 * class.cs: Optimizing slightly by removing redundant code after
7062 we switched to the `NoTypes' return value.
7063 (Property.DefineMethod): use NoTypes here too.
7065 This fixes the bug I introduced in my last batch of changes.
7067 2002-03-05 Ravi Pratap <ravi@ximian.com>
7069 * tree.cs (RecordEnum): Add. We now keep track of enums too.
7071 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7072 Enums since those are types too.
7074 * cs-parser.jay (enum_declaration): Record enums as we parse them.
7076 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
7077 thanks to a call during the lookup process.
7079 2002-03-07 Miguel de Icaza <miguel@ximian.com>
7081 * statement.cs (Foreach): Lots of work to accomodate a particular
7082 kind of foreach statement that I had not kept in mind. It is
7083 possible to have foreachs on classes that provide a GetEnumerator
7084 method that return objects that implement the "pattern" for using
7085 a foreach, there is no need to support GetEnumerator
7088 This is needed to compile nant.
7090 * decl.cs: Only report 114 if the member is not `Finalize' and if
7091 the warning level is at least 2.
7093 * class.cs: Moved the compare function from Method to
7096 (MethodSignature.InheritableMemberSignatureCompare): Add new
7097 filter function that is used to extract inheritable methods from a
7100 (Method.Define): Use the new `inheritable_method_signature_filter'
7103 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7106 2002-03-06 Miguel de Icaza <miguel@ximian.com>
7108 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7110 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7112 * expression.cs: Pass location information to
7113 ConvertImplicitStandard.
7115 * class.cs: Added debugging code to track return values from
7118 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7120 * expression.cs (Is.DoResolve): If either side of the `is' is an
7121 interface, do not flag the warning.
7123 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7126 * report.cs: Allow for --fatal to be used with --probe.
7128 * typemanager.cs (NoTypes): Move the definition for the empty Type
7131 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7133 (TypeContainer.DefineProxy): New function used to proxy to parent
7134 implementations when implementing interfaces.
7135 (TypeContainer.ParentImplements): used to lookup if our parent
7136 implements a public function that is required by an interface.
7137 (TypeContainer.VerifyPendingMethods): Hook this up.
7139 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7140 `modules' and `assemblies' arraylists into arrays. We only grow
7141 these are the very early start up of the program, so this improves
7142 the speedof LookupType (nicely measured).
7144 * expression.cs (MakeByteBlob): Replaced unsafe code with
7145 BitConverter, as suggested by Paolo.
7147 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7148 folding of string concatenation, but if either side is a string,
7149 and the other is not, then return null, and let the runtime use
7150 the concatenation on the string plus the object (using
7153 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7155 Constant Folding has been implemented now.
7157 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7158 the error instead on types that are not supported in one's
7161 * constant.cs (Constant and all children): New set of functions to
7162 perform implict and explicit conversions.
7164 * ecore.cs (EnumConstant): Implement the new functions to perform
7165 conversion by proxying to the child expression.
7167 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7168 own separate setting that can not be turned off from the command
7169 line using --unchecked or --checked and is only controlled using
7170 the checked/unchecked statements and expressions. This setting is
7171 used by the constant folder to flag errors.
7173 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7174 ConstantCheckState as well.
7176 During Resolve, they also have to flag the state, because the
7177 constant folder runs completely in the Resolve phase.
7179 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7182 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7184 * cfold.cs: New file, this file contains the constant folder.
7186 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7187 argument to track whether we are using the resulting address to
7188 load or store a value and provide better error messages.
7190 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7191 new AddressOf arguments.
7193 * statement.cs (Foreach.EmitCollectionForeach): Update
7195 * expression.cs (Argument.Emit): Call AddressOf with proper
7196 arguments to track usage.
7198 (New.DoEmit): Call AddressOf with new arguments.
7200 (Unary.Emit): Adjust AddressOf call.
7202 2002-03-01 Ravi Pratap <ravi@ximian.com>
7204 * cs-parser.jay (member_access): Change the case for pre-defined types
7205 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7208 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7211 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7212 essentially like methods and apply attributes like MethodImplOptions to them too.
7214 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7217 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7218 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7221 * Update code everywhere accordingly.
7223 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7225 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7227 2002-02-28 Ravi Pratap <ravi@ximian.com>
7229 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7230 try performing lookups against those instead of jumping straight into using
7231 the 'using' clauses.
7233 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7235 (LookupType): Perform lookups in implicit parents too.
7237 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7238 sequence as RootContext.LookupType.
7240 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7241 the various cases of namespace lookups into this method.
7243 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7245 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7246 in positional arguments)
7248 * class.cs (Operator): Update the AllowedModifiers to contain
7251 * cs-parser.jay: Update operator declaration to allow for the
7252 operator body to be empty.
7254 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7257 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7259 * class.cs (Method.Emit): Label parameters.
7261 * driver.cs: Return 1 or 0 as the program exit code.
7263 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7265 * expression.cs: Special case the `null' object when trying to
7266 auto-compute the type, as anything can be explicitly converted to
7269 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7270 spotting this Paolo.
7272 (Expression.ImplicitNumericConversion): Perform comparissions of
7273 the type using the underlying type in the case of an enumeration
7274 rather than using the enumeration type for the compare.
7276 Cope with the underlying == type case, which is not possible to
7279 (Expression.ConvertNumericExplicit): Perform comparissions of
7280 the type using the underlying type in the case of an enumeration
7281 rather than using the enumeration type for the compare.
7283 * driver.cs: If the user does not supply an extension, assume .exe
7285 * cs-parser.jay (if_statement): Rewrote so that we can track the
7286 location for the if statement.
7288 * expression.cs (Binary.ConstantFold): Only concat strings when
7289 the operation is "+", not everything ;-)
7291 * statement.cs (Statement.EmitBoolExpression): Take a location
7293 (If, While, Do): Track location.
7295 * expression.cs (Binary.ResolveOperator): In the object + string
7296 case, I was missing a call to ConvertImplicit
7298 2002-02-25 Ravi Pratap <ravi@ximian.com>
7300 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7301 Location arguments. Ensure we use RootContext.LookupType to do our work
7302 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7304 * interface.cs (PopulateMethod): Handle the type of the parameter being
7307 * expression.cs (Invocation.BetterFunction): Handle the case when we
7308 have a params method with no fixed arguments and a call is made with no
7311 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7313 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7314 the verbatim-string-literal
7316 * support.cs (InternalParameters.ParameterModifier): handle null
7318 (InternalParameters.ParameterType): ditto.
7320 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7321 duplicating the name of the variable parameter.
7322 (GetParameterByName): Fix bug where we were not looking up array
7323 paramters if they were the only present (thanks Paolo!).
7324 (GetParameterInfo): We only have an empty set of types if both
7325 fixed and array are set to null.
7326 (GetParameterInfo-idx): Handle FixedParameter == null
7328 * cs-parser.jay: Handle the case where there is no catch
7329 statements (missing null test).
7331 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7333 * driver.cs (MainDriver): Be conservative on our command line
7336 Catch DirectoryNotFoundException when calling GetFiles.
7338 (SplitPathAndPattern): Used to split the input specification into
7339 a path and a pattern that we can feed to Directory.GetFiles.
7341 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7343 * statement.cs (Fixed): Implement the last case of the Fixed
7344 statement (string handling).
7346 * expression.cs (StringPtr): New class used to return a char * to
7347 a string; Used by the Fixed statement.
7349 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7351 * expression.cs (Binary.ResolveOperator): Remove redundant
7352 MemberLookup pn parent type.
7353 Optimize union call, we do not need a union if the types are the same.
7354 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7357 Specialize the use of MemberLookup everywhere, instead of using
7358 the default settings.
7360 (StackAlloc): Implement stackalloc keyword.
7362 * cs-parser.jay: Add rule to parse stackalloc.
7364 * driver.cs: Handle /h, /help, /?
7366 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7367 before we supported unsafe code.
7369 * makefile: add --unsafe to the self compilation of mcs.
7371 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7373 * expression.cs (PointerArithmetic): New class that is used to
7374 perform pointer arithmetic.
7375 (Binary.Resolve): Handle pointer arithmetic
7376 Handle pointer comparission.
7377 (ArrayPtr): Utility expression class that is used to take the
7378 address of an array.
7380 (ElementAccess): Implement array access for pointers
7382 * statement.cs (Fixed): Implement fixed statement for arrays, we
7383 are missing one more case before we are done.
7385 * expression.cs (Indirection): Implement EmitAssign and set the
7386 ExprClass to Variable. This allows pointer dereferences to be
7387 treated as variables, and to have values assigned to them.
7389 * ecore.cs (Expression.StoreFromPtr): New utility function to
7390 store values dereferencing.
7392 2002-02-20 Ravi Pratap <ravi@ximian.com>
7394 * expression.cs (Binary.ResolveOperator): Ensure that we are
7395 not trying to operate on a void type - this fixes the reported
7398 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7399 the parent implementation is sealed.
7401 * ../errors/cs0239.cs : Add.
7403 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7405 * typemanager.cs (unverifiable_code_type): Corresponds to
7406 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7407 which have unsafe code in them.
7409 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7412 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7414 * cs-tokenizer.cs: Add support for @"litreal strings"
7416 Make tokenizer accept pre-processor directives
7417 on any column (remove the old C-like limitation).
7419 * rootcontext.cs (EmitCode): Emit any global attributes.
7420 (AddGlobalAttributes): Used to keep track of assembly attributes.
7422 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7424 * cs-parser.jay: Add support for global attributes.
7426 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7428 * expression.cs (Indirection): New helper class. Unary will
7429 create Indirection classes to be able to implement the
7430 IMemoryLocation interface on it.
7432 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7434 * cs-parser.jay (fixed_statement): reference the right statement.
7436 * statement.cs (Fixed.Emit): Finish implementing the fixed
7437 statement for the &x case.
7439 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7441 * class.cs (Property.Define, Method.Define): Remove newslot when
7444 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7445 wrong. NewSlot should only be used if the `new' keyword is present.
7447 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7448 locating our system dir. Sorry about this.
7450 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7452 * driver.cs (GetSystemDir): Compute correctly the location of our
7453 system assemblies. I was using the compiler directory instead of
7454 the library directory.
7456 2002-02-13 Ravi Pratap <ravi@ximian.com>
7458 * expression.cs (BetterFunction): Put back in what Miguel commented out
7459 since it is the correct fix. The problem is elsewhere ;-)
7461 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7462 parameters of the parms method are themselves compatible or not !
7464 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7465 to check that a class implements an interface before saying that an implicit
7466 conversion was allowed. Use ImplementsInterface to do the checking.
7468 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7470 * class.cs (Method.Define): Track whether we are an explicit
7471 implementation or not. And only call DefineMethodOverride if we
7472 are an explicit implementation.
7474 (Property.DefineMethod): Ditto.
7476 2002-02-11 Ravi Pratap <ravi@ximian.com>
7478 * expression.cs (BetterFunction): Catch hideous bug which was
7479 preventing us from detecting ambiguous calls due to implicit casts i.e
7482 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7484 * support.cs (Pair): Remove un-needed method. I figured why I was
7485 getting the error in cs-parser.jay, the variable in a foreach loop
7486 is readonly, and the compiler does not really treat this as a variable.
7488 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7489 instead of EQUALS in grammar.
7491 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7493 * expression.cs (Unary.DoResolve): Check whether the argument is
7496 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7498 * support.cs: Api for Pair to set a value. Despite the fact that
7499 the variables are public the MS C# compiler refuses to compile
7500 code that accesses the field if the variable is part of a foreach
7503 * statement.cs (Fixed): Begin implementation of the fixed
7506 (Block.AddVariable): Return the VariableInfo on success and null
7507 on failure instead of true/false.
7509 * cs-parser.jay (foreach): Catch errors on variables already
7510 defined (we were ignoring this value before) and properly unwind
7513 (fixed_statement): grammar for the fixed statement.
7515 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7517 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7518 pointer types to be incretemented.
7520 (SizeOf): Implement.
7522 * cs-parser.jay (pointer_member_access): Implement
7523 expr->IDENTIFIER production.
7525 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7526 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7529 (Unary): Implement indirection.
7531 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7532 use in non-unsafe context).
7534 (SimpleName.DoResolve): Check for pointers in field access on safe
7537 (Expression.LoadFromPtr): Factor the load-indirect code in this
7538 function. This was duplicated in UnboxCast and ParameterReference
7540 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7542 * expression.cs (ComposedCast): report an error if a pointer cast
7543 is used in a safe region.
7545 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7546 pointer type casts in unsafe context.
7548 * codegen.cs (EmitContext): Set up IsUnsafe.
7550 * cs-parser.jay (non_expression_type): Add productions for pointer
7553 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7554 code. We should not use force into static mode if the method is
7555 not virtual. Fixes bug in MIS
7557 * statement.cs (Do.Emit, While.Emit, For.Emit,
7558 Statement.EmitBoolExpression): Add support to Do and While to
7559 propagate infinite loop as `I do return' semantics.
7561 Improve the For case to also test for boolean constants.
7563 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7564 to the list of attributes we can add.
7566 Remove `EmitContext' argument.
7568 * class.cs (Method.Define): Apply parameter attributes.
7569 (Constructor.Define): Apply parameter attributes.
7570 (MethodCore.LabelParameters): Move here the core of labeling
7573 * support.cs (ReflectionParameters.ParameterModifier,
7574 InternalParameters.ParameterModifier): Use IsByRef on the type and
7575 only return the OUT bit for these parameters instead of in/out/ref
7578 This is because I miss-understood things. The ParameterInfo.IsIn
7579 and IsOut represent whether the parameter has the [In] and [Out]
7582 2002-01-22 Miguel de Icaza <miguel@ximian.com>
7584 * ecore.cs (FieldExpr.Emit): Release temporaries.
7586 * assign.cs (LocalTemporary.Release): new function.
7588 * codegen.cs (EmitContext.GetTemporaryStorage,
7589 EmitContext.FreeTemporaryStorage): Rework the way we deal with
7590 temporary storage. Now we can "put back" localbuilders when we
7593 2002-01-21 Miguel de Icaza <miguel@ximian.com>
7595 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7596 need to make a copy of the variable to generate verifiable code.
7598 2002-01-19 Miguel de Icaza <miguel@ximian.com>
7600 * driver.cs: Compute dynamically the system directory.
7602 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7603 Slower, but more generally useful. Used by the abstract
7604 registering implementation.
7606 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7607 the rules for the special rule on Type/instances. First check if
7608 we have the same name, and if so, try that special static path
7609 rather than the instance path.
7611 2002-01-18 Miguel de Icaza <miguel@ximian.com>
7613 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7616 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7617 Enum, ValueType, Delegate or Array for non-corlib compiles.
7619 * cs-tokenizer.cs: Catch long identifiers (645)
7621 * typemanager.cs (IndexerPropetyName): Ravi never tested this
7624 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7625 fix, we were returning too early, so we were not registering
7626 pending methods from abstract classes.
7628 Do not register pending methods if the class is abstract.
7630 * expression.cs (Conditional.DoResolve): Report circular implicit
7631 conversions when we neecd to compute it for conditional
7634 (Is.DoResolve): If the expression is always of the provided type,
7635 flag warning 183. If the expression can not ever be of the
7636 provided type flag warning 184.
7638 * class.cs: Catch 169 as well.
7640 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7643 2002-01-18 Nick Drochak <ndrochak@gol.com>
7645 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
7647 2002-01-17 Miguel de Icaza <miguel@ximian.com>
7649 * interface.cs: (PopulateMethod): Check for pointers being defined
7650 only if the unsafe context is active.
7651 (PopulateProperty): ditto.
7652 (PopulateIndexer): ditto.
7654 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7655 specified. If pointers are present, make sure that they are
7656 present in an unsafe context.
7657 (Constructor, Constructor.Define): ditto.
7658 (Field, Field.Define): ditto.
7659 (Property, Property.Define): ditto.
7660 (Event, Event.Define): ditto.
7662 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7663 hashtable if there are classes or structs defined.
7665 * expression.cs (LocalVariableReference.DoResolve): Simplify this
7666 code, as the constant resolution moved.
7668 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7669 the metadata, so we can flag error 133.
7671 * decl.cs (MemberCore.UnsafeOK): New function to test that a
7672 pointer is being declared in an unsafe context.
7674 2002-01-16 Miguel de Icaza <miguel@ximian.com>
7676 * modifiers.cs (Modifiers.Check): Require a Location argument.
7677 Report error 227 for Unsafe use.
7679 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7681 * statement.cs (For.Emit): If the test is null, then report that
7682 we do `return', as we wont reach anything afterwards.
7684 (Switch.SwitchGoverningType): Track the expression that matched
7687 * driver.cs: Allow negative numbers as an error code to flag.
7689 * cs-parser.jay: Handle 1551.
7691 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7693 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7695 * cs-parser.jay: Report 1518 (type declaration can only contain
7696 class, struct, interface, enum or delegate)
7698 (switch_label): Report 1523 (keywords `case' or `default' must
7701 (opt_switch_sections): Report 1522 (empty switch)
7703 * driver.cs: Report 1515 (response file specified multiple times)
7704 Report 1516 (Source file specified multiple times).
7706 * expression.cs (Argument.Resolve): Signal 1510
7708 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7709 access not allowed in static code)
7711 2002-01-11 Ravi Pratap <ravi@ximian.com>
7713 * typemanager.cs (IsPointerType): Utility method which we are going
7716 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7717 the object type, so we take care of that.
7719 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7721 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7722 added to non-params parameters :-)
7724 * typemanager.cs (CSharpName): Include 'void' type too.
7726 (void_ptr_type): Include in the set of core types.
7728 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
7731 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
7734 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
7735 completely forgotten about it.
7737 2002-01-10 Ravi Pratap <ravi@ximian.com>
7739 * cs-parser.jay (pointer_type): Add. This begins our implementation
7740 of parsing rules for unsafe code.
7742 (unsafe_statement): Implement.
7744 (embedded_statement): Modify to include the above.
7746 * statement.cs (Unsafe): Implement new class for unsafe blocks.
7748 * codegen.cs (EmitContext.InUnsafe): Add. This determines
7749 if the current context is an unsafe one.
7751 * cs-parser.jay (local_variable_pointer_type): Since local variable types
7752 are handled differently, we need separate rules for them.
7754 (local_variable_declaration): Update to use local_variable_pointer_type
7755 to allow variable declarations of unmanaged pointer types.
7757 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7760 * ../errors/cs0214.cs : Add.
7762 2002-01-16 Nick Drochak <ndrochak@gol.com>
7764 * makefile: remove 'response' file when cleaning.
7766 2002-01-15 Miguel de Icaza <miguel@ximian.com>
7768 * cs-parser.jay: Report 1524.
7770 2002-01-14 Miguel de Icaza <miguel@ximian.com>
7772 * typemanager.cs (RegisterMethod): drop checking if we have
7773 registered this from here
7775 2002-01-12 Miguel de Icaza <miguel@ximian.com>
7777 * class.cs (Method.EmitDestructor): Implement calling our base
7780 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7783 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7784 this routine and will wrap the call in a try/catch block. Deal
7787 2002-01-11 Miguel de Icaza <miguel@ximian.com>
7789 * ecore.cs (Expression.MemberLookup): instead of taking a
7790 parameter `same_type' that was used to tell whether we could
7791 access private members we compute our containing type from the
7794 (FieldExpr): Added partial support for volatile fields. This does
7795 not work for volatile fields exposed from assemblies, as I can not
7796 figure out how to extract the modreq from it.
7798 Updated all the source files to use this.
7800 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7801 because it is referenced by MemberLookup very often.
7803 2002-01-09 Ravi Pratap <ravi@ximian.com>
7805 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
7806 TypeBuilder.GetCustomAttributes to retrieve what we need.
7808 Get rid of redundant default_member_attr_type as this is the same as
7809 default_member_type which already exists.
7811 * interface.cs, attribute.cs : Update accordingly.
7813 2002-01-08 Miguel de Icaza <miguel@ximian.com>
7815 * typemanager.cs: Enable IndexerPropertyName again. It does not
7816 work for TYpeBuilders though. Ravi, can you please fix this?
7818 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
7820 * expression.cs (Argument.Emit): Handle the case of ref objects
7821 being passed to ref functions;
7823 (ParameterReference.EmitLoad): Loads the content of the pointer
7824 without dereferencing.
7826 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7828 * cs-tokenizer.cs: Implemented the pre-processing expressions.
7830 2002-01-08 Ravi Pratap <ravi@ximian.com>
7832 * class.cs (Indexer.DefineMethod): Incorporate the interface
7833 type in the name of the method if we are doing explicit interface
7836 * expression.cs (ConversionExists): Remove as it is completely obsolete.
7838 (BetterConversion): Fix extremely trivial bug where we were referring to
7839 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
7842 * ../errors/bug16.cs : Add although we have fixed it.
7844 2002-01-07 Miguel de Icaza <miguel@ximian.com>
7846 * expression.cs (BaseIndexer): Begin implementation.
7848 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
7850 * cs-parser.jay (indexer_declarator): Use qualified_identifier
7851 production directly to remove a shift/reduce, and implement
7852 explicit interface implementation.
7854 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
7855 after a floating point suffix.
7857 * expression.cs (DoNumericPromotions): Improved the conversion for
7858 uint/uint. If we have a constant, we avoid doing a typecast to a
7861 * class.cs (Indexer): Implement explicit interface implementation
7864 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
7866 * class.cs: make the default instance constructor public and hidebysig.
7868 2001-01-03 Ravi Pratap <ravi@ximian.com>
7870 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
7871 so we can call it from elsewhere.
7873 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
7874 we emit it internally if the class has a defined indexer; otherwise the user
7875 emits it by decorating the class definition with the DefaultMemberAttribute.
7877 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
7878 attribute is not used on a type which defines an indexer.
7880 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
7881 character when we skip whitespace.
7883 * ../errors/cs0646.cs : Add.
7885 2002-01-03 Miguel de Icaza <miguel@ximian.com>
7887 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7890 * makefile: Add practical target `mcs3.exe' which builds the third
7891 generation compiler.
7893 * expression.cs (New): Fix structures constructor calling.
7895 * class.cs (Property, Method, Indexer): Emit Final flag on the
7896 method if we are an interface implementation and we are not
7899 * ecore.cs (PropertyExpr): New public field `IsBase', tells
7900 whether this property is referencing a `base' method.
7902 * expression.cs (Invocation.EmitCall): take an extra argument:
7903 is_base, this is used to determine whether the `call' or
7904 `callvirt' opcode should be used.
7907 * delegate.cs: update EmitCall.
7909 * class.cs (Method.Define): Set NewSlot for the cases where we are
7910 not implementing an interface method.
7912 (Property.Define): ditto.
7914 2002-01-02 Miguel de Icaza <miguel@ximian.com>
7916 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7917 'r'. Allows mcs to parse itself fully.
7919 2002-01-02 Ravi Pratap <ravi@ximian.com>
7921 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
7922 of the number of initializers that require the InitializeArray method.
7924 (CheckIndices): Store the Expression in all cases - not the plain value. Also
7925 update the above field where necessary.
7927 (MakeByteBlob): Update accordingly.
7929 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
7932 (EmitDynamicInitializers): Update in accordance with the new optimization.
7934 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
7935 same OpCode applies.
7937 * cs-parser.jay : Fix some glaring errors I introduced.
7939 2002-01-01 Ravi Pratap <ravi@ximian.com>
7941 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
7942 so that we can check for name clashes there too.
7944 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
7945 for interface indexers.
7947 * interfaces.cs (Define): Emit the default member attribute.
7949 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
7950 variable was being referred to while setting the value ;-)
7952 2002-01-01 Miguel de Icaza <miguel@ximian.com>
7954 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
7955 byte-by-byte information when we know the data is zero.
7957 Make the block always a multiple of 4, because
7958 DefineInitializedData has a bug.
7960 * assign.cs: Fix, we should assign from the temporary, not from
7963 * expression.cs (MakeByteBlob): Fix my incorrect code.
7965 2001-12-31 Miguel de Icaza <miguel@ximian.com>
7967 * typemanager.cs (EnumToUnderlying): This function is used to get
7968 the underlying type from an enumeration, because it does not
7971 * constant.cs: Use the I4_S form for values between -128 and 127.
7973 * statement.cs (Block.LookupLabel): Looks up a label.
7974 (Block): Drop support for labeled blocks.
7976 (LabeledStatement): New kind of statement that represents a label
7979 (Goto): Finally implement this bad boy.
7981 * cs-parser.jay: Update to reflect new mechanism to implement
7984 2001-12-30 Miguel de Icaza <miguel@ximian.com>
7986 * codegen.cs (EmitContext.This): a codegen property that keeps the
7987 a single instance of this instead of creating many different this
7990 * delegate.cs (Delegate.DoResolve): Update to use the property;
7992 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
7994 * expression.cs (BaseAccess.DoResolve): Ditto.
7996 2001-12-29 Ravi Pratap <ravi@ximian.com>
7998 * typemanager.cs (methodimpl_attr_type): Add to hold the type
7999 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8001 (InitCoreTypes): Update accordingly.
8003 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8004 so we can quickly store the state.
8006 (ApplyAttributes): Set the correct implementation flags
8007 for InternalCall methods.
8009 2001-12-29 Miguel de Icaza <miguel@ximian.com>
8011 * expression.cs (EmitCall): if a method is not virtual, then do
8012 not use callvirt on it.
8014 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8015 user defined stuff) requires the use of stobj, which takes an
8016 address on the stack instead of an array and an index. So emit
8017 the Ldelema operation for it.
8019 (EmitStoreOpcode): Use stobj for valuetypes.
8021 (UnaryMutator.EmitCode): Use the right 1 value depending on
8022 whether we are dealing with int64/uint64, float or doubles.
8024 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8025 constructors that I implemented last night.
8027 (Constructor.IsDefault): Fix to work properly for static
8030 * cs-parser.jay (CheckDef): report method signature errors.
8031 Update error number 103 to be 132.
8033 * decl.cs: New AdditionResult enumeration value: MethodExists.
8034 Although we do this check for methods later on in the semantic
8035 analysis, catching repeated default constructors is so easy that
8036 we catch these here.
8038 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8041 (ParameterReference.EmitAssign, Emit): handle
8044 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8045 (ArrayAccess.EmitStoreOpcode): ditto.
8047 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8049 * expression.cs (MakeByteBlob): Complete all the missing types
8050 (uint, short, ushort, byte, sbyte)
8052 * class.cs: Only init instance field initializers on instance
8055 Rename `constructors' to instance_constructors.
8057 (TypeContainer.AddConstructor): Only add constructors to the list
8058 if it is not static.
8060 Make sure that we handle default_static_constructor independently
8061 everywhere where we handle instance_constructors
8063 2001-12-28 Miguel de Icaza <miguel@ximian.com>
8065 * class.cs: Do not lookup or create a base initializer for a
8068 (ConstructorInitializer.Resolve): use the proper type to lookup
8071 * cs-parser.jay: Report error 1585 (modifiers between type and name).
8073 * enum.cs, interface.cs: Remove CloseType, this is taken care by
8076 * decl.cs: CloseType is now an virtual method, the default
8077 implementation just closes this type.
8079 2001-12-28 Ravi Pratap <ravi@ximian.com>
8081 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8082 to PreserveSig by default. Also emit HideBySig on such methods.
8084 Basically, set the defaults to standard values.
8086 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8087 argument, if candidate is better, it can't be worse than the best !
8089 (Invocation): Re-write bits to differentiate between methods being
8090 applicable in their expanded form and their normal form - for params
8093 Get rid of use_standard everywhere as only standard conversions are allowed
8094 in overload resolution.
8096 More spec conformance.
8098 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8100 * driver.cs: Add --timestamp, to see where the compiler spends
8103 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8104 `this' in static code.
8106 (SimpleName.DoResolve): Implement in terms of a helper function
8107 that allows static-references to be passed upstream to
8110 (Expression.ResolveWithSimpleName): Resolve specially simple
8111 names when called by MemberAccess to implement the special
8114 (Expression.ImplicitReferenceConversion): Handle conversions from
8115 Null to reference types before others, as Null's type is
8118 * expression.cs (Invocation.EmitCall): Handle the special case of
8119 calling methods declared on a reference type from a ValueType
8120 (Base classes System.Object and System.Enum)
8122 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8123 the left hand side is a TypeExpr, not on every enumeration.
8125 (Binary.Resolve): If types are reference types, then do a cast to
8126 object on operators != and == of both arguments.
8128 * typemanager.cs (FindMembers): Extract instance and static
8129 members if requested.
8131 * interface.cs (PopulateProperty): Use void_type instead of null
8132 as the return type for the setter method.
8134 (PopulateIndexer): ditto.
8136 2001-12-27 Ravi Pratap <ravi@ximian.com>
8138 * support.cs (ReflectionParameters): Fix minor bug where we
8139 were examining the wrong parameter for the ParamArray attribute.
8141 Cope with requests for the type of the parameter at position
8142 greater than the params parameter's. We now return the element
8143 type of the params array as that makes more sense.
8145 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8146 accordingly as we no longer have to extract the element type
8149 (Invocation.OverloadResolve): Update.
8151 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8153 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8154 against IEnumerator, test whether the return value is a descendant
8155 of the IEnumerator interface.
8157 * class.cs (Indexer.Define): Use an auxiliary method to implement
8158 the other bits of the method definition. Begin support for
8159 explicit interface implementation.
8161 (Property.DefineMethod): Use TypeManager.void_type instead of null
8162 for an empty return value.
8164 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8166 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8167 dealing with a FieldExpr which is composed of a FieldBuilder, in
8168 the code path we did extract the constant, but we should have
8169 obtained the underlying value to be able to cast it (otherwise we
8170 end up in an infinite loop, this is what Ravi was running into).
8172 (ArrayCreation.UpdateIndices): Arrays might be empty.
8174 (MemberAccess.ResolveMemberAccess): Add support for section
8175 14.5.4.1 that deals with the special case of E.I when E is a type
8176 and something else, that I can be a reference to a static member.
8178 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8179 handle a particular array type to create byte blobs, it is just
8180 something we dont generate byteblobs for.
8182 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8185 * location.cs (Push): remove the key from the hashtable that we
8186 are about to add. This happens for empty files.
8188 * driver.cs: Dispose files after we have parsed them.
8190 (tokenize): new function that only runs the tokenizer on its
8191 input, for speed testing.
8193 2001-12-26 Ravi Pratap <ravi@ximian.com>
8195 * class.cs (Event.Define): Define the private field only if there
8196 are no accessors defined.
8198 * expression.cs (ResolveMemberAccess): If there is no associated
8199 field with the event, that means we have an event defined with its
8200 own accessors and we should flag error cs0070 since transforming
8201 ourselves into a field is not valid in that case.
8203 * ecore.cs (SimpleName.DoResolve): Same as above.
8205 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8206 and charset to sane values.
8208 2001-12-25 Ravi Pratap <ravi@ximian.com>
8210 * assign.cs (DoResolve): Perform check on events only if they
8211 are being accessed outside the declaring type.
8213 * cs-parser.jay (event_declarations): Update rules to correctly
8214 set the type of the implicit parameter etc.
8216 (add_accessor, remove_accessor): Set current local parameters.
8218 * expression.cs (Binary): For delegate addition and subtraction,
8219 cast the return value from the method into the appropriate delegate
8222 2001-12-24 Ravi Pratap <ravi@ximian.com>
8224 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8225 of these as the workaround is unnecessary.
8227 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8228 delegate data - none of that is needed at all.
8230 Re-write bits to extract the instance expression and the delegate method
8233 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8236 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8237 of attaching attributes instead of duplicating code everywhere.
8239 * everywhere : Update code to do attribute emission using the above method.
8241 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8243 * expression.cs (IsParamsMethodApplicable): if there are not
8244 parameters, return immediately.
8246 * ecore.cs: The 0 literal can be implicity converted to an enum
8249 (SimpleName.DoResolve): First lookup the type, then lookup the
8252 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8253 want to get its address. If the InstanceExpression is not
8254 addressable, store the result in a temporary variable, then get
8257 * codegen.cs: Only display 219 errors on warning level or above.
8259 * expression.cs (ArrayAccess): Make it implement the
8260 IMemoryLocation interface.
8262 (Binary.DoResolve): handle the operator == (object a, object b)
8263 and operator != (object a, object b) without incurring into a
8264 BoxedCast (because 5 != o should never be performed).
8266 Handle binary enumerator operators.
8268 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8269 value type, otherwise use Ldelem_ref.
8271 Use precomputed names;
8273 (AddressOf): Implement address of
8275 * cs-parser.jay (labeled_statement): Fix recursive block
8276 addition by reworking the production.
8278 * expression.cs (New.DoEmit): New has a special case:
8280 If we are dealing with a ValueType, we have a few
8281 situations to deal with:
8283 * The target of New is a ValueType variable, that is
8284 easy, we just pass this as the variable reference
8286 * The target of New is being passed as an argument,
8287 to a boxing operation or a function that takes a
8290 In this case, we need to create a temporary variable
8291 that is the argument of New.
8294 2001-12-23 Ravi Pratap <ravi@ximian.com>
8296 * rootcontext.cs (LookupType): Check that current_type is not null before
8297 going about looking at nested types.
8299 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8300 not implement the IAssignMethod interface any more.
8302 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8303 where we tranform them into FieldExprs if they are being resolved from within
8306 * ecore.cs (SimpleName.DoResolve): Do the same here.
8308 * assign.cs (DoResolve, Emit): Clean up code considerably.
8310 * ../errors/bug10.cs : Add.
8312 * ../errors/cs0070.cs : Add.
8314 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8316 * assign.cs : Get rid of EventIsLocal everywhere.
8318 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8320 * ecore.cs (ConvertIntLiteral): finished the implementation.
8322 * statement.cs (SwitchLabel): Convert the value we are using as a
8323 key before looking up the table.
8325 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8327 * codegen.cs (EmitTopBlock): Require a Location argument now.
8329 * cs-parser.jay (constructor_declarator): We need to setup
8330 current_local_parameters before we parse the
8331 opt_constructor_initializer, to allow the variables to be bound
8332 to the constructor arguments.
8334 * rootcontext.cs (LookupType): First lookup nested classes in our
8335 class and our parents before we go looking outside our class.
8337 * expression.cs (ConstantFold): Extract/debox the values at the
8340 * rootcontext.cs (EmitCode): Resolve the constants first before we
8341 resolve the types. This is not really needed, but it helps debugging.
8343 * statement.cs: report location.
8345 * cs-parser.jay: pass location to throw statement.
8347 * driver.cs: Small bug fix.
8349 * report.cs: Updated format to be 4-zero filled digits.
8351 2001-12-22 Ravi Pratap <ravi@ximian.com>
8353 * expression.cs (CheckIndices): Fix minor bug where the wrong
8354 variable was being referred to ;-)
8356 (DoEmit): Do not call EmitStaticInitializers when the
8357 underlying type is System.Object.
8359 2001-12-21 Ravi Pratap <ravi@ximian.com>
8361 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8362 and do the usual workaround for SRE.
8364 * class.cs (MyEventBuilder.EventType): New member to get at the type
8365 of the event, quickly.
8367 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8369 * assign.cs (Assign.DoResolve): Handle the case when the target
8370 is an EventExpr and perform the necessary checks.
8372 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8375 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8377 (EventExpr): Set the type in the constructor itself since we
8378 are meant to be born fully resolved.
8380 (EventExpr.Define): Revert code I wrote earlier.
8382 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8383 instance expression is null. The instance expression is a This in that case
8384 or a null, depending on whether it is a static method or not.
8386 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8387 refers to more than one method.
8389 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8390 and accordingly flag errors.
8392 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8394 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8396 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8398 * location.cs (ToString): Provide useful rutine.
8400 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8402 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8403 objects, return the actual integral boxed.
8405 * statement.cs (SwitchLabel): define an ILLabel for each
8408 (Switch.CheckSwitch): If the value is a Literal, extract
8409 the underlying literal.
8411 Also in the unused hashtable we had, add the SwitchLabel so we can
8412 quickly look this value up.
8414 * constant.cs: Implement a bunch of new constants. Rewrite
8415 Literal based on this. Made changes everywhere to adapt to this.
8417 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8418 dereferencing array only once, and also copes with enumrations.
8420 bytes are two bytes wide, not one.
8422 (Cast): Perform constant conversions.
8424 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8425 wrappers to the literals here.
8427 * expression.cs (DoNumericPromotions): long literals can converted
8428 to ulong implicity (this is taken care of elsewhere, but I was
8431 * ecore.cs (Expression.Literalize): Make the return type Literal,
8432 to improve type checking.
8434 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8436 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8438 * literal.cs: Revert code from ravi that checked the bounds. The
8439 bounds are sane by the definition of the type itself.
8441 * typemanager.cs: Fix implementation of ImplementsInterface. We
8442 need to actually look up in our parent hierarchy for interfaces
8445 * const.cs: Use the underlying type for enumerations
8447 * delegate.cs: Compute the basename for the delegate creation,
8448 that should fix the delegate test case, and restore the correct
8449 Type Lookup semantics in rootcontext
8451 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8452 referencing a nested type with the Reflection API is using the "+"
8455 * cs-parser.jay: Do not require EOF token at the end.
8457 2001-12-20 Ravi Pratap <ravi@ximian.com>
8459 * rootcontext.cs (LookupType): Concatenate type names with
8460 a '.' instead of a '+' The test suite passes again.
8462 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8463 field of the enumeration.
8465 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8466 the case when the member is an EventExpr.
8468 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8469 static has an associated instance expression.
8471 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8473 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8475 * class.cs (Event.Define): Register event and perform appropriate checks
8478 We define the Add and Remove methods even if the use provides none because
8479 in that case, we provide default implementations ourselves.
8481 Define a private field of the type of the event. This is done by the CSC compiler
8482 and we should be doing it too ;-)
8484 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8485 More methods we use in code we generate.
8487 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8490 (InitCoreTypes): Update accordingly for the above.
8492 * class.cs (Event.Emit): Generate code for default accessors that we provide
8494 (EmitDefaultMethod): Do the job in the above.
8496 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8499 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8501 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8502 builders even if we were missing one.
8504 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8505 pass the Basename as our class name instead of the Name. The
8506 basename will be correctly composed for us.
8508 * parameter.cs (Paramters): Now takes a Location argument.
8510 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8511 make all the code call directly LookupType in RootContext and take
8512 this chance to pass the Location information everywhere.
8514 * Everywhere: pass Location information.
8516 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8518 * class.cs (Constructor.Define): Updated way of detecting the
8519 length of the parameters.
8521 (TypeContainer.DefineType): Use basename as the type name for
8524 (TypeContainer.Define): Do not recursively define types here, as
8525 definition is taken care in order by the RootContext.
8527 * tree.cs: Keep track of namespaces in a per-file basis.
8529 * parameter.cs (Parameter.ComputeSignature): Update to use
8532 (Parameters.GetSignature): ditto.
8534 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8535 instead of a TypeContainer.
8537 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8538 resolve names. Because we need to be resolve in our context, not
8541 * driver.cs: Implement response files.
8543 * class.cs (TypeContainer.DefineType): If we are defined, do not
8546 (Event.Emit): Emit the code for add/remove handlers.
8547 (Event.Define): Save the MethodBuilders for add/remove.
8549 * typemanager.cs: Use pair here too.
8551 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8552 DictionaryEntry requires the first argument to be non-null.
8554 (enum_declaration): Compute full name for registering the
8557 (delegate_declaration): Instead of using
8558 formal_parameter_list, use opt_formal_parameter_list as the list
8561 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8562 (EventParsing): New property that controls whether `add' and
8563 `remove' are returned as tokens or identifiers (for events);
8565 2001-12-19 Ravi Pratap <ravi@ximian.com>
8567 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8568 use MyEventBuilder only and let it wrap the real builder for us.
8570 (MyEventBuilder): Revamp constructor etc.
8572 Implement all operations that we perform on EventBuilder in precisely the same
8575 (FindMembers): Update to use the EventBuilder member.
8577 (Event.Emit): Update accordingly.
8579 2001-12-18 Ravi Pratap <ravi@ximian.com>
8581 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8582 by calling the appropriate methods.
8584 (GetCustomAttributes): Make stubs as they cannot possibly do anything
8587 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8589 2001-12-17 Ravi Pratap <ravi@ximian.com>
8591 * delegate.cs (Delegate.Populate): Check that the return type
8592 and various parameters types are indeed accessible.
8594 * class.cs (Constructor.Define): Same here.
8596 (Field.Define): Ditto.
8598 (Event.Define): Ditto.
8600 (Operator.Define): Check that the underlying Method defined itself
8601 correctly - so it's MethodBuilder should not be null.
8603 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8604 expression happens to be null.
8606 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8607 members but as of now we don't seem to be able to do anything really useful with it.
8609 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8610 not the EventBuilder.
8612 2001-12-18 Miguel de Icaza <miguel@ximian.com>
8614 * cs-tokenizer.cs: Add support for defines.
8615 Add support for #if, #elif, #else, #endif
8617 (eval_var): evaluates a variable.
8618 (eval): stubbed for evaluating functions.
8620 * cs-parser.jay: Pass the defines information
8622 * driver.cs: Add --define command line option.
8624 * decl.cs: Move MemberCore here.
8626 Make it the base class for DeclSpace. This allows us to catch and
8627 report 108 and 109 for everything now.
8629 * class.cs (TypeContainer.Define): Extract all the members
8630 before populating and emit the warning 108 (new keyword required
8631 to override) instead of having each member implement this.
8633 (MemberCore.Define): New abstract method, we will be using this in
8634 the warning reporting engine in Populate.
8636 (Operator.Define): Adjust to new MemberCore protocol.
8638 * const.cs (Const): This does not derive from Expression, it is a
8639 temporary object we use to create fields, it is a MemberCore.
8641 * class.cs (Method.Define): Allow the entry point to be in a
8644 * driver.cs: Rewrite the argument handler to clean it up a bit.
8646 * rootcontext.cs: Made it just an auxiliary namespace feature by
8647 making everything static.
8649 * driver.cs: Adapt code to use RootContext type name instead of
8652 * delegate.cs: Remove RootContext argument.
8654 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8657 * class.cs (Event.Define): The lookup can fail.
8659 * cs-tokenizer.cs: Begin implementation of pre-procesor.
8661 * expression.cs: Resolve the this instance before invoking the code.
8663 2001-12-17 Miguel de Icaza <miguel@ximian.com>
8665 * cs-parser.jay: Add a production in element_access that allows
8666 the thing to become a "type" reference. This way we can parse
8667 things like "(string [])" as a type.
8669 Note that this still does not handle the more complex rules of
8673 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
8675 * ecore.cs: (CopyNewMethods): new utility function used to
8676 assemble the list of methods from running FindMembers.
8678 (MemberLookup): Rework FindMembers so that
8680 2001-12-16 Miguel de Icaza <miguel@ximian.com>
8682 * class.cs (TypeContainer): Remove Delegates who fail to be
8685 * delegate.cs (Populate): Verify that we dont get null return
8686 values. TODO: Check for AsAccessible.
8688 * cs-parser.jay: Use basename to emit error 574 (destructor should
8689 have the same name as container class), not the full name.
8691 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8692 possible representation.
8694 Also implements integer type suffixes U and L.
8696 2001-12-15 Miguel de Icaza <miguel@ximian.com>
8698 * expression.cs (ArrayCreation.DoResolve): We need to do the
8699 argument resolution *always*.
8701 * decl.cs: Make this hold the namespace. Hold the root context as
8703 (LookupType): Move here.
8705 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8707 * location.cs (Row, Name): Fixed the code, it was always returning
8708 references to the first file.
8710 * interface.cs: Register properties defined through interfaces.
8712 * driver.cs: Add support for globbing on the command line
8714 * class.cs (Field): Make it derive from MemberCore as well.
8717 2001-12-15 Ravi Pratap <ravi@ximian.com>
8719 * class.cs (Event::Define): Check that the type of the event is a delegate
8720 type else flag error #66.
8722 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8725 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8726 values of EntryPoint, CharSet etc etc.
8728 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8730 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8731 be null and we should ignore this. I am not sure if this is really clean. Apparently,
8732 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8733 which needs this to do its work.
8735 * ../errors/cs0066.cs : Add.
8737 2001-12-14 Miguel de Icaza <miguel@ximian.com>
8739 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8742 * class.cs: (MethodSignature.MethodSignature): Removed hack that
8743 clears out the parameters field.
8744 (MemberSignatureCompare): Cleanup
8746 (MemberCore): New base class used to share code between MethodCore
8749 (RegisterRequiredImplementations) BindingFlags.Public requires
8750 either BindingFlags.Instace or Static. Use instance here.
8752 (Property): Refactored code to cope better with the full spec.
8754 * parameter.cs (GetParameterInfo): Return an empty array instead
8757 * class.cs (Property): Abstract or extern properties have no bodies.
8759 * parameter.cs (GetParameterInfo): return a zero-sized array.
8761 * class.cs (TypeContainer.MethodModifiersValid): Move all the
8762 method modifier validation to the typecontainer so we can reuse
8765 (MethodCore.ParameterTypes): return an empty sized array of types.
8767 (Property.Define): Test property modifier validity.
8769 Add tests for sealed/override too.
8771 (Method.Emit): abstract or extern methods have no bodies.
8773 2001-12-14 Ravi Pratap <ravi@ximian.com>
8775 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8778 (Method::Define, ::Emit): Modify accordingly.
8780 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8782 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8784 * makefile: Pass in /unsafe.
8786 2001-12-13 Miguel de Icaza <miguel@ximian.com>
8788 * class.cs (MakeKey): Kill routine.
8790 * class.cs (TypeContainer.Define): Correctly define explicit
8791 method implementations (they require the full interface name plus
8794 * typemanager.cs: Deply the PtrHashtable here and stop using the
8795 lame keys. Things work so much better.
8797 This of course broke everyone who depended on `RegisterMethod' to
8798 do the `test for existance' test. This has to be done elsewhere.
8800 * support.cs (PtrHashtable): A hashtable that avoid comparing with
8801 the object stupid Equals method (because, that like fails all over
8802 the place). We still do not use it.
8804 * class.cs (TypeContainer.SetRequiredInterface,
8805 TypeContainer.RequireMethods): Killed these two routines and moved
8806 all the functionality to RegisterRequiredImplementations.
8808 (TypeContainer.RegisterRequiredImplementations): This routine now
8809 registers all the implementations required in an array for the
8810 interfaces and abstract methods. We use an array of structures
8811 which can be computed ahead of time to reduce memory usage and we
8812 also assume that lookups are cheap as most classes will not
8813 implement too many interfaces.
8815 We also avoid creating too many MethodSignatures.
8817 (TypeContainer.IsInterfaceMethod): Update and optionally does not
8818 clear the "pending" bit if we find that there are problems with
8821 (TypeContainer.VerifyPendingMethods): Update to report errors of
8822 methods that look like implementations but are not.
8824 (TypeContainer.Define): Add support for explicit interface method
8827 2001-12-12 Miguel de Icaza <miguel@ximian.com>
8829 * typemanager.cs: Keep track of the parameters here instead of
8830 being a feature of the TypeContainer.
8832 * class.cs: Drop the registration of parameters here, as
8833 InterfaceMethods are also interface declarations.
8835 * delegate.cs: Register methods with the TypeManager not only with
8836 the TypeContainer. This code was buggy.
8838 * interface.cs: Full registation here.
8840 2001-12-11 Miguel de Icaza <miguel@ximian.com>
8842 * expression.cs: Remove reducer for binary expressions, it can not
8845 * const.cs: Put here the code that used to go into constant.cs
8847 * constant.cs: Put here the code for constants, this is a new base
8850 * literal.cs: Make Literal derive from Constant.
8852 2001-12-09 Miguel de Icaza <miguel@ximian.com>
8854 * statement.cs (Return.Emit): Report error 157 if the user
8855 attempts to return from a finally block.
8857 (Return.Emit): Instead of emitting a return, jump to the end of
8860 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
8861 LocalBuilder to store the result of the function. ReturnLabel is
8862 the target where we jump.
8865 2001-12-09 Radek Doulik <rodo@ximian.com>
8867 * cs-parser.jay: remember alias in current namespace
8869 * ecore.cs (SimpleName::DoResolve): use aliases for types or
8872 * class.cs (LookupAlias): lookup alias in my_namespace
8874 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
8876 (LookupAlias): lookup alias in this and if needed in parent
8879 2001-12-08 Miguel de Icaza <miguel@ximian.com>
8883 * rootcontext.cs: (ModuleBuilder) Made static, first step into
8884 making things static. I need this to avoid passing the
8885 TypeContainer when calling ParameterType.
8887 * support.cs (InternalParameters.ParameterType): Remove ugly hack
8888 that did string manipulation to compute the type and then call
8889 GetType. Use Parameter.ParameterType instead.
8891 * cs-tokenizer.cs: Consume the suffix for floating values.
8893 * expression.cs (ParameterReference): figure out whether this is a
8894 reference parameter or not. Kill an extra variable by computing
8895 the arg_idx during emission.
8897 * parameter.cs (Parameters.GetParameterInfo): New overloaded
8898 function that returns whether a parameter is an out/ref value or not.
8900 (Parameter.ParameterType): The type of the parameter (base,
8901 without ref/out applied).
8903 (Parameter.Resolve): Perform resolution here.
8904 (Parameter.ExternalType): The full type (with ref/out applied).
8906 * statement.cs (Using.Emit, Using.EmitExpression): Implement
8907 support for expressions on the using statement.
8909 2001-12-07 Miguel de Icaza <miguel@ximian.com>
8911 * statement.cs (Using.EmitLocalVariableDecls): Split the
8912 localvariable handling of the using statement.
8914 (Block.EmitMeta): Keep track of variable count across blocks. We
8915 were reusing slots on separate branches of blocks.
8917 (Try.Emit): Emit the general code block, we were not emitting it.
8919 Check the type of the declaration to be an IDisposable or
8920 something that can be implicity converted to it.
8922 Emit conversions if required.
8924 * ecore.cs (EmptyExpression): New utility class.
8925 (Expression.ImplicitConversionExists): New utility function.
8927 2001-12-06 Miguel de Icaza <miguel@ximian.com>
8929 * statement.cs (Using): Implement.
8931 * expression.cs (LocalVariableReference): Support read only variables.
8933 * statement.cs: Remove the explicit emit for the Leave opcode.
8934 (VariableInfo): Add a readonly field.
8936 2001-12-05 Miguel de Icaza <miguel@ximian.com>
8938 * ecore.cs (ConvCast): new class used to encapsulate the various
8939 explicit integer conversions that works in both checked and
8942 (Expression.ConvertNumericExplicit): Use new ConvCast class to
8943 properly generate the overflow opcodes.
8945 2001-12-04 Miguel de Icaza <miguel@ximian.com>
8947 * statement.cs: The correct type for the EmptyExpression is the
8948 element_type, not the variable type. Ravi pointed this out.
8950 2001-12-04 Ravi Pratap <ravi@ximian.com>
8952 * class.cs (Method::Define): Handle PInvoke methods specially
8953 by using DefinePInvokeMethod instead of the usual one.
8955 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
8956 above to do the task of extracting information and defining the method.
8958 2001-12-04 Ravi Pratap <ravi@ximian.com>
8960 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
8961 of the condition for string type.
8963 (Emit): Move that here.
8965 (ArrayCreation::CheckIndices): Keep string literals in their expression
8968 (EmitDynamicInitializers): Handle strings appropriately.
8970 2001-12-04 Miguel de Icaza <miguel@ximian.com>
8972 * codegen.cs (EmitContext): Replace multiple variables with a
8973 single pointer to the current Switch statement.
8975 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
8978 2001-12-03 Miguel de Icaza <miguel@ximian.com>
8982 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
8985 (Foreach.Emit): Foreach on arrays was not setting
8986 up the loop variables (for break/continue).
8988 (GotoCase): Semi-implented.
8990 2001-12-03 Ravi Pratap <ravi@ximian.com>
8992 * attribute.cs (CheckAttribute): Handle system attributes by using
8993 Attribute.GetAttributes to examine information we need.
8995 (GetValidPlaces): Same here.
8997 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
8999 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9001 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9003 (Method::Define): Set appropriate flags if we have a DllImport attribute.
9005 (Method::Emit): Handle the case when we are a PInvoke method.
9007 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9009 * expression.cs: Use ResolveWithSimpleName on compound names.
9011 2001-12-02 Ravi Pratap <ravi@ximian.com>
9013 * constant.cs (EmitConstant): Make sure we resolve the associated expression
9014 before trying to reduce it.
9016 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9018 * constant.cs (LookupConstantValue): Implement.
9020 (EmitConstant): Use the above in emitting the constant.
9022 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9023 that are user-defined by doing a LookupConstantValue on them.
9025 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9028 2001-11-29 Miguel de Icaza <miguel@ximian.com>
9030 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9032 (BaseAccess.DoResolve): Implement.
9034 (MemberAccess.DoResolve): Split this routine into a
9035 ResolveMemberAccess routine that can be used independently
9037 2001-11-28 Miguel de Icaza <miguel@ximian.com>
9039 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9040 As that share bits of the implementation. Is returns a boolean,
9041 while As returns the Type that is being probed.
9043 2001-12-01 Ravi Pratap <ravi@ximian.com>
9045 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9046 instead of a Literal - much easier.
9048 (EnumInTransit): Remove - utterly useless :-)
9050 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9052 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9054 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9055 chain when we have no associated expression.
9057 2001-11-30 Ravi Pratap <ravi@ximian.com>
9059 * constant.cs (Define): Use Location while reporting the errror.
9061 Also emit a warning when 'new' is used and there is no inherited
9064 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
9067 (LookupEnumValue): Implement to lookup an enum member's value and define it
9070 (Populate): Re-write accordingly to use the above routine.
9072 2001-11-27 Miguel de Icaza <miguel@ximian.com>
9074 * expression.cs (This): Fix prototype for DoResolveLValue to
9075 override the base class DoResolveLValue.
9077 * cs-parser.cs: Report errors cs574 and cs575 (destructor
9080 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9081 (we need to load the address of the field here). This fixes
9084 (FieldExpr.DoResolveLValue): Call the DoResolve
9085 function to initialize the Instance expression.
9087 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9088 correctly the GetEnumerator operation on a value type.
9090 * cs-parser.jay: Add more simple parsing error catches.
9092 * statement.cs (Switch): Add support for string switches.
9093 Handle null specially.
9095 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
9097 2001-11-28 Ravi Pratap <ravi@ximian.com>
9099 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9101 (declare_local_constant): New helper function.
9103 * statement.cs (AddConstant): Keep a separate record of constants
9105 (IsConstant): Implement to determine if a variable is a constant.
9107 (GetConstantExpression): Implement.
9109 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9111 * statement.cs (IsVariableDefined): Re-write.
9113 2001-11-27 Ravi Pratap <ravi@ximian.com>
9115 * class.cs (TypeContainer::FindMembers): Look for constants
9116 in the case when we are looking for MemberTypes.Field
9118 * expression.cs (MemberAccess::DoResolve): Check that in the
9119 case we are a FieldExpr and a Literal, we are not being accessed
9120 by an instance reference.
9122 * cs-parser.jay (local_constant_declaration): Implement.
9124 (declaration_statement): Implement for constant declarations.
9126 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9128 * statement.cs (Switch): Catch double defaults.
9130 (Switch): More work on the switch() statement
9131 implementation. It works for integral values now, need to finish
9135 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9137 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9138 integer literals into other integer literals. To be used by
9141 2001-11-24 Ravi Pratap <ravi@ximian.com>
9143 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9146 (EmitDynamicInitializers): Cope with the above since we extract data
9147 directly from ArrayData now.
9149 (ExpectInitializers): Keep track of whether initializers are mandatory
9152 (Bounds): Make it a hashtable to prevent the same dimension being
9153 recorded for every element in that dimension.
9155 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9158 Also fix bug which was causing the indices to be emitted in the reverse
9161 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9163 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9164 unfinished. They do not work, because the underlying code is
9167 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9169 * cs-parser.jay: Remove bogus fixme.
9171 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9172 on Switch statement.
9174 2001-11-23 Ravi Pratap <ravi@ximian.com>
9176 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9179 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9180 parameter. Apparently, any expression is allowed.
9182 (ValidateInitializers): Update accordingly.
9184 (CheckIndices): Fix some tricky bugs thanks to recursion.
9186 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9187 I was being completely brain-dead.
9189 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9190 and re-write acordingly.
9192 (DelegateInvocation): Re-write accordingly.
9194 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9196 (MakeByteBlob): Handle types more correctly.
9198 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9199 initialization from expressions but it is incomplete because I am a complete
9202 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9204 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9205 on If. Basically, we have to return `true' (ie, we do return to
9206 our caller) only if both branches of the if return.
9208 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9209 short-circuit operators, handle them as short circuit operators.
9211 (Cast.DoResolve): Resolve type.
9212 (Cast.Cast): Take an expression as the target type.
9214 * cs-parser.jay (cast_expression): Remove old hack that only
9215 allowed a limited set of types to be handled. Now we take a
9216 unary_expression and we resolve to a type during semantic
9219 Use the grammar productions from Rhys to handle casts (this is
9220 not complete like Rhys syntax yet, we fail to handle that corner
9221 case that C# has regarding (-x), but we will get there.
9223 2001-11-22 Ravi Pratap <ravi@ximian.com>
9225 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9226 field which is an array type.
9228 * cs-parser.jay (declare_local_variables): Support array initialization too.
9230 * typemanager.cs (MakeKey): Implement.
9232 (everywhere): Use the above appropriately.
9234 * cs-parser.jay (for_statement): Update for array initialization while
9235 declaring variables.
9237 * ecore.cs : The error message was correct, it's the variable's names that
9238 were misleading ;-) Make the code more readable.
9240 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9241 the correct type etc.
9243 (ConvertExplicit): Handle Enum types by examining the underlying type.
9245 2001-11-21 Ravi Pratap <ravi@ximian.com>
9247 * parameter.cs (GetCallingConvention): Always return
9248 CallingConventions.Standard for now.
9250 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9252 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9253 and `r' after calling DoNumericPromotions.
9255 * ecore.cs: Fix error message (the types were in the wrong order).
9257 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9258 BindingFlags.Instance as well
9260 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9261 implicit int literal conversion in an empty cast so that we
9262 propagate the right type upstream.
9264 (UnboxCast): new class used to unbox value types.
9265 (Expression.ConvertExplicit): Add explicit type conversions done
9268 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9269 the target type before applying the implicit LongLiterals to ULong
9272 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9274 * cs-parser.jay (for_statement): Reworked the way For works: now
9275 we declare manually any variables that are introduced in
9276 for_initializer to solve the problem of having out-of-band code
9277 emition (that is what got for broken).
9279 (declaration_statement): Perform the actual variable declaration
9280 that used to be done in local_variable_declaration here.
9282 (local_variable_declaration): Do not declare anything, just pass
9283 the information on a DictionaryEntry
9285 2001-11-20 Ravi Pratap <ravi@ximian.com>
9287 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9288 re-write of the logic to now make it recursive.
9290 (UpdateIndices): Re-write accordingly.
9292 Store element data in a separate ArrayData list in the above methods.
9294 (MakeByteBlob): Implement to dump the array data into a byte array.
9296 2001-11-19 Ravi Pratap <ravi@ximian.com>
9298 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9301 * constant.cs (Define): Implement.
9303 (EmitConstant): Re-write fully.
9305 Pass in location info.
9307 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9310 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9311 DictionaryEntry since we need location info too.
9313 (constant_declaration): Update accordingly.
9315 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9316 code into another method : UpdateIndices.
9318 2001-11-18 Ravi Pratap <ravi@ximian.com>
9320 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9321 some type checking etc.
9323 2001-11-17 Ravi Pratap <ravi@ximian.com>
9325 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9326 bits to provide dimension info if the user skips doing that.
9328 Update second constructor to store the rank correctly.
9330 2001-11-16 Ravi Pratap <ravi@ximian.com>
9332 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9333 and try to implement.
9335 * ../errors/cs0150.cs : Add.
9337 * ../errors/cs0178.cs : Add.
9339 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9341 * statement.cs: Implement foreach on multi-dimensional arrays.
9343 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9344 name of the params argument.
9346 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9347 initializing the array.
9349 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9350 we can use this elsewhere.
9352 * statement.cs: Finish implementation of foreach for single
9355 * cs-parser.jay: Use an out-of-band stack to pass information
9356 around, I wonder why I need this.
9358 foreach_block: Make the new foreach_block the current_block.
9360 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9361 function used to return a static Parameters structure. Used for
9362 empty parameters, as those are created very frequently.
9364 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9366 2001-11-15 Ravi Pratap <ravi@ximian.com>
9368 * interface.cs : Default modifier is private, not public. The
9369 make verify test passes again.
9371 2001-11-15 Ravi Pratap <ravi@ximian.com>
9373 * support.cs (ReflectionParameters): Fix logic to determine
9374 whether the last parameter is a params one. Test 9 passes again.
9376 * delegate.cs (Populate): Register the builders we define with
9377 RegisterParameterForBuilder. Test 19 passes again.
9379 * cs-parser.jay (property_declaration): Reference $6 instead
9380 of $$ to get at the location.
9382 (indexer_declaration): Similar stuff.
9386 * class.cs (Property): Register parameters for the Get and Set methods
9387 if they exist. Test 23 passes again.
9389 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9390 call to EmitArguments as we are sure there aren't any params arguments.
9391 Test 32 passes again.
9393 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9394 IndexOutOfRangeException.
9396 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9397 Test 33 now passes again.
9399 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9401 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9402 broke a bunch of things. Will have to come up with a better way
9403 of tracking locations.
9405 * statement.cs: Implemented foreach for single dimension arrays.
9407 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9409 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9410 an error. This removes the lookup from the critical path.
9412 * cs-parser.jay: Removed use of temporary_loc, which is completely
9415 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9417 * support.cs (ReflectionParameters.ParameterModifier): Report
9418 whether the argument is a PARAMS argument or not.
9420 * class.cs: Set the attribute `ParamArrayAttribute' on the
9423 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9424 and cons_param_array_attribute (ConstructorInfo for
9425 ParamArrayAttribute).,
9427 * codegen.cs: Emit the return using the `Return' statement, that
9428 way we can report the error correctly for missing return values.
9430 * class.cs (Method.Emit): Clean up.
9432 * expression.cs (Argument.Resolve): Take another argument: the
9433 location where this argument is used. Notice that this is not
9434 part of the "Argument" class as to reduce the size of the
9435 structure (we know the approximate location anyways).
9437 Test if the argument is a variable-reference, if not, then
9438 complain with a 206.
9440 (Argument.Emit): Emit addresses of variables.
9442 (Argument.FullDesc): Simplify.
9444 (Invocation.DoResolve): Update for Argument.Resolve.
9446 (ElementAccess.DoResolve): ditto.
9448 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9449 method should be virtual, as this method is always virtual.
9451 (NewDelegate.DoResolve): Update for Argument.Resolve.
9453 * class.cs (ConstructorInitializer.DoResolve): ditto.
9455 * attribute.cs (Attribute.Resolve): ditto.
9457 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9459 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9461 * expression.cs (ParameterReference): Drop IStackStorage and implement
9462 IAssignMethod instead.
9464 (LocalVariableReference): ditto.
9466 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9467 IAssignMethod instead.
9469 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9471 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9472 enumerations that are used in heavily used structures derive from
9473 byte in a laughable and pathetic attempt to reduce memory usage.
9474 This is the kind of pre-optimzations that you should not do at
9475 home without adult supervision.
9477 * expression.cs (UnaryMutator): New class, used to handle ++ and
9478 -- separatedly from the other unary operators. Cleans up the
9479 code, and kills the ExpressionStatement dependency in Unary.
9481 (Unary): Removed `method' and `Arguments' from this class, making
9482 it smaller, and moving it all to SimpleCall, so I can reuse this
9483 code in other locations and avoid creating a lot of transient data
9484 strucutres when not required.
9486 * cs-parser.jay: Adjust for new changes.
9488 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9490 * enum.cs (Enum.Populate): If there is a failure during
9493 * cs-parser.jay (opt_enum_base): we used to catch type errors
9494 here, but this is really incorrect. The type error should be
9495 catched during semantic analysis.
9497 2001-12-11 Ravi Pratap <ravi@ximian.com>
9499 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9500 current_local_parameters as expected since I, in my stupidity, had forgotten
9503 * attribute.cs (GetValidPlaces): Fix stupid bug.
9505 * class.cs (Method::Emit): Perform check on applicability of attributes.
9507 (Constructor::Emit): Ditto.
9509 (Field::Emit): Ditto.
9511 (Field.Location): Store location information.
9513 (Property, Event, Indexer, Operator): Ditto.
9515 * cs-parser.jay (field_declaration): Pass in location for each field.
9517 * ../errors/cs0592.cs : Add.
9519 2001-11-12 Ravi Pratap <ravi@ximian.com>
9521 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9523 (InitCoreTypes): Update accordingly.
9525 (RegisterAttrType, LookupAttr): Implement.
9527 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9528 info about the same.
9530 (Resolve): Update to populate the above as necessary.
9534 (GetValidPlaces): Helper to the above.
9536 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9538 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9540 2001-11-12 Ravi Pratap <ravi@ximian.com>
9542 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9544 * ../errors/cs0617.cs : Add.
9546 2001-11-11 Ravi Pratap <ravi@ximian.com>
9548 * enum.cs (Emit): Rename to Populate to be more consistent with what
9549 we expect it to do and when exactly it is called.
9551 * class.cs, rootcontext.cs : Update accordingly.
9553 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9554 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9556 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9558 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9559 of a fieldinfo using the above, when dealing with a FieldBuilder.
9561 2001-11-10 Ravi Pratap <ravi@ximian.com>
9563 * ../errors/cs0031.cs : Add.
9565 * ../errors/cs1008.cs : Add.
9567 * ../errrors/cs0543.cs : Add.
9569 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9572 (FindMembers): Implement.
9574 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9575 enums and delegates too.
9577 (enum_types): Rename to builder_to_enum.
9579 (delegate_types): Rename to builder_to_delegate.
9581 * delegate.cs (FindMembers): Implement.
9583 2001-11-09 Ravi Pratap <ravi@ximian.com>
9585 * typemanager.cs (IsEnumType): Implement.
9587 * enum.cs (Emit): Re-write parts to account for the underlying type
9588 better and perform checking etc.
9590 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9591 of the underlying type.
9593 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9596 * enum.cs (error31): Helper to report error #31.
9598 * cs-parser.jay (enum_declaration): Store location of each member too.
9600 * enum.cs (member_to_location): New hashtable.
9602 (AddEnumMember): Update location hashtable.
9604 (Emit): Use the location of each member while reporting errors.
9606 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9608 * cs-parser.jay: A for_initializer if is a
9609 local_variable_declaration really ammount to have an implicit
9610 block with the variable declaration and no initializer for for.
9612 * statement.cs (For.Emit): Cope with null initializers.
9614 This fixes the infinite loop on for initializers.
9616 2001-11-08 Miguel de Icaza <miguel@ximian.com>
9618 * enum.cs: More cleanup.
9620 * ecore.cs: Remove dead code.
9622 * class.cs (Property.Emit): More simplification.
9623 (Event.Emit): ditto.
9625 Reworked to have less levels of indentation.
9627 2001-11-08 Ravi Pratap <ravi@ximian.com>
9629 * class.cs (Property): Emit attributes.
9639 * enum.cs (Emit): Ditto.
9641 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9644 * class.cs (Field, Event, etc.): Move attribute generation into the
9645 Emit method everywhere.
9647 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9648 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9649 as we had no way of defining nested enums !
9651 * rootcontext.cs : Adjust code accordingly.
9653 * typemanager.cs (AddEnumType): To keep track of enum types separately.
9655 2001-11-07 Ravi Pratap <ravi@ximian.com>
9657 * expression.cs (EvalConstantExpression): Move into ecore.cs
9659 * enum.cs (Enum): Rename some members and make them public and readonly
9660 according to our convention.
9662 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9665 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9667 (Enum::Emit): Write a simple version for now which doesn't try to compute
9668 expressions. I shall modify this to be more robust in just a while.
9670 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9672 (TypeContainer::CloseType): Create the Enum types too.
9674 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9676 * expression.cs (EvalConstantExpression): Get rid of completely.
9678 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9679 user-defined values and other cases.
9681 (IsValidEnumLiteral): Helper function.
9683 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
9684 out there in the case we had a literal FieldExpr.
9686 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9688 (Literalize): Revamp a bit to take two arguments.
9690 (EnumLiteral): New class which derives from Literal to wrap enum literals.
9692 2001-11-06 Ravi Pratap <ravi@ximian.com>
9694 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9696 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9698 (Resolve): Use the above to ensure we have proper initializers.
9700 2001-11-05 Ravi Pratap <ravi@ximian.com>
9702 * expression.cs (Expression::EvalConstantExpression): New method to
9703 evaluate constant expressions.
9705 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9707 2001-11-07 Miguel de Icaza <miguel@ximian.com>
9709 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9712 (Binary.ResolveOperator): Handle operator != (object a, object b)
9713 and operator == (object a, object b);
9715 (Binary.DoNumericPromotions): Indicate whether the numeric
9716 promotion was possible.
9718 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9721 Made the ArrayAccess implement interface IAssignMethod instead of
9722 IStackStore as the order in which arguments are passed reflects
9725 * assign.cs: Instead of using expr.ExprClass to select the way of
9726 assinging, probe for the IStackStore/IAssignMethod interfaces.
9728 * typemanager.cs: Load InitializeArray definition.
9730 * rootcontext.cs (RootContext.MakeStaticData): Used to define
9731 static data that can be used to initialize arrays.
9733 2001-11-05 Miguel de Icaza <miguel@ximian.com>
9735 * expression.cs: Handle operator== and operator!= for booleans.
9737 (Conditioal.Reduce): Implement reducer for the ?: operator.
9739 (Conditional.Resolve): Implement dead code elimination.
9741 (Binary.Resolve): Catch string literals and return a new
9742 concatenated string.
9744 (Unary.Reduce): Implement reduction of unary expressions.
9746 * ecore.cs: Split out the expression core handling here.
9748 (Expression.Reduce): New method used to perform constant folding
9749 and CSE. This is needed to support constant-expressions.
9751 * statement.cs (Statement.EmitBoolExpression): Pass true and false
9752 targets, and optimize for !x.
9754 2001-11-04 Ravi Pratap <ravi@ximian.com>
9756 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9757 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9758 set custom atttributes.
9760 * literal.cs (Literal::GetValue): New abstract method to return the actual
9761 value of the literal, cast as an object.
9763 (*Literal): Implement GetValue method.
9765 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9766 expressions to the arraylist but objects of type Argument.
9768 * class.cs (TypeContainer::Emit): Emit our attributes too.
9770 (Method::Emit, Constructor::Emit): Ditto.
9772 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9773 to be ignoring earlier.
9775 2001-11-03 Ravi Pratap <ravi@ximian.com>
9777 * attribute.cs (AttributeSection::Define): Implement to do the business
9778 of constructing a CustomAttributeBuilder.
9780 (Attribute): New trivial class. Increases readability of code.
9782 * cs-parser.jay : Update accordingly.
9784 (positional_argument_list, named_argument_list, named_argument): New rules
9786 (attribute_arguments): Use the above so that we are more correct.
9788 2001-11-02 Ravi Pratap <ravi@ximian.com>
9790 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9791 to perform all checks for a method with a params parameter.
9793 (Invocation::OverloadResolve): Update to use the above method and therefore
9794 cope correctly with params method invocations.
9796 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
9799 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9800 constructors in our parent too because we can't afford to miss out on
9803 * attribute.cs (AttributeSection): New name for the class Attribute
9805 Other trivial changes to improve readability.
9807 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
9808 use the new class names.
9810 2001-11-01 Ravi Pratap <ravi@ximian.com>
9812 * class.cs (Method::Define): Complete definition for params types too
9814 (Indexer::Define): Ditto.
9816 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
9817 Cope everywhere with a request for info about the array parameter.
9819 2001-11-01 Ravi Pratap <ravi@ximian.com>
9821 * tree.cs (RecordNamespace): Fix up to check for the correct key.
9823 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
9824 local_variable_type to extract the string corresponding to the type.
9826 (local_variable_type): Fixup the action to use the new helper method.
9828 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
9831 * expression.cs : Clean out code which uses the above.
9833 2001-10-31 Ravi Pratap <ravi@ximian.com>
9835 * typemanager.cs (RegisterMethod): Check if we already have an existing key
9836 and bale out if necessary by returning a false.
9838 (RegisterProperty): Ditto.
9840 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
9841 and print out appropriate error messages.
9843 * interface.cs (everywhere): Ditto.
9845 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
9846 location to constructor.
9848 * class.cs (Property, Event, Indexer): Update accordingly.
9850 * ../errors/cs111.cs : Added.
9852 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
9853 of a method, as laid down by the spec.
9855 (Invocation::OverloadResolve): Use the above method.
9857 2001-10-31 Ravi Pratap <ravi@ximian.com>
9859 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
9860 now take a TypeContainer and a Parameters object.
9862 (ParameterData): Modify return type of ParameterModifier method to be
9863 Parameter.Modifier and not a string.
9865 (ReflectionParameters, InternalParameters): Update accordingly.
9867 * expression.cs (Argument::GetParameterModifier): Same here.
9869 * support.cs (InternalParameters::ParameterType): Find a better way of determining
9870 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
9871 symbol in it at all so maybe this is only for now.
9873 2001-10-30 Ravi Pratap <ravi@ximian.com>
9875 * support.cs (InternalParameters): Constructor now takes an extra argument
9876 which is the actual Parameters class.
9878 (ParameterDesc): Update to provide info on ref/out modifiers.
9880 * class.cs (everywhere): Update call to InternalParameters to pass in
9881 the second argument too.
9883 * support.cs (ParameterData): Add ParameterModifier, which is a method
9884 to return the modifier info [ref/out etc]
9886 (InternalParameters, ReflectionParameters): Implement the above.
9888 * expression.cs (Argument::ParameterModifier): Similar function to return
9889 info about the argument's modifiers.
9891 (Invocation::OverloadResolve): Update to take into account matching modifiers
9894 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9895 a new SetFormalParameters object which we pass to InternalParameters.
9897 2001-10-30 Ravi Pratap <ravi@ximian.com>
9899 * expression.cs (NewArray): Merge into the ArrayCreation class.
9901 2001-10-29 Ravi Pratap <ravi@ximian.com>
9903 * expression.cs (NewArray): Merge classes NewBuiltinArray and
9904 NewUserdefinedArray into one as there wasn't much of a use in having
9907 * expression.cs (Argument): Change field's name to ArgType from Type.
9909 (Type): New readonly property which returns the proper type, taking into
9910 account ref/out modifiers.
9912 (everywhere): Adjust code accordingly for the above.
9914 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9915 whether we are emitting for a ref or out parameter.
9917 * expression.cs (Argument::Emit): Use the above field to set the state.
9919 (LocalVariableReference::Emit): Update to honour the flag and emit the
9922 * parameter.cs (Attributes): Set the correct flags for ref parameters.
9924 * expression.cs (Argument::FullDesc): New function to provide a full desc.
9926 * support.cs (ParameterData): Add method ParameterDesc to the interface.
9928 (ReflectionParameters, InternalParameters): Implement the above method.
9930 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
9933 (Invocation::FullMethodDesc): Ditto.
9935 2001-10-29 Miguel de Icaza <miguel@ximian.com>
9937 * cs-parser.jay: Add extra production for the second form of array
9940 * expression.cs (ArrayCreation): Update to reflect the above
9943 * Small changes to prepare for Array initialization.
9945 2001-10-28 Miguel de Icaza <miguel@ximian.com>
9947 * typemanager.cs (ImplementsInterface): interface might be null;
9948 Deal with this problem;
9950 Also, we do store negative hits on the cache (null values), so use
9951 this instead of calling t.GetInterfaces on the type everytime.
9953 2001-10-28 Ravi Pratap <ravi@ximian.com>
9955 * typemanager.cs (IsBuiltinType): New method to help determine the same.
9957 * expression.cs (New::DoResolve): Get rid of array creation code and instead
9958 split functionality out into different classes.
9960 (New::FormArrayType): Move into NewBuiltinArray.
9962 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
9965 (NewBuiltinArray): New class to handle creation of built-in arrays.
9967 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
9968 account creation of one-dimensional arrays.
9970 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
9972 (NewUserdefinedArray::DoResolve): Implement.
9974 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
9976 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
9977 we maintain inside the TypeManager. This is necessary to perform lookups on the
9980 (LookupType): Update to perform GetType on the module builders too.
9982 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
9984 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
9986 2001-10-23 Ravi Pratap <ravi@ximian.com>
9988 * expression.cs (New::DoResolve): Implement guts of array creation.
9990 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
9992 2001-10-27 Miguel de Icaza <miguel@ximian.com>
9994 * expression.cs: Fix bug I introduced lsat night that broke
9997 (Expression.Resolve): Report a 246 error (can not resolve name)
9998 if we find a SimpleName in the stream.
10000 (Expression.ResolveLValue): Ditto.
10002 (Expression.ResolveWithSimpleName): This function is a variant of
10003 ResolveName, this one allows SimpleNames to be returned without a
10004 warning. The only consumer of SimpleNames is MemberAccess
10006 2001-10-26 Miguel de Icaza <miguel@ximian.com>
10008 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10009 might arrive here. I have my doubts that this is correct.
10011 * statement.cs (Lock): Implement lock statement.
10013 * cs-parser.jay: Small fixes to support `lock' and `using'
10015 * cs-tokenizer.cs: Remove extra space
10017 * driver.cs: New flag --checked, allows to turn on integer math
10020 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10021 Threading.Monitor.Exit
10023 2001-10-23 Miguel de Icaza <miguel@ximian.com>
10025 * expression.cs (IndexerAccess::DoResolveLValue): Set the
10026 Expression Class to be IndexerAccess.
10028 Notice that Indexer::DoResolve sets the eclass to Value.
10030 2001-10-22 Miguel de Icaza <miguel@ximian.com>
10032 * class.cs (TypeContainer::Emit): Emit code for indexers.
10034 * assign.cs (IAssignMethod): New interface implemented by Indexers
10035 and Properties for handling assignment.
10037 (Assign::Emit): Simplify and reuse code.
10039 * expression.cs (IndexerAccess, PropertyExpr): Implement
10040 IAssignMethod, clean up old code.
10042 2001-10-22 Ravi Pratap <ravi@ximian.com>
10044 * typemanager.cs (ImplementsInterface): New method to determine if a type
10045 implements a given interface. Provides a nice cache too.
10047 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10050 (ConvertReferenceExplicit): Ditto.
10052 * delegate.cs (Delegate::Populate): Update to define the parameters on the
10053 various methods, with correct names etc.
10055 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
10056 Operator.UnaryNegation.
10058 * cs-parser.jay (operator_declarator): Be a little clever in the case where
10059 we have a unary plus or minus operator.
10061 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
10064 * everywhere : update accordingly.
10066 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10069 * class.cs (Method::Define): For the case where we are implementing a method
10070 inherited from an interface, we need to set the MethodAttributes.Final flag too.
10071 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10073 2001-10-21 Ravi Pratap <ravi@ximian.com>
10075 * interface.cs (FindMembers): Implement to work around S.R.E
10078 * typemanager.cs (IsInterfaceType): Implement.
10080 (FindMembers): Update to handle interface types too.
10082 * expression.cs (ImplicitReferenceConversion): Re-write bits which
10083 use IsAssignableFrom as that is not correct - it doesn't work.
10085 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10086 and accordingly override EmitStatement.
10088 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10089 using the correct logic :-)
10091 2001-10-19 Ravi Pratap <ravi@ximian.com>
10093 * ../errors/cs-11.cs : Add to demonstrate error -11
10095 2001-10-17 Miguel de Icaza <miguel@ximian.com>
10097 * assign.cs (Assign::Resolve): Resolve right hand side first, and
10098 then pass this as a hint to ResolveLValue.
10100 * expression.cs (FieldExpr): Add Location information
10102 (FieldExpr::LValueResolve): Report assignment to readonly
10105 (Expression::ExprClassFromMemberInfo): Pass location information.
10107 (Expression::ResolveLValue): Add new method that resolves an
10110 (Expression::DoResolveLValue): Default invocation calls
10113 (Indexers): New class used to keep track of indexers in a given
10116 (IStackStore): Renamed from LValue, as it did not really describe
10117 what this did. Also ResolveLValue is gone from this interface and
10118 now is part of Expression.
10120 (ElementAccess): Depending on the element access type
10122 * typemanager.cs: Add `indexer_name_type' as a Core type
10123 (System.Runtime.CompilerServices.IndexerNameAttribute)
10125 * statement.cs (Goto): Take a location.
10127 2001-10-18 Ravi Pratap <ravi@ximian.com>
10129 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10130 if two delegates are compatible.
10132 (NewDelegate::DoResolve): Update to take care of the case when
10133 we instantiate a delegate from another delegate.
10135 * typemanager.cs (FindMembers): Don't even try to look up members
10136 of Delegate types for now.
10138 2001-10-18 Ravi Pratap <ravi@ximian.com>
10140 * delegate.cs (NewDelegate): New class to take care of delegate
10143 * expression.cs (New): Split the delegate related code out into
10144 the NewDelegate class.
10146 * delegate.cs (DelegateInvocation): New class to handle delegate
10149 * expression.cs (Invocation): Split out delegate related code into
10150 the DelegateInvocation class.
10152 2001-10-17 Ravi Pratap <ravi@ximian.com>
10154 * expression.cs (New::DoResolve): Implement delegate creation fully
10155 and according to the spec.
10157 (New::DoEmit): Update to handle delegates differently.
10159 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10160 because of which we were printing out arguments in reverse order !
10162 * delegate.cs (VerifyMethod): Implement to check if the given method
10163 matches the delegate.
10165 (FullDelegateDesc): Implement.
10167 (VerifyApplicability): Implement.
10169 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10170 delegate invocations too.
10172 (Invocation::Emit): Ditto.
10174 * ../errors/cs1593.cs : Added.
10176 * ../errors/cs1594.cs : Added.
10178 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10180 2001-10-16 Ravi Pratap <ravi@ximian.com>
10182 * typemanager.cs (intptr_type): Core type for System.IntPtr
10184 (InitCoreTypes): Update for the same.
10186 (iasyncresult_type, asynccallback_type): Ditto.
10188 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10191 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10194 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10195 the builders for the 4 members of a delegate type :-)
10197 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10200 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10202 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10204 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10206 * statement.cs (Break::Emit): Implement.
10207 (Continue::Emit): Implement.
10209 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10210 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10211 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10212 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10215 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10216 properties that track the label for the current loop (begin of the
10217 loop and end of the loop).
10219 2001-10-15 Ravi Pratap <ravi@ximian.com>
10221 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10222 use of emitting anything at all.
10224 * class.cs, rootcontext.cs : Get rid of calls to the same.
10226 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10228 (Populate): Define the constructor correctly and set the implementation
10231 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10234 (AddDelegateType): Implement.
10236 (IsDelegateType): Implement helper method.
10238 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10240 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10241 and accordingly handle it.
10243 * delegate.cs (Populate): Take TypeContainer argument.
10244 Implement bits to define the Invoke method. However, I still haven't figured out
10245 how to take care of the native int bit :-(
10247 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10248 Qualify the name of the delegate, not its return type !
10250 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10253 (StandardConversionExists): Checking for array types turns out to be recursive.
10255 (ConvertReferenceExplicit): Implement array conversion.
10257 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10259 2001-10-12 Ravi Pratap <ravi@ximian.com>
10261 * cs-parser.jay (delegate_declaration): Store the fully qualified
10262 name as it is a type declaration.
10264 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10267 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10268 as TypeContainer::DefineType.
10270 (Populate): Method in which all the definition of the various methods (Invoke)
10273 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10276 (CloseDelegate): Finally creates the delegate.
10278 * class.cs (TypeContainer::DefineType): Update to define delegates.
10279 (Populate, Emit and CloseType): Do the same thing here too.
10281 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10282 delegates in all these operations.
10284 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10286 * expression.cs: LocalTemporary: a new expression used to
10287 reference a temporary that has been created.
10289 * assign.cs: Handle PropertyAccess back here, so that we can
10290 provide the proper semantic access to properties.
10292 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10293 a few more explicit conversions.
10295 * modifiers.cs: `NEW' modifier maps to HideBySig.
10297 * expression.cs (PropertyExpr): Make this into an
10298 ExpressionStatement, and support the EmitStatement code path.
10300 Perform get/set error checking, clean up the interface.
10302 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10303 them into toplevel access objects.
10305 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10307 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10310 * typemanager.cs: Keep track here of our PropertyBuilders again to
10311 work around lameness in SRE.
10313 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10315 * expression.cs (LValue::LValueResolve): New method in the
10316 interface, used to perform a second resolution pass for LValues.
10318 (This::DoResolve): Catch the use of this in static methods.
10320 (This::LValueResolve): Implement.
10322 (This::Store): Remove warning, assigning to `this' in structures
10325 (Invocation::Emit): Deal with invocation of
10326 methods on value types. We need to pass the address to structure
10327 methods rather than the object itself. (The equivalent code to
10328 emit "this" for structures leaves the entire structure on the
10329 stack instead of a pointer to it).
10331 (ParameterReference::DoResolve): Compute the real index for the
10332 argument based on whether the method takes or not a `this' pointer
10333 (ie, the method is static).
10335 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10336 value types returned from functions when we need to invoke a
10337 method on the sturcture.
10340 2001-10-11 Ravi Pratap <ravi@ximian.com>
10342 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10343 defining the type in the Modulebuilder or Typebuilder. This is to take
10344 care of nested types which need to be defined on the TypeBuilder using
10345 DefineNestedMethod.
10347 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10348 methods in RootContext, only ported to be part of TypeContainer.
10350 (TypeContainer::GetInterfaceOrClass): Ditto.
10352 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10354 * interface.cs (Interface::DefineInterface): New method. Does exactly
10355 what RootContext.CreateInterface did earlier, only it takes care of nested types
10358 (Interface::GetInterfaces): Move from RootContext here and port.
10360 (Interface::GetInterfaceByName): Same here.
10362 * rootcontext.cs (ResolveTree): Re-write.
10364 (PopulateTypes): Re-write.
10366 * class.cs (TypeContainer::Populate): Populate nested types too.
10367 (TypeContainer::Emit): Emit nested members too.
10369 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10370 instead just use the name argument passed in as it is already fully
10373 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10374 to TypeContainer mapping to see if a type is user-defined.
10376 * class.cs (TypeContainer::CloseType): Implement.
10378 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10379 the default constructor.
10381 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10384 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10386 * interface.cs (CloseType): Create the type here.
10388 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10391 Remove all the methods which are now in TypeContainer.
10393 2001-10-10 Ravi Pratap <ravi@ximian.com>
10395 * delegate.cs (Define): Re-write bits to define the delegate
10398 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10400 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10402 * expression.cs (ImplicitReferenceConversion): handle null as well
10403 as a source to convert to any reference type.
10405 * statement.cs (Return): Perform any implicit conversions to
10406 expected return type.
10408 Validate use of return statement.
10410 * codegen.cs (EmitContext): Pass the expected return type here.
10412 * class.cs (Method, Constructor, Property): Pass expected return
10413 type to EmitContext.
10415 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10417 * expression.cs: Make DoResolve take an EmitContext instead of a
10420 Replaced `l' and `location' for `loc', for consistency.
10422 (Error, Warning): Remove unneeded Tc argument.
10424 * assign.cs, literal.cs, constant.cs: Update to new calling
10427 * codegen.cs: EmitContext now contains a flag indicating whether
10428 code is being generated in a static method or not.
10430 * cs-parser.jay: DecomposeQI, new function that replaces the old
10431 QualifiedIdentifier. Now we always decompose the assembled
10432 strings from qualified_identifier productions into a group of
10435 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10437 * rootcontext.cs: Deal with field-less struct types correctly now
10438 by passing the size option to Define Type.
10440 * class.cs: Removed hack that created one static field.
10442 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10444 * statement.cs: Moved most of the code generation here.
10446 2001-10-09 Ravi Pratap <ravi@ximian.com>
10448 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10451 (ElementAccess): Remove useless bits for now - keep checks as the spec
10454 2001-10-08 Ravi Pratap <ravi@ximian.com>
10456 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10457 and start performing checks according to the spec.
10459 2001-10-07 Ravi Pratap <ravi@ximian.com>
10461 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10462 rank_specifiers instead.
10464 (rank_specifiers): Change the order in which the rank specifiers are stored
10466 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10468 * expression.cs (ElementAccess): Implement the LValue interface too.
10470 2001-10-06 Ravi Pratap <ravi@ximian.com>
10472 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10473 except that user defined conversions are not included.
10475 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10476 perform the conversion of the return type, if necessary.
10478 (New::DoResolve): Check whether we are creating an array or an object
10479 and accordingly do the needful.
10481 (New::Emit): Same here.
10483 (New::DoResolve): Implement guts of array creation.
10485 (New::FormLookupType): Helper function.
10487 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10489 * codegen.cs: Removed most of the code generation here, and move the
10490 corresponding code generation bits to the statement classes.
10492 Added support for try/catch/finalize and throw.
10494 * cs-parser.jay: Added support for try/catch/finalize.
10496 * class.cs: Catch static methods having the flags override,
10497 virtual or abstract.
10499 * expression.cs (UserCast): This user cast was not really doing
10500 what it was supposed to do. Which is to be born in fully resolved
10501 state. Parts of the resolution were being performed at Emit time!
10505 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10507 * expression.cs: Implicity convert the result from UserCast.
10509 2001-10-05 Ravi Pratap <ravi@ximian.com>
10511 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10512 prevented it from working correctly.
10514 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10515 merely ConvertImplicit.
10517 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10519 * typemanager.cs: Make the LookupTypeContainer function static,
10520 and not per-instance.
10522 * class.cs: Make static FindMembers (the one that takes a Type
10525 * codegen.cs: Add EmitForeach here.
10527 * cs-parser.jay: Make foreach a toplevel object instead of the
10528 inline expansion, as we need to perform semantic analysis on it.
10530 2001-10-05 Ravi Pratap <ravi@ximian.com>
10532 * expression.cs (Expression::ImplicitUserConversion): Rename to
10533 UserDefinedConversion.
10535 (Expression::UserDefinedConversion): Take an extra argument specifying
10536 whether we look for explicit user conversions too.
10538 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10540 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10542 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10543 with the appropriate arguments.
10545 * cs-parser.jay (cast_expression): Record location too.
10547 * expression.cs (Cast): Record location info.
10549 (Expression::ConvertExplicit): Take location argument.
10551 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10552 to determine if we are doing explicit conversions.
10554 (UserCast::Emit): Update accordingly.
10556 (Expression::ConvertExplicit): Report an error if everything fails.
10558 * ../errors/cs0030.cs : Add.
10560 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10562 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10563 virtual and newslot bits.
10565 * class.cs (TypeContainer::RegisterRequiredImplementations):
10566 Record methods we need.
10568 (TypeContainer::MakeKey): Helper function to make keys for
10569 MethodBases, since the Methodbase key is useless.
10571 (TypeContainer::Populate): Call RegisterRequiredImplementations
10572 before defining the methods.
10574 Create a mapping for method_builders_to_methods ahead of time
10575 instead of inside a tight loop.
10577 (::RequireMethods): Accept an object as the data to set into the
10578 hashtable so we can report interface vs abstract method mismatch.
10580 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10582 * report.cs: Make all of it static.
10584 * rootcontext.cs: Drop object_type and value_type computations, as
10585 we have those in the TypeManager anyways.
10587 Drop report instance variable too, now it is a global.
10589 * driver.cs: Use try/catch on command line handling.
10591 Add --probe option to debug the error reporting system with a test
10594 * report.cs: Add support for exiting program when a probe
10595 condition is reached.
10597 2001-10-03 Ravi Pratap <ravi@ximian.com>
10599 * expression.cs (Binary::DoNumericPromotions): Fix the case when
10600 we do a forcible conversion regardless of type, to check if
10601 ForceConversion returns a null.
10603 (Binary::error19): Use location to report error.
10605 (Unary::error23): Use location here too.
10607 * ../errors/cs0019.cs : Check in.
10609 * ../errors/cs0023.cs : Check in.
10611 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10612 case of a non-null MethodInfo object with a length of 0 !
10614 (Binary::ResolveOperator): Flag error if overload resolution fails to find
10615 an applicable member - according to the spec :-)
10616 Also fix logic to find members in base types.
10618 (Unary::ResolveOperator): Same here.
10620 (Unary::report23): Change name to error23 and make first argument a TypeContainer
10621 as I was getting thoroughly confused between this and error19 :-)
10623 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10624 (::FindMostEncompassedType): Implement.
10625 (::FindMostEncompassingType): Implement.
10626 (::StandardConversionExists): Implement.
10628 (UserImplicitCast): Re-vamp. We now need info about most specific
10629 source and target types so that we can do the necessary conversions.
10631 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10632 mathematical union with no duplicates.
10634 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10636 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10637 in order from base classes to child classes, so that we can in
10638 child classes look up in our parent for method names and
10639 attributes (required for handling abstract, virtual, new, override
10640 constructs: we need to instrospect our base class, and if we dont
10641 populate the classes in order, the introspection might be
10642 incorrect. For example, a method could query its parent before
10643 the parent has any methods and would determine that the parent has
10644 no abstract methods (while it could have had them)).
10646 (RootContext::CreateType): Record the order in which we define the
10649 2001-10-02 Miguel de Icaza <miguel@ximian.com>
10651 * class.cs (TypeContainer::Populate): Also method definitions can
10652 fail now, keep track of this.
10654 (TypeContainer::FindMembers): Implement support for
10655 DeclaredOnly/noDeclaredOnly flag.
10657 (Constructor::Emit) Return the ConstructorBuilder.
10659 (Method::Emit) Return the MethodBuilder.
10660 Check for abstract or virtual methods to be public.
10662 * rootcontext.cs (RootContext::CreateType): Register all the
10663 abstract methods required for the class to be complete and the
10664 interface methods that must be implemented.
10666 * cs-parser.jay: Report error 501 (method requires body if it is
10667 not marked abstract or extern).
10669 * expression.cs (TypeOf::Emit): Implement.
10671 * typemanager.cs: runtime_handle_type, new global type.
10673 * class.cs (Property::Emit): Generate code for properties.
10675 2001-10-02 Ravi Pratap <ravi@ximian.com>
10677 * expression.cs (Unary::ResolveOperator): Find operators on base type
10678 too - we now conform exactly to the spec.
10680 (Binary::ResolveOperator): Same here.
10682 * class.cs (Operator::Define): Fix minor quirk in the tests.
10684 * ../errors/cs0215.cs : Added.
10686 * ../errors/cs0556.cs : Added.
10688 * ../errors/cs0555.cs : Added.
10690 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10692 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10693 single integer which is really efficient
10695 2001-10-01 Ravi Pratap <ravi@ximian.com>
10697 * expression.cs (Expression::ImplicitUserConversion): Use location
10698 even in the case when we are examining True operators.
10700 * class.cs (Operator::Define): Perform extensive checks to conform
10701 with the rules for operator overloading in the spec.
10703 * expression.cs (Expression::ImplicitReferenceConversion): Implement
10704 some of the other conversions mentioned in the spec.
10706 * typemanager.cs (array_type): New static member for the System.Array built-in
10709 (cloneable_interface): For System.ICloneable interface.
10711 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10712 we start resolving the tree and populating types.
10714 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10716 2001-10-01 Miguel de Icaza <miguel@ximian.com>
10718 * expression.cs (Expression::ExprClassFromMemberInfo,
10719 Expression::Literalize): Create literal expressions from
10720 FieldInfos which are literals.
10722 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10723 type casts, because they were wrong. The test suite in tests
10726 (ImplicitNumericConversion): ushort to ulong requires a widening
10729 Int32 constant to long requires widening cast as well.
10731 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10732 for integers because the type on the stack is not i4.
10734 2001-09-30 Miguel de Icaza <miguel@ximian.com>
10736 * expression.cs (report118): require location argument.
10738 * parameter.cs: Do not dereference potential null value.
10740 * class.cs: Catch methods that lack the `new' keyword when
10741 overriding a name. Report warnings when `new' is used without
10742 anything being there to override.
10744 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10746 * class.cs: Only add constructor to hashtable if it is non-null
10747 (as now constructors can fail on define).
10749 (TypeManager, Class, Struct): Take location arguments.
10751 Catch field instance initialization in structs as errors.
10753 accepting_filter: a new filter for FindMembers that is static so
10754 that we dont create an instance per invocation.
10756 (Constructor::Define): Catch errors where a struct constructor is
10759 * cs-parser.jay: Pass location information for various new
10762 * delegate.cs (Delegate): take a location argument.
10764 * driver.cs: Do not call EmitCode if there were problesm in the
10765 Definition of the types, as many Builders wont be there.
10767 * decl.cs (Decl::Decl): Require a location argument.
10769 * cs-tokenizer.cs: Handle properly hex constants that can not fit
10770 into integers, and find the most appropiate integer for it.
10772 * literal.cs: Implement ULongLiteral.
10774 * rootcontext.cs: Provide better information about the location of
10775 failure when CreateType fails.
10777 2001-09-29 Miguel de Icaza <miguel@ximian.com>
10779 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10782 * expression.cs (Binary::CheckShiftArguments): Add missing type
10784 (Binary::ResolveOperator): Add type to the logical and and logical
10785 or, Bitwise And/Or and Exclusive Or code paths, it was missing
10788 (Binary::DoNumericPromotions): In the case where either argument
10789 is ulong (and most signed types combined with ulong cause an
10790 error) perform implicit integer constant conversions as well.
10792 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10794 * expression.cs (UserImplicitCast): Method should always be
10796 (Invocation::BetterConversion): Simplified test for IntLiteral.
10798 (Expression::ImplicitNumericConversion): Split this routine out.
10799 Put the code that performs implicit constant integer conversions
10802 (Expression::Resolve): Become a wrapper around DoResolve so we can
10803 check eclass and type being set after resolve.
10805 (Invocation::Badness): Remove this dead function
10807 (Binary::ResolveOperator): Do not compute the expensive argumnets
10808 unless we have a union for it.
10810 (Probe::Emit): Is needs to do an isinst and then
10811 compare against null.
10813 (::CanConvert): Added Location argument. If the Location argument
10814 is null (Location.Null), then we do not report errors. This is
10815 used by the `probe' mechanism of the Explicit conversion. We do
10816 not want to generate an error for something that the user
10817 explicitly requested to be casted. But the pipeline for an
10818 explicit cast first tests for potential implicit casts.
10820 So for now, if the Location is null, it means `Probe only' to
10821 avoid adding another argument. Might have to revise this
10824 (ClassCast): New class used to type cast objects into arbitrary
10825 classes (used in Explicit Reference Conversions).
10827 Implement `as' as well.
10829 Reverted all the patches from Ravi below: they were broken:
10831 * The use of `level' as a mechanism to stop recursive
10832 invocations is wrong. That was there just to catch the
10833 bug with a strack trace but not as a way of addressing
10836 To fix the problem we have to *understand* what is going
10837 on and the interactions and come up with a plan, not
10838 just get things going.
10840 * The use of the type conversion cache that I proposed
10841 last night had an open topic: How does this work across
10842 protection domains. A user defined conversion might not
10843 be public in the location where we are applying the
10844 conversion, a different conversion might be selected
10845 (ie, private A->B (better) but public B->A (worse),
10846 inside A, A->B applies, but outside it, B->A will
10849 * On top of that (ie, even if the above is solved),
10850 conversions in a cache need to be abstract. Ie, `To
10851 convert from an Int to a Short use an OpcodeCast', not
10852 `To convert from an Int to a Short use the OpcodeCast on
10853 the variable 5' (which is what this patch was doing).
10855 2001-09-28 Ravi Pratap <ravi@ximian.com>
10857 * expression.cs (Invocation::ConversionExists): Re-write to use
10858 the conversion cache
10860 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
10861 cache all conversions done, not just user-defined ones.
10863 (Invocation::BetterConversion): The real culprit. Use ConversionExists
10864 to determine if a conversion exists instead of acutually trying to
10865 perform the conversion. It's faster too.
10867 (Expression::ConvertExplicit): Modify to use ConversionExists to check
10868 and only then attempt the implicit conversion.
10870 2001-09-28 Ravi Pratap <ravi@ximian.com>
10872 * expression.cs (ConvertImplicit): Use a cache for conversions
10873 already found. Check level of recursion and bail out if necessary.
10875 2001-09-28 Miguel de Icaza <miguel@ximian.com>
10877 * typemanager.cs (string_concat_string_string, string_concat_object_object):
10878 Export standard methods that we expect for string operations.
10880 * statement.cs (Block::UsageWarning): Track usage of variables and
10881 report the errors for not used variables.
10883 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
10886 2001-09-27 Miguel de Icaza <miguel@ximian.com>
10888 * codegen.cs: remove unnneded code
10890 * expression.cs: Removed BuiltinTypeAccess class
10892 Fix the order in which implicit conversions are
10895 The previous fixed dropped support for boxed conversions (adding a
10896 test to the test suite now)
10898 (UserImplicitCast::CanConvert): Remove test for source being null,
10899 that code is broken. We should not feed a null to begin with, if
10900 we do, then we should track the bug where the problem originates
10901 and not try to cover it up here.
10903 Return a resolved expression of type UserImplicitCast on success
10904 rather than true/false. Ravi: this is what I was talking about,
10905 the pattern is to use a static method as a "constructor" for
10908 Also, do not create arguments until the very last minute,
10909 otherwise we always create the arguments even for lookups that
10910 will never be performed.
10912 (UserImplicitCast::Resolve): Eliminate, objects of type
10913 UserImplicitCast are born in a fully resolved state.
10915 * typemanager.cs (InitCoreTypes): Init also value_type
10916 (System.ValueType).
10918 * expression.cs (Cast::Resolve): First resolve the child expression.
10920 (LValue): Add new method AddressOf to be used by
10923 Change the argument of Store to take an EmitContext instead of an
10924 ILGenerator, because things like FieldExpr need to be able to call
10925 their children expression to generate the instance code.
10927 (Expression::Error, Expression::Warning): Sugar functions for
10930 (Expression::MemberLookup): Accept a TypeContainer instead of a
10931 Report as the first argument.
10933 (Expression::ResolvePrimary): Killed. I still want to improve
10934 this as currently the code is just not right.
10936 (Expression::ResolveMemberAccess): Simplify, but it is still
10939 (Unary::Resolve): Catch errors in AddressOf operators.
10941 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
10942 index to a byte for the short-version, or the compiler will choose
10943 the wrong Emit call, which generates the wrong data.
10945 (ParameterReference::Emit, ::Store): same.
10947 (FieldExpr::AddressOf): Implement.
10949 * typemanager.cs: TypeManager: made public variable instead of
10952 * driver.cs: document --fatal.
10954 * report.cs (ErrorMessage, WarningMessage): new names for the old
10955 Error and Warning classes.
10957 * cs-parser.jay (member_access): Turn built-in access to types
10958 into a normal simplename
10960 2001-09-27 Ravi Pratap <ravi@ximian.com>
10962 * expression.cs (Invocation::BetterConversion): Fix to cope
10963 with q being null, since this was introducing a bug.
10965 * expression.cs (ConvertImplicit): Do built-in conversions first.
10967 2001-09-27 Ravi Pratap <ravi@ximian.com>
10969 * expression.cs (UserImplicitCast::Resolve): Fix bug.
10971 2001-09-27 Ravi Pratap <ravi@ximian.com>
10973 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
10974 I had introduced long ago (what's new ?).
10976 * expression.cs (UserImplicitCast::CanConvert): Static method to do
10977 the work of all the checking.
10978 (ConvertImplicit): Call CanConvert and only then create object if necessary.
10979 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
10981 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
10982 that is the right way.
10984 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
10985 overloading resolution. Use everywhere instead of cutting and pasting code.
10987 (Binary::ResolveOperator): Use MakeUnionSet.
10989 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
10990 we have to convert to bool types. Not complete yet.
10992 2001-09-27 Miguel de Icaza <miguel@ximian.com>
10994 * typemanager.cs (TypeManager::CSharpName): support ushort.
10996 * expression.cs (Expression::TryImplicitIntConversion): Attempts
10997 to provide an expression that performsn an implicit constant int
10998 conversion (section 6.1.6).
10999 (Expression::ConvertImplicitRequired): Reworked to include
11000 implicit constant expression conversions.
11002 (Expression::ConvertNumericExplicit): Finished.
11004 (Invocation::Emit): If InstanceExpression is null, then it means
11005 that we perform a call on this.
11007 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11009 * expression.cs (Unary::Emit): Remove some dead code.
11010 (Probe): Implement Resolve and Emit for `is'.
11011 (Expression::ConvertImplicitRequired): Attempt to do constant
11012 expression conversions here. Maybe should be moved to
11013 ConvertImplicit, but I am not sure.
11014 (Expression::ImplicitLongConstantConversionPossible,
11015 Expression::ImplicitIntConstantConversionPossible): New functions
11016 that tell whether is it possible to apply an implicit constant
11017 expression conversion.
11019 (ConvertNumericExplicit): Started work on explicit numeric
11022 * cs-parser.jay: Update operator constants.
11024 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11025 (Parameters::GetSignature): Hook up VerifyArgs here.
11026 (Parameters::VerifyArgs): Verifies that no two arguments have the
11029 * class.cs (Operator): Update the operator names to reflect the
11030 ones that the spec expects (as we are just stringizing the
11033 * expression.cs (Unary::ResolveOperator): Fix bug: Use
11034 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11035 previous usage did only work for our methods.
11036 (Expression::ConvertImplicit): Handle decimal implicit numeric
11037 conversions as well.
11038 (Expression::InternalTypeConstructor): Used to invoke constructors
11039 on internal types for default promotions.
11041 (Unary::Emit): Implement special handling for the pre/post
11042 increment/decrement for overloaded operators, as they need to have
11043 the same semantics as the other operators.
11045 (Binary::ResolveOperator): ditto.
11046 (Invocation::ConversionExists): ditto.
11047 (UserImplicitCast::Resolve): ditto.
11049 2001-09-26 Ravi Pratap <ravi@ximian.com>
11051 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11052 operator, return after emitting body. Regression tests pass again !
11054 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11055 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11056 (Invocation::OverloadResolve): Ditto.
11057 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11059 * everywhere : update calls to the above methods accordingly.
11061 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11063 * assign.cs (Assign): Make it inherit from ExpressionStatement.
11065 * expression.cs (ExpressionStatement): New base class used for
11066 expressions that can appear in statements, so that we can provide
11067 an alternate path to generate expression that do not leave a value
11070 (Expression::Emit, and all the derivatives): We no longer return
11071 whether a value is left on the stack or not. Every expression
11072 after being emitted leaves a single value on the stack.
11074 * codegen.cs (EmitContext::EmitStatementExpression): Use the
11075 facilties of ExpressionStatement if possible.
11077 * cs-parser.jay: Update statement_expression.
11079 2001-09-25 Miguel de Icaza <miguel@ximian.com>
11081 * driver.cs: Change the wording of message
11083 2001-09-25 Ravi Pratap <ravi@ximian.com>
11085 * expression.cs (Binary::ResolveOperator): Had forgottten to set
11086 the type of the expression to the return type of the method if
11087 we have an overloaded operator match ! The regression tests pass again !
11088 (Unary::ResolveOperator): Ditto.
11090 * expression.cs (Invocation::ConversionExists): Correct the member lookup
11091 to find "op_Implicit", not "implicit" ;-)
11092 (UserImplicitCast): New class to take care of user-defined implicit conversions.
11093 (ConvertImplicit, ForceConversion): Take TypeContainer argument
11095 * everywhere : Correct calls to the above accordingly.
11097 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11098 (ConvertImplicit): Do user-defined conversion if it exists.
11100 2001-09-24 Miguel de Icaza <miguel@ximian.com>
11102 * assign.cs: track location.
11103 (Resolve): Use implicit conversions on assignment.
11105 * literal.cs: Oops. Not good, Emit of short access values should
11106 pass (Bytes) or the wrong argument will be selected.
11108 * expression.cs (Unary::Emit): Emit code for -expr.
11110 (Unary::ResolveOperator): Handle `Substract' for non-constants
11111 (substract from zero from the non-constants).
11112 Deal with Doubles as well.
11114 (Expression::ConvertImplicitRequired): New routine that reports an
11115 error if no implicit conversion exists.
11117 (Invocation::OverloadResolve): Store the converted implicit
11118 expressions if we make them
11120 2001-09-24 Ravi Pratap <ravi@ximian.com>
11122 * class.cs (ConstructorInitializer): Take a Location argument.
11123 (ConstructorBaseInitializer): Same here.
11124 (ConstructorThisInitializer): Same here.
11126 * cs-parser.jay : Update all calls accordingly.
11128 * expression.cs (Unary, Binary, New): Take location argument.
11129 Update accordingly everywhere.
11131 * cs-parser.jay : Update all calls to the above to take a location
11134 * class.cs : Ditto.
11136 2001-09-24 Ravi Pratap <ravi@ximian.com>
11138 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11139 (Invocation::BetterConversion): Same here
11140 (Invocation::ConversionExists): Ditto.
11142 (Invocation::ConversionExists): Implement.
11144 2001-09-22 Ravi Pratap <ravi@ximian.com>
11146 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11147 Also take an additional TypeContainer argument.
11149 * All over : Pass in TypeContainer as argument to OverloadResolve.
11151 * typemanager.cs (CSharpName): Update to check for the string type and return
11154 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11157 2001-09-21 Ravi Pratap <ravi@ximian.com>
11159 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11160 (Invocation::BetterFunction): Implement.
11161 (Invocation::BetterConversion): Implement.
11162 (Invocation::ConversionExists): Skeleton, no implementation yet.
11164 Okay, things work fine !
11166 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11168 * typemanager.cs: declare and load enum_type, delegate_type and
11171 * expression.cs (Expression::Emit): Now emit returns a value that
11172 tells whether a value is left on the stack or not. This strategy
11173 might be reveted tomorrow with a mechanism that would address
11174 multiple assignments.
11175 (Expression::report118): Utility routine to report mismatches on
11178 (Unary::Report23): Report impossible type/operator combination
11181 (Unary::IsIncrementableNumber): Whether the type can be
11182 incremented or decremented with add.
11183 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11185 (Unary::ResolveOperator): Implement ++, !, ~,
11187 (Invocation::Emit): Deal with new Emit convetion.
11189 * All Expression derivatives: Updated their Emit method to return
11190 whether they leave values on the stack or not.
11192 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11193 stack for expressions that are statements.
11195 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11197 * expression.cs (LValue): New interface. Must be implemented by
11199 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11202 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11203 interface for generating code, simplifies the code.
11205 2001-09-20 Ravi Pratap <ravi@ximian.com>
11207 * expression.cs (everywhere): Comment out return statements in ::Resolve
11208 methods to avoid the warnings.
11210 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11212 * driver.cs (parse): Report error 2001 if we can not open the
11215 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11218 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11221 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11222 otherwise nested blocks end up with the same index.
11224 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11226 * expression.cs: Instead of having FIXMEs in the Resolve
11227 functions, throw exceptions so it is obvious that we are facing a
11230 * cs-parser.jay (invocation_expression): Pass Location information.
11232 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11233 Use a basename for those routines because .NET does not like paths
11236 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11239 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11241 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11242 are loading the correct data types (throws an exception if not).
11243 (TypeManager::InitCoreTypes): Use CoreLookupType
11245 * expression.cs (Unary::ResolveOperator): return the child
11246 expression for expressions which are just +expr.
11247 (Unary::ResolveOperator): Return negative literals for -LITERAL
11248 expressions (otherwise they are Unary {Literal}).
11249 (Invocation::Badness): Take into account `Implicit constant
11250 expression conversions'.
11252 * literal.cs (LongLiteral): Implement long literal class.
11253 (IntLiteral): export the `Value' of the intliteral.
11255 2001-09-19 Ravi Pratap <ravi@ximian.com>
11257 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11259 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11260 instead of 'Operator'
11262 * expression.cs (Binary::ResolveOperator): Update accordingly.
11263 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11266 * cs-parser.jay (unary_expression): Update to use the new names.
11268 * gen-treedump.cs (GetUnary): Same here.
11270 * expression.cs (Unary::Resolve): Implement.
11271 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11272 operators are found instead of making noise ;-)
11273 (Unary::ResolveOperator): New method to do precisely the same thing which
11274 Binary::ResolveOperator does for Binary expressions.
11275 (Unary.method, .Arguments): Add.
11276 (Unary::OperName): Implement.
11277 (Unary::ForceConversion): Copy and Paste !
11279 * class.cs (Operator::Define): Fix a small bug for the case when we have
11282 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11283 for the inbuilt operators. Only overloading works for now ;-)
11285 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11287 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11288 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11290 * expression.cs (This::Emit): Implement.
11291 (This::Resolve): Implement.
11292 (TypeOf:Resolve): Implement.
11293 (Expression::ResolveSimpleName): Add an implicit this to instance
11295 (MemberAccess::Resolve): Deal with Parameters and Fields.
11296 Bind instance variable to Field expressions.
11297 (FieldExpr::Instance): New field used to track the expression that
11298 represents the object instance.
11299 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11301 (FieldExpr::Emit): Implement.
11303 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11304 the last instruction contains a return opcode to avoid generating
11305 the last `ret' instruction (this generates correct code, and it is
11306 nice to pass the peverify output).
11308 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11309 initializer for static and instance variables.
11310 (Constructor::Emit): Allow initializer to be null in the case of
11311 static constructors. Only emit initializer for instance
11314 (TypeContainer::FindMembers): Return a null array if there are no
11317 Also fix the code for the MemberTypes.Method branch, as it was not
11318 scanning that for operators (or tried to access null variables before).
11320 * assign.cs (Assign::Emit): Handle instance and static fields.
11324 * driver.cs: Stop compilation if there are parse errors.
11326 * cs-parser.jay (constructor_declaration): Provide default base
11327 initializer for non-static constructors.
11328 (constructor_declarator): Do not provide a default base
11329 initializers if none was specified.
11330 Catch the fact that constructors should not have parameters.
11332 * class.cs: Do not emit parent class initializers for static
11333 constructors, that should be flagged as an error.
11335 2001-09-18 Ravi Pratap <ravi@ximian.com>
11337 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11338 Move back code into TypeContainer::Populate.
11340 2001-09-18 Ravi Pratap <ravi@ximian.com>
11342 * class.cs (TypeContainer::AddConstructor): Fix the check to
11343 compare against Name, not Basename.
11344 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11346 * cs-parser.jay : Update accordingly.
11348 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11349 for methods, don't forget to look into the operators too.
11350 (RegisterMethodBuilder): Helper method to take care of this for
11351 methods, constructors and operators.
11352 (Operator::Define): Completely revamp.
11353 (Operator.OperatorMethod, MethodName): New fields.
11354 (TypeContainer::Populate): Move the registering of builders into
11355 RegisterMethodBuilder.
11356 (Operator::Emit): Re-write.
11358 * expression.cs (Binary::Emit): Comment out code path to emit method
11359 invocation stuff for the case when we have a user defined operator. I am
11360 just not able to get it right !
11362 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11364 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11367 (Expression::MemberLookup): Provide a version that allows to
11368 specify the MemberTypes and BindingFlags.
11370 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11371 so it was not fetching variable information from outer blocks.
11373 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11374 Beforefieldinit as it was buggy.
11376 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11377 that Ravi put here.
11379 * class.cs (Constructor::Emit): Only emit if block is not null.
11380 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11381 deal with this by semantically definining it as if the user had
11384 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11385 constructors as we now "emit" them at a higher level.
11387 (TypeContainer::DefineDefaultConstructor): Used to define the
11388 default constructors if none was provided.
11390 (ConstructorInitializer): Add methods Resolve and Emit.
11392 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11394 2001-09-17 Ravi Pratap <ravi@ximian.com>
11396 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11397 the default constructor builder with our hashtable for methodbuilders
11400 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11401 and argument_count is 0 in which case we have a match.
11402 (Binary::ResolveOperator): More null checking and miscellaneous coding
11405 2001-09-17 Ravi Pratap <ravi@ximian.com>
11407 * rootcontext.cs (IsNameSpace): Compare against null.
11409 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11411 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11412 and Unary::Operator.
11414 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11417 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11418 we have overloaded operators.
11419 (Binary::ResolveOperator): Implement the part which does the operator overload
11422 * class.cs (Operator::Emit): Implement.
11423 (TypeContainer::Emit): Emit the operators we have too.
11425 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11426 the case when we have a user-defined operator.
11428 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11430 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11432 2001-09-16 Ravi Pratap <ravi@ximian.com>
11434 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11435 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11436 (Constructor::Emit): Implement.
11437 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11438 if we have no work to do.
11439 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11442 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11443 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11445 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11448 2001-09-15 Ravi Pratap <ravi@ximian.com>
11450 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11452 (Tree::RecordNamespace): Method to do what the name says ;-)
11453 (Tree::Namespaces): Property to get at the namespaces hashtable.
11455 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11458 * rootcontext.cs (IsNamespace): Fixed it :-)
11460 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11462 * class.cs (TypeContainer::FindMembers): Add support for
11464 (MethodCore): New class that encapsulates both the shared aspects
11465 of a Constructor and a Method.
11466 (Method, Constructor): Factored pieces into MethodCore.
11468 * driver.cs: Added --fatal which makes errors throw exceptions.
11469 Load System assembly as well as part of the standard library.
11471 * report.cs: Allow throwing exceptions on errors for debugging.
11473 * modifiers.cs: Do not use `parent', instead use the real type
11474 container to evaluate permission settings.
11476 * class.cs: Put Ravi's patch back in. He is right, and we will
11477 have to cope with the
11479 2001-09-14 Ravi Pratap <ravi@ximian.com>
11481 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11482 FamORAssem, not FamANDAssem.
11484 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11486 * driver.cs: Added --parse option that only parses its input files
11489 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11490 incorrect. IsTopLevel is not used to tell whether an object is
11491 root_types or not (that can be achieved by testing this ==
11492 root_types). But to see if this is a top-level *class* (not
11493 necessarly our "toplevel" container).
11495 2001-09-14 Ravi Pratap <ravi@ximian.com>
11497 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11498 parent instead of a direct call to GetType.
11500 2001-09-14 Ravi Pratap <ravi@ximian.com>
11502 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11503 Modifiers.TypeAttr. This should just be a call to that method.
11505 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11506 object so that we can determine if we are top-level or not.
11508 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11511 * enum.cs (Enum::Define): Ditto.
11513 * modifiers.cs (FieldAttr): Re-write.
11515 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11516 (TypeContainer::HaveStaticConstructor): New property to provide access
11517 to precisely that info.
11519 * modifiers.cs (MethodAttr): Re-write.
11520 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11522 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11523 of top-level types as claimed.
11525 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11527 * expression.cs (MemberLookup): Fruitless attempt to lookup
11528 constructors. Maybe I need to emit default constructors? That
11529 might be it (currently .NET emits this for me automatically).
11530 (Invocation::OverloadResolve): Cope with Arguments == null.
11531 (Invocation::EmitArguments): new function, shared by the new
11532 constructor and us.
11533 (Invocation::Emit): Handle static and instance methods. Emit
11534 proper call instruction for virtual or non-virtual invocations.
11535 (New::Emit): Implement.
11536 (New::Resolve): Implement.
11537 (MemberAccess:Resolve): Implement.
11538 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11539 to track instances.
11540 (FieldExpr::Resolve): Set type.
11542 * support.cs: Handle empty arguments.
11544 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11545 SimpleLookup): Auxiliary routines to help parse a qualifier
11548 Update qualifier_identifier rule.
11550 * codegen.cs: Removed debugging messages.
11552 * class.cs: Make this a global thing, this acts just as a "key" to
11553 objects that we might have around.
11555 (Populate): Only initialize method_builders_to_methods once.
11557 * expression.cs (PropertyExpr): Initialize type from the
11560 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11561 Resolve pattern. Attempt to implicitly convert value to boolean.
11564 * expression.cs: Set the type for the int32/int32 argument case.
11565 (Binary::ResolveOperator): Set the return type to boolean for
11566 comparission operators
11568 * typemanager.cs: Remove debugging print code.
11570 (Invocation::Resolve): resolve type.
11572 * class.cs: Allocate a MemberInfo of the correct size, as the code
11573 elsewhere depends on the test to reflect the correct contents.
11575 (Method::) Keep track of parameters, due to System.Reflection holes
11577 (TypeContainer::Populate): Keep track of MethodBuilders to Method
11580 (TypeContainer::FindMembers): Use ArrayList and then copy an array
11581 of the exact size and return that.
11583 (Class::LookupMethodByBuilder): New function that maps
11584 MethodBuilders to its methods. Required to locate the information
11585 on methods because System.Reflection bit us again.
11587 * support.cs: New file, contains an interface ParameterData and
11588 two implementations: ReflectionParameters and InternalParameters
11589 used to access Parameter information. We will need to grow this
11592 * expression.cs (Invocation::GetParameterData): implement a cache
11593 and a wrapper around the ParameterData creation for methods.
11594 (Invocation::OverloadResolve): Use new code.
11596 2001-09-13 Ravi Pratap <ravi@ximian.com>
11598 * class.cs (TypeContainer::EmitField): Remove and move into
11599 (Field::Define): here and modify accordingly.
11600 (Field.FieldBuilder): New member.
11601 (TypeContainer::Populate): Update accordingly.
11602 (TypeContainer::FindMembers): Implement.
11604 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11606 * statement.cs: (VariableInfo::VariableType): New field to be
11607 initialized with the full type once it is resolved.
11609 2001-09-12 Miguel de Icaza <miguel@ximian.com>
11611 * parameter.cs (GetParameterInfo): Use a type cache to compute
11612 things only once, and to reuse this information
11614 * expression.cs (LocalVariableReference::Emit): Implement.
11615 (OpcodeCast::Emit): fix.
11617 (ParameterReference::Resolve): Implement.
11618 (ParameterReference::Emit): Implement.
11620 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11621 that are expressions need to stay as Expressions.
11623 * typemanager.cs (CSharpName): Returns the C# name of a type if
11626 * expression.cs (Expression::ConvertImplicit): New function that
11627 implements implicit type conversions.
11629 (Expression::ImplicitReferenceConversion): Implements implicit
11630 reference conversions.
11632 (EmptyCast): New type for transparent casts.
11634 (OpcodeCast): New type for casts of types that are performed with
11635 a sequence of bytecodes.
11637 (BoxedCast): New type used for casting value types into reference
11638 types. Emits a box opcode.
11640 (Binary::DoNumericPromotions): Implements numeric promotions of
11641 and computation of the Binary::Type.
11643 (Binary::EmitBranchable): Optimization.
11645 (Binary::Emit): Implement code emission for expressions.
11647 * typemanager.cs (TypeManager): Added two new core types: sbyte
11650 2001-09-12 Ravi Pratap <ravi@ximian.com>
11652 * class.cs (TypeContainer::FindMembers): Method which does exactly
11653 what Type.FindMembers does, only we don't have to use reflection. No
11654 implementation yet.
11656 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11657 typecontainer objects as we need to get at them.
11658 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11660 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11661 typecontainer object.
11663 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11664 of just a Report object.
11666 2001-09-11 Ravi Pratap <ravi@ximian.com>
11668 * class.cs (Event::Define): Go back to using the prefixes "add_" and
11670 (TypeContainer::Populate): Now define the delegates of the type too.
11671 (TypeContainer.Delegates): Property to access the list of delegates defined
11674 * delegates.cs (Delegate::Define): Implement partially.
11676 * modifiers.cs (TypeAttr): Handle more flags.
11678 2001-09-11 Ravi Pratap <ravi@ximian.com>
11680 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11682 (Operator::Define): Re-write logic to get types by using the LookupType method
11683 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11684 (Indexer::Define): Ditto.
11685 (Event::Define): Ditto.
11686 (Property::Define): Ditto.
11688 2001-09-10 Ravi Pratap <ravi@ximian.com>
11690 * class.cs (TypeContainer::Populate): Now define operators too.
11691 (TypeContainer.Operators): New property to access the list of operators
11693 (Operator.OperatorMethodBuilder): New member to hold the method builder
11694 for the operator we are defining.
11695 (Operator::Define): Implement.
11697 2001-09-10 Ravi Pratap <ravi@ximian.com>
11699 * class.cs (Event::Define): Make the prefixes of the accessor methods
11700 addOn_ and removeOn_
11702 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11703 of the location being passed in too. Ideally, this should go later since all
11704 error reporting should be done through the Report object.
11706 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11707 (Populate): Iterate thru the indexers we have and define them too.
11708 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11709 for the get and set accessors.
11710 (Indexer::Define): Implement.
11712 2001-09-09 Miguel de Icaza <miguel@ximian.com>
11714 * expression.cs (Binary::Resolve): Beginning of it. I scratched
11715 my previous implementation, did not work.
11717 * typemanager.cs: Add a couple of missing types (the longs).
11719 * literal.cs: Use TypeManager.bool_type instead of getting it.
11721 * expression.cs (EventExpr): New kind of expressions.
11722 (Expressio::ExprClassFromMemberInfo): finish
11724 2001-09-08 Miguel de Icaza <miguel@ximian.com>
11726 * assign.cs: Emit stores to static fields differently.
11728 2001-09-08 Ravi Pratap <ravi@ximian.com>
11730 * Merge in changes and adjust code to tackle conflicts. Backed out my
11731 code in Assign::Resolve ;-)
11733 2001-09-08 Ravi Pratap <ravi@ximian.com>
11735 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11736 instead Report.Error and also pass in the location.
11737 (CSharpParser::Lexer): New readonly property to return the reference
11738 to the Tokenizer object.
11739 (declare_local_variables): Use Report.Error with location instead of plain
11743 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11744 (Operator.CheckBinaryOperator): Ditto.
11746 * cs-parser.jay (operator_declarator): Update accordingly.
11748 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11749 (CheckBinaryOperator): Same here.
11751 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11752 on the name without any prefixes of namespace names etc. This is because we
11753 already might have something already fully qualified like
11754 'System.Console.WriteLine'
11756 * assign.cs (Resolve): Begin implementation. Stuck ;-)
11758 2001-09-07 Ravi Pratap <ravi@ximian.com>
11760 * cs-tokenizer.cs (location): Return a string which also contains
11763 * expression.cs (ElementAccess): New class for expressions of the
11764 type 'element access.'
11765 (BaseAccess): New class for expressions of the type 'base access.'
11766 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11769 * cs-parser.jay (element_access): Implement action.
11770 (base_access): Implement actions.
11771 (checked_expression, unchecked_expression): Implement.
11773 * cs-parser.jay (local_variable_type): Correct and implement.
11774 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11776 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11778 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11779 name and the specifiers.
11781 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11783 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
11784 making them all public ;-)
11786 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11789 2001-09-07 Miguel de Icaza <miguel@ximian.com>
11791 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11793 (FieldExpr, PropertyExprs): New resolved expressions.
11794 (SimpleName::MemberStaticCheck): Perform static checks for access
11795 to non-static fields on static methods. Maybe this should be
11796 generalized for MemberAccesses.
11797 (SimpleName::ResolveSimpleName): More work on simple name
11800 * cs-parser.jay (primary_expression/qualified_identifier): track
11801 the parameter index.
11803 * codegen.cs (CodeGen::Save): Catch save exception, report error.
11804 (EmitContext::EmitBoolExpression): Chain to expression generation
11805 instead of temporary hack.
11806 (::EmitStatementExpression): Put generic expression code generation.
11808 * assign.cs (Assign::Emit): Implement variable assignments to
11809 local variables, parameters and fields.
11811 2001-09-06 Miguel de Icaza <miguel@ximian.com>
11813 * statement.cs (Block::GetVariableInfo): New method, returns the
11814 VariableInfo for a variable name in a block.
11815 (Block::GetVariableType): Implement in terms of GetVariableInfo
11817 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
11818 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
11820 2001-09-06 Ravi Pratap <ravi@ximian.com>
11822 * cs-parser.jay (operator_declaration): Continue on my quest : update
11823 to take attributes argument.
11824 (event_declaration): Ditto.
11825 (enum_declaration): Ditto.
11826 (indexer_declaration): Ditto.
11828 * class.cs (Operator::Operator): Update constructor accordingly.
11829 (Event::Event): Ditto.
11831 * delegate.cs (Delegate::Delegate): Same here.
11833 * enum.cs (Enum::Enum): Same here.
11835 2001-09-05 Ravi Pratap <ravi@ximian.com>
11837 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
11839 * ../tests/cs0658.cs : New file to demonstrate error 0658.
11841 * attribute.cs (Attributes): New class to encapsulate all attributes which were
11842 being passed around as an arraylist.
11843 (Attributes::AddAttribute): Method to add attribute sections.
11845 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
11846 (struct_declaration): Update accordingly.
11847 (constant_declaration): Update.
11848 (field_declaration): Update.
11849 (method_header): Update.
11850 (fixed_parameter): Update.
11851 (parameter_array): Ditto.
11852 (property_declaration): Ditto.
11853 (destructor_declaration): Ditto.
11855 * class.cs (Struct::Struct): Update constructors accordingly.
11856 (Class::Class): Ditto.
11857 (Field::Field): Ditto.
11858 (Method::Method): Ditto.
11859 (Property::Property): Ditto.
11860 (TypeContainer::OptAttribute): update property's return type.
11862 * interface.cs (Interface.opt_attributes): New member.
11863 (Interface::Interface): Update to take the extra Attributes argument.
11865 * parameter.cs (Parameter::Parameter): Ditto.
11867 * constant.cs (Constant::Constant): Ditto.
11869 * interface.cs (InterfaceMemberBase): New OptAttributes field.
11870 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
11871 the attributes as a parameter.
11872 (InterfaceProperty): Update constructor call.
11873 (InterfaceEvent): Ditto.
11874 (InterfaceMethod): Ditto.
11875 (InterfaceIndexer): Ditto.
11877 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
11878 pass the attributes too.
11879 (interface_event_declaration): Ditto.
11880 (interface_property_declaration): Ditto.
11881 (interface_method_declaration): Ditto.
11882 (interface_declaration): Ditto.
11884 2001-09-05 Miguel de Icaza <miguel@ximian.com>
11886 * class.cs (Method::Define): Track the "static Main" definition to
11887 create an entry point.
11889 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11890 EntryPoint if we find it.
11892 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11893 (EmitContext::ig): Make this variable public.
11895 * driver.cs: Make the default output file be the first file name
11896 with the .exe extension.
11898 Detect empty compilations
11900 Handle various kinds of output targets. Handle --target and
11901 rename -t to --dumper.
11903 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11904 methods inherited from Expression return now an Expression. This
11905 will is used during the tree rewriting as we resolve them during
11908 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11909 the spec. Missing entirely is the information about
11910 accessability of elements of it.
11912 (Expression::ExprClassFromMemberInfo): New constructor for
11913 Expressions that creates a fully initialized Expression based on
11914 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11917 (Invocation::Resolve): Begin implementing resolution of invocations.
11919 * literal.cs (StringLiteral): Implement Emit.
11921 2001-09-05 Ravi Pratap <ravi@ximian.com>
11923 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
11926 2001-09-04 Ravi Pratap <ravi@ximian.com>
11928 * cs-parser.jay (attribute_arguments): Implement actions.
11929 (attribute): Fix bug in production. Implement action.
11930 (attribute_list): Implement.
11931 (attribute_target): Implement.
11932 (attribute_target_specifier, opt_target_specifier): Implement
11933 (CheckAttributeTarget): New method to check if the attribute target
11935 (attribute_section): Implement.
11936 (opt_attributes): Implement.
11938 * attribute.cs : New file to handle attributes.
11939 (Attribute): Class to hold attribute info.
11941 * cs-parser.jay (opt_attribute_target_specifier): Remove production
11942 (attribute_section): Modify production to use 2 different rules to
11943 achieve the same thing. 1 s/r conflict down !
11944 Clean out commented, useless, non-reducing dimension_separator rules.
11946 * class.cs (TypeContainer.attributes): New member to hold list
11947 of attributes for a type.
11948 (Struct::Struct): Modify to take one more argument, the attribute list.
11949 (Class::Class): Ditto.
11950 (Field::Field): Ditto.
11951 (Method::Method): Ditto.
11952 (Property::Property): Ditto.
11954 * cs-parser.jay (struct_declaration): Update constructor call to
11955 pass in the attributes too.
11956 (class_declaration): Ditto.
11957 (constant_declaration): Ditto.
11958 (field_declaration): Ditto.
11959 (method_header): Ditto.
11960 (fixed_parameter): Ditto.
11961 (parameter_array): Ditto.
11962 (property_declaration): Ditto.
11964 * constant.cs (Constant::Constant): Update constructor similarly.
11965 Use System.Collections.
11967 * parameter.cs (Parameter::Parameter): Update as above.
11969 2001-09-02 Ravi Pratap <ravi@ximian.com>
11971 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
11972 (TypeContainer.delegates): New member to hold list of delegates.
11974 * cs-parser.jay (delegate_declaration): Implement the action correctly
11975 this time as I seem to be on crack ;-)
11977 2001-09-02 Miguel de Icaza <miguel@ximian.com>
11979 * rootcontext.cs (RootContext::IsNamespace): new function, used to
11980 tell whether an identifier represents a namespace.
11982 * expression.cs (NamespaceExpr): A namespace expression, used only
11983 temporarly during expression resolution.
11984 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
11985 utility functions to resolve names on expressions.
11987 2001-09-01 Miguel de Icaza <miguel@ximian.com>
11989 * codegen.cs: Add hook for StatementExpressions.
11991 * class.cs: Fix inverted test for static flag in methods.
11993 2001-09-02 Ravi Pratap <ravi@ximian.com>
11995 * class.cs (Operator::CheckUnaryOperator): Correct error number used
11996 to make it coincide with MS' number.
11997 (Operator::CheckBinaryOperator): Ditto.
11999 * ../errors/errors.txt : Remove error numbers added earlier.
12001 * ../errors/cs1019.cs : Test case for error # 1019
12003 * ../errros/cs1020.cs : Test case for error # 1020
12005 * cs-parser.jay : Clean out commented cruft.
12006 (dimension_separators, dimension_separator): Comment out. Ostensibly not
12007 used anywhere - non-reducing rule.
12008 (namespace_declarations): Non-reducing rule - comment out.
12010 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12011 with TypeContainer::AddEnum.
12013 * delegate.cs : New file for delegate handling classes.
12014 (Delegate): Class for declaring delegates.
12016 * makefile : Update.
12018 * cs-parser.jay (delegate_declaration): Implement.
12020 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
12022 * class.cs (Event::Define): Implement.
12023 (Event.EventBuilder): New member.
12025 * class.cs (TypeContainer::Populate): Update to define all enums and events
12027 (Events): New property for the events arraylist we hold. Shouldn't we move to using
12028 readonly fields for all these cases ?
12030 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12032 * class.cs (Property): Revamp to use the convention of making fields readonly.
12033 Accordingly modify code elsewhere.
12035 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12036 the Define method of the Property class.
12038 * class.cs : Clean up applied patch and update references to variables etc. Fix
12040 (TypeContainer::Populate): Update to define all the properties we have. Also
12041 define all enumerations.
12043 * enum.cs (Define): Implement.
12045 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12047 * cs-parser.jay (overloadable_operator): The semantic value is an
12048 enum of the Operator class.
12049 (operator_declarator): Implement actions.
12050 (operator_declaration): Implement.
12052 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12053 validity of definitions.
12054 (Operator::CheckBinaryOperator): Static method to check for binary operators
12055 (TypeContainer::AddOperator): New method to add an operator to a type.
12057 * cs-parser.jay (indexer_declaration): Added line to actually call the
12058 AddIndexer method so it gets added ;-)
12060 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
12061 already taken care of by the MS compiler ?
12063 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12065 * class.cs (Operator): New class for operator declarations.
12066 (Operator::OpType): Enum for the various operators.
12068 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12070 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12071 ostensibly handle this in semantic analysis.
12073 * cs-parser.jay (general_catch_clause): Comment out
12074 (specific_catch_clauses, specific_catch_clause): Ditto.
12075 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12076 (catch_args, opt_catch_args): New productions.
12077 (catch_clause): Rewrite to use the new productions above
12078 (catch_clauses): Modify accordingly.
12079 (opt_catch_clauses): New production to use in try_statement
12080 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12081 and re-write the code in the actions to extract the specific and
12082 general catch clauses by being a little smart ;-)
12084 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12085 Hooray, try and catch statements parse fine !
12087 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12089 * statement.cs (Block::GetVariableType): Fix logic to extract the type
12090 string from the hashtable of variables.
12092 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12093 I end up making that mistake ;-)
12094 (catch_clauses): Fixed gross error which made Key and Value of the
12095 DictionaryEntry the same : $1 !!
12097 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12099 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12101 * cs-parser.jay (event_declaration): Correct to remove the semicolon
12102 when the add and remove accessors are specified.
12104 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12106 * cs-parser.jay (IndexerDeclaration): New helper class to hold
12107 information about indexer_declarator.
12108 (indexer_declarator): Implement actions.
12109 (parsing_indexer): New local boolean used to keep track of whether
12110 we are parsing indexers or properties. This is necessary because
12111 implicit_parameters come into picture even for the get accessor in the
12112 case of an indexer.
12113 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12115 * class.cs (Indexer): New class for indexer declarations.
12116 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12117 (TypeContainer::indexers): New member to hold list of indexers for the
12120 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12122 * cs-parser.jay (add_accessor_declaration): Implement action.
12123 (remove_accessor_declaration): Implement action.
12124 (event_accessors_declaration): Implement
12125 (variable_declarators): swap statements for first rule - trivial.
12127 * class.cs (Event): New class to hold information about event
12129 (TypeContainer::AddEvent): New method to add an event to a type
12130 (TypeContainer::events): New member to hold list of events.
12132 * cs-parser.jay (event_declaration): Implement actions.
12134 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12136 * cs-parser.jay (dim_separators): Implement. Make it a string
12137 concatenating all the commas together, just as they appear.
12138 (opt_dim_separators): Modify accordingly
12139 (rank_specifiers): Update accordingly. Basically do the same
12140 thing - instead, collect the brackets here.
12141 (opt_rank_sepcifiers): Modify accordingly.
12142 (array_type): Modify to actually return the complete type string
12143 instead of ignoring the rank_specifiers.
12144 (expression_list): Implement to collect the expressions
12145 (variable_initializer): Implement. We make it a list of expressions
12146 essentially so that we can handle the array_initializer case neatly too.
12147 (variable_initializer_list): Implement.
12148 (array_initializer): Make it a list of variable_initializers
12149 (opt_array_initializer): Modify accordingly.
12151 * expression.cs (New::NType): Add enumeration to help us
12152 keep track of whether we have an object/delegate creation
12153 or an array creation.
12154 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12155 members to hold data about array creation.
12156 (New:New): Modify to update NewType
12157 (New:New): New Overloaded contructor for the array creation
12160 * cs-parser.jay (array_creation_expression): Implement to call
12161 the overloaded New constructor.
12163 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12165 * class.cs (TypeContainer::Constructors): Return member
12166 constructors instead of returning null.
12168 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12170 * typemanager.cs (InitCoreTypes): Initialize the various core
12171 types after we have populated the type manager with the user
12172 defined types (this distinction will be important later while
12173 compiling corlib.dll)
12175 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12176 on Expression Classification. Now all expressions have a method
12177 `Resolve' and a method `Emit'.
12179 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12180 generation from working. Also add some temporary debugging
12183 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12185 * codegen.cs: Lots of code generation pieces. This is only the
12186 beginning, will continue tomorrow with more touches of polish. We
12187 handle the fundamentals of if, while, do, for, return. Others are
12188 trickier and I need to start working on invocations soon.
12190 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12193 * codegen.cs (EmitContext): New struct, used during code
12194 emission to keep a context. Most of the code generation will be
12197 * cs-parser.jay: Add embedded blocks to the list of statements of
12198 this block. So code generation proceeds in a top down fashion.
12200 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12202 * statement.cs: Add support for multiple child blocks.
12204 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12206 * codegen.cs (EmitCode): New function, will emit the code for a
12207 Block of code given a TypeContainer and its ILGenerator.
12209 * statement.cs (Block): Standard public readonly optimization.
12210 (Block::Block constructors): Link children.
12211 (Block::Child): Child Linker.
12212 (Block::EmitVariables): Emits IL variable declarations.
12214 * class.cs: Drop support for MethodGroups here, delay until
12216 (Method::): Applied the same simplification that I did before, and
12217 move from Properties to public readonly fields.
12218 (Method::ParameterTypes): Returns the parameter types for the
12219 function, and implements a cache that will be useful later when I
12220 do error checking and the semantic analysis on the methods is
12222 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12223 and made a method, optional argument tells whether this is a class
12224 or a structure to apply the `has-this' bit.
12225 (Method::GetCallingConvention): Implement, returns the calling
12227 (Method::Define): Defines the type, a second pass is performed
12228 later to populate the methods.
12230 (Constructor::ParameterTypes): implement a cache similar to the
12231 one on Method::ParameterTypes, useful later when we do semantic
12234 (TypeContainer::EmitMethod): New method. Emits methods.
12236 * expression.cs: Removed MethodGroup class from here.
12238 * parameter.cs (Parameters::GetCallingConvention): new method.
12240 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12242 * class.cs (TypeContainer::Populate): Drop RootContext from the
12245 (Constructor::CallingConvention): Returns the calling convention.
12246 (Constructor::ParameterTypes): Returns the constructor parameter
12249 (TypeContainer::AddConstructor): Keep track of default constructor
12250 and the default static constructor.
12252 (Constructor::) Another class that starts using `public readonly'
12253 instead of properties.
12255 (Constructor::IsDefault): Whether this is a default constructor.
12257 (Field::) use readonly public fields instead of properties also.
12259 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12260 track of static constructors; If none is used, turn on
12261 BeforeFieldInit in the TypeAttributes.
12263 * cs-parser.jay (opt_argument_list): now the return can be null
12264 for the cases where there are no arguments.
12266 (constructor_declarator): If there is no implicit `base' or
12267 `this', then invoke the default parent constructor.
12269 * modifiers.cs (MethodAttr): New static function maps a set of
12270 modifiers flags into a MethodAttributes enum
12271 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12272 MethodAttr, TypeAttr to represent the various mappings where the
12273 modifiers are used.
12274 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12276 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12278 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12281 * interface.cs (PopulateIndexer): Implemented the code generator
12282 for interface indexers.
12284 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12286 * interface.cs (InterfaceMemberBase): Now we track the new status
12289 (PopulateProperty): Implement property population. Woohoo! Got
12290 Methods and Properties going today.
12292 Removed all the properties for interfaces, and replaced them with
12293 `public readonly' fields.
12295 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12297 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12298 initialize their hashtables/arraylists only when they are needed
12299 instead of doing this always.
12301 * parameter.cs: Handle refs and out parameters.
12303 * cs-parser.jay: Use an ArrayList to construct the arguments
12304 instead of the ParameterCollection, and then cast that to a
12307 * parameter.cs: Drop the use of ParameterCollection and use
12308 instead arrays of Parameters.
12310 (GetParameterInfo): Use the Type, not the Name when resolving
12313 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12315 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12316 and instead use public readonly fields.
12318 * class.cs: Put back walking code for type containers.
12320 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12322 * class.cs (MakeConstant): Code to define constants.
12324 * rootcontext.cs (LookupType): New function. Used to locate types
12327 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12329 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12330 this System.Reflection code is. Kudos to Microsoft
12332 * typemanager.cs: Implement a type cache and avoid loading all
12333 types at boot time. Wrap in LookupType the internals. This made
12334 the compiler so much faster. Wow. I rule!
12336 * driver.cs: Make sure we always load mscorlib first (for
12337 debugging purposes, nothing really important).
12339 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12340 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12342 * rootcontext.cs: Lookup types on their namespace; Lookup types
12343 on namespaces that have been imported using the `using' keyword.
12345 * class.cs (TypeContainer::TypeAttr): Virtualize.
12346 (Class::TypeAttr): Return attributes suitable for this bad boy.
12347 (Struct::TypeAttr): ditto.
12348 Handle nested classes.
12349 (TypeContainer::) Remove all the type visiting code, it is now
12350 replaced with the rootcontext.cs code
12352 * rootcontext.cs (GetClassBases): Added support for structs.
12354 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12356 * interface.cs, statement.cs, class.cs, parameter.cs,
12357 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12358 Drop use of TypeRefs, and use strings instead.
12360 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12364 * class.cs (Struct::Struct): set the SEALED flags after
12365 checking the modifiers.
12366 (TypeContainer::TypeAttr): new property, returns the
12367 TypeAttributes for a class.
12369 * cs-parser.jay (type_list): Oops, list production was creating a
12370 new list of base types.
12372 * rootcontext.cs (StdLib): New property.
12373 (GetInterfaceTypeByName): returns an interface by type name, and
12374 encapsulates error handling here.
12375 (GetInterfaces): simplified.
12376 (ResolveTree): Encapsulated all the tree resolution here.
12377 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12380 * driver.cs: Add support for --nostdlib, to avoid loading the
12381 default assemblies.
12382 (Main): Do not put tree resolution here.
12384 * rootcontext.cs: Beginning of the class resolution.
12386 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12388 * rootcontext.cs: Provide better error reporting.
12390 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12392 * rootcontext.cs (CreateInterface): Handle the case where there
12393 are no parent interfaces.
12395 (CloseTypes): Routine to flush types at the end.
12396 (CreateInterface): Track types.
12397 (GetInterfaces): Returns an array of Types from the list of
12398 defined interfaces.
12400 * typemanager.c (AddUserType): Mechanism to track user types (puts
12401 the type on the global type hash, and allows us to close it at the
12404 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12406 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12407 RecordInterface instead.
12409 * cs-parser.jay: Updated to reflect changes above.
12411 * decl.cs (Definition): Keep track of the TypeBuilder type that
12412 represents this type here. Not sure we will use it in the long
12413 run, but wont hurt for now.
12415 * driver.cs: Smaller changes to accomodate the new code.
12417 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12420 * rootcontext.cs (CreateInterface): New method, used to create
12421 the System.TypeBuilder type for interfaces.
12422 (ResolveInterfaces): new entry point to resolve the interface
12424 (CodeGen): Property, used to keep track of the code generator.
12426 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12428 * cs-parser.jay: Add a second production for delegate_declaration
12431 (enum_body): Put an opt_comma here instead of putting it on
12432 enum_body or enum_member_declarations so we can handle trailing
12433 commas on enumeration members. Gets rid of a shift/reduce.
12435 (type_list): Need a COMMA in the middle.
12437 (indexer_declaration): Tell tokenizer to recognize get/set
12439 * Remove old targets.
12441 * Re-add the parser target.
12443 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12445 * cs-parser.jay: Add precendence rules for a number of operators
12446 ot reduce the number of shift/reduce conflicts in the grammar.
12448 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12450 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12453 Get rid of old crufty code.
12455 * rootcontext.cs: Use this to keep track of the parsed
12456 representation and the defined types available to the program.
12458 * gen-treedump.cs: adjust for new convention.
12460 * type.cs: Split out the type manager, and the assembly builder
12463 * typemanager.cs: the type manager will live here now.
12465 * cil-codegen.cs: And the code generator here.
12467 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12469 * makefile: Fixed up for easy making.
12471 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12473 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12476 (unary_expression): Expand pre_increment_expression and
12477 post_decrement_expression to reduce a shift/reduce.
12479 2001-07-11 Simon Cozens
12481 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12483 Improve allow_keyword_as_indent name.
12485 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12487 * Adjustments for Beta2.
12489 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12491 * decl.cs: Added `Define' abstract method.
12492 (InTransit): new property, used to catch recursive definitions.
12494 * interface.cs: Implement `Define'.
12496 * modifiers.cs: Map Modifiers.constants to
12497 System.Reflection.TypeAttribute flags.
12499 * class.cs: Keep track of types and user-defined types.
12500 (BuilderInit): New method for creating an assembly
12501 (ResolveType): New function to launch the resolution process, only
12502 used by interfaces for now.
12504 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12505 that are inserted into the name space.
12507 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12509 * ARGH. I have screwed up my tree so many times due to the use of
12510 rsync rather than using CVS. Going to fix this at once.
12512 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12515 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12517 * Experiment successful: Use System.Type rather that our own
12520 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12522 * cs-parser.jay: Removed nsAliases from here.
12524 Use new namespaces, handle `using XXX;'
12526 * namespace.cs: Reimplemented namespace handling, use a recursive
12527 definition of the class. Now we can keep track of using clauses
12528 and catch invalid using clauses.
12530 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12532 * gen-treedump.cs: Adapted for all the renaming.
12534 * expression.cs (Expression): this class now has a Type property
12535 which returns an expression Type.
12537 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12538 `Type', as this has a different meaning now in the base
12540 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12542 * interface.cs, class.cs: Removed from all the sources the
12543 references to signature computation, as we can not do method
12544 signature computation during the parsing time, as we are not
12545 trying to solve at that point distinguishing:
12549 void a (NS.Blah x) {}
12552 Which depending on the context might be valid or not, as we do not
12553 know if Blah is the same thing as NS.Blah at that point.
12555 * Redid everything so the code uses TypeRefs now instead of
12556 Types. TypeRefs are just temporary type placeholders, that need
12557 to be resolved. They initially have a pointer to a string and the
12558 current scope in which they are used. This is used later by the
12559 compiler to resolve the reference to an actual Type.
12561 * DeclSpace is no longer a CIR.Type, and neither are
12562 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12563 are all DeclSpaces, but no Types.
12565 * type.cs (TypeRefManager): This implements the TypeRef manager,
12566 which keeps track of all the types that need to be resolved after
12567 the parsing has finished.
12569 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12571 * ARGH. We are going to have to store `foreach' as a class rather
12572 than resolving it, as we need to verify error 1579 after name
12573 resolution. *OR* we could keep a flag that says `This request to
12574 IEnumerator comes from a foreach statement' which we can then use
12575 to generate the error.
12577 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12579 * class.cs (TypeContainer.AddMethod): we now add methods to the
12580 MethodGroup instead of the method hashtable.
12582 * expression.cs: Add MethodGroup abstraction, which gets us one
12583 step closer to the specification in the way we handle method
12586 * cs-parser.jay (primary_expression): qualified_identifier now
12587 tried to match up an identifier to a local variable reference or
12588 to a parameter reference.
12590 current_local_parameters is now a parser global variable that
12591 points to the current parameters for the block, used during name
12594 (property_declaration): Now creates an implicit `value' argument to
12597 2001-05-09 Miguel de Icaza <miguel@ximian.com>
12599 * parameter.cs: Do not use `param' arguments as part of the
12600 signature, per the spec.
12602 2001-05-08 Miguel de Icaza <miguel@ximian.com>
12604 * decl.cs: Base class for classes, structs and interfaces. This
12605 is the "Declaration Space"
12607 * cs-parser.jay: Use CheckDef for checking declaration errors
12608 instead of having one on each function.
12610 * class.cs: Factor out some code for handling error handling in
12611 accordance to the "Declarations" section in the "Basic Concepts"
12612 chapter in the ECMA C# spec.
12614 * interface.cs: Make all interface member classes derive from
12615 InterfaceMemberBase.
12617 2001-05-07 Miguel de Icaza <miguel@ximian.com>
12619 * Many things: all interfaces are parsed and generated in
12620 gen-treedump. Support for member variables, constructors,
12621 destructors, properties, constants is there.
12623 Beginning of the IL backend, but very little done, just there for
12626 2001-04-29 Miguel de Icaza <miguel@ximian.com>
12628 * cs-parser.jay: Fix labeled statement.
12630 * cs-tokenizer.cs (escape): Escape " and ' always.
12631 ref_line, ref_name: keep track of the line/filename as instructed
12632 by #line by the compiler.
12635 2001-04-27 Miguel de Icaza <miguel@ximian.com>
12637 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12638 to match the values in System.CodeDOM.
12640 Divid renamed to Divide.
12642 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12644 (Statements.set): remove.
12646 * System.CodeDOM/CodeCatchClause.cs: always have a valid
12649 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12650 falseStatements always have valid values.
12652 * cs-parser.jay: Use System.CodeDOM now.