2003-08-22 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-08-22  Martin Baulig  <martin@ximian.com>
2
3         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4         correctly; fixes #47722.
5
6 2003-08-22  Martin Baulig  <martin@ximian.com>
7
8         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
9         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
10
11         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
12
13 2003-08-22  Martin Baulig  <martin@ximian.com>
14
15         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
16         can only be assigned in static constructors.  Fixes #47161.
17
18 2003-08-22  Martin Baulig  <martin@ximian.com>
19
20         Rewrote and improved the flow analysis code.
21
22         * flowbranching.cs (FlowBranching): Make this class abstract.
23         (FlowBranching.CreateBranching): New static function to create a
24         new flow branching.
25         (FlowBranchingBlock, FlowBranchingException): New classes.
26         (FlowBranching.UsageVector.Type): New public readonly field.
27         (FlowBranching.UsageVector.Breaks): Removed the setter.
28         (FlowBranching.UsageVector.Returns): Removed the setter.
29         (FlowBranching.UsageVector): Added Break(), Return(),
30         NeverReachable() and Throw() methods to modify the reachability.
31         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
32         done by FlowBranching.Merge().
33         (FlowBranching.UsageVector.MergeChild): New method; merges the
34         merge result into the current vector.
35         (FlowBranching.Merge): New abstract method to merge a branching.
36
37 2003-08-12  Martin Baulig  <martin@ximian.com>
38
39         * expression.cs (Indirection.CacheTemporaries): Create the
40         LocalTemporary with the pointer type, not its element type.
41
42 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
43
44         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
45         token was a keyword or not.
46
47         Add `error' options where an IDENTIFIER was expected;  Provide
48         CheckToken and CheckIdentifierToken convenience error reporting
49         functions. 
50
51         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
52
53         * decl.cs: Rename `NamespaceEntry Namespace' public field into
54         NameSpaceEntry NameSpaceEntry.
55
56         (LookupInterfaceOrClass): Avoid creating a full qualified name
57         from namespace and name: avoid doing lookups when we know the
58         namespace is non-existant.   Use new Tree.LookupByNamespace which
59         looks up DeclSpaces based on their namespace, name pair.
60
61         * driver.cs: Provide a new `parser verbose' to display the
62         exception thrown during parsing.  This is turned off by default
63         now, so the output of a failure from mcs is more graceful.
64
65         * namespace.cs: Track all the namespaces defined in a hashtable
66         for quick lookup.
67         
68         (IsNamespace): New method
69
70 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
71
72         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
73         we know that we need to concatenate (full typename can never be
74         null). 
75
76         * class.cs: ditto.
77
78         * statement.cs: Use a bitfield;  Do not initialize to null things
79         which are done by the constructor by default.
80
81         * cs-parser.jay: bug fix, parameter was 4, not 3.
82
83         * expression.cs: Just use the property;
84
85         * statement.cs: No need for GetVariableInfo method.
86
87 2003-08-08  Martin Baulig  <martin@ximian.com>
88
89         * flowanalysis.cs (FlowReturns): This is now nested in the
90         `FlowBranching' class.
91         (MyBitVector): Moved this here from statement.cs.
92         (FlowBranching.SiblingType): New enum type.
93         (FlowBranching.CreateSibling): Added `SiblingType' argument.
94
95 2003-08-07  Martin Baulig  <martin@ximian.com>
96
97         * flowanalysis.cs (FlowBranchingType): This is now nested in the
98         `FlowBranching' class and called `BranchingType'.
99
100 2003-08-07  Martin Baulig  <martin@ximian.com>
101
102         * flowanalysis.cs: Moved all the control flow analysis code into
103         its own file.
104
105 2003-08-07  Martin Baulig  <martin@ximian.com>
106
107         * assign.cs (Assign.DoResolve): `target' must either be an
108         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
109         #37319.
110
111 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
112
113         * expression.cs (BinaryMethod): This kind of expression is created by the
114         Binary class if it determines that the operator has to be handled
115         by a method.
116
117         (BinaryDelegate): This kind of expression is created if we are
118         dealing with a + or - operator on delegates.
119
120         (Binary): remove method, argumetns, and DelegateOperator: when
121         dealing with methods, 
122         
123         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
124
125         * statement.cs (Block): use bitfields for the three extra booleans
126         we had in use.   Remove unused topblock parameter.
127
128         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
129
130         * assign.cs: Drop extra unneeded tests.
131
132 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
133
134         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
135
136         * statement.cs (Foreach): Use VariableStorage instead of
137         LocalBuilders.   
138
139         * codegen.cs (VariableStorage): New class used by clients that
140         require a variable stored: locals or fields for variables that
141         need to live across yield.
142
143         Maybe provide a convenience api for EmitThis+EmitLoad?
144
145         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
146         these bad boys.
147
148 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
149
150         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
151         RemapParameterLValue): New methods that are used to turn a
152         precomputed FieldInfo into an expression like this:
153
154                 instance.FieldInfo
155
156         The idea is to use this instead of making LocalVariableReference
157         have more than one meaning.
158
159         * cs-parser.jay: Add error production to BASE.
160
161         * ecore.cs: Deal with TypeManager.GetField returning null, which
162         is now a valid return value.
163
164         (FieldExprNoAddress): New expression for Fields whose address can
165         not be taken.
166
167         * expression.cs (LocalVariableReference): During the resolve
168         phases, create new expressions if we are in a remapping context.
169         Remove code that dealt with remapping here.
170
171         (ParameterReference): same.
172
173         (ProxyInstance): New expression, like the `This' expression, but
174         it is born fully resolved.  We know what we are doing, so remove
175         the errors that are targeted to user-provided uses of `this'.
176
177         * statement.cs (Foreach): our variable is now stored as an
178         Expression;  During resolution, follow the protocol, dont just
179         assume it will return this.
180         
181 2003-08-06  Martin Baulig  <martin@ximian.com>
182
183         * support.cs (SeekableStreamReader.cs): New public class.
184
185         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
186         SeekableStreamReader instead of the normal StreamReader.
187
188 2003-08-04  Martin Baulig  <martin@ximian.com>
189
190         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
191         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
192         deambiguate casts and delegate invocations.
193         (parenthesized_expression): Use the new tokens to ensure this is
194         not a cast of method invocation.
195
196         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
197         when reading a `)' and Deambiguate_CloseParens () was previously
198         called.
199
200         * expression.cs (ParenthesizedExpression): New class.  This is
201         just used for the CS0075 test.
202         (Binary.DoResolve): Check for CS0075.   
203
204 2003-07-29  Ravi Pratap  <ravi@ximian.com>
205
206         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
207         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
208         reference comparison.
209
210         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
211         examine the ReturnType for equality - this is necessary in the
212         cases of implicit and explicit operators whose signature also
213         includes the return type.
214
215 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
216
217         * namespace.cs: Cache the result of the namespace computation,
218         instead of computing it every time.
219
220 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
221
222         * decl.cs: Use a global arraylist that we reuse over invocations
223         to avoid excesive memory consumption.  Reduces memory usage on an
224         mcs compile by one meg (45 average).
225
226         * typemanager.cs (LookupTypeReflection): In .NET pointers are
227         private, work around that.
228
229 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
230
231         * literal.cs (IntLiteral): Define Zero and One static literals. 
232
233         * cs-parser.jay (integer_literal): use static literals to reduce
234         memory usage for the most used literals (0, 1 and -1).  211kb
235         reduced in memory usage.
236
237         Replace all calls to `new ArrayList' with `new
238         ArrayList(4)' which is a good average number for most allocations,
239         and also requires only 16 bytes of memory for its buffer by
240         default. 
241
242         This reduced MCS memory usage in seven megabytes for the RSS after
243         bootstrapping.
244
245 2003-07-28  Ravi Pratap  <ravi@ximian.com>
246
247         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
248         handle params methods the correct way by forming only one
249         applicable set with params and normal methods in them. Earlier we
250         were looking at params methods only if we found no normal methods
251         which was not the correct thing to do.
252
253         (Invocation.BetterFunction): Take separate arguments indicating
254         when candidate and the best method are params methods in their
255         expanded form.
256
257         This fixes bugs #43367 and #46199.
258
259         * attribute.cs: Documentation updates.
260
261         (CheckAttribute): Rename to CheckAttributeTarget.
262         (GetValidPlaces): Rename to GetValidTargets.
263
264         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
265         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
266
267         Fixes bug #44468.
268
269 2003-07-28  Martin Baulig  <martin@ximian.com>
270
271         * class.cs (TypeContainer.DefineMembers): Use the base type's full
272         name when looking up the base class of a nested class.  Fixes #46977.
273
274 2003-07-26  Martin Baulig  <martin@ximian.com>
275
276         * expression.cs (Indexers.Indexer): New nested struct; contains
277         getter, setter and the indexer's type.
278         (Indexers.Properties): This is now an ArrayList of
279         Indexers.Indexer's.
280         (IndexerAccess.DoResolveLValue): Correctly set the type if the
281         indexer doesn't have any getters.
282
283         * assign.cs (Assign.DoResolve): Also do the implicit conversions
284         for embedded property and indexer assignments.
285
286 2003-07-26  Martin Baulig  <martin@ximian.com>
287
288         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
289         preprocessor directive is not the first non-whitespace character
290         on a line.
291
292 2003-07-26  Martin Baulig  <martin@ximian.com>
293
294         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
295         namespace parsing, follow the spec more closely.
296
297         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
298         NamespaceEntry.Lookup().
299
300 2003-07-25  Martin Baulig  <martin@ximian.com>
301
302         * MethodCore.cs (OverridesSomething): New public field; it's set
303         from TypeContainer.DefineMembers if this method overrides
304         something (which doesn't need to be a method).  Fix #39462.
305
306 2003-07-25  Ravi Pratap  <ravi@ximian.com>
307
308         * typemanager.cs (GetMembers): Ensure that the list of members is
309         reversed. This keeps things in sync.
310
311         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
312         find an AttributeUsage attribute.
313
314         * expression.cs (Invocation.OverloadResolve): Perform the check
315         which disallows Invoke to be directly called on a Delegate.
316
317         (Error_InvokeOnDelegate): Report error cs1533.
318         
319 2003-07-25  Martin Baulig  <martin@ximian.com>
320
321         * expression.cs (Indexers.GetIndexersForType): Only look in the
322         interface hierarchy if the requested type is already an
323         interface.  Fixes #46788 while keeping #46502 fixed.
324
325 2003-07-25  Martin Baulig  <martin@ximian.com>
326
327         * class.cs (TypeContainer.DefineMembers): Check whether all
328         readonly fields have been assigned and report warning CS0649 if
329         not.
330
331         * statement.cs (LocalInfo.IsFixed): Always return true if this is
332         a valuetype.
333
334 2003-07-24  Ravi Pratap  <ravi@ximian.com>
335
336         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
337         returned from GetMethods to make things consistent with the
338         assumptions MCS makes about ordering of methods.
339
340         This should comprehensively fix bug #45127 and it does :-)
341
342         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
343         ordering is actually reverse.
344
345         * Clean up some debug messages I left lying around.
346
347         * interface.cs (Populate*): Get rid of code which emits attributes
348         since the stage in which we emit attributes is the 'Emit' stage,
349         not the define stage.
350
351         (Emit): Move attribute emission for interface members here.
352         
353 2003-07-22  Ravi Pratap  <ravi@ximian.com>
354
355         * expression.cs (Invocation.OverloadResolve): Follow the spec more
356         closely: we eliminate methods in base types when we have an
357         applicable method in a top-level type.
358
359         Please see section 14.5.5.1 for an exact description of what goes
360         on. 
361
362         This fixes bug #45127 and a host of other related to corlib compilation.
363
364         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
365         array is the method corresponding to the top-level type (this is
366         because of the changes made to icall.c) so we change this
367         accordingly.
368
369         (MethodGroupExpr.Name): This too.
370
371         * typemanager.cs (GetElementType): New method which does the right
372         thing when compiling corlib. 
373
374         * everywhere: Make use of the above in the relevant places.
375
376 2003-07-22  Martin Baulig  <martin@ximian.com>
377
378         * cs-parser.jay (invocation_expression): Moved
379         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
380         `cast_expression', but create a InvocationOrCast which later
381         resolves to either an Invocation or a Cast.
382
383         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
384         method; call this before EmitStatement() to make sure that this
385         expression can be used as a statement.
386
387         * expression.cs (InvocationOrCast): New class; resolves to either
388         an Invocation or a Cast.
389
390         * statement.cs (StatementExpression): Call ResolveStatement() on
391         the ExpressionStatement before emitting it.
392
393 2003-07-21  Martin Baulig  <martin@ximian.com>
394
395         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
396         `ref' and `out' attributes match; fixes #46220.
397         (MemberAccess.ResolveMemberAccess): You can't reference a type
398         through an expression; fixes #33180.
399         (Indexers.GetIndexersForType): Don't return the indexers from
400         interfaces the class implements; fixes #46502.
401
402 2003-07-21  Martin Baulig  <martin@ximian.com>
403
404         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
405         CS0661 checks; fixes bug #30442.
406
407 2003-07-21  Martin Baulig  <martin@ximian.com>
408
409         * decl.cs (AdditionResult): Added `Error'.
410
411         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
412
413         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
414         makes cs0031.cs actually work.
415
416 2003-07-20  Martin Baulig  <martin@ximian.com>
417
418         * namespace.cs: Fixed that bug which caused a crash when compiling
419         the debugger's GUI.
420
421 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
422
423         * typemanager.cs (LookupTypeReflection): Never expose types which
424         are NotPublic, NestedPrivate, NestedAssembly, or
425         NestedFamANDAssem.  We used to return these, and later do a check
426         that would report a meaningful error, but the problem is that we
427         would not get the real match, if there was a name override.
428
429 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
430
431         * namespace.cs (Namespace, Name): Do not compute the namespace
432         name dynamically, compute it in the constructor.  This reduced
433         memory usage by 1697 KB.
434
435         * driver.cs: Use --pause to pause at the end.
436
437 2003-07-17  Peter Williams  <peter@newton.cx>
438
439         * Makefile: Change the name of the test target so that it doesn't
440         conflict with the recursive test target.
441
442 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
443
444         * expression.cs (LocalVariableReference.Emit, EmitAssign,
445         AddressOf): Do not use EmitThis, that was wrong, use the actual
446         this pointer.
447
448 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
449
450         * class.cs (MethodData.Define): While checking if a method is an
451         interface implementation, improve the test: If we are not public
452         (use new test here: use the computed MethodAttributes directly,
453         instead of the parsed modifier flags) check if the `implementing'
454         method comes from an interface or not.
455
456         * pending.cs (VerifyPendingMethods): Slightly better error
457         message.
458
459         * makefile: add test target that does the mcs bootstrap.
460
461 2003-07-16  Ravi Pratap  <ravi@ximian.com>
462
463         * interface.cs (Define): Do nothing here since there are no
464         members to populate etc. Move the attribute emission out of here
465         since this was just totally the wrong place to put it. Attribute
466         application happens during the 'Emit' phase, not in the 'Define'
467         phase.
468
469         (Emit): Add this method and move the attribute emission here
470
471         * rootcontext.cs (EmitCode): Call the Emit method on interface
472         types too.
473
474 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
475
476         * expression.cs (OverloadResolve): Report error only if Location
477         is not 'Null' which means that there was a probe going on.
478
479 2003-07-14  Martin Baulig  <martin@ximian.com>
480
481         * expression.cs (ConditionalLogicalOperator): New public class to
482         implement user defined conditional logical operators.
483         This is section 14.11.2 in the spec and bug #40505.
484
485 2003-07-14  Martin Baulig  <martin@ximian.com>
486
487         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
488
489 2003-07-14  Martin Baulig  <martin@ximian.com>
490
491         * codegen.cs (EmitContext.InFixedInitializer): New public field.
492
493         * ecore.cs (IVariable.VerifyFixed): New interface method.
494
495         * expression.cs (Unary.ResolveOperator): When resolving the `&'
496         operator, check whether the variable is actually fixed.  Fixes bug
497         #36055.  Set a variable definitely assigned when taking its
498         address as required by the spec.
499
500         * statement.cs (LocalInfo.IsFixed): New field.
501         (LocalInfo.MakePinned): Set `IsFixed' to true.
502
503 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
504
505         * attribute.cs (Attribute.Resolve): While doing a Member lookup
506         for .ctors, ensure that we only ask for members declared in the
507         attribute type (BindingFlags.DeclaredOnly).
508
509         Fixes bug #43632.
510
511         * expression.cs (Error_WrongNumArguments): Report error 1501
512         correctly the way CSC does.
513
514 2003-07-13  Martin Baulig  <martin@ximian.com>
515
516         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
517         lookup on the fully qualified name, to make things like "X.X" work
518         where "X.X" is a fully qualified type name, but we also have a
519         namespace "X" in the using list.  Fixes #41975.
520
521 2003-07-13  Martin Baulig  <martin@ximian.com>
522
523         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
524         function. If we're a CompoundAssign, we need to create an embedded
525         CompoundAssign, not an embedded Assign.
526         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
527         Fixes #45854.
528
529 2003-07-13  Martin Baulig  <martin@ximian.com>
530
531         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
532         work to fix bug #46088.
533
534 2003-07-13  Ravi Pratap <ravi@ximian.com>
535
536         * class.cs (Operator.Emit): Do not emit attributes here - it is
537         taken care of by the Method class that we delegate too. This takes
538         care of bug #45876.
539         
540 2003-07-10  Martin Baulig  <martin@ximian.com>
541
542         * expression.cs (TypeOfVoid): New class.
543         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
544
545 2003-07-10  Martin Baulig  <martin@ximian.com>
546
547         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
548         bug #35957.
549
550 2003-07-10  Martin Baulig  <martin@ximian.com>
551
552         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
553         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
554
555         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
556
557         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
558
559 2003-07-10  Martin Baulig  <martin@ximian.com>
560
561         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
562         of decimal.  Fixes #42850.
563
564         NOTE: I also fixed the created byte blob, but this doesn't work on
565         the MS runtime and csc never produces any byte blobs for decimal
566         arrays.
567
568 2003-07-10  Martin Baulig  <martin@ximian.com>
569
570         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
571         structs; fixes #32068.
572         (Block.AddChildVariableNames): Fixed #44302.
573
574 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
575
576         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
577         
578 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
579
580         * attribute.cs: And this test is onger needed.
581
582 2003-07-08  Martin Baulig  <martin@ximian.com>
583
584         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
585         inaccessible types.  Fixes #36313.
586
587         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
588
589         * namespace.cs (NamespaceEntry): Create implicit entries for all
590         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
591         implicit entries for N1.N2 and N1.
592
593 2003-07-08  Martin Baulig  <martin@ximian.com>
594
595         Rewrote the handling of namespaces to fix a lot of the issues
596         wrt. `using' aliases etc.
597
598         * namespace.cs (Namespace): Splitted this class into a
599         per-assembly `Namespace' and a per-file `NamespaceEntry'.
600
601         * typemanager.cs (TypeManager.IsNamespace): Removed.
602         (TypeManager.ComputeNamespaces): Only compute namespaces from
603         loaded assemblies here, not the namespaces from the assembly we're
604         currently compiling.
605
606 2003-07-08  Martin Baulig  <martin@ximian.com>
607
608         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
609
610 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
611
612         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
613         already fixed it.  
614
615         I thought about the memory savings here, but LookupTypeReflection
616         is used under already very constrained scenarios.  Compiling
617         corlib or mcs only exposes one hit, so it would not really reduce
618         any memory consumption.
619
620 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
621
622         * typemanager.cs: fixes bug #45889 by only adding public types from
623         other assemblies to the list of known types.
624
625 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
626
627         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
628         on the type we resolved.
629
630 2003-07-05  Martin Baulig  <martin@ximian.com>
631
632         * pending.cs (PendingImplementation.ParentImplements): Don't
633         create the proxy if the parent is abstract.
634
635         * class.cs (TypeContainer.DefineIndexers): Process explicit
636         interface implementations first.  Fixes #37714.
637
638 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
639
640         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
641         defined recursively;  but since we modify the input parameters
642         (left is set to `this' temporarily), we reset this value if the
643         left_is_explicit is false, which gives the original semantics to
644         the code.  
645
646         * literal.cs (NullPointer): new class used to represent a null
647         literal in a pointer context.
648
649         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
650         type is a pointer, use a NullPointer object instead of a
651         NullLiteral.   Closes 43687
652
653         (ExplicitConversion): Convert pointer values using
654         the conv opcode to the proper type.
655
656         * ecore.cs (New): change ValueTypeVariable property into a method,
657         that returns whether the valuetype is suitable for being used.
658
659         * expression.cs (Binary.DoNumericPromotions): Only return if we
660         the int constant was a valid uint, and we can return both left and
661         right as uints.  If not, we continue processing, to trigger the
662         type conversion.  This fixes 39018.
663
664         * statement.cs (Block.EmitMeta): During constant resolution, set
665         the CurrentBlock property on the emitcontext, so that we resolve
666         constants propertly.
667
668 2003-07-02  Martin Baulig  <martin@ximian.com>
669
670         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
671         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
672
673         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
674         than emitting it here.
675
676         * statement.cs: Fixed some more flow analysis bugs.
677
678 2003-07-02  Martin Baulig  <martin@ximian.com>
679
680         * class.cs (MethodData.Define): When implementing interface
681         methods, set Final unless we're Virtual.
682
683         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
684         check work for interface methods.
685
686 2003-07-01  Martin Baulig  <martin@ximian.com>
687
688         * ecore.cs (EmitContext.This): Replaced this property with a
689         GetThis() method which takes a Location argument.  This ensures
690         that we get the correct error location for a CS0188.
691
692 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
693
694         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
695         ImplicitStandardConversion.
696
697         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
698
699 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
700
701         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
702         optimization.
703
704 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
705
706         * class.cs (Constructor.Define): Turn off initlocals for unsafe
707         constructors.
708
709         (MethodData.Define): Turn off initlocals for unsafe methods.
710
711 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
712
713         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
714         complete;  Fixes #37521.
715
716         * delegate.cs: Use Modifiers.TypeAttr to compute the
717         TypeAttributes, instead of rolling our own.  This makes the flags
718         correct for the delegates.
719
720 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
721
722         * class.cs (Constructor.Define): Set the private flag for static
723         constructors as well.
724
725         * cs-parser.jay (statement_expression): Set the return value to
726         null, to avoid a crash when we catch an error.
727
728 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
729
730         * cs-parser.jay: Applied patch from Jackson that adds support for
731         extern and unsafe modifiers to destructor declarations.
732
733         * expression.cs: Report error 21 if the user is trying to index a
734         System.Array.
735
736         * driver.cs: Add an error message, suggested by the bug report.
737
738         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
739         if we do not have a ": this ()" constructor initializer.  Fixes 45149
740
741 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
742
743         * namespace.cs: Add some information to reduce FAQs.
744
745 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
746
747         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
748         underlying enumeration types.  Fixes #43915.
749
750         * expression.cs: Treat ushort/short as legal values to be used in
751         bitwise operations.
752
753 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
754
755         * delegate.cs: transfer custom attributes for paramenters from
756         the delegate declaration to Invoke and BeginInvoke.
757
758 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
759
760         * attribute.cs: handle custom marshalers and emit marshal info
761         for fields, too.
762
763 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
764
765         * makefile.gnu: Added anonymous.cs to the compiler sources.
766
767 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
768
769         * iterators.cs: Change the name of the proxy class to include two
770         underscores.
771
772         * cs-parser.jay: Update grammar to include anonymous methods.
773         
774         * anonymous.cs: new file.
775
776 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
777
778         * class.cs (Field.Define): Add missing test for pointers and
779         safety. 
780
781 2003-05-27  Ravi Pratap  <ravi@ximian.com>
782
783         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
784         we use the stobj opcode.
785
786         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
787         since it wasn't the correct fix. 
788
789         It still is puzzling that we are required to use stobj for IntPtr
790         which seems to be a ValueType.
791
792 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
793
794         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
795         during regular simple name resolution.   Now, the trick is that
796         instead of returning for processing the simplename, we do a
797         TypeManager.LookupType (ie, a rooted lookup as opposed to a
798         contextual lookup type).   If a match is found, return that, if
799         not, return for further composition.
800
801         This fixes long-standing 30485.
802
803         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
804         using the address to initialize an object, do an Stobj instead of
805         using the regular Stelem.
806
807         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
808         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
809         Because if we are a BaseIndexerAccess that value will be true.
810         Fixes 43643.
811
812         * statement.cs (GotoCase.Resolve): Return after reporting an
813         error, do not attempt to continue. 
814
815         * expression.cs (PointerArithmetic.Emit): If our operand is a
816         long, convert our constants to match the operand before
817         multiplying.  Convert to I type before adding.   Fixes 43670.
818         
819 2003-05-14  Ravi Pratap  <ravi@ximian.com>
820
821         * enum.cs (ImplicitConversionExists) : Rename to
822         ImplicitEnumConversionExists to remove ambiguity. 
823
824         * ecore.cs (NullCast): New type of cast expression class which
825         basically is very similar to EmptyCast with the difference being
826         it still is a constant since it is used only to cast a null to
827         something else
828         (eg. (string) null)
829
830         * convert.cs (ImplicitReferenceConversion): When casting a null
831         literal, we return a NullCast.
832
833         * literal.cs (NullLiteralTyped): Remove - I don't see why this
834         should be around anymore.
835
836         The renaming (reported was slightly wrong). Corrections:
837
838         ConvertImplicitStandard -> ImplicitConversionStandard
839         ConvertExplicitStandard -> ExplicitConversionStandard
840
841         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
842         before passing them in !
843
844         * convert.cs (ImplicitConversionStandard): When comparing for
845         equal expr and target types, ensure that expr is not a
846         NullLiteral.
847
848         In general, we must not be checking (expr_type ==
849         target_type) in the top level conversion methods
850         (ImplicitConversion, ExplicitConversion etc). This checking is
851         done in the methods that they delegate to.
852
853 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
854
855         * convert.cs: Move Error_CannotConvertType,
856         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
857         ImplicitNumericConversion, ImplicitConversionExists,
858         ImplicitUserConversionExists, StandardConversionExists,
859         FindMostEncompassedType, FindMostSpecificSource,
860         FindMostSpecificTarget, ImplicitUserConversion,
861         ExplicitUserConversion, GetConversionOperators,
862         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
863         TryImplicitIntConversion, Error_CannotConvertImplicit,
864         ConvertImplicitRequired, ConvertNumericExplicit,
865         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
866         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
867         its own file.
868
869         Perform the following renames:
870         
871         StandardConversionExists -> ImplicitStandardConversionExists
872         ConvertImplicit -> ImplicitConversion
873         ConvertImplicitStandard -> ImplicitStandardConversion
874         TryImplicitIntConversion -> ImplicitIntConversion
875         ConvertImplicitRequired -> ImplicitConversionRequired
876         ConvertNumericExplicit -> ExplicitNumericConversion
877         ConvertReferenceExplicit -> ExplicitReferenceConversion
878         ConvertExplicit -> ExplicitConversion
879         ConvertExplicitStandard -> ExplicitStandardConversion
880
881 2003-05-19  Martin Baulig  <martin@ximian.com>
882
883         * statement.cs (TypeInfo.StructInfo): Made this type protected.
884         (TypeInfo): Added support for structs having structs as fields.
885
886         * ecore.cs (FieldExpr): Implement IVariable.
887         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
888         VariableInfo for the field.
889
890 2003-05-18  Martin Baulig  <martin@ximian.com>
891
892         * expression.cs (This.DoResolve): Report a CS0027 if we're
893         emitting a field initializer.
894
895 2003-05-18  Martin Baulig  <martin@ximian.com>
896
897         * expression.cs (This.ResolveBase): New public function.
898         (This.DoResolve): Check for CS0188.
899
900         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
901         This.Resolve().
902
903         * ecore.cs (MethodGroupExpr.DoResolve): Set the
904         `instance_expression' to null if we don't have any non-static
905         methods.
906
907 2003-05-18  Martin Baulig  <martin@ximian.com>
908
909         Reworked the way how local variables and parameters are handled by
910         the flow analysis code.
911
912         * statement.cs (TypeInfo, VariableMap): New public classes.
913         (VariableInfo): New public class.  This is now responsible for
914         checking whether a variable has been assigned.  It is used for
915         parameters and local variables.
916         (Block.EmitMeta): Take the InternalParameters as argument; compute
917         the layout of the flow vectors here.
918         (Block.LocalMap, Block.ParameterMap): New public properties.
919         (FlowBranching): The .ctor doesn't get the InternalParameters
920         anymore since Block.EmitMeta() now computes the layout of the flow
921         vector.
922         (MyStructInfo): This class is now known as `StructInfo' and nested
923         in `TypeInfo'; we don't access this directly anymore.
924
925         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
926         property and removed IsAssigned(), IsFieldAssigned(),
927         SetAssigned() and SetFieldAssigned(); we now call them on the
928         VariableInfo so we don't need to duplicate this code everywhere.
929
930         * expression.cs (ParameterReference): Added `Block block' argument
931         to the .ctor.
932         (LocalVariableReference, ParameterReference, This): The new
933         VariableInfo class is now responsible for all the definite
934         assignment stuff.
935
936         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
937         IsParameterAssigned, SetParameterAssigned): Removed.
938
939 2003-05-18  Martin Baulig  <martin@ximian.com>
940
941         * typemanager.cs (InitCoreTypes): Try calling
942         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
943         the 3-args-version.  Corlib now also needs our `void_type'.
944         (GetMethod): Added overloaded version which takes an optional
945         `bool report_errors' to allow lookups of optional methods.
946
947 2003-05-12  Martin Baulig  <martin@ximian.com>
948
949         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
950         only used for locals and not for parameters.
951
952 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
953
954         * support.cs (InternalParameters.ParameterType): Return the
955         ExternalType of the parameter.
956
957         * parameter.cs (Parameter.ExternalType): drop the two arguments,
958         they were unused.
959
960 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
961
962         * class.cs (MethodData.Define): Do not set the `newslot' on
963         interface members, if they are also flagged as "override".
964
965         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
966         better code for ++i and i++.  This only works for static fields
967         and local variables.
968
969         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
970         want to pull the DeclSpace out of the builder_to_declspace instead
971         of the TypeBuilder (like in TypeContainer.FindMembers).
972
973         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
974         instead of LookupTypeContainer.  Fixes the crash on .NET for
975         looking up interface members.
976
977         * const.cs: Create our own emit context during the Definition
978         stage, so that constants are evaluated in the proper context, when
979         a recursive definition happens.
980
981 2003-05-11  Martin Baulig  <martin@ximian.com>
982
983         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
984         new block for a switch section.
985         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
986         the adding/lookup in the switch block.  Fixes #39828.
987
988 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
989
990         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
991         functionality: I needed to convert the data after I had performed
992         the add/sub operation into the operands type size.
993
994         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
995         pass the type for the box operation, otherwise the resulting
996         object would have been of type object.
997
998         (BoxedCast): Add constructor to specify the type to box as.
999
1000 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1001
1002         * iterators.cs: I was reusing the `count' variable inadvertently,
1003         take steps to not allow this to happen.
1004
1005 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1006
1007         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1008         by creating an array at the point where the params starts and
1009         putting all those arguments there, then adjusting the size of the
1010         array.
1011
1012 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1013
1014         * expression.cs (New.AddressOf): Implement interface
1015         IMemoryLocation.  This is used when the `new' operator is used in
1016         the context of an invocation to a method on a value type.
1017
1018         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1019         example. 
1020
1021         * namespace.cs: Also check the using aliases here.
1022
1023         * driver.cs: Move the test for using validity after the types have
1024         been entered, so we do a single pass that also includes the using
1025         aliases. 
1026
1027         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1028         in the regular case.   CreateSiblingForFinally is doing extra
1029         error checking.
1030
1031         * attribute.cs (GetAttributeArgumentExpression): Store the result
1032         on an out value, and use the return value to indicate failure
1033         instead of using null (which is a valid return for Constant.GetValue).
1034
1035         * statement.cs: Perform the analysis flow for the increment
1036         portion after the statement, because this will be the real flow of
1037         execution.  Fixes #42385
1038
1039         * codegen.cs (EmitContext.EmitArgument,
1040         EmitContext.EmitStoreArgument): New helper functions when the
1041         RemapToProxy flag is set.
1042
1043         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1044         function.
1045
1046         Add support for remapping parameters. 
1047
1048         * iterators.cs: Propagate parameter values;  Store parameter
1049         values in the proxy classes.
1050         
1051 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1052
1053         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1054         need a proxy reference;  I do not know what I was thinking
1055
1056         * cs-parser.jay (constructor_initializer): catch another error,
1057         and display nice message.
1058         
1059         (field_declaration): catch void field declaration
1060         to flag a better error. 
1061
1062         * class.cs (MemberBase.CheckBase): Report an error instead of a
1063         warning if a new protected member is declared in a struct. 
1064         (Field.Define): catch the error of readonly/volatile.
1065
1066         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1067
1068         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1069         volatile variable is taken
1070
1071 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1072
1073         * statement.cs (Fixed.Resolve): Report an error if we are not in
1074         an unsafe context.
1075
1076 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1077
1078         * typemanager.cs: reuse the code that handles type clashes for
1079         delegates and enumerations.
1080
1081         * class.cs (Report28): Always report.
1082
1083         * expression.cs (EncodeAsAttribute): Allow nulls here.
1084
1085 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1086
1087         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1088         the functionality for testing whether an expression is valid for
1089         an attribute here.  Also handle the case of arrays of elements
1090         being stored. 
1091
1092         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1093         encoding a linear array into an array of objects that are suitable
1094         to be passed to an CustomAttributeBuilder.
1095
1096         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1097
1098         * ecore.cs: (FieldExpr): Handle field remapping here.
1099
1100         * iteratators.cs: Pass the instance variable (if the method is an
1101         instance method) to the constructors, so we can access the field
1102         variables on the class.
1103
1104         TODO: Test this with structs.  I think the THIS variable on
1105         structs might have to be a pointer, and not a refenrece
1106
1107 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1108
1109         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1110         local variables to fields in a proxy class.
1111
1112         * iterators.cs (PopulateProxy): Rename our internal fields to
1113         <XXX>.  
1114         Create a <THIS> field if we are an instance method, so we can
1115         reference our parent container variables.
1116         (MapVariable): Called back from the EmitContext code to enter a
1117         new variable to field mapping into the proxy class (we just create
1118         a FieldBuilder).
1119
1120         * expression.cs
1121         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1122         for using the remapped locals to fields.
1123
1124         I placed the code here, because that gives the same semantics to
1125         local variables, and only changes the Emit code.
1126
1127         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1128         statements inside iterators.
1129         (VariableInfo): Add a FieldBuilder for the cases when we are
1130         remapping local variables to fields in a proxy class
1131
1132         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1133         current_block != null.
1134
1135         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1136         not cope with strings, as it has been moved to the
1137         TableSwitchEmit.  Fixed bug in switch generation.
1138
1139         * expression.cs (New.DoResolve): Provide more context for the user
1140         when reporting an error.
1141
1142         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1143         pointers. 
1144
1145         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1146         check the permissions for it.  Note than in a type-resolution
1147         context the check was already present in DeclSpace.ResolveType,
1148         but was missing from the MemberAccess.
1149
1150         (ArrayCreation.CheckIndices): warn if the user has
1151         more nested levels of expressions, but there are no more
1152         dimensions specified.  Avoids crash on bug 41906.
1153
1154 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1155
1156         * statement.cs (Block): replace Implicit bool, for a generic
1157         flags.   
1158         New flag: `Unchecked'.  This is used during the EmitMeta phase
1159         (which is out-of-line with the regular Resolve/Emit process for a
1160         statement, as this is done ahead of time, but still gets a chance
1161         to call constant resolve).
1162         
1163         (Block.Flags): new enum for adding a new flag.
1164
1165         (Block.EmitMeta): track the state of unchecked.
1166         
1167         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1168         to enable constant resolution to work there as well.
1169
1170 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1171
1172         * typemanager.cs (ienumerable_type): Also look up
1173         System.Collections.IEnumerable. 
1174
1175 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1176
1177         TODO: Test more than one conditional per method.
1178         
1179         * class.cs (Indexer.Define): Report the location where the user is
1180         referencing the unsupported feature.
1181
1182         (MethodData): Overload the use of `conditionals' to
1183         minimize the creation of needless ArrayLists.   This saves roughly
1184         212kb on my machine.
1185
1186         (Method): Implement the new IIteratorContainer interface.
1187         (Method.SetYields): Implement the method by setting the ModFlags
1188         to contain METHOD_YIELDS.
1189         
1190         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1191         which just got set to null.
1192
1193         * iterators.cs: New file.
1194
1195         (Yield, YieldBreak): New statements.
1196
1197         * statement.cs (Return.Resolve): Flag an error if we are used in
1198         an iterator method.
1199
1200         * codegen.cs (InIterator): New flag set if the code is being
1201         compiled in an iterator method.
1202
1203         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1204         internal modifier, and we just use it to avoid adding extra
1205         fields, as this is seldom used.  
1206
1207         * cs-parser.jay: Add yield_statement (yield and yield break).
1208
1209         * driver.cs: New flag -v2 to turn on version 2 features. 
1210
1211         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1212         hashtable when v2 is enabled.
1213
1214 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1215
1216         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1217         there is already a namespace defined with this name.
1218
1219         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1220         people upgraded their corlibs.
1221
1222         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1223         always use fully qualified types, no need to use the compiler
1224         front end.
1225
1226         (TypeManager.IsNamespace): Use binarysearch.
1227         
1228         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1229         AddDelegate): I did not quite use the new IsValid API properly: I
1230         have to pass the short-name and the fullname.  I was passing only
1231         the basename instead of the fullname sometimes. 
1232
1233         (TypeContainer.DefineType): call NamespaceClash.
1234
1235         * interface.cs (Interface.DefineType): use NamespaceClash before
1236         defining the type.
1237
1238         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1239         defining the type.
1240
1241         * enum.cs: (Enum.DefineType): use NamespaceClash before
1242         defining the type.
1243
1244         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1245         speed increase.  First, use the negative_hits cache when we get a
1246         negative.  Second, add the type with its full original name
1247         instead of the new . and + encoded name (reflection uses + to
1248         separate type from a nested type).  Use LookupTypeReflection
1249         directly which bypasses the type->name hashtable (that we already
1250         know does not contain the type.
1251         
1252         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1253         location/container type. 
1254
1255         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1256
1257 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1258
1259         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1260
1261         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1262         method is being referenced in the method group from a static
1263         context, and report error 120 if so.
1264
1265         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1266         Error118. 
1267
1268         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1269         is created, we create the A namespace).
1270
1271         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1272         Fixes #41591
1273
1274 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1275
1276         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1277         invocation to ModuleBuilder.GetType with the same values will
1278         return a new type instance, so we need to cache its return
1279         values. 
1280
1281         * expression.cs (Binary.ResolveOperator): Only allow the compare
1282         operators on enums if they are of the same type.
1283
1284         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1285         types of ValueType on their own case.  Before we were giving them
1286         the same treatment as objects.
1287
1288         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1289         fullname.  Short name is used to compare against container name.
1290         Fullname is used to check against defined namespace names.
1291         
1292         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1293         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1294
1295         (Method.CheckBase): Call parent.
1296         (MemberBase.CheckBase): Check for protected members on sealed
1297         classes.
1298         (PropertyBase.CheckBase): Call parent.
1299         (Field.Define): Call parent.
1300
1301         * report.cs: Negative error codes are now mapped to 8000 - code,
1302         so that the display is render more nicely.
1303
1304         * typemanager.cs: Do not use try/catch, instead report a regular
1305         error. 
1306
1307         (GetPointerType, GetReferenceType): These methods provide
1308         mechanisms to obtain the T* and T& from a T.  We had the code
1309         previously scattered around the code base, and it also used
1310         TypeManager.LookupType that would go through plenty of caches.
1311         This one goes directly to the type source.
1312
1313         In some places we did the Type.GetType followed by
1314         ModuleBuilder.GetType, but not in others, so this unifies the
1315         processing as well.
1316
1317         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1318         statements now that we have namespace information.
1319
1320         * typemanager.cs (IsNamespace): New method, returns whether the
1321         string presented is a namespace or not.
1322
1323         (ComputeNamespaces): New public entry point, computes the list of
1324         available namespaces, using the GetNamespaces API call in Mono, or
1325         the slower version in MS.NET.   
1326
1327         Now before we start the semantic analysis phase, we have a
1328         complete list of namespaces including everything that the user has
1329         provided.
1330
1331         Deleted old code to cache namespaces in .nsc files.
1332
1333 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1334
1335         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1336         class/struct location definition Location for the implicit
1337         constructor location.
1338
1339         (Operator.Define): Use the location of the operator for the
1340         implicit Method definition.
1341
1342         (Constructor.Emit): use the constructor location for the implicit
1343         base initializer constructor.
1344
1345         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1346         and the Expression class now contains two new methods:
1347
1348         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1349         isolate type lookup from the rest of the resolution process.
1350
1351         Since we use Expressions to hold type definitions due to the way
1352         we parse the input we have historically overloaded Resolve to
1353         perform the Type lookups if a special flag is passed.  Now this is
1354         eliminated and two methods take their place. 
1355         
1356         The differences in the two methods between xStep and xTerminal is
1357         that xStep is involved in our current lookup system that uses
1358         SimpleNames to compose a name, while xTerminal is used just to
1359         catch the case where the simplename lookup failed.
1360         
1361 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1362
1363         * expression.cs (ResolveMemberAccess): Remove redundant code.
1364         TypeExpr expressions are always born fully resolved.
1365
1366         * interface.cs (PopulateMethod): Do not lookup the types twice.
1367         We were doing it once during SemanticAnalysis and once during
1368         PopulateMethod.
1369
1370         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1371         in local variable type definitions, were being returned as a
1372         SimpleName (we decomposed everything into a string), that is
1373         because primary_expression was being used instead of a type in the
1374         grammar (reduce/reduce conflicts).
1375
1376         The part that was wrong is that we converted the expression into a
1377         string (an oversimplification in one hand, compounded with primary
1378         expressions doing string concatenation).
1379
1380         So things like:
1381
1382         A.B.C [] x;
1383
1384         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1385         using clauses from working on this particular context.  And a type
1386         was being matched directly against "A.B.C[]".
1387
1388         We now use the correct approach, and allow for ComposedCast to be
1389         part of the unary expression.  So the "A.B.C []" become a composed
1390         cast of "A.B.C" (as a nested group of MemberAccess with a
1391         SimpleName at the end) plus the rank composition "[]". 
1392
1393         Also fixes 35567
1394         
1395 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1396
1397         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1398         for the access level checking.
1399
1400         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1401         `TypeContainer container', because I kept getting confused when I
1402         was debugging this code.
1403
1404         * expression.cs (Indexers): Instead of tracking getters/setters,
1405         we now track them in parallel.  We create one arraylist less, but
1406         most importantly it is possible now for the LValue code to find a
1407         matching get for a set.
1408
1409         (IndexerAccess.DoResolveLValue): Update the code.
1410         GetIndexersForType has been modified already to extract all the
1411         indexers from a type.  The code assumed it did not.
1412
1413         Also make the code set the correct return type for the indexer.
1414         This was fixed a long time ago for properties, but was missing for
1415         indexers.  It used to be void_type.
1416
1417         (Binary.Emit): Test first for doubles instead of
1418         floats, as they are more common.
1419
1420         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1421         when dealing with floats and the <=, >= operators.  This fixes bug
1422         #39314 
1423
1424         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1425         to load the array value by emitting a load on the foreach variable
1426         type.  This was incorrect.  
1427
1428         We now emit the code to load an element using the the array
1429         variable type, and then we emit the conversion operator.
1430
1431         Fixed #40176
1432
1433 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1434
1435         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1436
1437 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1438
1439         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1440         test for protection before we test for signatures. 
1441
1442         (MethodSignature.ToString): implement.
1443
1444         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1445         to the case where we reduced into a LongConstant.
1446
1447         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1448         depend on whether the information is acurrate, because the
1449         Microsoft runtime will always claim that the array type is public,
1450         regardless of the real state.
1451
1452         If the type is a pointer, another problem happens: the type is
1453         reported as non-public in Microsoft.  
1454
1455         In both cases we have to call CheckAccessLevel recursively with
1456         the underlying type as the argument to be tested.
1457
1458 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1459
1460         * assign.cs (Assign.Emit): If we are dealing with a compound
1461         assignment expression, we should use the code path that stores the
1462         intermediate result in a temporary value.  This fixes #40903.
1463
1464         *expression.cs (Indirection.ToString): Provide ToString method for
1465         debugging. 
1466         
1467 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1468
1469         * class.cs: Null out fields holding references to Block objects so
1470         they can be garbage collected.
1471
1472         * expression.cs (OverloadResolve): Remove unused local.
1473
1474 2003-04-07  Martin Baulig  <martin@ximian.com>
1475
1476         * codegen.cs (EmitContext.CurrentFile): New public field.
1477         (EmitContext.Mark): Use the CurrentFile to check whether the
1478         location is in the correct file.
1479         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1480
1481 2003-04-07  Martin Baulig  <martin@ximian.com>
1482
1483         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1484
1485         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1486         location.  [FIXME: The location argument which gets passed to this
1487         method is sometimes wrong!]
1488
1489 2003-04-07  Nick Drochak <ndrochak@gol.com>
1490
1491         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1492
1493 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
1494
1495         * expression.cs (Indirection.EmitAssign): We were using the
1496         temporary, but returning immediately instead of continuing the
1497         EmitAssing flow.
1498
1499 2003-04-06  Martin Baulig  <martin@ximian.com>
1500
1501         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1502         if it's a nested child, but also deriving from the outer class.
1503         See test 190.cs.
1504
1505         * typemanager.cs (IsNestedChildOf): Make this work if it's a
1506         nested child, but also deriving from the outer class.  See
1507         test-190.cs.
1508         (FilterWithClosure): We may access private members of the outer
1509         class if we're a nested child and deriving from the outer class.
1510         (RealMemberLookup): Only set `closure_private_ok' if the
1511         `original_bf' contained BindingFlags.NonPublic.
1512
1513 2003-04-05  Martin Baulig  <martin@ximian.com>
1514
1515         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1516
1517 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
1518
1519         * class.cs (Event.Define): Do not allow abstract events to have
1520         initializers. 
1521
1522 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
1523
1524         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1525         block in event declarations.
1526
1527         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1528         value type, get its address.
1529
1530         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1531         leaving a class on the stack instead of a boolean value (int
1532         0/1).  Change the code so we compare against null, and then the
1533         result against zero.
1534
1535         * class.cs (TypeContainer.GetClassBases): We were checking for the
1536         parent class being sealed too late.
1537
1538         * expression.cs (Binary.Emit): For <= and >= when dealing with
1539         floating point values, use cgt.un and clt.un instead of cgt and
1540         clt alone.
1541
1542 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
1543
1544         * statement.cs: Apply the same optimization as MS: skip the 
1545         GetEnumerator returning an IEnumerator, and use the one returning a 
1546         CharEnumerator instead. This allows us to avoid the try-finally block 
1547         and the boxing.
1548
1549 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
1550
1551         * cs-parser.jay: Attributes cannot be applied to
1552                          namespaces. Fixes #40473
1553
1554 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1555
1556         * class.cs:
1557         (Add*): check if the name is valid using the full name for constants,
1558         fields, properties and events.
1559
1560 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
1561
1562         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1563         char constants to be part of the enumeration.
1564
1565         * expression.cs (Conditional.DoResolve): Add support for operator
1566         true. Implements the missing functionality from 14.12
1567
1568         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1569         operator true/false as required by the spec.
1570
1571         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1572         implicit conversion to boolean.
1573
1574         * statement.cs (Statement.ResolveBoolean): A boolean expression is
1575         also one where the type implements `operator true'. 
1576
1577         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1578         get an expression that will invoke operator true based on an
1579         expression.  
1580
1581         (GetConversionOperators): Removed the hack that called op_True
1582         here.  
1583
1584         (Expression.ResolveBoolean): Move this from Statement.
1585
1586 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
1587
1588         * ecore.cs (FieldExpr): do not allow initialization of initonly
1589         fields on derived classes
1590
1591 2003-03-13  Martin Baulig  <martin@ximian.com>
1592
1593         * statement.cs (Block.Emit): Call ig.BeginScope() and
1594         ig.EndScope() when compiling with debugging info; call
1595         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1596
1597 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
1598
1599         * expression.cs (Indexers): Do not construct immediately, allow
1600         for new members to be appended as we go.  Fixes 38143
1601
1602 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1603
1604         * expression.cs: save/restore context when resolving an unchecked
1605         expression.
1606
1607 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
1608
1609         * cfold.cs: Catch division by zero in modulus operator during
1610         constant folding.
1611
1612 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
1613
1614         * interface.cs (Interface.DefineMembers): Avoid defining members
1615         twice. 
1616
1617 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
1618
1619         * driver.cs: handle the +/- options for -noconfig
1620
1621         * statement.cs (Unckeched.Resolve): Also track the state of
1622         unchecked in the Resolve phase.
1623
1624 2003-02-27  Martin Baulig  <martin@ximian.com>
1625
1626         * ecore.cs (Expression.MemberLookup): Don't create a
1627         MethodGroupExpr for something which is not a method.  Fixes #38291.
1628
1629 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
1630
1631         * class.cs (MemberBase.CheckParameters): Also check that the type
1632         is unmanaged if it is a pointer.
1633
1634         * expression.cs (SizeOf.Resolve): Add location information.
1635
1636         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1637         a managed type is declared.
1638
1639         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1640         parameter modifiers as well.  Fixes bug 38606
1641
1642         * class.cs: Very sad.  Am backing out the speed up changes
1643         introduced by the ArrayList -> Array in the TypeContainer, as they
1644         were not actually that much faster, and introduced a bug (no error
1645         reports on duplicated methods).
1646
1647         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1648         source first, this will guarantee that we have a valid expression
1649         before calling in lower levels functions that will require a
1650         resolved object.  Then use this original_source in the
1651         target.ResolveLValue instead of the original source that was
1652         passed to us.
1653
1654         Another change.  Use target.Resolve instead of LValueResolve.
1655         Although we are resolving for LValues, we will let the Assign code
1656         take care of that (it will be called again from Resolve).  This
1657         basically allows code like this:
1658
1659         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1660         class Y { void A (X x) { x [0] += o; }
1661
1662         The problem was that the indexer was trying to resolve for
1663         set_Item (idx, object o) and never finding one.  The real set_Item
1664         was set_Item (idx, X).  By delaying the process we get the right
1665         semantics. 
1666
1667         Fixes bug 36505
1668         
1669 2003-02-23  Martin Baulig  <martin@ximian.com>
1670
1671         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1672         while calling DoEmit ().
1673
1674         * codegen.cs (EmitContext.Mark): Don't mark locations in other
1675         source files; if you use the #line directive inside a method, the
1676         compiler stops emitting line numbers for the debugger until it
1677         reaches the end of the method or another #line directive which
1678         restores the original file.
1679
1680 2003-02-23  Martin Baulig  <martin@ximian.com>
1681
1682         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1683
1684 2003-02-23  Martin Baulig  <martin@ximian.com>
1685
1686         * statement.cs (Block.AddChildVariableNames): We need to call this
1687         recursively, not just for our immediate children.
1688
1689 2003-02-23  Martin Baulig  <martin@ximian.com>
1690
1691         * class.cs (Event.Define): Always make the field private, like csc does.
1692
1693         * typemanager.cs (TypeManager.RealMemberLookup): Make events
1694         actually work, fixes bug #37521.
1695
1696 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
1697
1698         * delegate.cs: When creating the various temporary "Parameters"
1699         classes, make sure that we call the ComputeAndDefineParameterTypes
1700         on those new parameters (just like we do with the formal ones), to
1701         allow them to be resolved in the context of the DeclSpace.
1702
1703         This fixes the bug that Dick observed in Bugzilla #38530.
1704
1705 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
1706
1707         * expression.cs (ResolveMemberAccess): When resolving a constant,
1708         do not attempt to pull a constant if the value was not able to
1709         generate a valid constant.
1710
1711         * const.cs (LookupConstantValue): Do not report more errors than required.
1712
1713 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1714
1715         * expression.cs: fixes bug #38328.
1716
1717 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
1718
1719         * class.cs: Changed all the various members that can be part of a
1720         class from being an ArrayList to be an Array of the right type.
1721         During the DefineType type_list, interface_list, delegate_list and
1722         enum_list are turned into types, interfaces, delegates and enums
1723         arrays.  
1724
1725         And during the member population, indexer_list, event_list,
1726         constant_list, field_list, instance_constructor_list, method_list,
1727         operator_list and property_list are turned into their real arrays.
1728
1729         Although we could probably perform this operation earlier, for
1730         good error reporting we need to keep the lists and remove the
1731         lists for longer than required.
1732
1733         This optimization was triggered by Paolo profiling the compiler
1734         speed on the output of `gen-sample-program.pl' perl script. 
1735
1736         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
1737         not crash in methods like MemberLookupFailed that use this field.  
1738
1739         This problem arises when the compiler fails to resolve a type
1740         during interface type definition for example.
1741
1742 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
1743
1744         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
1745         inherit from System.Object, so we have to stop at null, not only
1746         when reaching System.Object.
1747
1748 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
1749
1750         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
1751         DeclaredOnly because the parent indexer might have had a different
1752         name, but did not loop until the top of the hierarchy was reached.
1753
1754         The problem this one fixes is 35492: when a class implemented an
1755         indexer from an interface, we were getting the interface method
1756         (which was abstract) and we were flagging an error (can not invoke
1757         abstract method).
1758
1759         This also keeps bug 33089 functioning, and test-148 functioning.
1760
1761         * typemanager.cs (IsSpecialMethod): The correct way of figuring
1762         out if a method is special is to see if it is declared in a
1763         property or event, or whether it is one of the predefined operator
1764         names.   This should fix correctly #36804.
1765
1766 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
1767
1768         The goal here is to remove the dependency on EmptyCast.Peel ().
1769         Killing it completely.
1770         
1771         The problem is that currently in a number of places where
1772         constants are expected, we have to "probe" for an EmptyCast, and
1773         Peel, which is not the correct thing to do, as this will be
1774         repetitive and will likely lead to errors. 
1775
1776         The idea is to remove any EmptyCasts that are used in casts that
1777         can be reduced to constants, so we only have to cope with
1778         constants. 
1779
1780         This bug hunt was triggered by Bug 37363 and the desire to remove
1781         the duplicate pattern where we were "peeling" emptycasts to check
1782         whether they were constants.  Now constants will always be
1783         constants.
1784         
1785         * ecore.cs: Use an enumconstant here instead of wrapping with
1786         EmptyCast.  
1787
1788         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1789         throwing me off.  By handling this we can get rid of a few hacks.
1790         
1791         * statement.cs (Switch): Removed Peel() code.
1792
1793 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
1794
1795         * class.cs: Location information for error 508
1796
1797         * expression.cs (New.DoResolve): Add a guard against double
1798         resolution of an expression.  
1799
1800         The New DoResolve might be called twice when initializing field
1801         expressions (see EmitFieldInitializers, the call to
1802         GetInitializerExpression will perform a resolve on the expression,
1803         and later the assign will trigger another resolution
1804
1805         This leads to bugs (#37014)
1806
1807         * delegate.cs: The signature for EndInvoke should contain any ref
1808         or out parameters as well.  We were not doing this in the past. 
1809
1810         * class.cs (Field.Define): Do not overwrite the type definition
1811         inside the `volatile' group.  Turns out that volatile enumerations
1812         were changing the type here to perform a validity test, which
1813         broke conversions. 
1814
1815 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
1816
1817         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
1818         and structs, we do not want to load the instance variable
1819
1820         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
1821         enum_type has to be handled like an object reference (implicit
1822         conversions exists from this to object), but the regular IsClass
1823         and IsValueType tests will never return true for this one.
1824
1825         Also we use TypeManager.IsValueType instead of type.IsValueType,
1826         just for consistency with the rest of the code (this is only
1827         needed if we ever use the construct exposed by test-180.cs inside
1828         corlib, which we dont today).
1829
1830 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
1831
1832         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
1833         just InternalCall.
1834
1835 2003-02-09  Martin Baulig  <martin@ximian.com>
1836
1837         * namespace.cs (Namespace..ctor): Added SourceFile argument.
1838         (Namespace.DefineNamespaces): New static public method; this is
1839         called when we're compiling with debugging to add all namespaces
1840         to the symbol file.
1841
1842         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
1843         pass it to the Namespace's .ctor.
1844
1845         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
1846         and MethodBase arguments; pass the namespace ID to the symwriter;
1847         pass the MethodBase instead of the token to the symwriter.
1848         (SymbolWriter.DefineNamespace): New method to add a namespace to
1849         the symbol file.
1850
1851 2003-02-09  Martin Baulig  <martin@ximian.com>
1852
1853         * symbolwriter.cs: New file.  This is a wrapper around
1854         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
1855         methods here in near future.
1856
1857 2003-02-09  Martin Baulig  <martin@ximian.com>
1858
1859         * codegen.cs (EmitContext.Mark): Just pass the arguments to
1860         ILGenerator.MarkSequencePoint() which are actually used by the
1861         symbol writer.
1862
1863 2003-02-09  Martin Baulig  <martin@ximian.com>
1864
1865         * location.cs (SourceFile): New public sealed class.  This
1866         contains the name and an index which is used in the location's token.
1867         (Location): Reserve an appropriate number of bits in the token for
1868         the source file instead of walking over that list, this gives us a
1869         really huge performance improvement when compiling with debugging.
1870
1871         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
1872         `SourceFile' argument instead of a string.
1873         (Driver.ProcessFile): Add all the files via Location.AddFile(),
1874         but don't parse/tokenize here, we need to generate the list of all
1875         source files before we do that.
1876         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
1877         the files.
1878
1879         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
1880         instead of a string.
1881
1882         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
1883         of a string.
1884
1885 2003-02-09  Martin Baulig  <martin@ximian.com>
1886
1887         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
1888         filename on `#line default'.
1889
1890 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
1891
1892         * statement.cs: don't clear the pinned var when the fixed statement
1893         returns from the method (fixes bug#37752).
1894
1895 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
1896
1897         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
1898         to IsValueType.
1899
1900 2003-02-07  Martin Baulig  <martin@ximian.com>
1901
1902         * driver.cs: Removed the `--debug-args' command line argument.
1903
1904         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
1905         automatically by the AsssemblyBuilder.
1906         (CodeGen.InitializeSymbolWriter): We don't need to call any
1907         initialization function on the symbol writer anymore.  This method
1908         doesn't take any arguments.
1909
1910 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
1911
1912         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
1913         from referenced assemblies as well.
1914
1915 2003-02-02  Martin Baulig  <martin@ximian.com>
1916
1917         * class.cs (MethodData.Emit): Generate debugging info for external methods.
1918
1919 2003-02-02  Martin Baulig  <martin@ximian.com>
1920
1921         * class.cs (Constructor.Emit): Open the symbol writer before
1922         emitting the constructor initializer.
1923         (ConstructorInitializer.Emit): Call ec.Mark() to allow
1924         single-stepping through constructor initializers.
1925
1926 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
1927
1928         * class.cs: Handle error 549: do not allow virtual methods in
1929         sealed classes. 
1930
1931 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
1932
1933         * decl.cs: Check access levels when resolving types
1934         
1935 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
1936
1937         * statement.cs: Add parameters and locals set in catch blocks that might 
1938         return to set vector
1939
1940 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
1941
1942         * class.cs (Operator): Set the SpecialName flags for operators.
1943         
1944         * expression.cs (Invocation.DoResolve): Only block calls to
1945         accessors and operators on SpecialName methods.
1946
1947         (Cast.TryReduce): Handle conversions from char constants.
1948
1949
1950 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
1951
1952         * statement.cs: small memory and time optimization in FlowBranching.
1953         
1954 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
1955
1956         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
1957         problem that the last fix but in the other sid (Set).
1958
1959         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
1960         access when there is no indexer in the hierarchy.
1961         
1962 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
1963
1964         * class.cs: Combine some if statements.
1965
1966 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1967
1968         * driver.cs: fixed bug #37187.
1969
1970 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
1971
1972         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
1973         any indexer, it's needed to build a list with all the indexers in the
1974         hierarchy (AllGetters), else we have problems. Fixes #35653.
1975
1976 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
1977
1978         * class.cs (MethodData.Define): It is wrong for an interface
1979         implementation to be static in both cases: explicit and implicit.
1980         We were only handling this in one case.
1981
1982         Improve the if situation there to not have negations.
1983         
1984         * class.cs (Field.Define): Turns out that we do not need to check
1985         the unsafe bit on field definition, only on usage.  Remove the test.
1986
1987 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1988
1989         * driver.cs: use assembly.Location instead of Codebase (the latest
1990         patch made mcs fail when using MS assemblies).
1991
1992 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
1993
1994         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1995         get the path to *corlib.dll.
1996
1997 2003-01-21  Nick Drochak <ndrochak@gol.com>
1998
1999         * cs-tokenizer.cs:
2000         * pending.cs:
2001         * typemanager.cs: Remove compiler warnings
2002
2003 2003-01-20  Duncan Mak  <duncan@ximian.com>
2004
2005         * AssemblyInfo.cs: Bump the version number to 0.19.
2006         
2007 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2008
2009         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2010
2011 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2012
2013         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2014
2015 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2016
2017         * cs-parser.jay: Small fix: we were not comparing the constructor
2018         name correctly.   Thanks to Zoltan for the initial pointer.
2019
2020 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2021
2022         * cs-tokenizer.cs: Set file name when specified with #line
2023
2024 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2025
2026         * cs-parser.jay: Only perform the constructor checks here if we
2027         are named like the class;  This will help provider a better
2028         error.  The constructor path is taken when a type definition is
2029         not found, but most likely the user forgot to add the type, so
2030         report that rather than the constructor error.
2031
2032 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2033
2034         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2035         allocations.
2036
2037 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2038
2039         * cs-parser.jay: Add cleanup call.
2040
2041 2003-01-13  Duncan Mak  <duncan@ximian.com>
2042
2043         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2044         consistent with other methods.
2045
2046 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2047
2048         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2049         
2050 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2051
2052         * attribute.cs: only set GuidAttr to true when we have a
2053         GuidAttribute.
2054
2055 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2056
2057         * ecore.cs:
2058         * expression.cs:
2059         * typemanager.cs: fixes to allow mcs compile corlib with the new
2060         Type.IsSubclassOf fix.
2061
2062 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2063
2064         * expression.cs (LocalVariableReference.DoResolve): Classify a
2065         constant as a value, not as a variable.   Also, set the type for
2066         the variable.
2067
2068         * cs-parser.jay (fixed_statement): take a type instead of a
2069         pointer_type, so we can produce a better error message later.
2070         
2071         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2072         as an error.  
2073         
2074         (For.DoEmit): Make inifinite loops have a
2075         non-conditional branch back.
2076
2077         (Fixed.DoEmit): First populate the pinned variables, then emit the
2078         statement, then clear the variables.  Before I was emitting the
2079         code once for each fixed piece.
2080
2081
2082 2003-01-08  Martin Baulig  <martin@ximian.com>
2083
2084         * statement.cs (FlowBranching.MergeChild): A break in a
2085         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2086
2087 2003-01-08  Martin Baulig  <martin@ximian.com>
2088
2089         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2090         lives in the same number space than `param_map'.  Fixes #36154.
2091
2092 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2093
2094         * cs-parser.jay (constructor_declaration): Set the
2095         Constructor.ModFlags before probing for it.  This makes the
2096         compiler report 514, 515 and 132 (the code was there, but got
2097         broken). 
2098
2099         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2100         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2101         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2102
2103 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2104
2105         * enum.cs: create the enum static fields using the enum type.
2106
2107 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2108
2109         * class.cs: don't try to create the ParamBuilder for the return
2110         type if it's not needed (and handle it breaking for the ms runtime
2111         anyway).
2112
2113 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2114
2115         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2116
2117 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2118
2119         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2120         the command.   This showed up while compiling the JANET source
2121         code, which used \r as its only newline separator.
2122
2123 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2124
2125         * class.cs (Method.Define): If we are an operator (because it
2126         reuses our code), then set the SpecialName and HideBySig.  #36128
2127
2128 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2129
2130         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2131         exception, report error 120 `object reference required'.
2132
2133         * driver.cs: Add --pause option, used during to measure the size
2134         of the process as it goes with --timestamp.
2135
2136         * expression.cs (Invocation.DoResolve): Do not allow methods with
2137         SpecialName to be invoked.
2138
2139 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2140
2141         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2142         number before adding it.
2143
2144 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2145
2146         * ecore.cs (StandardImplicitConversion): When in an unsafe
2147         context, we allow conversion between void * to any other pointer
2148         type. This fixes bug #35973.
2149
2150 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2151
2152         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2153         is not thrown when extensionless outputs are used 
2154
2155 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2156
2157         * rootcontext.cs: fixed compilation of corlib.
2158
2159 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2160
2161         * attribute.cs (Attributes.Contains): Add new method.
2162
2163         * class.cs (MethodCore.LabelParameters): if the parameter is an
2164         `out' parameter, check that no attribute `[In]' has been passed.
2165
2166         * enum.cs: Handle the `value__' name in an enumeration.
2167
2168 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2169
2170         * decl.cs: Added special case to allow overrides on "protected
2171         internal" methods
2172         
2173 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2174
2175         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2176         since it makes much more sense.
2177
2178         (Attributes.ctor): Don't require a Location parameter.
2179         
2180         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2181
2182         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2183         since we already have that information per attribute.
2184
2185         * everywhere : make appropriate changes.
2186
2187         * class.cs (LabelParameters): Write the code which actually
2188         applies attributes to the return type. We can't do this on the MS
2189         .NET runtime so we flag a warning in the case an exception is
2190         thrown.
2191
2192 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2193
2194         * const.cs: Handle implicit null conversions here too.
2195
2196 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2197
2198         * class.cs (MethodCore.LabelParameters): Remove the extra
2199         Type [] parameter since it is completely unnecessary. Instead
2200         pass in the method's attributes so that we can extract
2201         the "return" attribute.
2202
2203 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2204
2205         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2206         of ignoring it and letting the compile continue.
2207
2208         * typemanager.cs (ChangeType): use an extra argument to return an
2209         error condition instead of throwing an exception.
2210
2211 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2212
2213         * expression.cs (Unary.TryReduce): mimic the code for the regular
2214         code path.  Perform an implicit cast in the cases where we can
2215         implicitly convert to one of the integral types, and then reduce
2216         based on that constant.   This fixes bug #35483.
2217
2218 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2219
2220         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2221
2222 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2223
2224         * namespace.cs: fixed bug #35489.
2225
2226 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2227
2228         * class.cs: Remove some dead code.
2229
2230         * cs-parser.jay: Estimate the number of methods needed
2231         (RootContext.MethodCount);
2232
2233         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2234         numbers instead of StringBuilders.
2235
2236         * support.cs (PtrHashtable): Add constructor with initial size;
2237         We can now reduce reallocations of the method table.
2238
2239 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2240
2241         * attribute.cs (ApplyAttributes): Keep track of the emitted
2242         attributes on a per-target basis. This fixes bug #35413.
2243
2244 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2245
2246         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2247         default to the Windows 1252 encoding.
2248
2249         (UnixParseOption): Support version, thanks to Alp for the missing
2250         pointer. 
2251
2252         * AssemblyInfo.cs: Add nice assembly information.
2253
2254         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2255         (bug 35169).
2256
2257         * cs-parser.jay: Allow a trailing comma before the close bracked
2258         in the attribute_section production.
2259
2260         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2261         address of the instance was being taken, I will take this out,
2262         because we take the address of the object immediately here.
2263
2264 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2265
2266         * typemanager.cs (AreMultipleAllowed): Take care of the most
2267         obvious case where attribute type is not in the current assembly -
2268         stupid me ;-)
2269
2270 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2271
2272         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2273         definitions, instead of doing that afterwards.  
2274
2275         Also we use a nice little hack, depending on the constructor, we
2276         know if we are a "composed" name or a simple name.  Hence, we
2277         avoid the IndexOf test, and we avoid 
2278
2279         * codegen.cs: Add code to assist in a bug reporter to track down
2280         the source of a compiler crash. 
2281
2282 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2283
2284         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2285         types have been emitted for a given element and flag an error
2286         if something which does not have AllowMultiple set is used more
2287         than once.
2288
2289         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2290         attribute types and their corresponding AllowMultiple properties
2291
2292         (AreMultipleAllowed): Check the property for a given type.
2293
2294         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2295         property in the case we have a TypeContainer.
2296
2297         (Attributes.AddAttribute): Detect duplicates and just skip on
2298         adding them. This trivial fix catches a pretty gross error in our
2299         attribute emission - global attributes were being emitted twice!
2300
2301         Bugzilla bug #33187 is now fixed.
2302
2303 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2304
2305         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2306         instead of pp_and).
2307
2308         * expression.cs (Binary.ResolveOperator): I can only use the
2309         Concat (string, string, string) and Concat (string, string,
2310         string, string) if the child is actually a concatenation of
2311         strings. 
2312
2313 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2314
2315         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2316         context where we need a 2-character lookahead.
2317
2318         * pending.cs (PendingImplementation): Rework so we can keep track
2319         of interface types all the time, and flag those which were
2320         implemented by parents as optional.
2321
2322 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2323
2324         * expression.cs (Binary.ResolveOperator): Use
2325         String.Concat(string,string,string) or
2326         String.Concat(string,string,string,string) when possible. 
2327
2328         * typemanager: More helper methods.
2329
2330
2331 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2332
2333         * pending.cs: remove the bogus return from GetMissingInterfaces()
2334         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2335
2336 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2337
2338         * namespace.cs: avoid duplicated 'using xxx' being added to
2339         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2340         when we get more than one 'using' statement for the same namespace.
2341         Report a CS0105 warning for it.
2342
2343 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2344
2345         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2346         of calling getChar/putback, uses internal knowledge of it.    
2347
2348         (xtoken): Reorder tokenizer so most common patterns are checked
2349         first.  This reduces the compilation time in another 5% (from 8.11s
2350         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2351
2352         The parsing time is 22% of the compilation in mcs, and from that
2353         64% is spent on the tokenization process.  
2354
2355         I tried using a binary search for keywords, but this is slower
2356         than the hashtable.  Another option would be to do a couple of
2357         things:
2358
2359                 * Not use a StringBuilder, instead use an array of chars,
2360                   with a set value.  Notice that this way we could catch
2361                   the 645 error without having to do it *afterwards*.
2362
2363                 * We could write a hand-parser to avoid the hashtable
2364                   compares altogether.
2365
2366         The identifier consumption process takes 37% of the tokenization
2367         time.  Another 15% is spent on is_number.  56% of the time spent
2368         on is_number is spent on Int64.Parse:
2369
2370                 * We could probably choose based on the string length to
2371                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2372                   computations. 
2373
2374         Another 3% is spend on wrapping `xtoken' in the `token' function.
2375
2376         Handle 0xa0 as whitespace (#34752)
2377         
2378 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2379
2380         * typemanager.cs (IsCLRType): New routine to tell whether a type
2381         is one of the builtin types.  
2382
2383         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2384         typecode in more places instead of doing pointer comparissions.
2385         We could leverage some knowledge about the way the typecodes are
2386         laid out.
2387
2388         New code to cache namespaces in assemblies, it is currently not
2389         invoked, to be used soon.
2390
2391         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2392
2393         * expression.cs (Binary.ResolveOperator): specially handle
2394         strings, and do not perform user-defined operator overloading for
2395         built-in types.
2396
2397 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2398
2399         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2400         internalcall as it is a pretty simple operation;  Avoid whenever
2401         possible to call Char.IsLetter.
2402
2403         (consume_identifier): Cut by half the number of
2404         hashtable calls by merging the is_keyword and GetKeyword behavior.
2405
2406         Do not short-circuit, because if we do, we
2407         report errors (ie, #if false && true would produce an invalid
2408         directive error);
2409         
2410
2411 2002-11-24  Martin Baulig  <martin@ximian.com>
2412
2413         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2414         check constant ranges and report a CS0221.  Fixes #33186.
2415
2416 2002-11-24  Martin Baulig  <martin@ximian.com>
2417
2418         * cs-parser.jay: Make this work for uninitialized variable
2419         declarations in the `for' initializer.  Fixes #32416.
2420
2421 2002-11-24  Martin Baulig  <martin@ximian.com>
2422
2423         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2424         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2425
2426 2002-11-24  Martin Baulig  <martin@ximian.com>
2427
2428         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2429         argument; if true, we also check for user-defined conversions.
2430         This is only needed if both arguments are of a user-defined type.
2431         Fixes #30443, added test-175.cs.
2432         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2433
2434         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2435
2436 2002-11-24  Martin Baulig  <martin@ximian.com>
2437
2438         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2439         function to get the store opcode.
2440         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2441         only emit the Ldelema if the store opcode is Stobj.  You must run
2442         both test-34 and test-167 to test this.  Fixes #34529.
2443
2444 2002-11-23  Martin Baulig  <martin@ximian.com>
2445
2446         * ecore.cs (Expression.MemberLookup): Added additional
2447         `qualifier_type' argument which is used when we're being called
2448         from MemberAccess.DoResolve() and null if we're called from a
2449         SimpleName lookup.
2450         (Expression.MemberLookupFailed): New method to report errors; this
2451         does the CS1540 check and reports the correct error message.
2452
2453         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2454         argument for the CS1540 check and redone the way how we're dealing
2455         with private members.  See the comment in the source code for details.
2456         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2457         `closure_start_type' to `closure_qualifier_type' and check whether
2458         it's not null.  It was not this filter being broken, it was just
2459         being called with the wrong arguments.
2460
2461         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2462         and pass it the correct `qualifier_type'; this also does the error
2463         handling for us.
2464
2465 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2466
2467         * expression.cs (Invocation.EmitParams): If the we are dealing
2468         with a non-built-in value type, load its address as well.
2469
2470         (ArrayCreation): Use a a pretty constant instead
2471         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2472         static initializers.  
2473
2474         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2475         because they are not really value types, just glorified integers. 
2476
2477         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2478
2479         * ecore.cs: Remove redundant code for enumerations, make them use
2480         the same code path as everything else, fixes the casting issue
2481         with enumerations in Windows.Forms.
2482
2483         * attribute.cs: Do only cast to string if it is a string, the
2484         validation happens later.
2485
2486         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2487         people upgrade their corlibs.
2488
2489         * ecore.cs: Oops, enumerations were not following the entire code path
2490
2491 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
2492
2493         * typemanager.cs (FilterWithClosure): Commented out the test for
2494         1540 in typemanager.cs, as it has problems when accessing
2495         protected methods from a parent class (see test-174.cs). 
2496
2497         * attribute.cs (Attribute.ValidateGuid): new method.
2498         (Attribute.Resolve): Use above.
2499
2500 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
2501
2502         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2503
2504         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2505         handling for enumerations, as we only needed the TypeContainer
2506         functionality to begin with (this is required for the fix below to
2507         work for enums that reference constants in a container class for
2508         example). 
2509
2510         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2511
2512         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2513         a valid TypeBuilder to perform lookups on.o
2514
2515         * class.cs (InheritableMemberSignatureCompare): Use true in the
2516         call to GetGetMethod and GetSetMethod, because we are comparing
2517         the signature, and we need to get the methods *even* if they are
2518         private. 
2519
2520         (PropertyBase.CheckBase): ditto.
2521
2522         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2523         GotoCase.Resolve): Use Peel on EmpytCasts.
2524
2525         * ecore.cs (EmptyCast): drop child, add Peel method.
2526
2527 2002-11-17  Martin Baulig  <martin@ximian.com>
2528
2529         * ecore.cs (EmptyCast.Child): New public property.
2530
2531         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2532         label resolved to an EmptyCast.  Fixes #34162.
2533         (GotoCase.Resolve): Likewise.
2534         (Block.EmitMeta): Likewise.
2535
2536 2002-11-17  Martin Baulig  <martin@ximian.com>
2537
2538         * expression.cs (Invocation.BetterConversion): Prefer int over
2539         uint; short over ushort; long over ulong for integer literals.
2540         Use ImplicitConversionExists instead of StandardConversionExists
2541         since we also need to check for user-defined implicit conversions.
2542         Fixes #34165.  Added test-173.cs.
2543
2544 2002-11-16  Martin Baulig  <martin@ximian.com>
2545
2546         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2547         with the `true' and `false' literals.  Fixes #33151.
2548
2549 2002-11-16  Martin Baulig  <martin@ximian.com>
2550
2551         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2552         October 22nd; don't do the cs1540 check for static members.
2553
2554         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2555         now using our own filter here and doing the cs1540 check again.
2556
2557 2002-11-16  Martin Baulig  <martin@ximian.com>
2558
2559         * support.cs (InternalParameters): Don't crash if we don't have
2560         any fixed parameters.  Fixes #33532.
2561
2562 2002-11-16  Martin Baulig  <martin@ximian.com>
2563
2564         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2565         when looking up static methods to make this work on Windows.
2566         Fixes #33773.
2567
2568 2002-11-16  Martin Baulig  <martin@ximian.com>
2569
2570         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2571         a setter rather than using PropertyInfo.CanWrite.
2572
2573 2002-11-15  Nick Drochak  <ndrochak@gol.com>
2574
2575         * class.cs: Allow acces to block member by subclasses. Fixes build
2576         breaker.
2577
2578 2002-11-14  Martin Baulig  <martin@ximian.com>
2579
2580         * class.cs (Constructor.Emit): Added the extern/block check.
2581         Fixes bug #33678.
2582
2583 2002-11-14  Martin Baulig  <martin@ximian.com>
2584
2585         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2586         iteration while looking for indexers, this is needed because the
2587         indexer may have a different name in our base classes.  Fixed the
2588         error reporting (no indexers at all, not get accessor, no
2589         overloaded match).  Fixes bug #33089.
2590         (IndexerAccess.DoResolveLValue): Likewise.
2591
2592 2002-11-14  Martin Baulig  <martin@ximian.com>
2593
2594         * class.cs (PropertyBase.CheckBase): Make this work for multiple
2595         indexers.  Fixes the first part of bug #33089.
2596         (MethodSignature.InheritableMemberSignatureCompare): Added support
2597         for properties.
2598
2599 2002-11-13  Ravi Pratap  <ravi@ximian.com>
2600
2601         * attribute.cs (Attribute.Resolve): Catch the
2602         NullReferenceException and report it since it isn't supposed to
2603         happen. 
2604         
2605 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
2606
2607         * expression.cs (Binary.EmitBranchable): Also handle the cases for
2608         LogicalOr and LogicalAnd that can benefit from recursively
2609         handling EmitBranchable.  The code now should be nice for Paolo.
2610
2611 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
2612
2613         * typemanager.cs (LookupType): Added a negative-hit hashtable for
2614         the Type lookups, as we perform quite a number of lookups on
2615         non-Types.  This can be removed once we can deterministically tell
2616         whether we have a type or a namespace in advance.
2617
2618         But this might require special hacks from our corlib.
2619
2620         * TODO: updated.
2621
2622         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2623         and double which avoids a conversion from an integer to a double.
2624
2625         * expression.cs: tiny optimization, avoid calling IsConstant,
2626         because it effectively performs the lookup twice.
2627
2628 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
2629
2630         But a bogus return here to keep the semantics of the old code
2631         until the Mono runtime is fixed.
2632         
2633         * pending.cs (GetMissingInterfaces): New method used to remove all
2634         the interfaces that are already implemented by our parent
2635         classes from the list of pending methods. 
2636
2637         * interface.cs: Add checks for calls after ResolveTypeExpr.
2638
2639 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
2640
2641         * class.cs (Class.Emit): Report warning 67: event not used if the
2642         warning level is beyond 3.
2643
2644         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2645         being a NullLiteral.
2646
2647         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2648         specifiers. 
2649
2650         * class.cs (TypeContainer.GetClassBases): Cover a missing code
2651         path that might fail if a type can not be resolved.
2652
2653         * expression.cs (Binary.Emit): Emit unsigned versions of the
2654         operators. 
2655
2656         * driver.cs: use error 5.
2657         
2658 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2659
2660         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2661
2662 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
2663
2664         * cs-parser.jay (switch_section): A beautiful patch from Martin
2665         Baulig that fixed 33094.
2666
2667 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
2668
2669         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2670         Check whether the base is abstract and report an error if so.
2671
2672         * expression.cs (IndexerAccess.DoResolveLValue,
2673         IndexerAccess.DoResolve): ditto. 
2674
2675         (Invocation.DoResolve): ditto.
2676         
2677         (Invocation.FullMethodDesc): Improve the report string.
2678
2679         * statement.cs (Block): Eliminate IsVariableDefined as it is
2680         basically just a wrapper for GetVariableInfo.
2681
2682         * ecore.cs (SimpleName): Use new 
2683
2684         * support.cs (ReflectionParamter.ParameterType): We unwrap the
2685         type, as we return the actual parameter ref/unref state on a
2686         different call.
2687
2688 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
2689
2690         * support.cs: Return proper flags REF/OUT fixing the previous
2691         commit.  
2692
2693         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
2694         not used to mean `ref' but `ref or out' in ParameterReference
2695         
2696         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
2697         full type signature instead of calling TypeManger.CSharpName
2698         ourselves. 
2699
2700         * support.cs (InternalParameters.ParameterDesc): Do not compare
2701         directly to the modflags, because REF/OUT will actually be bitsets
2702         if set. 
2703
2704         * delegate.cs (VerifyMethod): Check also the modifiers.
2705
2706         * cs-tokenizer.cs: Fix bug where floating point values with an
2707         exponent where a sign was missing was ignored.
2708
2709         * driver.cs: Allow multiple assemblies to be specified in a single
2710         /r: argument
2711
2712 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
2713
2714         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
2715         because identifiers after a parenthesis would end up in this kind
2716         of production, and we needed to desamiguate it for having casts
2717         like:
2718
2719                 (UserDefinedType *) xxx
2720
2721 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
2722
2723         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
2724         we should set on the Bindingflags.NonPublic, but not turn on
2725         private_ok.  private_ok controls whether a Private member is
2726         returned (this is chekced on the filter routine), while the
2727         BindingFlags.NonPublic just controls whether private/protected
2728         will be allowed.   This fixes the problem part of the problem of
2729         private properties being allowed to be used in derived classes.
2730
2731         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
2732         so we can call the children DoResolveLValue method (this will
2733         properly signal errors on lvalue assignments to base properties)
2734         
2735         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
2736         getter are null, and we have a property info, we know that this
2737         happened because the lookup failed, so we report an error 122 for
2738         protection level violation.
2739
2740         We also silently return if setter and getter are null in the
2741         resolve functions, this condition only happens if we have flagged
2742         the error before.  This is the other half of the problem. 
2743
2744         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
2745         not have accessibility information, that is why we were returning
2746         true in the filter function in typemanager.cs.
2747
2748         To properly report 122 (property is inaccessible because of its
2749         protection level) correctly, we report this error in ResolveAccess
2750         by failing if both the setter and the getter are lacking (ie, the
2751         lookup failed). 
2752
2753         DoResolve and DoLResolve have been modified to check for both
2754         setter/getter being null and returning silently, the reason being
2755         that I did not want to put the knowledge about this error in upper
2756         layers, like:
2757
2758         int old = Report.Errors;
2759         x = new PropertyExpr (...);
2760         if (old != Report.Errors)
2761                 return null;
2762         else
2763                 return x;
2764
2765         So the property expr is returned, but it is invalid, so the error
2766         will be flagged during the resolve process. 
2767
2768         * class.cs: Remove InheritablePropertySignatureCompare from the
2769         class, as we no longer depend on the property signature to compute
2770         whether it is possible to implement a method or not.
2771
2772         The reason is that calling PropertyInfo.GetGetMethod will return
2773         null (in .NET, in Mono it works, and we should change this), in
2774         cases where the Get Method does not exist in that particular
2775         class.
2776
2777         So this code:
2778
2779         class X { public virtual int A { get { return 1; } } }
2780         class Y : X { }
2781         class Z : Y { public override int A { get { return 2; } } }
2782
2783         Would fail in Z because the parent (Y) would not have the property
2784         defined.  So we avoid this completely now (because the alternative
2785         fix was ugly and slow), and we now depend exclusively on the
2786         method names.
2787
2788         (PropertyBase.CheckBase): Use a method-base mechanism to find our
2789         reference method, instead of using the property.
2790
2791         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2792         routines are gone now.
2793
2794         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2795         names, they were incorrectly named.
2796
2797         * cs-tokenizer.cs: Return are more gentle token on failure. 
2798
2799         * pending.cs (PendingImplementation.InterfaceMethod): This routine
2800         had an out-of-sync index variable, which caused it to remove from
2801         the list of pending methods the wrong method sometimes.
2802
2803 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
2804
2805         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2806         CanWrite, because those refer to this particular instance of the
2807         property, and do not take into account the fact that we can
2808         override single members of a property.
2809
2810         Constructor requires an EmitContext.  The resolution process does
2811         not happen here, but we need to compute the accessors before,
2812         because the resolution does not always happen for properties.
2813         
2814         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
2815         subclass, before we did not update this flag, but we did update
2816         bindingflags. 
2817
2818         (GetAccessors): Drop this routine, as it did not work in the
2819         presence of partially overwritten set/get methods. 
2820
2821         Notice that this broke the cs1540 detection, but that will require
2822         more thinking. 
2823         
2824 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2825
2826         * class.cs:
2827         * codegen.cs:
2828         * driver.cs: issue a warning instead of an error if we don't support
2829         debugging for the platform. Also ignore a couple of errors that may
2830         arise when trying to write the symbols. Undo my previous patch.
2831
2832 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2833
2834         * driver.cs: ignore /debug switch except for Unix platforms.
2835
2836 2002-10-23  Nick Drochak  <ndrochak@gol.com>
2837
2838         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
2839
2840 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
2841
2842         * driver.cs: Do not make mcs-debug conditional, so we do not break
2843         builds that use it.
2844
2845         * statement.cs (UsageVector.MergeChildren): I would like Martin to
2846         review this patch.  But basically after all the children variables
2847         have been merged, the value of "Breaks" was not being set to
2848         new_breaks for Switch blocks.  I think that it should be set after
2849         it has executed.  Currently I set this to the value of new_breaks,
2850         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
2851         conservative, but I do not understand this code very well.
2852
2853         I did not break anything in the build, so that is good ;-)
2854
2855         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
2856
2857 2002-10-20  Mark Crichton  <crichton@gimp.org>
2858
2859         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
2860
2861 2002-10-20  Nick Drochak  <ndrochak@gol.com>
2862
2863         * cfold.cs: Fixed compile blocker.
2864
2865 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
2866
2867         * driver.cs: I was chekcing the key, not the file.
2868
2869 2002-10-19  Ravi Pratap  <ravi@ximian.com>
2870
2871         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
2872         message that we were generating - we just need to silently return
2873         a null.
2874
2875 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
2876
2877         * class.cs (Event.Define): Change my previous commit, as this
2878         breaks the debugger.  This is a temporary hack, as it seems like
2879         the compiler is generating events incorrectly to begin with.
2880
2881         * expression.cs (Binary.ResolveOperator): Added support for 
2882         "U operator - (E x, E y)"
2883
2884         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
2885         y)".
2886
2887         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
2888         init-only variables, but this path did not take into account that
2889         there might be also instance readonly variables.  Correct this
2890         problem. 
2891
2892         This fixes bug 32253
2893
2894         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
2895         delegates as well.
2896
2897         * driver.cs: Change the extension for modules to `netmodule'
2898
2899         * cs-parser.jay: Improved slightly the location tracking for
2900         the debugger symbols.
2901
2902         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
2903         modifiers that were specified instead of the hardcoded value
2904         (FamAndAssem).  This was basically ignoring the static modifier,
2905         and others.  Fixes 32429.
2906
2907         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
2908         fixed a bug in the process (32476)
2909
2910         * expression.cs (ArrayAccess.EmitAssign): Patch from
2911         hwang_rob@yahoo.ca that fixes bug 31834.3
2912
2913 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
2914
2915         * driver.cs: Make the module extension .netmodule.
2916
2917 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
2918
2919         * driver.cs: Report an error if the resource file is not found
2920         instead of crashing.
2921
2922         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
2923         false, like Emit does.
2924
2925 2002-10-16  Nick Drochak  <ndrochak@gol.com>
2926
2927         * typemanager.cs: Remove unused private member.  Also reported mcs
2928         bug to report this as a warning like csc.
2929
2930 2002-10-15  Martin Baulig  <martin@gnome.org>
2931
2932         * statement.cs (Statement.Emit): Made this a virtual method; emits
2933         the line number info and calls DoEmit().
2934         (Statement.DoEmit): New protected abstract method, formerly knows
2935         as Statement.Emit().
2936
2937         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
2938
2939 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
2940
2941         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
2942         have fixed a remaining problem: not every AddXXXX was adding a
2943         fully qualified name.  
2944
2945         Now everyone registers a fully qualified name in the DeclSpace as
2946         being defined instead of the partial name.  
2947
2948         Downsides: we are slower than we need to be due to the excess
2949         copies and the names being registered this way.  
2950
2951         The reason for this is that we currently depend (on the corlib
2952         bootstrap for instance) that types are fully qualified, because
2953         we dump all the types in the namespace, and we should really have
2954         types inserted into the proper namespace, so we can only store the
2955         basenames in the defined_names array.
2956
2957 2002-10-10  Martin Baulig  <martin@gnome.org>
2958
2959         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
2960         from bug #31834, see the bug report for a testcase which is
2961         miscompiled.
2962
2963 2002-10-10  Martin Baulig  <martin@gnome.org>
2964
2965         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
2966         flow analysis code for this.
2967
2968         * statement.cs (Do, While, For): Tell the flow analysis code about
2969         infinite loops.
2970         (FlowBranching.UsageVector): Added support for infinite loops.
2971         (Block.Resolve): Moved the dead code elimination here and use flow
2972         analysis to do it.
2973
2974 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
2975
2976         * class.cs (Field.Define): Catch cycles on struct type
2977         definitions. 
2978
2979         * typemanager.cs (IsUnmanagedtype): Do not recursively check
2980         fields if the fields are static.  We only need to check instance
2981         fields. 
2982
2983         * expression.cs (As.DoResolve): Test for reference type.
2984
2985         * statement.cs (Using.ResolveExpression): Use
2986         ConvertImplicitRequired, not ConvertImplicit which reports an
2987         error on failture
2988         (Using.ResolveLocalVariableDecls): ditto.
2989
2990         * expression.cs (Binary.ResolveOperator): Report errors in a few
2991         places where we had to.
2992
2993         * typemanager.cs (IsUnmanagedtype): Finish implementation.
2994
2995 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
2996
2997         * expression.cs: Use StoreFromPtr instead of extracting the type
2998         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
2999
3000         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3001         an enumeration value to a System.Enum, but System.Enum is not a
3002         value type, but an class type, so we need to box.
3003
3004         (Expression.ConvertExplicit): One codepath could return
3005         errors but not flag them.  Fix this.  Fixes #31853
3006
3007         * parameter.cs (Resolve): Do not allow void as a parameter type.
3008
3009 2002-10-06  Martin Baulig  <martin@gnome.org>
3010
3011         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3012         if it's a class type and not a struct.  Fixes #31815.
3013
3014 2002-10-06  Martin Baulig  <martin@gnome.org>
3015
3016         * statement.cs: Reworked the flow analysis code a bit to make it
3017         usable for dead code elimination.
3018
3019 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3020
3021         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3022
3023 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3024
3025         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3026         to fix the test 165, will investigate deeper.
3027
3028 2002-10-04  Martin Baulig  <martin@gnome.org>
3029
3030         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3031         finally blocks actually work.
3032         (Try.Resolve): We don't need to create a sibling for `finally' if
3033         there is no finally block.
3034
3035 2002-10-04  Martin Baulig  <martin@gnome.org>
3036
3037         * class.cs (Constructor.Define): The default accessibility for a
3038         non-default constructor is private, not public.
3039
3040 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3041
3042         * class.cs (Constructor): Make AllowedModifiers public, add
3043         EXTERN.
3044
3045         * cs-parser.jay: Perform the modifiers test here, as the
3046         constructor for the Constructor class usually receives a zero
3047         because of the way we create it (first we create, later we
3048         customize, and we were never checking the modifiers).
3049
3050         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3051         is a version of LookupTypeReflection that includes the type-name
3052         cache.  This can be used as a fast path for functions that know
3053         the fully qualified name and are only calling into *.GetType() to
3054         obtain a composed type.
3055
3056         This is also used by TypeManager.LookupType during its type
3057         composition.
3058
3059         (LookupType): We now also track the real type name, as sometimes
3060         we can get a quey for the real type name from things like
3061         ComposedCast.  This fixes bug 31422.
3062         
3063         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3064         complete type fullname, it does not have to go through the type
3065         resolution system to obtain the composed version of the type (for
3066         obtaining arrays or pointers).
3067         
3068         (Conditional.Emit): Use the EmitBoolExpression to
3069         generate nicer code, as requested by Paolo.
3070
3071         (ArrayCreation.CheckIndices): Use the patch from
3072         hwang_rob@yahoo.ca to validate the array initializers. 
3073
3074 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3075
3076         * class.cs (ConstructorInitializer.Emit): simplify code by using
3077         Invocation.EmitCall, and at the same time, fix the bugs in calling
3078         parent constructors that took variable arguments. 
3079
3080         * ecore.cs (Expression.ConvertNumericExplicit,
3081         Expression.ImplicitNumericConversion): Remove the code that
3082         manually wrapped decimal (InternalTypeConstructor call is now gone
3083         as well).
3084
3085         * expression.cs (Cast.TryReduce): Also handle decimal types when
3086         trying to perform a constant fold on the type.
3087
3088         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3089
3090         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3091         that only turned off an error report, and did nothing else. 
3092
3093 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3094
3095         * driver.cs: Handle and ignore /fullpaths
3096
3097 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3098
3099         * expression.cs (Binary.ResolveOperator): Catch the case where
3100         DoNumericPromotions returns true, 
3101
3102         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3103
3104 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3105
3106         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3107         report error 70.
3108
3109 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3110
3111         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3112         conversion exists, but it is also required that the conversion be
3113         performed.  This manifested in "(Type64Enum) 2".  
3114
3115         * class.cs (TypeManager.AddMethod): The fix is not to change
3116         AddEnum, because that one was using a fully qualified name (every
3117         DeclSpace derivative does), but to change the AddMethod routine
3118         that was using an un-namespaced name.  This now correctly reports
3119         the duplicated name.
3120
3121         Revert patch until I can properly fix it.  The issue
3122         is that we have a shared Type space across all namespaces
3123         currently, which is wrong.
3124
3125         Options include making the Namespace a DeclSpace, and merge
3126         current_namespace/current_container in the parser.
3127
3128 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3129
3130         * cs-parser.jay: Improve error reporting when we get a different
3131         kind of expression in local_variable_type and
3132         local_variable_pointer_type. 
3133
3134         Propagate this to avoid missleading errors being reported.
3135
3136         * ecore.cs (ImplicitReferenceConversion): treat
3137         TypeManager.value_type as a target just like object_type.   As
3138         code like this:
3139
3140         ValueType v = 1;
3141
3142         Is valid, and needs to result in the int 1 being boxed before it
3143         is assigned to the value type v.
3144
3145         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3146         to validate the enumeration name.
3147
3148         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3149         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3150         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3151
3152         * ecore.cs (TryImplicitIntConversion): When doing an
3153         implicit-enumeration-conversion, check if the type is 64-bits and
3154         perform a conversion before passing to EnumConstant.
3155
3156 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3157
3158         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3159         report ambiguous type references.  Unlike the MS version, we
3160         report what the ambiguity is.   Innovation at work ;-)
3161
3162         (DeclSpace.FindType): Require a location argument to
3163         display when we display an ambiguous error.
3164
3165         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3166
3167         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3168
3169         * expression.cs (EmitDynamicInitializers): Apply patch from
3170         hwang_rob@yahoo.ca that fixes the order in which we emit our
3171         initializers. 
3172
3173 2002-09-21  Martin Baulig  <martin@gnome.org>
3174
3175         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3176         delegate takes no arguments.
3177
3178 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3179
3180         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3181         from integers.
3182
3183         * expression.cs: Extract the underlying type.
3184
3185         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3186
3187         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3188
3189 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3190
3191         * class.cs (TypeContainer.DefineType): We can not use the nice
3192         PackingSize with the size set to 1 DefineType method, because it
3193         will not allow us to define the interfaces that the struct
3194         implements.
3195
3196         This completes the fixing of bug 27287
3197
3198         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3199         means also structs.  This fixes part of the problem. 
3200         (Expresion.ImplicitReferenceConversionExists): ditto.
3201
3202         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3203         error if there were no errors reported during the type lookup
3204         process, to avoid duplicates or redundant errors.  Without this
3205         you would get an ambiguous errors plus a type not found.  We have
3206         beaten the user enough with the first error.  
3207
3208         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3209         reference. 
3210
3211         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3212         during the resolution process, stop the lookup, this avoids
3213         repeated error reports (same error twice).
3214
3215         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3216
3217         * typemanager.cs (LookupType): Redo the type lookup code to match
3218         the needs of System.Reflection.  
3219
3220         The issue is that System.Reflection requires references to nested
3221         types to begin with a "+" sign instead of a dot.  So toplevel
3222         types look like: "NameSpace.TopLevelClass", and nested ones look
3223         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3224         levels. 
3225
3226 2002-09-19  Martin Baulig  <martin@gnome.org>
3227
3228         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3229         says that a method always returns or always throws an exception,
3230         don't report the CS0161.
3231
3232         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3233         set `Returns = new_returns'.
3234
3235 2002-09-19  Martin Baulig  <martin@gnome.org>
3236
3237         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3238         to an enum constant, check for a CS0176.
3239
3240 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3241
3242         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3243         for operators that must be in pairs and report errors.
3244
3245         * ecore.cs (SimpleName.DoResolveType): During the initial type
3246         resolution process, when we define types recursively, we must
3247         check first for types in our current scope before we perform
3248         lookups in the enclosing scopes.
3249
3250         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3251
3252         (Invocation.VerifyArgumentsCompat): Call
3253         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3254         I thought we were supposed to always call this, but there are a
3255         few places in the code where we dont do it.
3256
3257 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3258
3259         * driver.cs: Add support in -linkres and -resource to specify the
3260         name of the identifier.
3261
3262 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3263
3264         * ecore.cs (StandardConversionExists): Sync with the conversion
3265         code: allow anything-* to void* conversions.
3266
3267         (FindMostSpecificSource): Use an Expression argument
3268         instead of a Type, because we might be handed over a Literal which
3269         gets a few more implicit conversions that plain types do not.  So
3270         this information was being lost.
3271
3272         Also, we drop the temporary type-holder expression when not
3273         required.
3274
3275 2002-09-17  Martin Baulig  <martin@gnome.org>
3276
3277         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3278         this is an explicit interface implementation.
3279
3280 2002-09-17  Martin Baulig  <martin@gnome.org>
3281
3282         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3283         different `IndexerName' attributes.
3284
3285         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3286         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3287         virtual CommonResolve().
3288
3289 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3290
3291         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3292         and convert that to the UnderlyingType.
3293
3294         * statement.cs (Foreach.Resolve): Indexers are just like variables
3295         or PropertyAccesses.
3296
3297         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3298         inside quoted strings, we were not doing this before.
3299
3300 2002-09-16  Martin Baulig  <martin@gnome.org>
3301
3302         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3303         resolve it.  This is needed for the definite assignment check of the
3304         instance expression, fixes bug #29846.
3305         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3306
3307 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3308
3309         * parameter.cs: Fix compile error.  Cannot reference static member
3310         from an instance object.  Is this an mcs bug?
3311
3312 2002-09-14  Martin Baulig  <martin@gnome.org>
3313
3314         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3315         multiple times.  Fixes bug #30295, added test-166.cs.
3316
3317 2002-09-14  Martin Baulig  <martin@gnome.org>
3318
3319         * statement.cs (Block.Emit): Don't emit unreachable code.
3320         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3321         `break' statements.
3322         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3323
3324 2002-09-14  Martin Baulig  <martin@gnome.org>
3325
3326         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3327         is set.
3328
3329 2002-09-14  Martin Baulig  <martin@gnome.org>
3330
3331         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3332         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3333         be false on the ms runtime.
3334
3335 2002-09-13  Martin Baulig  <martin@gnome.org>
3336
3337         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3338         the CS0038 error message.
3339
3340 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3341
3342         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3343         constant inside, return it.
3344
3345 2002-09-12  Martin Baulig  <martin@gnome.org>
3346
3347         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3348         implicit conversion can be done between enum types.
3349
3350         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3351         check whether an implicit conversion to the current enum's UnderlyingType
3352         exists and report an error if not.
3353
3354         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3355         without debugging support.
3356
3357         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3358         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3359
3360 2002-09-12  Martin Baulig  <martin@gnome.org>
3361
3362         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3363
3364         * ecore.cs (IMemberExpr.DeclaringType): New property.
3365         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3366         nonstatic member of an outer type (CS0038).
3367
3368 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3369
3370         * driver.cs: Activate the using-error detector at warning level
3371         4 (at least for MS-compatible APIs).
3372
3373         * namespace.cs (VerifyUsing): Small buglett fix.
3374
3375         * pending.cs (PendingImplementation): pass the container pointer. 
3376
3377         * interface.cs (GetMethods): Allow for recursive definition.  Long
3378         term, I would like to move every type to support recursive
3379         definitions, not the current ordering mechanism that we have right
3380         now.
3381
3382         The situation is this: Attributes are handled before interfaces,
3383         so we can apply attributes to interfaces.  But some attributes
3384         implement interfaces, we will now handle the simple cases
3385         (recursive definitions will just get an error).  
3386
3387         * parameter.cs: Only invalidate types at the end if we fail to
3388         lookup all types.  
3389
3390 2002-09-09  Martin Baulig  <martin@gnome.org>
3391
3392         * ecore.cs (PropertyExpr.Emit): Also check for
3393         TypeManager.system_int_array_get_length so this'll also work when
3394         compiling corlib.  Fixes #30003.
3395
3396 2002-09-09  Martin Baulig  <martin@gnome.org>
3397
3398         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3399         and throw an exception if we can't get the type's size.  Fixed #30040,
3400         added test-165.cs.
3401
3402 2002-09-09  Martin Baulig  <martin@gnome.org>
3403
3404         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3405
3406         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3407         context.  Fixes bug #30027.
3408
3409         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3410         virtual functions.  Fixes bug #30043, added test-164.cs.
3411
3412 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3413
3414         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3415
3416 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3417
3418         * driver.cs: Use an object to get the windows codepage since it's not a
3419         static property.
3420
3421 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3422
3423         * statement.cs (For.Emit): for infinite loops (test == null)
3424         return whether there is a break inside, not always "true".
3425
3426         * namespace.cs (UsingEntry): New struct to hold the name of the
3427         using definition, the location where it is defined, and whether it
3428         has been used in a successful type lookup.
3429         
3430         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3431         strings.
3432
3433         * decl.cs: ditto.
3434
3435 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3436
3437         * attribute.cs : Fix incorrect code which relied on catching
3438         a NullReferenceException to detect a null being passed in
3439         where an object was expected.
3440
3441 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3442
3443         * statement.cs (Try): flag the catch variable as assigned
3444
3445         * expression.cs (Cast): Simplified by using ResolveType instead of
3446         manually resolving.
3447
3448         * statement.cs (Catch): Fix bug by using ResolveType.
3449
3450 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3451
3452         * expression.cs (BetterConversion): Special case for when we have
3453         a NullLiteral as the argument and we have to choose between string
3454         and object types - we choose string the way csc does.
3455
3456         * attribute.cs (Attribute.Resolve): Catch the
3457         NullReferenceException and report error #182 since the Mono
3458         runtime no more has the bug and having this exception raised means
3459         we tried to select a constructor which takes an object and is
3460         passed a null.
3461
3462 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3463
3464         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3465         message (1502, 1503) when we can't locate a method after overload
3466         resolution. This is much more informative and closes the bug
3467         Miguel reported.
3468
3469         * interface.cs (PopulateMethod): Return if there are no argument
3470         types. Fixes a NullReferenceException bug.
3471
3472         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3473         expressions too. Previously we were checking only in one place for
3474         positional arguments leaving out named arguments.
3475
3476         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3477         type to the enum type is not allowed. Remove code corresponding to
3478         that.
3479
3480         (ConvertNumericExplicit): Allow explicit conversions from
3481         the underlying type to enum type. This precisely follows the spec
3482         and closes a bug filed by Gonzalo.
3483         
3484 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3485
3486         * compiler.csproj:
3487         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3488
3489 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3490
3491         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3492         it was important that we stored the right value after the
3493         reduction in `converted'.
3494
3495 2002-09-04  Martin Baulig  <martin@gnome.org>
3496
3497         * location.cs (Location.SymbolDocument): Use full pathnames for the
3498         source files.
3499
3500 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
3501
3502         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3503         of the expression resolve mechanism, because that will catch the
3504         SimpleName error failures.
3505
3506         (Conditional): If we can not resolve the
3507         expression, return, do not crash.
3508
3509 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3510
3511         * cs-tokenizer.cs:
3512         (location): display token name instead of its number.
3513
3514 2002-08-28  Martin Baulig  <martin@gnome.org>
3515
3516         * expression.cs (Binary.ResolveOperator): Don't silently return
3517         but return an error if an operator cannot be applied between two
3518         enum types.
3519
3520 2002-08-28  Martin Baulig  <martin@gnome.org>
3521
3522         * class.cs (Constructor.Define): Set the permission attributes
3523         correctly instead of making all constructors public.
3524
3525 2002-08-28  Martin Baulig  <martin@gnome.org>
3526
3527         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3528         for private members before reporting a CS0103; if we find anything,
3529         it's a CS0122.
3530
3531 2002-08-28  Martin Baulig  <martin@gnome.org>
3532
3533         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3534         to check whether `closure_start_type == closure_invocation_type',
3535         we also need to check whether `m.DeclaringType == closure_invocation_type'
3536         before bypassing the permission checks.  We might be accessing
3537         protected/private members from the base class.
3538         (TypeManager.RealMemberLookup): Only set private_ok if private
3539         members were requested via BindingFlags.NonPublic.
3540
3541         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3542
3543         * expression.cs (MemberAccess.ResolveMemberAccess): Set
3544         MethodGroupExpr.IsExplicitImpl if appropriate.
3545         (Invocation.DoResolve): Don't report the CS0120 for explicit
3546         interface implementations.
3547
3548 2002-08-27  Martin Baulig  <martin@gnome.org>
3549
3550         * expression.cs (Invocation.DoResolve): If this is a static
3551         method and we don't have an InstanceExpression, we must report
3552         a CS0120.
3553
3554 2002-08-25  Martin Baulig  <martin@gnome.org>
3555
3556         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3557         `==' between a valuetype and an object.
3558
3559 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
3560
3561         * ecore.cs (TypeExpr): Provide a ToString method.
3562
3563 2002-08-24  Martin Baulig  <martin@gnome.org>
3564
3565         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3566         now called proggie.dbg and it's a binary file.
3567
3568 2002-08-23  Martin Baulig  <martin@gnome.org>
3569
3570         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3571
3572 2002-08-23  Martin Baulig  <martin@gnome.org>
3573
3574         * struct.cs (MyStructInfo.ctor): Make this work with empty
3575         structs; it's not allowed to use foreach() on null.
3576
3577 2002-08-23  Martin Baulig  <martin@gnome.org>
3578
3579         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3580         writer the full pathname of the generated assembly.
3581
3582 2002-08-23  Martin Baulig  <martin@gnome.org>
3583
3584         * statements.cs (FlowBranching.UsageVector.MergeChildren):
3585         A `finally' block never returns or breaks; improved handling of
3586         unreachable code.
3587
3588 2002-08-23  Martin Baulig  <martin@gnome.org>
3589
3590         * statement.cs (Throw.Resolve): Allow `throw null'.
3591
3592 2002-08-23  Martin Baulig  <martin@gnome.org>
3593
3594         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3595         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3596         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
3597         MemberLookup would return a wrong event if this is an explicit
3598         interface implementation and the class has an event with the same
3599         name.
3600
3601 2002-08-23  Martin Baulig  <martin@gnome.org>
3602
3603         * statement.cs (Block.AddChildVariableNames): New public method.
3604         (Block.AddChildVariableName): Likewise.
3605         (Block.IsVariableNameUsedInChildBlock): Likewise.
3606         (Block.AddVariable): Check whether a variable name has already
3607         been used in a child block.
3608
3609         * cs-parser.jay (declare_local_variables): Mark all variable names
3610         from the current block as being used in a child block in the
3611         implicit block.
3612
3613 2002-08-23  Martin Baulig  <martin@gnome.org>
3614
3615         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3616         find the symbol writer.
3617
3618         * driver.cs: csc also allows the arguments to /define being
3619         separated by commas, not only by semicolons.
3620
3621 2002-08-23  Martin Baulig  <martin@gnome.org>
3622
3623         * interface.cs (Interface.GetMembers): Added static check for events.
3624
3625 2002-08-15  Martin Baulig  <martin@gnome.org>
3626
3627         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3628         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3629
3630         * ecore.cs (Expression.MemberLookup): Added documentation and explained
3631         why the MethodData.EmitDestructor() change was necessary.
3632
3633 2002-08-20  Martin Baulig  <martin@gnome.org>
3634
3635         * class.cs (TypeContainer.FindMembers): Added static check for events.
3636
3637         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3638
3639         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3640         use Type.GetEvents(), not Type.FindMembers().
3641
3642 2002-08-20  Martin Baulig  <martin@gnome.org>
3643
3644         * decl.cs (MemberCache): Added a special method cache which will
3645         be used for method-only searched.  This ensures that a method
3646         search will return a MethodInfo with the correct ReflectedType for
3647         inherited methods.      
3648
3649 2002-08-20  Martin Baulig  <martin@gnome.org>
3650
3651         * decl.cs (DeclSpace.FindMembers): Made this public.
3652
3653 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3654
3655         * delegate.cs: fixed build on windows.
3656         [FIXME:  Filed as bug #29150: MCS must report these errors.]
3657
3658 2002-08-19  Ravi Pratap  <ravi@ximian.com>
3659
3660         * ecore.cs (StandardConversionExists): Return a false
3661         if we are trying to convert the void type to anything else
3662         since that is not allowed.
3663
3664         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3665         we flag error 70 in the event an event is trying to be accessed
3666         directly from outside the declaring type.
3667
3668 2002-08-20  Martin Baulig  <martin@gnome.org>
3669
3670         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3671         MemberCache from typemanager.cs to decl.cs.
3672
3673 2002-08-19  Martin Baulig  <martin@gnome.org>
3674
3675         * class.cs (TypeContainer): Implement IMemberContainer.
3676         (TypeContainer.DefineMembers): Create the MemberCache.
3677         (TypeContainer.FindMembers): Do better BindingFlags checking; only
3678         return public members if BindingFlags.Public was given, check
3679         whether members are static.
3680
3681 2002-08-16  Martin Baulig  <martin@gnome.org>
3682
3683         * decl.cs (DeclSpace.Define): Splitted this in Define and
3684         DefineMembers.  DefineMembers is called first and initializes the
3685         MemberCache.
3686
3687         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
3688         DefineMembers() on all our DeclSpaces.
3689
3690         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3691         but call DefineMembers() on all nested interfaces.  We call their
3692         Define() in our new Define() function.
3693
3694         * interface.cs (Interface): Implement IMemberContainer.
3695         (Interface.Define): Moved all code except the attribute stuf to
3696         DefineMembers().
3697         (Interface.DefineMembers): Initialize the member cache.
3698
3699         * typemanager.cs (IMemberFinder): Removed this interface, we don't
3700         need this anymore since we can use MemberCache.FindMembers directly.
3701
3702 2002-08-19  Martin Baulig  <martin@gnome.org>
3703
3704         * typemanager.cs (MemberCache): When creating the cache for an
3705         interface type, add all inherited members.
3706         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
3707         to `out bool used_cache' and documented it.
3708         (TypeManager.MemberLookup): If we already used the cache in the first
3709         iteration, we don't need to do the interfaces check.
3710
3711 2002-08-19  Martin Baulig  <martin@gnome.org>
3712
3713         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
3714         here from IMemberFinder and don't implement this interface anymore.
3715         (DeclSpace.MemberCache): Moved here from IMemberFinder.
3716
3717         * typemanager.cs (IMemberFinder): This interface is now only used by
3718         classes which actually support the member cache.
3719         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
3720         since we only put DeclSpaces into this Hashtable.
3721         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
3722         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
3723
3724 2002-08-16  Martin Baulig  <martin@gnome.org>
3725
3726         * typemanager.cs (ICachingMemberFinder): Removed.
3727         (IMemberFinder.MemberCache): New property.
3728         (TypeManager.FindMembers): Merged this with RealFindMembers().
3729         This function will never be called from TypeManager.MemberLookup()
3730         so we can't use the cache here, just the IMemberFinder.
3731         (TypeManager.MemberLookup_FindMembers): Check whether the
3732         IMemberFinder has a MemberCache and call the cache's FindMembers
3733         function.
3734         (MemberCache): Rewrote larger parts of this yet another time and
3735         cleaned it up a bit.
3736
3737 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
3738
3739         * driver.cs (LoadArgs): Support quoting.
3740
3741         (Usage): Show the CSC-like command line arguments.
3742
3743         Improved a few error messages.
3744
3745 2002-08-15  Martin Baulig  <martin@gnome.org>
3746
3747         * typemanager.cs (IMemberContainer.Type): New property.
3748         (IMemberContainer.IsInterface): New property.
3749
3750         The following changes are conditional to BROKEN_RUNTIME, which is
3751         defined at the top of the file.
3752
3753         * typemanager.cs (MemberCache.MemberCache): Don't add the base
3754         class'es members, but add all members from TypeHandle.ObjectType
3755         if we're an interface.
3756         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
3757         is the current type.
3758         (MemberCache.CacheEntry.Container): Removed this field.
3759         (TypeHandle.GetMembers): Include inherited members.
3760
3761 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3762
3763         * typemanager.cs: fixed compilation and added a comment on a field that
3764         is never used.
3765
3766 2002-08-15  Martin Baulig  <martin@gnome.org>
3767
3768         * class.cs (ConstructorInitializer.Resolve): In the
3769         Expression.MemberLookup call, use the queried_type as
3770         invocation_type.
3771
3772         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
3773         declared' attribute, it's always true.
3774         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3775         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3776         temporary wrapper for FindMembers which tells MemberLookup whether
3777         members from the base classes are included in the return value.
3778         This will go away soon.
3779         (TypeManager.MemberLookup): Use this temporary hack here; once the
3780         new MemberCache is completed, we don't need to do the DeclaredOnly
3781         looping here anymore since the MemberCache will take care of this.
3782         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3783         (MemberCache): When creating the MemberCache for a class, get
3784         members from the current class and all its base classes.
3785         (MemberCache.CacheEntry.Container): New field.  This is a
3786         temporary hack until the Mono runtime is fixed to distinguish
3787         between ReflectedType and DeclaringType.  It allows us to use MCS
3788         with both the MS runtime and the unfixed Mono runtime without
3789         problems and without accecting performance.
3790         (MemberCache.SearchMembers): The DeclaredOnly looping from
3791         TypeManager.MemberLookup is now done here.      
3792
3793 2002-08-14  Martin Baulig  <martin@gnome.org>
3794
3795         * statement.cs (MyStructInfo.MyStructInfo): Don't call
3796         Type.GetFields on dynamic types but get the fields from the
3797         corresponding TypeContainer.
3798         (MyStructInfo.GetStructInfo): Added check for enum types.
3799
3800         * typemanager.cs (MemberList.IsSynchronized): Implemented.
3801         (MemberList.SyncRoot): Implemented.
3802         (TypeManager.FilterWithClosure): No need to check permissions if
3803         closure_start_type == closure_invocation_type, don't crash if
3804         closure_invocation_type is null.
3805
3806 2002-08-13  Martin Baulig  <martin@gnome.org>
3807
3808         Rewrote TypeContainer.FindMembers to use a member cache.  This
3809         gives us a speed increase of about 35% for the self-hosting MCS
3810         build and of about 15-20% for the class libs (both on GNU/Linux).
3811
3812         * report.cs (Timer): New class to get enhanced profiling.  This
3813         whole class is "TIMER" conditional since it remarkably slows down
3814         compilation speed.
3815
3816         * class.cs (MemberList): New class.  This is an IList wrapper
3817         which we're now using instead of passing MemberInfo[]'s around to
3818         avoid copying this array unnecessarily.
3819         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
3820         (ICachingMemberFinder, IMemberContainer): New interface.
3821         (TypeManager.FilterWithClosure): If `criteria' is null, the name
3822         has already been checked, otherwise use it for the name comparision.
3823         (TypeManager.FindMembers): Renamed to RealMemberFinder and
3824         provided wrapper which tries to use ICachingMemberFinder.FindMembers
3825         if possible.  Returns a MemberList, not a MemberInfo [].
3826         (TypeHandle): New class, implements IMemberContainer.  We create
3827         one instance of this class per type, it contains a MemberCache
3828         which is used to do the member lookups.
3829         (MemberCache): New class.  Each instance of this class contains
3830         all members of a type and a name-based hash table.
3831         (MemberCache.FindMembers): This is our new member lookup
3832         function.  First, it looks up all members of the requested name in
3833         the hash table.  Then, it walks this list and sorts out all
3834         applicable members and returns them.
3835
3836 2002-08-13  Martin Baulig  <martin@gnome.org>
3837
3838         In addition to a nice code cleanup, this gives us a performance
3839         increase of about 1.4% on GNU/Linux - not much, but it's already
3840         half a second for the self-hosting MCS compilation.
3841
3842         * typemanager.cs (IMemberFinder): New interface.  It is used by
3843         TypeManager.FindMembers to call FindMembers on a TypeContainer,
3844         Enum, Delegate or Interface.
3845         (TypeManager.finder_to_member_finder): New PtrHashtable.
3846         (TypeManager.finder_to_container): Removed.
3847         (TypeManager.finder_to_delegate): Removed.
3848         (TypeManager.finder_to_interface): Removed.
3849         (TypeManager.finder_to_enum): Removed.
3850
3851         * interface.cs (Interface): Implement IMemberFinder.
3852
3853         * delegate.cs (Delegate): Implement IMemberFinder.
3854
3855         * enum.cs (Enum): Implement IMemberFinder.
3856
3857         * class.cs (TypeContainer): Implement IMemberFinder.
3858
3859 2002-08-12  Martin Baulig  <martin@gnome.org>
3860
3861         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
3862
3863 2002-08-12  Martin Baulig  <martin@gnome.org>
3864
3865         * ecore.cs (ITypeExpression): New interface for expressions which
3866         resolve to a type.
3867         (TypeExpression): Renamed to TypeLookupExpression.
3868         (Expression.DoResolve): If we're doing a types-only lookup, the
3869         expression must implement the ITypeExpression interface and we
3870         call DoResolveType() on it.
3871         (SimpleName): Implement the new ITypeExpression interface.
3872         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
3873         hack, the situation that we're only looking up types can't happen
3874         anymore when this method is called.  Moved the type lookup code to
3875         DoResolveType() and call it.
3876         (SimpleName.DoResolveType): This ITypeExpression interface method
3877         is now doing the types-only lookup.
3878         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
3879         (ResolveFlags): Added MaskExprClass.
3880
3881         * expression.cs (MemberAccess): Implement the ITypeExpression
3882         interface.
3883         (MemberAccess.DoResolve): Added support for a types-only lookup
3884         when we're called via ITypeExpression.DoResolveType().
3885         (ComposedCast): Implement the ITypeExpression interface.
3886
3887         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
3888         Expression.Resolve() with ResolveFlags.Type instead.
3889
3890 2002-08-12  Martin Baulig  <martin@gnome.org>
3891
3892         * interface.cs (Interface.Define): Apply attributes.
3893
3894         * attribute.cs (Attribute.ApplyAttributes): Added support for
3895         interface attributes.
3896
3897 2002-08-11  Martin Baulig  <martin@gnome.org>
3898
3899         * statement.cs (Block.Emit): Only check the "this" variable if we
3900         do not always throw an exception.
3901
3902         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
3903         whether the property has a set accessor.
3904
3905 2002-08-11  Martin Baulig  <martin@gnome.org>
3906
3907         Added control flow analysis support for structs.
3908
3909         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
3910         with control flow analysis turned off.
3911         (IVariable): New interface.
3912         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
3913         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
3914         (FieldExpr.DoResolve): Resolve the instance expression with flow
3915         analysis turned off and do the definite assignment check after the
3916         resolving when we know what the expression will resolve to.
3917
3918         * expression.cs (LocalVariableReference, ParameterReference):
3919         Implement the new IVariable interface, only call the flow analysis
3920         code if ec.DoFlowAnalysis is true.
3921         (This): Added constructor which takes a Block argument.  Implement
3922         the new IVariable interface.
3923         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
3924         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
3925         This does the definite assignment checks for struct members.
3926
3927         * class.cs (Constructor.Emit): If this is a non-static `struct'
3928         constructor which doesn't have any initializer, call
3929         Block.AddThisVariable() to tell the flow analysis code that all
3930         struct elements must be initialized before control returns from
3931         the constructor.
3932
3933         * statement.cs (MyStructInfo): New public class.
3934         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
3935         argument to this indexer.  If non-zero, check an individual struct
3936         member, not the whole struct.
3937         (FlowBranching.CheckOutParameters): Check struct members.
3938         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
3939         overloaded versions of these methods which take an additional
3940         `int field_idx' argument to check struct members.
3941         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
3942         overloaded versions of these methods which take an additional
3943         `string field_name' argument to check struct member.s
3944         (VariableInfo): Implement the IVariable interface.
3945         (VariableInfo.StructInfo): New public property.  Returns the
3946         MyStructInfo instance of the variable if it's a struct or null.
3947         (Block.AddThisVariable): New public method.  This is called from
3948         Constructor.Emit() for non-static `struct' constructor which do
3949         not have any initializer.  It creates a special variable for the
3950         "this" instance variable which will be checked by the flow
3951         analysis code to ensure that all of the struct's fields are
3952         initialized before control returns from the constructor.
3953         (UsageVector): Added support for struct members.  If a
3954         variable/parameter is a struct with N members, we reserve a slot
3955         in the usage vector for each member.  A struct is considered fully
3956         initialized if either the struct itself (slot 0) or all its
3957         members are initialized.
3958
3959 2002-08-08  Martin Baulig  <martin@gnome.org>
3960
3961         * driver.cs (Driver.MainDriver): Only report an error CS5001
3962         if there were no compilation errors.
3963
3964         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
3965         `UnsafeContext' property to determine whether the parent is in
3966         unsafe context rather than checking the parent's ModFlags:
3967         classes nested in an unsafe class are unsafe as well.
3968
3969 2002-08-08  Martin Baulig  <martin@gnome.org>
3970
3971         * statement.cs (UsageVector.MergeChildren): Distinguish between
3972         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
3973         we return.  Added test17() and test18() to test-154.cs.
3974
3975 2002-08-08  Martin Baulig  <martin@gnome.org>
3976
3977         * typemanager.cs (TypeManager.FilterWithClosure): If we have
3978         Family access, make sure the invoking type isn't a subclass of the
3979         queried type (that'd be a CS1540).
3980
3981         * ecore.cs (Expression.MemberLookup): Added overloaded version of
3982         this method which takes an additional `Type invocation_type'.
3983
3984         * expression.cs (BaseAccess.DoResolve): Use the base type as
3985         invocation and query type.
3986         (MemberAccess.DoResolve): If the lookup failed and we're about to
3987         report a CS0122, try a lookup with the ec.ContainerType - if this
3988         succeeds, we must report a CS1540.
3989
3990 2002-08-08  Martin Baulig  <martin@gnome.org>
3991
3992         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3993         (MethodGroupExpr): Implement the IMemberExpr interface.
3994
3995         * expression (MemberAccess.ResolveMemberAccess): No need to have
3996         any special code for MethodGroupExprs anymore, they're now
3997         IMemberExprs.   
3998
3999 2002-08-08  Martin Baulig  <martin@gnome.org>
4000
4001         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4002         Family, FamANDAssem and FamORAssem permissions.
4003         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4004
4005 2002-08-08  Martin Baulig  <martin@gnome.org>
4006
4007         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4008         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4009         or loop block.
4010
4011 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4012
4013         * driver.cs: implemented /resource option to embed managed resources.
4014
4015 2002-08-07  Martin Baulig  <martin@gnome.org>
4016
4017         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4018         (FieldBase.HasFieldInitializer): New public property.
4019         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4020         returns the field initializer and makes sure it is only resolved once.
4021         (TypeContainer.EmitFieldInitializers): Call
4022         FieldBase.GetInitializerExpression to get the initializer, this ensures
4023         that it isn't resolved multiple times.
4024
4025         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4026         the resolving process (SimpleName/MemberLookup) that we're currently
4027         emitting a field initializer (which must not access any instance members,
4028         this is an error CS0236).
4029
4030         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4031         argument, if the `IsFieldInitializer' flag is set, we must report and
4032         error CS0236 and not an error CS0120.   
4033
4034 2002-08-07  Martin Baulig  <martin@gnome.org>
4035
4036         * ecore.cs (IMemberExpr): New public interface.
4037         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4038         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4039         if the expression is an IMemberExpr.
4040
4041         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4042         to be null, implicitly default to `this' if we're non-static in
4043         this case.  Simplified the code a lot by using the new IMemberExpr
4044         interface.  Also fixed bug #28176 here.
4045
4046 2002-08-06  Martin Baulig  <martin@gnome.org>
4047
4048         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4049         ParameterReferences during semantic analysis so that we can do a
4050         type-only search when resolving Cast, TypeOf and SizeOf.
4051         (block): Pass the `current_local_parameters' to the Block's
4052         constructor.
4053
4054         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4055         argument to the constructor.
4056         (ConstructorInitializer.Resolve): Create a temporary implicit
4057         block with the parameters.
4058
4059         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4060         references here if we aren't doing a type-only search.
4061
4062         * statement.cs (Block): Added constructor which takes a
4063         `Parameters parameters' argument.
4064         (Block.Parameters): New public property.
4065
4066         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4067         to `Parameters' and made it public readonly.
4068
4069 2002-08-06  Martin Baulig  <martin@gnome.org>
4070
4071         * ecore.cs (Expression.Warning): Made this public as well.
4072
4073         * report.cs (Report.Debug): Print the contents of collections.
4074
4075 2002-08-06  Martin Baulig  <martin@gnome.org>
4076
4077         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4078         used to tell Resolve() which kinds of expressions it may return.
4079         (Expression.Resolve): Added overloaded version of this method which
4080         takes a `ResolveFlags flags' argument.  This can be used to tell
4081         Resolve() which kinds of expressions it may return.  Reports a
4082         CS0118 on error.
4083         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4084         ResolveFlags.SimpleName.
4085         (Expression.Error118): Added overloaded version of this method which
4086         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4087         which kinds of expressions are allowed.
4088
4089         * expression.cs (Argument.ResolveMethodGroup): New public method.
4090         Resolves an argument, but allows a MethodGroup to be returned.
4091         This is used when invoking a delegate.
4092
4093         * TODO: Updated a bit.
4094
4095 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4096
4097         Fixed compilation with csc.
4098
4099         * ecore.cs: Expression.Error made public. Is this correct? Should
4100         Warning be made public too?
4101
4102         * expression.cs: use ea.Location instead of ea.loc.
4103         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4104
4105 2002-08-06  Martin Baulig  <martin@gnome.org>
4106
4107         * ecore.cs (Expression.loc): Moved the location here instead of
4108         duplicating it in all derived classes.
4109         (Expression.Location): New public property.
4110         (Expression.Error, Expression.Warning): Made them non-static and
4111         removed the location argument.
4112         (Expression.Warning): Added overloaded version which takes an
4113         `int level' argument.
4114         (Expression.Error118): Make this non-static and removed the
4115         expression and location arguments.
4116         (TypeExpr): Added location argument to the constructor.
4117
4118         * expression.cs (StaticCallExpr): Added location argument to
4119         the constructor.
4120         (Indirection, PointerArithmetic): Likewise.
4121         (CheckedExpr, UnCheckedExpr): Likewise.
4122         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4123         (StringPtr): Likewise.
4124
4125
4126 2002-08-05  Martin Baulig  <martin@gnome.org>
4127
4128         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4129
4130         * assign.cs (Assign.DoResolve): Check whether the source
4131         expression is a value or variable.
4132
4133         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4134         while resolving the corresponding blocks.
4135
4136         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4137         an error, don't silently return null.
4138
4139         * statement.cs (Block.AddVariable): Do the error reporting here
4140         and distinguish between CS0128 and CS0136.
4141         (Block.DoResolve): Report all unused labels (warning CS0164).
4142         (LabeledStatement): Pass the location to the constructor.
4143         (LabeledStatement.HasBeenReferenced): New property.
4144         (LabeledStatement.Resolve): Set it to true here.
4145
4146         * statement.cs (Return.Emit): Return success even after reporting
4147         a type mismatch error (CS0126 or CS0127), this is what csc does and
4148         it avoids confusing the users with any consecutive errors.
4149
4150 2002-08-05  Martin Baulig  <martin@gnome.org>
4151
4152         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4153
4154         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4155
4156         * expression.cs (MemberAccess.DoResolve): Silently return if an
4157         error has already been reported.
4158
4159         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4160         error has already been reported.
4161
4162 2002-08-05  Martin Baulig  <martin@gnome.org>
4163
4164         * statement.cs (UsageVector): Only initialize the `parameters'
4165         vector if we actually have any "out" parameters.
4166
4167 2002-08-05  Martin Baulig  <martin@gnome.org>
4168
4169         * expression.cs (Binary.ResolveOperator): When combining delegates,
4170         they must have the same type.
4171
4172 2002-08-05  Martin Baulig  <martin@gnome.org>
4173
4174         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4175         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4176         work with the ms runtime and we also don't need it: if we're a
4177         PropertyBuilder and not in the `indexer_arguments' hash, then we
4178         are a property and not an indexer.
4179
4180         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4181         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4182         since the latter one doesn't work with the ms runtime.
4183
4184 2002-08-03  Martin Baulig  <martin@gnome.org>
4185
4186         Fixed bugs #27998 and #22735.
4187
4188         * class.cs (Method.IsOperator): New public field.
4189         (Method.CheckBase): Report CS0111 if there's already a method
4190         with the same parameters in the current class.  Report CS0508 when
4191         attempting to change the return type of an inherited method.
4192         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4193         and it's not marked abstract or extern.
4194         (PropertyBase): New abstract base class for Property and Indexer.
4195         (PropertyBase.CheckBase): Moved here from Property and made it work
4196         for indexers.
4197         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4198         the same so we can reuse it there.
4199         (Property, Indexer): Derive from PropertyBase.
4200         (MethodSignature.inheritable_property_signature_filter): New delegate
4201         to find properties and indexers.
4202
4203         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4204         argument and improved error reporting.
4205
4206         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4207         EmptyReadOnlyParameters and made it a property.
4208
4209         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4210         version of this method which takes a `PropertyInfo indexer'.
4211         (TypeManager.RegisterIndexer): New method.
4212
4213         * class.cs: Added myself as author of this file :-)
4214
4215 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4216
4217         * class.cs: fixed compilation on windoze.
4218
4219 2002-08-03  Martin Baulig  <martin@gnome.org>
4220
4221         * interface.cs (Interface.GetInterfaceBases): Check whether all
4222         base interfaces are at least as accessible than the current one.
4223
4224         * class.cs (TypeContainer.GetClassBases): Check whether base types
4225         are at least as accessible than the current type.
4226         (TypeContainer.AsAccessible): Implemented and made non-static.
4227         (MemberBase.CheckParameters): Report errors if the accessibility
4228         checks fail.
4229
4230         * delegate.cs (Delegate.Delegate): The default visibility is
4231         internal for top-level types and private for nested types.
4232         (Delegate.Define): Report errors if the accessibility checks fail.
4233
4234         * enum.cs (Enum.Enum): The default visibility is internal for
4235         top-level types and private for nested types.
4236         (Enum.DefineType): Compute the correct visibility.
4237
4238         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4239         function which takes a `bool is_toplevel' instead of a TypeContainer.
4240
4241         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4242         builtin type.
4243
4244 2002-08-02  Martin Baulig  <martin@gnome.org>
4245
4246         * expression.cs (LocalVariableReferenc): Added constructor which
4247         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4248         (LocalVariableReference.IsReadOnly): New property.
4249         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4250         variable is readonly, use our own readonly flag to do this; you can
4251         use the new constructor to get a writable reference to a read-only
4252         variable.
4253
4254         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4255         reference to the local variable.
4256
4257 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4258
4259         * rootcontext.cs (ResolveCore): Also include System.Exception
4260
4261         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4262         we reach an EmptyStatement.
4263
4264         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4265         is also fine.
4266
4267         * expression.cs (Binary.ResolveOperator): Check error result in
4268         two places.
4269
4270         use brtrue/brfalse directly and avoid compares to null.
4271
4272 2002-08-02  Martin Baulig  <martin@gnome.org>
4273
4274         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4275         Fixes bug #28407, added test-155.cs.
4276
4277 2002-08-01  Martin Baulig  <martin@gnome.org>
4278
4279         * class.cs (Event.EmitDefaultMethod): Make this work with static
4280         events.  Fixes #28311, added verify-3.cs.
4281
4282 2002-08-01  Martin Baulig  <martin@gnome.org>
4283
4284         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4285         `is_disposable' fields.
4286         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4287         `hm.is_disposable' if we're using the collection pattern.
4288         (Foreach.EmitCollectionForeach): Use the correct type for the
4289         enumerator's local variable, only emit the try/finally block if
4290         necessary (fixes #27713).
4291
4292 2002-08-01  Martin Baulig  <martin@gnome.org>
4293
4294         * ecore.cs (Expression.report118): Renamed to Error118 and made
4295         it public static.
4296
4297         * statement.cs (Throw.Resolve): Check whether the expression is of
4298         the correct type (CS0118) and whether the type derives from
4299         System.Exception (CS0155).
4300         (Catch.Resolve): New method.  Do the type lookup here and check
4301         whether it derives from System.Exception (CS0155).
4302         (Catch.CatchType, Catch.IsGeneral): New public properties.
4303
4304         * typemanager.cs (TypeManager.exception_type): Added.
4305
4306 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4307
4308         * driver.cs: Updated About function.
4309
4310 2002-07-31  Martin Baulig  <martin@gnome.org>
4311
4312         Implemented Control Flow Analysis.
4313
4314         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4315         (EmitContext.CurrentBranching): Added.
4316         (EmitContext.StartFlowBranching): Added.
4317         (EmitContext.EndFlowBranching): Added.
4318         (EmitContext.KillFlowBranching): Added.
4319         (EmitContext.IsVariableAssigned): Added.
4320         (EmitContext.SetVariableAssigned): Added.
4321         (EmitContext.IsParameterAssigned): Added.
4322         (EmitContext.SetParameterAssigned): Added.
4323         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4324         Added control flow analysis stuff here.
4325
4326         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4327         resolve the expression as lvalue.
4328         (LocalVariableReference.DoResolve): Check whether the variable has
4329         already been assigned.
4330         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4331         the parameter as assigned here.
4332         (ParameterReference.DoResolve): Check whether the parameter has already
4333         been assigned.
4334         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4335         expression as lvalue.
4336
4337         * statement.cs (FlowBranching): New class for the flow analysis code.
4338         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4339         (LabeledStatement.IsDefined): New public property.
4340         (LabeledStatement.AddUsageVector): New public method to tell flow
4341         analyis that the label may be reached via a forward jump.
4342         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4343         flow analysis.
4344         (VariableInfo.Number): New public field.  This is used by flow analysis
4345         to number all locals of a block.
4346         (Block.CountVariables): New public property.  This is the number of
4347         local variables in this block (including the locals from all parent
4348         blocks).
4349         (Block.EmitMeta): Number all the variables.
4350
4351         * statement.cs: Added flow analysis support to all classes.
4352
4353 2002-07-31  Martin Baulig  <martin@gnome.org>
4354
4355         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4356         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4357         then use this argument.
4358
4359         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4360
4361         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4362         use this to specify /define options.
4363
4364 2002-07-29  Martin Baulig  <martin@gnome.org>
4365
4366         * statement.cs (Fixed): Moved all code that does variable lookups
4367         and resolvings from Emit to Resolve.
4368
4369         * statement.cs (For): Moved all code that does variable lookups
4370         and resolvings from Emit to Resolve.
4371
4372         * statement.cs (Using): Moved all code that does variable lookups
4373         and resolvings from Emit to Resolve.
4374
4375 2002-07-29  Martin Baulig  <martin@gnome.org>
4376
4377         * attribute.cs (Attribute.Resolve): Explicitly catch a
4378         System.NullReferenceException when creating the
4379         CustromAttributeBuilder and report a different warning message.
4380
4381 2002-07-29  Martin Baulig  <martin@gnome.org>
4382
4383         * support.cs (ParameterData.ParameterName): Added method to
4384         get the name of a parameter.
4385
4386         * typemanager.cs (TypeManager.IsValueType): New public method.
4387
4388 2002-07-29  Martin Baulig  <martin@gnome.org>
4389
4390         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4391         is a flag which specifies that it's either ref or out.
4392         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4393         the out parameter to `out Parameter.Modifier mod', also set the
4394         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4395
4396         * support.cs (InternalParameters.ParameterModifier): Distinguish
4397         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4398         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4399
4400         * expression.cs (Argument.GetParameterModifier): Distinguish
4401         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4402         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4403
4404 2002-07-29  Martin Baulig  <martin@gnome.org>
4405
4406         * expression.cs (ParameterReference.ParameterReference): Added
4407         `Location loc' argument to the constructor.
4408
4409         * cs-parser.jay: Pass location to ParameterReference.
4410
4411 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4412
4413         * statement.cs (Try): Initialize the location.
4414
4415         * cs-parser.jay: pass location to Try.
4416
4417         * expression.cs (Unary.Reduce): Change the prototype to return
4418         whether a constant fold could be performed or not.  The result is
4419         returned in an out parameters.  In the case of Indirection and
4420         AddressOf, we want to perform the full tests.
4421
4422 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4423
4424         * statement.cs (Statement.Emit): Flag dead code.
4425
4426 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4427
4428         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4429
4430 2002-07-27  Martin Baulig  <martin@gnome.org>
4431
4432         * class.cs (MethodData.Define): Put back call to
4433         TypeManager.AddMethod(), accidentally commented this out.
4434
4435         * report.cs (Debug): New public method to print debugging information,
4436         this is `[Conditional ("DEBUG")]'.
4437
4438 2002-07-26  Martin Baulig  <martin@gnome.org>
4439
4440         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4441         (switch_statement): Push the current_block to the switch_stack and
4442         pop it again when we're done with the switch.
4443         (switch_section): The new block is a child of the current_block.
4444         Fixes bug #24007, added test-152.cs.
4445
4446 2002-07-27  Martin Baulig  <martin@gnome.org>
4447
4448         * expression.cs (Invocation.EmitArguments): When calling a varargs
4449         function with only its fixed arguments, we need to pass an empty
4450         array.
4451
4452 2002-07-27  Martin Baulig  <martin@gnome.org>
4453
4454         Mono 0.13 has been released.
4455
4456 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4457
4458         * driver.cs: Rename --resource to --linkres, because that is what
4459         we do currently, we dont support --resource yet.
4460
4461         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4462
4463 2002-07-25  Martin Baulig  <martin@gnome.org>
4464
4465         * class.cs (MethodData): New public class.  This is a `method builder'
4466         class for a method or one accessor of a Property/Indexer/Event.
4467         (MethodData.GetMethodFlags): Moved here from MemberBase.
4468         (MethodData.ApplyAttributes): Likewise.
4469         (MethodData.ApplyObsoleteAttribute): Likewise.
4470         (MethodData.ApplyConditionalAttribute): Likewise.
4471         (MethodData.ApplyDllImportAttribute): Likewise.
4472         (MethodData.CheckAbstractAndExternal): Likewise.
4473         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4474         (MethodData.Emit): Formerly known as Method.Emit().
4475         (MemberBase): Moved everything which was specific to a single
4476         accessor/method to MethodData.
4477         (Method): Create a new MethodData and call Define() and Emit() on it.
4478         (Property, Indexer, Event): Create a new MethodData objects for each
4479         accessor and call Define() and Emit() on them.
4480
4481 2002-07-25  Martin Baulig  <martin@gnome.org>
4482
4483         Made MethodCore derive from MemberBase to reuse the code from there.
4484         MemberBase now also checks for attributes.
4485
4486         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4487         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4488         as virtual.
4489         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4490         `CallingConventions cc' and `Attributes opt_attrs' arguments.
4491         (MemberBase.ApplyAttributes): New virtual method; applies the
4492         attributes to a method or accessor.
4493         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4494         (MemberBase.ApplyConditionalAttribute): Likewise.
4495         (MemberBase.ApplyDllImportAttribute): Likewise.
4496         (MemberBase.CheckAbstractAndExternal): Likewise.
4497         (MethodCore.ParameterTypes): This is now a property instead of a
4498         method, it's initialized from DoDefineParameters().
4499         (MethodCore.ParameterInfo): Removed the set accessor.
4500         (MethodCore.DoDefineParameters): New protected virtual method to
4501         initialize ParameterTypes and ParameterInfo.
4502         (Method.GetReturnType): We can now simply return the MemberType.
4503         (Method.GetMethodFlags): Override the MemberBase version and add
4504         the conditional flags.
4505         (Method.CheckBase): Moved some code from Define() here, call
4506         DoDefineParameters() here.
4507         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4508         here to avoid some larger code duplication.
4509         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4510         ensure that abstract and external accessors don't declare a body.
4511
4512         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4513         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4514         lookup in the attribute's parent classes, so we need to abort as soon
4515         as we found the first match.
4516         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4517         the attribute has no arguments.
4518
4519         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4520         of a Method.
4521
4522 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4523
4524         * cs-parser.jay: reverted previous patch.
4525
4526 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4527
4528         * cs-parser.jay: fixed bug #22119.
4529
4530 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4531
4532         * attribute.cs: fixed compilation. The error was:
4533         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
4534         be assigned to before control leaves the current method."
4535         [FIXME:  Filed as bug #28186: MCS must report this error.]
4536
4537 2002-07-25  Martin Baulig  <martin@gnome.org>
4538
4539         * attribute.cs (Attribute.Conditional_GetConditionName): New static
4540         method to pull the condition name ouf of a Conditional attribute.
4541         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4542         the obsolete message and error flag out of an Obsolete attribute.
4543
4544         * class.cs (Method.GetMethodFlags): New public method to get the
4545         TypeManager.MethodFlags for this method.
4546         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4547         private methods.
4548         (Method.Define): Get and apply the Obsolete and Conditional attributes;
4549         if we're overriding a virtual function, set the new private variable
4550         `parent_method'; call the new TypeManager.AddMethod().
4551
4552         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
4553         the MethodBuilder and the Method in a PtrHashtable.
4554         (TypeManager.builder_to_method): Added for this purpose.
4555         (TypeManager.MethodFlags): Added IsObsoleteError.
4556         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
4557         Obsolete and Conditional arguments in MethodBuilders.  If we discover
4558         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4559         the message from the attribute.
4560
4561 2002-07-24  Martin Baulig  <martin@gnome.org>
4562
4563         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4564         preprocessor directives, ensure that the argument to #define/#undef is
4565         exactly one identifier and that it's actually an identifier.
4566
4567         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4568         did not work ....
4569
4570 2002-07-24  Martin Baulig  <martin@gnome.org>
4571
4572         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4573         initialize it to TypeManager.object_type in the constructor.
4574         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4575         of the `hm.get_current' method if we're using the collection pattern.
4576         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4577         for the explicit conversion to make it work when we're using the collection
4578         pattern and the `Current' property has a different return type than `object'.
4579         Fixes #27713.
4580
4581 2002-07-24  Martin Baulig  <martin@gnome.org>
4582
4583         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4584         does not match, but don't report any errors.  This method is called in
4585         order for all methods in a MethodGroupExpr until a matching method is
4586         found, so we don't want to bail out if the first method doesn't match.
4587         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4588         matches, report the 123.  Fixes #28070.
4589
4590 2002-07-24  Martin Baulig  <martin@gnome.org>
4591
4592         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4593         TypeManager.TypeToCoreType() to the top of the method so the
4594         following equality checks will work.  Fixes #28107.
4595
4596 2002-07-24  Martin Baulig  <martin@gnome.org>
4597
4598         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4599         operand is of type uint, and the other operand is of type sbyte,
4600         short or int, the operands are converted to type long." -
4601         Actually do what this comment already told us.  Fixes bug #28106,
4602         added test-150.cs.
4603
4604 2002-07-24  Martin Baulig  <martin@gnome.org>
4605
4606         * class.cs (MethodBase): New abstract class.  This is now a base
4607         class for Property, Indexer and Event to avoid some code duplication
4608         in their Define() and DefineMethods() methods.
4609         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4610         generic methods for Define() and DefineMethods().
4611         (FieldBase): Derive from MemberBase, not MemberCore.
4612         (Property): Derive from MemberBase, not MemberCore.
4613         (Property.DefineMethod): Moved all the code from this method to the
4614         new MethodBase.DefineAccessor(), just call it with appropriate
4615         argumetnts.
4616         (Property.Define): Call the new Property.DoDefine(), this does some
4617         sanity checks and we don't need to duplicate the code everywhere.
4618         (Event): Derive from MemberBase, not MemberCore.
4619         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4620         accessors, this will also make them work with interface events.
4621         (Indexer): Derive from MemberBase, not MemberCore.
4622         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4623         (Indexer.Define): Use the new MethodBase functions.
4624
4625         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4626         argument to the constructor.
4627         (Interface.FindMembers): Added support for interface events.
4628         (Interface.PopluateEvent): Implemented.
4629
4630         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
4631
4632 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
4633
4634         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4635         but this is required to check for a method name being the same as
4636         the containing class.  
4637
4638         Handle this now.
4639
4640 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4641
4642         * interface.cs: initialize variable.
4643
4644 2002-07-23  Martin Baulig  <martin@gnome.org>
4645
4646         Implemented the IndexerName attribute in interfaces.
4647
4648         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4649         name if this is an explicit interface implementation.
4650         (Indexer.InterfaceIndexerName): New public variable.  If we're
4651         implementing an interface indexer, this is the IndexerName in that
4652         interface.  Otherwise, it's the IndexerName.
4653         (Indexer.DefineMethod): If we're implementing interface indexer,
4654         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
4655         and Pending.ImplementIndexer methods.
4656         (Indexer.Define): Also define the PropertyBuilder if we're
4657         implementing an interface indexer and this is neither an explicit
4658         interface implementation nor do the IndexerName match the one in
4659         the interface.
4660
4661         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4662         If a method is defined here, then we always need to create a proxy
4663         for it.  This is used when implementing interface indexers.
4664         (Pending.IsInterfaceIndexer): New public method.
4665         (Pending.ImplementIndexer): New public method.
4666         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4667         This is used when implementing interface indexers to define a proxy
4668         if necessary.
4669         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4670         define a proxy if necessary.
4671
4672         * interface.cs (Interface.IndexerName): New public variable.
4673         (Interface.PopulateIndexer): Set the IndexerName.
4674         (Interface.DefineIndexers): New private method.  Populate all the
4675         indexers and make sure their IndexerNames match.
4676
4677         * typemanager.cs (IndexerPropertyName): Added support for interface
4678         indexers.
4679
4680 2002-07-22  Martin Baulig  <martin@gnome.org>
4681
4682         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4683         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4684         ret if HasReturnLabel.
4685         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4686         variables.
4687
4688         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4689         and set the ec.LoopBeginTryCatchLevel.
4690         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4691         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
4692         the current ec.TryCatchLevel, the branch goes out of an exception
4693         block.  In this case, we need to use Leave and not Br.
4694
4695 2002-07-22  Martin Baulig  <martin@gnome.org>
4696
4697         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
4698         block unless the block does not always return or it is contained in
4699         another try { ... } catch { ... } block.  Fixes bug #26506.
4700         Added verify-1.cs to the test suite.
4701
4702 2002-07-22  Martin Baulig  <martin@gnome.org>
4703
4704         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
4705         then we do not always return.  Fixes bug #24985.
4706
4707 2002-07-22  Martin Baulig  <martin@gnome.org>
4708
4709         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
4710         lookup on a per-class level; ie. walk up the class hierarchy until we
4711         found at least one applicable method, then choose the best among them.
4712         Fixes bug #24463 and test-29.cs.
4713
4714 2002-07-22  Martin Baulig  <martin@gnome.org>
4715
4716         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
4717         return types of the methods.  The return type is not part of the
4718         signature and we must not check it to make the `new' modifier work.
4719         Fixes bug #27999, also added test-147.cs.
4720         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
4721
4722         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
4723         on the method's return type.
4724
4725 2002-07-21  Martin Baulig  <martin@gnome.org>
4726
4727         * assign.cs: Make this work if the rightmost source is a constant and
4728         we need to do an implicit type conversion.  Also adding a few more tests
4729         to test-38.cs which should have caught this.
4730
4731         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
4732         target in the makefile for this.  The makefile.gnu is primarily intended
4733         for end-users who don't want to debug the compiler.
4734
4735 2002-07-21  Martin Baulig  <martin@gnome.org>
4736
4737         * assign.cs: Improved the Assign class so it can now handle embedded
4738         assignments (X = Y = Z = something).  As a side-effect this'll now also
4739         consume less local variables.  test-38.cs now passes with MCS, added
4740         a few new test cases to that test.
4741
4742 2002-07-20  Martin Baulig  <martin@gnome.org>
4743
4744         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
4745         instructions.  Fixes bug #27977, also added test-146.cs.
4746
4747 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4748
4749         * cs-tokenizer.cs: fixed getHex ().
4750
4751 2002-07-19  Martin Baulig  <martin@gnome.org>
4752
4753         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
4754         not Type.GetType() to lookup the array type.  This is needed when
4755         we're constructing an array of a user-defined type.
4756         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
4757         single-dimensional arrays, but also for single-dimensial arrays of
4758         type decimal.
4759
4760 2002-07-19  Martin Baulig  <martin@gnome.org>
4761
4762         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
4763         this function is called, it's not allowed to share LocalBuilders
4764         among ILGenerators.
4765
4766 2002-07-19  Martin Baulig  <martin@gnome.org>
4767
4768         * expression.cs (Argument.Resolve): Report an error 118 when trying
4769         to pass a type as argument.
4770
4771 2002-07-18  Martin Baulig  <martin@gnome.org>
4772
4773         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
4774         Conv_R_Un for the signed `long' type.
4775
4776 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
4777
4778         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4779         `expr' for the temporary result, as that will fail if we do
4780         multiple resolves on the same expression.
4781
4782 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
4783
4784         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4785         ec.TypeContainer for looking up aliases. 
4786
4787         * class.cs (TypeContainer): Remove LookupAlias from here.
4788
4789         * decl.cs (DeclSpace); Move here.
4790
4791 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
4792
4793         * class.cs (FindMembers): Only call filter if the constructor
4794         bulider is not null.
4795
4796         Also handle delegates in `NestedTypes' now.  Now we will perform
4797         type lookups using the standard resolution process.  This also
4798         fixes a bug.
4799
4800         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4801         This uses Expressions (the limited kind that can be parsed by the
4802         tree) instead of strings.
4803
4804         * expression.cs (ComposedCast.ToString): Implement, used to flag
4805         errors since now we have to render expressions.
4806
4807         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
4808         FormArrayType. 
4809
4810         * ecore.cs (SimpleName.ToString): ditto.
4811
4812         * cs-parser.jay: Instead of using strings to assemble types, use
4813         Expressions to assemble the type (using SimpleName, ComposedCast,
4814         MemberAccess).  This should fix the type lookups in declarations,
4815         because we were using a different code path for this.
4816
4817         * statement.cs (Block.Resolve): Continue processing statements
4818         even when there is an error.
4819
4820 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
4821
4822         * class.cs (Event.Define): Also remove the `remove' method from
4823         the list of pending items.
4824
4825         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
4826         generate more compact code. 
4827
4828 2002-07-17  Martin Baulig  <martin@gnome.org>
4829
4830         * const.cs (Const.LookupConstantValue): Add support for constant
4831         `unchecked' and `checked' expressions.
4832         Also adding test case test-140.cs for this.
4833
4834 2002-07-17  Martin Baulig  <martin@gnome.org>
4835
4836         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
4837         check whether mi.ReturnType implements the IEnumerator interface; the
4838         `==' and the IsAssignableFrom() will fail in this situation.
4839
4840 2002-07-16  Ravi Pratap  <ravi@ximian.com>
4841
4842         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
4843         here too.
4844
4845 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4846
4847         * expression.cs: fixed bug #27811.
4848
4849 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
4850
4851         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
4852         Molaro: when we are a ref, the value already contains a pointer
4853         value, do not take the address of it.
4854
4855 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4856         * removed mb-parser.jay and mb-tokenizer.cs
4857
4858 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4859
4860         * expression.cs: check against the building corlib void type.
4861
4862 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
4863
4864         * ecore.cs: fix for valuetype static readonly fields: when 
4865         initializing them, we need their address, not the address of a copy.
4866
4867 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
4868
4869         * typemanager.cs: register also enum_type in corlib.
4870
4871 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4872
4873         * class.cs: allow calling this (but not base) initializers in structs.
4874
4875 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
4876
4877         * ecore.cs: make sure we compare against the building base types
4878         in GetTypeSize ().
4879
4880 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
4881
4882         * typemanager.cs: fix TypeToCoreType() to handle void and object
4883         (corlib gets no more typerefs after this change).
4884
4885 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
4886
4887         * expression.cs (ArrayCreation.EmitArrayArguments): use
4888         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
4889
4890         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
4891         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
4892         array indexes, the runtime actually forbids them.
4893
4894         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
4895         for array arguments here.
4896
4897         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
4898         instead of the default for ValueTypes.
4899
4900         (New.DoEmit): Use IsValueType instead of
4901         IsSubclassOf (value_type)
4902         (New.DoResolve): ditto.
4903         (Invocation.EmitCall): ditto.
4904
4905         * assign.cs (Assign): ditto.
4906
4907         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
4908         Statements *are* currently doing part of their resolution during
4909         Emit.  
4910
4911         Expressions do always resolve during resolve, but statements are
4912         only required to propagate resolution to their children.
4913
4914 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
4915
4916         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
4917
4918         (LoadAssembly): Do not add the dll if it is already specified
4919         
4920         (MainDriver): Add the System directory to the link path at the end,
4921         after all the other -L arguments. 
4922
4923         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
4924         wrong opcode for loading bytes and bools (ldelem.i1 instead of
4925         ldelem.u1) and using the opposite for sbytes.
4926
4927         This fixes Digger, and we can finally run it.
4928
4929         * driver.cs (UnixParseOption): Move the option parsing here.  
4930         (CSCParseOption): Implement CSC-like parsing of options.
4931
4932         We now support both modes of operation, the old Unix way, and the
4933         new CSC-like way.  This should help those who wanted to make cross
4934         platform makefiles.
4935
4936         The only thing broken is that /r:, /reference: and /lib: are not
4937         implemented, because I want to make those have the same semantics
4938         as the CSC compiler has, and kill once and for all the confussion
4939         around this.   Will be doing this tomorrow.
4940
4941         * statement.cs (Unsafe.Resolve): The state is checked during
4942         resolve, not emit, so we have to set the flags for IsUnsfe here.
4943
4944 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4945
4946         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
4947         not catch the Error_ObjectRefRequired in SimpleName (as it is
4948         possible to have a class/instance variable name that later gets
4949         deambiguated), we have to check this here.      
4950
4951 2002-07-10  Ravi Pratap  <ravi@ximian.com>
4952
4953         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
4954         make static and put into Expression.
4955
4956         (Event.Define): Register the private field of the event with the 
4957         TypeManager so that GetFieldFromEvent can get at it.
4958
4959         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
4960         keep track of the private field associated with an event which
4961         has no accessors.
4962
4963         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
4964         private field.
4965
4966         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
4967         
4968 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4969
4970         * expression.cs (Binary.EmitBranchable): this routine emits the
4971         Binary expression in a branchable context.  This basically means:
4972         we need to branch somewhere, not just get the value on the stack.
4973
4974         This works together with Statement.EmitBoolExpression.
4975
4976         * statement.cs (Statement.EmitBoolExpression): Use
4977         EmitBranchable. 
4978
4979 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
4980
4981         * statement.cs (For): Reduce the number of jumps in loops.
4982
4983         (For): Implement loop inversion for the For statement.
4984
4985         (Break): We can be breaking out of a Try/Catch controlled section
4986         (foreach might have an implicit try/catch clause), so we need to
4987         use Leave instead of Br.
4988
4989         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4990         now).  If the instace expression supports IMemoryLocation, we use
4991         the AddressOf method from the IMemoryLocation to extract the
4992         address instead of emitting the instance.
4993
4994         This showed up with `This', as we were emitting the instance
4995         always (Emit) instead of the Address of This.  Particularly
4996         interesting when This is a value type, as we dont want the Emit
4997         effect (which was to load the object).
4998         
4999 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5000
5001         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5002
5003         * statement.cs (Checked): Set the CheckedState during the resolve
5004         process too, as the ConvCast operations track the checked state on
5005         the resolve process, and not emit.
5006
5007         * cs-parser.jay (namespace_member_declaration): Flag that we have
5008         found a declaration when we do.  This is used to flag error 1529
5009
5010         * driver.cs: Report ok when we display the help only.
5011
5012 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5013
5014         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5015
5016 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5017
5018         * cs-tokenizer.cs (define): We also have to track locally the
5019         defines.  AllDefines is just used for the Conditional Attribute,
5020         but we also need the local defines for the current source code. 
5021
5022 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5023
5024         * statement.cs (While, For, Do): These loops can exit through a
5025         Break statement, use this information to tell whether the
5026         statement is the last piece of code.
5027
5028         (Break): Flag that we break.
5029
5030         * codegen.cs (EmitContexts): New `Breaks' state variable.
5031
5032 2002-07-03  Martin Baulig  <martin@gnome.org>
5033
5034         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5035         modifiers in method declarations in structs.  Otherwise, you won't
5036         be able to override things like Object.Equals().
5037
5038 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5039
5040         * class.cs (Method, Property, Indexer): Do not allow the public
5041         modifier to be used in explicit interface implementations.
5042
5043         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5044         override modifiers in method declarations in structs
5045
5046 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5047
5048         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5049         integer or real overflow, report an error
5050
5051 2002-07-02  Martin Baulig  <martin@gnome.org>
5052
5053         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5054         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5055         to tell the runtime about our newly created System.Object and
5056         System.ValueType types.
5057
5058 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5059
5060         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5061         struct instead of Ldarg/Starg.
5062
5063 2002-07-02  Martin Baulig  <martin@gnome.org>
5064
5065         * expression.cs (Indirection.Indirection): Call
5066         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5067
5068 2002-07-02  Martin Baulig  <martin@gnome.org>
5069
5070         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5071         ValueType, call TypeManager.TypeToCoreType() on it.
5072         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5073         the OpCodes.Newarr argument.
5074
5075 2002-07-02  Martin Baulig  <martin@gnome.org>
5076
5077         * expression.cs (Invocation.EmitCall): When compiling corlib,
5078         replace all calls to the system's System.Array type to calls to
5079         the newly created one.
5080
5081         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5082         System.Array methods.
5083         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5084         from the system's System.Array type which must be replaced.
5085
5086 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5087
5088         * typemanager.cs: load unverifiable_code_ctor so we can build
5089         corlib using the correct type. Avoid using GetTypeCode() with
5090         TypeBuilders.
5091         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5092         TypeManager.object_type to allow building corlib.
5093
5094 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5095
5096         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5097
5098 2002-07-01  Martin Baulig  <martin@gnome.org>
5099
5100         * class.cs: Make the last change actually work, we need to check
5101         whether `ifaces != null' to avoid a crash.
5102
5103 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5104
5105         * class.cs: when we build structs without fields that implement
5106         interfaces, we need to add the interfaces separately, since there is
5107         no API to both set the size and add the interfaces at type creation
5108         time.
5109
5110 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5111
5112         * expression.cs: the dimension arguments to the array constructors
5113         need to be converted if they are a long.
5114
5115 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5116
5117         * class.cs: don't emit ldarg.0 if there is no parent constructor
5118         (fixes showstopper for corlib).
5119
5120 2002-06-29  Martin Baulig  <martin@gnome.org>
5121
5122         MCS now compiles corlib on GNU/Linux :-)
5123
5124         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5125         ie. check for MethodImplOptions.InternalCall.
5126
5127         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5128         and TypeManager.attribute_type are null, so we must explicitly check
5129         whether parent is not null to find out whether it's an attribute type.
5130         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5131         and SetBuilder, not only if the property is neither abstract nor external.
5132         This is necessary to set the MethodImplOptions on the accessor methods.
5133         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5134         SetBuilder, see Property.Emit().
5135
5136         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5137         populate "System.Object", "System.ValueType" and "System.Attribute" since
5138         they've already been populated from BootCorlib_PopulateCoreTypes().
5139
5140 2002-06-29  Martin Baulig  <martin@gnome.org>
5141
5142         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5143         is the NullLiteral, we also need to make sure that target_type is not
5144         an enum type.   
5145
5146 2002-06-29  Martin Baulig  <martin@gnome.org>
5147
5148         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5149         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5150         before calling BootstrapCorlib_ResolveDelegate ().
5151
5152 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5153
5154         * statement.cs: fixed build-breaker. All tests passed ok.
5155
5156 2002-06-27  Martin Baulig  <martin@gnome.org>
5157
5158         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5159         for System.Decimal when compiling corlib.
5160
5161 2002-06-27  Martin Baulig  <martin@gnome.org>
5162
5163         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5164         switch blocks which contain nothing but a default clause.
5165
5166 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5167
5168        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5169
5170 2002-06-27  Martin Baulig  <martin@gnome.org>
5171
5172         * ecore.cs (PropertyExpr.PropertyExpr): Call
5173         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5174
5175         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5176         is already a TypeBuilder.
5177
5178 2002-06-27  Martin Baulig  <martin@gnome.org>
5179
5180         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5181         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5182         the "from an array-type to System.Array" case.  This makes it work
5183         when compiling corlib.
5184
5185 2002-06-27  Martin Baulig  <martin@gnome.org>
5186
5187         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5188         non-static PropertyExpr, set its InstanceExpression.  This makes
5189         the `ICollection.Count' property work in System/Array.cs.
5190
5191 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5192
5193         * driver.cs: Made error handling more consistent.  Errors now
5194         tracked by Report class, so many methods which used to return int
5195         now return void.  Main() now prints success/failure and 
5196         errors/warnings message.
5197
5198         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5199         the magic number return values (123 and 124).  Now, if the
5200         expected error occurs, the compiler exits with success (exit value
5201         0).  If the compilation completes without seeing that particular
5202         error, the compiler exits with failure (exit value 1).  The
5203         makefile in mcs/errors has been changed to handle the new behaviour.
5204
5205         * report.cs: Made 'expected error' number a property and renamed
5206         it from 'Probe' to 'ExpectedError'.
5207
5208         * genericparser.cs: Removed error handling support, since it is
5209         now all done by Report class.
5210
5211         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5212         class, so parse() no longer returns an int.
5213
5214         * namespace.cs: Use Report.Error instead of GenericParser.error
5215
5216 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5217
5218         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5219         TypeContainer.AddOperator): At the front of the list put the
5220         explicit implementations, so they get resolved/defined first. 
5221
5222 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5223
5224         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5225         interface type is implemented by this TypeContainer.  Used during
5226         explicit interface implementation.
5227
5228         (Property.Define, Indexer.Define, Method.Define): Validate that
5229         the given interface in the explicit implementation is one of the
5230         base classes for the containing type.
5231
5232         Also if we are explicitly implementing an interface, but there is
5233         no match in the pending implementation table, report an error.
5234
5235         (Property.Define): Only define the property if we are
5236         not explicitly implementing a property from an interface.  Use the
5237         correct name also for those properties (the same CSC uses,
5238         although that is really not needed).
5239         
5240         (Property.Emit): Do not emit attributes for explicitly implemented
5241         properties, as there is no TypeBuilder.
5242
5243         (Indexer.Emit): ditto.
5244
5245         Hiding then means that we do not really *implement* a pending
5246         implementation, which makes code fail.
5247
5248 2002-06-22  Martin Baulig  <martin@gnome.org>
5249
5250         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5251         the return value of Object.GetType().  [FIXME: we need to do this whenever
5252         we get a type back from the reflection library].
5253
5254 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5255
5256         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5257
5258 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5259
5260         * attribute.cs: Return null if we can not look up the type.
5261
5262         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5263         the interface types found.
5264
5265         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5266         interface types found.
5267
5268         * typemanager.cs (GetInterfaces): Make this routine returns alll
5269         the interfaces and work around the lame differences between
5270         System.Type and System.Reflection.Emit.TypeBuilder in the results
5271         result for GetInterfaces.
5272         
5273         (ExpandInterfaces): Given an array of interface types, expand and
5274         eliminate repeated ocurrences of an interface.  This expands in
5275         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5276         be IA, IB, IC.
5277         
5278 2002-06-21  Martin Baulig  <martin@gnome.org>
5279
5280         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5281         on System.Enum.
5282
5283 2002-06-21  Martin Baulig  <martin@gnome.org>
5284
5285         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5286         and called with one of the core types, return the corresponding typebuilder for
5287         that type.
5288
5289         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5290         element type.
5291
5292 2002-06-21  Martin Baulig  <martin@gnome.org>
5293
5294         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5295         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5296         (Expression.ConvertReferenceExplicit): Likewise.
5297
5298         * expression.cs (ElementAccess.DoResolve): Likewise.
5299         (ElementAccess.DoResolveLValue): Likewise.
5300
5301 2002-06-10  Martin Baulig  <martin@gnome.org>
5302
5303         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5304         add the "value" parameter to the parameter list.
5305
5306         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5307         to our caller.
5308
5309 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5310
5311         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5312         the argument to an int, uint, long or ulong, per the spec.  Also
5313         catch negative constants in array creation.
5314
5315 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5316
5317         * class.cs: do not allow the same interface to appear twice in
5318         the definition list.
5319
5320 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5321
5322         * ecore.cs: don't use ldlen with System.Array.
5323
5324 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5325
5326         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5327
5328 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5329
5330         * modifiers.cs: produce correct field attributes for protected
5331         internal. Easy fix so miguel can work on ther harder stuff:-)
5332
5333 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5334
5335         * pending.cs: New file.  Move the code from class.cs here.
5336         Support clearning the pending flag for all methods (when not doing
5337         explicit interface implementation).
5338
5339 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5340
5341         * rootcontext.cs: added a couple more types needed to bootstrap.
5342
5343 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5344
5345         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5346         constructor in the type, instead of any constructor in the type
5347         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5348         a bug in the Mono runtime when applying the params attribute). 
5349
5350 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5351         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5352
5353 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5354
5355         * expression.cs (Unary.ResolveOperator): Use TypeManager
5356         to resolve the type.
5357         
5358 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5359
5360         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5361         attached.
5362
5363         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5364         with each member too.
5365
5366         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5367         field builders too - this takes care of the enum member case.
5368
5369 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5370
5371         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5372         address-of operator on both value types and pointers.
5373         
5374 2002-06-10  Martin Baulig  <martin@gnome.org>
5375
5376         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5377         PropertyBuilder to the `property_builders' list.
5378
5379         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5380         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5381         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5382         find any indexers which are inherited from an interface.
5383
5384 2002-06-09  Martin Baulig  <martin@gnome.org>
5385
5386         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5387         the same type as the constant if necessary.  There's also a test-130.cs
5388         for this.
5389
5390         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5391
5392         * typemanager.cs (TypeManager.ChangeType): Previously known as
5393         Enum.ChangeEnumType().
5394
5395 2002-06-09  Martin Baulig  <martin@gnome.org>
5396
5397         * expression.cs (Cast.TryReduce): Added support for consts.
5398
5399 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5400
5401         * class.cs (Accessor): Hold attributes information so we can pass
5402         it along.
5403
5404         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5405         Modify to pass in attributes attached to the methods.
5406
5407         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5408
5409         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5410         to handle the Accessor kind :-)
5411
5412         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5413         
5414 2002-06-08  Martin Baulig  <martin@gnome.org>
5415
5416         * expression.cs (Unary.TryReduceNegative): Added support for
5417         ULongConstants.
5418
5419 2002-06-08  Martin Baulig  <martin@gnome.org>
5420
5421         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5422         name can't be found in the `defined_names' - the caller will do a
5423         MemberLookup in this case and thus find methods in System.Enum
5424         such as Enum.IsDefined().
5425
5426 2002-06-08  Martin Baulig  <martin@gnome.org>
5427
5428         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5429         Convert.ChangeType() which works with TypeBuilder created types.
5430         (Enum.LookupEnumValue, Enum.Define): Use it here.
5431
5432         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5433         `TypeBuilder.BaseType != null' check.
5434         (TypeContainer.FindMembers): Only lookup parent members if we
5435         actually have a parent.
5436         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5437         (ConstructorInitializer.Resolve): Likewise.
5438
5439         * interface.cs (Interface.FindMembers): Added
5440         `TypeBuilder.BaseType != null' check.
5441
5442         * rootcontext.cs (RootContext.ResolveCore): Added
5443         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5444         classes_second_stage.
5445
5446         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5447         debug_type and trace_type when compiling with --nostdlib.       
5448
5449 2002-06-07  Martin Baulig  <martin@gnome.org>
5450
5451         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5452         (AddField): Set it to true when adding a non-static field.
5453         (DefineType): Use `have_nonstatic_fields' to find out whether we
5454         have non-static fields, not `Fields != null'.
5455
5456 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5457
5458         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5459         dereferencing a null on the static-field code path)
5460
5461 2002-05-30  Martin Baulig  <martin@gnome.org>
5462
5463         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5464         to take command line arguments.  Use reflection to call the new
5465         custom `Initialize' function on the symbol writer and pass it the
5466         command line arguments.
5467
5468         * driver.cs (--debug-args): New command line argument to pass command
5469         line arguments to the symbol writer.
5470
5471 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5472
5473         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5474         the target type for indexers and properties.  Thanks to Joe for
5475         catching this.
5476
5477 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5478
5479         * typemanager.cs (MethodFlags): returns the method flags
5480         (Obsolete/ShouldIgnore) that control warning emission and whether
5481         the invocation should be made, or ignored. 
5482
5483         * expression.cs (Invocation.Emit): Remove previous hack, we should
5484         not do this on matching a base type, we should do this based on an attribute
5485
5486         Only emit calls to System.Diagnostics.Debug and
5487         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5488         on the command line.
5489
5490         * rootcontext.cs: Global settings for tracing and debugging.
5491
5492         * cs-tokenizer.cs (define): New utility function to track
5493         defines.   Set the global settings for TRACE and DEBUG if found.
5494
5495 2002-05-25  Ravi Pratap  <ravi@ximian.com>
5496
5497         * interface.cs (Populate*): Pass in the TypeContainer as well as
5498         the DeclSpace as parameters so that we can create EmitContexts and
5499         then use that to apply attributes etc.
5500
5501         (PopulateMethod, PopulateEvent, PopulateProperty)
5502         (PopulateIndexer): Apply attributes everywhere.
5503
5504         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5505         etc.
5506
5507         (ApplyAttributes): Update accordingly.
5508
5509         We now apply interface attributes for all members too.
5510
5511 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
5512
5513         * class.cs (Indexer.Define); Correctly check if we are explicit
5514         implementation (instead of checking the Name for a ".", we
5515         directly look up if the InterfaceType was specified).
5516
5517         Delay the creation of the PropertyBuilder.
5518
5519         Only create the PropertyBuilder if we are not an explicit
5520         interface implementation.   This means that explicit interface
5521         implementation members do not participate in regular function
5522         lookups, and hence fixes another major ambiguity problem in
5523         overload resolution (that was the visible effect).
5524
5525         (DefineMethod): Return whether we are doing an interface
5526         implementation. 
5527         
5528         * typemanager.cs: Temporary hack until we get attributes in
5529         interfaces (Ravi is working on that) and we get IndexerName
5530         support in interfaces.
5531
5532         * interface.cs: Register the indexers as properties.
5533
5534         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5535         warning, I have verified that this is a bug in the .NET runtime
5536         (JavaScript suffers of the same problem).
5537
5538         * typemanager.cs (MemberLookup): When looking up members for
5539         interfaces, the parent of an interface is the implicit
5540         System.Object (so we succeed in searches of Object methods in an
5541         interface method invocation.  Example:  IEnumerable x;  x.ToString
5542         ()) 
5543
5544 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
5545
5546         * class.cs (Event): Events should also register if they do
5547         implement the methods that an interface requires.
5548
5549         * typemanager.cs (MemberLookup); use the new GetInterfaces
5550         method. 
5551
5552         (GetInterfaces): The code used to lookup interfaces for a type is
5553         used in more than one place, factor it here. 
5554
5555         * driver.cs: Track the errors at the bottom of the file, we kept
5556         on going.
5557
5558         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5559         instance if the method we are calling is static!
5560
5561 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
5562
5563         * attribute.cs (ApplyAttributes): Make this function filter out
5564         the IndexerName attribute (as that attribute in reality is never
5565         applied) and return the string constant for the IndexerName
5566         attribute. 
5567
5568         * class.cs (TypeContainer.Emit): Validate that all the indexers
5569         have the same IndexerName attribute, and if so, set the
5570         DefaultName attribute on the class. 
5571
5572         * typemanager.cs: The return value might contain other stuff (not
5573         only methods).  For instance, consider a method with an "Item"
5574         property and an Item method.
5575
5576         * class.cs: If there is a problem with the parameter types,
5577         return. 
5578
5579 2002-05-24  Ravi Pratap  <ravi@ximian.com>
5580
5581         * ecore.cs (ImplicitConversionExists): Wrapper function which also
5582         looks at user defined conversion after making a call to 
5583         StandardConversionExists - we need this for overload resolution.
5584
5585         * expression.cs : Update accordingly the various method calls.
5586
5587         This fixes 2 bugs filed against implicit user defined conversions 
5588
5589 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
5590
5591         * statement.cs: Track the result of the assignment.
5592
5593 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
5594
5595         * expression.cs (MemberAccess): Improved error reporting for
5596         inaccessible members.
5597
5598 2002-05-22  Martin Baulig  <martin@gnome.org>
5599
5600         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
5601         itself with debugging support.
5602
5603 2002-05-22  Martin Baulig  <martin@gnome.org>
5604
5605         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5606         Removed, this isn't needed anymore.
5607
5608 2002-05-20  Martin Baulig  <martin@gnome.org>
5609
5610         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5611         be underlying type for an enum.
5612
5613 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
5614
5615         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5616         that splits out the loading of just the core types.
5617
5618         * rootcontext.cs (ResolveCore): Split the struct resolution in
5619         two, so we can load the enumeration underlying types before any
5620         enums are used.
5621
5622         * expression.cs (Is): Bandaid until we fix properly Switch (see
5623         bug #24985 for details).
5624
5625         * typemanager.cs (ImplementsInterface): The hashtable will contain
5626         a null if there are no interfaces implemented.
5627
5628 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
5629
5630         * cs-parser.jay (indexer_declarator): It is fine to have array
5631         parameters
5632
5633 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5634
5635         * typemanager.cs: (RegisterBuilder): New function used to register
5636         TypeBuilders that implement interfaces.  Since
5637         TypeBuilder.GetInterfaces (as usual) does not work with lame
5638         Reflection.Emit. 
5639         (AddUserType): register interfaces.
5640
5641         (ImplementsInterface): Use the builder_to_ifaces hash if we are
5642         dealing with TypeBuilder.  Also, arrays are showing up as
5643         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5644         methods can not be invoked on them!
5645
5646         * ecore.cs (ExplicitReferenceConversionExists): Made public.
5647         (ImplicitReferenceConversionExists): Split out from
5648         StandardConversionExists. 
5649
5650         * expression.cs (As): We were only implementing one of the three
5651         cases for the as operator.  We now implement them all.
5652         (Is): Implement the various other cases for Is as well.
5653
5654         * typemanager.cs (CACHE): New define used to control if we want or
5655         not the FindMembers cache.  Seems to have a negative impact on
5656         performance currently
5657
5658         (MemberLookup): Nested types have full acess to
5659         enclosing type members
5660
5661         Remove code that coped with instance/static returns for events, we
5662         now catch this in RealFindMembers.
5663
5664         (RealFindMembers): only perform static lookup if the instance
5665         lookup did not return a type or an event.  
5666
5667 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5668
5669         * assign.cs (CompoundAssign): We pass more semantic information
5670         now to Compound Assignments than we did before: now we have all
5671         the information at hand, and now we resolve the target *before* we
5672         do the expression expansion, which allows the "CacheValue" method
5673         to have the effect we intended (before, a [x] += 1 would generate
5674         two differen ArrayAccess expressions from the ElementAccess,
5675         during the resolution process).
5676
5677         (CompoundAssign.DoResolve): Resolve target and original_source here.
5678
5679 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
5680
5681         * expression.cs (ArrayAccess): dropped debugging information. 
5682
5683         * typemanager.cs: Small bug fix: I was always returning i_members,
5684         instead of one of i_members or s_members (depending on which had
5685         the content).
5686
5687         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
5688         method is invoked before any code generation takes place, and it
5689         is a mechanism to inform that the expression will be invoked more
5690         than once, and that the method should use temporary values to
5691         avoid having side effects
5692
5693         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
5694         
5695         * ecore.cs (Expression.CacheTemporaries): Provide empty default
5696         implementation.
5697
5698         * expression.cs (Indirection, ArrayAccess): Add support for
5699         CacheTemporaries in these two bad boys. 
5700
5701         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
5702         ldobj or ldind_ref.  
5703         (StoreFromPtr): Handle stobj as well.
5704
5705         * expression.cs (UnaryMutator): Share more code.
5706         
5707         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
5708         down: I was not tracking the Filter function as well, which
5709         was affecting the results of the cache.
5710
5711 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
5712
5713         * attribute.cs: Remove the hack to handle the CharSet property on
5714         StructLayouts. 
5715
5716 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
5717
5718         * attribute.cs (DoResolve): More uglyness, we now only try to
5719         resolve the attribute partially, to extract the CharSet
5720         information (only if we are a StructLayout attribute).  Otherwise 
5721
5722         (GetExtraTypeInfo): Add some code to conditionally kill in the
5723         future this.   I am more and more convinced that the .NET
5724         framework has special code to handle the attribute setting on
5725         certain elements.
5726
5727         * expression.cs (IsParamsMethodApplicable): Revert my previous
5728         foreach change here, it was wrong.
5729
5730 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
5731
5732         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
5733         (pp_expr): do not abort on unknown input, just return.
5734         (eval): abort if there are pending chars.
5735
5736         * attribute.cs (Attribute.Resolve): Positional parameters are
5737         optional.  Deal with that case.
5738
5739         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
5740         the Ansi/Unicode/Auto information for the type.
5741
5742         (TypeContainer.DefineType): instantiate the EmitContext here, as
5743         we will be using it during the type definition (to resolve
5744         attributes) and during the emit phase.
5745
5746         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
5747         to pull type information out of the attributes
5748
5749         (Attribute.Resolve): track the constructor builder, and allow for
5750         multiple invocations (structs and classes will use this).
5751
5752         * ecore.cs (MemberLookupFinal): new version with all the
5753         parameters customizable.
5754
5755         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
5756         constructors.  Return if the result value is null (as the error
5757         would have been flagged already by MemberLookupFinal)
5758
5759         Do not allow instances of abstract classes or interfaces to be
5760         created.
5761         
5762         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
5763         We have to compare the assembly property here when dealing with
5764         FamANDAssem and Assembly access modifiers, because we might be
5765         creating an assembly from *modules* (that means that we are not
5766         getting TypeBuilders for types defined in other modules that are
5767         part of this assembly).
5768
5769         (Method.Emit): If the method is marked abstract and has a body,
5770         emit an error. 
5771
5772         (TypeContainer.DefineMembers): If both the defined member and the
5773         parent name match are methods, then do not emit any warnings: let
5774         the Method.Define routine take care of flagging warnings.  But if
5775         there is a mismatch (method overrides something else, or method is
5776         overriwritten by something, then emit warning).
5777
5778         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5779         set to null, this means `do not check for the return type on the
5780         signature'. 
5781
5782         (Method.Define): set the return type for the method signature to
5783         null, so that we get methods with the same name and parameters and
5784         different return types.  This is used to flag warning 114 (you are
5785         hiding a method, and you probably want to use the new/override
5786         keywords instead).
5787
5788         * typemanager.cs (MemberLookup): Implemented proper access
5789         control, closing a long standing set of bug reports.  The problem
5790         was that the Framework only has two bits: Public and NonPublic,
5791         and NonPublic includes private and protected methods, but we need
5792         to enforce the FamANDAssem, FamOrAssem and Family. 
5793
5794 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
5795
5796         * statement.cs (GotoCase): Return true: Ammounts to giving up
5797         knowledge on whether we return or not, and letting the other case
5798         be responsible for it.
5799
5800 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
5801
5802         * driver.cs: Do not load directories for each file processed, only
5803         do it if there is a pattern.
5804
5805         * ecore.cs: Report readonly assigns here as well, as we might have
5806         been resolved only by MemberAccess.
5807
5808         (SimpleName.SimpleNameResolve): Also be useful for LValue
5809         resolution.   We need this to propagate assign to local readonly variables
5810
5811         * typemanager.cs: Use a ptrhashtable for the criteria, because we
5812         do not want to reuse potential criteria memory.
5813
5814         * class.cs (MyEventBuilder): Set reflected_type;
5815
5816         * ecore.cs (Constantify): Added support for constifying bools.
5817
5818         (RootContext.LookupType): Added a cache for values looked up in
5819         the declaration space.
5820
5821         * typemanager.cs (FindMembers): Now is a front-end to
5822         RealFindMembers, and provides a two-level hashtable-based cache to
5823         the request.  
5824
5825         15% performance improvement: from 22.5 to 19.2 seconds.
5826
5827         * expression.cs (IsParamsMethodApplicable): use foreach.
5828         (Invocation.DoResolve): ditto.
5829         (New.DoResolve): ditto.
5830         (ArrayCreation.DoResolve): ditto.
5831
5832         * ecore.cs (FindMostEncompassingType): use foreach.
5833
5834         * delegate.cs (NewDelegate.DoResolve): Use foreach
5835
5836         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
5837         (RemoveMethods): use foreach.
5838
5839         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
5840         nested foreach statements instead of for, and also break out of
5841         the inner loop once a match is found.
5842         
5843         (Invocation.OverloadResolve): Use foreach, simplify the code. 
5844
5845 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
5846
5847         * cfold.cs (BinaryFold): During an enumeration evaluation context,
5848         we actually unwrap the expression to allow for extra information
5849         to be extracted. 
5850
5851         * expression.cs: Use Shr_Un on unsigned operations. 
5852
5853 2002-05-08  Ravi Pratap  <ravi@ximian.com>
5854
5855         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
5856         applicable operators was not being considered correctly. This closes
5857         the bug Miguel reported.
5858
5859 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
5860
5861         * attribute.cs: check that the type derives from System.Attribute
5862         and report the correct error in that case (moved the duplicate code to
5863         its own method, too).
5864
5865 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
5866
5867         * attribute.cs: lookup attribute type name as the spec says: first the
5868         bare attribute name and then name + "Attribute" (nant compiles with
5869         mcs after this fix).
5870
5871 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
5872
5873         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
5874         Because of the way we parse things, we should try to see if a
5875         UIntConstant can fit in an integer.
5876
5877 2002-05-07  Ravi Pratap  <ravi@ximian.com>
5878
5879         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
5880         when we are in an explicit context.
5881
5882         (ConvertReferenceExplicit): When converting from Iface type S to Class
5883         T make sure the rules are implemented as an OR.
5884
5885         * parameter.cs (ParameterType): Make it a property for now although the
5886         purpose really isn't anything immediate.
5887         
5888         * expression.cs (Is*Applicable): Do better checking on the parameter type
5889         of a ref/out parameter. The ones from the system assemblies are already 
5890         marked with the correct type so we don't need to do any correction.
5891
5892         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
5893         the object type is standard too so include that.
5894
5895 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5896
5897         * ecore.cs (StandardConversionExists): Augment with missing code:
5898         deal with IntConstant, LongConstants and Enumerations.
5899
5900         * assign.cs: Report the error, instead of failing silently
5901
5902         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
5903         typecontainer that they are declared, because the
5904         typecontainer/namespace will have the list of using clauses that
5905         need to be applied.
5906
5907         Assembly Attributes were escaping the normal registration
5908         mechanism. 
5909
5910         (EmitCode): Apply attributes within an EmitContext that represents
5911         the container they were declared on.
5912         
5913         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
5914
5915 2002-05-06  Ravi Pratap  <ravi@ximian.com>
5916
5917         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
5918         Revamp completely - make much cleaner as we now operate only
5919         on a set of Types.
5920
5921         (FindMostSpecificSource, FindMostSpecificTarget): New methods
5922         to implement the logic detailed in the spec more correctly.
5923
5924         (UserDefinedConversion): Update accordingly.
5925
5926 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5927
5928         * statement.cs: Return flow analysis information up.
5929
5930         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
5931         and the default.
5932
5933         (token): Do not consume an extra character before calling
5934         decimal_digits.
5935
5936 2002-05-06  Piers Haken <piersh@friskit.com>
5937
5938         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
5939
5940 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5941
5942         * class.cs (Constructor.Emit): Set the IsStatic flag in the
5943         EmitContext during the instance constructor initializer
5944         resolution, to stop access to instance variables.
5945
5946         This is mandated by the spec, last paragraph of the `constructor
5947         initializers' section. 
5948
5949 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
5950
5951         * cs-parser.jay, class.cs (Accessor): new class used to represent
5952         an accessor (get or set).  In the past we used `null' to represent
5953         a missing accessor.  But this is ambiguous because there was no
5954         way to tell in abstract indexers/properties if one of them was
5955         specified.
5956
5957         Now there is a way of addressing that.
5958
5959         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
5960         instead of FindMembers.
5961
5962         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
5963         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
5964
5965         * attribute.cs: Treat indexers and properties as the same in terms
5966         of applying attributes
5967
5968         * ecore.cs (FindMostEncompassedType): Use statically initialized
5969         EmptyExpressions()s like we do elsewhere to avoid creating useless
5970         objects (and we take this out of the tight loop).
5971
5972         (GetConversionOperators): Move the code to extract the actual
5973         operators to a separate routine to clean things up.
5974
5975 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
5976
5977         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5978         events are always registered FieldBuilders.
5979         
5980         * class.cs (FieldBase): New class shared by Fields 
5981
5982         * delegate.cs: If we are a toplevel delegate, use our full name.
5983         If we are a nested delegate, then only use our tail name.
5984
5985 2002-05-02  Ravi Pratap  <ravi@ximian.com>
5986
5987         * expression.cs (IsApplicable): Ensure that we add the "&" to
5988         ref/out types before comparing it with the type of the argument.
5989
5990         (IsParamsMethodApplicable): Ditto.
5991
5992         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
5993         silly me ;-)
5994
5995         * delegate.cs : Handle the case when we have more than one applicable
5996         method. Flag an error only when we finish checking all.
5997
5998 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
5999
6000         * expression.cs: Add support for boolean static initializers.
6001
6002 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6003
6004         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6005
6006         * parameter.cs (ComputeParameterTypes,
6007         ComputeAndDefineParameterTypes): Better error handling: now we
6008         clear the `types' cache if we fail during any of the type lookups.
6009         We also return the status code correctly to our caller
6010
6011         * delegate.cs: If we fail to define a delegate, abort the extra
6012         steps. 
6013
6014         * expression.cs (Binary.ResolveOperator): for
6015         operator==(object,object) and operator !=(object, object) we also
6016         have to verify that there is an implicit conversion from one to
6017         the other.
6018
6019         (ArrayAccess.DoResolve): Array Access can operate on
6020         non-variables. 
6021
6022 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6023
6024         * assign.cs (CompoundAssign): A new class used as a "flag" that
6025         the assignment actually is happening as part of a compound
6026         assignment operator.
6027
6028         During compound assignment, a few new rules exist to enable things
6029         like:
6030
6031         byte b |= 1 + 2
6032
6033         From the spec:
6034         
6035         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6036         to the type of x) if y is implicitly convertible to the type of x,
6037         and the operator is a builtin operator and the return type of the
6038         operator is explicitly convertible to the type of x. 
6039
6040         * rootcontext.cs: Reset warning level to 2.  4 catches various
6041         "interesting" features in mcs, we must clean this up at some
6042         point, but currently am trying to kill other bugs ;-)
6043
6044         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6045         in container classes as well.  
6046
6047         * expression.cs (Binary.ResolveOperator): Handle string case
6048         before anything else (as operator overloading does emit an error
6049         before doing anything else).
6050
6051         This code could go away when we move to a table driven model, but
6052         i could not come up with a good plan last night.
6053         
6054 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6055
6056         * typemanager.cs (CSharpName): reimplementation using regex.
6057         * class.cs: added null check for fields in Emit
6058         * rootcontext.cs: set warninglevel to 4
6059
6060 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6061
6062         * typemanager.cs (CSharpName): reimplemented with Lupus
6063         suggestion.
6064
6065 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6066
6067         * statement.cs (If): correclty implement Resolve, because we were
6068         not catching sem errors in there.  The same process is needed
6069         everywhere else. 
6070         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6071         
6072
6073         (Statement.Warning_DeadCodeFound): Factorize code.
6074         (While): Report dead code here too.
6075
6076         (Statement): Added Resolve virtual method to allow
6077         for resolution split from the emit code.
6078
6079 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6080
6081         * statement.cs (EmitBoolExpression): No longer try to resolve the
6082         expression here.    
6083         (MakeBoolean): New utility function that resolve, implicitly
6084         converts to boolean and tags the expression. 
6085         
6086
6087         (If, Do): Implement dead code elimination.
6088         (While): Implement loop inversion
6089
6090         (Do, While, For, If): Resolve the expression prior to calling our
6091         code generation.
6092
6093 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6094
6095         * class.cs:
6096           - added method Report28 (warning: program has more than one entry point)
6097           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6098           - modified method Method.Define, the part at the end of the method
6099
6100         * rootcontext.cs: added static public Location EntryPointLocation;
6101           
6102         * ../errors/cs0028.cs : Add test case for the above warning.              
6103
6104         * typemanager.cs:
6105           - modified method CSharpName to allow arrays of primitive type to
6106             be printed nicely (e.g. instead of System.Int32[][] it now prints
6107             int[][])
6108           - added method CSharpSignature: returns the signature of a method
6109             in string format to be used in reporting errors, warnings, etc.
6110
6111         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6112         with String.Empty.
6113         
6114 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6115
6116         * delegate.cs (Define): Fix extremely silly bug where I was
6117         setting the type of the 'object' parameter of the BeginInvoke
6118         method to System.IAsyncResult instead of System.Object ;-)
6119
6120 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6121
6122         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6123         here. 
6124
6125         (Constructor.Emit): return if we fail to initialize the
6126         constructor.  Another door closed!  
6127
6128         * expression.cs (New.DoResolve): Improve error message (from -6 to
6129         1501).  Use DeclaredOnly lookup to find the exact constructor.
6130
6131         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6132         loop.  This is useful.
6133
6134         * cs-parser.jay: Adjust the default parameters so that destructors
6135         have the proper signature.
6136
6137 2002-04-26  Martin Baulig  <martin@gnome.org>
6138
6139         * driver.cs (LoadAssembly): If `assembly' contains any characters
6140         which are only valid in path names and not in assembly names
6141         (currently slash, backslash and point), use Assembly.LoadFrom ()
6142         instead of Assembly.Load () on the `assembly' (before iteration
6143         over the link_paths).
6144
6145 2002-04-26  Martin Baulig  <martin@gnome.org>
6146
6147         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6148
6149 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6150
6151         * class.cs (Property): use the new typemanager.MemberLookup
6152
6153         (TypeContainer.MemberLookup): Implement using the
6154         TypeManager.MemberLookup now. 
6155         
6156         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6157         and return MemberInfos, so that these can be used without an
6158         EmitContext (what we had before).
6159
6160 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6161
6162         * expression.cs: Fix the case where the argument to params if the
6163         type of the params.  I omitted handling this before.   Fixed
6164
6165 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6166
6167         * driver.cs: Call BootCorlib_PopulateCoreType
6168
6169         * class.cs (Property.CheckBase): Check for properties only, not
6170         for all members. 
6171
6172         * interface.cs: Temporary hack: try/catch around the
6173         CustomAttributeBuilder, because I am getting an exception that I
6174         do not understand.
6175
6176         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6177         types whose definitions are required to be there (attributes are
6178         defined before standard types).
6179
6180         Compute definitions as we boot the various types, as they are used
6181         immediately (value_type class will need object_type, but if we do
6182         not initialize object_type, we will pass a null, which will let
6183         the runtime pick the System.Object from the existing corlib, which
6184         is not what we want).
6185
6186 2002-04-22  Patrik Torstensson <totte@labs2.com>
6187
6188         * cs-tokenizer.cs: fixed a number of trim() issues.
6189
6190 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6191
6192         * expression.cs (Argument.Type): Ensure that we return the correct
6193         type when we have out or ref parameters [in which case we 
6194         append a "&"].
6195         
6196 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6197
6198         * class.cs (Property, Indexer): Allow extern modifier in there. 
6199
6200         * typemanager.cs (InitBaseTypes): Initializes object_type and
6201         value_type, since those will be used early on during the bootstrap
6202         process to compile corlib.
6203
6204         (InitCoreTypes): Move code from here to InitBaseTypes.
6205
6206 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6207
6208         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6209         single-dimension arrays as using the ldlen opcode.  
6210
6211         Daniel Lewis discovered this optimization.  
6212
6213         * typemanager.cs: Add signature for System.Array::get_Length
6214
6215 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6216
6217         * statement.cs: report the error when the foreach does not apply to an
6218         array nor a collection.
6219
6220 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6221
6222         * expression.cs: Add implicit conversions to the operator ~.
6223
6224         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6225
6226         * typemanager.cs: Locate the decimal constructor.
6227
6228 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6229
6230         * attribute.cs: use the new property of TypeOf.
6231         * expression.cs: added 'get' property around typearg.
6232
6233         These changes fix a build breaker reported by NickD. Is this the
6234         correct way to fix?  If not, please, revert my changes and make it
6235         work :-).
6236
6237 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6238
6239         * attribute.cs: Add support for typeof in attribute invocations.
6240         I am not sure that this is right though.
6241
6242 2002-04-14  Duncan Mak  <duncan@ximian.com>
6243
6244         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6245         Binary.Operator.Division case.
6246
6247 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6248
6249         * class.cs (DefineType): Ensure that we do a proper check on
6250         attribute types and also register it with the TypeManager.
6251
6252         (TypeContainer.Targets): The default for attribute types is
6253         AttributeTargets.All.
6254         
6255         * attribute.cs (ApplyAttributes): Registering the attribute type
6256         is done elsewhere, not when we discover we have a Usage attribute.
6257
6258 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6259
6260         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6261         and get rid of is_delegate parameter.
6262
6263         * everywhere : update.
6264         
6265 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6266
6267         * cs-parser.jay (compilation_unit): Revamp completely to use
6268         some new ideas that I got from Rhys' grammar to solve the problems
6269         with assembly level attributes.
6270
6271         (outer_declaration): New grammar production.
6272
6273         (attribute_sections): Add.
6274
6275         (opt_attributes): Base on attribute_sections
6276
6277         (namespace_declaration): Allow opt_attributes to tackle the case
6278         when we have assembly level attributes - we are clever in this
6279         regard now ;-)
6280
6281         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6282         attributes in the non-global context.
6283
6284         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6285         instead of SetGlobalAttributes.
6286
6287         * class.cs, rootcontext.cs : Ensure we define and generate 
6288         attribute types before anything else.
6289
6290         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6291         and flag the new error -20 for the case when the attribute type
6292         does not have valid targets specified. csc does not catch this.
6293
6294         * ../errors/errors.txt : update for error # -20
6295
6296 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6297
6298         * support.cs (InternalParameters.ParameterModifier): Do some null
6299         checking and return sane values.
6300
6301         * class.cs (Method.Define): If we are a PInvoke method, ensure
6302         that we are static and extern. Report error # 601
6303
6304         * ../errors/cs0601.cs : Add test case for the above error.
6305
6306 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6307
6308         * rootcontext.cs (attribute_types): We need to keep type of
6309         all attribute types separately and emit code for them first.
6310
6311         (RegisterAttribute) : Implement.
6312
6313         * class.cs (DefineType): Check if the current Type is a custom
6314         attribute type and register it accordingly.
6315
6316         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6317         adding the first attribute twice and rename to
6318
6319         (SetGlobalAttributes): this.
6320
6321         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6322         lookups.
6323
6324         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6325         if we are processing global arguments. Hmm, I am unsure of this.
6326
6327 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6328
6329         * expression.cs: added static array of strings to avoid calling
6330         Enum.ToString () for Operator in Binary. Significant recover of
6331         performance.
6332
6333 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6334
6335         * class.cs (FindMembers): Allow the Builders of the various
6336         members to be null.  If they are skip them.  This only happens
6337         during the PInvoke declaration.
6338
6339 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6340
6341         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6342         failure, so we do not keep going afterwards.
6343
6344         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6345         wanted to pass `false' as the `is_delegate' argument.  If this is
6346         the case, why not use delegate_type == null to mean `is_delegate =
6347         false' and anything else as is_delegate = true.
6348
6349 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6350
6351         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6352         code for the section, not the beginning of the tests.
6353
6354 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6355
6356         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6357
6358         * expression.cs (Binary): same.  Warn about errors where we have
6359         Enum/Enum in operator + as well.
6360
6361 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6362
6363         * statement.cs:
6364                 - added support for switch(bool)
6365                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6366                 - add TableSwitchEmit() to handle table-based switch statements
6367
6368 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6369
6370         * expression.cs (Invocation.OverloadResolve): Factor out code which
6371         does parameter compatibility checking with arguments so that we can 
6372         re-use the code even from Delegate.VerifyApplicability
6373
6374         (VerifyArgumentsCompat): Move above code here.
6375
6376         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6377         and instead make a call to the above method.
6378
6379 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6380
6381         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6382         We use it to keep track of classes which are attribute types.
6383
6384 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6385
6386         * delegate.cs (Delegate.Define): Correctly define the types in the
6387         presence of fixed and array parameters.
6388
6389         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6390         doing FindMembers.
6391
6392         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6393         include NonPublic after the first iteration.
6394
6395         * class.cs (Indexer.CheckBase): Only check if both parents are
6396         non-null. 
6397         
6398         * cs-parser.jay (accessor_body): If empty, set to null.
6399
6400         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6401         same code path here to resolve constants names that we did have in
6402         MemberAccess.DoResolve.  There is too much code duplicated here.
6403
6404 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6405
6406         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6407
6408         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6409         to MakeUnionSet.
6410
6411         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6412         tokens, numbers and strings.
6413
6414         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6415         parenthesis.
6416
6417         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6418         asyncronous parameters and the regular parameters.  
6419
6420         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6421         specify the target directory.
6422
6423         * expression.cs: (This.DoResolve): Simplify
6424         (As.Emit): Optimize, do not generate IsInst if the expression is
6425         always of the given type.
6426
6427         (Is.DoResolve): Bug fix, we were reporting both always/never for
6428         the is expression.
6429
6430         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6431         creating too many unnecessary arrays.
6432
6433 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6434
6435         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6436         fields instead of rolling our own initializer.   Takes care of all
6437         implicit conversions, and drops unnecessary static checks/argument.
6438
6439 2002-03-31  Dick Porter  <dick@ximian.com>
6440
6441         * driver.cs: use the GetDirectories() return values properly, and
6442         use "/" as path separator.
6443
6444 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6445
6446         * expression.cs (Unary): Optimize - - expr into expr.
6447         (Binary): Optimize a + (-b) into a -b.
6448
6449         * codegen.cs (CodeGen): Made all methods static.
6450
6451 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6452
6453         * rootcontext.cs: 
6454
6455         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6456         TypeBuilder property.
6457
6458         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6459         instead. 
6460
6461         * tree.cs: Removed the various RecordXXXX, and replaced with a
6462         single RecordDecl.  Removed all the accessor methods, and just
6463         left a single access point Type 
6464
6465         * enum.cs: Rename DefineEnum to DefineType.
6466
6467         * decl.cs: New abstract method `DefineType' used to unify the
6468         Defines for Enumerations, Interfaces, TypeContainers and
6469         Delegates.
6470
6471         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6472         LookupBaseClasses method that used to live in class.cs and
6473         interface.cs here, and renamed to FindType.
6474         
6475         * delegate.cs: Implement DefineType.  Take advantage of the
6476         refactored pattern for locating the parent builder without taking
6477         the parent_builder argument (which we know does not work if we are
6478         nested, and triggering a toplevel definition).
6479
6480 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6481
6482         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6483         accessibility of a member has changed during override and report
6484         an error if so.
6485
6486         * class.cs (Method.Define, Property.Define): Only complain on
6487         overrides if the method is private, any other accessibility is
6488         fine (and since we just checked the permission is the same, we are
6489         good to go).
6490
6491         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6492         and elif are processed always.  The other pre-processing
6493         directives are only processed if we are "taking" the path
6494
6495 2002-03-29  Martin Baulig  <martin@gnome.org>
6496
6497         * class.cs (Method.Emit): Only emit symbolic debugging info if the
6498         current location is not Null.
6499
6500         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6501         a separate method so we can profile it.
6502
6503         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6504         `span.Seconds' are just seconds, but no minutes or hours.
6505         (MainDriver): Profile the CodeGen.SaveSymbols calls.
6506
6507 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6508
6509         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6510         Remove the gratuitous set of Final:
6511
6512                                 // If an interface implementation, then we can set Final.
6513                                 if (((flags & MethodAttributes.Abstract) == 0) &&
6514                                     implementing.DeclaringType.IsInterface)
6515                                         flags |= MethodAttributes.Final;
6516
6517         I do not know what I was smoking when I used that.
6518         
6519
6520         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6521         step into fixing the name resolution issues for delegates and
6522         unifying the toplevel name resolution.
6523
6524 2002-03-28  Martin Baulig  <martin@gnome.org>
6525
6526         * class.cs (Method.Emit): If we have a symbol writer, call its
6527         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6528         tell it about the current method.
6529
6530         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6531         writer that we're going to emit the first byte of IL code for a new
6532         statement (a new source line).
6533         (EmitContext.EmitTopBlock): If we have a symbol writer, call
6534         EmitContext.Mark() before emitting any code.
6535
6536         * location.cs (SymbolDocument): Return null when we're Null.
6537
6538         * statement.cs (Statement): Moved the `Location loc' variable here.
6539         (Statement.EmitBoolExpression): If we have a symbol writer, call
6540         ec.Mark() before emitting any code to tell it that we're at the
6541         beginning of a new statement.
6542         (StatementExpression): Added `Location' argument to the constructor.
6543         (Block): Added public readonly variable `StartLocation' and public
6544         variable `EndLocation'.  The latter is to be set using SetEndLocation().
6545         (Block): Added constructor which takes a start and end location.
6546         (Block.SetEndLocation): New method. This sets the end location.
6547         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6548         local variables we create.
6549         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6550         each statement and do also mark the begin and end of the block.
6551
6552         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6553         tell it the current lexer.Location, use Location.Null for the end of the
6554         block.
6555         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6556         current block, set its end location using SetEndLocation().
6557         (statement_expression): StatementExpression constructor now takes the
6558         lexer.Location as additional argument.
6559         (for_statement, declare_local_variables): Likewise.
6560         (declare_local_variables): When creating a new implicit block, use the
6561         new Block constructor and pass it the lexer.Location.
6562
6563 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6564
6565         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6566         members also on the parent interfaces recursively.
6567
6568 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
6569
6570         * report.cs: Use new formats, since Gonzalo finished the missing
6571         bits. 
6572
6573         * expression.cs (Binary.ResolveOperator): added missing operator|
6574         operator& and operator^ for bool/bool.
6575
6576         * cs-parser.jay: CheckDef now takes a Location argument that is
6577         used to report errors more precisly (instead of reporting the end
6578         of a definition, we try to track something which is a lot closer
6579         to the source of the problem).
6580
6581         * cs-tokenizer.cs: Track global token use, so we can properly flag
6582         the use of #define/#undef after the first token has been seen.
6583
6584         Also, rename the reportXXXX to Error_DescriptiveName
6585
6586         * decl.cs (DeclSpace.IsTopLevel): Move property here from
6587         TypeContainer, so that Enum and Interface can use this too.
6588
6589         * class.cs (TypeContainer.LookupInterfaceOrClass,
6590         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6591         `builder' argument.  Typically this was used to pass the parent
6592         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6593         the definition).  
6594
6595         The problem is that a nested class could trigger the definition of
6596         a toplevel class, and the builder would be obviously wrong in that
6597         case. 
6598
6599         So we drop this argument, and we compute dynamically the
6600         TypeBuilder/ModuleBuilder (the correct information was available
6601         to us anyways from DeclSpace.Parent)
6602
6603         * interface.cs (Interface.DefineInterface): Drop builder
6604         parameter cleanup like class.cs
6605
6606         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
6607         like class.cs
6608
6609         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6610         values. 
6611
6612         (Try.Emit): Propagate the returns value from the statement.
6613
6614         (Return.Emit): Even if we are leavning 
6615
6616         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6617
6618         * modifiers.cs: Fix the computation of MethodAttributes flags.
6619
6620 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6621
6622         * driver.cs: allow compilation of files that start with '/'.
6623         Add a default case when checking the argument of --target.
6624
6625 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
6626
6627         * interface.cs: Implement the same search algorithm for types in
6628         the interface code.
6629
6630         * delegate.cs: Do not allow multiple definition.
6631
6632         * Recovered ChangeLog that got accidentally amputated
6633
6634         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6635
6636         * rootcontext.cs: Load manually enum to allow core classes to
6637         contain enumerations.
6638
6639         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6640         Update to new static methods in TypeManager.
6641
6642         * typemanager.cs (GetMethod, GetConstructor): Use our
6643         implementation of FindMembers to find the members, since during
6644         corlib compilation, the types are TypeBuilders and GetMethod and
6645         GetConstructor do not work.
6646
6647         Make all methods in TypeManager static.
6648
6649         (InitCodeHelpers): Split the functionality from
6650         the InitCodeTypes function.
6651
6652         * driver.cs: Call InitCodeHelpers after we have populated the
6653         types. 
6654
6655         * cs-parser.jay (delegate_declaration): we did not used to compute
6656         the delegate name correctly for void delegates.
6657
6658 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
6659
6660         * rootcontext.cs (RootContext): Init the interface_resolve_order
6661         and type_container_resolve_order always.
6662
6663         (ResolveCore, BootstrapCorlib_ResolveClass,
6664         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6665         compiler when compiling with --nostdlib
6666
6667         * class.cs (TypeContainer.DefineType): Check that our parent is
6668         not null.  This test is most important when we are bootstraping
6669         the core types.
6670
6671         * codegen.cs: Split out the symbol writing code.
6672
6673 2002-03-25  Martin Baulig  <martin@gnome.org>
6674
6675         * driver.cs (-g): Made -g an alias for --debug.
6676
6677 2002-03-24  Martin Baulig  <martin@gnome.org>
6678
6679         * codegen.cs (SymbolWriter): New public variable. Returns the
6680         current symbol writer.
6681         (CodeGen): Added `bool want_debugging_support' argument to the
6682          constructor. If true, tell the ModuleBuild that we want debugging
6683         support and ask it for the ISymbolWriter.
6684         (Save): If we have a symbol writer, call it's Close() method after
6685         saving the assembly.
6686
6687         * driver.c (--debug): New command line argument to create a
6688         debugger information file.
6689
6690         * location.cs (SymbolDocument): New public property. Returns an
6691         ISymbolDocumentWriter object for the current source file or null
6692         if we don't have a symbol writer.
6693
6694 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
6695
6696         * driver.cs (LoadAssembly): Correctly return when all the paths
6697         have been tried and not before.
6698
6699         * statement.cs (Switch.Emit): return the actual coverage for this
6700         statement (returns/not-returns)
6701
6702         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
6703         switch of the statement if we are the last switch section.  That
6704         kills two problems: try/catch problems (we used to emit an empty
6705         nop at the end) and switch statements where all branches would
6706         return. 
6707
6708 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
6709
6710         * driver.cs: Add default assemblies (the equivalent to the
6711         Microsoft CSC.RSP file)
6712
6713         * cs-tokenizer.cs: When updating `cols and setting it to zero,
6714         also update tokens_seen and set it to false.
6715
6716         * driver.cs: Implement --recurse for Mike.
6717
6718         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
6719         correctly splitting out the paths.
6720
6721 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
6722
6723         * interface.cs (Interface.PopulateProperty): Instead of using
6724         `parent' as the declaration space for the set parameters, use
6725         `this' 
6726
6727         * support.cs (InternalParameters): InternalParameters constructor
6728         takes a DeclSpace instead of a TypeContainer.
6729
6730         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
6731         types are being initialized, load the address of it before calling
6732         the function.  
6733
6734         (New): Provide a mechanism to disable the generation of local
6735         value type temporaries when the caller will be providing us with
6736         an address to store it.
6737
6738         (ArrayCreation.EmitDynamicInitializers): Use it.
6739
6740 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
6741
6742         * expression.cs (Invocation.EmitArguments): Only probe for array
6743         property if there is more than one argument.  Sorry about that.
6744
6745         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
6746         empty param arrays.
6747         
6748         * class.cs (Method.LabelParameters): Fix incorrect code path that
6749         prevented the `ParamArrayAttribute' from being applied to the
6750         params attribute.
6751
6752 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
6753
6754         * support.cs (ReflectionParameters): Correctly compute whether the
6755         last argument is a params array.  Fixes the problem with
6756         string.Split ('a')
6757
6758         * typemanager.cs: Make the assemblies array always be non-null
6759         (empty, but non-null)
6760
6761         * tree.cs (RecordDecl): New function that abstracts the recording
6762         of names.  This reports error 101, and provides a pointer to the
6763         previous declaration.  Fixes a crash in the compiler.
6764
6765         * cs-parser.jay (constructor_declaration): Update to new grammar,
6766         and provide a constructor_body that can be empty.
6767
6768 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
6769
6770         * driver.cs: Add support for --resources.
6771
6772         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6773         Make all types for the various array helper methods be integer.
6774
6775         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6776         CheckState to ConvCast.
6777
6778         (ConvCast): Now it takes a `checked' state argument, to avoid
6779         depending on the emit context for the conversion, and just using
6780         the resolve time setting.
6781
6782         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6783         instead of Invocation.EmitArguments.  We do not emit the original
6784         arguments, instead we emit those which have been converted to
6785         unsigned int expressions.
6786
6787         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6788
6789         * codegen.cs: ditto.
6790
6791         * expression.cs (LocalVariableReference): Drop the use of the
6792         Store function that depended on the variable index.
6793
6794         * statement.cs (VariableInfo): Drop the `Idx' property from this
6795         class, as this is not taking into account the indexes for
6796         temporaries tat we generate during the execution, getting the
6797         indexes wrong.
6798
6799         * class.cs: First emit class initializers, then call the parent
6800         constructor. 
6801
6802         * expression.cs (Binary): Fix opcode emision.
6803         (UnaryMutator.EmitCode): Support checked code generation
6804
6805         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6806         matches for events for both the Static and Instance scans,
6807         pointing to the same element.   Fix that.
6808
6809 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
6810
6811         * rootcontext.cs (ResolveTree): Always set the
6812         interface_resolve_order, because nested interfaces will be calling
6813         into us.
6814
6815         * class.cs (GetInterfaceOrClass): Track the same resolution
6816         process used by TypeManager.LookupType.  This fixes the nested
6817         type lookups in class declarations (separate path from
6818         LookupType). 
6819
6820         (TypeContainer.DefineType): Also define nested interfaces.
6821         (TypeContainer.RegisterOrder): New public function used to
6822         register the order in which child interfaces need to be closed.
6823
6824         Nested interfaces need to be closed after their parents have been
6825         created. 
6826         
6827         * interface.cs (InterfaceAttr): Put all the logic for computing
6828         the interface attribute here. 
6829
6830         (DefineInterface): Register our interface order with the
6831         RootContext or with the TypeContainer depending on the case.
6832
6833 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6834
6835         * cs-parser.jay: rework foreach statement to work with the new
6836         changes to the policy on SimpleNames.
6837         
6838         * report.cs: support Stacktrace on warnings as well.
6839
6840         * makefile: drop --unsafe and /unsafe from the compile.
6841
6842 2002-03-13  Ravi Pratap  <ravi@ximian.com>
6843
6844         * ecore.cs (StandardConversionExists): Modify to take an Expression
6845         as the first parameter. Ensure we do null -> reference type conversion
6846         checking.
6847
6848         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
6849         temporary Expression objects.
6850
6851 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
6852
6853         * interface.cs: workaround bug in method overloading resolution
6854         (there is already a bugzilla bug for it).
6855
6856 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6857
6858         We could also solve this problem by having a separate path for
6859         performing type lookups, instead of DoResolve, we could have a
6860         ResolveType entry point, and only participating pieces of the
6861         production (simplename, deref, array) would implement this. 
6862         
6863         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
6864         signal SimpleName to only resolve type names and not attempt to
6865         resolve anything else.
6866
6867         * expression.cs (Cast): Set the flag.
6868
6869         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
6870
6871         * class.cs: Only report 108 if there is no `new' modifier.
6872
6873         * cs-parser.jay: rework foreach statement to work with the new
6874         changes to the policy on SimpleNames.
6875         
6876         * report.cs: support Stacktrace on warnings as well.
6877
6878         * makefile: drop --unsafe and /unsafe from the compile.
6879
6880 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
6881
6882         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6883         lookups here, instead of doing that at parse time.  This means
6884         that our grammar will not introduce `LocalVariableReferences' as
6885         expressions at this point.  That solves the problem of code like
6886         this:
6887
6888         class X {
6889            static void Main ()
6890            { int X = 1;
6891             { X x = null }}}
6892
6893         This is only half the fix.  The full fix requires parameters to
6894         also be handled in this way.
6895
6896         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
6897         makes the use more obvious of the DeclSpace.  The
6898         ec.TypeContainer.TypeBuilder is now only used to pull the
6899         TypeBuilder for it.
6900
6901         My theory is that I can get rid of the TypeBuilder completely from
6902         the EmitContext, and have typecasts where it is used (from
6903         DeclSpace to where it matters).  
6904
6905         The only pending problem is that the code that implements Aliases
6906         is on TypeContainer, and probably should go in DeclSpace.
6907
6908         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6909         lookups here, instead of doing that at parse time.  This means
6910         that our grammar will not introduce `LocalVariableReferences' as
6911         expressions at this point.  That solves the problem of code like
6912         this:
6913
6914         class X {
6915            static void Main ()
6916            { int X = 1;
6917             { X x = null }}}
6918
6919         This is only half the fix.  The full fix requires parameters to
6920         also be handled in this way.
6921
6922         * class.cs (Property.DefineMethod): When implementing an interface
6923         method, set newslot, when implementing an abstract method, do not
6924         set the flag (before we tried never setting it, or always setting
6925         it, which is the difference).
6926         (Indexer.DefineMethod): same.
6927         (Method.DefineMethod): same.
6928
6929         * ecore.cs: Only set the status used flag if we get back a Field.
6930
6931         * attribute.cs: Temporary hack, so Paolo can keep working.
6932
6933 2002-03-08  Ravi Pratap  <ravi@ximian.com>
6934
6935         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
6936         the unmanaged type in the case we have a MarshalAs attribute.
6937
6938         (Resolve): Handle the case when we are parsing the special MarshalAs
6939         attribute [we need to store the unmanaged type to use later]
6940         
6941         * typemanager.cs (marshal_as_attr_type): Built in type for the 
6942         MarshalAs Attribute.
6943
6944         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
6945         on parameters and accordingly set the marshalling info.
6946         
6947 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
6948
6949         * class.cs: Optimizing slightly by removing redundant code after
6950         we switched to the `NoTypes' return value.
6951         (Property.DefineMethod): use NoTypes here too.
6952
6953         This fixes the bug I introduced in my last batch of changes.
6954
6955 2002-03-05  Ravi Pratap  <ravi@ximian.com>
6956
6957         * tree.cs (RecordEnum): Add. We now keep track of enums too.
6958
6959         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
6960         Enums since those are types too. 
6961
6962         * cs-parser.jay (enum_declaration): Record enums as we parse them.
6963         
6964         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
6965         thanks to a call during the lookup process.
6966
6967 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
6968
6969         * statement.cs (Foreach): Lots of work to accomodate a particular
6970         kind of foreach statement that I had not kept in mind.  It is
6971         possible to have foreachs on classes that provide a GetEnumerator
6972         method that return objects that implement the "pattern" for using
6973         a foreach, there is no need to support GetEnumerator
6974         specifically. 
6975
6976         This is needed to compile nant.
6977
6978         * decl.cs: Only report 114 if the member is not `Finalize' and if
6979         the warning level is at least 2.
6980
6981         * class.cs: Moved the compare function from Method to
6982         MethodSignature. 
6983
6984         (MethodSignature.InheritableMemberSignatureCompare): Add new
6985         filter function that is used to extract inheritable methods from a
6986         class. 
6987
6988         (Method.Define): Use the new `inheritable_method_signature_filter'
6989         delegate
6990
6991         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6992         command. 
6993
6994 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
6995
6996         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6997
6998         * cs-parser.jay: Add opt_semicolon to the interface declaration.
6999
7000         * expression.cs: Pass location information to
7001         ConvertImplicitStandard. 
7002
7003         * class.cs: Added debugging code to track return values from
7004         interfaces. 
7005
7006 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7007
7008         * expression.cs (Is.DoResolve): If either side of the `is' is an
7009         interface, do not flag the warning.
7010
7011         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7012         for interfaces
7013
7014         * report.cs: Allow for --fatal to be used with --probe.
7015         
7016         * typemanager.cs (NoTypes): Move the definition for the empty Type
7017         array here. 
7018
7019         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7020         properties. 
7021         (TypeContainer.DefineProxy): New function used to proxy to parent
7022         implementations when implementing interfaces.
7023         (TypeContainer.ParentImplements): used to lookup if our parent
7024         implements a public function that is required by an interface.
7025         (TypeContainer.VerifyPendingMethods): Hook this up.
7026
7027         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7028         `modules' and `assemblies' arraylists into arrays.  We only grow
7029         these are the very early start up of the program, so this improves
7030         the speedof LookupType (nicely measured).
7031
7032         * expression.cs (MakeByteBlob): Replaced unsafe code with
7033         BitConverter, as suggested by Paolo.
7034
7035         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7036         folding of string concatenation, but if either side is a string,
7037         and the other is not, then return null, and let the runtime use
7038         the concatenation on the string plus the object (using
7039         `Object.ToString'). 
7040
7041 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7042
7043         Constant Folding has been implemented now.
7044         
7045         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7046         the error instead on types that are not supported in one's
7047         complement. 
7048
7049         * constant.cs (Constant and all children): New set of functions to
7050         perform implict and explicit conversions.
7051         
7052         * ecore.cs (EnumConstant): Implement the new functions to perform
7053         conversion by proxying to the child expression.
7054
7055         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7056         own separate setting that can not be turned off from the command
7057         line using --unchecked or --checked and is only controlled using
7058         the checked/unchecked statements and expressions.  This setting is
7059         used by the constant folder to flag errors.
7060
7061         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7062         ConstantCheckState as well.   
7063
7064         During Resolve, they also have to flag the state, because the
7065         constant folder runs completely in the Resolve phase.
7066
7067         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7068         well.
7069
7070 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7071
7072         * cfold.cs: New file, this file contains the constant folder.
7073         
7074         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7075         argument to track whether we are using the resulting address to
7076         load or store a value and provide better error messages. 
7077
7078         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7079         new AddressOf arguments.
7080
7081         * statement.cs (Foreach.EmitCollectionForeach): Update
7082
7083         * expression.cs (Argument.Emit): Call AddressOf with proper
7084         arguments to track usage.
7085
7086         (New.DoEmit): Call AddressOf with new arguments.
7087
7088         (Unary.Emit): Adjust AddressOf call.
7089
7090 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7091
7092         * cs-parser.jay (member_access): Change the case for pre-defined types
7093         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7094         this suggestion.
7095
7096         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7097         a method body.
7098
7099         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7100         essentially like methods and apply attributes like MethodImplOptions to them too.
7101
7102         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7103         not being null.
7104
7105         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7106         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7107         is the DeclSpace.
7108
7109         * Update code everywhere accordingly.
7110
7111         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7112
7113         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7114
7115 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7116
7117         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7118         try performing lookups against those instead of jumping straight into using
7119         the 'using' clauses.
7120
7121         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7122
7123         (LookupType): Perform lookups in implicit parents too.
7124
7125         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7126         sequence as RootContext.LookupType. 
7127
7128         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7129         the various cases of namespace lookups into this method.
7130
7131 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7132
7133         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7134         in positional arguments)
7135
7136         * class.cs (Operator): Update the AllowedModifiers to contain
7137         extern. 
7138
7139         * cs-parser.jay: Update operator declaration to allow for the
7140         operator body to be empty.
7141
7142         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7143         values. 
7144
7145 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7146
7147         * class.cs (Method.Emit): Label parameters.
7148
7149         * driver.cs: Return 1 or 0 as the program exit code.
7150
7151 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7152
7153         * expression.cs: Special case the `null' object when trying to
7154         auto-compute the type, as anything can be explicitly converted to
7155         that. 
7156
7157         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7158         spotting this Paolo.
7159
7160         (Expression.ImplicitNumericConversion): Perform comparissions of
7161         the type using the underlying type in the case of an enumeration
7162         rather than using the enumeration type for the compare.
7163
7164         Cope with the underlying == type case, which is not possible to
7165         catch before. 
7166
7167         (Expression.ConvertNumericExplicit): Perform comparissions of
7168         the type using the underlying type in the case of an enumeration
7169         rather than using the enumeration type for the compare.
7170
7171         * driver.cs: If the user does not supply an extension, assume .exe
7172
7173         * cs-parser.jay (if_statement): Rewrote so that we can track the
7174         location for the if statement.
7175
7176         * expression.cs (Binary.ConstantFold): Only concat strings when
7177         the operation is "+", not everything ;-)
7178
7179         * statement.cs (Statement.EmitBoolExpression): Take a location
7180         argument. 
7181         (If, While, Do): Track location.
7182
7183         * expression.cs (Binary.ResolveOperator): In the object + string
7184         case, I was missing a call to ConvertImplicit
7185
7186 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7187
7188         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7189         Location arguments. Ensure we use RootContext.LookupType to do our work
7190         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7191
7192         * interface.cs (PopulateMethod): Handle the type of the parameter being
7193         null gracefully.
7194
7195         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7196         have a params method with no fixed arguments and a call is made with no
7197         arguments.
7198
7199 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7200
7201         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7202         the verbatim-string-literal
7203
7204         * support.cs (InternalParameters.ParameterModifier): handle null
7205         fixed parameters.
7206         (InternalParameters.ParameterType): ditto.
7207
7208         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7209         duplicating the name of the variable parameter.
7210         (GetParameterByName): Fix bug where we were not looking up array
7211         paramters if they were the only present (thanks Paolo!).
7212         (GetParameterInfo): We only have an empty set of types if both
7213         fixed and array are set to null.
7214         (GetParameterInfo-idx): Handle FixedParameter == null
7215
7216         * cs-parser.jay: Handle the case where there is no catch
7217         statements (missing null test).
7218
7219 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7220
7221         * driver.cs (MainDriver): Be conservative on our command line
7222         handling.
7223
7224         Catch DirectoryNotFoundException when calling GetFiles.
7225         
7226         (SplitPathAndPattern): Used to split the input specification into
7227         a path and a pattern that we can feed to Directory.GetFiles.
7228
7229 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7230
7231         * statement.cs (Fixed): Implement the last case of the Fixed
7232         statement (string handling).
7233
7234         * expression.cs (StringPtr): New class used to return a char * to
7235         a string;  Used by the Fixed statement.
7236
7237         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7238
7239         * expression.cs (Binary.ResolveOperator): Remove redundant
7240         MemberLookup pn parent type.
7241         Optimize union call, we do not need a union if the types are the same.
7242         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7243         type.
7244
7245         Specialize the use of MemberLookup everywhere, instead of using
7246         the default settings. 
7247
7248         (StackAlloc): Implement stackalloc keyword.
7249
7250         * cs-parser.jay: Add rule to parse stackalloc.
7251         
7252         * driver.cs: Handle /h, /help, /?
7253
7254         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7255         before we supported unsafe code.
7256         
7257         * makefile: add --unsafe to the self compilation of mcs.
7258
7259 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7260
7261         * expression.cs (PointerArithmetic): New class that is used to
7262         perform pointer arithmetic.
7263         (Binary.Resolve): Handle pointer arithmetic
7264         Handle pointer comparission.
7265         (ArrayPtr): Utility expression class that is used to take the
7266         address of an array.
7267
7268         (ElementAccess): Implement array access for pointers
7269         
7270         * statement.cs (Fixed): Implement fixed statement for arrays, we
7271         are missing one more case before we are done.
7272
7273         * expression.cs (Indirection): Implement EmitAssign and set the
7274         ExprClass to Variable.  This allows pointer dereferences to be
7275         treated as variables, and to have values assigned to them.
7276         
7277         * ecore.cs (Expression.StoreFromPtr): New utility function to
7278         store values dereferencing.
7279
7280 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7281
7282         * expression.cs (Binary.ResolveOperator): Ensure that we are
7283         not trying to operate on a void type - this fixes the reported
7284         bug.
7285
7286         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7287         the parent implementation is sealed.
7288
7289         * ../errors/cs0239.cs : Add.
7290
7291         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7292
7293         * typemanager.cs (unverifiable_code_type): Corresponds to 
7294         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7295         which have unsafe code in them.
7296
7297         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7298         unsafe context.
7299
7300 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7301
7302         * cs-tokenizer.cs: Add support for @"litreal strings"
7303
7304         Make tokenizer accept pre-processor directives
7305         on any column (remove the old C-like limitation). 
7306
7307         * rootcontext.cs (EmitCode): Emit any global attributes.
7308         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7309
7310         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7311
7312         * cs-parser.jay: Add support for global attributes.  
7313
7314 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7315
7316         * expression.cs (Indirection): New helper class.  Unary will
7317         create Indirection classes to be able to implement the
7318         IMemoryLocation interface on it.
7319
7320 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7321
7322         * cs-parser.jay (fixed_statement): reference the right statement.
7323
7324         * statement.cs (Fixed.Emit): Finish implementing the fixed
7325         statement for the &x case.
7326
7327 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7328
7329         * class.cs (Property.Define, Method.Define): Remove newslot when
7330         `implementing'.  
7331
7332         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7333         wrong.  NewSlot should only be used if the `new' keyword is present.
7334
7335         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7336         locating our system dir.  Sorry about this.
7337
7338 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7339
7340         * driver.cs (GetSystemDir): Compute correctly the location of our
7341         system assemblies.  I was using the compiler directory instead of
7342         the library directory.
7343
7344 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7345
7346         * expression.cs (BetterFunction): Put back in what Miguel commented out
7347         since it is the correct fix. The problem is elsewhere ;-)
7348
7349         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7350         parameters of the parms method are themselves compatible or not !
7351
7352         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7353         to check that a class implements an interface before saying that an implicit
7354         conversion was allowed. Use ImplementsInterface to do the checking.
7355
7356 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7357
7358         * class.cs (Method.Define): Track whether we are an explicit
7359         implementation or not.  And only call DefineMethodOverride if we
7360         are an explicit implementation.
7361
7362         (Property.DefineMethod): Ditto.
7363
7364 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7365
7366         * expression.cs (BetterFunction): Catch hideous bug which was
7367          preventing us from detecting ambiguous calls due to implicit casts i.e
7368         cs0121.
7369
7370 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7371
7372         * support.cs (Pair): Remove un-needed method.  I figured why I was
7373         getting the error in cs-parser.jay, the variable in a foreach loop
7374         is readonly, and the compiler does not really treat this as a variable.
7375
7376         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7377         instead of EQUALS in grammar.  
7378
7379         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7380
7381         * expression.cs (Unary.DoResolve): Check whether the argument is
7382         managed or not.
7383
7384 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7385
7386         * support.cs: Api for Pair to set a value.  Despite the fact that
7387         the variables are public the MS C# compiler refuses to compile
7388         code that accesses the field if the variable is part of a foreach
7389         statement. 
7390
7391         * statement.cs (Fixed): Begin implementation of the fixed
7392         statement.
7393
7394         (Block.AddVariable): Return the VariableInfo on success and null
7395         on failure instead of true/false. 
7396
7397         * cs-parser.jay (foreach): Catch errors on variables already
7398         defined (we were ignoring this value before) and properly unwind
7399         the block hierarchy
7400
7401         (fixed_statement): grammar for the fixed statement.
7402
7403 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7404
7405         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7406         pointer types to be incretemented.
7407
7408         (SizeOf): Implement.
7409
7410         * cs-parser.jay (pointer_member_access): Implement
7411         expr->IDENTIFIER production.
7412
7413         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7414         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7415         on safe contexts.
7416
7417         (Unary): Implement indirection.
7418
7419         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7420         use in non-unsafe context).
7421
7422         (SimpleName.DoResolve): Check for pointers in field access on safe
7423         contexts. 
7424
7425         (Expression.LoadFromPtr): Factor the load-indirect code in this
7426         function.  This was duplicated in UnboxCast and ParameterReference
7427
7428 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7429
7430         * expression.cs (ComposedCast): report an error if a pointer cast
7431         is used in a safe region.
7432
7433         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7434         pointer type casts in unsafe context.
7435
7436         * codegen.cs (EmitContext): Set up IsUnsafe.
7437
7438         * cs-parser.jay (non_expression_type): Add productions for pointer
7439         casts. 
7440
7441         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7442         code.  We should not use force into static mode if the method is
7443         not virtual.  Fixes bug in MIS
7444
7445         * statement.cs (Do.Emit, While.Emit, For.Emit,
7446         Statement.EmitBoolExpression): Add support to Do and While to
7447         propagate infinite loop as `I do return' semantics.
7448
7449         Improve the For case to also test for boolean constants.
7450
7451         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7452         to the list of attributes we can add.
7453
7454         Remove `EmitContext' argument.
7455
7456         * class.cs (Method.Define): Apply parameter attributes.
7457         (Constructor.Define): Apply parameter attributes.
7458         (MethodCore.LabelParameters): Move here the core of labeling
7459         parameters. 
7460
7461         * support.cs (ReflectionParameters.ParameterModifier,
7462         InternalParameters.ParameterModifier): Use IsByRef on the type and
7463         only return the OUT bit for these parameters instead of in/out/ref
7464         flags.
7465
7466         This is because I miss-understood things.  The ParameterInfo.IsIn
7467         and IsOut represent whether the parameter has the [In] and [Out]
7468         attributes set.  
7469
7470 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7471
7472         * ecore.cs (FieldExpr.Emit): Release temporaries.
7473
7474         * assign.cs (LocalTemporary.Release): new function.
7475
7476         * codegen.cs (EmitContext.GetTemporaryStorage,
7477         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7478         temporary storage.  Now we can "put back" localbuilders when we
7479         are done with them
7480
7481 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7482
7483         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7484         need to make a copy of the variable to generate verifiable code.
7485
7486 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7487
7488         * driver.cs: Compute dynamically the system directory.
7489
7490         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7491         Slower, but more generally useful.  Used by the abstract
7492         registering implementation. 
7493
7494         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7495         the rules for the special rule on Type/instances.  First check if
7496         we have the same name, and if so, try that special static path
7497         rather than the instance path.
7498         
7499 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
7500
7501         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7502         for, while and if.
7503
7504         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7505         Enum, ValueType, Delegate or Array for non-corlib compiles.
7506
7507         * cs-tokenizer.cs: Catch long identifiers (645)
7508
7509         * typemanager.cs (IndexerPropetyName): Ravi never tested this
7510         piece of code.
7511
7512         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7513         fix, we were returning too early, so we were not registering
7514         pending methods from abstract classes.
7515
7516         Do not register pending methods if the class is abstract.
7517
7518         * expression.cs (Conditional.DoResolve): Report circular implicit
7519         conversions when we neecd to compute it for conditional
7520         expressions. 
7521
7522         (Is.DoResolve): If the expression is always of the provided type,
7523         flag warning 183.  If the expression can not ever be of the
7524         provided type flag warning 184.
7525
7526         * class.cs: Catch 169 as well.
7527
7528         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7529         read. 
7530
7531 2002-01-18  Nick Drochak  <ndrochak@gol.com>
7532
7533         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
7534
7535 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
7536
7537         * interface.cs: (PopulateMethod): Check for pointers being defined
7538         only if the unsafe context is active.
7539         (PopulateProperty): ditto.
7540         (PopulateIndexer): ditto.
7541
7542         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7543         specified.  If pointers are present, make sure that they are
7544         present in an unsafe context.
7545         (Constructor, Constructor.Define): ditto.
7546         (Field, Field.Define): ditto.
7547         (Property, Property.Define): ditto.
7548         (Event, Event.Define): ditto.
7549
7550         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7551         hashtable if there are classes or structs defined.
7552
7553         * expression.cs (LocalVariableReference.DoResolve): Simplify this
7554         code, as the constant resolution moved.
7555
7556         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7557         the metadata, so we can flag error 133. 
7558
7559         * decl.cs (MemberCore.UnsafeOK): New function to test that a
7560         pointer is being declared in an unsafe context.
7561
7562 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
7563
7564         * modifiers.cs (Modifiers.Check): Require a Location argument.
7565         Report error 227 for Unsafe use.
7566
7567         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7568
7569         * statement.cs (For.Emit): If the test is null, then report that
7570         we do `return', as we wont reach anything afterwards.
7571
7572         (Switch.SwitchGoverningType): Track the expression that matched
7573         the conversion.
7574
7575         * driver.cs: Allow negative numbers as an error code to flag.
7576
7577         * cs-parser.jay: Handle 1551.
7578
7579         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7580
7581 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7582
7583         * cs-parser.jay: Report 1518 (type declaration can only contain
7584         class, struct, interface, enum or delegate)
7585
7586         (switch_label): Report 1523 (keywords `case' or `default' must
7587         preced code)
7588
7589         (opt_switch_sections): Report 1522 (empty switch)
7590
7591         * driver.cs: Report 1515 (response file specified multiple times)
7592         Report 1516 (Source file specified multiple times).
7593
7594         * expression.cs (Argument.Resolve): Signal 1510
7595
7596         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7597         access not allowed in static code)
7598
7599 2002-01-11  Ravi Pratap  <ravi@ximian.com>
7600
7601         * typemanager.cs (IsPointerType): Utility method which we are going
7602         to need a lot.
7603
7604         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7605         the object type, so we take care of that.
7606
7607         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7608         
7609         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7610         added to non-params parameters :-)
7611
7612         * typemanager.cs (CSharpName): Include 'void' type too. 
7613
7614         (void_ptr_type): Include in the set of core types.
7615
7616         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
7617         duplicating code.
7618
7619         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
7620         an unsafe context.
7621
7622         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
7623         completely forgotten about it.
7624
7625 2002-01-10  Ravi Pratap  <ravi@ximian.com>
7626
7627         * cs-parser.jay (pointer_type): Add. This begins our implementation
7628         of parsing rules for unsafe code.
7629
7630         (unsafe_statement): Implement.
7631
7632         (embedded_statement): Modify to include the above.
7633
7634         * statement.cs (Unsafe): Implement new class for unsafe blocks.
7635
7636         * codegen.cs (EmitContext.InUnsafe): Add. This determines
7637         if the current context is an unsafe one.
7638
7639         * cs-parser.jay (local_variable_pointer_type): Since local variable types
7640         are handled differently, we need separate rules for them.
7641
7642         (local_variable_declaration): Update to use local_variable_pointer_type
7643         to allow variable declarations of unmanaged pointer types.
7644
7645         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7646         in unsafe contexts.
7647
7648         * ../errors/cs0214.cs : Add.
7649
7650 2002-01-16  Nick Drochak  <ndrochak@gol.com>
7651
7652         * makefile: remove 'response' file when cleaning.
7653
7654 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7655
7656         * cs-parser.jay: Report 1524.
7657
7658 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
7659
7660         * typemanager.cs (RegisterMethod): drop checking if we have
7661         registered this from here
7662
7663 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
7664
7665         * class.cs (Method.EmitDestructor): Implement calling our base
7666         destructor. 
7667
7668         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7669         value of InFinally.
7670
7671         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7672         this routine and will wrap the call in a try/catch block.  Deal
7673         with the case.
7674
7675 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
7676
7677         * ecore.cs (Expression.MemberLookup): instead of taking a
7678         parameter `same_type' that was used to tell whether we could
7679         access private members we compute our containing type from the
7680         EmitContext.
7681
7682         (FieldExpr): Added partial support for volatile fields.  This does
7683         not work for volatile fields exposed from assemblies, as I can not
7684         figure out how to extract the modreq from it.
7685
7686         Updated all the source files to use this.
7687
7688         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7689         because it is referenced by MemberLookup very often. 
7690
7691 2002-01-09  Ravi Pratap  <ravi@ximian.com>
7692
7693         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
7694         TypeBuilder.GetCustomAttributes to retrieve what we need.
7695
7696         Get rid of redundant default_member_attr_type as this is the same as
7697         default_member_type which already exists.
7698
7699         * interface.cs, attribute.cs : Update accordingly.
7700         
7701 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
7702
7703         * typemanager.cs: Enable IndexerPropertyName again.  It does not
7704         work for TYpeBuilders though.  Ravi, can you please fix this?
7705
7706         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
7707
7708         * expression.cs (Argument.Emit): Handle the case of ref objects
7709         being passed to ref functions;  
7710
7711         (ParameterReference.EmitLoad): Loads the content of the pointer
7712         without dereferencing.
7713
7714 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
7715
7716         * cs-tokenizer.cs: Implemented the pre-processing expressions.
7717
7718 2002-01-08  Ravi Pratap  <ravi@ximian.com>
7719
7720         * class.cs (Indexer.DefineMethod): Incorporate the interface
7721         type in the name of the method if we are doing explicit interface
7722         implementation.
7723
7724         * expression.cs (ConversionExists): Remove as it is completely obsolete.
7725
7726         (BetterConversion): Fix extremely trivial bug where we were referring to
7727         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
7728         again !
7729
7730         * ../errors/bug16.cs : Add although we have fixed it.
7731
7732 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
7733
7734         * expression.cs (BaseIndexer): Begin implementation.
7735
7736         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
7737
7738         * cs-parser.jay (indexer_declarator): Use qualified_identifier
7739         production directly to remove a shift/reduce, and implement
7740         explicit interface implementation.
7741
7742         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
7743         after a floating point suffix.
7744
7745         * expression.cs (DoNumericPromotions): Improved the conversion for
7746         uint/uint.  If we have a constant, we avoid doing a typecast to a
7747         larger type.
7748
7749         * class.cs (Indexer): Implement explicit interface implementation
7750         for indexers.
7751         
7752 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
7753
7754         * class.cs: make the default instance constructor public and hidebysig.
7755
7756 2001-01-03  Ravi Pratap  <ravi@ximian.com>
7757
7758         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
7759         so we can call it from elsewhere.
7760
7761         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
7762         we emit it internally if the class has a defined indexer; otherwise the user
7763         emits it by decorating the class definition with the DefaultMemberAttribute.
7764
7765         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
7766         attribute is not used on a type which defines an indexer.
7767
7768         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
7769         character when we skip whitespace.
7770
7771         * ../errors/cs0646.cs : Add.
7772
7773 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
7774
7775         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7776         again. 
7777
7778         * makefile: Add practical target `mcs3.exe' which builds the third
7779         generation compiler. 
7780
7781         * expression.cs (New): Fix structures constructor calling.
7782
7783         * class.cs (Property, Method, Indexer): Emit Final flag on the
7784         method if we are an interface implementation and we are not
7785         abstract. 
7786
7787         * ecore.cs (PropertyExpr): New public field `IsBase', tells
7788         whether this property is referencing a `base' method.
7789
7790         * expression.cs (Invocation.EmitCall): take an extra argument:
7791         is_base, this is used to determine whether the `call' or
7792         `callvirt' opcode should be used.
7793
7794         
7795         * delegate.cs: update EmitCall.
7796
7797         * class.cs (Method.Define): Set NewSlot for the cases where we are
7798         not implementing an interface method.
7799
7800         (Property.Define): ditto.
7801
7802 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
7803
7804         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7805         'r'.  Allows mcs to parse itself fully.
7806
7807 2002-01-02  Ravi Pratap  <ravi@ximian.com>
7808
7809         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
7810         of the number of initializers that require the InitializeArray method.
7811
7812         (CheckIndices): Store the Expression in all cases - not the plain value. Also
7813         update the above field where necessary.
7814
7815         (MakeByteBlob): Update accordingly.
7816
7817         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
7818         greater than 2.
7819
7820         (EmitDynamicInitializers): Update in accordance with the new optimization.
7821
7822         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
7823         same OpCode applies.
7824
7825         * cs-parser.jay : Fix some glaring errors I introduced.
7826
7827 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
7828
7829         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
7830         so that we can check for name clashes there too.
7831
7832         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
7833         for interface indexers.
7834
7835         * interfaces.cs (Define): Emit the default member attribute.
7836
7837         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
7838         variable was being referred to while setting the value ;-)
7839
7840 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
7841
7842         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
7843         byte-by-byte information when we know the data is zero.
7844
7845         Make the block always a multiple of 4, because
7846         DefineInitializedData has a bug.
7847
7848         * assign.cs: Fix, we should assign from the temporary, not from
7849         the source. 
7850
7851         * expression.cs (MakeByteBlob): Fix my incorrect code.
7852
7853 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
7854
7855         * typemanager.cs (EnumToUnderlying): This function is used to get
7856         the underlying type from an enumeration, because it does not
7857         always work. 
7858
7859         * constant.cs: Use the I4_S form for values between -128 and 127.
7860
7861         * statement.cs (Block.LookupLabel): Looks up a label.
7862         (Block): Drop support for labeled blocks.
7863
7864         (LabeledStatement): New kind of statement that represents a label
7865         only.
7866
7867         (Goto): Finally implement this bad boy.
7868         
7869         * cs-parser.jay: Update to reflect new mechanism to implement
7870         labels.
7871
7872 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
7873
7874         * codegen.cs (EmitContext.This): a codegen property that keeps the
7875         a single instance of this instead of creating many different this
7876         instances. 
7877
7878         * delegate.cs (Delegate.DoResolve): Update to use the property;
7879
7880         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
7881
7882         * expression.cs (BaseAccess.DoResolve): Ditto.
7883
7884 2001-12-29  Ravi Pratap  <ravi@ximian.com>
7885
7886         * typemanager.cs (methodimpl_attr_type): Add to hold the type
7887         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
7888
7889         (InitCoreTypes): Update accordingly.
7890
7891         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
7892         so we can quickly store the state.
7893
7894         (ApplyAttributes): Set the correct implementation flags
7895         for InternalCall methods.
7896
7897 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
7898
7899         * expression.cs (EmitCall): if a method is not virtual, then do
7900         not use callvirt on it.
7901
7902         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
7903         user defined stuff) requires the use of stobj, which takes an
7904         address on the stack instead of an array and an index.  So emit
7905         the Ldelema operation for it.
7906
7907         (EmitStoreOpcode): Use stobj for valuetypes.
7908
7909         (UnaryMutator.EmitCode): Use the right 1 value depending on
7910         whether we are dealing with int64/uint64, float or doubles.
7911
7912         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
7913         constructors that I implemented last night.
7914
7915         (Constructor.IsDefault): Fix to work properly for static
7916         constructors.
7917
7918         * cs-parser.jay (CheckDef): report method signature errors.
7919         Update error number 103 to be 132.
7920
7921         * decl.cs: New AdditionResult enumeration value: MethodExists.
7922         Although we do this check for methods later on in the semantic
7923         analysis, catching repeated default constructors is so easy that
7924         we catch these here. 
7925         
7926         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
7927         promotions code.
7928
7929         (ParameterReference.EmitAssign, Emit): handle
7930         bools as bytes.
7931
7932         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
7933         (ArrayAccess.EmitStoreOpcode): ditto.
7934
7935         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
7936
7937         * expression.cs (MakeByteBlob): Complete all the missing types
7938         (uint, short, ushort, byte, sbyte)
7939
7940         * class.cs: Only init instance field initializers on instance
7941         constructors. 
7942
7943         Rename `constructors' to instance_constructors. 
7944
7945         (TypeContainer.AddConstructor): Only add constructors to the list
7946         if it is not static.
7947
7948         Make sure that we handle default_static_constructor independently
7949         everywhere where we handle instance_constructors
7950
7951 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
7952
7953         * class.cs: Do not lookup or create a base initializer for a
7954         static constructor.
7955
7956         (ConstructorInitializer.Resolve): use the proper type to lookup
7957         for constructors.
7958
7959         * cs-parser.jay: Report error 1585 (modifiers between type and name).
7960
7961         * enum.cs, interface.cs: Remove CloseType, this is taken care by
7962         in DeclSpace. 
7963
7964         * decl.cs: CloseType is now an virtual method, the default
7965         implementation just closes this type.
7966         
7967 2001-12-28  Ravi Pratap  <ravi@ximian.com>
7968
7969         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
7970         to PreserveSig by default. Also emit HideBySig on such methods.
7971
7972         Basically, set the defaults to standard values.
7973
7974         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7975         argument, if candidate is better, it can't be worse than the best !
7976
7977         (Invocation): Re-write bits to differentiate between methods being
7978         applicable in their expanded form and their normal form - for params
7979         methods of course.
7980
7981         Get rid of use_standard everywhere as only standard conversions are allowed
7982         in overload resolution. 
7983
7984         More spec conformance.
7985         
7986 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7987
7988         * driver.cs: Add --timestamp, to see where the compiler spends
7989         most of its time.
7990
7991         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7992         `this' in static code.
7993
7994         (SimpleName.DoResolve): Implement in terms of a helper function
7995         that allows static-references to be passed upstream to
7996         MemberAccess.
7997
7998         (Expression.ResolveWithSimpleName): Resolve specially simple
7999         names when called by MemberAccess to implement the special
8000         semantics. 
8001
8002         (Expression.ImplicitReferenceConversion): Handle conversions from
8003         Null to reference types before others, as Null's type is
8004         System.Object. 
8005
8006         * expression.cs (Invocation.EmitCall): Handle the special case of
8007         calling methods declared on a reference type from a ValueType
8008         (Base classes System.Object and System.Enum)
8009
8010         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8011         the left hand side is a TypeExpr, not on every enumeration. 
8012
8013         (Binary.Resolve): If types are reference types, then do a cast to
8014         object on operators != and == of both arguments.
8015         
8016         * typemanager.cs (FindMembers): Extract instance and static
8017         members if requested.
8018
8019         * interface.cs (PopulateProperty): Use void_type instead of null
8020         as the return type for the setter method.
8021
8022         (PopulateIndexer): ditto.
8023
8024 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8025
8026         * support.cs (ReflectionParameters): Fix minor bug where we
8027         were examining the wrong parameter for the ParamArray attribute.
8028
8029         Cope with requests for the type of the parameter at position
8030         greater than the params parameter's. We now return the element
8031         type of the params array as that makes more sense.
8032
8033         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8034         accordingly as we no longer have to extract the element type
8035         ourselves.
8036
8037         (Invocation.OverloadResolve): Update.
8038
8039 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8040
8041         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8042         against IEnumerator, test whether the return value is a descendant
8043         of the IEnumerator interface.
8044
8045         * class.cs (Indexer.Define): Use an auxiliary method to implement
8046         the other bits of the method definition.  Begin support for
8047         explicit interface implementation.
8048
8049         (Property.DefineMethod): Use TypeManager.void_type instead of null
8050         for an empty return value.
8051
8052 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8053
8054         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8055         dealing with a FieldExpr which is composed of a FieldBuilder, in
8056         the code path we did extract the constant, but we should have
8057         obtained the underlying value to be able to cast it (otherwise we
8058         end up in an infinite loop, this is what Ravi was running into).
8059
8060         (ArrayCreation.UpdateIndices): Arrays might be empty.
8061
8062         (MemberAccess.ResolveMemberAccess): Add support for section
8063         14.5.4.1 that deals with the special case of E.I when E is a type
8064         and something else, that I can be a reference to a static member.
8065
8066         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8067         handle a particular array type to create byte blobs, it is just
8068         something we dont generate byteblobs for.
8069
8070         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8071         arguments. 
8072
8073         * location.cs (Push): remove the key from the hashtable that we
8074         are about to add.   This happens for empty files.
8075
8076         * driver.cs: Dispose files after we have parsed them.
8077
8078         (tokenize): new function that only runs the tokenizer on its
8079         input, for speed testing.
8080
8081 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8082
8083         * class.cs (Event.Define): Define the private field only if there
8084         are no accessors defined.
8085
8086         * expression.cs (ResolveMemberAccess): If there is no associated
8087         field with the event, that means we have an event defined with its
8088         own accessors and we should flag error cs0070 since transforming
8089         ourselves into a field is not valid in that case.
8090
8091         * ecore.cs (SimpleName.DoResolve): Same as above.
8092
8093         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8094         and charset to sane values.
8095
8096 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8097
8098         * assign.cs (DoResolve): Perform check on events only if they 
8099         are being accessed outside the declaring type.
8100
8101         * cs-parser.jay (event_declarations): Update rules to correctly
8102         set the type of the implicit parameter etc.
8103
8104         (add_accessor, remove_accessor): Set current local parameters.
8105
8106         * expression.cs (Binary): For delegate addition and subtraction,
8107         cast the return value from the method into the appropriate delegate
8108         type.
8109
8110 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8111
8112         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8113         of these as the workaround is unnecessary.
8114
8115         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8116         delegate data - none of that is needed at all.
8117
8118         Re-write bits to extract the instance expression and the delegate method
8119         correctly.
8120
8121         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8122         on delegates too.
8123
8124         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8125         of attaching attributes instead of duplicating code everywhere.
8126
8127         * everywhere : Update code to do attribute emission using the above method.
8128
8129 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8130
8131         * expression.cs (IsParamsMethodApplicable): if there are not
8132         parameters, return immediately.
8133
8134         * ecore.cs: The 0 literal can be implicity converted to an enum
8135         type. 
8136
8137         (SimpleName.DoResolve): First lookup the type, then lookup the
8138         members. 
8139
8140         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8141         want to get its address.  If the InstanceExpression is not
8142         addressable, store the result in a temporary variable, then get
8143         the address of it.
8144
8145         * codegen.cs: Only display 219 errors on warning level or above. 
8146
8147         * expression.cs (ArrayAccess): Make it implement the
8148         IMemoryLocation interface.
8149
8150         (Binary.DoResolve): handle the operator == (object a, object b)
8151         and operator != (object a, object b) without incurring into a
8152         BoxedCast (because 5 != o should never be performed).
8153
8154         Handle binary enumerator operators.
8155
8156         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8157         value type, otherwise use Ldelem_ref.
8158
8159         Use precomputed names;
8160
8161         (AddressOf): Implement address of
8162
8163         * cs-parser.jay (labeled_statement): Fix recursive block
8164         addition by reworking the production.
8165
8166         * expression.cs (New.DoEmit): New has a special case:
8167                 
8168                  If we are dealing with a ValueType, we have a few
8169                  situations to deal with:
8170                 
8171                     * The target of New is a ValueType variable, that is
8172                       easy, we just pass this as the variable reference
8173                 
8174                     * The target of New is being passed as an argument,
8175                       to a boxing operation or a function that takes a
8176                       ValueType.
8177                 
8178                       In this case, we need to create a temporary variable
8179                       that is the argument of New.
8180
8181
8182 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8183
8184         * rootcontext.cs (LookupType): Check that current_type is not null before
8185         going about looking at nested types.
8186
8187         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8188         not implement the IAssignMethod interface any more.
8189
8190         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8191         where we tranform them into FieldExprs if they are being resolved from within
8192         the declaring type.
8193
8194         * ecore.cs (SimpleName.DoResolve): Do the same here.
8195
8196         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8197
8198         * ../errors/bug10.cs : Add.
8199
8200         * ../errors/cs0070.cs : Add.
8201
8202         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8203
8204         * assign.cs : Get rid of EventIsLocal everywhere.
8205         
8206 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8207
8208         * ecore.cs (ConvertIntLiteral): finished the implementation.
8209
8210         * statement.cs (SwitchLabel): Convert the value we are using as a
8211         key before looking up the table.
8212
8213 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8214
8215         * codegen.cs (EmitTopBlock): Require a Location argument now.
8216
8217         * cs-parser.jay (constructor_declarator): We need to setup
8218         current_local_parameters before we parse the
8219         opt_constructor_initializer, to allow the variables to be bound
8220         to the constructor arguments.
8221
8222         * rootcontext.cs (LookupType): First lookup nested classes in our
8223         class and our parents before we go looking outside our class.
8224
8225         * expression.cs (ConstantFold): Extract/debox the values at the
8226         beginnning. 
8227
8228         * rootcontext.cs (EmitCode): Resolve the constants first before we
8229         resolve the types.  This is not really needed, but it helps debugging.
8230
8231         * statement.cs: report location.
8232         
8233         * cs-parser.jay: pass location to throw statement.
8234
8235         * driver.cs: Small bug fix.
8236
8237         * report.cs: Updated format to be 4-zero filled digits.
8238
8239 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8240
8241         * expression.cs (CheckIndices): Fix minor bug where the wrong
8242         variable was being referred to ;-)
8243
8244         (DoEmit): Do not call EmitStaticInitializers when the 
8245         underlying type is System.Object.
8246
8247 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8248
8249         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8250         and do the usual workaround for SRE.
8251
8252         * class.cs (MyEventBuilder.EventType): New member to get at the type
8253         of the event, quickly.
8254
8255         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8256
8257         * assign.cs (Assign.DoResolve): Handle the case when the target
8258         is an EventExpr and perform the necessary checks.
8259
8260         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8261         interface.
8262
8263         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8264
8265         (EventExpr): Set the type in the constructor itself since we 
8266         are meant to be born fully resolved.
8267
8268         (EventExpr.Define): Revert code I wrote earlier.
8269                 
8270         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8271         instance expression is null. The instance expression is a This in that case
8272         or a null, depending on whether it is a static method or not.
8273
8274         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8275         refers to more than one method.
8276
8277         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8278         and accordingly flag errors.
8279
8280 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8281
8282         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8283
8284 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8285
8286         * location.cs (ToString): Provide useful rutine.
8287
8288 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8289
8290         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8291         objects, return the actual integral boxed.
8292
8293         * statement.cs (SwitchLabel): define an ILLabel for each
8294         SwitchLabel. 
8295         
8296         (Switch.CheckSwitch): If the value is a Literal, extract
8297         the underlying literal.
8298         
8299         Also in the unused hashtable we had, add the SwitchLabel so we can
8300         quickly look this value up.
8301
8302         * constant.cs: Implement a bunch of new constants.  Rewrite
8303         Literal based on this.  Made changes everywhere to adapt to this.
8304         
8305         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8306         dereferencing array only once, and also copes with enumrations.
8307
8308         bytes are two bytes wide, not one.
8309
8310         (Cast): Perform constant conversions.
8311         
8312         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8313         wrappers to the literals here.
8314
8315         * expression.cs (DoNumericPromotions): long literals can converted
8316         to ulong implicity (this is taken care of elsewhere, but I was
8317         missing this spot).
8318
8319         * ecore.cs (Expression.Literalize): Make the return type Literal,
8320         to improve type checking.
8321
8322         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8323
8324 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8325
8326         * literal.cs: Revert code from ravi that checked the bounds.  The
8327         bounds are sane by the definition of the type itself. 
8328
8329         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8330         need to actually look up in our parent hierarchy for interfaces
8331         implemented. 
8332
8333         * const.cs: Use the underlying type for enumerations
8334
8335         * delegate.cs: Compute the basename for the delegate creation,
8336         that should fix the delegate test case, and restore the correct
8337         Type Lookup semantics in rootcontext
8338
8339         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8340         referencing a nested type with the Reflection API is using the "+"
8341         sign. 
8342
8343         * cs-parser.jay: Do not require EOF token at the end.
8344
8345 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8346
8347         * rootcontext.cs (LookupType): Concatenate type names with
8348         a '.' instead of a '+' The test suite passes again.
8349
8350         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8351         field of the enumeration.
8352
8353         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8354         the case when the member is an EventExpr.
8355
8356         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8357         static has an associated instance expression.
8358
8359         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8360
8361         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8362
8363         * class.cs (Event.Define): Register event and perform appropriate checks
8364         for error #111.
8365
8366         We define the Add and Remove methods even if the use provides none because
8367         in that case, we provide default implementations ourselves.
8368
8369         Define a private field of the type of the event. This is done by the CSC compiler
8370         and we should be doing it too ;-)
8371
8372         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8373         More methods we use in code we generate.
8374
8375         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8376         is important.
8377
8378         (InitCoreTypes): Update accordingly for the above.
8379
8380         * class.cs (Event.Emit): Generate code for default accessors that we provide
8381
8382         (EmitDefaultMethod): Do the job in the above.
8383
8384         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8385         appropriate place.
8386
8387 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8388
8389         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8390         builders even if we were missing one.
8391
8392         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8393         pass the Basename as our class name instead of the Name.  The
8394         basename will be correctly composed for us.
8395
8396         * parameter.cs (Paramters): Now takes a Location argument.
8397
8398         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8399         make all the code call directly LookupType in RootContext and take
8400         this chance to pass the Location information everywhere.
8401
8402         * Everywhere: pass Location information.
8403
8404 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8405
8406         * class.cs (Constructor.Define): Updated way of detecting the
8407         length of the parameters.
8408
8409         (TypeContainer.DefineType): Use basename as the type name for
8410         nested types.
8411
8412         (TypeContainer.Define): Do not recursively define types here, as
8413         definition is taken care in order by the RootContext.
8414
8415         * tree.cs: Keep track of namespaces in a per-file basis.
8416
8417         * parameter.cs (Parameter.ComputeSignature): Update to use
8418         DeclSpace. 
8419
8420         (Parameters.GetSignature): ditto.
8421
8422         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8423         instead of a TypeContainer.
8424
8425         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8426         resolve names.  Because we need to be resolve in our context, not
8427         our parents.
8428         
8429         * driver.cs: Implement response files.
8430
8431         * class.cs (TypeContainer.DefineType): If we are defined, do not
8432         redefine ourselves.
8433         
8434         (Event.Emit): Emit the code for add/remove handlers.
8435         (Event.Define): Save the MethodBuilders for add/remove.
8436
8437         * typemanager.cs: Use pair here too.
8438
8439         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8440         DictionaryEntry requires the first argument to be non-null.  
8441         
8442         (enum_declaration): Compute full name for registering the
8443         enumeration.
8444         
8445         (delegate_declaration): Instead of using
8446         formal_parameter_list, use opt_formal_parameter_list as the list
8447         can be empty.
8448
8449         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8450         (EventParsing): New property that controls whether `add' and
8451         `remove' are returned as tokens or identifiers (for events);
8452
8453 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8454
8455         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8456         use MyEventBuilder only and let it wrap the real builder for us.
8457
8458         (MyEventBuilder): Revamp constructor etc.
8459
8460         Implement all operations that we perform on EventBuilder in precisely the same
8461         way here too.
8462
8463         (FindMembers): Update to use the EventBuilder member.
8464
8465         (Event.Emit): Update accordingly.
8466
8467 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8468
8469         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8470         by calling the appropriate methods.
8471
8472         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8473         useful.
8474
8475         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8476
8477 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8478
8479         * delegate.cs (Delegate.Populate): Check that the return type
8480         and various parameters types are indeed accessible.
8481
8482         * class.cs (Constructor.Define): Same here.
8483
8484         (Field.Define): Ditto.
8485
8486         (Event.Define): Ditto.
8487
8488         (Operator.Define): Check that the underlying Method defined itself
8489         correctly - so it's MethodBuilder should not be null.
8490
8491         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8492         expression happens to be null.
8493
8494         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8495         members but as of now we don't seem to be able to do anything really useful with it.
8496
8497         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8498         not the EventBuilder.
8499
8500 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
8501
8502         * cs-tokenizer.cs: Add support for defines.
8503         Add support for #if, #elif, #else, #endif
8504         
8505         (eval_var): evaluates a variable.
8506         (eval): stubbed for evaluating functions.
8507
8508         * cs-parser.jay: Pass the defines information
8509
8510         * driver.cs: Add --define command line option.
8511
8512         * decl.cs: Move MemberCore here.
8513
8514         Make it the base class for DeclSpace.  This allows us to catch and
8515         report 108 and 109 for everything now.
8516
8517         * class.cs (TypeContainer.Define): Extract all the members
8518         before populating and emit the warning 108 (new keyword required
8519         to override) instead of having each member implement this.
8520
8521         (MemberCore.Define): New abstract method, we will be using this in
8522         the warning reporting engine in Populate.
8523         
8524         (Operator.Define): Adjust to new MemberCore protocol. 
8525
8526         * const.cs (Const): This does not derive from Expression, it is a
8527         temporary object we use to create fields, it is a MemberCore. 
8528
8529         * class.cs (Method.Define): Allow the entry point to be in a
8530         specific class.
8531
8532         * driver.cs: Rewrite the argument handler to clean it up a bit.
8533
8534         * rootcontext.cs: Made it just an auxiliary namespace feature by
8535         making everything static.
8536
8537         * driver.cs: Adapt code to use RootContext type name instead of
8538         instance variable.
8539
8540         * delegate.cs: Remove RootContext argument.
8541
8542         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8543         argument. 
8544
8545         * class.cs (Event.Define): The lookup can fail.
8546         
8547         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
8548
8549         * expression.cs: Resolve the this instance before invoking the code.
8550
8551 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
8552
8553         * cs-parser.jay: Add a production in element_access that allows
8554         the thing to become a "type" reference.  This way we can parse
8555         things like "(string [])" as a type.
8556
8557         Note that this still does not handle the more complex rules of
8558         casts. 
8559         
8560
8561         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
8562
8563         * ecore.cs: (CopyNewMethods): new utility function used to
8564         assemble the list of methods from running FindMembers.
8565
8566         (MemberLookup): Rework FindMembers so that 
8567
8568 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
8569
8570         * class.cs (TypeContainer): Remove Delegates who fail to be
8571         defined.
8572
8573         * delegate.cs (Populate): Verify that we dont get null return
8574         values.   TODO: Check for AsAccessible.
8575
8576         * cs-parser.jay: Use basename to emit error 574 (destructor should
8577         have the same name as container class), not the full name.
8578
8579         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8580         possible representation.  
8581
8582         Also implements integer type suffixes U and L.
8583
8584 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
8585
8586         * expression.cs (ArrayCreation.DoResolve): We need to do the
8587         argument resolution *always*.
8588
8589         * decl.cs: Make this hold the namespace.  Hold the root context as
8590         well.
8591         (LookupType): Move here.
8592
8593         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8594
8595         * location.cs (Row, Name): Fixed the code, it was always returning
8596         references to the first file.
8597
8598         * interface.cs: Register properties defined through interfaces.
8599
8600         * driver.cs: Add support for globbing on the command line
8601
8602         * class.cs (Field): Make it derive from MemberCore as well.
8603         (Event): ditto.
8604
8605 2001-12-15  Ravi Pratap  <ravi@ximian.com>
8606
8607         * class.cs (Event::Define): Check that the type of the event is a delegate
8608         type else flag error #66.
8609
8610         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8611         same.
8612
8613         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8614         values of EntryPoint, CharSet etc etc.
8615
8616         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8617
8618         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8619         be null and we should ignore this. I am not sure if this is really clean. Apparently,
8620         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8621         which needs this to do its work.
8622
8623         * ../errors/cs0066.cs : Add.
8624
8625 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
8626
8627         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8628         helper functions.
8629
8630         * class.cs: (MethodSignature.MethodSignature): Removed hack that
8631         clears out the parameters field.
8632         (MemberSignatureCompare): Cleanup
8633
8634         (MemberCore): New base class used to share code between MethodCore
8635         and Property.
8636
8637         (RegisterRequiredImplementations) BindingFlags.Public requires
8638         either BindingFlags.Instace or Static.  Use instance here.
8639
8640         (Property): Refactored code to cope better with the full spec.
8641
8642         * parameter.cs (GetParameterInfo): Return an empty array instead
8643         of null on error.
8644
8645         * class.cs (Property): Abstract or extern properties have no bodies.
8646
8647         * parameter.cs (GetParameterInfo): return a zero-sized array.
8648
8649         * class.cs (TypeContainer.MethodModifiersValid): Move all the
8650         method modifier validation to the typecontainer so we can reuse
8651         this on properties.
8652
8653         (MethodCore.ParameterTypes): return an empty sized array of types.
8654
8655         (Property.Define): Test property modifier validity.
8656
8657         Add tests for sealed/override too.
8658
8659         (Method.Emit): abstract or extern methods have no bodies.
8660
8661 2001-12-14  Ravi Pratap  <ravi@ximian.com>
8662
8663         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8664         thing.
8665
8666         (Method::Define, ::Emit): Modify accordingly.
8667
8668         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8669
8670         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8671
8672         * makefile: Pass in /unsafe.
8673
8674 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
8675
8676         * class.cs (MakeKey): Kill routine.
8677         
8678         * class.cs (TypeContainer.Define): Correctly define explicit
8679         method implementations (they require the full interface name plus
8680         the method name).
8681
8682         * typemanager.cs: Deply the PtrHashtable here and stop using the
8683         lame keys.  Things work so much better.
8684
8685         This of course broke everyone who depended on `RegisterMethod' to
8686         do the `test for existance' test.  This has to be done elsewhere.
8687
8688         * support.cs (PtrHashtable): A hashtable that avoid comparing with
8689         the object stupid Equals method (because, that like fails all over
8690         the place).  We still do not use it.
8691
8692         * class.cs (TypeContainer.SetRequiredInterface,
8693         TypeContainer.RequireMethods): Killed these two routines and moved
8694         all the functionality to RegisterRequiredImplementations.
8695
8696         (TypeContainer.RegisterRequiredImplementations): This routine now
8697         registers all the implementations required in an array for the
8698         interfaces and abstract methods.  We use an array of structures
8699         which can be computed ahead of time to reduce memory usage and we
8700         also assume that lookups are cheap as most classes will not
8701         implement too many interfaces.
8702
8703         We also avoid creating too many MethodSignatures.
8704
8705         (TypeContainer.IsInterfaceMethod): Update and optionally does not
8706         clear the "pending" bit if we find that there are problems with
8707         the declaration.
8708
8709         (TypeContainer.VerifyPendingMethods): Update to report errors of
8710         methods that look like implementations but are not.
8711
8712         (TypeContainer.Define): Add support for explicit interface method
8713         implementation. 
8714         
8715 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
8716
8717         * typemanager.cs: Keep track of the parameters here instead of
8718         being a feature of the TypeContainer.
8719
8720         * class.cs: Drop the registration of parameters here, as
8721         InterfaceMethods are also interface declarations.
8722
8723         * delegate.cs: Register methods with the TypeManager not only with
8724         the TypeContainer.  This code was buggy.
8725
8726         * interface.cs: Full registation here.
8727
8728 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
8729
8730         * expression.cs: Remove reducer for binary expressions, it can not
8731         be done this way.
8732
8733         * const.cs: Put here the code that used to go into constant.cs
8734
8735         * constant.cs: Put here the code for constants, this is a new base
8736         class for Literals.
8737
8738         * literal.cs: Make Literal derive from Constant.
8739
8740 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
8741
8742         * statement.cs (Return.Emit): Report error 157 if the user
8743         attempts to return from a finally block.
8744
8745         (Return.Emit): Instead of emitting a return, jump to the end of
8746         the function.
8747
8748         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
8749         LocalBuilder to store the result of the function.  ReturnLabel is
8750         the target where we jump.
8751         
8752
8753 2001-12-09  Radek Doulik  <rodo@ximian.com>
8754
8755         * cs-parser.jay: remember alias in current namespace
8756
8757         * ecore.cs (SimpleName::DoResolve): use aliases for types or
8758         namespaces
8759
8760         * class.cs (LookupAlias): lookup alias in my_namespace
8761
8762         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
8763         aliases hashtable
8764         (LookupAlias): lookup alias in this and if needed in parent
8765         namespaces
8766
8767 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
8768
8769         * support.cs: 
8770
8771         * rootcontext.cs: (ModuleBuilder) Made static, first step into
8772         making things static.  I need this to avoid passing the
8773         TypeContainer when calling ParameterType.
8774
8775         * support.cs (InternalParameters.ParameterType): Remove ugly hack
8776         that did string manipulation to compute the type and then call
8777         GetType.  Use Parameter.ParameterType instead.
8778
8779         * cs-tokenizer.cs: Consume the suffix for floating values.
8780
8781         * expression.cs (ParameterReference): figure out whether this is a
8782         reference parameter or not.  Kill an extra variable by computing
8783         the arg_idx during emission.
8784
8785         * parameter.cs (Parameters.GetParameterInfo): New overloaded
8786         function that returns whether a parameter is an out/ref value or not.
8787
8788         (Parameter.ParameterType): The type of the parameter (base,
8789         without ref/out applied).
8790         
8791         (Parameter.Resolve): Perform resolution here.
8792         (Parameter.ExternalType): The full type (with ref/out applied).
8793
8794         * statement.cs (Using.Emit, Using.EmitExpression): Implement
8795         support for expressions on the using statement.
8796
8797 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
8798
8799         * statement.cs (Using.EmitLocalVariableDecls): Split the
8800         localvariable handling of the using statement.
8801
8802         (Block.EmitMeta): Keep track of variable count across blocks.  We
8803         were reusing slots on separate branches of blocks.
8804
8805         (Try.Emit): Emit the general code block, we were not emitting it. 
8806
8807         Check the type of the declaration to be an IDisposable or
8808         something that can be implicity converted to it. 
8809
8810         Emit conversions if required.
8811
8812         * ecore.cs (EmptyExpression): New utility class.
8813         (Expression.ImplicitConversionExists): New utility function.
8814
8815 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
8816
8817         * statement.cs (Using): Implement.
8818
8819         * expression.cs (LocalVariableReference): Support read only variables.
8820
8821         * statement.cs: Remove the explicit emit for the Leave opcode.
8822         (VariableInfo): Add a readonly field.
8823
8824 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
8825
8826         * ecore.cs (ConvCast): new class used to encapsulate the various
8827         explicit integer conversions that works in both checked and
8828         unchecked contexts.
8829
8830         (Expression.ConvertNumericExplicit): Use new ConvCast class to
8831         properly generate the overflow opcodes.
8832
8833 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8834
8835         * statement.cs: The correct type for the EmptyExpression is the
8836         element_type, not the variable type.  Ravi pointed this out.
8837
8838 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8839
8840         * class.cs (Method::Define): Handle PInvoke methods specially
8841         by using DefinePInvokeMethod instead of the usual one.
8842
8843         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
8844         above to do the task of extracting information and defining the method.
8845         
8846 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8847
8848         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
8849         of the condition for string type.
8850
8851         (Emit): Move that here. 
8852
8853         (ArrayCreation::CheckIndices): Keep string literals in their expression
8854         form.
8855
8856         (EmitDynamicInitializers): Handle strings appropriately.
8857
8858 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8859
8860         * codegen.cs (EmitContext): Replace multiple variables with a
8861         single pointer to the current Switch statement.
8862
8863         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
8864         EmitContext.
8865
8866 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8867
8868         * statement.cs 
8869
8870         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
8871         default'.
8872         
8873         (Foreach.Emit): Foreach on arrays was not setting
8874         up the loop variables (for break/continue).
8875
8876         (GotoCase): Semi-implented.
8877         
8878 2001-12-03  Ravi Pratap  <ravi@ximian.com>
8879
8880         * attribute.cs (CheckAttribute): Handle system attributes by using
8881         Attribute.GetAttributes to examine information we need.
8882
8883         (GetValidPlaces): Same here.
8884
8885         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
8886
8887         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
8888
8889         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
8890
8891         (Method::Define): Set appropriate flags if we have a DllImport attribute.
8892
8893         (Method::Emit): Handle the case when we are a PInvoke method.
8894
8895 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8896
8897         * expression.cs: Use ResolveWithSimpleName on compound names.
8898
8899 2001-12-02  Ravi Pratap  <ravi@ximian.com>
8900
8901         * constant.cs (EmitConstant): Make sure we resolve the associated expression
8902         before trying to reduce it.
8903
8904         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
8905
8906         * constant.cs (LookupConstantValue): Implement.
8907
8908         (EmitConstant): Use the above in emitting the constant.
8909
8910         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
8911         that are user-defined by doing a LookupConstantValue on them.
8912
8913         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
8914         too, like above.
8915
8916 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
8917
8918         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
8919
8920         (BaseAccess.DoResolve): Implement.
8921
8922         (MemberAccess.DoResolve): Split this routine into a
8923         ResolveMemberAccess routine that can be used independently
8924
8925 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
8926
8927         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
8928         As that share bits of the implementation.  Is returns a boolean,
8929         while As returns the Type that is being probed.
8930
8931 2001-12-01  Ravi Pratap  <ravi@ximian.com>
8932
8933         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
8934         instead of a Literal - much easier.
8935
8936         (EnumInTransit): Remove - utterly useless :-)
8937
8938         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
8939
8940         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
8941
8942         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
8943         chain when we have no associated expression.
8944
8945 2001-11-30  Ravi Pratap  <ravi@ximian.com>
8946
8947         * constant.cs (Define): Use Location while reporting the errror.
8948
8949         Also emit a warning when 'new' is used and there is no inherited
8950         member to hide.
8951
8952         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
8953         populated.
8954
8955         (LookupEnumValue): Implement to lookup an enum member's value and define it
8956         if necessary.
8957
8958         (Populate): Re-write accordingly to use the above routine.
8959
8960 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
8961
8962         * expression.cs (This): Fix prototype for DoResolveLValue to
8963         override the base class DoResolveLValue.
8964
8965         * cs-parser.cs: Report errors cs574 and cs575 (destructor
8966         declarations) 
8967
8968         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
8969         (we need to load the address of the field here).  This fixes
8970         test-22. 
8971         
8972         (FieldExpr.DoResolveLValue): Call the DoResolve
8973         function to initialize the Instance expression.
8974         
8975         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8976         correctly the GetEnumerator operation on a value type.
8977
8978         * cs-parser.jay: Add more simple parsing error catches.
8979
8980         * statement.cs (Switch): Add support for string switches.
8981         Handle null specially.
8982
8983         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
8984
8985 2001-11-28  Ravi Pratap  <ravi@ximian.com>
8986
8987         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8988
8989         (declare_local_constant): New helper function.
8990
8991         * statement.cs (AddConstant): Keep a separate record of constants
8992
8993         (IsConstant): Implement to determine if a variable is a constant.
8994
8995         (GetConstantExpression): Implement.
8996
8997         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8998
8999         * statement.cs (IsVariableDefined): Re-write.
9000
9001 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9002
9003         * class.cs (TypeContainer::FindMembers): Look for constants
9004         in the case when we are looking for MemberTypes.Field
9005
9006         * expression.cs (MemberAccess::DoResolve): Check that in the
9007         case we are a FieldExpr and a Literal, we are not being accessed
9008         by an instance reference.
9009
9010         * cs-parser.jay (local_constant_declaration): Implement.
9011
9012         (declaration_statement): Implement for constant declarations.
9013
9014 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9015
9016         * statement.cs (Switch): Catch double defaults.
9017
9018         (Switch): More work on the switch() statement
9019         implementation.  It works for integral values now, need to finish
9020         string support.
9021
9022
9023 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9024
9025         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9026         integer literals into other integer literals.  To be used by
9027         switch. 
9028
9029 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9030
9031         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9032         some memory.
9033
9034         (EmitDynamicInitializers): Cope with the above since we extract data
9035         directly from ArrayData now.
9036
9037         (ExpectInitializers): Keep track of whether initializers are mandatory
9038         or not.
9039
9040         (Bounds): Make it a hashtable to prevent the same dimension being 
9041         recorded for every element in that dimension.
9042
9043         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9044         from being found.
9045
9046         Also fix bug which was causing the indices to be emitted in the reverse
9047         order.
9048
9049 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9050
9051         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9052         unfinished.  They do not work, because the underlying code is
9053         sloppy.
9054
9055 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9056
9057         * cs-parser.jay: Remove bogus fixme.
9058
9059         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9060         on Switch statement.
9061         
9062 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9063
9064         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9065         the same. 
9066         
9067         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9068         parameter. Apparently, any expression is allowed. 
9069
9070         (ValidateInitializers): Update accordingly.
9071
9072         (CheckIndices): Fix some tricky bugs thanks to recursion.
9073
9074         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9075         I was being completely brain-dead.
9076
9077         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9078         and re-write acordingly.
9079
9080         (DelegateInvocation): Re-write accordingly.
9081
9082         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9083
9084         (MakeByteBlob): Handle types more correctly.
9085
9086         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9087         initialization from expressions but it is incomplete because I am a complete
9088         Dodo :-|
9089
9090 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9091
9092         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9093         on If.  Basically, we have to return `true' (ie, we do return to
9094         our caller) only if both branches of the if return.
9095
9096         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9097         short-circuit operators, handle them as short circuit operators. 
9098
9099         (Cast.DoResolve): Resolve type.
9100         (Cast.Cast): Take an expression as the target type.
9101
9102         * cs-parser.jay (cast_expression): Remove old hack that only
9103         allowed a limited set of types to be handled.  Now we take a
9104         unary_expression and we resolve to a type during semantic
9105         analysis.
9106
9107         Use the grammar productions from Rhys to handle casts (this is
9108         not complete like Rhys syntax yet, we fail to handle that corner
9109         case that C# has regarding (-x), but we will get there.
9110         
9111 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9112
9113         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9114         field which is an array type.
9115
9116         * cs-parser.jay (declare_local_variables): Support array initialization too.
9117
9118         * typemanager.cs (MakeKey): Implement.
9119
9120         (everywhere): Use the above appropriately.
9121
9122         * cs-parser.jay (for_statement): Update for array initialization while
9123         declaring variables.
9124
9125         * ecore.cs : The error message was correct, it's the variable's names that
9126         were misleading ;-) Make the code more readable.
9127
9128         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9129         the correct type etc.
9130
9131         (ConvertExplicit): Handle Enum types by examining the underlying type.
9132
9133 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9134
9135         * parameter.cs (GetCallingConvention): Always return
9136         CallingConventions.Standard for now.
9137
9138 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9139
9140         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9141         and `r' after calling DoNumericPromotions.
9142
9143         * ecore.cs: Fix error message (the types were in the wrong order).
9144
9145         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9146         BindingFlags.Instance as well 
9147
9148         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9149         implicit int literal conversion in an empty cast so that we
9150         propagate the right type upstream.
9151
9152         (UnboxCast): new class used to unbox value types.
9153         (Expression.ConvertExplicit): Add explicit type conversions done
9154         by unboxing.
9155
9156         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9157         the target type before applying the implicit LongLiterals to ULong
9158         literal cast.
9159
9160 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9161
9162         * cs-parser.jay (for_statement): Reworked the way For works: now
9163         we declare manually any variables that are introduced in
9164         for_initializer to solve the problem of having out-of-band code
9165         emition (that is what got for broken).
9166
9167         (declaration_statement): Perform the actual variable declaration
9168         that used to be done in local_variable_declaration here.
9169
9170         (local_variable_declaration): Do not declare anything, just pass
9171         the information on a DictionaryEntry
9172
9173 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9174
9175         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9176         re-write of the logic to now make it recursive.
9177
9178         (UpdateIndices): Re-write accordingly.
9179
9180         Store element data in a separate ArrayData list in the above methods.
9181
9182         (MakeByteBlob): Implement to dump the array data into a byte array.
9183
9184 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9185
9186         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9187         into CheckIndices.
9188
9189         * constant.cs (Define): Implement.
9190
9191         (EmitConstant): Re-write fully.
9192
9193         Pass in location info.
9194
9195         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9196         respectively.
9197
9198         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9199         DictionaryEntry since we need location info too.
9200
9201         (constant_declaration): Update accordingly.
9202
9203         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9204         code into another method : UpdateIndices.
9205
9206 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9207
9208         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9209         some type checking etc.
9210
9211 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9212
9213         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9214         bits to provide dimension info if the user skips doing that.
9215
9216         Update second constructor to store the rank correctly.
9217
9218 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9219
9220         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9221         and try to implement.
9222
9223         * ../errors/cs0150.cs : Add.
9224
9225         * ../errors/cs0178.cs : Add.
9226
9227 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9228
9229         * statement.cs: Implement foreach on multi-dimensional arrays. 
9230
9231         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9232         name of the params argument.
9233
9234         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9235         initializing the array.
9236
9237         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9238         we can use this elsewhere.
9239
9240         * statement.cs: Finish implementation of foreach for single
9241         dimension arrays.
9242
9243         * cs-parser.jay: Use an out-of-band stack to pass information
9244         around, I wonder why I need this.
9245
9246         foreach_block: Make the new foreach_block the current_block.
9247
9248         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9249         function used to return a static Parameters structure.  Used for
9250         empty parameters, as those are created very frequently.
9251
9252         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9253
9254 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9255
9256         * interface.cs : Default modifier is private, not public. The
9257         make verify test passes again.
9258
9259 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9260
9261         * support.cs (ReflectionParameters): Fix logic to determine
9262         whether the last parameter is a params one. Test 9 passes again.
9263
9264         * delegate.cs (Populate): Register the builders we define with
9265         RegisterParameterForBuilder. Test 19 passes again.
9266
9267         * cs-parser.jay (property_declaration): Reference $6 instead
9268         of $$ to get at the location.
9269
9270         (indexer_declaration): Similar stuff.
9271
9272         (attribute): Ditto.
9273
9274         * class.cs (Property): Register parameters for the Get and Set methods
9275         if they exist. Test 23 passes again.
9276
9277         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9278         call to EmitArguments as we are sure there aren't any params arguments. 
9279         Test 32 passes again.
9280
9281         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9282         IndexOutOfRangeException. 
9283
9284         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9285         Test 33 now passes again.
9286         
9287 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9288
9289         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9290         broke a bunch of things.  Will have to come up with a better way
9291         of tracking locations.
9292
9293         * statement.cs: Implemented foreach for single dimension arrays.
9294
9295 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9296
9297         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9298         an error.  This removes the lookup from the critical path.
9299
9300         * cs-parser.jay: Removed use of temporary_loc, which is completely
9301         broken. 
9302
9303 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9304
9305         * support.cs (ReflectionParameters.ParameterModifier): Report
9306         whether the argument is a PARAMS argument or not.
9307
9308         * class.cs: Set the attribute `ParamArrayAttribute' on the
9309         parameter argument.
9310
9311         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9312         and cons_param_array_attribute (ConstructorInfo for
9313         ParamArrayAttribute)., 
9314
9315         * codegen.cs: Emit the return using the `Return' statement, that
9316         way we can report the error correctly for missing return values. 
9317
9318         * class.cs (Method.Emit): Clean up.
9319
9320         * expression.cs (Argument.Resolve): Take another argument: the
9321         location where this argument is used.  Notice that this is not
9322         part of the "Argument" class as to reduce the size of the
9323         structure (we know the approximate location anyways).
9324
9325         Test if the argument is a variable-reference, if not, then
9326         complain with a 206.
9327
9328         (Argument.Emit): Emit addresses of variables.
9329
9330         (Argument.FullDesc): Simplify.
9331
9332         (Invocation.DoResolve): Update for Argument.Resolve.
9333
9334         (ElementAccess.DoResolve): ditto.
9335
9336         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9337         method should be virtual, as this method is always virtual.
9338
9339         (NewDelegate.DoResolve): Update for Argument.Resolve.
9340
9341         * class.cs (ConstructorInitializer.DoResolve): ditto.
9342         
9343         * attribute.cs (Attribute.Resolve): ditto.
9344
9345 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9346
9347         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9348
9349         * expression.cs (ParameterReference): Drop IStackStorage and implement
9350         IAssignMethod instead. 
9351
9352         (LocalVariableReference): ditto.
9353         
9354         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9355         IAssignMethod instead. 
9356
9357 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9358
9359         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9360         enumerations that are used in heavily used structures derive from
9361         byte in a laughable and pathetic attempt to reduce memory usage.
9362         This is the kind of pre-optimzations that you should not do at
9363         home without adult supervision.
9364
9365         * expression.cs (UnaryMutator): New class, used to handle ++ and
9366         -- separatedly from the other unary operators.  Cleans up the
9367         code, and kills the ExpressionStatement dependency in Unary.
9368
9369         (Unary): Removed `method' and `Arguments' from this class, making
9370         it smaller, and moving it all to SimpleCall, so I can reuse this
9371         code in other locations and avoid creating a lot of transient data
9372         strucutres when not required.
9373
9374         * cs-parser.jay: Adjust for new changes.
9375
9376 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9377
9378         * enum.cs (Enum.Populate): If there is a failure during
9379         definition, return
9380
9381         * cs-parser.jay (opt_enum_base): we used to catch type errors
9382         here, but this is really incorrect.  The type error should be
9383         catched during semantic analysis.
9384
9385 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9386
9387         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9388         current_local_parameters as expected since I, in my stupidity, had forgotten
9389         to do this :-)
9390
9391         * attribute.cs (GetValidPlaces): Fix stupid bug.
9392
9393         * class.cs (Method::Emit): Perform check on applicability of attributes.
9394
9395         (Constructor::Emit): Ditto.
9396
9397         (Field::Emit): Ditto.
9398
9399         (Field.Location): Store location information.
9400
9401         (Property, Event, Indexer, Operator): Ditto.
9402
9403         * cs-parser.jay (field_declaration): Pass in location for each field.
9404
9405         * ../errors/cs0592.cs : Add.
9406
9407 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9408
9409         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9410
9411         (InitCoreTypes): Update accordingly.
9412
9413         (RegisterAttrType, LookupAttr): Implement.
9414
9415         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9416         info about the same.
9417
9418         (Resolve): Update to populate the above as necessary.
9419
9420         (Error592): Helper.
9421
9422         (GetValidPlaces): Helper to the above.
9423
9424         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9425
9426         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9427
9428 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9429
9430         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9431
9432         * ../errors/cs0617.cs : Add.
9433
9434 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9435
9436         * enum.cs (Emit): Rename to Populate to be more consistent with what
9437         we expect it to do and when exactly it is called.
9438
9439         * class.cs, rootcontext.cs : Update accordingly.
9440
9441         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9442         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9443
9444         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9445
9446         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9447         of a fieldinfo using the above, when dealing with a FieldBuilder.
9448
9449 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9450
9451         * ../errors/cs0031.cs : Add.
9452
9453         * ../errors/cs1008.cs : Add.
9454
9455         * ../errrors/cs0543.cs : Add.
9456
9457         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9458         enum type.
9459
9460         (FindMembers): Implement.
9461
9462         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9463         enums and delegates too.
9464
9465         (enum_types): Rename to builder_to_enum.
9466
9467         (delegate_types): Rename to builder_to_delegate.
9468
9469         * delegate.cs (FindMembers): Implement.
9470
9471 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9472
9473         * typemanager.cs (IsEnumType): Implement.
9474
9475         * enum.cs (Emit): Re-write parts to account for the underlying type
9476         better and perform checking etc.
9477
9478         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9479         of the underlying type.
9480
9481         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9482         value
9483
9484         * enum.cs (error31): Helper to report error #31.
9485
9486         * cs-parser.jay (enum_declaration): Store location of each member too.
9487
9488         * enum.cs (member_to_location): New hashtable. 
9489
9490         (AddEnumMember): Update location hashtable.
9491
9492         (Emit): Use the location of each member while reporting errors.
9493
9494 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9495
9496         * cs-parser.jay: A for_initializer if is a
9497         local_variable_declaration really ammount to have an implicit
9498         block with the variable declaration and no initializer for for.
9499
9500         * statement.cs (For.Emit): Cope with null initializers.
9501
9502         This fixes the infinite loop on for initializers.
9503
9504 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
9505
9506         * enum.cs: More cleanup.
9507
9508         * ecore.cs: Remove dead code.
9509
9510         * class.cs (Property.Emit): More simplification.
9511         (Event.Emit): ditto.
9512
9513         Reworked to have less levels of indentation.
9514         
9515 2001-11-08  Ravi Pratap  <ravi@ximian.com>
9516
9517         * class.cs (Property): Emit attributes.
9518
9519         (Field): Ditto.
9520         
9521         (Event): Ditto.
9522
9523         (Indexer): Ditto.
9524
9525         (Operator): Ditto.
9526
9527         * enum.cs (Emit): Ditto.
9528
9529         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9530         Enums too.
9531
9532         * class.cs (Field, Event, etc.): Move attribute generation into the
9533         Emit method everywhere.
9534
9535         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9536         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9537         as we had no way of defining nested enums !
9538
9539         * rootcontext.cs : Adjust code accordingly.
9540
9541         * typemanager.cs (AddEnumType): To keep track of enum types separately.
9542
9543 2001-11-07  Ravi Pratap  <ravi@ximian.com>
9544
9545         * expression.cs (EvalConstantExpression): Move into ecore.cs
9546         
9547         * enum.cs (Enum): Rename some members and make them public and readonly
9548         according to our convention.
9549
9550         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9551         nothing else.
9552
9553         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9554
9555         (Enum::Emit): Write a simple version for now which doesn't try to compute
9556         expressions. I shall modify this to be more robust in just a while.
9557
9558         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9559
9560         (TypeContainer::CloseType): Create the Enum types too.
9561
9562         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9563
9564         * expression.cs (EvalConstantExpression): Get rid of completely.
9565
9566         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9567         user-defined values and other cases.
9568
9569         (IsValidEnumLiteral): Helper function.
9570
9571         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
9572         out there in the case we had a literal FieldExpr.
9573
9574         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9575
9576         (Literalize): Revamp a bit to take two arguments.
9577         
9578         (EnumLiteral): New class which derives from Literal to wrap enum literals.
9579         
9580 2001-11-06  Ravi Pratap  <ravi@ximian.com>
9581
9582         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9583
9584         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9585
9586         (Resolve): Use the above to ensure we have proper initializers.
9587
9588 2001-11-05  Ravi Pratap  <ravi@ximian.com>
9589
9590         * expression.cs (Expression::EvalConstantExpression): New method to 
9591         evaluate constant expressions.
9592
9593         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9594
9595 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
9596
9597         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9598         in an array.
9599
9600         (Binary.ResolveOperator): Handle operator != (object a, object b)
9601         and operator == (object a, object b);
9602
9603         (Binary.DoNumericPromotions): Indicate whether the numeric
9604         promotion was possible.
9605
9606         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9607         Implement.  
9608
9609         Made the ArrayAccess implement interface IAssignMethod instead of
9610         IStackStore as the order in which arguments are passed reflects
9611         this.
9612
9613         * assign.cs: Instead of using expr.ExprClass to select the way of
9614         assinging, probe for the IStackStore/IAssignMethod interfaces.
9615
9616         * typemanager.cs: Load InitializeArray definition.
9617
9618         * rootcontext.cs (RootContext.MakeStaticData): Used to define
9619         static data that can be used to initialize arrays. 
9620
9621 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
9622
9623         * expression.cs: Handle operator== and operator!= for booleans.
9624
9625         (Conditioal.Reduce): Implement reducer for the ?: operator.
9626
9627         (Conditional.Resolve): Implement dead code elimination.
9628
9629         (Binary.Resolve): Catch string literals and return a new
9630         concatenated string.
9631
9632         (Unary.Reduce): Implement reduction of unary expressions.
9633
9634         * ecore.cs: Split out the expression core handling here.
9635
9636         (Expression.Reduce): New method used to perform constant folding
9637         and CSE.  This is needed to support constant-expressions. 
9638         
9639         * statement.cs (Statement.EmitBoolExpression): Pass true and false
9640         targets, and optimize for !x.
9641
9642 2001-11-04  Ravi Pratap  <ravi@ximian.com>
9643
9644         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9645         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9646         set custom atttributes.
9647
9648         * literal.cs (Literal::GetValue): New abstract method to return the actual
9649         value of the literal, cast as an object.
9650
9651         (*Literal): Implement GetValue method.
9652
9653         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9654         expressions to the arraylist but objects of type Argument.
9655
9656         * class.cs (TypeContainer::Emit): Emit our attributes too.
9657
9658         (Method::Emit, Constructor::Emit): Ditto.
9659
9660         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9661         to be ignoring earlier.
9662
9663 2001-11-03  Ravi Pratap  <ravi@ximian.com>
9664
9665         * attribute.cs (AttributeSection::Define): Implement to do the business
9666         of constructing a CustomAttributeBuilder.
9667
9668         (Attribute): New trivial class. Increases readability of code.  
9669
9670         * cs-parser.jay : Update accordingly.
9671
9672         (positional_argument_list, named_argument_list, named_argument): New rules
9673
9674         (attribute_arguments): Use the above so that we are more correct.
9675         
9676 2001-11-02  Ravi Pratap  <ravi@ximian.com>
9677         
9678         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9679         to perform all checks for a method with a params parameter.
9680
9681         (Invocation::OverloadResolve): Update to use the above method and therefore
9682         cope correctly with params method invocations.
9683
9684         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
9685         params too.
9686
9687         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9688         constructors in our parent too because we can't afford to miss out on 
9689         protected ones ;-)
9690
9691         * attribute.cs (AttributeSection): New name for the class Attribute
9692
9693         Other trivial changes to improve readability.
9694
9695         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
9696         use the new class names.
9697         
9698 2001-11-01  Ravi Pratap  <ravi@ximian.com>
9699
9700         * class.cs (Method::Define): Complete definition for params types too
9701
9702         (Indexer::Define): Ditto.
9703
9704         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
9705         Cope everywhere with a request for info about the array parameter.
9706
9707 2001-11-01  Ravi Pratap  <ravi@ximian.com>
9708
9709         * tree.cs (RecordNamespace): Fix up to check for the correct key.
9710
9711         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
9712         local_variable_type to extract the string corresponding to the type.
9713
9714         (local_variable_type): Fixup the action to use the new helper method.
9715
9716         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
9717         go.
9718
9719         * expression.cs : Clean out code which uses the above.
9720
9721 2001-10-31  Ravi Pratap  <ravi@ximian.com>
9722         
9723         * typemanager.cs (RegisterMethod): Check if we already have an existing key
9724         and bale out if necessary by returning a false.
9725
9726         (RegisterProperty): Ditto.
9727
9728         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
9729         and print out appropriate error messages.
9730
9731         * interface.cs (everywhere): Ditto.
9732
9733         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
9734         location to constructor.
9735
9736         * class.cs (Property, Event, Indexer): Update accordingly.
9737
9738         * ../errors/cs111.cs : Added.
9739
9740         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
9741         of a method, as laid down by the spec.
9742
9743         (Invocation::OverloadResolve): Use the above method.
9744
9745 2001-10-31  Ravi Pratap  <ravi@ximian.com>
9746
9747         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
9748         now take a TypeContainer and a Parameters object.
9749
9750         (ParameterData): Modify return type of ParameterModifier method to be 
9751         Parameter.Modifier and not a string.
9752
9753         (ReflectionParameters, InternalParameters): Update accordingly.
9754
9755         * expression.cs (Argument::GetParameterModifier): Same here.
9756
9757         * support.cs (InternalParameters::ParameterType): Find a better way of determining
9758         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
9759         symbol in it at all so maybe this is only for now.
9760
9761 2001-10-30  Ravi Pratap  <ravi@ximian.com>
9762
9763         * support.cs (InternalParameters): Constructor now takes an extra argument 
9764         which is the actual Parameters class.
9765
9766         (ParameterDesc): Update to provide info on ref/out modifiers.
9767
9768         * class.cs (everywhere): Update call to InternalParameters to pass in
9769         the second argument too.
9770
9771         * support.cs (ParameterData): Add ParameterModifier, which is a method 
9772         to return the modifier info [ref/out etc]
9773
9774         (InternalParameters, ReflectionParameters): Implement the above.
9775
9776         * expression.cs (Argument::ParameterModifier): Similar function to return
9777         info about the argument's modifiers.
9778
9779         (Invocation::OverloadResolve): Update to take into account matching modifiers 
9780         too.
9781
9782         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9783         a new SetFormalParameters object which we pass to InternalParameters.
9784
9785 2001-10-30  Ravi Pratap  <ravi@ximian.com>
9786
9787         * expression.cs (NewArray): Merge into the ArrayCreation class.
9788
9789 2001-10-29  Ravi Pratap  <ravi@ximian.com>
9790
9791         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
9792         NewUserdefinedArray into one as there wasn't much of a use in having
9793         two separate ones.
9794
9795         * expression.cs (Argument): Change field's name to ArgType from Type.
9796
9797         (Type): New readonly property which returns the proper type, taking into 
9798         account ref/out modifiers.
9799
9800         (everywhere): Adjust code accordingly for the above.
9801
9802         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9803         whether we are emitting for a ref or out parameter.
9804
9805         * expression.cs (Argument::Emit): Use the above field to set the state.
9806
9807         (LocalVariableReference::Emit): Update to honour the flag and emit the
9808         right stuff.
9809
9810         * parameter.cs (Attributes): Set the correct flags for ref parameters.
9811
9812         * expression.cs (Argument::FullDesc): New function to provide a full desc.
9813
9814         * support.cs (ParameterData): Add method ParameterDesc to the interface.
9815
9816         (ReflectionParameters, InternalParameters): Implement the above method.
9817
9818         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
9819         reporting errors.
9820
9821         (Invocation::FullMethodDesc): Ditto. 
9822
9823 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
9824
9825         * cs-parser.jay: Add extra production for the second form of array
9826         creation. 
9827
9828         * expression.cs (ArrayCreation): Update to reflect the above
9829         change. 
9830
9831         * Small changes to prepare for Array initialization.
9832
9833 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
9834
9835         * typemanager.cs (ImplementsInterface): interface might be null;
9836         Deal with this problem;
9837
9838         Also, we do store negative hits on the cache (null values), so use
9839         this instead of calling t.GetInterfaces on the type everytime.
9840
9841 2001-10-28  Ravi Pratap  <ravi@ximian.com>
9842
9843         * typemanager.cs (IsBuiltinType): New method to help determine the same.
9844
9845         * expression.cs (New::DoResolve): Get rid of array creation code and instead
9846         split functionality out into different classes.
9847
9848         (New::FormArrayType): Move into NewBuiltinArray.
9849
9850         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
9851         quite useless.
9852
9853         (NewBuiltinArray): New class to handle creation of built-in arrays.
9854
9855         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
9856         account creation of one-dimensional arrays.
9857
9858         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
9859
9860         (NewUserdefinedArray::DoResolve): Implement.
9861
9862         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
9863
9864         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
9865         we maintain inside the TypeManager. This is necessary to perform lookups on the
9866         module builder.
9867
9868         (LookupType): Update to perform GetType on the module builders too.     
9869
9870         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
9871
9872         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
9873
9874 2001-10-23  Ravi Pratap  <ravi@ximian.com>
9875
9876         * expression.cs (New::DoResolve): Implement guts of array creation.
9877
9878         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
9879         
9880 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
9881
9882         * expression.cs: Fix bug I introduced lsat night that broke
9883         Delegates. 
9884
9885         (Expression.Resolve): Report a 246 error (can not resolve name)
9886         if we find a SimpleName in the stream.
9887         
9888         (Expression.ResolveLValue): Ditto.
9889         
9890         (Expression.ResolveWithSimpleName): This function is a variant of
9891         ResolveName, this one allows SimpleNames to be returned without a
9892         warning.  The only consumer of SimpleNames is MemberAccess
9893
9894 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
9895
9896         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
9897         might arrive here.  I have my doubts that this is correct.
9898
9899         * statement.cs (Lock): Implement lock statement.
9900
9901         * cs-parser.jay: Small fixes to support `lock' and `using'
9902
9903         * cs-tokenizer.cs: Remove extra space
9904
9905         * driver.cs: New flag --checked, allows to turn on integer math
9906         checking. 
9907
9908         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
9909         Threading.Monitor.Exit 
9910         
9911 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
9912
9913         * expression.cs (IndexerAccess::DoResolveLValue): Set the
9914         Expression Class to be IndexerAccess.
9915
9916         Notice that Indexer::DoResolve sets the eclass to Value.
9917
9918 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
9919
9920         * class.cs (TypeContainer::Emit): Emit code for indexers.
9921
9922         * assign.cs (IAssignMethod): New interface implemented by Indexers
9923         and Properties for handling assignment.
9924
9925         (Assign::Emit): Simplify and reuse code. 
9926         
9927         * expression.cs (IndexerAccess, PropertyExpr): Implement
9928         IAssignMethod, clean up old code. 
9929
9930 2001-10-22  Ravi Pratap  <ravi@ximian.com>
9931
9932         * typemanager.cs (ImplementsInterface): New method to determine if a type
9933         implements a given interface. Provides a nice cache too.
9934
9935         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
9936         method.
9937
9938         (ConvertReferenceExplicit): Ditto.
9939
9940         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
9941         various methods, with correct names etc.
9942
9943         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
9944         Operator.UnaryNegation.
9945
9946         * cs-parser.jay (operator_declarator): Be a little clever in the case where
9947         we have a unary plus or minus operator.
9948
9949         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
9950         UnaryMinus.
9951
9952         * everywhere : update accordingly.
9953
9954         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
9955         respectively.
9956
9957         * class.cs (Method::Define): For the case where we are implementing a method
9958         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
9959         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
9960         
9961 2001-10-21  Ravi Pratap  <ravi@ximian.com>
9962
9963         * interface.cs (FindMembers): Implement to work around S.R.E
9964         lameness.
9965
9966         * typemanager.cs (IsInterfaceType): Implement.
9967
9968         (FindMembers): Update to handle interface types too.
9969
9970         * expression.cs (ImplicitReferenceConversion): Re-write bits which
9971         use IsAssignableFrom as that is not correct - it doesn't work.
9972
9973         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9974         and accordingly override EmitStatement.
9975
9976         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9977         using the correct logic :-)
9978
9979 2001-10-19  Ravi Pratap  <ravi@ximian.com>
9980
9981         * ../errors/cs-11.cs : Add to demonstrate error -11 
9982
9983 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
9984
9985         * assign.cs (Assign::Resolve): Resolve right hand side first, and
9986         then pass this as a hint to ResolveLValue.
9987         
9988         * expression.cs (FieldExpr): Add Location information
9989
9990         (FieldExpr::LValueResolve): Report assignment to readonly
9991         variable. 
9992         
9993         (Expression::ExprClassFromMemberInfo): Pass location information.
9994
9995         (Expression::ResolveLValue): Add new method that resolves an
9996         LValue. 
9997
9998         (Expression::DoResolveLValue): Default invocation calls
9999         DoResolve. 
10000
10001         (Indexers): New class used to keep track of indexers in a given
10002         Type. 
10003
10004         (IStackStore): Renamed from LValue, as it did not really describe
10005         what this did.  Also ResolveLValue is gone from this interface and
10006         now is part of Expression.
10007
10008         (ElementAccess): Depending on the element access type
10009         
10010         * typemanager.cs: Add `indexer_name_type' as a Core type
10011         (System.Runtime.CompilerServices.IndexerNameAttribute)
10012
10013         * statement.cs (Goto): Take a location.
10014         
10015 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10016
10017         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10018         if two delegates are compatible.
10019
10020         (NewDelegate::DoResolve): Update to take care of the case when
10021         we instantiate a delegate from another delegate.
10022
10023         * typemanager.cs (FindMembers): Don't even try to look up members
10024         of Delegate types for now.
10025
10026 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10027
10028         * delegate.cs (NewDelegate): New class to take care of delegate
10029         instantiation.
10030
10031         * expression.cs (New): Split the delegate related code out into 
10032         the NewDelegate class.
10033
10034         * delegate.cs (DelegateInvocation): New class to handle delegate 
10035         invocation.
10036
10037         * expression.cs (Invocation): Split out delegate related code into
10038         the DelegateInvocation class.
10039
10040 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10041
10042         * expression.cs (New::DoResolve): Implement delegate creation fully
10043         and according to the spec.
10044
10045         (New::DoEmit): Update to handle delegates differently.
10046
10047         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10048         because of which we were printing out arguments in reverse order !
10049
10050         * delegate.cs (VerifyMethod): Implement to check if the given method
10051         matches the delegate.
10052
10053         (FullDelegateDesc): Implement.
10054
10055         (VerifyApplicability): Implement.
10056
10057         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10058         delegate invocations too.
10059
10060         (Invocation::Emit): Ditto.
10061
10062         * ../errors/cs1593.cs : Added.
10063
10064         * ../errors/cs1594.cs : Added.
10065
10066         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10067
10068 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10069
10070         * typemanager.cs (intptr_type): Core type for System.IntPtr
10071
10072         (InitCoreTypes): Update for the same.
10073
10074         (iasyncresult_type, asynccallback_type): Ditto.
10075
10076         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10077         correct.
10078
10079         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10080         too.
10081
10082         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10083         the builders for the 4 members of a delegate type :-)
10084
10085         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10086         type.
10087
10088         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10089
10090         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10091
10092 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10093
10094         * statement.cs (Break::Emit): Implement.   
10095         (Continue::Emit): Implement.
10096
10097         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10098         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10099         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10100         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10101         end loop
10102         
10103         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10104         properties that track the label for the current loop (begin of the
10105         loop and end of the loop).
10106
10107 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10108
10109         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10110         use of emitting anything at all.
10111
10112         * class.cs, rootcontext.cs : Get rid of calls to the same.
10113
10114         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10115
10116         (Populate): Define the constructor correctly and set the implementation
10117         attributes.
10118
10119         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10120         have been defined.
10121
10122         (AddDelegateType): Implement.
10123
10124         (IsDelegateType): Implement helper method.
10125
10126         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10127
10128         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10129         and accordingly handle it.
10130
10131         * delegate.cs (Populate): Take TypeContainer argument.
10132         Implement bits to define the Invoke method. However, I still haven't figured out
10133         how to take care of the native int bit :-(
10134
10135         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10136         Qualify the name of the delegate, not its return type !
10137
10138         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10139         conversion.
10140
10141         (StandardConversionExists): Checking for array types turns out to be recursive.
10142
10143         (ConvertReferenceExplicit): Implement array conversion.
10144
10145         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10146         
10147 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10148
10149         * cs-parser.jay (delegate_declaration): Store the fully qualified
10150         name as it is a type declaration.
10151
10152         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10153         readonly.
10154
10155         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10156         as TypeContainer::DefineType.
10157
10158         (Populate): Method in which all the definition of the various methods (Invoke)
10159         etc is done.
10160
10161         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10162         see.
10163         
10164         (CloseDelegate): Finally creates the delegate.
10165
10166         * class.cs (TypeContainer::DefineType): Update to define delegates.
10167         (Populate, Emit and CloseType): Do the same thing here too.
10168
10169         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10170         delegates in all these operations.
10171
10172 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10173
10174         * expression.cs: LocalTemporary: a new expression used to
10175         reference a temporary that has been created.
10176
10177         * assign.cs: Handle PropertyAccess back here, so that we can
10178         provide the proper semantic access to properties.
10179
10180         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10181         a few more explicit conversions. 
10182
10183         * modifiers.cs: `NEW' modifier maps to HideBySig.
10184
10185         * expression.cs (PropertyExpr): Make this into an
10186         ExpressionStatement, and support the EmitStatement code path. 
10187
10188         Perform get/set error checking, clean up the interface.
10189
10190         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10191         them into toplevel access objects.
10192
10193 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10194
10195         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10196         SRE.
10197
10198         * typemanager.cs: Keep track here of our PropertyBuilders again to
10199         work around lameness in SRE.
10200
10201 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10202
10203         * expression.cs (LValue::LValueResolve): New method in the
10204         interface, used to perform a second resolution pass for LValues. 
10205         
10206         (This::DoResolve): Catch the use of this in static methods.
10207
10208         (This::LValueResolve): Implement.
10209
10210         (This::Store): Remove warning, assigning to `this' in structures
10211         is 
10212
10213         (Invocation::Emit): Deal with invocation of
10214         methods on value types.  We need to pass the address to structure
10215         methods rather than the object itself.  (The equivalent code to
10216         emit "this" for structures leaves the entire structure on the
10217         stack instead of a pointer to it). 
10218
10219         (ParameterReference::DoResolve): Compute the real index for the
10220         argument based on whether the method takes or not a `this' pointer
10221         (ie, the method is static).
10222
10223         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10224         value types returned from functions when we need to invoke a
10225         method on the sturcture.
10226         
10227
10228 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10229
10230         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10231         defining the type in the Modulebuilder or Typebuilder. This is to take
10232         care of nested types which need to be defined on the TypeBuilder using
10233         DefineNestedMethod.
10234
10235         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10236         methods in RootContext, only ported to be part of TypeContainer.
10237
10238         (TypeContainer::GetInterfaceOrClass): Ditto.
10239
10240         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10241
10242         * interface.cs (Interface::DefineInterface): New method. Does exactly
10243         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10244         too.
10245
10246         (Interface::GetInterfaces): Move from RootContext here and port.
10247
10248         (Interface::GetInterfaceByName): Same here.
10249
10250         * rootcontext.cs (ResolveTree): Re-write.
10251
10252         (PopulateTypes): Re-write.
10253
10254         * class.cs (TypeContainer::Populate): Populate nested types too.
10255         (TypeContainer::Emit): Emit nested members too.
10256
10257         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10258         instead just use the name argument passed in as it is already fully
10259         qualified.
10260
10261         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10262         to TypeContainer mapping to see if a type is user-defined.
10263
10264         * class.cs (TypeContainer::CloseType): Implement. 
10265
10266         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10267         the default constructor.
10268         
10269         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10270         twice.
10271
10272         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10273
10274         * interface.cs (CloseType): Create the type here.
10275         
10276         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10277         the hierarchy.
10278
10279         Remove all the methods which are now in TypeContainer.
10280
10281 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10282
10283         * delegate.cs (Define): Re-write bits to define the delegate
10284         correctly.
10285
10286 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10287
10288         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10289
10290         * expression.cs (ImplicitReferenceConversion): handle null as well
10291         as a source to convert to any reference type.
10292
10293         * statement.cs (Return): Perform any implicit conversions to
10294         expected return type.  
10295
10296         Validate use of return statement.  
10297
10298         * codegen.cs (EmitContext): Pass the expected return type here.
10299
10300         * class.cs (Method, Constructor, Property): Pass expected return
10301         type to EmitContext.
10302
10303 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10304
10305         * expression.cs: Make DoResolve take an EmitContext instead of a
10306         TypeContainer.
10307
10308         Replaced `l' and `location' for `loc', for consistency.
10309         
10310         (Error, Warning): Remove unneeded Tc argument.
10311
10312         * assign.cs, literal.cs, constant.cs: Update to new calling
10313         convention. 
10314         
10315         * codegen.cs: EmitContext now contains a flag indicating whether
10316         code is being generated in a static method or not.
10317
10318         * cs-parser.jay: DecomposeQI, new function that replaces the old
10319         QualifiedIdentifier.  Now we always decompose the assembled
10320         strings from qualified_identifier productions into a group of
10321         memberaccesses.
10322
10323 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10324
10325         * rootcontext.cs: Deal with field-less struct types correctly now
10326         by passing the size option to Define Type.
10327
10328         * class.cs: Removed hack that created one static field. 
10329
10330 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10331
10332         * statement.cs: Moved most of the code generation here. 
10333
10334 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10335
10336         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10337         seem very right.
10338
10339         (ElementAccess): Remove useless bits for now - keep checks as the spec
10340         says.
10341
10342 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10343
10344         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10345         and start performing checks according to the spec.
10346
10347 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10348
10349         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10350         rank_specifiers instead.
10351
10352         (rank_specifiers): Change the order in which the rank specifiers are stored
10353
10354         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10355
10356         * expression.cs (ElementAccess): Implement the LValue interface too.
10357         
10358 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10359         
10360         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10361         except that user defined conversions are not included.
10362
10363         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10364         perform the conversion of the return type, if necessary.
10365
10366         (New::DoResolve): Check whether we are creating an array or an object
10367         and accordingly do the needful.
10368
10369         (New::Emit): Same here.
10370
10371         (New::DoResolve): Implement guts of array creation.
10372
10373         (New::FormLookupType): Helper function.
10374
10375 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10376
10377         * codegen.cs: Removed most of the code generation here, and move the
10378         corresponding code generation bits to the statement classes. 
10379
10380         Added support for try/catch/finalize and throw.
10381         
10382         * cs-parser.jay: Added support for try/catch/finalize.
10383
10384         * class.cs: Catch static methods having the flags override,
10385         virtual or abstract.
10386
10387         * expression.cs (UserCast): This user cast was not really doing
10388         what it was supposed to do.  Which is to be born in fully resolved
10389         state.  Parts of the resolution were being performed at Emit time! 
10390
10391         Fixed this code.
10392
10393 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10394
10395         * expression.cs: Implicity convert the result from UserCast.
10396
10397 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10398
10399         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10400         prevented it from working correctly. 
10401
10402         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10403         merely ConvertImplicit.
10404
10405 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10406
10407         * typemanager.cs: Make the LookupTypeContainer function static,
10408         and not per-instance.  
10409
10410         * class.cs: Make static FindMembers (the one that takes a Type
10411         argument). 
10412
10413         * codegen.cs: Add EmitForeach here.
10414
10415         * cs-parser.jay: Make foreach a toplevel object instead of the
10416         inline expansion, as we need to perform semantic analysis on it. 
10417
10418 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10419
10420         * expression.cs (Expression::ImplicitUserConversion): Rename to
10421         UserDefinedConversion.
10422
10423         (Expression::UserDefinedConversion): Take an extra argument specifying 
10424         whether we look for explicit user conversions too.
10425
10426         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10427
10428         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10429
10430         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10431         with the appropriate arguments.
10432
10433         * cs-parser.jay (cast_expression): Record location too.
10434
10435         * expression.cs (Cast): Record location info.
10436
10437         (Expression::ConvertExplicit): Take location argument.
10438
10439         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10440         to determine if we are doing explicit conversions.
10441
10442         (UserCast::Emit): Update accordingly.
10443
10444         (Expression::ConvertExplicit): Report an error if everything fails.
10445
10446         * ../errors/cs0030.cs : Add.
10447
10448 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10449
10450         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10451         virtual and newslot bits. 
10452
10453         * class.cs (TypeContainer::RegisterRequiredImplementations):
10454         Record methods we need.
10455
10456         (TypeContainer::MakeKey): Helper function to make keys for
10457         MethodBases, since the Methodbase key is useless.
10458
10459         (TypeContainer::Populate): Call RegisterRequiredImplementations
10460         before defining the methods.   
10461
10462         Create a mapping for method_builders_to_methods ahead of time
10463         instead of inside a tight loop.
10464
10465         (::RequireMethods):  Accept an object as the data to set into the
10466         hashtable so we can report interface vs abstract method mismatch.
10467
10468 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10469
10470         * report.cs: Make all of it static.
10471
10472         * rootcontext.cs: Drop object_type and value_type computations, as
10473         we have those in the TypeManager anyways.
10474
10475         Drop report instance variable too, now it is a global.
10476
10477         * driver.cs: Use try/catch on command line handling.
10478
10479         Add --probe option to debug the error reporting system with a test
10480         suite. 
10481
10482         * report.cs: Add support for exiting program when a probe
10483         condition is reached.
10484
10485 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10486
10487         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10488         we do a forcible conversion regardless of type, to check if 
10489         ForceConversion returns a null.
10490
10491         (Binary::error19): Use location to report error.
10492
10493         (Unary::error23): Use location here too.
10494
10495         * ../errors/cs0019.cs : Check in.
10496
10497         * ../errors/cs0023.cs : Check in.
10498
10499         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10500         case of a non-null MethodInfo object with a length of 0 !
10501
10502         (Binary::ResolveOperator): Flag error if overload resolution fails to find
10503         an applicable member - according to the spec :-)
10504         Also fix logic to find members in base types.
10505
10506         (Unary::ResolveOperator): Same here.
10507
10508         (Unary::report23): Change name to error23 and make first argument a TypeContainer
10509         as I was getting thoroughly confused between this and error19 :-)
10510         
10511         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10512         (::FindMostEncompassedType): Implement.
10513         (::FindMostEncompassingType): Implement.
10514         (::StandardConversionExists): Implement.
10515
10516         (UserImplicitCast): Re-vamp. We now need info about most specific
10517         source and target types so that we can do the necessary conversions.
10518
10519         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10520         mathematical union with no duplicates.
10521
10522 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10523
10524         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10525         in order from base classes to child classes, so that we can in
10526         child classes look up in our parent for method names and
10527         attributes (required for handling abstract, virtual, new, override
10528         constructs: we need to instrospect our base class, and if we dont
10529         populate the classes in order, the introspection might be
10530         incorrect.  For example, a method could query its parent before
10531         the parent has any methods and would determine that the parent has
10532         no abstract methods (while it could have had them)).
10533
10534         (RootContext::CreateType): Record the order in which we define the
10535         classes.
10536
10537 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
10538
10539         * class.cs (TypeContainer::Populate): Also method definitions can
10540         fail now, keep track of this.
10541
10542         (TypeContainer::FindMembers): Implement support for
10543         DeclaredOnly/noDeclaredOnly flag.
10544
10545         (Constructor::Emit) Return the ConstructorBuilder.
10546
10547         (Method::Emit) Return the MethodBuilder. 
10548         Check for abstract or virtual methods to be public.
10549
10550         * rootcontext.cs (RootContext::CreateType): Register all the
10551         abstract methods required for the class to be complete and the
10552         interface methods that must be implemented. 
10553
10554         * cs-parser.jay: Report error 501 (method requires body if it is
10555         not marked abstract or extern).
10556
10557         * expression.cs (TypeOf::Emit): Implement.
10558
10559         * typemanager.cs: runtime_handle_type, new global type.
10560
10561         * class.cs (Property::Emit): Generate code for properties.
10562
10563 2001-10-02  Ravi Pratap  <ravi@ximian.com>
10564
10565         * expression.cs (Unary::ResolveOperator): Find operators on base type
10566         too - we now conform exactly to the spec.
10567
10568         (Binary::ResolveOperator): Same here.
10569
10570         * class.cs (Operator::Define): Fix minor quirk in the tests.
10571
10572         * ../errors/cs0215.cs : Added.
10573
10574         * ../errors/cs0556.cs : Added.
10575
10576         * ../errors/cs0555.cs : Added.
10577
10578 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10579
10580         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10581         single integer which is really efficient
10582
10583 2001-10-01  Ravi Pratap  <ravi@ximian.com>
10584
10585         *  expression.cs (Expression::ImplicitUserConversion): Use location
10586         even in the case when we are examining True operators.
10587  
10588         * class.cs (Operator::Define): Perform extensive checks to conform
10589         with the rules for operator overloading in the spec.
10590
10591         * expression.cs (Expression::ImplicitReferenceConversion): Implement
10592         some of the other conversions mentioned in the spec.
10593
10594         * typemanager.cs (array_type): New static member for the System.Array built-in
10595         type.
10596
10597         (cloneable_interface): For System.ICloneable interface.
10598
10599         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10600         we start resolving the tree and populating types.
10601
10602         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10603  
10604 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10605
10606         * expression.cs (Expression::ExprClassFromMemberInfo,
10607         Expression::Literalize): Create literal expressions from
10608         FieldInfos which are literals.
10609
10610         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10611         type casts, because they were wrong.  The test suite in tests
10612         caught these ones.
10613
10614         (ImplicitNumericConversion): ushort to ulong requires a widening
10615         cast. 
10616
10617         Int32 constant to long requires widening cast as well.
10618
10619         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10620         for integers because the type on the stack is not i4.
10621
10622 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
10623
10624         * expression.cs (report118): require location argument. 
10625
10626         * parameter.cs: Do not dereference potential null value.
10627
10628         * class.cs: Catch methods that lack the `new' keyword when
10629         overriding a name.  Report warnings when `new' is used without
10630         anything being there to override.
10631
10632         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10633
10634         * class.cs: Only add constructor to hashtable if it is non-null
10635         (as now constructors can fail on define).
10636
10637         (TypeManager, Class, Struct): Take location arguments.
10638
10639         Catch field instance initialization in structs as errors.
10640
10641         accepting_filter: a new filter for FindMembers that is static so
10642         that we dont create an instance per invocation.
10643
10644         (Constructor::Define): Catch errors where a struct constructor is
10645         parameterless 
10646
10647         * cs-parser.jay: Pass location information for various new
10648         constructs. 
10649         
10650         * delegate.cs (Delegate): take a location argument.
10651
10652         * driver.cs: Do not call EmitCode if there were problesm in the
10653         Definition of the types, as many Builders wont be there. 
10654
10655         * decl.cs (Decl::Decl): Require a location argument.
10656
10657         * cs-tokenizer.cs: Handle properly hex constants that can not fit
10658         into integers, and find the most appropiate integer for it.
10659
10660         * literal.cs: Implement ULongLiteral.
10661
10662         * rootcontext.cs: Provide better information about the location of
10663         failure when CreateType fails.
10664         
10665 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
10666
10667         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10668         as well.
10669
10670         * expression.cs (Binary::CheckShiftArguments): Add missing type
10671         computation.
10672         (Binary::ResolveOperator): Add type to the logical and and logical
10673         or, Bitwise And/Or and Exclusive Or code paths, it was missing
10674         before.
10675
10676         (Binary::DoNumericPromotions): In the case where either argument
10677         is ulong (and most signed types combined with ulong cause an
10678         error) perform implicit integer constant conversions as well.
10679
10680 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
10681
10682         * expression.cs (UserImplicitCast): Method should always be
10683         non-null. 
10684         (Invocation::BetterConversion): Simplified test for IntLiteral.
10685
10686         (Expression::ImplicitNumericConversion): Split this routine out.
10687         Put the code that performs implicit constant integer conversions
10688         here. 
10689
10690         (Expression::Resolve): Become a wrapper around DoResolve so we can
10691         check eclass and type being set after resolve.
10692
10693         (Invocation::Badness): Remove this dead function
10694
10695         (Binary::ResolveOperator): Do not compute the expensive argumnets
10696         unless we have a union for it.
10697
10698         (Probe::Emit): Is needs to do an isinst and then
10699         compare against null.
10700
10701         (::CanConvert): Added Location argument.  If the Location argument
10702         is null (Location.Null), then we do not report errors.  This is
10703         used by the `probe' mechanism of the Explicit conversion.  We do
10704         not want to generate an error for something that the user
10705         explicitly requested to be casted.  But the pipeline for an
10706         explicit cast first tests for potential implicit casts.
10707
10708         So for now, if the Location is null, it means `Probe only' to
10709         avoid adding another argument.   Might have to revise this
10710         strategy later.
10711
10712         (ClassCast): New class used to type cast objects into arbitrary
10713         classes (used in Explicit Reference Conversions).
10714
10715         Implement `as' as well.
10716
10717         Reverted all the patches from Ravi below: they were broken:
10718
10719                 * The use of `level' as a mechanism to stop recursive
10720                   invocations is wrong.  That was there just to catch the
10721                   bug with a strack trace but not as a way of addressing
10722                   the problem.
10723
10724                   To fix the problem we have to *understand* what is going
10725                   on and the interactions and come up with a plan, not
10726                   just get things going.
10727
10728                 * The use of the type conversion cache that I proposed
10729                   last night had an open topic: How does this work across
10730                   protection domains.  A user defined conversion might not
10731                   be public in the location where we are applying the
10732                   conversion, a different conversion might be selected
10733                   (ie, private A->B (better) but public B->A (worse),
10734                   inside A, A->B applies, but outside it, B->A will
10735                   apply).
10736
10737                 * On top of that (ie, even if the above is solved),
10738                   conversions in a cache need to be abstract.  Ie, `To
10739                   convert from an Int to a Short use an OpcodeCast', not
10740                   `To convert from an Int to a Short use the OpcodeCast on
10741                   the variable 5' (which is what this patch was doing).
10742         
10743 2001-09-28  Ravi Pratap  <ravi@ximian.com>
10744
10745         * expression.cs (Invocation::ConversionExists): Re-write to use
10746         the conversion cache
10747         
10748         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
10749         cache all conversions done, not just user-defined ones.
10750
10751         (Invocation::BetterConversion): The real culprit. Use ConversionExists
10752         to determine if a conversion exists instead of acutually trying to 
10753         perform the conversion. It's faster too.
10754
10755         (Expression::ConvertExplicit): Modify to use ConversionExists to check
10756         and only then attempt the implicit conversion.
10757
10758 2001-09-28  Ravi Pratap  <ravi@ximian.com>
10759
10760         * expression.cs (ConvertImplicit): Use a cache for conversions
10761         already found. Check level of recursion and bail out if necessary.
10762         
10763 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
10764
10765         * typemanager.cs (string_concat_string_string, string_concat_object_object):
10766         Export standard methods that we expect for string operations.
10767         
10768         * statement.cs (Block::UsageWarning): Track usage of variables and
10769         report the errors for not used variables.
10770
10771         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
10772         operator. 
10773
10774 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10775
10776         * codegen.cs: remove unnneded code 
10777
10778         * expression.cs: Removed BuiltinTypeAccess class
10779
10780         Fix the order in which implicit conversions are
10781         done.  
10782
10783         The previous fixed dropped support for boxed conversions (adding a
10784         test to the test suite now)
10785
10786         (UserImplicitCast::CanConvert): Remove test for source being null,
10787         that code is broken.  We should not feed a null to begin with, if
10788         we do, then we should track the bug where the problem originates
10789         and not try to cover it up here.
10790
10791         Return a resolved expression of type UserImplicitCast on success
10792         rather than true/false.  Ravi: this is what I was talking about,
10793         the pattern is to use a static method as a "constructor" for
10794         objects. 
10795
10796         Also, do not create arguments until the very last minute,
10797         otherwise we always create the arguments even for lookups that
10798         will never be performed. 
10799
10800         (UserImplicitCast::Resolve): Eliminate, objects of type
10801         UserImplicitCast are born in a fully resolved state. 
10802         
10803         * typemanager.cs (InitCoreTypes): Init also value_type
10804         (System.ValueType). 
10805
10806         * expression.cs (Cast::Resolve): First resolve the child expression.
10807
10808         (LValue): Add new method AddressOf to be used by
10809         the `&' operator.  
10810
10811         Change the argument of Store to take an EmitContext instead of an
10812         ILGenerator, because things like FieldExpr need to be able to call
10813         their children expression to generate the instance code. 
10814
10815         (Expression::Error, Expression::Warning): Sugar functions for
10816         reporting errors.
10817
10818         (Expression::MemberLookup): Accept a TypeContainer instead of a
10819         Report as the first argument.
10820
10821         (Expression::ResolvePrimary): Killed.  I still want to improve
10822         this as currently the code is just not right.
10823
10824         (Expression::ResolveMemberAccess): Simplify, but it is still
10825         wrong. 
10826
10827         (Unary::Resolve): Catch errors in AddressOf operators.
10828
10829         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
10830         index to a byte for the short-version, or the compiler will choose
10831         the wrong Emit call, which generates the wrong data.
10832
10833         (ParameterReference::Emit, ::Store): same.
10834
10835         (FieldExpr::AddressOf): Implement.
10836         
10837         * typemanager.cs: TypeManager: made public variable instead of
10838         property.
10839         
10840         * driver.cs: document --fatal.
10841
10842         * report.cs (ErrorMessage, WarningMessage): new names for the old
10843         Error and Warning classes.
10844
10845         * cs-parser.jay (member_access): Turn built-in access to types
10846         into a normal simplename
10847
10848 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10849
10850         * expression.cs (Invocation::BetterConversion): Fix to cope
10851         with q being null, since this was introducing a bug.
10852
10853         * expression.cs (ConvertImplicit): Do built-in conversions first.
10854
10855 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10856
10857         * expression.cs (UserImplicitCast::Resolve): Fix bug.
10858
10859 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10860
10861         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
10862         I had introduced long ago (what's new ?).
10863
10864         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
10865         the work of all the checking. 
10866         (ConvertImplicit): Call CanConvert and only then create object if necessary.
10867         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
10868
10869         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
10870         that is the right way. 
10871
10872         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
10873         overloading resolution. Use everywhere instead of cutting and pasting code.
10874
10875         (Binary::ResolveOperator): Use MakeUnionSet.
10876
10877         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
10878         we have to convert to bool types. Not complete yet.
10879         
10880 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10881
10882         * typemanager.cs (TypeManager::CSharpName): support ushort.
10883
10884         * expression.cs (Expression::TryImplicitIntConversion): Attempts
10885         to provide an expression that performsn an implicit constant int
10886         conversion (section 6.1.6).
10887         (Expression::ConvertImplicitRequired): Reworked to include
10888         implicit constant expression conversions.
10889
10890         (Expression::ConvertNumericExplicit): Finished.
10891
10892         (Invocation::Emit): If InstanceExpression is null, then it means
10893         that we perform a call on this.
10894         
10895 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10896
10897         * expression.cs (Unary::Emit): Remove some dead code.
10898         (Probe): Implement Resolve and Emit for `is'.
10899         (Expression::ConvertImplicitRequired): Attempt to do constant
10900         expression conversions here.  Maybe should be moved to
10901         ConvertImplicit, but I am not sure.
10902         (Expression::ImplicitLongConstantConversionPossible,
10903         Expression::ImplicitIntConstantConversionPossible): New functions
10904         that tell whether is it possible to apply an implicit constant
10905         expression conversion.
10906
10907         (ConvertNumericExplicit): Started work on explicit numeric
10908         conversions.
10909
10910         * cs-parser.jay: Update operator constants.
10911
10912         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
10913         (Parameters::GetSignature): Hook up VerifyArgs here.
10914         (Parameters::VerifyArgs): Verifies that no two arguments have the
10915         same name. 
10916
10917         * class.cs (Operator): Update the operator names to reflect the
10918         ones that the spec expects (as we are just stringizing the
10919         operator names).
10920         
10921         * expression.cs (Unary::ResolveOperator): Fix bug: Use
10922         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
10923         previous usage did only work for our methods.
10924         (Expression::ConvertImplicit): Handle decimal implicit numeric
10925         conversions as well.
10926         (Expression::InternalTypeConstructor): Used to invoke constructors
10927         on internal types for default promotions.
10928
10929         (Unary::Emit): Implement special handling for the pre/post
10930         increment/decrement for overloaded operators, as they need to have
10931         the same semantics as the other operators.
10932
10933         (Binary::ResolveOperator): ditto.
10934         (Invocation::ConversionExists): ditto.
10935         (UserImplicitCast::Resolve): ditto.
10936         
10937 2001-09-26  Ravi Pratap  <ravi@ximian.com>
10938
10939         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
10940         operator, return after emitting body. Regression tests pass again !
10941
10942         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
10943         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
10944         (Invocation::OverloadResolve): Ditto.
10945         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
10946
10947         * everywhere : update calls to the above methods accordingly.
10948
10949 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10950
10951         * assign.cs (Assign): Make it inherit from ExpressionStatement.
10952
10953         * expression.cs (ExpressionStatement): New base class used for
10954         expressions that can appear in statements, so that we can provide
10955         an alternate path to generate expression that do not leave a value
10956         on the stack.
10957
10958         (Expression::Emit, and all the derivatives): We no longer return
10959         whether a value is left on the stack or not.  Every expression
10960         after being emitted leaves a single value on the stack.
10961
10962         * codegen.cs (EmitContext::EmitStatementExpression): Use the
10963         facilties of ExpressionStatement if possible.
10964
10965         * cs-parser.jay: Update statement_expression.
10966
10967 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
10968
10969         * driver.cs: Change the wording of message
10970
10971 2001-09-25  Ravi Pratap  <ravi@ximian.com>
10972
10973         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
10974         the type of the expression to the return type of the method if
10975         we have an overloaded operator match ! The regression tests pass again !
10976         (Unary::ResolveOperator): Ditto.
10977
10978         * expression.cs (Invocation::ConversionExists): Correct the member lookup
10979         to find "op_Implicit", not "implicit" ;-)
10980         (UserImplicitCast): New class to take care of user-defined implicit conversions.
10981         (ConvertImplicit, ForceConversion): Take TypeContainer argument
10982
10983         * everywhere : Correct calls to the above accordingly.
10984
10985         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10986         (ConvertImplicit): Do user-defined conversion if it exists.
10987
10988 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
10989
10990         * assign.cs: track location.
10991         (Resolve): Use implicit conversions on assignment.
10992
10993         * literal.cs: Oops.  Not good, Emit of short access values should
10994         pass (Bytes) or the wrong argument will be selected.
10995
10996         * expression.cs (Unary::Emit): Emit code for -expr.
10997         
10998         (Unary::ResolveOperator): Handle `Substract' for non-constants
10999         (substract from zero from the non-constants).
11000         Deal with Doubles as well. 
11001         
11002         (Expression::ConvertImplicitRequired): New routine that reports an
11003         error if no implicit conversion exists. 
11004
11005         (Invocation::OverloadResolve): Store the converted implicit
11006         expressions if we make them
11007         
11008 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11009
11010         * class.cs (ConstructorInitializer): Take a Location argument.
11011         (ConstructorBaseInitializer): Same here.
11012         (ConstructorThisInitializer): Same here.
11013
11014         * cs-parser.jay : Update all calls accordingly.
11015
11016         * expression.cs (Unary, Binary, New): Take location argument.
11017         Update accordingly everywhere.
11018
11019         * cs-parser.jay : Update all calls to the above to take a location
11020         argument.
11021
11022         * class.cs : Ditto.
11023
11024 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11025
11026         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11027         (Invocation::BetterConversion): Same here
11028         (Invocation::ConversionExists): Ditto.
11029
11030         (Invocation::ConversionExists): Implement.
11031
11032 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11033
11034         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11035         Also take an additional TypeContainer argument.
11036
11037         * All over : Pass in TypeContainer as argument to OverloadResolve.
11038
11039         * typemanager.cs (CSharpName): Update to check for the string type and return
11040         that too.
11041
11042         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11043         a given method.
11044         
11045 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11046
11047         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11048         (Invocation::BetterFunction): Implement.
11049         (Invocation::BetterConversion): Implement.
11050         (Invocation::ConversionExists): Skeleton, no implementation yet.
11051
11052         Okay, things work fine !
11053
11054 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11055
11056         * typemanager.cs: declare and load enum_type, delegate_type and
11057         void_type. 
11058
11059         * expression.cs (Expression::Emit): Now emit returns a value that
11060         tells whether a value is left on the stack or not.  This strategy
11061         might be reveted tomorrow with a mechanism that would address
11062         multiple assignments.
11063         (Expression::report118): Utility routine to report mismatches on
11064         the ExprClass.
11065
11066         (Unary::Report23): Report impossible type/operator combination
11067         utility function.
11068
11069         (Unary::IsIncrementableNumber): Whether the type can be
11070         incremented or decremented with add.
11071         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11072         complemented. 
11073         (Unary::ResolveOperator): Implement ++, !, ~,
11074
11075         (Invocation::Emit): Deal with new Emit convetion.
11076         
11077         * All Expression derivatives: Updated their Emit method to return
11078         whether they leave values on the stack or not.
11079         
11080         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11081         stack for expressions that are statements. 
11082
11083 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11084
11085         * expression.cs (LValue): New interface.  Must be implemented by
11086         LValue objects.
11087         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11088         LValue interface.
11089         
11090         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11091         interface for generating code, simplifies the code.
11092
11093 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11094
11095         * expression.cs (everywhere): Comment out return statements in ::Resolve
11096         methods to avoid the warnings.
11097
11098 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11099
11100         * driver.cs (parse): Report error 2001 if we can not open the
11101         source file.
11102
11103         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11104         not resolve it.
11105
11106         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11107         object. 
11108
11109         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11110         otherwise nested blocks end up with the same index.
11111
11112         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11113
11114         * expression.cs:  Instead of having FIXMEs in the Resolve
11115         functions, throw exceptions so it is obvious that we are facing a
11116         bug. 
11117
11118         * cs-parser.jay (invocation_expression): Pass Location information.
11119
11120         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11121         Use a basename for those routines because .NET does not like paths
11122         on them. 
11123
11124         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11125         already defined.
11126
11127 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11128
11129         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11130         are loading the correct data types (throws an exception if not).
11131         (TypeManager::InitCoreTypes): Use CoreLookupType
11132
11133         * expression.cs (Unary::ResolveOperator): return the child
11134         expression for expressions which are just +expr.
11135         (Unary::ResolveOperator): Return negative literals for -LITERAL
11136         expressions (otherwise they are Unary {Literal}).
11137         (Invocation::Badness): Take into account `Implicit constant
11138         expression conversions'.
11139
11140         * literal.cs (LongLiteral): Implement long literal class.
11141         (IntLiteral): export the `Value' of the intliteral. 
11142
11143 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11144
11145         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11146
11147         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11148         instead of 'Operator'
11149
11150         * expression.cs (Binary::ResolveOperator): Update accordingly.
11151         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11152         and 'Minus'
11153
11154         * cs-parser.jay (unary_expression): Update to use the new names.
11155
11156         * gen-treedump.cs (GetUnary): Same here.
11157
11158         * expression.cs (Unary::Resolve): Implement.
11159         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11160         operators are found instead of making noise ;-)
11161         (Unary::ResolveOperator): New method to do precisely the same thing which
11162         Binary::ResolveOperator does for Binary expressions.
11163         (Unary.method, .Arguments): Add.
11164         (Unary::OperName): Implement.   
11165         (Unary::ForceConversion): Copy and Paste !
11166
11167         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11168         a unary operator.
11169
11170         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11171         for the inbuilt operators. Only overloading works for now ;-)
11172
11173 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11174
11175         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11176         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11177
11178         * expression.cs (This::Emit): Implement. 
11179         (This::Resolve): Implement.
11180         (TypeOf:Resolve): Implement.
11181         (Expression::ResolveSimpleName): Add an implicit this to instance
11182         field references. 
11183         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11184         Bind instance variable to Field expressions.
11185         (FieldExpr::Instance): New field used to track the expression that
11186         represents the object instance.
11187         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11188         binding 
11189         (FieldExpr::Emit): Implement.
11190
11191         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11192         the last instruction contains a return opcode to avoid generating
11193         the last `ret' instruction (this generates correct code, and it is
11194         nice to pass the peverify output).
11195
11196         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11197         initializer for static and instance variables.
11198         (Constructor::Emit): Allow initializer to be null in the case of
11199         static constructors.  Only emit initializer for instance
11200         constructors. 
11201
11202         (TypeContainer::FindMembers): Return a null array if there are no
11203         matches.
11204
11205         Also fix the code for the MemberTypes.Method branch, as it was not
11206         scanning that for operators (or tried to access null variables before).
11207
11208         * assign.cs (Assign::Emit): Handle instance and static fields. 
11209
11210         * TODO: Updated.
11211
11212         * driver.cs: Stop compilation if there are parse errors.
11213
11214         * cs-parser.jay (constructor_declaration): Provide default base
11215         initializer for non-static constructors.
11216         (constructor_declarator): Do not provide a default base
11217         initializers if none was specified.
11218         Catch the fact that constructors should not have parameters.
11219
11220         * class.cs: Do not emit parent class initializers for static
11221         constructors, that should be flagged as an error.
11222
11223 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11224
11225         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11226         Move back code into TypeContainer::Populate.
11227
11228 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11229
11230         * class.cs (TypeContainer::AddConstructor): Fix the check to
11231         compare against Name, not Basename. 
11232         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11233
11234         * cs-parser.jay : Update accordingly.
11235
11236         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11237         for methods, don't forget to look into the operators too.
11238         (RegisterMethodBuilder): Helper method to take care of this for
11239         methods, constructors and operators.
11240         (Operator::Define): Completely revamp.
11241         (Operator.OperatorMethod, MethodName): New fields.
11242         (TypeContainer::Populate): Move the registering of builders into
11243         RegisterMethodBuilder.
11244         (Operator::Emit): Re-write.
11245
11246         * expression.cs (Binary::Emit): Comment out code path to emit method
11247         invocation stuff for the case when we have a user defined operator. I am
11248         just not able to get it right !
11249         
11250 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11251
11252         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11253         argument. 
11254
11255         (Expression::MemberLookup): Provide a version that allows to
11256         specify the MemberTypes and BindingFlags. 
11257
11258         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11259         so it was not fetching variable information from outer blocks.
11260
11261         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11262         Beforefieldinit as it was buggy.
11263
11264         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11265         that Ravi put here.  
11266
11267         * class.cs (Constructor::Emit): Only emit if block is not null.
11268         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11269         deal with this by semantically definining it as if the user had
11270         done it.
11271
11272         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11273         constructors as we now "emit" them at a higher level.
11274
11275         (TypeContainer::DefineDefaultConstructor): Used to define the
11276         default constructors if none was provided.
11277
11278         (ConstructorInitializer): Add methods Resolve and Emit. 
11279         
11280         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11281
11282 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11283
11284         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11285         the default constructor builder with our hashtable for methodbuilders
11286         to methodcores.
11287
11288         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11289         and argument_count is 0 in which case we have a match.
11290         (Binary::ResolveOperator): More null checking and miscellaneous coding
11291         style cleanup.
11292
11293 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11294
11295         * rootcontext.cs (IsNameSpace): Compare against null.
11296
11297         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11298
11299         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11300         and Unary::Operator.
11301
11302         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11303         accordingly.
11304
11305         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11306         we have overloaded operators.
11307         (Binary::ResolveOperator): Implement the part which does the operator overload
11308         resolution.
11309
11310         * class.cs (Operator::Emit): Implement.
11311         (TypeContainer::Emit): Emit the operators we have too.
11312
11313         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11314         the case when we have a user-defined operator.
11315         
11316 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11317
11318         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11319
11320 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11321
11322         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11323         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11324         (Constructor::Emit): Implement.
11325         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11326         if we have no work to do. 
11327         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11328         Emit method.
11329
11330         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11331         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11332
11333         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11334         of parent.parent.
11335
11336 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11337
11338         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11339         in the source.
11340         (Tree::RecordNamespace): Method to do what the name says ;-)
11341         (Tree::Namespaces): Property to get at the namespaces hashtable.
11342
11343         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11344         keep track.
11345
11346         * rootcontext.cs (IsNamespace): Fixed it :-)
11347
11348 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11349
11350         * class.cs (TypeContainer::FindMembers): Add support for
11351         constructors. 
11352         (MethodCore): New class that encapsulates both the shared aspects
11353         of a Constructor and a Method.  
11354         (Method, Constructor): Factored pieces into MethodCore.
11355
11356         * driver.cs: Added --fatal which makes errors throw exceptions.
11357         Load System assembly as well as part of the standard library.
11358
11359         * report.cs: Allow throwing exceptions on errors for debugging.
11360
11361         * modifiers.cs: Do not use `parent', instead use the real type
11362         container to evaluate permission settings.
11363
11364         * class.cs: Put Ravi's patch back in.  He is right, and we will
11365         have to cope with the
11366
11367 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11368
11369         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11370         FamORAssem, not FamANDAssem.
11371         
11372 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11373
11374         * driver.cs: Added --parse option that only parses its input files
11375         and terminates.
11376
11377         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11378         incorrect.  IsTopLevel is not used to tell whether an object is
11379         root_types or not (that can be achieved by testing this ==
11380         root_types).  But to see if this is a top-level *class* (not
11381         necessarly our "toplevel" container). 
11382
11383 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11384
11385         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11386         parent instead of a direct call to GetType.
11387
11388 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11389
11390         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11391         Modifiers.TypeAttr. This should just be a call to that method.
11392
11393         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11394         object so that we can determine if we are top-level or not.
11395
11396         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11397         TypeContainer too.
11398
11399         * enum.cs (Enum::Define): Ditto.
11400
11401         * modifiers.cs (FieldAttr): Re-write.
11402
11403         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11404         (TypeContainer::HaveStaticConstructor): New property to provide access
11405         to precisely that info.
11406
11407         * modifiers.cs (MethodAttr): Re-write.
11408         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11409
11410         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11411         of top-level types as claimed.
11412         
11413 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11414
11415         * expression.cs (MemberLookup): Fruitless attempt to lookup
11416         constructors.  Maybe I need to emit default constructors?  That
11417         might be it (currently .NET emits this for me automatically).
11418         (Invocation::OverloadResolve): Cope with Arguments == null.
11419         (Invocation::EmitArguments): new function, shared by the new
11420         constructor and us.
11421         (Invocation::Emit): Handle static and instance methods.  Emit
11422         proper call instruction for virtual or non-virtual invocations.
11423         (New::Emit): Implement.
11424         (New::Resolve): Implement.
11425         (MemberAccess:Resolve): Implement.
11426         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11427         to track instances.
11428         (FieldExpr::Resolve): Set type.
11429
11430         * support.cs: Handle empty arguments.
11431                 
11432         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11433         SimpleLookup): Auxiliary routines to help parse a qualifier
11434         identifier.  
11435
11436         Update qualifier_identifier rule.
11437
11438         * codegen.cs: Removed debugging messages.
11439
11440         * class.cs: Make this a global thing, this acts just as a "key" to
11441         objects that we might have around.
11442
11443         (Populate): Only initialize method_builders_to_methods once.
11444
11445         * expression.cs (PropertyExpr): Initialize type from the
11446         PropertyType. 
11447
11448         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11449         Resolve pattern.  Attempt to implicitly convert value to boolean.
11450         Emit code.
11451
11452         * expression.cs: Set the type for the int32/int32 argument case.
11453         (Binary::ResolveOperator): Set the return type to boolean for
11454         comparission operators
11455
11456         * typemanager.cs: Remove debugging print code.
11457
11458         (Invocation::Resolve): resolve type.
11459
11460         * class.cs: Allocate a MemberInfo of the correct size, as the code
11461         elsewhere depends on the test to reflect the correct contents.
11462
11463         (Method::) Keep track of parameters, due to System.Reflection holes
11464
11465         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11466         mapping here.
11467
11468         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11469         of the exact size and return that.
11470
11471         (Class::LookupMethodByBuilder): New function that maps
11472         MethodBuilders to its methods.  Required to locate the information
11473         on methods because System.Reflection bit us again.
11474
11475         * support.cs: New file, contains an interface ParameterData and
11476         two implementations: ReflectionParameters and InternalParameters
11477         used to access Parameter information.  We will need to grow this
11478         as required.
11479
11480         * expression.cs (Invocation::GetParameterData): implement a cache
11481         and a wrapper around the ParameterData creation for methods. 
11482         (Invocation::OverloadResolve): Use new code.
11483
11484 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11485
11486         * class.cs (TypeContainer::EmitField): Remove and move into 
11487         (Field::Define): here and modify accordingly.
11488         (Field.FieldBuilder): New member.
11489         (TypeContainer::Populate): Update accordingly.
11490         (TypeContainer::FindMembers): Implement.
11491
11492 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11493
11494         * statement.cs: (VariableInfo::VariableType): New field to be
11495         initialized with the full type once it is resolved. 
11496
11497 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
11498
11499         * parameter.cs (GetParameterInfo): Use a type cache to compute
11500         things only once, and to reuse this information
11501
11502         * expression.cs (LocalVariableReference::Emit): Implement.
11503         (OpcodeCast::Emit): fix.
11504
11505         (ParameterReference::Resolve): Implement.
11506         (ParameterReference::Emit): Implement.
11507
11508         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11509         that are expressions need to stay as Expressions.
11510
11511         * typemanager.cs (CSharpName): Returns the C# name of a type if
11512         possible. 
11513
11514         * expression.cs (Expression::ConvertImplicit): New function that
11515         implements implicit type conversions.
11516
11517         (Expression::ImplicitReferenceConversion): Implements implicit
11518         reference conversions.
11519
11520         (EmptyCast): New type for transparent casts.
11521
11522         (OpcodeCast): New type for casts of types that are performed with
11523         a sequence of bytecodes.
11524         
11525         (BoxedCast): New type used for casting value types into reference
11526         types.  Emits a box opcode.
11527
11528         (Binary::DoNumericPromotions): Implements numeric promotions of
11529         and computation of the Binary::Type.
11530
11531         (Binary::EmitBranchable): Optimization.
11532
11533         (Binary::Emit): Implement code emission for expressions.
11534         
11535         * typemanager.cs (TypeManager): Added two new core types: sbyte
11536         and byte.
11537
11538 2001-09-12  Ravi Pratap  <ravi@ximian.com>
11539
11540         * class.cs (TypeContainer::FindMembers): Method which does exactly
11541         what Type.FindMembers does, only we don't have to use reflection. No
11542         implementation yet.
11543
11544         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11545         typecontainer objects as we need to get at them.
11546         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11547
11548         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11549         typecontainer object.
11550
11551         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11552         of just a Report object.
11553
11554 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11555
11556         * class.cs (Event::Define): Go back to using the prefixes "add_" and
11557         "remove_"
11558         (TypeContainer::Populate): Now define the delegates of the type too.
11559         (TypeContainer.Delegates): Property to access the list of delegates defined
11560         in the type.
11561
11562         * delegates.cs (Delegate::Define): Implement partially.
11563
11564         * modifiers.cs (TypeAttr): Handle more flags.
11565
11566 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11567
11568         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11569         and not <=
11570         (Operator::Define): Re-write logic to get types by using the LookupType method
11571         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11572         (Indexer::Define): Ditto.
11573         (Event::Define): Ditto.
11574         (Property::Define): Ditto.
11575         
11576 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11577
11578         * class.cs (TypeContainer::Populate): Now define operators too. 
11579         (TypeContainer.Operators): New property to access the list of operators
11580         in a type.
11581         (Operator.OperatorMethodBuilder): New member to hold the method builder
11582         for the operator we are defining.
11583         (Operator::Define): Implement.
11584
11585 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11586
11587         * class.cs (Event::Define): Make the prefixes of the accessor methods
11588         addOn_ and removeOn_ 
11589
11590         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11591         of the location being passed in too. Ideally, this should go later since all
11592         error reporting should be done through the Report object.
11593
11594         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11595         (Populate): Iterate thru the indexers we have and define them too.
11596         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11597         for the get and set accessors.
11598         (Indexer::Define): Implement.
11599         
11600 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
11601
11602         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
11603         my previous implementation, did not work.
11604
11605         * typemanager.cs: Add a couple of missing types (the longs).
11606
11607         * literal.cs: Use TypeManager.bool_type instead of getting it.
11608
11609         * expression.cs (EventExpr): New kind of expressions.
11610         (Expressio::ExprClassFromMemberInfo): finish
11611
11612 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
11613
11614         * assign.cs: Emit stores to static fields differently.
11615
11616 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11617
11618         * Merge in changes and adjust code to tackle conflicts. Backed out my
11619         code in Assign::Resolve ;-) 
11620
11621 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11622
11623         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11624         instead Report.Error and also pass in the location.
11625         (CSharpParser::Lexer): New readonly property to return the reference
11626         to the Tokenizer object.
11627         (declare_local_variables): Use Report.Error with location instead of plain 
11628         old error.
11629         (CheckDef): Ditto.
11630
11631         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11632         (Operator.CheckBinaryOperator): Ditto.
11633
11634         * cs-parser.jay (operator_declarator): Update accordingly.
11635
11636         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11637         (CheckBinaryOperator): Same here.
11638
11639         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11640         on the name without any prefixes of namespace names etc. This is because we
11641         already might have something already fully qualified like 
11642         'System.Console.WriteLine'
11643
11644         * assign.cs (Resolve): Begin implementation. Stuck ;-)
11645
11646 2001-09-07  Ravi Pratap  <ravi@ximian.com>
11647
11648         * cs-tokenizer.cs (location): Return a string which also contains
11649         the file name.
11650
11651         * expression.cs (ElementAccess): New class for expressions of the
11652         type 'element access.'
11653         (BaseAccess): New class for expressions of the type 'base access.'
11654         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11655         respectively.
11656         
11657         * cs-parser.jay (element_access): Implement action.
11658         (base_access): Implement actions.
11659         (checked_expression, unchecked_expression): Implement.
11660
11661         * cs-parser.jay (local_variable_type): Correct and implement.
11662         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11663
11664         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11665
11666         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11667         name and the specifiers.
11668
11669         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11670         
11671         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
11672         making them all public ;-)
11673
11674         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11675         class anyways.
11676         
11677 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
11678
11679         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11680         PropertyExprs.
11681         (FieldExpr, PropertyExprs): New resolved expressions.
11682         (SimpleName::MemberStaticCheck): Perform static checks for access
11683         to non-static fields on static methods. Maybe this should be
11684         generalized for MemberAccesses. 
11685         (SimpleName::ResolveSimpleName): More work on simple name
11686         resolution. 
11687
11688         * cs-parser.jay (primary_expression/qualified_identifier): track
11689         the parameter index.
11690
11691         * codegen.cs (CodeGen::Save): Catch save exception, report error.
11692         (EmitContext::EmitBoolExpression): Chain to expression generation
11693         instead of temporary hack.
11694         (::EmitStatementExpression): Put generic expression code generation.
11695
11696         * assign.cs (Assign::Emit): Implement variable assignments to
11697         local variables, parameters and fields.
11698
11699 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
11700
11701         * statement.cs (Block::GetVariableInfo): New method, returns the
11702         VariableInfo for a variable name in a block.
11703         (Block::GetVariableType): Implement in terms of GetVariableInfo
11704
11705         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
11706         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
11707
11708 2001-09-06  Ravi Pratap  <ravi@ximian.com>
11709
11710         * cs-parser.jay (operator_declaration): Continue on my quest : update
11711         to take attributes argument.
11712         (event_declaration): Ditto.
11713         (enum_declaration): Ditto.
11714         (indexer_declaration): Ditto.
11715         
11716         * class.cs (Operator::Operator): Update constructor accordingly.
11717         (Event::Event): Ditto.
11718
11719         * delegate.cs (Delegate::Delegate): Same here.
11720
11721         * enum.cs (Enum::Enum): Same here.
11722         
11723 2001-09-05  Ravi Pratap  <ravi@ximian.com>
11724
11725         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
11726
11727         * ../tests/cs0658.cs : New file to demonstrate error 0658.
11728
11729         * attribute.cs (Attributes): New class to encapsulate all attributes which were
11730         being passed around as an arraylist.
11731         (Attributes::AddAttribute): Method to add attribute sections.
11732
11733         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
11734         (struct_declaration): Update accordingly.
11735         (constant_declaration): Update.
11736         (field_declaration): Update.
11737         (method_header): Update.
11738         (fixed_parameter): Update.
11739         (parameter_array): Ditto.
11740         (property_declaration): Ditto.
11741         (destructor_declaration): Ditto.
11742         
11743         * class.cs (Struct::Struct): Update constructors accordingly.
11744         (Class::Class): Ditto.
11745         (Field::Field): Ditto.
11746         (Method::Method): Ditto.
11747         (Property::Property): Ditto.
11748         (TypeContainer::OptAttribute): update property's return type.
11749         
11750         * interface.cs (Interface.opt_attributes): New member.
11751         (Interface::Interface): Update to take the extra Attributes argument.
11752
11753         * parameter.cs (Parameter::Parameter): Ditto.
11754
11755         * constant.cs (Constant::Constant): Ditto.
11756
11757         * interface.cs (InterfaceMemberBase): New OptAttributes field.
11758         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
11759         the attributes as a parameter.
11760         (InterfaceProperty): Update constructor call.
11761         (InterfaceEvent): Ditto.
11762         (InterfaceMethod): Ditto.
11763         (InterfaceIndexer): Ditto.
11764
11765         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
11766         pass the attributes too.
11767         (interface_event_declaration): Ditto.
11768         (interface_property_declaration): Ditto.
11769         (interface_method_declaration): Ditto.
11770         (interface_declaration): Ditto.
11771
11772 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
11773
11774         * class.cs (Method::Define): Track the "static Main" definition to
11775         create an entry point. 
11776
11777         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11778         EntryPoint if we find it. 
11779
11780         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11781         (EmitContext::ig): Make this variable public.
11782
11783         * driver.cs: Make the default output file be the first file name
11784         with the .exe extension.  
11785
11786         Detect empty compilations
11787
11788         Handle various kinds of output targets.  Handle --target and
11789         rename -t to --dumper.
11790
11791         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11792         methods inherited from Expression return now an Expression.  This
11793         will is used during the tree rewriting as we resolve them during
11794         semantic analysis.
11795
11796         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11797         the spec.  Missing entirely is the information about
11798         accessability of elements of it.
11799
11800         (Expression::ExprClassFromMemberInfo): New constructor for
11801         Expressions that creates a fully initialized Expression based on
11802         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11803         a Type.
11804
11805         (Invocation::Resolve): Begin implementing resolution of invocations.
11806         
11807         * literal.cs (StringLiteral):  Implement Emit.
11808
11809 2001-09-05  Ravi Pratap  <ravi@ximian.com>
11810
11811         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
11812         member.
11813         
11814 2001-09-04  Ravi Pratap  <ravi@ximian.com>
11815
11816         * cs-parser.jay (attribute_arguments): Implement actions.
11817         (attribute): Fix bug in production. Implement action.
11818         (attribute_list): Implement.
11819         (attribute_target): Implement.
11820         (attribute_target_specifier, opt_target_specifier): Implement
11821         (CheckAttributeTarget): New method to check if the attribute target
11822         is valid.
11823         (attribute_section): Implement.
11824         (opt_attributes): Implement.
11825
11826         * attribute.cs : New file to handle attributes.
11827         (Attribute): Class to hold attribute info.
11828
11829         * cs-parser.jay (opt_attribute_target_specifier): Remove production
11830         (attribute_section): Modify production to use 2 different rules to 
11831         achieve the same thing. 1 s/r conflict down !
11832         Clean out commented, useless, non-reducing dimension_separator rules.
11833         
11834         * class.cs (TypeContainer.attributes): New member to hold list
11835         of attributes for a type.
11836         (Struct::Struct): Modify to take one more argument, the attribute list.
11837         (Class::Class): Ditto.
11838         (Field::Field): Ditto.
11839         (Method::Method): Ditto.
11840         (Property::Property): Ditto.
11841         
11842         * cs-parser.jay (struct_declaration): Update constructor call to
11843         pass in the attributes too.
11844         (class_declaration): Ditto.
11845         (constant_declaration): Ditto.
11846         (field_declaration): Ditto.
11847         (method_header): Ditto.
11848         (fixed_parameter): Ditto.
11849         (parameter_array): Ditto.
11850         (property_declaration): Ditto.
11851
11852         * constant.cs (Constant::Constant): Update constructor similarly.
11853         Use System.Collections.
11854
11855         * parameter.cs (Parameter::Parameter): Update as above.
11856
11857 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11858
11859         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
11860         (TypeContainer.delegates): New member to hold list of delegates.
11861
11862         * cs-parser.jay (delegate_declaration): Implement the action correctly 
11863         this time as I seem to be on crack ;-)
11864
11865 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
11866
11867         * rootcontext.cs (RootContext::IsNamespace): new function, used to
11868         tell whether an identifier represents a namespace.
11869
11870         * expression.cs (NamespaceExpr): A namespace expression, used only
11871         temporarly during expression resolution.
11872         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
11873         utility functions to resolve names on expressions.
11874
11875 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
11876
11877         * codegen.cs: Add hook for StatementExpressions. 
11878
11879         * class.cs: Fix inverted test for static flag in methods.
11880
11881 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11882
11883         * class.cs (Operator::CheckUnaryOperator): Correct error number used
11884         to make it coincide with MS' number.
11885         (Operator::CheckBinaryOperator): Ditto.
11886
11887         * ../errors/errors.txt : Remove error numbers added earlier.
11888
11889         * ../errors/cs1019.cs : Test case for error # 1019
11890
11891         * ../errros/cs1020.cs : Test case for error # 1020
11892
11893         * cs-parser.jay : Clean out commented cruft.
11894         (dimension_separators, dimension_separator): Comment out. Ostensibly not
11895         used anywhere - non-reducing rule.
11896         (namespace_declarations): Non-reducing rule - comment out.
11897
11898         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
11899         with TypeContainer::AddEnum.
11900
11901         * delegate.cs : New file for delegate handling classes.
11902         (Delegate): Class for declaring delegates.
11903
11904         * makefile : Update.
11905
11906         * cs-parser.jay (delegate_declaration): Implement.
11907
11908 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
11909
11910         * class.cs (Event::Define): Implement.
11911         (Event.EventBuilder): New member.
11912
11913         * class.cs (TypeContainer::Populate): Update to define all enums and events
11914         we have.
11915         (Events): New property for the events arraylist we hold. Shouldn't we move to using
11916         readonly fields for all these cases ?
11917
11918 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11919
11920         * class.cs (Property): Revamp to use the convention of making fields readonly.
11921         Accordingly modify code elsewhere.
11922
11923         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
11924         the Define method of the Property class.
11925
11926         * class.cs : Clean up applied patch and update references to variables etc. Fix 
11927         trivial bug.
11928         (TypeContainer::Populate): Update to define all the properties we have. Also
11929         define all enumerations.
11930
11931         * enum.cs (Define): Implement.
11932         
11933 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11934
11935         * cs-parser.jay (overloadable_operator): The semantic value is an
11936         enum of the Operator class.
11937         (operator_declarator): Implement actions.
11938         (operator_declaration): Implement.
11939
11940         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
11941         validity of definitions.
11942         (Operator::CheckBinaryOperator): Static method to check for binary operators
11943         (TypeContainer::AddOperator): New method to add an operator to a type.
11944
11945         * cs-parser.jay (indexer_declaration): Added line to actually call the
11946         AddIndexer method so it gets added ;-)
11947
11948         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
11949         already taken care of by the MS compiler ?  
11950
11951 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11952
11953         * class.cs (Operator): New class for operator declarations.
11954         (Operator::OpType): Enum for the various operators.
11955
11956 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11957
11958         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
11959         ostensibly handle this in semantic analysis.
11960
11961         * cs-parser.jay (general_catch_clause): Comment out
11962         (specific_catch_clauses, specific_catch_clause): Ditto.
11963         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
11964         (catch_args, opt_catch_args): New productions.
11965         (catch_clause): Rewrite to use the new productions above
11966         (catch_clauses): Modify accordingly.
11967         (opt_catch_clauses): New production to use in try_statement
11968         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
11969         and re-write the code in the actions to extract the specific and
11970         general catch clauses by being a little smart ;-)
11971
11972         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
11973         Hooray, try and catch statements parse fine !
11974         
11975 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11976
11977         * statement.cs (Block::GetVariableType): Fix logic to extract the type
11978         string from the hashtable of variables.
11979
11980         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11981         I end up making that mistake ;-)
11982         (catch_clauses): Fixed gross error which made Key and Value of the 
11983         DictionaryEntry the same : $1 !!
11984
11985 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11986
11987         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11988
11989         * cs-parser.jay (event_declaration): Correct to remove the semicolon
11990         when the add and remove accessors are specified. 
11991
11992 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11993
11994         * cs-parser.jay (IndexerDeclaration): New helper class to hold
11995         information about indexer_declarator.
11996         (indexer_declarator): Implement actions.
11997         (parsing_indexer): New local boolean used to keep track of whether
11998         we are parsing indexers or properties. This is necessary because 
11999         implicit_parameters come into picture even for the get accessor in the 
12000         case of an indexer.
12001         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12002
12003         * class.cs (Indexer): New class for indexer declarations.
12004         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12005         (TypeContainer::indexers): New member to hold list of indexers for the
12006         type.
12007
12008 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12009
12010         * cs-parser.jay (add_accessor_declaration): Implement action.
12011         (remove_accessor_declaration): Implement action.
12012         (event_accessors_declaration): Implement
12013         (variable_declarators): swap statements for first rule - trivial.
12014
12015         * class.cs (Event): New class to hold information about event
12016         declarations.
12017         (TypeContainer::AddEvent): New method to add an event to a type
12018         (TypeContainer::events): New member to hold list of events.
12019
12020         * cs-parser.jay (event_declaration): Implement actions.
12021
12022 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12023
12024         * cs-parser.jay (dim_separators): Implement. Make it a string
12025         concatenating all the commas together, just as they appear.
12026         (opt_dim_separators): Modify accordingly
12027         (rank_specifiers): Update accordingly. Basically do the same
12028         thing - instead, collect the brackets here.
12029         (opt_rank_sepcifiers): Modify accordingly.
12030         (array_type): Modify to actually return the complete type string
12031         instead of ignoring the rank_specifiers.
12032         (expression_list): Implement to collect the expressions
12033         (variable_initializer): Implement. We make it a list of expressions
12034         essentially so that we can handle the array_initializer case neatly too.
12035         (variable_initializer_list): Implement.
12036         (array_initializer): Make it a list of variable_initializers
12037         (opt_array_initializer): Modify accordingly.
12038
12039         * expression.cs (New::NType): Add enumeration to help us
12040         keep track of whether we have an object/delegate creation
12041         or an array creation.
12042         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12043         members to hold data about array creation.
12044         (New:New): Modify to update NewType
12045         (New:New): New Overloaded contructor for the array creation
12046         case.
12047
12048         * cs-parser.jay (array_creation_expression): Implement to call
12049         the overloaded New constructor.
12050         
12051 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12052
12053         * class.cs (TypeContainer::Constructors): Return member
12054         constructors instead of returning null.
12055
12056 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12057
12058         * typemanager.cs (InitCoreTypes): Initialize the various core
12059         types after we have populated the type manager with the user
12060         defined types (this distinction will be important later while
12061         compiling corlib.dll)
12062
12063         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12064         on Expression Classification.  Now all expressions have a method
12065         `Resolve' and a method `Emit'.
12066
12067         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12068         generation from working.     Also add some temporary debugging
12069         code. 
12070         
12071 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12072
12073         * codegen.cs: Lots of code generation pieces.  This is only the
12074         beginning, will continue tomorrow with more touches of polish.  We
12075         handle the fundamentals of if, while, do, for, return.  Others are
12076         trickier and I need to start working on invocations soon.
12077         
12078         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12079         s.InitStatement. 
12080
12081         * codegen.cs (EmitContext): New struct, used during code
12082         emission to keep a context.   Most of the code generation will be
12083         here. 
12084
12085         * cs-parser.jay: Add embedded blocks to the list of statements of
12086         this block.  So code generation proceeds in a top down fashion.
12087
12088 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12089
12090         * statement.cs: Add support for multiple child blocks.
12091
12092 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12093
12094         * codegen.cs (EmitCode): New function, will emit the code for a
12095         Block of code given a TypeContainer and its ILGenerator. 
12096
12097         * statement.cs (Block): Standard public readonly optimization.
12098         (Block::Block constructors): Link children. 
12099         (Block::Child): Child Linker.
12100         (Block::EmitVariables): Emits IL variable declarations.
12101
12102         * class.cs: Drop support for MethodGroups here, delay until
12103         Semantic Analysis.
12104         (Method::): Applied the same simplification that I did before, and
12105         move from Properties to public readonly fields.
12106         (Method::ParameterTypes): Returns the parameter types for the
12107         function, and implements a cache that will be useful later when I
12108         do error checking and the semantic analysis on the methods is
12109         performed.
12110         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12111         and made a method, optional argument tells whether this is a class
12112         or a structure to apply the `has-this' bit.
12113         (Method::GetCallingConvention): Implement, returns the calling
12114         convention. 
12115         (Method::Define): Defines the type, a second pass is performed
12116         later to populate the methods.
12117
12118         (Constructor::ParameterTypes): implement a cache similar to the
12119         one on Method::ParameterTypes, useful later when we do semantic
12120         analysis. 
12121
12122         (TypeContainer::EmitMethod):  New method.  Emits methods.
12123
12124         * expression.cs: Removed MethodGroup class from here.
12125         
12126         * parameter.cs (Parameters::GetCallingConvention): new method.
12127
12128 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12129
12130         * class.cs (TypeContainer::Populate): Drop RootContext from the
12131         argument. 
12132
12133         (Constructor::CallingConvention): Returns the calling convention.
12134         (Constructor::ParameterTypes): Returns the constructor parameter
12135         types. 
12136         
12137         (TypeContainer::AddConstructor): Keep track of default constructor
12138         and the default static constructor.
12139
12140         (Constructor::) Another class that starts using `public readonly'
12141         instead of properties. 
12142
12143         (Constructor::IsDefault): Whether this is a default constructor. 
12144
12145         (Field::) use readonly public fields instead of properties also.
12146
12147         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12148         track of static constructors;  If none is used, turn on
12149         BeforeFieldInit in the TypeAttributes. 
12150
12151         * cs-parser.jay (opt_argument_list): now the return can be null
12152         for the cases where there are no arguments. 
12153
12154         (constructor_declarator): If there is no implicit `base' or
12155         `this', then invoke the default parent constructor. 
12156         
12157         * modifiers.cs (MethodAttr): New static function maps a set of
12158         modifiers flags into a MethodAttributes enum
12159         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12160         MethodAttr, TypeAttr to represent the various mappings where the
12161         modifiers are used.
12162         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12163
12164 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12165
12166         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12167         method arguments.
12168
12169         * interface.cs (PopulateIndexer): Implemented the code generator
12170         for interface indexers.
12171
12172 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12173
12174         * interface.cs (InterfaceMemberBase): Now we track the new status
12175         here.  
12176
12177         (PopulateProperty): Implement property population.  Woohoo!  Got
12178         Methods and Properties going today. 
12179
12180         Removed all the properties for interfaces, and replaced them with
12181         `public readonly' fields. 
12182
12183 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12184
12185         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12186         initialize their hashtables/arraylists only when they are needed
12187         instead of doing this always.
12188
12189         * parameter.cs: Handle refs and out parameters.
12190
12191         * cs-parser.jay: Use an ArrayList to construct the arguments
12192         instead of the ParameterCollection, and then cast that to a
12193         Parameter[] array.
12194
12195         * parameter.cs: Drop the use of ParameterCollection and use
12196         instead arrays of Parameters.
12197
12198         (GetParameterInfo): Use the Type, not the Name when resolving
12199         types. 
12200
12201 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12202
12203         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12204         and instead use public readonly fields.
12205
12206         * class.cs: Put back walking code for type containers.
12207
12208 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12209
12210         * class.cs (MakeConstant): Code to define constants.
12211
12212         * rootcontext.cs (LookupType): New function.  Used to locate types 
12213
12214         
12215 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12216
12217         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12218         this System.Reflection code is.  Kudos to Microsoft
12219         
12220         * typemanager.cs: Implement a type cache and avoid loading all
12221         types at boot time.  Wrap in LookupType the internals.  This made
12222         the compiler so much faster.  Wow.  I rule!
12223         
12224         * driver.cs: Make sure we always load mscorlib first (for
12225         debugging purposes, nothing really important).
12226
12227         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12228         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12229
12230         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12231         on namespaces that have been imported using the `using' keyword.
12232
12233         * class.cs (TypeContainer::TypeAttr): Virtualize.
12234         (Class::TypeAttr): Return attributes suitable for this bad boy.
12235         (Struct::TypeAttr): ditto.
12236         Handle nested classes.
12237         (TypeContainer::) Remove all the type visiting code, it is now
12238         replaced with the rootcontext.cs code
12239
12240         * rootcontext.cs (GetClassBases): Added support for structs. 
12241
12242 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12243
12244         * interface.cs, statement.cs, class.cs, parameter.cs,
12245         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12246         Drop use of TypeRefs, and use strings instead.
12247
12248 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12249
12250         * rootcontext.cs: 
12251
12252         * class.cs (Struct::Struct): set the SEALED flags after
12253         checking the modifiers.
12254         (TypeContainer::TypeAttr): new property, returns the
12255         TypeAttributes for a class.  
12256
12257         * cs-parser.jay (type_list): Oops, list production was creating a
12258         new list of base types.
12259
12260         * rootcontext.cs (StdLib): New property.
12261         (GetInterfaceTypeByName): returns an interface by type name, and
12262         encapsulates error handling here.
12263         (GetInterfaces): simplified.
12264         (ResolveTree): Encapsulated all the tree resolution here.
12265         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12266         types. 
12267         
12268         * driver.cs: Add support for --nostdlib, to avoid loading the
12269         default assemblies.
12270         (Main): Do not put tree resolution here. 
12271
12272         * rootcontext.cs: Beginning of the class resolution.
12273
12274 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12275
12276         * rootcontext.cs: Provide better error reporting. 
12277
12278         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12279
12280         * rootcontext.cs (CreateInterface): Handle the case where there
12281         are no parent interfaces.
12282         
12283         (CloseTypes): Routine to flush types at the end.
12284         (CreateInterface): Track types.
12285         (GetInterfaces): Returns an array of Types from the list of
12286         defined interfaces.
12287
12288         * typemanager.c (AddUserType): Mechanism to track user types (puts
12289         the type on the global type hash, and allows us to close it at the
12290         end). 
12291         
12292 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12293
12294         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12295         RecordInterface instead.
12296
12297         * cs-parser.jay: Updated to reflect changes above.
12298
12299         * decl.cs (Definition): Keep track of the TypeBuilder type that
12300         represents this type here.  Not sure we will use it in the long
12301         run, but wont hurt for now.
12302
12303         * driver.cs: Smaller changes to accomodate the new code.
12304
12305         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12306         when done. 
12307
12308         * rootcontext.cs (CreateInterface):  New method, used to create
12309         the System.TypeBuilder type for interfaces.
12310         (ResolveInterfaces): new entry point to resolve the interface
12311         hierarchy. 
12312         (CodeGen): Property, used to keep track of the code generator.
12313
12314 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12315
12316         * cs-parser.jay: Add a second production for delegate_declaration
12317         with `VOID'.
12318
12319         (enum_body): Put an opt_comma here instead of putting it on
12320         enum_body or enum_member_declarations so we can handle trailing
12321         commas on enumeration members.  Gets rid of a shift/reduce.
12322         
12323         (type_list): Need a COMMA in the middle.
12324
12325         (indexer_declaration): Tell tokenizer to recognize get/set
12326
12327         * Remove old targets.
12328
12329         * Re-add the parser target.
12330
12331 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12332
12333         * cs-parser.jay: Add precendence rules for a number of operators
12334         ot reduce the number of shift/reduce conflicts in the grammar.
12335         
12336 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12337
12338         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12339         and put it here.
12340
12341         Get rid of old crufty code.
12342
12343         * rootcontext.cs: Use this to keep track of the parsed
12344         representation and the defined types available to the program. 
12345
12346         * gen-treedump.cs: adjust for new convention.
12347
12348         * type.cs: Split out the type manager, and the assembly builder
12349         from here. 
12350
12351         * typemanager.cs: the type manager will live here now.
12352
12353         * cil-codegen.cs: And the code generator here. 
12354
12355 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12356
12357         * makefile: Fixed up for easy making.
12358
12359 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12360
12361         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12362         the 
12363
12364         (unary_expression): Expand pre_increment_expression and
12365         post_decrement_expression to reduce a shift/reduce.
12366
12367 2001-07-11  Simon Cozens
12368
12369         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12370
12371         Improve allow_keyword_as_indent name.
12372
12373 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12374
12375         * Adjustments for Beta2. 
12376
12377 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12378
12379         * decl.cs: Added `Define' abstract method.
12380         (InTransit): new property, used to catch recursive definitions. 
12381
12382         * interface.cs: Implement `Define'. 
12383
12384         * modifiers.cs: Map Modifiers.constants to
12385         System.Reflection.TypeAttribute flags.
12386
12387         * class.cs: Keep track of types and user-defined types.
12388         (BuilderInit): New method for creating an assembly
12389         (ResolveType): New function to launch the resolution process, only
12390         used by interfaces for now.
12391
12392         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12393         that are inserted into the name space. 
12394
12395 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12396
12397         * ARGH.  I have screwed up my tree so many times due to the use of
12398         rsync rather than using CVS.  Going to fix this at once. 
12399
12400         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12401         load types.
12402
12403 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12404
12405         * Experiment successful: Use System.Type rather that our own
12406         version of Type.  
12407
12408 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12409
12410         * cs-parser.jay: Removed nsAliases from here.
12411
12412         Use new namespaces, handle `using XXX;' 
12413
12414         * namespace.cs: Reimplemented namespace handling, use a recursive
12415         definition of the class.  Now we can keep track of using clauses
12416         and catch invalid using clauses.
12417
12418 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12419
12420         * gen-treedump.cs: Adapted for all the renaming.
12421
12422         * expression.cs (Expression): this class now has a Type property
12423         which returns an expression Type.
12424
12425         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12426         `Type', as this has a different meaning now in the base
12427
12428 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12429
12430         * interface.cs, class.cs: Removed from all the sources the
12431         references to signature computation, as we can not do method
12432         signature computation during the parsing time, as we are not
12433         trying to solve at that point distinguishing:
12434
12435         class X {
12436                 void a (Blah x) {}
12437                 void a (NS.Blah x) {}
12438         }
12439
12440         Which depending on the context might be valid or not, as we do not
12441         know if Blah is the same thing as NS.Blah at that point.
12442
12443         * Redid everything so the code uses TypeRefs now instead of
12444         Types.  TypeRefs are just temporary type placeholders, that need
12445         to be resolved.  They initially have a pointer to a string and the
12446         current scope in which they are used.  This is used later by the
12447         compiler to resolve the reference to an actual Type. 
12448
12449         * DeclSpace is no longer a CIR.Type, and neither are
12450         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12451         are all DeclSpaces, but no Types. 
12452
12453         * type.cs (TypeRefManager): This implements the TypeRef manager,
12454         which keeps track of all the types that need to be resolved after
12455         the parsing has finished. 
12456
12457 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12458
12459         * ARGH.  We are going to have to store `foreach' as a class rather
12460         than resolving it, as we need to verify error 1579 after name
12461         resolution.   *OR* we could keep a flag that says `This request to
12462         IEnumerator comes from a foreach statement' which we can then use
12463         to generate the error.
12464
12465 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12466
12467         * class.cs (TypeContainer.AddMethod): we now add methods to the
12468         MethodGroup instead of the method hashtable.  
12469
12470         * expression.cs: Add MethodGroup abstraction, which gets us one
12471         step closer to the specification in the way we handle method
12472         declarations.  
12473
12474         * cs-parser.jay (primary_expression): qualified_identifier now
12475         tried to match up an identifier to a local variable reference or
12476         to a parameter reference.
12477
12478         current_local_parameters is now a parser global variable that
12479         points to the current parameters for the block, used during name
12480         lookup.
12481
12482         (property_declaration): Now creates an implicit `value' argument to
12483         the set accessor.
12484
12485 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12486
12487         * parameter.cs: Do not use `param' arguments as part of the
12488         signature, per the spec.
12489
12490 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
12491
12492         * decl.cs: Base class for classes, structs and interfaces.  This
12493         is the "Declaration Space" 
12494
12495         * cs-parser.jay: Use CheckDef for checking declaration errors
12496         instead of having one on each function.
12497
12498         * class.cs: Factor out some code for handling error handling in
12499         accordance to the "Declarations" section in the "Basic Concepts"
12500         chapter in the ECMA C# spec.
12501
12502         * interface.cs: Make all interface member classes derive from
12503         InterfaceMemberBase.
12504
12505 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
12506
12507         * Many things: all interfaces are parsed and generated in
12508         gen-treedump.  Support for member variables, constructors,
12509         destructors, properties, constants is there.
12510
12511         Beginning of the IL backend, but very little done, just there for
12512         testing purposes. 
12513
12514 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
12515
12516         * cs-parser.jay: Fix labeled statement.
12517
12518         * cs-tokenizer.cs (escape): Escape " and ' always.
12519         ref_line, ref_name: keep track of the line/filename as instructed
12520         by #line by the compiler.
12521         Parse #line.
12522
12523 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
12524
12525         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12526         to match the values in System.CodeDOM.
12527
12528         Divid renamed to Divide.
12529
12530         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12531         statements. 
12532         (Statements.set): remove.
12533
12534         * System.CodeDOM/CodeCatchClause.cs: always have a valid
12535         statements. 
12536
12537         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12538         falseStatements always have valid values. 
12539
12540         * cs-parser.jay: Use System.CodeDOM now.
12541